• Paul Eggert's avatar
    hexl: handle large files and I/O errors · 23e64fac
    Paul Eggert authored
    * lib-src/hexl.c: Include inttypes.h, for PRIxMAX etc.
    Do not include ctype.h, as the code no longer uses isdigit.
    (DEFAULT_GROUPING, un_flag, iso_flag, group_by): Now local to ‘main’.
    (DEFAULT_BASE, endian): Remove; was not really used.
    (usage): Remove; now done by ‘main’, as that’s simpler.
    (progname): Now static.
    (output_error, hexchar): New functions.
    (main): Use them.  Simplify.  Remove "-oct", "-big-endian", and
    "-little-endian" options, as they did not work and were not used.
    Use SET_BINARY only on stdin, and fopen with "rb" otherwise.
    Use SET_BINARY only once on stdout.
    Do not assume file offsets fit in ‘long’.
    If an I/O error occurs, report it and exit with nonzero status.
hexl.c 4.46 KB