|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use `const' when needed to pacify gcc. Use 0, not NULL, for portability.
Make globals static when possible.
(file): Now a 2-element array; replaces `file1' and `file2'.
(file_desc, buffer): Likewise, for file[12]_desc and buf[12].
(main): Likewise, for stat_buf[12]. Index these variables with `i'.
(ignore_initial): New var.
(long_options): Now const. Add `--ignore-initial'.
(usage): Sort options and add `--ignore-initial'.
(main, cmp): Add `--ignore-initial' support.
(main): `cmp - -' now succeeds. Use STD{IN,OUT,ERR}_FILENO instead of [012].
When comparing standard input to a file, and using a shortcut (e.g.
looking at file sizes or inode numbers), take the lseek offset into
account before deciding whether the files are identical.
Avoid mentioning `dev_t', `ino_t' for portability to nonstandard hosts.
Use l.c.m. of files' buffer sizes, not 8 * 1024.
ferror (stdout) does not imply errno has a useful value.
If 2nd file is "-", treat it first, in case stdin is closed.
(cmp): Always compute `char_number', `smaller' for speed and simplicity.
Say `cmp: EOF on input', not `/usr/gnu/bin/cmp: EOF on input',
as per Posix.2.
(block_compare_and_count): Increment line_number argument.
Remove end_char argument; it's always '\n'. All callers changed.
Do not assume sizeof(long) == 4; this isn't true on some 64-bit hosts.
(block_compare): Minimize differences with block_compare_and_count.
(block_read): Coalesce `bp += nread's.
(printc): Remove `FILE *' arg; output to stdout. All callers changed.
|