Commit Graph

4794 Commits

Author SHA1 Message Date
Jim Meyering 7380cf792a (complement, COMPLEMENT_OPTION): New.
(longopts): Add --complement.
(usage): Say not that -b, -c, and -f `print' fields,
but rather that they `select' fields for printing.
Describe the new --complement option.
(mark_range_start): Extracted from set_fields.
(print_kth): Support --complement.
(compare_ranges): New function.
(set_fields): Rewrite the part that populates range_start_ht,
merging it with the part that populates printable_field.
(main): Handle --complement.

From Paolo Bonzini.
2004-12-04 13:32:48 +00:00
Paul Eggert cd9d7fd2bd (tail_file): Set errnum to -1 if the initial "tail" failed. 2004-12-04 07:02:35 +00:00
Jim Meyering d6fed8d35e With using --color and with LS_COLORS saying not to color
executables, don't stat every file.

(is_colored): New function.
(gobble_file): Use it.
(main): Use it here, in place of too-strict tests against NULL:
if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
old test would fail.
2004-12-02 07:47:14 +00:00
Paul Eggert c82d4cf0b5 (different): Assume setlocale exists. 2004-12-02 06:56:28 +00:00
Paul Eggert bba741d6c2 Assume locale.h exists.
(HAVE_SETLOCALE): Remove.
2004-12-02 06:56:08 +00:00
Paul Eggert 543696d559 (C_DECIMAL_POINT): Remove. Use changed to '.'.
Assume setlocale exists.
(thousands_sep): Renamed from th_sep.
(IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
(NONZERO): Parenthesize use of arg.
(numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
consistency.  Avoid unnecessary negation by reversing
fraccompare args.
(main): Rewrite localeconv call to match seq.c.
2004-12-02 06:55:31 +00:00
Paul Eggert d153646bbc (decimal_point): Treat like sort. Now char.
All uses changed.
2004-12-02 06:55:08 +00:00
Paul Eggert 037268041b (keycmp): Assume setlocale exists. 2004-12-02 06:54:40 +00:00
Paul Eggert a0a9d4c6f4 (compare_files): Assume setlocale exists. 2004-12-02 06:54:16 +00:00
Paul Eggert 29f4f8aff6 (sort_files): Minor cleanup. Remove an unnecessary
'volatile' on a local variable.  Rewrite to avoid unnecessary
double-assignment to 'func' in the usual case where strcoll does
not fail.
2004-12-02 00:31:43 +00:00
Paul Eggert 3b3530057a (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
(IS_USER_PROCESS): Move to ../lib/readutmp.h.
(UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
(gethostname): Remove decl.
(list_entries_who, scan_entries): Use the new macros defined above,
for consistency with pinky, uptime, and users.
2004-11-30 21:41:09 +00:00
Paul Eggert a0d8525938 (list_entries_users): Use IS_USER_PROCESS
instead of by-hand code.
2004-11-30 21:40:52 +00:00
Paul Eggert 78a436fb0b (print_uptime): Use IS_USER_PROCESS and
UT_TYPE_BOOT_TIME instead of by-hand code.
2004-11-30 21:40:29 +00:00
Paul Eggert 76d1b4a434 (gethostname): Remove decl.
(scan_entries): Use IS_USER_PROCESS instead of by-hand code.
* src/uptime.c (print_uptime): Use IS_USER_PROCESS and
UT_TYPE_BOOT_TIME instead of by-hand code.
2004-11-30 21:40:12 +00:00
Jim Meyering 4ed96077e8 . 2004-11-30 14:58:46 +00:00
Jim Meyering 2fadd0587d . 2004-11-28 21:26:17 +00:00
Jim Meyering b174e49170 . 2004-11-28 21:01:03 +00:00
Paul Eggert 6942c45d50 Regenerate. 2004-11-26 08:11:52 +00:00
Paul Eggert d45902c31b (link, symlink): Remove decls. 2004-11-26 07:39:57 +00:00
Paul Eggert cef32c7c86 (stat): Remove decl. 2004-11-26 07:39:32 +00:00
Paul Eggert 2a3e586dee (stat, lstat, rename): Remove decls. 2004-11-26 07:39:14 +00:00
Jim Meyering 3475a2d993 Since the changes of 2004-05-22, the u.saved_cwd member at
the bottom of the active-directory stack was no longer
strictly necessary.  This change removes that member and uses
the newer cwd_state parameter for the final restore_cwd.

(struct AD_ent) [u]: Remove now-unnecessary union.
[dev_ino]: Rename from `a'.
(AD_pop_and_chdir): Add a parameter to play the role of just-removed
bottom-of-stack cwd-state member.
(AD_pop_and_chdir): No longer return boolean.  Adjust caller.
(AD_push_initial): Remove CWD parameter.  Adjust caller.
2004-11-24 21:30:18 +00:00
Paul Eggert 557bd55cd2 (posix_date): Remove; not needed as a static var.
All uses rewritten.
(touch): Use new futimens function to operate more efficiently
in some cases.  Don't stat/fstat existing file when
(!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
old time stamps aren't needed in that case.
(main): change_times is int, not bool.  Simplify test for
change_times.
2004-11-23 20:43:47 +00:00
Jim Meyering b90f1a4404 tweak comment 2004-11-23 09:44:17 +00:00
Paul Eggert c0b70ba29b (usage): Avoid usage that runs afoul of Docbook
translation.  Problem reported by Eric S. Raymond.
2004-11-21 07:29:31 +00:00
Paul Eggert e5526bf63c (flags, usage, main): Add noctty flag to dd. 2004-11-20 08:56:44 +00:00
Jim Meyering 79fc6d94b6 (usage): Clarified description of --no-group (-G),
--human-readable (-h), --inode (-i), --size (-s), --time,
and --time-style.
2004-11-19 21:41:00 +00:00
Jim Meyering 273e13d35b (find_dir_entry): Update comment to match reality. 2004-11-19 21:36:00 +00:00
Jim Meyering 148f896119 (usage): Clarify description of --author.
Tweak indentation so that help2man creates better nroff.
2004-11-19 19:29:55 +00:00
Jim Meyering d766e90d4c (check_file): Don't check stdout for errors here. 2004-11-19 18:56:16 +00:00
Jim Meyering e26c30aa38 (robust_getcwd): Correct the comment: this function constructs the
directory name.  The caller prints it.
2004-11-18 14:46:47 +00:00
Paul Eggert a18a5093f8 Regenerate. 2004-11-17 03:50:34 +00:00
Paul Eggert 5bb58a71ad (STATFS): New macro, for portability to Solaris 9.
(do_statfs): Use it.
2004-11-17 03:12:06 +00:00
Paul Eggert c68ae6252c (main): argv is not const. 2004-11-17 00:57:11 +00:00
Paul Eggert d1bc398fa0 (main): Use getopt_long rather than getopt. 2004-11-17 00:56:25 +00:00
Paul Eggert 6fca9011e5 Add putty, screen-bce. 2004-11-16 20:49:17 +00:00
Paul Eggert 6d988bb20d (usage): Improve documentation along the lines suggested
by Debian 5.2.1-2.
2004-11-16 20:47:28 +00:00
Paul Eggert ed2fcc6f9a Fix memory leak. 2004-11-16 20:44:34 +00:00
Paul Eggert 586b8823f9 (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
macros.
(STATUS_NOXFER, statuses): New constants.
(usage, print_stats, scanargs): Add support for status=noxfer.
(usage): Update status output to match new behavior.
(print_stats): Always output complete byte count.
Put space between numbers and units, as SI requires.
Use ngettext so that i18n can use plurals for "byte" and "second".
Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
(iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
the string.
2004-11-16 07:46:08 +00:00
Paul Eggert 7d8f8967f3 Include "human.h".
(w_bytes, start_time): New vars.
(usage): Document new I/O statistics output
(print_stats): Output new I/O statistics.
(cleanup): Do statistics after closing stdin and stdout, so that
the times are more accurate.
(write_output, dd_copy): Count output bytes.
(main): Get initial value of clock.
2004-11-15 06:49:59 +00:00
Paul Eggert c7169d726f (dd_LDADD): Add $(LIB_CLOCK_GETTIME). 2004-11-15 06:49:36 +00:00
Jim Meyering 81720d306e (usage): Put the description of `[-n] STRING'
on two lines, one for `-n STRING' and one for `STRING' so that
help2man properly escapes the `-'.  Otherwise, the hyphen is
rendered inappropriately in UTF-8 locales.
2004-11-14 08:56:53 +00:00
Jim Meyering c5b7dbc58e (zaptemp): Mark new diagnostic for translation. 2004-11-14 08:36:30 +00:00
Jim Meyering 21bf149e86 . 2004-11-14 00:32:50 +00:00
Paul Eggert af6bd870f4 (zaptemp): Warn if a temporary file is not removed.
Prune unnecessary accesses to volatile locations, and take some
code out of the critical section that didn't need to be in it.
2004-11-13 04:45:58 +00:00
Paul Eggert 1b2e96f830 Make the newly-introduced critical section a bit smaller. 2004-11-13 01:02:48 +00:00
Paul Eggert 8aed6ea305 Avoid O(N**2) behavior when there are many temporary files.
(temptail): New variable, so that we can easily append to list.
(create_temp_file): Create new files at end of list, so that
searching the list has O(N**NMERGE) behavior instead of O(N**2).
(zaptemp): Update temptail if needed.
(mergefps, merge): Accept new arg that counts temp files, and keep it
up to date as we create and remove temporaries.  This is for
efficiency, so that we don't call zaptemp so often.
All callers changed.
(sort): Don't create array in reverse order, since the list of
temporaries is now in the correct order.

(zaptemp): Protect against race condition: if 'sort' is
interrupted in the middle of zaptemp, it might unlink the
temporary file twice, and the second time this happens the file
might already have been created by some other process.

(create_temp_file): Use offsetof for clarity.
(die): Move it up earlier, to clean up the code a bit.
2004-11-13 00:50:56 +00:00
Paul Eggert 48eaa73827 (strtoumax): Declare if not declared.
(skip_to_page, first_page_number, last_page_number, page_number,
first_last_page, print_header):
Use uintmax_t for page numbers.
(first_last_page): Remove unnecessary forward declaration.
Do not modify arg (it is now a const pointer).
Return a true if successful, false (without print a diagnostic)
otherwise.
(main): If +XXX does not specify a valid page range, treat it
as a file name.  This follows the response to Open Group XCU ERN 41
<http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
which says the behavior is allowed.
(skip_to_page): When starting page number exceeds page count,
print both numbers in the diagnostic.
(print_header): Detect page number overflow.
2004-11-12 19:35:54 +00:00
Paul Eggert 3c530e63c5 Sync from gnulib and regenerate. 2004-11-12 06:00:01 +00:00
Jim Meyering 594d5064c9 [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
(main) [__APPLE__]: Get the processor type via syscall rather than
hard-coding "powerpc".  From toby@opendarwin.org.
2004-11-09 20:31:39 +00:00