Age | Commit message (Collapse) | Author |
|
Rather than this: error (..., "...`%s'...", arg);
do this: error (..., "...%s...", quote (arg));
|
|
|
|
|
|
|
|
(recheck, tail_file): Use fd_safer rather than open_safer.
|
|
|
|
(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.
|
|
|
|
Reported by Nik A. Melchior in http://bugs.debian.org/273781.
|
|
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.
|
|
|
|
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.
|
|
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.
|
|
(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.
|
|
and standard input is a pipe.
|
|
even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
|
|
|
|
(usage): Don't bother normalizing exit status
since the arg is already the correct exit status now.
|
|
|
|
Fail when following by name but no names are specified.
|
|
(parse_options): Update xstrtod call to include new argument, c_strtod.
|
|
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.
|
|
gcc's warning about shadowing a global.
|
|
Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
Mark each WRITTEN_BY string as translatable.
|
|
|
|
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
|
|
(parse_options): Give a diagnostic for (but still accept) the
deprecated --allow-missing option.
|
|
(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.
|
|
|
|
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).
|
|
`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.
|
|
|
|
|
|
|
|
Don't include closeout.h.
|
|
|
|
|
|
from function returning non-void''.
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
|
|
(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.
|
|
|
|
|
|
|
|
xrealloc, and xcalloc return values and of xrealloc's first argument.
|
|
Use primitives from inttostr.h, not human.h, to print large numbers simply.
|