Commit Graph

70 Commits

Author SHA1 Message Date
Jim Meyering 13e80acf07 The command, `yes ''|./cat -n' would stop printing after INT_MAX lines.
(cat): Never let `newlines' exceed 3.
2000-10-21 19:57:41 +00:00
Jim Meyering 51e2ffc524 Prevent a counter buffer overrun when numbering lines and when
processing 100 billion lines (or more) of input.

(LINE_COUNTER_BUF_LEN): Define to allow numbering as
many as 10^18 - 1 lines (the old limit was 10^11 - 1, and could
be exceeded without too much trouble).	Use this symbol rather
than hard-coding the constant everywhere.  Rather than overruning
for input with more lines, mark the line number by putting a
`>' in the leftmost slot.
(next_line_num): Fixed (now academic) possible line buffer overrun.
Patch by Jan Nieuwenhuizen.
2000-10-21 19:16:37 +00:00
Jim Meyering fd5da15041 (closeout_func): Remove variable.
(close_stdout_wrapper): Remove unused function.
(main): Remove assignment to closeout_func.
2000-08-07 13:23:44 +00:00
Jim Meyering 62e3f1f1ef (main): Correct a comment. 2000-06-22 17:10:51 +00:00
Jim Meyering 8ccf29f7fe Arrange to call close_stdout upon exit.
Don't close stdout explicitly.  Replace uses of global constant,
output_desc, with uses of STDOUT_FILENO.
2000-05-27 21:14:26 +00:00
Jim Meyering 98270d63fb (main): When stdout is in binary mode, make sure all
input files are also read in binary mode.
1999-05-18 14:13:33 +00:00
Jim Meyering e6bc0dccbc (main): Declare out_dev to be of type dev_t, not `int'.
Declare out_ino to be of type ino_t, not `int'.
1999-04-13 01:11:46 +00:00
Jim Meyering d815c152df Standardize --help and --version processing. 1999-04-04 15:44:26 +00:00
Jim Meyering c21cecaea8 Use AUTHORS in place of string in parse_long_options call. 1999-04-03 05:26:48 +00:00
Jim Meyering 1d47220ab2 Insert AUTHORS definition. 1999-04-03 05:22:05 +00:00
Jim Meyering cf691ec714 Use PROGRAM_NAME in place of string in parse_long_options call. 1999-04-03 05:20:06 +00:00
Jim Meyering 7c2d5de6c7 define PROGRAM_NAME 1999-04-03 05:01:48 +00:00
Jim Meyering 88cbad9817 Include long-options.h
[long_options]: Remove the "help" and "version" entries.
Remove declarations of show_help and show_version.
(main): Use parse_long_options, including author name(s).
Remove the show_version and show_help blocks.
1999-03-04 05:36:10 +00:00
Jim Meyering 7568de8654 update copyright dates 1999-02-16 04:20:43 +00:00
Jim Meyering 9fec9172be Don't prototype usage as static. 1999-01-14 18:25:16 +00:00
Jim Meyering 7914fb4069 (usage) [O_BINARY]: Describe -B,--binary option.
(main) [O_BINARY]: binary_files, binary_output, file_open_mode:
new variables. 	Add --binary to long_options[].  Switch stdin and
stdout to binary mode unless file contents are not important
anyway.  Open files in binary mode when required.
1999-01-01 22:20:23 +00:00
Jim Meyering 6880f434c0 update bug-reporting address 1998-09-19 17:24:05 +00:00
Jim Meyering d4257e63c7 Use STREQ rather than strcmp 1998-04-12 09:27:45 +00:00
Jim Meyering 66c7b3c41d Include safe-read.h instead of merely declaring safe_read. 1998-04-11 18:23:13 +00:00
Jim Meyering 3a62f8785f (cat): Convert comma-expressions to pairs of
semicolon-terminated stmts.
Add braces around compound if/else stmts.
1998-01-25 08:25:05 +00:00
Jim Meyering e211bb2aff Remove old-style xmalloc and xrealloc decls. 1997-10-25 04:45:43 +00:00
Jim Meyering d4899bad7e Remove stpcpy dcl. 1997-10-23 14:28:31 +00:00
Jim Meyering 3ea2606e41 indent cpp directives to reflect nesting 1997-10-07 23:58:29 +00:00
Jim Meyering 3f3f566627 update bug-reporting address 1997-10-07 23:55:52 +00:00
Jim Meyering dbc538f92b update copyrights for 1997 1997-02-09 04:46:02 +00:00
Jim Meyering e077b7593b bracket bug address with <> and append a period 1997-02-01 04:24:58 +00:00
Jim Meyering c2d2dec516 Compare getopt_long return value against -1, not EOF. Use NULL, not '(int *) 0' as last parameter in getopt_long call. 1997-02-01 02:00:04 +00:00
Jim Meyering e298f1f300 (usage): Alphabetize options like sort -f would. 1996-11-23 22:06:55 +00:00
Jim Meyering 2e55854100 change bug-reporting address 1996-11-03 03:16:23 +00:00
Jim Meyering 17c0c658f1 change bug-reporting address 1996-11-02 20:44:52 +00:00
Jim Meyering 630b771f1b (main): update --version output again 1996-10-04 04:25:46 +00:00
Jim Meyering 3361bd2bca (main): update --version output to conform to coding standard 1996-10-04 04:15:08 +00:00
Jim Meyering 39c406f18a . 1996-10-01 01:10:54 +00:00
Jim Meyering c609ba2d13 (usage): Tell where to report bugs. 1996-09-02 15:34:25 +00:00
Jim Meyering 41e757beb6 (cat): Cast first arg to stpcpy to char*. 1996-08-24 19:28:27 +00:00
Jim Meyering 9da759a317 (main): Use STDIN_FILENO and STDOUT_FILENO instead of less portable fileno(*). 1996-05-28 01:42:07 +00:00
Jim Meyering 59d334f4d4 update Copyright years for 1996 1996-04-24 04:50:53 +00:00
Jim Meyering 818d29db9b Call error with EXIT_FAILURE (rather than `1') as first actual parameter. 1996-03-24 16:59:11 +00:00
Jim Meyering 47f70113d4 Exit with status EXIT_SUCCESS or EXIT_FAILURE, rather than 0 or 1.
This doesn't change `error (1' calls.
1996-03-24 14:58:01 +00:00
Jim Meyering adb7c216b2 (main): Declare to be of type int, not void. 1996-03-21 22:41:04 +00:00
Jim Meyering 4229a555fc Don't include version.h.
(main): Use PACKAGE_VERSION instead of version_string.
1996-03-16 22:30:54 +00:00
Jim Meyering 715765a548 (main): Initialize for internationalized message support: call setlocale,
bindtextdomain, and textdomain.
1996-03-09 20:19:13 +00:00
Jim Meyering 7956c15081 s/non-zero/nonzero/g 1995-11-27 03:09:18 +00:00
Jim Meyering 24aec7f87f (main): Don't die when dev/ino of input and output are
the same and the file descriptors correspond to stdin and stdout.
This is necessary on at least Digital UNIX (aka OSF1) 3.2C.
Otherwise, running `cat << X > $$' would fail with `cat: -: input
file is output file'.  From Jarkko Hietaniemi <jhi@epsilon.hut.fi>.
1995-11-11 14:21:15 +00:00
Jim Meyering de4de17bc5 (usage, next_line_num, main): Protoize. 1995-10-31 02:22:23 +00:00
Jim Meyering 14390d1fed Protoize. Reorder functions to obviate forward dcls.
Remove forward dcls.
1995-10-17 13:13:19 +00:00
Jim Meyering 0e15d57a89 Rewrite confusing comment. 1995-09-19 12:59:49 +00:00
Jim Meyering 92c50e7f52 Annotate localizable strings with _(...). From Franc,ois. 1995-08-07 14:57:29 +00:00
Jim Meyering 0e7bce124f reformat comment 1995-07-21 06:27:39 +00:00
Jim Meyering 86671a4ed0 Undefine min and/or max before defining to avoid redefinition warning
on systems.
1995-06-24 21:10:12 +00:00