Commit Graph
20330 Commits
Author SHA1 Message Date
Jim Meyering 68371a1d4c *** empty log message *** 2003-07-22 11:56:37 +00:00
Jim Meyering bf2cf0b7ba Begin to address this comment: What if someone wants to
extract the 1,000,000-th field of some huge input file?
The first step is to rearrange things so that the values
in the printable_field array are all 0/1 rather than 0/1/2.

(RANGE_START_SENTINEL): Remove.
Store range-start indices in a hash table, rather than
overloading the `printable_field' array.
(range_start_ht): New global.
(hash_int, hash_compare_ints, is_range_start_index): New functions.
(print_kth): Use is_range_start_index; don't test printable_field.
(set_fields): Detect overflow.
(set_fields): Insert each range-start index into range_start_ht.
(main): Call set_fields only once, and only after
output_delimiter_specified and (if required) range_start_ht have
been defined.
2003-07-22 11:56:24 +00:00
Jim Meyering a5eacea399 *** empty log message *** 2003-07-20 21:13:08 +00:00
Jim Meyering 1eb0fd1dd1 (get_input_fstatus): Fix typo: `stat' was being
invoked with a null pointer when there were no file arguments.
2003-07-20 21:13:04 +00:00
Jim Meyering 1fb0960527 *** empty log message *** 2003-07-20 16:04:04 +00:00
Jim Meyering c279f529aa (sc_changelog): Add another nit-picky check. 2003-07-20 16:03:58 +00:00
Jim Meyering 72214f2990 . 2003-07-20 16:02:28 +00:00
Jim Meyering 1fdb5a48fa . 2003-07-20 15:57:27 +00:00
Jim Meyering 8b5fe89e35 *** empty log message *** 2003-07-20 15:51:06 +00:00
Jim Meyering 4840b689ee *** empty log message *** 2003-07-20 15:45:58 +00:00
Jim Meyering bec97d9ee9 *** empty log message *** 2003-07-20 15:45:32 +00:00
Jim Meyering 224d5c8170 (write_counts): Add a comment.
(wc): Rename `file' parameter.
Set new local, `file', to be the file name, or (when it's NULL)
_("standard output") so that all uses of `file' use the proper value.
Use STREQ, not strcmp.
2003-07-20 15:45:29 +00:00
Jim Meyering 47c0b910f1 *** empty log message *** 2003-07-20 15:25:02 +00:00
Jim Meyering b17a0f8d39 Adjust to the new output widths. 2003-07-20 15:24:52 +00:00
Jim Meyering 6c32aa26a2 wc count field widths now are heuristically adjusted depending
on the input size, if known.  If only one count is printed, it
is guaranteed to be printed without leading spaces.

Previously, wc did not align the count fields if
POSIXLY_CORRECT was set, but POSIX did not actually require
this undesirable behavior, so it has been removed.

* doc/coreutils.texi (wc invocation): Likewise.
2003-07-20 15:24:21 +00:00
Jim Meyering 85c6c1592c *** empty log message *** 2003-07-20 15:22:42 +00:00
Jim Meyering 6e1923f4c1 (number_width): New var.
(posixly_correct): Remove.
(struct fstatus): New struct.
(write_counts): Output fields of width number_width.
Do not worry about POSIXLY_CORRECT.
Use null file, not empty-string file, to denote stdin,
since "" is a valid file name on some hosts.
(wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
if possible.
(wc):  Avoid problems if end_pos - current_pos overflows.
Do not print odd message if stdin has a read error.
(get_input_fstatus, compute_number_width): New functions.
(main): Use them to implement the new behavior.
Ignore POSIXLY_CORRECT.
2003-07-20 15:22:25 +00:00
Jim Meyering 32d2cea9b8 convert each 8-space prefix to a TAB 2003-07-20 11:19:12 +00:00
Jim Meyering 107ee59889 convert each 8-space prefix to a TAB 2003-07-20 11:18:12 +00:00
Jim Meyering 018d21f27b convert each 8-space prefix to a TAB 2003-07-20 11:17:51 +00:00
Jim Meyering 34ecf6b086 convert each 8-space prefix to a TAB 2003-07-20 11:17:26 +00:00
Jim Meyering a9c557304a *** empty log message *** 2003-07-20 06:30:06 +00:00
Jim Meyering c67f098cb7 *** empty log message *** 2003-07-20 05:38:28 +00:00
Jim Meyering 4383217a7b *** empty log message *** 2003-07-20 05:36:10 +00:00
Jim Meyering 479038b02c from gnulib 2003-07-20 05:35:54 +00:00
Jim Meyering e13407adf9 (jm_MACROS): Invoke gl_MEMCOLL. 2003-07-20 05:35:38 +00:00
Jim Meyering 18695bd657 *** empty log message *** 2003-07-19 17:30:49 +00:00
Jim Meyering 51ff0dc7c0 Restore definition of $verbose. 2003-07-19 12:00:38 +00:00
Jim Meyering 30c42b2089 Don't create temporary directory -- we don't use it. 2003-07-19 11:59:12 +00:00
Jim Meyering 1ce4f09d1e *** empty log message *** 2003-07-19 11:59:02 +00:00
Jim Meyering afd207eda5 remove now-redundant VERSION check 2003-07-19 11:54:39 +00:00
Jim Meyering dc701b5cf2 *** empty log message *** 2003-07-19 11:47:22 +00:00
Jim Meyering d7a263ce2a Don't open-code test for UID != 0.
Use priv-check's require-non-root instead.
Update to use newer framework.
2003-07-19 11:47:17 +00:00
Jim Meyering 0aa4df1070 *** empty log message *** 2003-07-19 11:39:27 +00:00
Jim Meyering 1f3c90c6a5 (expected_failure_status_expr): Record that
expr exits with status of 3 for e.g., a write error.
2003-07-19 11:39:22 +00:00
Jim Meyering ae481a2cb7 *** empty log message *** 2003-07-19 11:19:16 +00:00
Jim Meyering 1d510c3f9b Use `id -u' to see if we're running as root,
rather than trying go write to an write-protected file.
When running as root, ensure $NON_ROOT_USERNAME is valid.
When running as root with `require-non-root', ensure that `.'
is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
2003-07-19 11:19:12 +00:00
Jim Meyering c321e53e88 *** empty log message *** 2003-07-19 08:17:16 +00:00
Jim Meyering db34cf4ee6 Include "exitfail.h".
(main): Set exit_failure rather than calling close_stdout_set_status.
2003-07-19 08:17:06 +00:00
Jim Meyering fe52d65af0 Include "exitfail.h".
(main): Set exit_failure rather than calling close_stdout_set_status.
2003-07-19 08:16:38 +00:00
Jim Meyering 3fd76bf433 *** empty log message *** 2003-07-19 08:09:01 +00:00
Jim Meyering 9802c059ff Likewise. Include "closeout.h" right after config.h,
to test that it can stand by itself.  Include "exitfail.h".
Clients should set exit_failure instead.
(EXIT_FAILURE): Remove; no longer needed.  Do not include <stdlib.h>.
2003-07-19 08:08:56 +00:00
Jim Meyering 2925e558cb (close_stdout_set_status, close_stdout_status): Remove. 2003-07-19 08:05:44 +00:00
Jim Meyering 8ed1e0ab9a *** empty log message *** 2003-07-18 18:08:08 +00:00
Jim Meyering eea7d0c8da (memcoll) [!HAVE_STRCOLL]: Clear errno. 2003-07-18 18:07:48 +00:00
Jim Meyering d2cc1e9856 *** empty log message *** 2003-07-18 09:58:59 +00:00
Jim Meyering 05b4128b5d Update to use newer framework. 2003-07-18 09:48:16 +00:00
Jim Meyering c42d31bc78 Use $srcdir/../priv-check, create a temporary
directory, and remove Perl-coded `you may not run as root' test.
2003-07-18 09:12:23 +00:00
Jim Meyering 10c48512f0 Use $srcdir/../priv-check, rather than
hard-coding something not quite equivalent.  Reported by Paul Jarc.
2003-07-18 09:05:49 +00:00
Jim Meyering 8dd15f024c *** empty log message *** 2003-07-18 08:53:32 +00:00