summaryrefslogtreecommitdiff
path: root/src/tail.c
AgeCommit message (Collapse)Author
2005-06-16Don't embed `this'-style quotes in format strings.Jim Meyering
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-26(parse_obsolete_option): Don't complain about -NUM.Paul Eggert
2005-04-11Include unistd-safer.h rather than fcntl-safer.h.Paul Eggert
(recheck, tail_file): Use fd_safer rather than open_safer.
2005-03-28(follow_mode_string): Use NULL, not `0'.Jim Meyering
2005-01-14The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.Jim Meyering
(IS_TAILABLE_FILE_TYPE): Adjust definition also to include sockets, since that's what you get when reading from a command-line- supplied pipe on Darwin 7.7. (IS_PIPE_LIKE_FILE_TYPE): Define. (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO. This same change is also required on NetBSD/sparc-1.5. Reported by Adrian Bunk.
2004-12-04(tail_file): Set errnum to -1 if the initial "tail" failed.Paul Eggert
2004-09-28(usage): Clarify: --retry works only with --follow=name.Jim Meyering
Reported by Nik A. Melchior in http://bugs.debian.org/273781.
2004-09-23(parse_obsolete_option): Bring back supportPaul Eggert
for obsolete option followed by non-obsolete, or by more than one file. When obsolete, conform to SUSv2 rather than original POSIX 1003.2-1992, as SUSv2 corrected the case of "tail -c". Add support for the SUSv2 "b" modifier.
2004-09-21Remove unused "case 0".Paul Eggert
2004-09-10(parse_obsolete_option): Renamed fromPaul Eggert
parse_obsolescent_option, since the options are obsolete now. Remove bool *arg; just exit if there's an error. Revamp to follow POSIX 1003.2-1992 more precisely, to handle cases like "tail - file" and "tail -10 -- file" correctly when we are conforming to the older standard. (main): Adjust to this change.
2004-08-02(struct File_spec, reopen_inaccessible_files, count_lines,Paul Eggert
forever, from_start, print_headers, have_read_stdin, valid_file_spec, write_header, file_lines, pipe_lines, pipe_bytes, recheck, tail_forever, tail_bytes, tail_lines, tail, tail_file, parse_obsolescent_option, parse_options, main): Use bool for booleans. (struct File_spec, max_n_unchanged_stats_between_opens, parse_options): Use uintmax_t, not unsigned int or unsigned long int, for state counters. (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to make it a bit clearer.
2004-07-23Include fcntl-safer.h.Paul Eggert
(COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong). (COPY_A_BUFFER): New macro. (struct File_spec): New members mtime, mode, blocking. Remove member n_consecutive_size_changes. (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES, max_n_consecutive_size_changes_between_opens, MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove. (long_options, tail_forever, parse_options): Remove (non-)support for --max-consecutive-size-changes. (record_open_fd): New function. (recheck, tail_file): Use it. Don't assume that stdin is open. (dump_remainder): Add support for new COPY_A_BUFFER special value. Treat errno==EAGAIN like EOF, since it might be a nonblocking read. (recheck): New arg BLOCKING, specifying whether to use blocking reads. All uses changed. (n_live_files): Remove, replacing with... (any_live_files): New function. All uses changed. (tail_forever): Use nonblocking I/O unless we know that blocking I/O is safe; this avoids some hangs when reading from a fifo. Avoid invoking fstat or sleep when using blocking I/O. Do not check for changes to size if the file is not a regular file, as the size is undefined in that case. Check for changes to mtime or mode, too; this works for non-regular files. (tail_forever, main): Redo fflush strategy to work even when input is nonblocking. Don't use unbuffered output; just flush when needed.
2004-07-22(main): Ignore -f if no file operand is specifiedPaul Eggert
and standard input is a pipe.
2004-06-15(parse_obsolescent_option): Support multiple file operandsJim Meyering
even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
2004-05-06(main): Use xnmalloc, rather than xmalloc.Jim Meyering
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.
2004-01-12(main): Warn about following stdin only when it's a tty.Jim Meyering
2004-01-04(main): Warn about following stdin.Jim Meyering
Fail when following by name but no names are specified.
2003-11-27Include "c-strtod.h".Jim Meyering
(parse_options): Update xstrtod call to include new argument, c_strtod.
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-10-16(start_bytes): Rename local, remainder, to avoidJim Meyering
gcc's warning about shadowing a global.
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-09-06(enum): Add ALLOW_MISSING_OPTION.Jim Meyering
(parse_options): Give a diagnostic for (but still accept) the deprecated --allow-missing option.
2003-09-05(pipe_lines, pipe_bytes): Don't assign 0 or SAFE_READ_ERROR to tmp->nbytes.Jim Meyering
(struct linebuffer, struct charbuffer): Change nbytes and nlines from unsigned int to size_t. unsigned int is safe (after the 2003-09-03 patch) but size_t is cleaner. (pipe_bytes): Likewise for local variable 'i', which was 'int'. Standardize on BUFSIZ as opposed to other macro names and values. (BUFSIZ) [!defined BUFSIZ]: Remove. stdio.h has always defined it, and other code already assumes it's defined.
2003-09-04(pipe_lines): Don't truncate return value from safe_read.Jim Meyering
2003-08-16(tail_lines): Fix a potential (but very hard to exercise)Jim Meyering
race condition bug. The bug would be triggered when tailing a file with file pointer not at beginning of file, and where the file was truncated to have a length of less than the initial offset at just the right moment (between the two lseek calls in this function).
2003-08-16An invalid initial value for *read_pos would result inJim Meyering
`tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a busy-wait rather than sleeping between iterations. The bug manifests itself only when tailing regular files that are initially nonempty. (tail_bytes): Set *read_pos to new file offset after each xlseek call. (tail_lines): Likewise, after lseek calls.
2003-08-09(main): Tweak Solaris OS version number in comment.Jim Meyering
2003-08-09(pipe_lines): Use memchr to skip lines, rather than an explicit loop.Jim Meyering
2003-08-09Add new undocumented option, --presume-input-pipe.Jim Meyering
2003-07-23Don't include headers already included by system.h:Jim Meyering
Don't include closeout.h.
2003-07-23Tweak comment: Solaris2.7 -> Solaris 2.7Jim Meyering
2003-07-10(usage): Use 1024*1024 in place of 1048576.Jim Meyering
2003-07-09(xlseek): Avoid warning about ``return without valueJim Meyering
from function returning non-void''.
2003-06-17(main): Call initialize_main.Jim Meyering
2003-06-01Avoid a race condition in `tail -f' described by Ken Raeburn inJim Meyering
http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html (file_lines): Add new parameter, *read_pos, and set it. (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise. (tail_bytes, tail_lines, tail): Likewise. (tail_file): Use the new `read_pos' value as the size, rather than stats.st_size from the fstat call.
2003-05-13Remove unnecessary cast of argument to free. twice moreJim Meyering
2003-05-13Remove unnecessary cast of argument to free.Jim Meyering
2003-05-13Include "quote.h".Jim Meyering
Use quote in diagnostics. Change many error format strings from just `%s' to e.g., `error reading %s'. (pipe_lines): Change type of parameter, n_lines, to uintmax_t. Rewrite newline-counting loop to use memchr.
2003-05-10(main): Test for the case of no arguments before computing n_files.Jim Meyering
2003-05-01Change type of n_units, n_bytes, n_lines to be `uintmax_t'.Jim Meyering
(dump_remainder): Move two declarations `down' into the scope where they are used. (xlseek): Return the resulting offset. (file_lines): Rename parameter, file_length, to end_pos. (pipe_lines): Don't coerce safe_read return value to `int'. Adapt tests accordingly. (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int' to `unsigned int'. Change type of `total_bytes' from `int' to `size_t', since the former wouldn't always be wide enough. Don't coerce safe_read return value to `int', and adapt tests accordingly. Now that testing for a read error no longer involves using `tmp', handle that case *after* freeing `tmp'. (start_bytes): Clean up. (tail_bytes): Now that `n_bytes' may be larger than OFF_T_MAX, test for that condition and, if it's true, don't use lseek optimizations. (parse_options): Don't fail just because N_UNITS is larger than the maximum size of a file -- tail may be applied to an input stream (e.g., a pipe) with more data than that.
2003-05-01(file_lines): Rename parameter, file_length, to end_pos.Jim Meyering
2003-05-01(start_lines): Rewrite to use memchr. Clean up.Jim Meyering
2003-04-11Remove SPC in SPC-TAB sequence.Jim Meyering
2003-04-11Remove anachronistic casts of xmalloc,Jim Meyering
xrealloc, and xcalloc return values and of xrealloc's first argument.
2002-11-05(xlseek):Jim Meyering
Use primitives from inttostr.h, not human.h, to print large numbers simply.