Compare commits

...

104 Commits

Author SHA1 Message Date
Jim Meyering
97c9216e92 . 1999-05-23 21:06:36 +00:00
Jim Meyering
f914ebb255 *** empty log message *** 1999-05-23 20:46:23 +00:00
Jim Meyering
3fed986eee *** empty log message *** 1999-05-23 20:45:34 +00:00
Jim Meyering
5cd334b32e . 1999-05-23 20:44:48 +00:00
Jim Meyering
a54b71f493 *** empty log message *** 1999-05-23 20:43:11 +00:00
Jim Meyering
08f55c4b7c Correct erroneous expected output from the `cp -f foo foo' tests. 1999-05-23 20:42:25 +00:00
Jim Meyering
994746ffe9 (libfu_a_SOURCES): Add same.c.
(noinst_HEADERS): Add same.h.
1999-05-23 20:40:59 +00:00
Jim Meyering
645015312e Remove today's earlier misguided attempts.
Add a single condition to the existing sameness test.
1999-05-23 20:37:16 +00:00
Jim Meyering
642d250781 Include same.h.
(copy_internal): Qualify SAME_INODE test with (link-count == 1
|| same_name(...)).
1999-05-23 19:45:33 +00:00
Jim Meyering
00fbb65ec1 *** empty log message *** 1999-05-23 19:43:10 +00:00
Jim Meyering
0e96b5d2e7 New file (function extracted from ln.c). 1999-05-23 19:42:59 +00:00
Jim Meyering
2a8c9424f0 (same_name): Remove function.
<same.h>: Include this instead.
<dirname.h>: No longer include this.
1999-05-23 19:41:19 +00:00
Jim Meyering
96074cef79 *** empty log message *** 1999-05-23 19:38:53 +00:00
Jim Meyering
27893412b2 white-space tweak 1999-05-23 19:27:36 +00:00
Jim Meyering
ff08632036 white-space tweak 1999-05-23 19:27:07 +00:00
Jim Meyering
0868b5794a (copy_internal): Make it so `mv -f FILE FILE' does not remove FILE.
Based on a patch from Chris Yeo.
1999-05-23 14:52:32 +00:00
Jim Meyering
46945ad760 *** empty log message *** 1999-05-23 14:49:14 +00:00
Jim Meyering
78d7d7b746 *** empty log message *** 1999-05-23 13:36:37 +00:00
Jim Meyering
77cf4d48dd (TESTS): Add force.
(TESTS_ENVIRONMENT): Change PATH to be absolute.
1999-05-23 13:36:14 +00:00
Jim Meyering
e7eeacebbc *** empty log message *** 1999-05-23 04:19:10 +00:00
Jim Meyering
dee24e9fac *** empty log message *** 1999-05-23 04:01:55 +00:00
Jim Meyering
65ffd691ee *** empty log message *** 1999-05-23 03:59:08 +00:00
Jim Meyering
80ef68e006 *** empty log message *** 1999-05-22 22:10:34 +00:00
Jim Meyering
b5b54d2fed *** empty log message *** 1999-05-22 22:02:54 +00:00
Jim Meyering
1f2dc06993 *** empty log message *** 1999-05-22 22:02:00 +00:00
Jim Meyering
2b477f5dc4 (AC_REPLACE_FUNCS): Add memchr. 1999-05-22 22:00:42 +00:00
Jim Meyering
39d0a166c5 *** empty log message *** 1999-05-22 16:56:40 +00:00
Jim Meyering
dae50ead45 *** empty log message *** 1999-05-22 12:53:07 +00:00
Jim Meyering
be6aea6fb9 Document locale-specific changes to `sort',
as well as the new, POSIX-compliant definition of line comparison,
and -g's more careful treatment of NaNs, infinities and zeros.
1999-05-22 12:52:41 +00:00
Jim Meyering
9e48e223db (general_numcompare): Put exceptional cases
first, not last, to be consistent with -M.
1999-05-22 12:52:14 +00:00
Jim Meyering
59b22bd058 *** empty log message *** 1999-05-22 04:30:36 +00:00
Jim Meyering
77d5a18a9b *** empty log message *** 1999-05-22 04:29:30 +00:00
Jim Meyering
4539e57b3c . 1999-05-22 04:24:10 +00:00
Jim Meyering
668807df85 . 1999-05-22 02:53:08 +00:00
Jim Meyering
b66bd5f56c *** empty log message *** 1999-05-22 02:48:22 +00:00
Jim Meyering
7bac5533d7 (strtod): Declare if STDC_HEADERS is not defined.
(general_numcompare): Use strtod, not xstrtod.
Do not consider partial conversions to be errors.
Put -infinity at the start, and +infinity at the end;
follow +infinity with NaNs (sorted by bit pattern),
and finally by conversion errors.
1999-05-22 02:47:45 +00:00
Jim Meyering
28c635adb2 (use-nl): New test from Paul Eggert. 1999-05-22 02:41:39 +00:00
Jim Meyering
125ce0f85c tweak comment 1999-05-22 02:37:47 +00:00
Jim Meyering
157c31573e (11d): Reverse lines in expected output to reflect latest change. 1999-05-22 02:37:10 +00:00
Jim Meyering
67fbe7e2a0 remove trailing newline 1999-05-21 20:47:18 +00:00
Jim Meyering
c734236a6f *** empty log message *** 1999-05-21 20:24:39 +00:00
Jim Meyering
d6261d35c9 Treat the trailing newline as part of the line, as required by POSIX.2.
(struct line, findlines, compare, checkfp, mergefps, sort):
A line now includes its trailing newline.
(findlines): Do not replace newline with NUL.
(memcoll, keycompare): Work even if the data to be compared are
adjacent strings; this is possible now that lines contain the
trailing newline.
(fillbuf): Always have an unused byte at the end of the	buffer,
since memcoll and keycompare want to modify a byte after the last line.
(sortalloc, mergealloc): Increase by 1, for trailing byte.
1999-05-21 20:24:19 +00:00
Jim Meyering
db0d476b12 *** empty log message *** 1999-05-21 19:53:05 +00:00
Jim Meyering
07add9a796 . 1999-05-20 20:12:17 +00:00
Jim Meyering
46e594f9bc [AC_SEARCH_LIBS]: Quote name in undefine.
Add a colon after each `then' in case $4 is empty.
1999-05-20 20:12:12 +00:00
Jim Meyering
6501594508 . 1999-05-20 20:10:17 +00:00
Jim Meyering
d60127857c . 1999-05-20 16:51:40 +00:00
Jim Meyering
0a4ebdb1d3 *** empty log message *** 1999-05-20 16:51:29 +00:00
Jim Meyering
559f32b40d Add test case from Paul Eggert. 1999-05-20 16:48:56 +00:00
Jim Meyering
bffbff4ff2 *** empty log message *** 1999-05-20 16:29:51 +00:00
Jim Meyering
d30365509d (keycompare): Ignore any length difference if the
localized comparison says the strings are equal.
1999-05-20 16:29:38 +00:00
Jim Meyering
9a27ea2eb2 (memcoll, keycompare, compare): Handle NUL
characters properly when comparing with LC_COLLATE semantics.
(NLS_MEMCMP): Remove.
(memcoll): Renamed from strncoll.
Take separate lengths for each string.
This function is now invoked only when need_locale.
(keycompare): Don't copy strings when ignore and translate
are both NULL.
1999-05-20 16:09:12 +00:00
Jim Meyering
61b2bceab7 (MONTHTAB_CONST): Renamed from NLS_CONST; the use
is also changed.  Define to const also if !HAVE_NL_LANGINFO.

(usage): `,' -> `;' (English typo).
1999-05-20 03:52:15 +00:00
Jim Meyering
0f5bb7dd4e add the comment to go with last change 1999-05-20 03:49:25 +00:00
Jim Meyering
a0766fb80f (get_date): Let mktime deduce tm_isdst if we
have an absolute timestamp, or if the relative timestamp
mentions days, months, or years.
1999-05-20 03:47:24 +00:00
Jim Meyering
867c8b0e85 . 1999-05-19 14:31:53 +00:00
Jim Meyering
98270d63fb (main): When stdout is in binary mode, make sure all
input files are also read in binary mode.
1999-05-18 14:13:33 +00:00
Jim Meyering
d9076a130e *** empty log message *** 1999-05-17 13:10:53 +00:00
Jim Meyering
8d5798a538 *** empty log message *** 1999-05-17 13:10:31 +00:00
Jim Meyering
1ee4fffc88 (human_readable): Allow from_block_size to be zero. 1999-05-17 13:03:46 +00:00
Jim Meyering
4fd5e02337 . 1999-05-16 19:13:59 +00:00
Jim Meyering
92462cca2a . 1999-05-16 19:11:16 +00:00
Jim Meyering
a162f70539 *** empty log message *** 1999-05-16 19:09:25 +00:00
Jim Meyering
cbdd9172f9 . 1999-05-16 16:54:01 +00:00
Jim Meyering
bc48b59612 *** empty log message *** 1999-05-16 16:53:02 +00:00
Jim Meyering
901dc5cba9 *** empty log message *** 1999-05-16 16:43:22 +00:00
Jim Meyering
108ff5810f Don't autodetect the locale of numbers and
months, as this conflicts with POSIX.2 and is tricky to boot.

(FLOATING_COMMA, NLS_STRNCMP, NLS_MAX_GROUPS,
NLS_ONE_CHARACTER_STRING): Remove macros no longer used.

(nls_grouping, nls_fraction_found, nls_month_found, nos_monthtab,
nls_months_collide, nls_keyhead, us_monthtab): Remove variables no
longer used.

(struct nls_keyfield): Remove types no longer used.

(strncoll_s2_readonly, nls_set_fraction, look_for_fraction,
nls_month_is_either_locale, nls_numeric_format): Remove functions no
longer used.

(monthtab): Now has the role that us_monthtab had, but it's const only
if ENABLE_NLS is not defined.

(C_DECIMAL_POINT): Renamed from FLOATING_POINT.  All uses changed.
(MONTHS_PER_YEAR): Renamed from NLS_NUM_MONTHS.  All uses changed.
(struct_month_cmp): Renamed from nls_sort_month_comp.  All uses changed.
Use strcmp, not strcoll, since the user doesn't care about collating
here.

(inittables): Read locale data into monthtab, rather than modifying a
separate month table and futzing with indirection.  Do not worry about
colliding months, since we no longer autodetect month locale.

(fraccompare): Don't set no-longer-used variable nls_fraction_found.

(getmonth): Use strncmp to compare months, since user doesn't care
about collating here.  Fix bug where code incorrectly assumed that
strlen (monthtab[lo].name) == strlen (monthtab[ix].name).

(keycompare, main): Don't autodetect month locale.

(compare): Don't use NLS_MEMCP in code that can't be executed if
need_locale is false, as NLS_MEMCP is equivalent to memcmp in that
case.

(sort, insertkey, main): Don't autodetect numeric locale.
1999-05-16 16:18:46 +00:00
Jim Meyering
4b11c1f734 *** empty log message *** 1999-05-16 15:50:56 +00:00
Jim Meyering
3cf365bf7e *** empty log message *** 1999-05-16 15:50:04 +00:00
Jim Meyering
f2a1097c92 . 1999-05-16 15:48:43 +00:00
Jim Meyering
3d2009b52d New file to override autoconf's AC_SEARCH_LIBS. 1999-05-16 15:48:11 +00:00
Jim Meyering
73a206d970 . 1999-05-15 06:13:00 +00:00
Jim Meyering
dad89f8b93 . 1999-05-15 05:46:45 +00:00
Jim Meyering
23d3bb9416 (usage): Whoops. 1999-05-15 05:46:12 +00:00
Jim Meyering
cd0c914437 *** empty log message *** 1999-05-15 05:42:55 +00:00
Jim Meyering
dace9c7477 . 1999-05-15 05:30:51 +00:00
Jim Meyering
1acf1ddd65 (trailing-sp): New test for this fix. 1999-05-15 05:28:51 +00:00
Jim Meyering
771bc6ea9d (xfields): Don't interpret a trailing blank as a
delimiter when e.g. -t: was specified.  From Tim Smithers.
1999-05-15 05:28:16 +00:00
Jim Meyering
634a39aad5 (getugroups): Don't dereference a null pointer when
running `id USER' for some USER that is listed on the RHS in /etc/group.
From Sander van Malssen.
Add some curly braces, use STREQ, reverse the sense of a test
and use `continue' to save a level of nesting.
1999-05-15 04:50:26 +00:00
Jim Meyering
7af9c3c085 *** empty log message *** 1999-05-15 04:11:13 +00:00
Jim Meyering
d8c0345769 *** empty log message *** 1999-05-15 04:08:29 +00:00
Jim Meyering
0a25564c1c (open_maybe_create): Handle Solaris' failure mode when
FILE is a directory.  Reported by Vin Shelton.
1999-05-15 04:06:51 +00:00
Jim Meyering
7565800a11 (main): When asking for info on an explicit file name,
just warn rather than failing if the table of mounted filesystems
cannot be read.
1999-05-15 01:53:21 +00:00
Jim Meyering
2d97b1c61b (version_etc): Put version info and author names
on the first two lines respectively rather than putting the three
lines of copyright info between them.
1999-05-14 17:11:03 +00:00
Jim Meyering
1fdc84d5a2 *** empty log message *** 1999-05-14 16:59:46 +00:00
Jim Meyering
c93ac403ed Include <string.h> or <strings.h> for strlen prototype. 1999-05-13 20:48:44 +00:00
Jim Meyering
4c9f46a4a1 [__GLIBC__ >= 2]: #if-out prototypes. 1999-05-13 20:44:45 +00:00
Jim Meyering
59d16049d8 (pop_dir): Cast length to `int' to avoid a warning on
64-bit systems.  From Ulrich Drepper.
1999-05-13 20:42:45 +00:00
Jim Meyering
5a83986f79 (main): Put `u' for -u in getopt_long's string argument.
Remove the `R'.
1999-05-12 16:50:54 +00:00
Jim Meyering
150ca569b5 *** empty log message *** 1999-05-12 16:01:29 +00:00
Jim Meyering
048a38dc54 Use `%%' place-holder that Makefile.am rule expects. 1999-05-12 15:54:52 +00:00
Jim Meyering
ece1dc4e51 (usage): Split the --help message into two pieces so that
neither is longer than 2048.  For Irix4's cc.  Reported by Kaveh Ghazi.
1999-05-12 14:58:30 +00:00
Jim Meyering
c1a461273d (usage): Split --help message into two pieces so that
Split the --help message into two pieces so that neither is longer
than 2048.  For Irix4's cc.  Reported by Kaveh Ghazi.
1999-05-12 02:13:45 +00:00
Jim Meyering
da36bbf417 *** empty log message *** 1999-05-12 02:10:38 +00:00
Jim Meyering
74e5374045 *** empty log message *** 1999-05-11 16:30:03 +00:00
Jim Meyering
f039432d03 Fix typos in config.h comments. 1999-05-11 16:29:56 +00:00
Jim Meyering
5af7e261fa Fix typos in config.h comments. 1999-05-11 16:29:33 +00:00
Jim Meyering
ce1d9075d7 *** empty log message *** 1999-05-10 17:25:27 +00:00
Jim Meyering
c23f5758dc (AUTHORS): Reflect reality: add Kaveh. 1999-05-10 15:12:24 +00:00
Jim Meyering
af735060cb Expand each `&' character in the gecos field.
(count_ampersands): New function.
(create_fullname): New function.
(print_entry): Use create_fullname here.
(print_long_entry): Use it here, too.
From Kaveh Ghazi.
1999-05-10 14:17:09 +00:00
Jim Meyering
0ff57399ed *** empty log message *** 1999-05-10 05:24:38 +00:00
Jim Meyering
447527eeb5 Reflect renaming: AM_FUNC_MKTIME -> AC_FUNC_MKTIME. 1999-05-10 05:18:30 +00:00
Jim Meyering
d845b9a5a3 Require 2.14.1, since we use newly-renamed AC_FUNC_MKTIME. 1999-05-10 05:17:38 +00:00
Jim Meyering
f1b3fb4f3b Update from libc. 1999-05-10 04:24:49 +00:00
78 changed files with 1086 additions and 825 deletions

4
THANKS
View File

@@ -20,6 +20,7 @@ Bjorn Helgaas: helgaas@rsn.hp.com
Bob McCracken: kerouac@ravenet.com
Brendan O'Dea: bod@compusol.com.au
Charles Karney: karney@pppl.gov
Chris Yeo: cyeo@biking.org
Christian von Roques: roques@pond.sub.org
Colin Plumb: colin@nyx.net
Dirk Lattermann: dlatt@t-online.de
@@ -59,6 +60,7 @@ Matthew S. Levine: mslevine@theory.lcs.mit.edu
Matthew Swift: swift@alum.mit.edu
Matthias Urlichs: smurf@noris.de
Michiel Bacchiani: bacchian@raven.bu.edu
Michael Veksler: mveksler@techunix.technion.ac.il
Miles Bader: miles@gnu.ai.mit.edu
Noel Cragg: noel@red-bean.com
Olav Morkrid: olav@funcom.com
@@ -76,7 +78,7 @@ Ton Hospel: thospel@mail.dma.be
Torbjorn Lindgren: tl@funcom.no
Tony Leneis: tony@plaza.ds.adp.com
Ulrich Drepper: drepper@cygnus.com
Vin Shelton: acs@alumni.princeton.edu
Volker Borchert: bt@teknon.de
Michael Veksler: mveksler@techunix.technion.ac.il
Wayne Stewart: wstewa@atl.com
William Bader: william@nscs.fast.net

View File

@@ -109,6 +109,7 @@ EXTRA_DIST = perm.texi getdate.texi
# and those names all map to one 14-byte name (<package>.info-) on some crufty
# old systems.
MAKEINFO = makeinfo --no-split
subdir = doc
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
@@ -235,8 +236,9 @@ uninstall-info:
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
list='$(INFO_DEPS)'; \
for file in $$list; do \
echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file"; \
install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
d=$(srcdir); \
echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $$d/$$file"; \
install-info --info-dir=$(DESTDIR)$(infodir) --remove $$d/$$file; \
done; \
else :; fi
@$(NORMAL_UNINSTALL)
@@ -284,8 +286,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = doc
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -44,7 +44,7 @@ START-INFO-DIR-ENTRY
* tsort: (textutils)tsort invocation. Topological sort.
* tr: (textutils)tr invocation. Translate characters.
* unexpand: (textutils)unexpand invocation. Convert spaces to tabs.
* uniq: (textutils)uniq invocation. Uniqify files.
* uniq: (textutils)uniq invocation. Uniquify files.
* wc: (textutils)wc invocation. Byte, word, and line counts.
END-INFO-DIR-ENTRY
@end format
@@ -161,7 +161,7 @@ Summarizing files
Operating on sorted files
* sort invocation:: Sort text files.
* uniq invocation:: Uniqify files.
* uniq invocation:: Uniquify files.
* comm invocation:: Compare two sorted files line by line.
* ptx invocation:: Produce a permuted index of file contents.
* tsort invocation:: Topological sort.
@@ -672,7 +672,7 @@ Output at most @var{bytes} bytes of the input. Prefixes and suffixes on
@opindex --strings
@cindex string constants, outputting
Instead of the normal output, output only @dfn{string constants}: at
least @var{n} (3 by default) consecutive ASCII graphic characters,
least @var{n} (3 by default) consecutive @sc{ASCII} graphic characters,
followed by a null (zero) byte.
@item -t @var{type}
@@ -687,14 +687,14 @@ of each output line using each of the data types that you specified,
in the order that you specified.
Adding a trailing ``z'' to any type specification appends a display
of the ASCII character representation of the printable characters
of the @sc{ASCII} character representation of the printable characters
to the output line generated by the type specification.
@table @samp
@item a
named character,
@item c
ASCII character or backslash escape,
@sc{ASCII} character or backslash escape,
@item d
signed decimal,
@item f
@@ -779,7 +779,7 @@ Output as octal bytes. Equivalent to @samp{-toC}.
@item -c
@opindex -c
Output as ASCII characters or backslash escapes. Equivalent to
Output as @sc{ASCII} characters or backslash escapes. Equivalent to
@samp{-tc}.
@item -d
@@ -1998,7 +1998,7 @@ These commands work with (or produce) sorted files.
@menu
* sort invocation:: Sort text files.
* uniq invocation:: Uniqify files.
* uniq invocation:: Uniquify files.
* comm invocation:: Compare two sorted files line by line.
* ptx invocation:: Produce a permuted index of file contents.
* tsort invocation:: Topological sort.
@@ -2043,18 +2043,21 @@ works.
@end table
@vindex LC_COLLATE
A pair of lines is compared as follows: if any key fields have been
specified, @code{sort} compares each pair of fields, in the order
specified on the command line, according to the associated ordering
options, until a difference is found or no fields are left.
Unless otherwise specified, all comparisons use the character
collating sequence specified by the @env{LC_COLLATE} locale.
If any of the global options @samp{Mbdfinr} are given but no key fields
are specified, @code{sort} compares the entire lines according to the
global options.
Finally, as a last resort when all keys compare equal (or if no
ordering options were specified at all), @code{sort} compares the lines
byte by byte in machine collating sequence. The last resort comparison
ordering options were specified at all), @code{sort} compares the entire
lines. The last resort comparison
honors the @samp{-r} global option. The @samp{-s} (stable) option
disables this last-resort comparison so that lines in which all fields
compare equal are left in their original relative order. If no fields
@@ -2063,7 +2066,10 @@ or global options are specified, @samp{-s} has no effect.
GNU @code{sort} (as specified for all GNU utilities) has no limits on
input line length or restrictions on bytes allowed within lines. In
addition, if the final byte of an input file is not a newline, GNU
@code{sort} silently supplies one.
@code{sort} silently supplies one. A line's trailing newline is part of
the line for comparison purposes; for example, with no options in an
@sc{ASCII} locale, a line starting with a tab sorts before an empty line
because tab precedes newline in the @sc{ASCII} collating sequence.
Upon any error, @code{sort} exits with a status of @samp{2}.
@@ -2073,11 +2079,14 @@ value as the directory for temporary files instead of @file{/tmp}. The
@samp{-T @var{tempdir}} option in turn overrides the environment
variable.
@vindex LC_CTYPE
The following options affect the ordering of output lines. They may be
specified globally or as part of a specific key field. If no key
fields are specified, global options apply to comparison of entire
lines; otherwise the global options are inherited by key fields that do
not specify any special options of their own.
not specify any special options of their own. The @samp{-b}, @samp{-d},
@samp{-f} and @samp{-i} options classify characters according to
the @env{LC_CTYPE} locale.
@table @samp
@@ -2102,40 +2111,59 @@ sorting so that, for example, @samp{b} and @samp{B} sort as equal.
@item -g
@opindex -g
@cindex general numeric sort
Sort numerically, but use strtod(3) to arrive at the numeric values.
Sort numerically, using the standard C function @code{strtod} to convert
a prefix of each line to a double-precision floating point number.
This allows floating point numbers to be specified in scientific notation,
like @code{1.0e-34} and @code{10e100}. Use this option only if there
is no alternative; it is much slower than @samp{-n} and numbers with
too many significant digits will be compared as if they had been
truncated. In addition, numbers outside the range of representable
double precision floating point numbers are treated as if they were
zeroes; overflow and underflow are not reported.
like @code{1.0e-34} and @code{10e100}.
Do not report overflow, underflow, or conversion errors.
Use the following collating sequence:
@itemize @bullet
@item
Lines that do not start with numbers (all considered to be equal).
@item
NaNs (``Not a Number'' values, in IEEE floating point arithmetic)
in a consistent but machine-dependent order.
@item
Minus infinity.
@item
Finite numbers in ascending numeric order (with @math{-0} and @math{+0} equal).
@item
Plus infinity.
@end itemize
Use this option only if there is no alternative; it is much slower than
@samp{-n} and it can lose information when converting to floating point.
@item -i
@opindex -i
@cindex unprintable characters, ignoring
Ignore characters outside the printable ASCII range 040-0176 octal
(inclusive) when sorting.
Ignore unprintable characters.
@item -M
@opindex -M
@cindex months, sorting by
@vindex LC_TIME
An initial string, consisting of any amount of whitespace, followed
by three letters abbreviating a month name, is folded to UPPER case and
by a month name abbreviation, is folded to UPPER case and
compared in the order @samp{JAN} < @samp{FEB} < @dots{} < @samp{DEC}.
Invalid names compare low to valid names.
Invalid names compare low to valid names. The @env{LC_TIME} locale
determines the month spellings.
@item -n
@opindex -n
@cindex numeric sort
@vindex LC_NUMERIC
Sort numerically: the number begins each line; specifically, it consists
of optional whitespace, an optional @samp{-} sign, and zero or more
digits, optionally followed by a decimal point and zero or more digits.
digits possibly separated by thousands separators, optionally followed
by a radix character and zero or more digits. The @env{LC_NUMERIC}
locale specifies the radix character and thousands separator.
@code{sort -n} uses what might be considered an unconventional method
to compare strings representing floating point numbers. Rather than
first converting each string to the C @code{double} type and then
comparing those values, sort aligns the decimal points in the two
comparing those values, sort aligns the radix characters in the two
strings and compares the strings a character at a time. One benefit
of using this approach is its speed. In practice this is much more
efficient than performing the two corresponding string-to-double (or even
@@ -2180,7 +2208,7 @@ following.
@item -u
@opindex -u
@cindex uniqifying output
@cindex uniquifying output
For the default case or the @samp{-m} option, only output the first
of a sequence of lines that compare equal. For the @samp{-c} option,
check that no pair of consecutive lines compares equal.
@@ -2199,7 +2227,7 @@ See below for more examples.
@opindex -z
@cindex sort zero-terminated lines
Treat the input as a set of lines, each terminated by a zero byte (@sc{ASCII}
@sc{NUL} (Null) character) instead of a @sc{ASCII} @sc{LF} (Line Feed.)
@sc{NUL} (Null) character) instead of an @sc{ASCII} @sc{LF} (Line Feed).
This option can be useful in conjunction with @samp{perl -0} or
@samp{find -print0} and @samp{xargs -0} which do the same in order to
reliably handle arbitrary pathnames (even those which contain Line Feed
@@ -2342,10 +2370,10 @@ sort -t : -b -k 5,5 -k 3,3n /etc/passwd
@node uniq invocation
@section @code{uniq}: Uniqify files
@section @code{uniq}: Uniquify files
@pindex uniq
@cindex uniqify files
@cindex uniquify files
@code{uniq} writes the unique lines in the given @file{input}, or
standard input if nothing is given or for an @var{input} name of
@@ -2618,7 +2646,7 @@ As it is setup now, the program assumes that the input file is coded
using 8-bit ISO 8859-1 code, also known as Latin-1 character set,
@emph{unless} if it is compiled for MS-DOS, in which case it uses the
character set of the IBM-PC. (GNU @code{ptx} is not known to work on
smaller MS-DOS machines anymore.) Compared to 7-bit ASCII, the set of
smaller MS-DOS machines anymore.) Compared to 7-bit @sc{ASCII}, the set of
characters which are letters is then different, this fact alters the
behaviour of regular expression matching. Thus, the default regular
expression for a keyword allows foreign or diacriticized letters.
@@ -2907,7 +2935,7 @@ sequence @code{^\@{ @}} and @code{~\@{ @}} respectively. Other
diacriticized characters of the underlying character set produce an
appropriate @TeX{} sequence as far as possible. The other non-graphical
characters, like newline and tab, and all others characters which are
not part of ASCII, are merely changed to exactly one space, with no
not part of @sc{ASCII}, are merely changed to exactly one space, with no
special attempt to compress consecutive spaces. Let me know how to
improve this special character processing for @TeX{}.
@@ -3842,8 +3870,8 @@ yourself using when setting up fancy data plumbing. The @code{sort}
command reads and sorts each file named on the command line. It then
merges the sorted data and writes it to standard output. It will read
standard input if no files are given on the command line (thus
making it into a filter). The sort is based on the machine collating
sequence (@sc{ASCII}) or based on user-supplied ordering criteria.
making it into a filter). The sort is based on the character collating
sequence or based on user-supplied ordering criteria.
@node The uniq command
@@ -4019,7 +4047,7 @@ $ tr '[A-Z]' '[a-z]' < whats.gnu | tr -cd '[A-Za-z0-9_ \012]' | ...
The second @code{tr} command operates on the complement of the listed
characters, which are all the letters, the digits, the underscore, and
the blank. The @samp{\012} represents the newline character; it has to
be left alone. (The ASCII TAB character should also be included for
be left alone. (The @sc{ASCII} tab character should also be included for
good measure in a production script.)
At this point, we have data consisting of words separated by blank space.
@@ -4065,7 +4093,7 @@ with the help of two more @code{sort} options:
@table @samp
@item -n
do a numeric sort, not an ASCII one
do a numeric sort, not a textual one
@item -r
reverse the order of the sort

View File

@@ -11,7 +11,7 @@ addext.c argmatch.c backupfile.c basename.c \
closeout.c dirname.c exclude.c filemode.c \
full-write.c human.c idcache.c \
isdir.c long-options.c makepath.c modechange.c hash.c path-concat.c \
quotearg.c safe-read.c save-cwd.c savedir.c stripslash.c userspec.c \
quotearg.c safe-read.c same.c save-cwd.c savedir.c stripslash.c userspec.c \
version-etc.c xgetcwd.c xmalloc.c xstrdup.c \
xstrtol.c xstrtoul.c xstrtoumax.c yesno.c
@@ -22,7 +22,8 @@ noinst_HEADERS = argmatch.h backupfile.h closeout.h \
dirname.h error.h exclude.h filemode.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
posixtm.h quotearg.h regex.h safe-read.h same.h save-cwd.h \
savedir.h strverscmp.h \
version-etc.h xalloc.h xstrtol.h
BUILT_SOURCES = getdate.c lstat.c stat.c

View File

@@ -108,7 +108,7 @@ addext.c argmatch.c backupfile.c basename.c \
closeout.c dirname.c exclude.c filemode.c \
full-write.c human.c idcache.c \
isdir.c long-options.c makepath.c modechange.c hash.c path-concat.c \
quotearg.c safe-read.c save-cwd.c savedir.c stripslash.c userspec.c \
quotearg.c safe-read.c same.c save-cwd.c savedir.c stripslash.c userspec.c \
version-etc.c xgetcwd.c xmalloc.c xstrdup.c \
xstrtol.c xstrtoul.c xstrtoumax.c yesno.c
@@ -120,13 +120,15 @@ noinst_HEADERS = argmatch.h backupfile.h closeout.h \
dirname.h error.h exclude.h filemode.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
posixtm.h quotearg.h regex.h safe-read.h same.h save-cwd.h \
savedir.h strverscmp.h \
version-etc.h xalloc.h xstrtol.h
BUILT_SOURCES = getdate.c lstat.c stat.c
EXTRA_DIST = xstat.in
subdir = lib
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
@@ -138,18 +140,19 @@ CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
ANSI2KNR = ../src/ansi2knr
libfu_a_AR = $(AR) cru
am_libfu_a_OBJECTS = getdate$U.o posixtm$U.o getopt$U.o getopt1$U.o \
addext$U.o argmatch$U.o backupfile$U.o basename$U.o closeout$U.o \
dirname$U.o exclude$U.o filemode$U.o full-write$U.o human$U.o \
idcache$U.o isdir$U.o long-options$U.o makepath$U.o modechange$U.o \
hash$U.o path-concat$U.o quotearg$U.o safe-read$U.o save-cwd$U.o \
savedir$U.o stripslash$U.o userspec$U.o version-etc$U.o xgetcwd$U.o \
xmalloc$U.o xstrdup$U.o xstrtol$U.o xstrtoul$U.o xstrtoumax$U.o \
yesno$U.o
hash$U.o path-concat$U.o quotearg$U.o safe-read$U.o same$U.o \
save-cwd$U.o savedir$U.o stripslash$U.o userspec$U.o version-etc$U.o \
xgetcwd$U.o xmalloc$U.o xstrdup$U.o xstrtol$U.o xstrtoul$U.o \
xstrtoumax$U.o yesno$U.o
libfu_a_OBJECTS = $(am_libfu_a_OBJECTS)
AR = ar
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CFLAGS = @CFLAGS@
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libfu_a_SOURCES)
@@ -158,11 +161,11 @@ HEADERS = $(noinst_HEADERS)
DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in TODO alloca.c \
chown.c dup2.c error.c error.h euidaccess.c fileblocks.c fnmatch.c \
fsusage.c ftruncate.c getdate.c getgroups.c getline.c group-member.c \
lchown.c lstat.c malloc.c memcmp.c memcpy.c memset.c mkdir.c mktime.c \
lchown.c malloc.c memchr.c memcmp.c memcpy.c memset.c mkdir.c mktime.c \
mountlist.c obstack.c obstack.h realloc.c regex.c rename.c rmdir.c \
rpmatch.c stat.c stpcpy.c strcasecmp.c strdup.c strftime.c \
strncasecmp.c strndup.c strstr.c strtol.c strtoul.c strtoull.c \
strtoumax.c strverscmp.c utime.c
rpmatch.c stpcpy.c strcasecmp.c strdup.c strftime.c strncasecmp.c \
strndup.c strstr.c strtol.c strtoul.c strtoull.c strtoumax.c \
strverscmp.c utime.c
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -176,18 +179,18 @@ DEP_FILES = .deps/addext.P .deps/alloca.P .deps/argmatch.P \
.deps/getgroups.P .deps/getline.P .deps/getopt.P .deps/getopt1.P \
.deps/group-member.P .deps/hash.P .deps/human.P .deps/idcache.P \
.deps/isdir.P .deps/lchown.P .deps/long-options.P .deps/lstat.P \
.deps/makepath.P .deps/malloc.P .deps/memcmp.P .deps/memcpy.P \
.deps/memset.P .deps/mkdir.P .deps/mktime.P .deps/modechange.P \
.deps/mountlist.P .deps/obstack.P .deps/path-concat.P .deps/posixtm.P \
.deps/quotearg.P .deps/realloc.P .deps/regex.P .deps/rename.P \
.deps/rmdir.P .deps/rpmatch.P .deps/safe-read.P .deps/save-cwd.P \
.deps/savedir.P .deps/stat.P .deps/stpcpy.P .deps/strcasecmp.P \
.deps/strdup.P .deps/strftime.P .deps/stripslash.P .deps/strncasecmp.P \
.deps/strndup.P .deps/strstr.P .deps/strtol.P .deps/strtoul.P \
.deps/strtoull.P .deps/strtoumax.P .deps/strverscmp.P .deps/userspec.P \
.deps/utime.P .deps/version-etc.P .deps/xgetcwd.P .deps/xmalloc.P \
.deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P .deps/xstrtoumax.P \
.deps/yesno.P
.deps/makepath.P .deps/malloc.P .deps/memchr.P .deps/memcmp.P \
.deps/memcpy.P .deps/memset.P .deps/mkdir.P .deps/mktime.P \
.deps/modechange.P .deps/mountlist.P .deps/obstack.P \
.deps/path-concat.P .deps/posixtm.P .deps/quotearg.P .deps/realloc.P \
.deps/regex.P .deps/rename.P .deps/rmdir.P .deps/rpmatch.P \
.deps/safe-read.P .deps/same.P .deps/save-cwd.P .deps/savedir.P \
.deps/stat.P .deps/stpcpy.P .deps/strcasecmp.P .deps/strdup.P \
.deps/strftime.P .deps/stripslash.P .deps/strncasecmp.P .deps/strndup.P \
.deps/strstr.P .deps/strtol.P .deps/strtoul.P .deps/strtoull.P \
.deps/strtoumax.P .deps/strverscmp.P .deps/userspec.P .deps/utime.P \
.deps/version-etc.P .deps/xgetcwd.P .deps/xmalloc.P .deps/xstrdup.P \
.deps/xstrtol.P .deps/xstrtoul.P .deps/xstrtoumax.P .deps/yesno.P
SOURCES = $(libfu_a_SOURCES)
OBJECTS = $(am_libfu_a_OBJECTS)
@@ -235,49 +238,13 @@ clean-kr:
distclean-kr:
maintainer-clean-kr:
getdate$U.o:
posixtm$U.o:
getopt$U.o:
getopt1$U.o:
addext$U.o:
argmatch$U.o:
backupfile$U.o:
basename$U.o:
closeout$U.o:
dirname$U.o:
exclude$U.o:
filemode$U.o:
full-write$U.o:
human$U.o:
idcache$U.o:
isdir$U.o:
long-options$U.o:
makepath$U.o:
modechange$U.o:
hash$U.o:
path-concat$U.o:
quotearg$U.o:
safe-read$U.o:
save-cwd$U.o:
savedir$U.o:
stripslash$U.o:
userspec$U.o:
version-etc$U.o:
xgetcwd$U.o:
xmalloc$U.o:
xstrdup$U.o:
xstrtol$U.o:
xstrtoul$U.o:
xstrtoumax$U.o:
yesno$U.o:
libfu.a: $(libfu_a_OBJECTS) $(libfu_a_DEPENDENCIES)
-rm -f libfu.a
$(AR) cru libfu.a $(libfu_a_OBJECTS) $(libfu_a_LIBADD)
$(libfu_a_AR) libfu.a $(libfu_a_OBJECTS) $(libfu_a_LIBADD)
$(RANLIB) libfu.a
getdate.o:
lstat.o:
stat.o:
.c.o:
$(COMPILE) -c $<
addext_.c: addext.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addext.c; then echo $(srcdir)/addext.c; else echo addext.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > addext_.c
alloca_.c: alloca.c $(ANSI2KNR)
@@ -344,6 +311,8 @@ makepath_.c: makepath.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/makepath.c; then echo $(srcdir)/makepath.c; else echo makepath.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > makepath_.c
malloc_.c: malloc.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/malloc.c; then echo $(srcdir)/malloc.c; else echo malloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > malloc_.c
memchr_.c: memchr.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memchr.c; then echo $(srcdir)/memchr.c; else echo memchr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memchr_.c
memcmp_.c: memcmp.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memcmp.c; then echo $(srcdir)/memcmp.c; else echo memcmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memcmp_.c
memcpy_.c: memcpy.c $(ANSI2KNR)
@@ -378,6 +347,8 @@ rpmatch_.c: rpmatch.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rpmatch.c; then echo $(srcdir)/rpmatch.c; else echo rpmatch.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > rpmatch_.c
safe-read_.c: safe-read.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/safe-read.c; then echo $(srcdir)/safe-read.c; else echo safe-read.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > safe-read_.c
same_.c: same.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/same.c; then echo $(srcdir)/same.c; else echo same.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > same_.c
save-cwd_.c: save-cwd.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/save-cwd.c; then echo $(srcdir)/save-cwd.c; else echo save-cwd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > save-cwd_.c
savedir_.c: savedir.c $(ANSI2KNR)
@@ -435,15 +406,15 @@ closeout_.o dirname_.o dup2_.o error_.o euidaccess_.o exclude_.o \
fileblocks_.o filemode_.o fnmatch_.o fsusage_.o ftruncate_.o \
full-write_.o getdate_.o getgroups_.o getline_.o getopt_.o getopt1_.o \
group-member_.o hash_.o human_.o idcache_.o isdir_.o lchown_.o \
long-options_.o lstat_.o makepath_.o malloc_.o memcmp_.o memcpy_.o \
memset_.o mkdir_.o mktime_.o modechange_.o mountlist_.o obstack_.o \
path-concat_.o posixtm_.o quotearg_.o realloc_.o regex_.o rename_.o \
rmdir_.o rpmatch_.o safe-read_.o save-cwd_.o savedir_.o stat_.o \
stpcpy_.o strcasecmp_.o strdup_.o strftime_.o stripslash_.o \
strncasecmp_.o strndup_.o strstr_.o strtol_.o strtoul_.o strtoull_.o \
strtoumax_.o strverscmp_.o userspec_.o utime_.o version-etc_.o \
xgetcwd_.o xmalloc_.o xstrdup_.o xstrtol_.o xstrtoul_.o xstrtoumax_.o \
yesno_.o : $(ANSI2KNR)
long-options_.o lstat_.o makepath_.o malloc_.o memchr_.o memcmp_.o \
memcpy_.o memset_.o mkdir_.o mktime_.o modechange_.o mountlist_.o \
obstack_.o path-concat_.o posixtm_.o quotearg_.o realloc_.o regex_.o \
rename_.o rmdir_.o rpmatch_.o safe-read_.o same_.o save-cwd_.o \
savedir_.o stat_.o stpcpy_.o strcasecmp_.o strdup_.o strftime_.o \
stripslash_.o strncasecmp_.o strndup_.o strstr_.o strtol_.o strtoul_.o \
strtoull_.o strtoumax_.o strverscmp_.o userspec_.o utime_.o \
version-etc_.o xgetcwd_.o xmalloc_.o xstrdup_.o xstrtol_.o xstrtoul_.o \
xstrtoumax_.o yesno_.o : $(ANSI2KNR)
.y.c:
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
if test -f y.tab.h; then \
@@ -482,8 +453,6 @@ maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = lib
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
@@ -516,8 +485,8 @@ distclean-depend:
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*D)/$(*F).pp -c $<
@echo '$(COMPILE) -c -o $@ $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
@@ -525,8 +494,8 @@ maintainer-clean-depend:
rm .deps/$(*D)/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*D)/$(*F).pp -c $<
@echo '$(LTCOMPILE) -c -o $@ $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \

View File

@@ -953,6 +953,12 @@ get_date (const char *p, const time_t *now)
tm.tm_hour += yyRelHour;
tm.tm_min += yyRelMinutes;
tm.tm_sec += yyRelSeconds;
/* Let mktime deduce tm_isdst if we have an absolute timestamp,
or if the relative timestamp mentions days, months, or years. */
if (yyHaveDate | yyHaveDay | yyHaveTime | yyRelDay | yyRelMonth | yyRelYear)
tm.tm_isdst = -1;
tm0 = tm;
Start = mktime (&tm);

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1997, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,10 +27,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# endif
# endif
# if __GLIBC__ < 2
int
getline PARAMS ((char **_lineptr, size_t *_n, FILE *_stream));
int
getdelim PARAMS ((char **_lineptr, size_t *_n, int _delimiter, FILE *_stream));
# endif
#endif /* not GETLINE_H_ */

View File

@@ -41,6 +41,8 @@ struct group *getgrent ();
# include <strings.h>
#endif
#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
/* Like `getgroups', but for user USERNAME instead of for the current
process. Store at most MAXCOUNT group IDs in the GROUPLIST array.
If GID is not -1, store it first (if possible). GID should be the
@@ -64,14 +66,17 @@ getugroups (int maxcount, GETGROUPS_T *grouplist, char *username, gid_t gid)
setgrent ();
while ((grp = getgrent ()) != 0)
for (cp = grp->gr_mem; *cp; ++cp)
if (!strcmp (username, *cp))
{
for (cp = grp->gr_mem; *cp; ++cp)
{
int n;
if ( ! STREQ (username, *cp))
continue;
/* See if this group number is already on the list. */
for (n = 0; n < count; ++n)
if (grouplist[n] == grp->gr_gid)
if (grouplist && grouplist[n] == grp->gr_gid)
break;
/* If it's a new group number, then try to add it to the list. */
@@ -89,6 +94,8 @@ getugroups (int maxcount, GETGROUPS_T *grouplist, char *username, gid_t gid)
count++;
}
}
}
endgrent ();
return count;
}

View File

@@ -30,6 +30,12 @@
# include <limits.h>
#endif
#if HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
@@ -70,7 +76,7 @@ static const char suffixes[] =
/* Convert N to a human readable format in BUF.
N is expressed in units of FROM_BLOCK_SIZE. FROM_BLOCK_SIZE must
be positive.
be nonnegative.
If OUTPUT_BLOCK_SIZE is positive, use units of OUTPUT_BLOCK_SIZE in
the output number. OUTPUT_BLOCK_SIZE must be a multiple of
@@ -95,7 +101,7 @@ human_readable (uintmax_t n, char *buf,
uintmax_t amt;
int base;
int to_block_size;
int tenths;
int tenths = 0;
int power;
char *p;
@@ -103,7 +109,7 @@ human_readable (uintmax_t n, char *buf,
1 means AMT.TENTHS < adjusted N < AMT.TENTHS + 0.05;
2 means adjusted N == AMT.TENTHS + 0.05;
3 means AMT.TENTHS + 0.05 < adjusted N < AMT.TENTHS + 0.1. */
int rounding;
int rounding = 0;
if (output_block_size < 0)
{
@@ -130,7 +136,6 @@ human_readable (uintmax_t n, char *buf,
{
int multiplier = from_block_size / to_block_size;
amt = n * multiplier;
tenths = rounding = 0;
if (amt / multiplier != n)
{
@@ -166,6 +171,8 @@ human_readable (uintmax_t n, char *buf,
return buf;
}
}
else if (from_block_size == 0)
amt = 0;
else
{
int divisor = to_block_size / from_block_size;

View File

@@ -2,7 +2,7 @@
version 0.12.
(Implements POSIX draft P1003.2/D11.2, except for some of the
internationalization features.)
Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
Copyright (C) 1993, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -254,6 +254,12 @@ init_syntax_once ()
#define ISUPPER(c) (ISASCII (c) && isupper (c))
#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
#ifdef _tolower
# define TOLOWER(c) _tolower(c)
#else
# define TOLOWER(c) tolower(c)
#endif
#ifndef NULL
# define NULL (void *)0
#endif
@@ -5628,7 +5634,7 @@ regcomp (preg, pattern, cflags)
/* Map uppercase characters to corresponding lowercase ones. */
for (i = 0; i < CHAR_SET_SIZE; i++)
preg->translate[i] = ISUPPER (i) ? tolower (i) : i;
preg->translate[i] = ISUPPER (i) ? TOLOWER (i) : i;
}
else
preg->translate = NULL;

75
lib/same.c Normal file
View File

@@ -0,0 +1,75 @@
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#include "same.h"
#include "dirname.h"
#include "error.h"
#if ENABLE_NLS
# include <libintl.h>
# define _(Text) gettext (Text)
#else
# define _(Text) Text
#endif
#define STREQ(a, b) (strcmp ((a), (b)) == 0)
#ifndef HAVE_DECL_FREE
void free ();
#endif
char *base_name PARAMS ((char const *));
#define SAME_INODE(Stat_buf_1, Stat_buf_2) \
((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
&& (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
/* Return nonzero if SOURCE and DEST point to the same name in the same
directory. */
int
same_name (const char *source, const char *dest)
{
struct stat source_dir_stats;
struct stat dest_dir_stats;
char *source_dirname, *dest_dirname;
source_dirname = dir_name (source);
dest_dirname = dir_name (dest);
if (source_dirname == NULL || dest_dirname == NULL)
error (1, 0, _("virtual memory exhausted"));
if (stat (source_dirname, &source_dir_stats))
{
/* Shouldn't happen. */
error (1, errno, "%s", source_dirname);
}
if (stat (dest_dirname, &dest_dir_stats))
{
/* Shouldn't happen. */
error (1, errno, "%s", dest_dirname);
}
free (source_dirname);
free (dest_dirname);
return (SAME_INODE (source_dir_stats, dest_dir_stats)
&& STREQ (base_name (source), base_name (dest)));
}

19
lib/same.h Normal file
View File

@@ -0,0 +1,19 @@
#ifndef SAME_H_
# define SAME_H_ 1
# if HAVE_CONFIG_H
# include <config.h>
# endif
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
int
same_name PARAMS ((const char *source, const char *dest));
#endif /* SAME_H_ */

View File

@@ -35,13 +35,12 @@ version_etc (FILE *stream,
const char *version, const char *authors)
{
fprintf (stream, "%s (%s) %s\n", command_name, package, version);
fprintf (stream, _("Written by %s.\n"), authors);
fputs (_("\
\n\
Copyright (C) 1999 Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
\n\
"
), stream);
fprintf (stream, _("Written by %s.\n"), authors);
}

View File

@@ -1,5 +1,5 @@
/* xstrtod.c - error-checking interface to strtod
Copyright (C) 1996 Free Software Foundation, Inc.
Copyright (C) 1996, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -68,4 +68,3 @@ xstrtod (str, ptr, result)
*result = val;
return fail;
}

View File

@@ -1,3 +1,27 @@
1999-05-22 Jim Meyering <meyering@ascend.com>
* jm-macros.m4 (AC_REPLACE_FUNCS): Add memchr.
1999-05-20 Jim Meyering <meyering@ascend.com>
* search-libs.m4 [AC_SEARCH_LIBS]: Quote name in undefine.
Add a colon after each `then' in case $4 is empty.
1999-05-16 Jim Meyering <meyering@ascend.com>
* search-libs.m4: New file to override autoconf's AC_SEARCH_LIBS.
1999-05-10 Jim Meyering <meyering@ascend.com>
* jm-mktime.m4: Reflect renaming: AM_FUNC_MKTIME -> AC_FUNC_MKTIME.
* jm-macros.m4: Require 2.14.1, since we use newly-renamed
AC_FUNC_MKTIME.
1999-05-10 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* jm-mktime.m4, putenv.m4: Fix typos in config.h comments.
1999-05-04 Paul Eggert <eggert@twinsun.com>
* lfs.m4 (AC_LFS): -n32, -o32, and -n64 should be in CFLAGS,

View File

@@ -41,6 +41,7 @@ putenv.m4 \
readdir.m4 \
realloc.m4 \
regex.m4 \
search-libs.m4 \
st_dm_mode.m4 \
st_mtim.m4 \
stat.m4 \

View File

@@ -66,6 +66,7 @@ CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GETCONF = @GETCONF@
GMOFILES = @GMOFILES@
@@ -82,16 +83,17 @@ LIBOBJS = @LIBOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
l = @l@
@@ -135,6 +137,7 @@ putenv.m4 \
readdir.m4 \
realloc.m4 \
regex.m4 \
search-libs.m4 \
st_dm_mode.m4 \
st_mtim.m4 \
stat.m4 \
@@ -147,6 +150,7 @@ utime.m4 \
utimes.m4 \
xstrtoumax.m4
subdir = m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
@@ -172,8 +176,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = m4
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -4,7 +4,7 @@ dnl Misc type-related macros for fileutils, sh-utils, textutils.
AC_DEFUN(jm_MACROS,
[
AC_PREREQ(2.13) dnl Minimum Autoconf version required.
AC_PREREQ(2.14.1) dnl Minimum Autoconf version required.
GNU_PACKAGE="GNU $PACKAGE"
AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
@@ -40,6 +40,7 @@ AC_DEFUN(jm_MACROS,
AC_REQUIRE([jm_AC_PREREQ_XSTRTOUMAX])
AC_REPLACE_FUNCS(strcasecmp strncasecmp)
AC_REPLACE_FUNCS(dup2)
AC_REPLACE_FUNCS(memchr)
# By default, argmatch should fail calling usage (1).
AC_DEFINE(ARGMATCH_DIE, [usage (1)],

View File

@@ -1,16 +1,16 @@
#serial 5
#serial 7
dnl From Jim Meyering.
dnl A wrapper around AM_FUNC_MKTIME.
dnl A wrapper around AC_FUNC_MKTIME.
AC_DEFUN(jm_FUNC_MKTIME,
[AC_REQUIRE([AM_FUNC_MKTIME])dnl
[AC_REQUIRE([AC_FUNC_MKTIME])dnl
dnl mktime.c uses localtime_r if it exists. Check for it.
AC_CHECK_FUNCS(localtime_r)
if test $am_cv_func_working_mktime = no; then
if test $ac_cv_func_working_mktime = no; then
AC_DEFINE_UNQUOTED(mktime, rpl_mktime,
[Define to gnu_mktime if the replacement function should be used.])
[Define to rpl_mktime if the replacement function should be used.])
fi
])

View File

@@ -1,4 +1,4 @@
#serial 2
#serial 3
dnl From Jim Meyering.
dnl
@@ -36,6 +36,6 @@ AC_DEFUN(jm_FUNC_PUTENV,
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS putenv.$ac_objext"
AC_DEFINE_UNQUOTED(putenv, rpl_putenv,
[Define to rpl_memcmp if the replacement function should be used.])
[Define to rpl_putenv if the replacement function should be used.])
fi
])

44
m4/search-libs.m4 Normal file
View File

@@ -0,0 +1,44 @@
#serial 2
dnl A replacement for autoconf's macro by the same name. This version
dnl uses `ac_lib' rather than `i' for the loop variable, but more importantly
dnl moves the ACTION-IF-FOUND ($3) into the inner `if'-block so that it is
dnl run only if one of the listed libraries ends up being used (and not in
dnl the `none required' case.
dnl I hope it's only temporary while we wait for that version to be fixed.
undefine([AC_SEARCH_LIBS])
dnl AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
dnl Search for a library defining FUNC, if it's not already available.
AC_DEFUN(AC_SEARCH_LIBS,
[
AC_PREREQ([2.13])
AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
[
ac_func_search_save_LIBS="$LIBS"
ac_cv_search_$1="no"
AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])
if test "$ac_cv_search_$1" = "no"; then
for ac_lib in $2; do
LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS"
AC_TRY_LINK_FUNC([$1],
[ac_cv_search_$1="-l$ac_lib"
break])
done
fi
LIBS="$ac_func_search_save_LIBS"
])
if test "$ac_cv_search_$1" = "no"; then :
$4
else
if test "$ac_cv_search_$1" = "none required"; then :
$4
else
LIBS="$ac_cv_search_$1 $LIBS"
$3
fi
fi
])

View File

@@ -1,3 +1,65 @@
1999-05-23 Jim Meyering <meyering@ascend.com>
* Version 4.0i.
* tests/cp/same-file: Correct erroneous expected output from
the `cp -f foo foo' tests.
* po/POTFILES.in: Add same.c.
* lib/same.h: New file.
* lib/same.c: New file (function extracted from ln.c).
* lib/Makefile.am (libfu_a_SOURCES): Add same.c.
(noinst_HEADERS): Add same.h.
* src/copy.c: Include same.h.
* src/ln.c (same_name): Remove function.
<same.h>: Include this instead.
<dirname.h>: No longer include this.
* tests/mv/force: Be sure we still allow `mv -f FILE LINK-TO-FILE'.
* src/copy.c (copy_internal): Make it so `cp/mv -f FILE FILE' does not
remove FILE. Suggestion from Chris Yeo.
* tests/mv/force: New test, for the above fix.
* tests/mv/Makefile.am (TESTS): Add force.
(TESTS_ENVIRONMENT): Change PATH to be absolute.
* tests/mv/force (mv): New test.
1999-05-17 Paul Eggert <eggert@twinsun.com>
* lib/getdate.y (get_date): Let mktime deduce tm_isdst if we
have an absolute timestamp, or if the relative timestamp
mentions days, months, or years. Reported by Volker Borchert.
* lib/human.c (human_readable): Allow from_block_size to be zero.
1999-05-14 Jim Meyering <meyering@ascend.com>
* tests/Makefile.am (envvar-check): Renamed from check-local.
(check): Depend on envvar-check so the envvar check is performed
before all other tests. Reported by Volker Borchert.
* tests/.env-warn: Use `%%' place-holder that Makefile.am rule expects,
so CDPATH is mentioned in the message. Reported by Volker Borchert.
* src/df.c (main): When asking for info on an explicit file name,
just warn rather than failing if the table of mounted filesystems
cannot be read. Based on a patch from Mark Kettenis.
* lib/version-etc.c (version_etc): Put version info and author names
on the first two lines respectively rather than putting the three
lines of copyright info between them.
* src/touch.c (open_maybe_create): Handle Solaris' failure mode when
FILE is a directory. Reported by Vin Shelton.
* lib/human.c: Include <string.h> or <strings.h> for strlen prototype.
* lib/getline.h [__GLIBC__ >= 2]: #if-out prototypes.
* src/remove.c (pop_dir): Cast length to `int' to avoid a warning on
64-bit systems. From Ulrich Drepper.
1999-05-12 Jim Meyering <meyering@ascend.com>
* src/shred.c (main): Put `u' for -u in getopt_long's string argument.
Remove the `R'.
1999-05-07 Jim Meyering <meyering@ascend.com>
* Version 4.0h.

View File

@@ -1,4 +1,9 @@
Changes in release 4.1:
[4.0i]
* `cp -f FILE FILE' and `mv -f FILE FILE' no longer remove FILE
* touch works once again (DST-wise) when certain `--date DATE-TIME'
values are specified.
* shred's -u option (short form of --remove) is now accepted
[4.0h]
* cp --one-file-system (-x) no longer crosses filesystem boundaries.
* touch can once again operate on directories

View File

@@ -1,5 +1,44 @@
1999-05-21 Jim Meyering <meyering@ascend.com>
* Version 1.16k.
* configuration fixes: see m4/ChangeLog.
1999-05-16 Jim Meyering <meyering@ascend.com>
* Version 1.16j.
* configure.in (AC_SEARCH_LIBS): Set LIB_CRYPT to $ac_cv_search_crypt,
to go along with the new macro in m4/search-libs.m4.
1999-05-14 Jim Meyering <meyering@ascend.com>
* lib/getugroups.c (getugroups): Don't dereference a null pointer when
running `id USER' for some USER that is listed on the RHS in /etc/group.
From Sander van Malssen.
Add some curly braces, use STREQ, reverse the sense of a test
and use `continue' to save a level of nesting.
* tests/Makefile.am (envvar-check): Renamed from check-local.
(check): Depend on envvar-check so the envvar check is performed
before all other tests. Reported by Volker Borchert.
* tests/.env-warn: Use `%%' place-holder that Makefile.am rule expects,
so CDPATH is mentioned in the message. Reported by Volker Borchert.
1999-05-10 Jim Meyering <meyering@ascend.com>
* src/uptime.c (AUTHORS): add Kaveh.
Expand each `&' character in the gecos field.
* src/pinky.c (count_ampersands): New function.
(create_fullname): New function.
(print_entry): Use create_fullname here.
(print_long_entry): Use it here, too.
From Kaveh Ghazi.
1999-05-09 Jim Meyering <meyering@ascend.com>
* lib/regex.c: Update from libc.
* Version 1.16i.
* configure.in: Clean up checks for libraries so that we don't add

View File

@@ -1,4 +1,10 @@
Changes in release 1.17
[1.16k]
* fix typos in my version of AC_SEARCH_LIBS.
* fix dates on config files so builders don't need autoconf/automake
[1.16j]
* work around problems with my use of AC_SEARCH_LIBS
* fix a bug in id
[1.16i]
* portability tweaks for lib/readutmp.[ch] and src/date.c
[1.16h]

View File

@@ -1,5 +1,151 @@
1999-05-22 Jim Meyering <meyering@ascend.com>
* lib/Makefile.am (libtu_a_SOURCES): Remove memchr.c.
From Ulrich Drepper.
* Version 1.22m.
1999-05-22 Paul Eggert <eggert@twinsun.com>
* doc/textutils.texi: Document locale-specific changes to `sort',
as well as the new, POSIX-compliant definition of line comparison,
and -g's more careful treatment of NaNs, infinities and zeros.
* src/sort.c (general_numcompare): Put exceptional cases
first, not last, to be consistent with -M.
1999-05-21 Paul Eggert <eggert@twinsun.com>
* src/sort.c (strtod): Declare if STDC_HEADERS is not defined.
(general_numcompare): Use strtod, not xstrtod.
Do not consider partial conversions to be errors.
Put -infinity at the start, and +infinity at the end;
follow +infinity with NaNs (sorted by bit pattern),
and finally by conversion errors.
1999-05-21 Jim Meyering <meyering@ascend.com>
* tests/sort/Test.pm (11d): Reverse lines in expected output
to reflect latest change.
(use-nl): New test from Paul Eggert.
1999-05-20 Paul Eggert <eggert@twinsun.com>
* src/sort.c: Treat the trailing newline as part of the line,
as required by POSIX.2.
(struct line, findlines, compare, checkfp, mergefps, sort):
A line now includes its trailing newline.
(findlines): Do not replace newline with NUL.
(memcoll, keycompare): Work even if the data to be compared are
adjacent strings; this is possible now that lines contain the
trailing newline.
(fillbuf): Always have an unused byte at the end of the buffer,
since memcoll and keycompare want to modify a byte after the last line.
(sortalloc, mergealloc): Increase by 1, for trailing byte.
1999-05-20 Jim Meyering <meyering@ascend.com>
* tests/sort/Test.pm: Add test case from Paul Eggert.
1999-05-20 Paul Eggert <eggert@twinsun.com>
* src/sort.c (keycompare): Ignore any length difference if the
localized comparison says the strings are equal.
* src/sort.c (memcoll, keycompare, compare): Handle NUL
characters properly when comparing with LC_COLLATE semantics.
(NLS_MEMCMP): Remove.
(memcoll): Renamed from strncoll.
Take separate lengths for each string.
This function is now invoked only when need_locale.
(keycompare): Don't copy strings when ignore and translate
are both NULL.
1999-05-18 Paul Eggert <eggert@twinsun.com>
* src/sort.c (MONTHTAB_CONST): Renamed from NLS_CONST; the use
is also changed. Define to const also if !HAVE_NL_LANGINFO.
(usage): `,' -> `;' (English typo).
1999-05-17 Eli Zaretskii <eliz@is.elta.co.il>
* src/cat.c (main): When stdout is in binary mode, make sure all
input files are also read in binary mode.
1999-05-16 Jim Meyering <meyering@ascend.com>
* Version 1.22l.
1999-05-11 Paul Eggert <eggert@twinsun.com>
* src/sort.c: Don't autodetect the locale of numbers and
months, as this conflicts with POSIX.2 and is tricky to boot.
(FLOATING_COMMA, NLS_STRNCMP, NLS_MAX_GROUPS,
NLS_ONE_CHARACTER_STRING): Remove macros no longer used.
(nls_grouping, nls_fraction_found, nls_month_found, nos_monthtab,
nls_months_collide, nls_keyhead, us_monthtab): Remove variables no
longer used.
(struct nls_keyfield): Remove types no longer used.
(strncoll_s2_readonly, nls_set_fraction, look_for_fraction,
nls_month_is_either_locale, nls_numeric_format): Remove functions no
longer used.
(monthtab): Now has the role that us_monthtab had, but it's const only
if ENABLE_NLS is not defined.
(C_DECIMAL_POINT): Renamed from FLOATING_POINT. All uses changed.
(MONTHS_PER_YEAR): Renamed from NLS_NUM_MONTHS. All uses changed.
(struct_month_cmp): Renamed from nls_sort_month_comp. All uses changed.
Use strcmp, not strcoll, since the user doesn't care about collating
here.
(inittables): Read locale data into monthtab, rather than modifying a
separate month table and futzing with indirection. Do not worry about
colliding months, since we no longer autodetect month locale.
(fraccompare): Don't set no-longer-used variable nls_fraction_found.
(getmonth): Use strncmp to compare months, since user doesn't care
about collating here. Fix bug where code incorrectly assumed that
strlen (monthtab[lo].name) == strlen (monthtab[ix].name).
(keycompare, main): Don't autodetect month locale.
(compare): Don't use NLS_MEMCP in code that can't be executed if
need_locale is false, as NLS_MEMCP is equivalent to memcmp in that
case.
(sort, insertkey, main): Don't autodetect numeric locale.
1999-05-15 Jim Meyering <meyering@ascend.com>
* tests/join/Test.pm (trailing-sp): New test for this fix.
* src/join.c (xfields): Don't interpret a trailing blank as a
delimiter when e.g. -t: was specified. From Tim Smithers.
1999-05-12 Jim Meyering <meyering@ascend.com>
* tests/Makefile.am (envvar-check): Renamed from check-local.
(check): Depend on envvar-check so the envvar check is performed
before all other tests. Reported by Volker Borchert.
* tests/.env-warn: Use `%%' place-holder that Makefile.am rule expects,
so CDPATH is mentioned in the message. Reported by Volker Borchert.
1999-05-11 Jim Meyering <meyering@ascend.com>
* src/sort.c (usage): Split the --help message into two pieces so that
neither is longer than 2048. For Irix4's cc. Reported by Kaveh Ghazi.
1999-05-09 Jim Meyering <meyering@ascend.com>
* lib/regex.c: Update from libc.
* Version 1.22k.
* Makefile.maint (alpha): Put the announcement in

View File

@@ -1,4 +1,21 @@
Changes in release 1.23
[1.22n]
* use lib/memchr.c only if it's not provided by the system -- this means
that on systems with a fast library memchr function you may notice an
improvement. If you use a system with a buggy or signifcantly slower
memchr, please report it.
[1.22m]
* sort now considers newlines to be part of the line, as required by POSIX.2.
E.g. a line starting with a tab now sorts before an empty line,
since tab precedes newline in the ASCII collating sequence.
* sort handles NUL bytes correctly when configured/compiled with --enable-nls
* fix typos in my version of AC_SEARCH_LIBS.
* fix dates on config files so builders don't need autoconf/automake
[1.22l]
* sort no longer autodetects the locale of numbers and months,
as that conflicts with POSIX.2
* `join -tC' now works when input contains trailing spaces
* portability tweaks for Irix's cc
[1.22k]
* `sort -n' works with negative numbers when configured/compiled
with --enable-nls

View File

@@ -666,6 +666,9 @@ main (int argc, char **argv)
/* Switch stdout to BINARY mode. */
binary_output = 1;
SET_BINARY (output_desc);
/* When stdout is in binary mode, make sure all input files are
also read in binary mode. */
file_open_mode |= O_BINARY;
}
else if (quote)
{

View File

@@ -32,8 +32,9 @@
#include "savedir.h"
#include "copy.h"
#include "cp-hash.h"
#include "path-concat.h"
#include "dirname.h"
#include "path-concat.h"
#include "same.h"
#define DO_CHOWN(Chown, File, New_uid, New_gid) \
(Chown ((File), (x->myeuid == 0 ? (New_uid) : x->myeuid), (New_gid)) \
@@ -460,7 +461,8 @@ copy_internal (const char *src_path, const char *dst_path,
if (x->hard_link)
return 0;
if (x->backup_type == none && !x->force)
if (x->backup_type == none
&& (!x->force || same_name (src_path, dst_path)))
{
error (0, 0, _("`%s' and `%s' are the same file"),
src_path, dst_path);

View File

@@ -753,7 +753,15 @@ main (int argc, char **argv)
|| show_local_fs));
if (mount_list == NULL)
error (1, errno, _("cannot read table of mounted filesystems"));
{
/* Couldn't read the table of mounted filesystems.
Fail if df was invoked with no file name arguments;
Otherwise, merely give a warning and proceed. */
const char *warning = (optind == argc ? "" : _("Warning: "));
int status = (optind == argc ? 1 : 0);
error (status, errno,
_("%scannot read table of mounted filesystems"), warning);
}
if (require_sync)
sync ();

View File

@@ -230,7 +230,7 @@ xfields (struct line *line)
}
}
if (ptr > line->beg && ((tab && ISSPACE (ptr[-1])) || ptr[-1] == tab))
if (ptr > line->beg && ((!tab && ISSPACE (ptr[-1])) || ptr[-1] == tab))
{
/* Add one more (empty) field because the last character of the
line was a delimiter. */

View File

@@ -27,8 +27,8 @@
#include <getopt.h>
#include "system.h"
#include "same.h"
#include "backupfile.h"
#include "dirname.h"
#include "error.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -117,40 +117,6 @@ static struct option const long_options[] =
{NULL, 0, NULL, 0}
};
/* Return nonzero if SOURCE and DEST point to the same name in the same
directory. */
static int
same_name (const char *source, const char *dest)
{
struct stat source_dir_stats;
struct stat dest_dir_stats;
char *source_dirname, *dest_dirname;
source_dirname = dir_name (source);
dest_dirname = dir_name (dest);
if (source_dirname == NULL || dest_dirname == NULL)
error (1, 0, _("virtual memory exhausted"));
if (stat (source_dirname, &source_dir_stats))
{
/* Shouldn't happen. */
error (1, errno, "%s", source_dirname);
}
if (stat (dest_dirname, &dest_dir_stats))
{
/* Shouldn't happen. */
error (1, errno, "%s", dest_dirname);
}
free (source_dirname);
free (dest_dirname);
return (SAME_INODE (source_dir_stats, dest_dir_stats)
&& STREQ (base_name (source), base_name (dest)));
}
/* Make a link DEST to the (usually) existing file SOURCE.
Symbolic links to nonexistent files are allowed.
If DEST is a directory, put the link to SOURCE in that directory.

View File

@@ -81,6 +81,56 @@ static struct option const longopts[] =
{NULL, 0, NULL, 0}
};
/* Count and return the number of ampersands in STR. */
static int
count_ampersands (const char *str)
{
int count = 0;
do
{
if (*str == '&')
count++;
} while (*str++);
return count;
}
/* Create a string (via xmalloc) which contains a full name by substituting
for each ampersand in GECOS_NAME the USER_NAME string with its first
character capitalized. The caller must ensure that GECOS_NAME contains
no `,'s. The caller also is responsible for free'ing the return value of
this function. */
static char *
create_fullname (const char *gecos_name, const char *user_name)
{
const int result_len = strlen (gecos_name)
+ count_ampersands (gecos_name) * (strlen (user_name) - 1) + 1;
char *const result = xmalloc (result_len);
char *r = result;
while (*gecos_name)
{
if (*gecos_name == '&')
{
const char *uname = user_name;
if (ISLOWER (*uname))
*r++ = TOUPPER (*uname++);
while (*uname)
*r++ = *uname++;
}
else
{
*r++ = *gecos_name;
}
gecos_name++;
}
*r = 0;
return result;
}
/* Return a string representing the time between WHEN and the time
that this function is first run. */
@@ -164,11 +214,14 @@ print_entry (const STRUCT_UTMP *utmp_ent)
else
{
char *const comma = strchr (pw->pw_gecos, ',');
char *result;
if (comma)
*comma = '\0';
/* FIXME: we don't yet convert '&' to username capitalized. */
printf (" %-19.19s", pw->pw_gecos);
result = create_fullname (pw->pw_gecos, pw->pw_name);
printf (" %-19.19s", result);
free (result);
}
}
@@ -245,11 +298,14 @@ print_long_entry (const char name[])
else
{
char *const comma = strchr (pw->pw_gecos, ',');
char *result;
if (comma)
*comma = '\0';
/* FIXME: we don't yet convert '&' to username capitalized. */
printf (" %s", pw->pw_gecos);
result = create_fullname (pw->pw_gecos, pw->pw_name);
printf (" %s", result);
free (result);
}
putchar ('\n');

View File

@@ -247,7 +247,7 @@ pop_dir (void)
/* Pop the length stack, too. */
assert (obstack_object_size (&len_stack) >= sizeof (size_t));
obstack_blank (&len_stack, -(sizeof (size_t)));
obstack_blank (&len_stack, (int) -(sizeof (size_t)));
}
/* Copy the SRC_LEN bytes of data beginning at SRC into the DST_LEN-byte

View File

@@ -1709,7 +1709,7 @@ main (int argc, char **argv)
flags.n_iterations = DEFAULT_PASSES;
flags.size = -1;
while ((c = getopt_long (argc, argv, "fn:Rs:vxz", long_opts, NULL)) != -1)
while ((c = getopt_long (argc, argv, "fn:s:uvxz", long_opts, NULL)) != -1)
{
switch (c)
{

File diff suppressed because it is too large Load Diff

View File

@@ -129,7 +129,7 @@ char *alloca ();
#endif
#define N_(Text) Text
#define STREQ(a,b) (strcmp((a), (b)) == 0)
#define STREQ(a, b) (strcmp ((a), (b)) == 0)
#ifndef HAVE_DECL_FREE
void free ();

View File

@@ -121,8 +121,9 @@ open_maybe_create (const char *file, int *file_created)
*file_created = 1;
/* If the open succeeded or if it failed for any reason other
than the existence of FILE, then we're done. */
if (fd != -1 || errno != EEXIST)
than the existence of FILE, then we're done. Some systems
(solaris) set errno to EINVAL when FILE is a directory. */
if (fd != -1 || (errno != EEXIST && errno != EINVAL))
break;
/* The first open failed because FILE already exists.

View File

@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by jla; revised by djm */
/* Created by hacking who.c by Kaveh Ghazi ghazi@caip.rutgers.edu. */
#include <config.h>
#include <getopt.h>
@@ -29,7 +29,7 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "uptime"
#define AUTHORS "Joseph Arceneaux and David MacKenzie"
#define AUTHORS "Joseph Arceneaux, David MacKenzie, and Kaveh Ghazi"
int getloadavg ();

View File

@@ -1,8 +1,8 @@
***************************** WARNING ************************************
You seem to have set the POSIXLY_CORRECT environment variable,
You seem to have set the %% environment variable,
this might cause some of the tests in this package to fail.
If any test fails, clear POSIXLY_CORRECT from the environment,
If any test fails, clear %% from the environment,
and rerun all tests.
***************************** WARNING ************************************

View File

@@ -116,6 +116,7 @@ TESTS_ENVIRONMENT = \
PATH=../../src:$$PATH \
PROG=basename
subdir = tests/basename
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -141,8 +142,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/basename
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -104,6 +104,7 @@ EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
PATH=`pwd`/../../src:$$PATH
subdir = tests/chmod
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -129,8 +130,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/chmod
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -107,6 +107,7 @@ EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
PATH=`pwd`/../../src:$$PATH
subdir = tests/cp
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -132,8 +133,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/cp
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -114,8 +114,8 @@ cat <<\EOF > $expected
1 [cp: `foo' and `foo' are the same file] (foo)
1 -d [cp: `foo' and `foo' are the same file] (foo)
1 -f [cp: `foo' and `foo' are the same file] () symlink-loop symlink-loop
1 -df [cp: `foo' and `foo' are the same file] () symlink-loop symlink-loop
1 -f [cp: `foo' and `foo' are the same file] (foo)
1 -df [cp: `foo' and `foo' are the same file] (foo)
1 -b [cp: `foo' and `foo' are the same file] (foo)
1 -bd [cp: `foo' and `foo' are the same file] (foo)
0 -bf (foo foo.~1~)

View File

@@ -128,6 +128,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/cut
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -155,8 +156,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/cut
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -140,6 +140,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/date
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -167,8 +168,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/date
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -108,6 +108,7 @@ TESTS_ENVIRONMENT = \
TESTS = misc
subdir = tests/dd
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -133,8 +134,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/dd
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -108,6 +108,7 @@ TESTS_ENVIRONMENT = \
TESTS = simple
subdir = tests/dircolors
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -133,8 +134,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/dircolors
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -116,6 +116,7 @@ TESTS_ENVIRONMENT = \
PATH=../../src:$$PATH \
PROG=factor
subdir = tests/factor
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -141,8 +142,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/factor
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -123,6 +123,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/head
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -150,8 +151,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/head
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -107,6 +107,7 @@ TESTS_ENVIRONMENT = \
MKDIR=../../src/mkdir \
RM=../../src/rm
subdir = tests/install
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -132,8 +133,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/install
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -11,12 +11,13 @@ maint_gen = 1a.I1 1a.I2 1a.X 1b.I1 1b.I2 1b.X 1c.I1 1c.I2 1c.X 1d.I1 1d.I2 \
5g.I1 5g.I2 5g.X 5h.I1 5h.I2 5h.X 5i.I1 5i.I2 5i.X 5j.I1 5j.I2 5j.X 5k.I1 \
5k.I2 5k.X 5l.I1 5l.I2 5l.X 5m.I1 5m.I2 5m.X 6a.I1 6a.I2 6a.X 6b.I1 6b.I2 \
6b.X 6c.I1 6c.I2 6c.X 7a.I1 7a.I2 7a.X 8a.I1 8a.I2 8a.X 8b.I1 8b.I2 8b.X \
9a.I1 9a.I2 9a.X
9a.I1 9a.I2 9a.X trailing-sp.I1 trailing-sp.I2 trailing-sp.X
run_gen = 1a.O 1a.E 1b.O 1b.E 1c.O 1c.E 1d.O 1d.E 1e.O 1e.E 1f.O 1f.E 2a.O \
2a.E 2b.O 2b.E 2c.O 2c.E 3a.O 3a.E 4a.O 4a.E 4b.O 4b.E 4c.O 4c.E 4d.O 4d.E \
4e.O 4e.E 5a.O 5a.E 5b.O 5b.E 5c.O 5c.E 5d.O 5d.E 5e.O 5e.E 5f.O 5f.E 5g.O \
5g.E 5h.O 5h.E 5i.O 5i.E 5j.O 5j.E 5k.O 5k.E 5l.O 5l.E 5m.O 5m.E 6a.O 6a.E \
6b.O 6b.E 6c.O 6c.E 7a.O 7a.E 8a.O 8a.E 8b.O 8b.E 9a.O 9a.E
6b.O 6b.E 6c.O 6c.E 7a.O 7a.E 8a.O 8a.E 8b.O 8b.E 9a.O 9a.E trailing-sp.O \
trailing-sp.E
##test-files-end
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)

View File

@@ -105,13 +105,14 @@ maint_gen = 1a.I1 1a.I2 1a.X 1b.I1 1b.I2 1b.X 1c.I1 1c.I2 1c.X 1d.I1 1d.I2 \
5g.I1 5g.I2 5g.X 5h.I1 5h.I2 5h.X 5i.I1 5i.I2 5i.X 5j.I1 5j.I2 5j.X 5k.I1 \
5k.I2 5k.X 5l.I1 5l.I2 5l.X 5m.I1 5m.I2 5m.X 6a.I1 6a.I2 6a.X 6b.I1 6b.I2 \
6b.X 6c.I1 6c.I2 6c.X 7a.I1 7a.I2 7a.X 8a.I1 8a.I2 8a.X 8b.I1 8b.I2 8b.X \
9a.I1 9a.I2 9a.X
9a.I1 9a.I2 9a.X trailing-sp.I1 trailing-sp.I2 trailing-sp.X
run_gen = 1a.O 1a.E 1b.O 1b.E 1c.O 1c.E 1d.O 1d.E 1e.O 1e.E 1f.O 1f.E 2a.O \
2a.E 2b.O 2b.E 2c.O 2c.E 3a.O 3a.E 4a.O 4a.E 4b.O 4b.E 4c.O 4c.E 4d.O 4d.E \
4e.O 4e.E 5a.O 5a.E 5b.O 5b.E 5c.O 5c.E 5d.O 5d.E 5e.O 5e.E 5f.O 5f.E 5g.O \
5g.E 5h.O 5h.E 5i.O 5i.E 5j.O 5j.E 5k.O 5k.E 5l.O 5l.E 5m.O 5m.E 6a.O 6a.E \
6b.O 6b.E 6c.O 6c.E 7a.O 7a.E 8a.O 8a.E 8b.O 8b.E 9a.O 9a.E
6b.O 6b.E 6c.O 6c.E 7a.O 7a.E 8a.O 8a.E 8b.O 8b.E 9a.O 9a.E trailing-sp.O \
trailing-sp.E
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
@@ -126,6 +127,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/join
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -153,8 +155,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/join
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -91,8 +91,13 @@ my @tv = (
# From David Dyck
['9a', '', [" a 1\n b 2\n", " a Y\n b Z\n"], "a 1 Y\nb 2 Z\n", 0],
# From Tim Smithers: fixed in 1.22l
['trailing-sp', '-t: -1 1 -2 1', ["a:x \n", "a:y \n"], "a:x :y \n", 0],
);
sub test_vector
{
return @tv;

View File

@@ -613,8 +613,25 @@ else
esac
fi
test -s 9a.E || rm -f 9a.E
$xx -t: -1 1 -2 1 $srcdir/trailing-sp.I1 $srcdir/trailing-sp.I2 > trailing-sp.O 2> trailing-sp.E
code=$?
if test $code != 0 ; then
$echo "Test trailing-sp failed: ../../src/join return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp trailing-sp.O $srcdir/trailing-sp.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed trailing-sp"; fi ;;
1) $echo "Test trailing-sp failed: files trailing-sp.O and $srcdir/trailing-sp.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test trailing-sp may have failed." 1>&2;
$echo The command "cmp trailing-sp.O $srcdir/trailing-sp.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s trailing-sp.E || rm -f trailing-sp.E
if test $errors = 0 ; then
$echo Passed all 35 tests. 1>&2
$echo Passed all 36 tests. 1>&2
else
$echo Failed $errors tests. 1>&2
fi

View File

@@ -104,6 +104,7 @@ EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
PATH=`pwd`/../../src:$$PATH
subdir = tests/ln
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -129,8 +130,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/ln
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -108,6 +108,7 @@ TESTS_ENVIRONMENT = \
TESTS = tests
subdir = tests/ls-2
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -133,8 +134,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/ls-2
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -102,6 +102,7 @@ AUTOMAKE_OPTIONS = 1.2 gnits
TESTS = rt-1 time-1
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = LS=../../src/ls TOUCH=../../src/touch
subdir = tests/ls
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -127,8 +128,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/ls
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -106,6 +106,7 @@ TESTS_ENVIRONMENT = \
TESTS = basic-1 newline-1
subdir = tests/md5sum
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -131,8 +132,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/md5sum
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -102,6 +102,7 @@ AUTOMAKE_OPTIONS = 1.1 gnits
TESTS = p-1 p-2
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = MKDIR=../../src/mkdir
subdir = tests/mkdir
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -127,8 +128,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/mkdir
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -2,7 +2,7 @@
AUTOMAKE_OPTIONS = 1.3 gnits
TESTS = mv-special-1 into-self into-self-2 into-self-3 backup-is-src \
i-1 hard-link-1
i-1 hard-link-1 force
EXTRA_DIST = $(TESTS) setup
TESTS_ENVIRONMENT = \
@@ -15,5 +15,5 @@ TESTS_ENVIRONMENT = \
RM=../../src/rm \
TOUCH=../../src/touch \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=mv

View File

@@ -100,7 +100,7 @@ l = @l@
AUTOMAKE_OPTIONS = 1.3 gnits
TESTS = mv-special-1 into-self into-self-2 into-self-3 backup-is-src \
i-1 hard-link-1
i-1 hard-link-1 force
EXTRA_DIST = $(TESTS) setup
@@ -114,9 +114,10 @@ TESTS_ENVIRONMENT = \
RM=../../src/rm \
TOUCH=../../src/touch \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=mv
subdir = tests/mv
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -142,8 +143,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/mv
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

46
tests/mv/force Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/sh
# move a file onto itself with --force
if test "$VERBOSE" = yes; then
set -x
mv --version
fi
ff=force-file
ff2=force-file-2
framework_failure=0
rm -f $ff $ff2 || framework_failure=1
echo force-contents > $ff || framework_failure=1
ln $ff $ff2 || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
# Make sure we get English translations.
LANGUAGE=C
export LANGUAGE
LC_ALL=C
export LC_ALL
LANG=C
export LANG
# This mv command should exit nonzero.
mv --force $ff $ff > out 2>&1 && fail=1
cat > exp <<EOF
mv: \`$ff' and \`$ff' are the same file
EOF
cmp out exp || fail=1
test `cat $ff` = force-contents || fail=1
# This should succeed, even though the source and destination
# device and inodes are the same.
mv --force $ff $ff2 || fail=1
rm -fr out exp $ff $ff2
exit $fail

View File

@@ -178,6 +178,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/pr
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -205,8 +206,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/pr
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -110,6 +110,7 @@ TESTS_ENVIRONMENT = \
PATH=../../src:$$PATH \
PROG=rm
subdir = tests/rm
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -135,8 +136,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/rm
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -116,6 +116,7 @@ TESTS_ENVIRONMENT = \
PATH=../../src:$$PATH \
PROG=seq
subdir = tests/seq
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -141,8 +142,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/seq
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -19,7 +19,8 @@ n10b.X n11a.I n11a.X n11b.I n11b.X 01a.I 01a.X 02a.I 02a.X 02b.I 02b.X 02c.I \
15c.X 15d.I 15d.X 15e.I 15e.X 16a.I 16a.X 17.I 17.X 18a.I 18a.X 18b.I 18b.X \
18c.I 18c.X 18d.I 18d.X 18e.I 18e.X 19a.I 19a.X 19b.I 19b.X 20a.I 20a.X 21a.I \
21a.X 21b.I 21b.X 21c.I 21c.X 21d.I 21d.X 21e.I 21e.X 21f.I 21f.X 21g.I 21g.X \
22a.I 22a.X 22b.I 22b.X no-file1.X o-no-file1.X neg-nls.I neg-nls.X
22a.I 22a.X 22b.I 22b.X no-file1.X o-no-file1.X neg-nls.I neg-nls.X nul-nls.I \
nul-nls.X use-nl.I use-nl.X
run_gen = n1.O n1.E n2.O n2.E n3.O n3.E n4.O n4.E n5.O n5.E n6.O n6.E n7.O \
n7.E n8a.O n8a.E n8b.O n8b.E n9a.O n9a.E n9b.O n9b.E n10a.O n10a.E n10b.O \
n10b.E n11a.O n11a.E n11b.O n11b.E 01a.O 01a.E 02a.O 02a.E 02b.O 02b.E 02c.O \
@@ -37,7 +38,7 @@ n10b.E n11a.O n11a.E n11b.O n11b.E 01a.O 01a.E 02a.O 02a.E 02b.O 02b.E 02c.O \
18c.O 18c.E 18d.O 18d.E 18e.O 18e.E 19a.O 19a.E 19b.O 19b.E 20a.O 20a.E 21a.O \
21a.E 21b.O 21b.E 21c.O 21c.E 21d.O 21d.E 21e.O 21e.E 21f.O 21f.E 21g.O 21g.E \
22a.O 22a.E 22b.O 22b.E no-file1.O no-file1.E o-no-file1.O o-no-file1.E \
neg-nls.O neg-nls.E
neg-nls.O neg-nls.E nul-nls.O nul-nls.E use-nl.O use-nl.E
##test-files-end
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)

View File

@@ -113,7 +113,8 @@ n10b.X n11a.I n11a.X n11b.I n11b.X 01a.I 01a.X 02a.I 02a.X 02b.I 02b.X 02c.I \
15c.X 15d.I 15d.X 15e.I 15e.X 16a.I 16a.X 17.I 17.X 18a.I 18a.X 18b.I 18b.X \
18c.I 18c.X 18d.I 18d.X 18e.I 18e.X 19a.I 19a.X 19b.I 19b.X 20a.I 20a.X 21a.I \
21a.X 21b.I 21b.X 21c.I 21c.X 21d.I 21d.X 21e.I 21e.X 21f.I 21f.X 21g.I 21g.X \
22a.I 22a.X 22b.I 22b.X no-file1.X o-no-file1.X neg-nls.I neg-nls.X
22a.I 22a.X 22b.I 22b.X no-file1.X o-no-file1.X neg-nls.I neg-nls.X nul-nls.I \
nul-nls.X use-nl.I use-nl.X
run_gen = n1.O n1.E n2.O n2.E n3.O n3.E n4.O n4.E n5.O n5.E n6.O n6.E n7.O \
n7.E n8a.O n8a.E n8b.O n8b.E n9a.O n9a.E n9b.O n9b.E n10a.O n10a.E n10b.O \
@@ -132,7 +133,7 @@ n10b.E n11a.O n11a.E n11b.O n11b.E 01a.O 01a.E 02a.O 02a.E 02b.O 02b.E 02c.O \
18c.O 18c.E 18d.O 18d.E 18e.O 18e.E 19a.O 19a.E 19b.O 19b.E 20a.O 20a.E 21a.O \
21a.E 21b.O 21b.E 21c.O 21c.E 21d.O 21d.E 21e.O 21e.E 21f.O 21f.E 21g.O 21g.E \
22a.O 22a.E 22b.O 22b.E no-file1.O no-file1.E o-no-file1.O o-no-file1.E \
neg-nls.O neg-nls.E
neg-nls.O neg-nls.E nul-nls.O nul-nls.E use-nl.O use-nl.E
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
@@ -147,6 +148,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/sort
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -174,8 +176,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/sort
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -114,7 +114,10 @@ my @tv = (
["11a", '-t: -k1,1b -k2,2', "a\t:a\na :b\n", "a\t:a\na :b\n", 0],
["11b", '-t: -k1,1b -k2,2', "a :b\na\t:a\n", "a\t:a\na :b\n", 0],
["11c", '-t: -k2,2b -k3,3', "z:a\t:a\na :b\n", "z:a\t:a\na :b\n", 0],
["11d", '-t: -k2,2b -k3,3', "z:a :b\na\t:a\n", "a\t:a\nz:a :b\n", 0],
# Before 1.22m, the first key comparison reported equality.
# With 1.22m, they compare different: "a" sorts before "a\n",
# and the second key spec isn't even used.
["11d", '-t: -k2,2b -k3,3', "z:a :b\na\t:a\n", "z:a :b\na\t:a\n", 0],
#
# Exercise bug re comparing `-' and integers.
["12a", '-n -t: +1', "a:1\nb:-\n", "b:-\na:1\n", 0],
@@ -206,6 +209,34 @@ my @tv = (
# From Paul Eggert. This was fixed in textutils-1.22k.
["neg-nls", '-n', "-1\n-9\n", "-9\n-1\n", 0],
# From Paul Eggert. This was fixed in textutils-1.22m.
# The bug was visible only when using the internationalized sorting code
# (i.e., not when configured with --disable-nls).
["nul-nls", '', "\0b\n\0a\n", "\0a\n\0b\n", 0],
# Paul Eggert wrote:
# I tested the revised `sort' against Solaris `sort', and found a
# discrepancy that turns out to be a longstanding bug in GNU sort.
# POSIX.2 specifies that a newline is part of the input line, and should
# be significant during comparison; but with GNU sort the newline is
# insignificant. Here is an example of the bug:
#
# $ od -c t
# 0000000 \n \t \n
# 0000003
# $ sort t | od -c
# 0000000 \n \t \n
# 0000003
#
# The correct output of the latter command should be
#
# 0000000 \t \n \n
# 0000003
#
# because \t comes before \n in the collating sequence, and the trailing
# \n's are part of the input line.
["use-nl", '', "\n\t\n", "\t\n\n", 0],
);
sub test_vector

View File

@@ -1837,8 +1837,42 @@ else
esac
fi
test -s neg-nls.E || rm -f neg-nls.E
$xx $srcdir/nul-nls.I > nul-nls.O 2> nul-nls.E
code=$?
if test $code != 0 ; then
$echo "Test nul-nls failed: ../../src/sort return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp nul-nls.O $srcdir/nul-nls.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed nul-nls"; fi ;;
1) $echo "Test nul-nls failed: files nul-nls.O and $srcdir/nul-nls.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test nul-nls may have failed." 1>&2;
$echo The command "cmp nul-nls.O $srcdir/nul-nls.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s nul-nls.E || rm -f nul-nls.E
$xx $srcdir/use-nl.I > use-nl.O 2> use-nl.E
code=$?
if test $code != 0 ; then
$echo "Test use-nl failed: ../../src/sort return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp use-nl.O $srcdir/use-nl.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed use-nl"; fi ;;
1) $echo "Test use-nl failed: files use-nl.O and $srcdir/use-nl.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test use-nl may have failed." 1>&2;
$echo The command "cmp use-nl.O $srcdir/use-nl.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s use-nl.E || rm -f use-nl.E
if test $errors = 0 ; then
$echo Passed all 107 tests. 1>&2
$echo Passed all 109 tests. 1>&2
else
$echo Failed $errors tests. 1>&2
fi

View File

@@ -110,6 +110,7 @@ AUTOMAKE_OPTIONS = 1.2f gnits
TESTS = row-col-1 basic-1
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = PATH=../../src:$$PATH
subdir = tests/stty
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -135,8 +136,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/stty
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -126,6 +126,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/tac
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -153,8 +154,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/tac
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -128,6 +128,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/tail
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -155,8 +156,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/tail
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -159,6 +159,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/test
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -186,8 +187,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/test
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -104,6 +104,7 @@ EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
PATH=../../src:$$PATH
subdir = tests/touch
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -129,8 +130,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/touch
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -130,6 +130,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/tr
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -157,8 +158,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/tr
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -124,6 +124,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/uniq
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -151,8 +152,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/uniq
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \

View File

@@ -118,6 +118,7 @@ mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
subdir = tests/wc
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -145,8 +146,6 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/wc
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \