Commit Graph
4766 Commits
Author SHA1 Message Date
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
Jim Meyering 4d223551d7 (merge): Remove declarations of now-unused variables. 2004-11-07 07:05:38 +00:00
Paul Eggert a31bc04af0 (first_same_file): Remove. Move most of the code to....
(avoid_trashing_input): New function.
(merge): Avoid some silly merges, e.g., copying a single file to
a temporary file when there are exactly 17 input files to merge.
Take a count of temporary files rather than a max_merge arg.
All uses changed.
2004-11-06 23:46:47 +00:00
Jim Meyering 7d354a1286 . 2004-11-06 22:46:44 +00:00
Jim Meyering d73a00981c (xfclose): Don't close stdout here (just flush it),
since close_stdout now closes stdout unconditionally.
2004-11-06 22:37:02 +00:00
Paul Eggert 8a0f42dff9 (inittables, sort_buffer_size, getmonth, mergefps,
first_same_file, merge, sort, main): Use size_t for indexes into arrays.
This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
temporary files).
(getmonth, keycompare, compare): Rewrite to avoid need for alloca,
thus avoiding unchecked stack overflow in some cases.  As a side
effect this improve the performance of "sort -M" by a factor of 4
on my benchmarks.
2004-11-05 23:02:09 +00:00
Paul Eggert 5312181e5b Regenerate. 2004-11-04 00:02:19 +00:00
Paul Eggert 2c0b64899b Include "vasprintf.h" since we use vasprintf now. 2004-11-03 23:17:29 +00:00
Paul Eggert 90d6db1fbb (check-AUTHORS): Don't assume \? works in a sed
expression; it's not portable.  Problem reported by Albert Chin.
Don't invoke a program more than once.
2004-11-03 23:12:55 +00:00
Paul Eggert fe92cc42b2 (version): New variable, containing author info,
for benefit of AUTHORS check.  Use it when acting on --version option.
2004-11-03 23:11:45 +00:00
Paul Eggert 8655b4eabd Don't #define and #undef getopt around <stdlib.h>,
as this breaks the new regime that does "#define getopt rpl_getopt".
2004-11-03 18:44:33 +00:00
Jim Meyering 9f6eecc987 quote(...) file names in diagnostics. 2004-11-03 08:50:11 +00:00
Paul Eggert da9f67dcf6 Regenerate. 2004-11-03 07:47:08 +00:00
Jim Meyering 0c1c5b483d * src/tac.c (tac_file): Remove temporary prototype and move this
function `down' so that it precedes definition of tac_nonseekable.
2004-10-29 21:59:33 +00:00
Jim Meyering 259934f3a4 `tac /proc/modules' would print nothing
(copy_to_temp): Renamed from save_stdin, since
now it copies a general file descriptor, not just stdin.
(tac_nonseekable): Renamed/adapted from tac_stdin.
(tac_file): Get fd via `open' directly rather than via fopen/fileno,
since we never used the stream.  Perform "-" to stdin mapping here
rather than in main.  Determine whether a file is seekable,
by trying to `lseek' to its end, and dispatch to tac_seekable or
tac_nonseekable accordingly.
(main): Rewrite argument handling now that it uses only tac_file.
Reported by Harald Dunkel in http://bugs.debian.org/278604.
2004-10-29 21:55:15 +00:00
Jim Meyering 2168e06a9d . 2004-10-21 10:39:15 +00:00
Jim Meyering 2469a229d5 Correct my patch of 2004-10-18.
(rm): Destroy the saved_cwd here (via cwd_state),
if necessary, not in remove_dir.  Otherwise, removing multiple
`.'-relative nonempty directories no longer worked.
2004-10-21 10:37:18 +00:00
Paul Eggert a5929282a9 (usage): Improve description of --prefix.
Problem reported by Edward Welbourne.
2004-10-20 21:16:56 +00:00
Jim Meyering e302d38421 Plug a leak that would cause rm or a cross-device mv to fail when
operating on too many command-line-specified nonempty directories.

(remove_dir): Destroy the `struct saved_cwd' on the
top of the stack before returning.  This usually closes the file
descriptor that was used to return to the original working directory.
Reported by Cyril Bouthors in
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
2004-10-18 08:59:12 +00:00
Jim Meyering 385f1ab2a0 (validate_file_name): Give a more descriptive
diagnostic when pathconf fails.  This also avoids an unwarranted
warning from gcc-3.3.5 about a format not being a string literal.
2004-10-18 08:19:26 +00:00
Jim Meyering 41d58525e3 (main): Remove declaration of unused local, optc. 2004-10-18 07:54:01 +00:00
Jim Meyering bc8a38f102 (main): Remove declaration of unused local, opt. 2004-10-18 07:53:45 +00:00
Jim Meyering 4e1cbbdb67 (main): Remove declaration of unused local, c. 2004-10-18 07:52:19 +00:00
Paul Eggert 8d177f684a (AUTHORS): Add self.
Change "path" to "file name" whenever possible.
Remove usage comment, as it was a duplication of the code or doc.
Include <wchar.h> if available.
(mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
(NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
pathconf_wrapper, portable_chars, dir_ok): Remove.
(NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
(pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
(portable_chars_only): New arg FILELEN.
Don't assume ASCII; we might be on an EBCDIC host.
Don't assume unibyte locale in diagnostic.
(component_start, component_len): New functions.
(validate_file_name): Renamed from validate_path.  All uses changed.
Pretty much a complete rewrite.
Don't make copy of file arg.  Always append trailing slash to
pathconf arg, just in case it's a symlink (this is pure paranoia;
we don't know of any hosts where the trailing slash is required).
Use size_t instead of long int when possible.
Avoid need to call pathconf in most practical cases.
Don't use euidaccess several times to test searchability;
just use lstat once.  Reword diagnostic to put the (often very long)
file names last.
2004-10-18 06:30:49 +00:00
Paul Eggert c34c0ac31e (usage): Mention Unicode, and use H for hex digits. 2004-10-15 19:31:47 +00:00
Jim Meyering 3d19556081 Add .mpc as an audio suffix, too. 2004-10-12 16:58:51 +00:00
Jim Meyering 44ac21f970 Add .flac as an audio suffix. 2004-10-12 16:54:24 +00:00
Paul Eggert 677c71d285 (ignore_mode): Renamed from ignore, to avoid shadowing
problems.  All uses changed.
2004-10-05 17:38:15 +00:00
Jim Meyering 041c1bc62e remove trailing blanks. 2004-10-05 07:13:08 +00:00