1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-06-09 03:06:33 +02:00
Commit Graph

3801 Commits

Author SHA1 Message Date
Jim Meyering b20134e12c Remove unnecessary cast of argument to free. twice more 2003-05-13 14:32:10 +00:00
Jim Meyering 949f3a3c76 Remove unnecessary cast of argument to free. 2003-05-13 14:31:39 +00:00
Jim Meyering 26532ef1f2 Include "quote.h".
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-13 13:25:10 +00:00
Jim Meyering 5352c4a62b (elide_tail_lines_pipe): Use `if', not an assert.
Now that assert is no longer used, don't include <assert.h>.
2003-05-13 10:21:13 +00:00
Jim Meyering 8f59417689 Include <assert.h>.
(AUTHORS): Add my name.
(elide_tail_lines_pipe): New function.
2003-05-12 09:36:26 +00:00
Jim Meyering 5b5557e3a3 . 2003-05-11 06:35:10 +00:00
Jim Meyering 92f900fdf3 (main): Handle argc < optind. 2003-05-11 06:32:47 +00:00
Jim Meyering 6a0019aa78 (main): Handle argc < optind. 2003-05-10 20:27:56 +00:00
Jim Meyering 4fd6d22880 (main): Handle argc == 0. 2003-05-10 20:27:16 +00:00
Jim Meyering c2173890f0 (main): Handle argc < optind. 2003-05-10 20:01:32 +00:00
Jim Meyering 9eb8322209 (main): Handle argc == 0. 2003-05-10 20:00:54 +00:00
Jim Meyering 888d3d38d9 Handle argc < optind. 2003-05-10 19:58:04 +00:00
Jim Meyering a6a4c372c0 (main): Handle argc == 0. 2003-05-10 19:56:49 +00:00
Jim Meyering 74de8e29a8 Handle argc < optind. 2003-05-10 19:56:10 +00:00
Jim Meyering e2cad9b457 (send_signals): Don't check command line arguments here.
(main): Check them here instead.  Handle argc < optind.
2003-05-10 15:45:00 +00:00
Jim Meyering 9153514495 Handle argc < optind. 2003-05-10 15:39:39 +00:00
Jim Meyering f01fcb05a9 Handle argc < optind. 2003-05-10 15:00:00 +00:00
Jim Meyering 9b652d0790 Handle argc < optind. 2003-05-10 14:59:04 +00:00
Jim Meyering 8a7f744635 Handle argc < optind. 2003-05-10 14:58:15 +00:00
Jim Meyering ddc5610b88 (main): Set program_name before first use.
Remove that (redundant) first use.
Don't exit successfully just because --verbose was specified.
Pass 0, not EXIT_SUCCESS, as first argument to error; when that
parameter is 0, error does not exit.
2003-05-10 14:54:23 +00:00
Jim Meyering f6d13ddf6d (main): Handle argc < optind. 2003-05-10 14:39:16 +00:00
Jim Meyering b037820eb4 (main): Handle argc < optind. 2003-05-10 14:37:12 +00:00
Jim Meyering 8eb2464d3e (main): Handle argc < optind. 2003-05-10 14:33:24 +00:00
Jim Meyering 007103be2e add semicolon 2003-05-10 14:19:44 +00:00
Jim Meyering dfd12de6b9 (main): When failing due to too few arguments, also say
that rather than just "Try `uname --help' for more information.".
2003-05-10 14:17:46 +00:00
Jim Meyering 49f700b61c (main): When failing due to unaccepted arguments,
also say `too many arguments' rather than just `Try `uname --help'
for more information.'.
2003-05-10 13:47:38 +00:00
Jim Meyering f4c0d12cb0 (main): Handle argc < optind. 2003-05-10 13:42:48 +00:00
Jim Meyering 6c1a29f06f (main): Don't segfault when argc < optind. 2003-05-10 13:39:05 +00:00
Jim Meyering 2de1d40446 (main): Use error, rather than fprintf, for the sake of consistency. 2003-05-10 13:36:50 +00:00
Jim Meyering 0919600481 (main): Test for the case of no arguments before computing n_files. 2003-05-10 13:30:26 +00:00
Jim Meyering 3de521ebf9 (main): Test for `missing argument' before computing n_files. 2003-05-10 13:25:41 +00:00
Jim Meyering 9f763671c0 Include error.h. 2003-05-10 10:41:14 +00:00
Jim Meyering 0b65f598c8 (main): Don't overrun array bound if argc is 0. 2003-05-09 22:25:12 +00:00
Jim Meyering 12844e5674 fix off-by-one error in last change 2003-05-09 22:16:22 +00:00
Jim Meyering 6476197bcb (main): Don't overrun array bound if argc is 0.
That would happen when invoked via: execl ("/usr/bin/sort", NULL);
2003-05-09 08:50:37 +00:00
Jim Meyering 61ba51a61e Implement support so that `head --lines=-N' works on seekable files.
(enum Copy_fd_status): Define.
(COPY_FD_DIAGNOSE): New macro.
(elide_tail_lines_seekable): New funtion.
(elide_tail_lines_file): Call it here.
2003-05-07 16:21:52 +00:00
Jim Meyering ad06bb9c5a (CHAR_BIT): Remove duplicate definition. 2003-05-06 13:33:12 +00:00
Jim Meyering f1ce5dbf0e . 2003-05-04 08:45:17 +00:00
Jim Meyering 87c13cce86 (HAVE_WORKING_READDIR): Define to 0 if not defined.
(IF_READDIR_NEEDS_REWINDDIR): Remove.
(remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
which was a bit weird because it couldn't be emulated by a function.
2003-05-04 07:10:21 +00:00
Jim Meyering 57c1158f02 Extend head to accept --lines=-N (--bytes=-N) and to print all
but the N lines (bytes) at the end of the file.

Include full-write.h, full-read.h, inttostr.h, quote.h.
Use quote() in diagnostics, rather than literal `' marks.
(copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
New functions.
(elide_tail_lines_pipe, elide_tail_lines_file): New functions.
(head_file): Reorganize so as to call head from only one place.
(main): Likewise, for head_file.
Handle new, undocumented option, --presume-input-pipe.
Handle negative line and byte counts.
2003-05-03 15:10:13 +00:00
Jim Meyering c4ff976e20 (usage): Don't mention obsolescent -WIDTH option.
Instead explain about `-' and standard input.
(main): Give a proper diagnostic for e.g., `fmt -c -72'.
2003-05-02 19:52:48 +00:00
Jim Meyering cfed14f3cc Include "quote.h".
Use quote() in diagnostics, rather than literal `' marks.
(main): Exit nonzero when unable to open an input file.
2003-05-02 19:37:23 +00:00
Jim Meyering 7747a57abc (main): Diagnose invalid suffix on obsolescent width specifications like `-72x'. 2003-05-02 19:15:19 +00:00
Jim Meyering 4ed5c260a3 Work around nasty readdir bug with Darwin6.5 and hfs file system.
(IF_READDIR_NEEDS_REWINDDIR): Define.
[! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
returned NULL and there has been at least one successful unlink or
rmdir call since the opendir or previous rewinddir, then call
rewinddir and reiterate the loop.
2003-05-02 12:53:02 +00:00
Jim Meyering 4f6fe96afe Factor out common code.
(readdir_ignoring_dotdirs): New function.
(is_empty_dir): Use it here.
(remove_cwd_entries): Use it here.
2003-05-02 10:44:32 +00:00
Jim Meyering c8e2fca40c Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
(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 16:25:13 +00:00
Jim Meyering 5bc75bf6a0 (file_lines): Rename parameter, file_length, to end_pos. 2003-05-01 13:22:19 +00:00
Jim Meyering 882edccbd6 (start_lines): Rewrite to use memchr. Clean up. 2003-05-01 11:49:12 +00:00
Jim Meyering fa4150ded7 . 2003-04-24 13:51:05 +00:00
Jim Meyering 034fcf16e3 (tsort): Remove unnecessary test of have_read_stdin.
(main): Minor syntactic clean-up.
2003-04-24 13:50:27 +00:00