summaryrefslogtreecommitdiff
path: root/src/tail.c
AgeCommit message (Collapse)Author
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.
2002-10-12tail -c +N would perform an extra read after encountering EOFJim Meyering
[this change is analogous (bytes vs. lines) to the one of 2002-01-27] (start_bytes): Detect EOF, inform caller. (tail_bytes): Upon EOF in start_bytes, return immediately. (file_lines): Reorganize to use memrchr rather than an explicit loop. Adapt to new safe_read ABI.
2002-10-03Mark translatable string with `N_ (...)'.Jim Meyering
2002-09-29(parse_options): Give a sensible diagnostic forJim Meyering
an invalid byte or line count. Reported by Mikko Tuumanen.
2002-09-28(tail_bytes): Change type of bytes_remaining to off_tJim Meyering
to avoid overflow. Reported by Hans Lermen.
2002-09-12Include xnanosleep.h and xstrtod.h.Jim Meyering
Move declaration of global variable, sleep_interval, to ... (main): ...here. (usage): Update description of --sleep-interval option. (tail_forever): New parameter, sleep_interval. Update caller. Use xnanosleep, rather than sleep. (parse_options): New parameter, sleep_interval. Update caller. Use xstrtod, now that we accept floating point values.
2002-08-31Change `exit (0)' to `exit (EXIT_SUCCESS)',Jim Meyering
`exit (1)' to `exit (EXIT_FAILURE)', and `usage (1)' to `usage (EXIT_FAILURE)'.
2002-08-30Change `error (1, ...' to `error (EXIT_FAILURE, ...'.Jim Meyering
2002-08-25(main): Close STDIN_FILENO rather than a literal `0'.Jim Meyering
2002-07-29Adjust command examples in comments to use POSIX 1003.1-2001 option syntax.Jim Meyering
From Paul Eggert.
2002-07-02(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.Jim Meyering
2002-04-29(tail_forever): Do not treatJim Meyering
max_n_unchanged_stats_between_opens specially (as if it were infinite) if it has its maximal value. Similarly for max_n_consecutive_size_changes_between_opens.
2002-04-29(parse_obsolescent_option): Do not limit the maximumJim Meyering
line/byte count to be less than ULONG_MAX on systems where OFF_T_MAX is larger.
2002-02-16Include posixver.h.Jim Meyering
(usage): Document only the intersection of the old and new behaviors, to encourage portability. (main, parse_obsolescent_option): Parse options using POSIX 1003.1-2001 rules if conforming to that standard. Do not warn of obsolete options.
2002-02-01Add more support for POSIX 1003.1-2001, which requires removal forJim Meyering
support of obsolete "-N" option syntax in expand, head, fold, split, tail, unexpand, uniq, and which prohibits options with optional arguments in od and pr. (parse_obsolescent_option, main): Likewise.
2002-02-01(start_lines): Handle the case in which bytes_read is zero.Jim Meyering
2002-01-27tail -n +2 would perform an extra read after encountering EOFJim Meyering
(start_lines): Detect EOF, inform caller. (tail_lines): Upon EOF in start_lines, return immediately.
2002-01-18(parse_obsolescent_option): Issue a warning for obsolete usage,Jim Meyering
unless POSIXLY_CORRECT.
2002-01-16add 2002 to Copyright lineJim Meyering
2002-01-16Add support for POSIX 1003.1-2001, which requires removal forJim Meyering
support of obsolete "+" option syntax in sort, tail, and uniq. (usage, parse_obsolescent_option): Implement the above.
2001-12-03(usage): Don't split translatable strings in the middle of a sentence.Jim Meyering
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-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-20remove FIXME comment about duplicate codeJim Meyering
2001-11-19(xlseek): New function.Jim Meyering
Call it instead of lseek, in most cases, so any failure is reported.
2001-11-17(tail_forever): Add a cast.Jim Meyering