Just like stdio fseek(), except works on a CFILE
| 602 | } |
| 603 | // Just like stdio fseek(), except works on a CFILE |
| 604 | int cfseek(CFILE *cfp, long offset, int where) { |
| 605 | int c; |
| 606 | long goal_position; |
| 607 | switch (where) { |
| 608 | case SEEK_SET: |
| 609 | goal_position = offset; |
| 610 | break; |
| 611 | case SEEK_CUR: |
| 612 | goal_position = cfp->position + offset; |
| 613 | break; |
| 614 | case SEEK_END: |
| 615 | goal_position = cfp->size + offset; |
| 616 | break; |
| 617 | default: |
| 618 | return 1; |
| 619 | } |
| 620 | c = fseek(cfp->file, cfp->lib_offset + goal_position, SEEK_SET); |
| 621 | cfp->position = ftell(cfp->file) - cfp->lib_offset; |
| 622 | return c; |
| 623 | } |
| 624 | |
| 625 | // Just like stdio ftell(), except works on a CFILE |
| 626 | long cftell(CFILE *cfp) { return cfp->position; } |
no outgoing calls
no test coverage detected