Jim Meyering [Tue, 13 Mar 2001 08:28:09 +0000 (08:28 +0000)]
Do not include closeout.h.
(xfopen): Use stdout if *how != 'r'.
(mergefps): Remove FPS arg.
Open all input files, and close all files when done.
If OFP is null, open the output file (but after opening input files).
All callers changed.
(first_same_file): New function.
(sort, merge): Remove arg OFP; we now open the output file as needed.
All callers changed.
(merge): New arg MAX_MERGE. All callers changed.
(sort): For "sort F -o F", close the input before opening the output.
(main): Do not use close_stdout; 'sort' and 'merge' now close stdout.
(This also fixes a close-stdout-twice bug.)
Remove test for overlapping input and output files, as 'sort' no longer
needs to worry about overlap, and 'merge' checks for overlap itself.
Use first_same_file to inform 'merge' about how much to merge at
the top level, to avoid overlap.
Jim Meyering [Tue, 13 Mar 2001 04:17:57 +0000 (04:17 +0000)]
.
Jim Meyering [Tue, 13 Mar 2001 04:17:42 +0000 (04:17 +0000)]
.
Jim Meyering [Tue, 13 Mar 2001 04:17:07 +0000 (04:17 +0000)]
.
Jim Meyering [Mon, 12 Mar 2001 21:23:29 +0000 (21:23 +0000)]
.
Jim Meyering [Mon, 12 Mar 2001 21:19:16 +0000 (21:19 +0000)]
*** empty log message ***
Jim Meyering [Mon, 12 Mar 2001 21:17:39 +0000 (21:17 +0000)]
.
Jim Meyering [Mon, 12 Mar 2001 21:16:09 +0000 (21:16 +0000)]
*** empty log message ***
Jim Meyering [Mon, 12 Mar 2001 21:16:05 +0000 (21:16 +0000)]
`fmt --prefix=S' would not work properly for any string S containing
a byte with the high bit set.
(prefix): Declare to be of type unsigned char, not `char'.
(get_prefix): Likewise for local, `p'.
Jim Meyering [Mon, 12 Mar 2001 21:11:31 +0000 (21:11 +0000)]
*** empty log message ***
Jim Meyering [Mon, 12 Mar 2001 17:49:00 +0000 (17:49 +0000)]
*** empty log message ***
Jim Meyering [Mon, 12 Mar 2001 10:52:26 +0000 (10:52 +0000)]
*** empty log message ***
Jim Meyering [Mon, 12 Mar 2001 10:52:20 +0000 (10:52 +0000)]
(save_stdin): Use mkstemp to create temporary file.
Jim Meyering [Mon, 12 Mar 2001 10:15:08 +0000 (10:15 +0000)]
.
Jim Meyering [Sun, 11 Mar 2001 15:24:38 +0000 (15:24 +0000)]
*** empty log message ***
Jim Meyering [Sun, 11 Mar 2001 15:24:28 +0000 (15:24 +0000)]
Disable this test for now.
It would block when run in the background.
Jim Meyering [Sat, 10 Mar 2001 07:56:07 +0000 (07:56 +0000)]
clean up wording in last change
Jim Meyering [Sat, 10 Mar 2001 07:53:47 +0000 (07:53 +0000)]
*** empty log message ***
Jim Meyering [Sat, 10 Mar 2001 07:53:35 +0000 (07:53 +0000)]
(date invocation): Correct the description of how
date works when given no format. Reported by Ole Laursen.
Jim Meyering [Sat, 10 Mar 2001 07:52:40 +0000 (07:52 +0000)]
*** empty log message ***
Jim Meyering [Fri, 9 Mar 2001 18:45:59 +0000 (18:45 +0000)]
.
Jim Meyering [Fri, 9 Mar 2001 18:42:11 +0000 (18:42 +0000)]
*** empty log message ***
Jim Meyering [Fri, 9 Mar 2001 18:41:03 +0000 (18:41 +0000)]
(my_distdir): Define new variable, and use this
in place of most old uses of $(distdir).
Jim Meyering [Fri, 9 Mar 2001 18:37:57 +0000 (18:37 +0000)]
.
Jim Meyering [Fri, 9 Mar 2001 18:35:13 +0000 (18:35 +0000)]
*** empty log message ***
Jim Meyering [Fri, 9 Mar 2001 18:34:28 +0000 (18:34 +0000)]
*** empty log message ***
Jim Meyering [Fri, 9 Mar 2001 18:28:33 +0000 (18:28 +0000)]
(usage): Describe %C.
Jim Meyering [Fri, 9 Mar 2001 18:28:11 +0000 (18:28 +0000)]
(Date directives): Likewise.
Jim Meyering [Fri, 9 Mar 2001 18:24:22 +0000 (18:24 +0000)]
.
Jim Meyering [Fri, 9 Mar 2001 18:23:45 +0000 (18:23 +0000)]
*** empty log message ***
Jim Meyering [Fri, 9 Mar 2001 18:23:29 +0000 (18:23 +0000)]
Reflect change in location of input-tty.
Jim Meyering [Fri, 9 Mar 2001 18:21:56 +0000 (18:21 +0000)]
moved from stty/~
Jim Meyering [Fri, 9 Mar 2001 18:21:29 +0000 (18:21 +0000)]
moved from stty/~
Jim Meyering [Fri, 9 Mar 2001 18:20:28 +0000 (18:20 +0000)]
(EXTRA_DIST): Remove input-tty.
Jim Meyering [Fri, 9 Mar 2001 18:03:22 +0000 (18:03 +0000)]
Ensure that /dev/full is a character device
(using test -c) as well as being writable, before trying to write to it.
Otherwise, the test could mistakenly append a newline to an existing,
regular, writable, /dev/full file.
Suggested by Ulrich Drepper.
Jim Meyering [Thu, 8 Mar 2001 07:48:19 +0000 (07:48 +0000)]
*** empty log message ***
Jim Meyering [Thu, 8 Mar 2001 07:48:14 +0000 (07:48 +0000)]
Insert the `--text' argument for each test.
Jim Meyering [Tue, 6 Mar 2001 18:11:20 +0000 (18:11 +0000)]
(locale_charset): Don't use setlocale(LC_CTYPE,NULL).
Don't return NULL.
Jim Meyering [Tue, 6 Mar 2001 18:11:01 +0000 (18:11 +0000)]
(print_unicode_char): Simplify accordingly.
Jim Meyering [Tue, 6 Mar 2001 18:01:26 +0000 (18:01 +0000)]
*** empty log message ***
Jim Meyering [Tue, 6 Mar 2001 18:00:47 +0000 (18:00 +0000)]
Update for FreeBSD 4.2 and OSF/1 5.1. Add support for DOS/DJGPP.
Jim Meyering [Tue, 6 Mar 2001 05:50:10 +0000 (05:50 +0000)]
(S_TYPEISSHM): Rename parameter to reflect its type.
(main): Pass a `struct stat *', not stat.st_mode to S_TYPEISSHM.
Jim Meyering [Sun, 4 Mar 2001 21:12:06 +0000 (21:12 +0000)]
*** empty log message ***
Jim Meyering [Sun, 4 Mar 2001 21:11:50 +0000 (21:11 +0000)]
(alpha): Use $(PACKAGE)-$(VERSION), not $(distdir),
since the latter now has a `$(top_distdir)/' prefix.
Jim Meyering [Sun, 4 Mar 2001 20:53:38 +0000 (20:53 +0000)]
*** empty log message ***
Jim Meyering [Sun, 4 Mar 2001 20:53:01 +0000 (20:53 +0000)]
*** empty log message ***
Jim Meyering [Sun, 4 Mar 2001 04:04:13 +0000 (04:04 +0000)]
.
Jim Meyering [Sun, 4 Mar 2001 03:14:40 +0000 (03:14 +0000)]
(output_char): Reformat so each statement is on a separate line.
Jim Meyering [Sun, 4 Mar 2001 03:05:32 +0000 (03:05 +0000)]
.
Jim Meyering [Sun, 4 Mar 2001 01:48:17 +0000 (01:48 +0000)]
.
Jim Meyering [Sat, 3 Mar 2001 19:31:47 +0000 (19:31 +0000)]
*** empty log message ***
Jim Meyering [Sat, 3 Mar 2001 19:31:37 +0000 (19:31 +0000)]
(die): New function.
(create_temp_file, xfopen, xfclose, write_bytes, sort_buffer_size,
fillbuf, main): Use it to regularize error messages. The only change
in behavior is that write_bytes and the final close used to say "write
error" but now give just the output file name, which should be enough.
Jim Meyering [Sat, 3 Mar 2001 19:21:49 +0000 (19:21 +0000)]
*** empty log message ***
Jim Meyering [Sat, 3 Mar 2001 19:21:41 +0000 (19:21 +0000)]
(xfclose): Add FILE arg, and report the file name
on error. All callers changed.
Jim Meyering [Sat, 3 Mar 2001 19:19:12 +0000 (19:19 +0000)]
*** empty log message ***
Jim Meyering [Sat, 3 Mar 2001 19:19:06 +0000 (19:19 +0000)]
(main): When fclose (stdin) fails, do not mention
the output file in the error message; mention "-" instead.
Jim Meyering [Sat, 3 Mar 2001 19:12:29 +0000 (19:12 +0000)]
*** empty log message ***
Jim Meyering [Sat, 3 Mar 2001 19:12:23 +0000 (19:12 +0000)]
(xfopen): Set have_read_stdin to 1 only if file is "-".
Use fopen_safer, not fopen, to avoid subtle bugs when fopen returns
stdin, stdout, or stderr.
(xfclose): stdout is no longer a special case.
(main): Close output file, don't just flush it; there might be
an error on the close.
Jim Meyering [Sat, 3 Mar 2001 19:06:54 +0000 (19:06 +0000)]
(libfetish_a_SOURCES): Add dup-safer.c, fopen-safer.c.
(noinst_HEADERS): Add stdio-safer.h, unistd-safer.h.
Jim Meyering [Sat, 3 Mar 2001 19:06:28 +0000 (19:06 +0000)]
*** empty log message ***
Jim Meyering [Sat, 3 Mar 2001 19:05:36 +0000 (19:05 +0000)]
from Paul Eggert
Jim Meyering [Sat, 3 Mar 2001 18:53:53 +0000 (18:53 +0000)]
*** empty log message ***
Jim Meyering [Sat, 3 Mar 2001 18:53:44 +0000 (18:53 +0000)]
(initbuf): If the desired size cannot be
allocated, repeatedly halve it until allocation succeeds.
Jim Meyering [Sat, 3 Mar 2001 18:40:44 +0000 (18:40 +0000)]
(parse_field_count): Comment fix.
Jim Meyering [Sat, 3 Mar 2001 18:38:22 +0000 (18:38 +0000)]
.
Jim Meyering [Sat, 3 Mar 2001 18:23:37 +0000 (18:23 +0000)]
*** empty log message ***
Jim Meyering [Sat, 3 Mar 2001 18:23:29 +0000 (18:23 +0000)]
Tune allocation and comparison of nodes
representing temp files. This improved CPU performance of
'sort -S 1 *.[ch]' by 17% on my host.
(struct tempnode): name member now uses struct hack.
(temphead): Now a pointer, not a structure. All uses changed.
(create_temp_file): Allocate node using struct hack.
(zaptemp): Free node using struct hack. Use pointer comparison, not
string comparison.
Jim Meyering [Fri, 2 Mar 2001 03:44:49 +0000 (03:44 +0000)]
(eolchar, trim_trailing_blanks): Now static.
Jim Meyering [Fri, 2 Mar 2001 03:41:50 +0000 (03:41 +0000)]
*** empty log message ***
Jim Meyering [Fri, 2 Mar 2001 03:14:38 +0000 (03:14 +0000)]
*** empty log message ***
Jim Meyering [Fri, 2 Mar 2001 03:14:31 +0000 (03:14 +0000)]
(jm_MACROS): Use mkstemp replacement if the system
lacks mkstemp. Compile our own tempname.c if we compile our own
mkstemp.c, as mkstemp relies on tempname.
Jim Meyering [Fri, 2 Mar 2001 03:13:34 +0000 (03:13 +0000)]
from GNU libc
Jim Meyering [Fri, 2 Mar 2001 03:12:47 +0000 (03:12 +0000)]
from GNU libc
Jim Meyering [Fri, 2 Mar 2001 03:10:42 +0000 (03:10 +0000)]
*** empty log message ***
Jim Meyering [Fri, 2 Mar 2001 03:06:08 +0000 (03:06 +0000)]
.
Jim Meyering [Fri, 2 Mar 2001 02:58:30 +0000 (02:58 +0000)]
*** empty log message ***
Jim Meyering [Fri, 2 Mar 2001 02:58:23 +0000 (02:58 +0000)]
'sort' race condition fixes.
Defend against a DoS attack where someone else creates a
temporary file with the same name as ours. Use mkstemp to do
this, supplying our own mkstemp if the system doesn't have one.
Also, fix a race condition during cleanup on hosts without
sigaction.
(NAME_MAX_IN_DIR): Remove.
(sigprocmask, sigset_t): New macros, defined only on older hosts.
(caught_signals): New var.
(xtmpfopen, tempname): Removed.
(create_temp_file): New function, combining the functions of the old
xtmpfopen and tempname. All callers changed.
Use mkstemp to create the file.
(sighandler): On hosts without sigaction, ignore signals while
cleaning up, instead of letting them interrupt cleanup.
(main): Initialize caught_signals. On hosts with sigaction, block all
caught signals while handling one. Remove duplicate code.
Jim Meyering [Thu, 1 Mar 2001 05:33:25 +0000 (05:33 +0000)]
*** empty log message ***
Jim Meyering [Thu, 1 Mar 2001 05:33:18 +0000 (05:33 +0000)]
(jm_AC_DOS): Remove extra backslashes, now that
AH_VERBATIM really does output its argument verbatim.
Jim Meyering [Sun, 25 Feb 2001 07:55:33 +0000 (07:55 +0000)]
*** empty log message ***
Jim Meyering [Sun, 25 Feb 2001 07:55:27 +0000 (07:55 +0000)]
Fix typo: '-d=1may' -> '-d 1may'.
Fix and clarify time zone usage in 'date' examples.
Jim Meyering [Fri, 23 Feb 2001 08:52:27 +0000 (08:52 +0000)]
*** empty log message ***
Jim Meyering [Thu, 22 Feb 2001 15:11:08 +0000 (15:11 +0000)]
(keycompare): Move declarations of locals, lena and lenb,
into the inner scope where they are used.
Jim Meyering [Wed, 21 Feb 2001 10:56:06 +0000 (10:56 +0000)]
(main): Remove assignment-in-if-expression.
In fact, remove t_errno altogether.
Jim Meyering [Wed, 21 Feb 2001 10:50:07 +0000 (10:50 +0000)]
*** empty log message ***
Jim Meyering [Wed, 21 Feb 2001 10:49:58 +0000 (10:49 +0000)]
Add two tests of existing behavior -- both will
have to be changed (soon after release), once ls is fixed.
Jim Meyering [Tue, 20 Feb 2001 23:04:45 +0000 (23:04 +0000)]
.
Jim Meyering [Tue, 20 Feb 2001 23:00:33 +0000 (23:00 +0000)]
test for existing behavior
Jim Meyering [Tue, 20 Feb 2001 22:58:44 +0000 (22:58 +0000)]
.
Jim Meyering [Tue, 20 Feb 2001 22:58:16 +0000 (22:58 +0000)]
*** empty log message ***
Jim Meyering [Tue, 20 Feb 2001 22:53:38 +0000 (22:53 +0000)]
(FULL_TIME_OPTION): Renamed from FULL_TIME, for
consistency with the other enum values.
Jim Meyering [Tue, 20 Feb 2001 22:52:31 +0000 (22:52 +0000)]
(SI_OPTION): New enum value.
(long_options): Use it instead of 'H' for --si.
(decode_switches): Warn that -H will change soon.
(usage): Likewise.
Jim Meyering [Tue, 20 Feb 2001 22:48:39 +0000 (22:48 +0000)]
revert last change, until after release
Jim Meyering [Tue, 20 Feb 2001 22:48:18 +0000 (22:48 +0000)]
*** empty log message ***
Jim Meyering [Tue, 20 Feb 2001 22:48:00 +0000 (22:48 +0000)]
revert last change, until after the release
Jim Meyering [Tue, 20 Feb 2001 08:16:47 +0000 (08:16 +0000)]
`ls -Fd symlink-to-directory' would print a trailing `/'
Now it prints a trailing `@'.
(gobble_file): Don't clobber lstat stats of command line
arguments when using -d and -F (--directory and --classify) options.
Jim Meyering [Mon, 19 Feb 2001 08:53:37 +0000 (08:53 +0000)]
*** empty log message ***
Jim Meyering [Mon, 19 Feb 2001 08:53:24 +0000 (08:53 +0000)]
(AUTHORS): Add Paul Eggert.
Jim Meyering [Mon, 19 Feb 2001 08:52:58 +0000 (08:52 +0000)]
*** empty log message ***
Jim Meyering [Mon, 19 Feb 2001 08:52:53 +0000 (08:52 +0000)]
Fix a race condition: freed storage accessed during a signal handler.
(struct tempnode.next): Now volatile.
(zaptemp): Free the file name after removing it from the temp list,
not before, because a signal can arrive between the two actions
and cleanup () traverses the list.