summaryrefslogtreecommitdiff
path: root/src/cat.c
AgeCommit message (Collapse)Author
2006-06-08Ensure that cat works with any of the options, -A -v -e -E -T,Jim Meyering
when applied to files in /proc and /sys, even when the FIONREAD ioctl produces nonsensical results. Before this change, cat would produce no output (or truncated output), for some linux kernels. * src/cat.c (write_pending): New function, factored out of cat. (cat): Also interpret a negative ioctl/FIONREAD count as indicating that there are bytes to read. Some versions of linux-2.6.16 do that. Write any pending output before returning. Reported by Dan Jacobson in <http://bugs.debian.org/370583>. * NEWS: Mention this bug fix. * tests/misc/cat-proc: New file. Test for the above. * tests/misc/Makefile.am (TESTS): Add cat-proc.
2005-12-14Undo previous change.Paul Eggert
2005-12-14(main): Check for close (STDOUT_FILENO) failure.Paul Eggert
2005-07-11(usage, main, long_options) [O_BINARY]:Paul Eggert
Remove support for -B. Use same rules as other programs to decide whether to use binary I/O, except that the -bensAE options always select text mode. (main): Avoid setmode; use POSIX-specified routines instead.
2005-07-09Use only HAVE_SYS_IOCTL_H to decide whether to include sys/ioctl.h.Paul Eggert
2005-07-08Include stropt.h if available.Paul Eggert
Use HAVE_FIONREAD_IN_SYS_IOCTL instead of _POSIX_SOURCE to decide whether to include <sys/ioctl.h>.
2005-06-16Don't embed `this'-style quotes in format strings.Jim Meyering
Include "quote.h". Rather than this: error (..., "...`%s'...", arg); do this: error (..., "...%s...", quote (arg));
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-04-09(close_stdout_wrapper): Likewise.Jim Meyering
Don't close STDOUT_FILENO explicitly; close_stdout does it.
2005-04-05(usage): Add examples.Paul Eggert
2004-09-21Remove unused "case 0".Paul Eggert
2004-07-29(exit_status): Remove. Now done by passing a booleanPaul Eggert
'ok' flag around. (simple_cat, cat): Return true if successful. All callers changed. (simple_cat, cat, main): Use bool for booleans. (simple_cat): Use size_t for sizes. (cat, main): Use the same names for parameters that we use for long options, to avoid confusion. This inverts the sense of the show_tabs (formerly output_tabs) and number_nonblank (formerly numbers_at_empty_lines) variables. (main): Don't mess up (due to integer overflow) if we are given INT_MAX - INT_MIN + 1 options. [O_BINARY]: Don't invoke isatty unless the other options require it. (main): When deciding whether to use simple_cat, don't worry about binary option; it's irrelevant.
2004-06-30Use "file system" rather than "filesystem" in comments.Jim Meyering
2004-04-15Include getpagesize.h.Jim Meyering
(main): Align I/O buffers to page boundaries.
2004-01-21(usage): Use EXIT_SUCCESS, not 0, for clarity.Jim Meyering
(usage): Don't bother normalizing exit status since the arg is already the correct exit status now.
2003-10-18Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS changeJim Meyering
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings. Update the call to parse_long_options so that `AUTHORS, NULL' are the last parameters. * src/true.c (main): Append NULL to version_etc argument list. * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
2003-09-18(WRITTEN_BY): Rename from AUTHORS.Jim Meyering
Begin each WRITTEN_BY string with `Written by ' and end it with `.'. Mark each WRITTEN_BY string as translatable.
2003-09-18revert previous changeJim Meyering
2003-09-18Update AUTHORS definition to be a comma-separated list of strings and/or updateJim Meyering
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
2003-07-23Don't include headers already included by system.h:Jim Meyering
Don't include closeout.h.
2003-06-17(main): Call initialize_main.Jim Meyering
2003-06-16(cat): Remove `#ifndef ENOSYS', now that it'sJim Meyering
guaranteed to be defined.
2002-10-08(cat): Don't advance the write pointer past the end of the write buffer.Jim Meyering
2002-10-06(simple_cat, cat): Adapt to new safe_read ABI.Jim Meyering
2002-09-29(simple_cat): Use a temporary to avoid bogus warnings.Jim Meyering
(cat): Declare insize and outsize to be of type size_t, not int. Rearrange pointer/integer expressions to avoid bogus warnings. (main): Declare insize and outsize to be of type size_t, not int.
2002-08-26(close_stdout_wrapper): New, kludgey, function and file-scoped global.Jim Meyering
(main): Register it with atexit. Close STDOUT_FILENO, to avoid a problem when writing to /dev/audio on at least Solaris 2.7 and 2.8 systems.
2002-08-25(main): Close STDIN_FILENO rather than a literal `0'.Jim Meyering
2002-07-02(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.Jim Meyering
2002-02-23(simple_cat, cat, main): Used char * rather thanJim Meyering
unsigned char *, to avoid some technical violations of the C standard, and to avoid the need for casts. I guess the unsigned char * was probably there for improved performance with ancient compilers, but the code wasn't using the unsignedness any more. Reported by Nelson H. F. Beebe. (cat): int -> size_t for full_write arg. This doesn't fix any bugs since the buffer size is small, but it makes the code a bit clearer.
2001-12-01Reflect renaming to, and new usage of these macros:Jim Meyering
HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION.
2001-12-01(usage): Use new macros, EMIT_HELP_DESCRIPTION and EMIT_VERSION_DESCRIPTIONJim Meyering
instead of hard-coding --help and --version descriptions.
2001-11-26(cat): Don't test whether the full_write return value (of type size_t)Jim Meyering
is less than 0. Reported by Nelson H. F. Beebe, as a warning from Irix 6.5's C compiler.
2001-11-23Factor out some common strings to make translation easier.Jim Meyering
Split usage strings so that --help and --version descriptions are alone in their own string. Likewise for the one that says: Mandatory arguments to long options are mandatory for short options too.
2001-11-11(usage): Split --help output into smaller pieces.Jim Meyering
Use fputs, not printf.
2001-08-31copyrightJim Meyering
2001-08-31Include full-write.h.Jim Meyering
(full_write): Remove decl; not needed. (simple_cat, cat): Don't assume read and write size fits in int.
2001-08-13(AUTHORS): Mark string for translation, since it contains the English word ↵Jim Meyering
`and'.
2000-10-21The command, `yes ''|./cat -n' would stop printing after INT_MAX lines.Jim Meyering
(cat): Never let `newlines' exceed 3.
2000-10-21Prevent a counter buffer overrun when numbering lines and whenJim Meyering
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-08-07(closeout_func): Remove variable.Jim Meyering
(close_stdout_wrapper): Remove unused function. (main): Remove assignment to closeout_func.
2000-06-22(main): Correct a comment.Jim Meyering
2000-05-27Arrange to call close_stdout upon exit.Jim Meyering
Don't close stdout explicitly. Replace uses of global constant, output_desc, with uses of STDOUT_FILENO.
1999-05-18(main): When stdout is in binary mode, make sure allJim Meyering
input files are also read in binary mode.
1999-04-13(main): Declare out_dev to be of type dev_t, not `int'.Jim Meyering
Declare out_ino to be of type ino_t, not `int'.
1999-04-04Standardize --help and --version processing.Jim Meyering
1999-04-03Use AUTHORS in place of string in parse_long_options call.Jim Meyering
1999-04-03Insert AUTHORS definition.Jim Meyering
1999-04-03Use PROGRAM_NAME in place of string in parse_long_options call.Jim Meyering
1999-04-03define PROGRAM_NAMEJim Meyering