| 101 | } |
| 102 | |
| 103 | static struct cd_toc *gettoc (int unitnum, struct cd_toc_head *th, int block) |
| 104 | { |
| 105 | if (th->lastaddress == 0) { |
| 106 | if (unitnum < 0) |
| 107 | return NULL; |
| 108 | if (!sys_command_cd_toc(unitnum, th)) |
| 109 | return NULL; |
| 110 | } |
| 111 | for (int i = th->first_track_offset + 1; i <= th->last_track_offset; i++) { |
| 112 | struct cd_toc *t = &th->toc[i]; |
| 113 | if (block < t->paddress) |
| 114 | return t - 1; |
| 115 | } |
| 116 | return &th->toc[th->last_track_offset]; |
| 117 | } |
| 118 | |
| 119 | int cdtracknumber(struct cd_toc_head *th, int block) |
| 120 | { |
no test coverage detected