mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
321 Commits
FILEUTILS-
...
FILEUTILS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e48314ac1b | ||
|
|
7c94dda02d | ||
|
|
fe6c711f48 | ||
|
|
2c7c121c13 | ||
|
|
7a8b837062 | ||
|
|
25eb22e88f | ||
|
|
7f798f5f4f | ||
|
|
9d502e7240 | ||
|
|
c1ecd3afea | ||
|
|
a95088a5ea | ||
|
|
fb43ebcbae | ||
|
|
73ed11f2b7 | ||
|
|
6390686aab | ||
|
|
3e0c759c3a | ||
|
|
10f565971b | ||
|
|
e1ea22da05 | ||
|
|
1e71247ea0 | ||
|
|
46f650f6b0 | ||
|
|
74bca24efe | ||
|
|
e385fd1e4c | ||
|
|
239899ae58 | ||
|
|
2a3863e2b8 | ||
|
|
bd30083472 | ||
|
|
01839f9f82 | ||
|
|
6f807a8598 | ||
|
|
94439345f5 | ||
|
|
e9dc554349 | ||
|
|
68ed0308cf | ||
|
|
fb04070061 | ||
|
|
9200311684 | ||
|
|
dd374cd779 | ||
|
|
71076df2d8 | ||
|
|
a1a27df129 | ||
|
|
fd685e41d6 | ||
|
|
c672fc6df6 | ||
|
|
0a735b7b9e | ||
|
|
5aaadded9d | ||
|
|
a8bcd782c4 | ||
|
|
2be7ff8311 | ||
|
|
0894db7b3f | ||
|
|
d58a074dea | ||
|
|
d73bc3ca57 | ||
|
|
186d893f27 | ||
|
|
edeada009c | ||
|
|
18195dd699 | ||
|
|
338b31ba60 | ||
|
|
562eb3d16d | ||
|
|
175fb661e0 | ||
|
|
50c04a9d3e | ||
|
|
8a66d0dd57 | ||
|
|
1f678023d5 | ||
|
|
b66a30133f | ||
|
|
598a7bda46 | ||
|
|
0800b55642 | ||
|
|
5ac433d292 | ||
|
|
b22469537b | ||
|
|
591844b387 | ||
|
|
2611844743 | ||
|
|
c04fc60484 | ||
|
|
ffb626613a | ||
|
|
3452006a53 | ||
|
|
161422b9b2 | ||
|
|
2091adbbb1 | ||
|
|
ccbf5f37f1 | ||
|
|
ef2b6836fd | ||
|
|
44386ac6ff | ||
|
|
5c7e1b6bee | ||
|
|
3266134b2a | ||
|
|
63571532a2 | ||
|
|
82b01ee905 | ||
|
|
48569d6b98 | ||
|
|
211fe36692 | ||
|
|
8dd8bb78b1 | ||
|
|
d64cc3c1ef | ||
|
|
db7201835d | ||
|
|
74cb2ee314 | ||
|
|
6d24eee926 | ||
|
|
aeb7c0bc47 | ||
|
|
940f23f4a4 | ||
|
|
f3f1cae097 | ||
|
|
fbe50426e2 | ||
|
|
8011a147de | ||
|
|
3cca257a3b | ||
|
|
de96d28c57 | ||
|
|
783fb6b2a6 | ||
|
|
b969dad022 | ||
|
|
c1db691c12 | ||
|
|
5f9c33edfe | ||
|
|
10d7644859 | ||
|
|
6cb5a99aa7 | ||
|
|
f696bb6737 | ||
|
|
8a9acec293 | ||
|
|
7eeedf8385 | ||
|
|
4c066c3552 | ||
|
|
6e5149f0ab | ||
|
|
af12dd6260 | ||
|
|
f8e40348be | ||
|
|
be8f2b0de2 | ||
|
|
279f065a06 | ||
|
|
c7837e95d2 | ||
|
|
9130f4b9d2 | ||
|
|
5aa14aeef0 | ||
|
|
61976fe88d | ||
|
|
0868a7d0bd | ||
|
|
48be557ad6 | ||
|
|
371f45401c | ||
|
|
9b9213f122 | ||
|
|
4c3d7d6a8b | ||
|
|
720d1c1c5e | ||
|
|
0dac1e107c | ||
|
|
31a8ced738 | ||
|
|
eb07a88b9e | ||
|
|
0503b28076 | ||
|
|
f45eaa5782 | ||
|
|
2f00343264 | ||
|
|
323c9cfee7 | ||
|
|
676a608318 | ||
|
|
39d1a08208 | ||
|
|
9ca6f19a2d | ||
|
|
0acd885d83 | ||
|
|
9110853f39 | ||
|
|
4ffe108e39 | ||
|
|
7290a43da9 | ||
|
|
9cfc701536 | ||
|
|
b0a020d50b | ||
|
|
36942690e1 | ||
|
|
afda328772 | ||
|
|
8a752e8696 | ||
|
|
8bd5d9e607 | ||
|
|
6885aee87b | ||
|
|
e4c57a939b | ||
|
|
b802aa3f55 | ||
|
|
8f915aadf8 | ||
|
|
662e8b4a03 | ||
|
|
3dd86270c6 | ||
|
|
ce7c0d5468 | ||
|
|
9ae64058d2 | ||
|
|
92de89ed2c | ||
|
|
5f0b9f1d99 | ||
|
|
8ebfd37293 | ||
|
|
cb6351aa82 | ||
|
|
a518e28429 | ||
|
|
7de0d8e233 | ||
|
|
839c312d49 | ||
|
|
783bace690 | ||
|
|
31d836282b | ||
|
|
bc73cf3351 | ||
|
|
731cbc77fb | ||
|
|
2bd16e646e | ||
|
|
7f2c13e703 | ||
|
|
635a7c3186 | ||
|
|
42d1927306 | ||
|
|
ba246b0f36 | ||
|
|
13ff080b78 | ||
|
|
06a5782edd | ||
|
|
12f377da25 | ||
|
|
c423a2d74a | ||
|
|
04a1a572f4 | ||
|
|
1ba3bd3896 | ||
|
|
fb59a28b16 | ||
|
|
ab48b17dca | ||
|
|
d2ca2163c6 | ||
|
|
5ae342e1a9 | ||
|
|
6c635d1f27 | ||
|
|
42640f71df | ||
|
|
0b83b3090b | ||
|
|
4b583d1691 | ||
|
|
a182aa4e5a | ||
|
|
22ca9b17a5 | ||
|
|
04916b80de | ||
|
|
d7d7ae76b2 | ||
|
|
da7809f65c | ||
|
|
b7d3a68ce5 | ||
|
|
8794c292e7 | ||
|
|
ece3b1d144 | ||
|
|
8087dd5668 | ||
|
|
1a622aa2d9 | ||
|
|
1ea9952168 | ||
|
|
4df74fe308 | ||
|
|
68545c98ed | ||
|
|
4650315342 | ||
|
|
fbfde91f6a | ||
|
|
e3f1d80dd9 | ||
|
|
5e58599e6e | ||
|
|
c22036ab86 | ||
|
|
34ffd87f30 | ||
|
|
cea704d6da | ||
|
|
ddf8459662 | ||
|
|
8320e65164 | ||
|
|
f42460fb09 | ||
|
|
24a118665e | ||
|
|
3bcffe04d7 | ||
|
|
79523152dd | ||
|
|
35aaa568cd | ||
|
|
85da146bd2 | ||
|
|
ae8ee650ea | ||
|
|
4a11d01711 | ||
|
|
f76a4b618e | ||
|
|
c8c91b5e20 | ||
|
|
70155d8013 | ||
|
|
af14a04c19 | ||
|
|
6e62afaaed | ||
|
|
9190f77006 | ||
|
|
5d845a1678 | ||
|
|
f6c32178c7 | ||
|
|
ff5cd3f6a3 | ||
|
|
b3d8117527 | ||
|
|
103713c42b | ||
|
|
c84fb64144 | ||
|
|
8e02fb10ab | ||
|
|
1b47ed2714 | ||
|
|
dcd02c8008 | ||
|
|
a80c49322b | ||
|
|
3982e9cdf8 | ||
|
|
a5b6fae599 | ||
|
|
b660d78cf5 | ||
|
|
c86883a62a | ||
|
|
e36197cd8f | ||
|
|
2185c1f3d8 | ||
|
|
48a76e855c | ||
|
|
19b5a4f761 | ||
|
|
9dbd283b1e | ||
|
|
4376f9f2ce | ||
|
|
37fea371b7 | ||
|
|
bb02f48670 | ||
|
|
64cd458e0a | ||
|
|
bc9aded4b9 | ||
|
|
a611c6cbf6 | ||
|
|
68c33eea03 | ||
|
|
fec6a430da | ||
|
|
1266fc26ee | ||
|
|
41a41dd48e | ||
|
|
e59e2e803c | ||
|
|
52c7e3147e | ||
|
|
8829551700 | ||
|
|
e95fe088e1 | ||
|
|
e13281014a | ||
|
|
aac56cabe4 | ||
|
|
df5f33a5bf | ||
|
|
0799786a33 | ||
|
|
6621f0a9a9 | ||
|
|
d5b9b29ac6 | ||
|
|
022a19b21f | ||
|
|
12133d7f01 | ||
|
|
58dfd6b442 | ||
|
|
5fc47138b1 | ||
|
|
4a2b289e7c | ||
|
|
bab072f3aa | ||
|
|
8679e372cd | ||
|
|
b0690ba414 | ||
|
|
ed354b6490 | ||
|
|
81d1fa5cb6 | ||
|
|
421e75544b | ||
|
|
7466f41075 | ||
|
|
1e7d4b9c70 | ||
|
|
6a13b75511 | ||
|
|
ebefd435aa | ||
|
|
b3335ab809 | ||
|
|
d293e5f03c | ||
|
|
0a470f01de | ||
|
|
b181d31372 | ||
|
|
b3a49ee8d0 | ||
|
|
35b886ad7b | ||
|
|
cecde31171 | ||
|
|
ae6c43a3ab | ||
|
|
17432bd066 | ||
|
|
c835f92a61 | ||
|
|
89b765e32c | ||
|
|
3752e13942 | ||
|
|
858afc04d2 | ||
|
|
5fecd9e4d5 | ||
|
|
ae5ee331f1 | ||
|
|
954c7bc4cc | ||
|
|
625dc74361 | ||
|
|
b26beb4996 | ||
|
|
0b3d661480 | ||
|
|
33448d128a | ||
|
|
b3ef6f599d | ||
|
|
72f95044eb | ||
|
|
859f8587f8 | ||
|
|
24e15328df | ||
|
|
357c53621f | ||
|
|
fd688bcc5f | ||
|
|
e8c6c8175b | ||
|
|
561e4c139e | ||
|
|
507288d2c7 | ||
|
|
6c47524481 | ||
|
|
300c151b8b | ||
|
|
3c7e9fec08 | ||
|
|
7235fb47cc | ||
|
|
8ef2abf7e9 | ||
|
|
5e55e49972 | ||
|
|
48a255beb0 | ||
|
|
17a2ec94a8 | ||
|
|
e7f8503138 | ||
|
|
f789ddbdda | ||
|
|
1f1bd53b86 | ||
|
|
3a2afe3311 | ||
|
|
20b960db10 | ||
|
|
8fd3e8664b | ||
|
|
1b25f1c2cd | ||
|
|
8569e32ec8 | ||
|
|
1321f30e73 | ||
|
|
290ee99712 | ||
|
|
3008ad90f4 | ||
|
|
8c5b30bc1e | ||
|
|
f0fa287b4f | ||
|
|
4ecb3b28f1 | ||
|
|
ea93e0b7ad | ||
|
|
7603401c86 | ||
|
|
90d97b9703 | ||
|
|
4091022393 | ||
|
|
338061e307 | ||
|
|
6a99b4cc40 | ||
|
|
86d6c36d09 | ||
|
|
a7f5043de8 | ||
|
|
5110583f3e | ||
|
|
813c8e8bb6 | ||
|
|
7d72c942bb | ||
|
|
f17cc2e29c | ||
|
|
4f4111709c |
24
ABOUT-NLS
24
ABOUT-NLS
@@ -134,7 +134,8 @@ Each translation team has its own mailing list, courtesy of Linux
|
||||
International. You may reach your translation team at the address
|
||||
`LL@li.org', replacing LL by the two-letter ISO 639 code for your
|
||||
language. Language codes are *not* the same as the country codes given
|
||||
in ISO 3166. The following translation teams exist, as of October 1996:
|
||||
in ISO 3166. The following translation teams exist, as of December
|
||||
1996:
|
||||
|
||||
Arabic `ar', Chinese `zh', Czech `cs', Danish `da', Dutch `nl',
|
||||
English `en', Esperanto `eo', Finnish `fi', French `fr', German
|
||||
@@ -172,13 +173,13 @@ Available Packages
|
||||
|
||||
Languages are not equally supported in all GNU packages. The
|
||||
following matrix shows the current state of GNU internationalization,
|
||||
as of October 1996. The matrix shows, in regard of each package, for
|
||||
as of December 1996. The matrix shows, in regard of each package, for
|
||||
which languages PO files have been submitted to translation
|
||||
coordination.
|
||||
|
||||
cs de en es fi fr ja ko nl no pl pt sl sv
|
||||
Ready PO files cs de en es fi fr ja ko nl no pl pt sl sv
|
||||
.-------------------------------------------.
|
||||
bash | [] [] | 2
|
||||
bash | [] [] [] | 3
|
||||
bison | [] [] [] | 3
|
||||
clisp | [] [] [] | 3
|
||||
cpio | [] [] [] [] | 4
|
||||
@@ -186,17 +187,18 @@ coordination.
|
||||
enscript | [] [] [] [] [] | 5
|
||||
fileutils | [] [] [] [] [] [] [] [] | 8
|
||||
findutils | [] [] [] [] [] [] | 6
|
||||
flex | [] | 1
|
||||
flex | [] [] | 2
|
||||
gcal | [] [] [] | 3
|
||||
gettext | [] [] [] [] [] [] [] [] [] [] | 11
|
||||
grep | [] [] [] [] [] [] [] [] | 8
|
||||
hello | [] [] [] [] [] [] [] [] [] [] | 10
|
||||
id-utils | [] [] | 2
|
||||
indent | | 0
|
||||
libc | [] [] [] [] [] [] | 6
|
||||
m4 | [] [] [] [] [] | 5
|
||||
make | [] [] [] [] | 4
|
||||
make | [] [] [] [] [] | 5
|
||||
music | [] | 1
|
||||
ptx | [] [] [] [] [] [] [] | 7
|
||||
ptx | [] [] [] [] [] [] [] [] | 8
|
||||
recode | [] [] [] [] [] [] [] | 7
|
||||
sh-utils | [] [] [] [] [] | 5
|
||||
sharutils | [] [] [] [] | 4
|
||||
@@ -205,8 +207,8 @@ coordination.
|
||||
textutils | [] [] [] [] [] [] | 6
|
||||
wdiff | [] [] [] [] [] [] [] [] | 8
|
||||
`-------------------------------------------'
|
||||
cs de en es fi fr ja ko nl no pl pt sl sv
|
||||
1 20 1 9 1 24 1 8 20 7 14 6 7 13 132
|
||||
14 languages cs de en es fi fr ja ko nl no pl pt sl sv
|
||||
27 packages 1 21 1 11 1 24 1 8 20 7 14 6 7 14 136
|
||||
|
||||
Some counters in the preceding matrix are higher than the number of
|
||||
visible blocks let us expect. This is because a few extra PO files are
|
||||
@@ -219,6 +221,6 @@ distributed as such by its maintainer. There might be an observable
|
||||
lag between the mere existence a PO file and its wide availability in a
|
||||
GNU distribution.
|
||||
|
||||
If October 1996 seems to be old, you may fetch a more recent copy of
|
||||
this `ABOUT-NLS' file on most GNU archive sites.
|
||||
If December 1996 seems to be old, you may fetch a more recent copy
|
||||
of this `ABOUT-NLS' file on most GNU archive sites.
|
||||
|
||||
|
||||
10
THANKS
10
THANKS
@@ -1,13 +1,21 @@
|
||||
This is just a start at listing e-mail addresses of contributors.
|
||||
The rest of the addresses are still in the ChangeLog.
|
||||
|
||||
Arne Henrik Juul arnej@imf.unit.no
|
||||
Bauke Jan Douma: bjdouma@xs4all.nl
|
||||
Charles Karney: karney@pppl.gov
|
||||
Eirik Fuller: eirik@netcom.com
|
||||
Emile LeBlanc: leblanc@math.toronto.edu
|
||||
Galen Hazelwood: galenh@micron.net
|
||||
James Antill: jmanti%essex.ac.uk@seralph21.essex.ac.uk
|
||||
Jesse Thilo: jgt2@eecs.lehigh.edu
|
||||
Joakim Rosqvist: dvljrt@cs.umu.se
|
||||
Marcus Daniels: marcus@sysc.pdx.edu
|
||||
Mark A. Thomas: thommark@access.digex.net
|
||||
Miles Bader: miles@gnu.ai.mit.edu
|
||||
Peter Eriksson: peter@ifm.liu.se
|
||||
Ross Ridge: rridge@calum.csclub.uwaterloo.ca
|
||||
Santiago Vila Doncel: sanvila@ctv.es
|
||||
Thomas Bushnell, n/BSG: thomas@gnu.ai.mit.edu
|
||||
Thomas Bushnell, n/BSG: thomas@gnu.ai.mit.edu
|
||||
Tony Leneis: tony@plaza.ds.adp.com
|
||||
Wayne Stewart: wstewa@atl.com
|
||||
|
||||
@@ -181,7 +181,7 @@ clean-info:
|
||||
distclean-info:
|
||||
|
||||
maintainer-clean-info:
|
||||
for i in $(INFO_DEPS); do rm `eval echo $$i*`; done
|
||||
for i in $(INFO_DEPS); do rm -f `eval echo $$i*`; done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
@@ -876,7 +876,7 @@ results in a new page. Page counting with and without
|
||||
@samp{+@var{first_page}} is identical. By default, it starts with the
|
||||
first page of input file (not first page printed). Page numbering may be
|
||||
altered by @samp{-N} option.
|
||||
|
||||
|
||||
@item -@var{column}
|
||||
@opindex -@var{column}
|
||||
@cindex down columns
|
||||
@@ -918,7 +918,7 @@ is 8).
|
||||
Use a form feed instead of newlines to separate output pages. Default
|
||||
page length of 66 lines is not altered. But the number of lines of text
|
||||
per page changes from 56 to 63 lines.
|
||||
|
||||
|
||||
|
||||
@item -h @var{HEADER}
|
||||
@opindex -h
|
||||
@@ -941,7 +941,7 @@ is 8).
|
||||
@opindex -j
|
||||
Merge lines of full length. Used together with the column options
|
||||
@samp{-@var{column}}, @samp{-a -@var{column}} or @samp{-m}. Turns off
|
||||
@samp{-w} line truncation; no column alignment used; may be used with
|
||||
@samp{-w} line truncation; no column alignment used; may be used with
|
||||
@samp{-s[@var{separator}]}.
|
||||
|
||||
|
||||
@@ -1322,7 +1322,7 @@ less than @var{bytes} bytes of the line are left, then continue
|
||||
normally. @var{bytes} has the same format as for the @samp{--bytes}
|
||||
option.
|
||||
|
||||
@itemx --verbose=@var{bytes}
|
||||
@itemx --verbose
|
||||
@opindex --verbose
|
||||
Write a diagnostic to standard error just before each output file is opened.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ noinst_LIBRARIES = libfu.a
|
||||
|
||||
## FIXME: Remove mvdir.c, and rmdir.c when
|
||||
## automake is fixed -- probably for 1.1g
|
||||
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c
|
||||
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c getgroups.c
|
||||
|
||||
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||
|
||||
@@ -18,8 +18,8 @@ libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
|
||||
|
||||
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
|
||||
getline.h getopt.h group-member.h long-options.h makepath.h modechange.h \
|
||||
mountlist.h path-concat.h pathmax.h \
|
||||
getdate.h getline.h getopt.h group-member.h long-options.h \
|
||||
makepath.h modechange.h mountlist.h path-concat.h pathmax.h \
|
||||
save-cwd.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
|
||||
@@ -49,7 +49,7 @@ RM = @RM@
|
||||
|
||||
noinst_LIBRARIES = libfu.a
|
||||
|
||||
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c
|
||||
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c getgroups.c
|
||||
|
||||
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||
|
||||
@@ -64,8 +64,8 @@ libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
|
||||
|
||||
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
|
||||
getline.h getopt.h group-member.h long-options.h makepath.h modechange.h \
|
||||
mountlist.h path-concat.h pathmax.h \
|
||||
getdate.h getline.h getopt.h group-member.h long-options.h \
|
||||
makepath.h modechange.h mountlist.h path-concat.h pathmax.h \
|
||||
save-cwd.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
@@ -94,7 +94,7 @@ HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in alloca.c basename.c error.c \
|
||||
error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
|
||||
getdate.c getline.c getloadavg.c group-member.c interlock memcmp.c \
|
||||
getdate.c getgroups.c getline.c group-member.c interlock memcmp.c \
|
||||
memcpy.c memset.c mkdir.c mktime.c mountlist.c obstack.c obstack.h \
|
||||
posixtm.c regex.c regex.h rename.c rmdir.c rpmatch.c rx.c rx.h stpcpy.c \
|
||||
strcasecmp.c strdup.c strftime.c strndup.c strstr.c strtol.c strtoul.c \
|
||||
@@ -111,8 +111,8 @@ TAR = tar
|
||||
DEP_FILES = .deps/alloca.P .deps/argmatch.P .deps/backupfile.P \
|
||||
.deps/basename.P .deps/dirname.P .deps/error.P .deps/euidaccess.P \
|
||||
.deps/fileblocks.P .deps/filemode.P .deps/fnmatch.P .deps/fsusage.P \
|
||||
.deps/ftruncate.P .deps/full-write.P .deps/getdate.P .deps/getline.P \
|
||||
.deps/getloadavg.P .deps/getopt.P .deps/getopt1.P .deps/getversion.P \
|
||||
.deps/ftruncate.P .deps/full-write.P .deps/getdate.P .deps/getgroups.P \
|
||||
.deps/getline.P .deps/getopt.P .deps/getopt1.P .deps/getversion.P \
|
||||
.deps/group-member.P .deps/idcache.P .deps/isdir.P .deps/long-options.P \
|
||||
.deps/makepath.P .deps/memcmp.P .deps/memcpy.P .deps/memset.P \
|
||||
.deps/mkdir.P .deps/mktime.P .deps/modechange.P .deps/mountlist.P \
|
||||
|
||||
@@ -68,8 +68,17 @@ char *malloc ();
|
||||
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||
#endif
|
||||
|
||||
#define ISDIGIT(c) (IN_CTYPE_DOMAIN ((unsigned char) (c)) \
|
||||
&& isdigit ((unsigned char) (c)))
|
||||
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
||||
|
||||
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
|
||||
- Its arg may be any int or unsigned int; it need not be an unsigned char.
|
||||
- It's guaranteed to evaluate its argument exactly once.
|
||||
- It's typically faster.
|
||||
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
|
||||
only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
|
||||
it's important to use the locale's definition of `digit' even when the
|
||||
host does not conform to Posix. */
|
||||
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
|
||||
46
lib/getdate.h
Normal file
46
lib/getdate.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* Copyright (C) 1995 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
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined (__GNUC__) || __STDC__
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#if defined (vms)
|
||||
# include <types.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# ifdef TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
# else
|
||||
# ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif /* defined (vms) */
|
||||
|
||||
time_t get_date PARAMS ((const char *p, const time_t *now));
|
||||
851
lib/getdate.y
851
lib/getdate.y
File diff suppressed because it is too large
Load Diff
59
lib/getgroups.c
Normal file
59
lib/getgroups.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* provide consistent interface to getgroups for systems that don't allow N==0
|
||||
Copyright (C) 1996 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
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
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 Jim Meyering */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
char *xmalloc ();
|
||||
|
||||
/* On at least Ultrix 4.3 and NextStep 3.2, getgroups (0, 0) always fails.
|
||||
On other systems, it returns the number of supplemental groups for the
|
||||
process is returned.
|
||||
This function handles that special case and lets the system-
|
||||
provided function handle all others. */
|
||||
|
||||
int
|
||||
getgroups (n, group)
|
||||
size_t n;
|
||||
GETGROUPS_T *group;
|
||||
{
|
||||
int n_groups;
|
||||
GETGROUPS_T *gbuf;
|
||||
|
||||
#undef getgroups
|
||||
|
||||
if (n != 0)
|
||||
return getgroups (n, group);
|
||||
|
||||
n = 20;
|
||||
gbuf = NULL;
|
||||
while (1)
|
||||
{
|
||||
gbuf = (GETGROUPS_T *) xrealloc (gbuf, n * sizeof (GETGROUPS_T));
|
||||
n_groups = getgroups (n, gbuf);
|
||||
if (n_groups < n)
|
||||
break;
|
||||
n += 10;
|
||||
}
|
||||
|
||||
free (gbuf);
|
||||
|
||||
return n_groups;
|
||||
}
|
||||
768
lib/getloadavg.c
768
lib/getloadavg.c
File diff suppressed because it is too large
Load Diff
275
lib/getopt.c
275
lib/getopt.c
@@ -3,22 +3,26 @@
|
||||
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
|
||||
before changing it!
|
||||
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97
|
||||
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 the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
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
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
|
||||
Ditto for AIX 3.2 and <stdlib.h>. */
|
||||
@@ -48,18 +52,24 @@
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
|
||||
#define GETOPT_INTERFACE_VERSION 2
|
||||
#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
|
||||
#include <gnu-versions.h>
|
||||
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
||||
#define ELIDE_CODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* Don't include stdlib.h for non-GNU C libraries because some of them
|
||||
contain conflicting prototypes for getopt. */
|
||||
#include <stdlib.h>
|
||||
#if defined (_LIBC) || defined (HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif /* GNU C library. */
|
||||
|
||||
#ifdef VMS
|
||||
@@ -69,7 +79,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) && !defined (__CYGWIN32__)
|
||||
/* It's not Unix, really. See? Capital letters. */
|
||||
#include <windows.h>
|
||||
#define getpid() GetCurrentProcessId()
|
||||
@@ -116,14 +126,20 @@ char *optarg = NULL;
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns EOF, this is the index of the first of the
|
||||
When `getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
/* XXX 1003.2 says this must be 1 before any call. */
|
||||
int optind = 0;
|
||||
/* 1003.2 says this must be 1 before any call. */
|
||||
int optind = 1;
|
||||
|
||||
/* Formerly, initialization of getopt depended on optind==0, which
|
||||
causes problems with re-calling getopt as programs generally don't
|
||||
know that. */
|
||||
|
||||
int __getopt_initialized = 0;
|
||||
|
||||
/* The next char to be scanned in the option-element
|
||||
in which the last option character we returned was found.
|
||||
@@ -172,7 +188,7 @@ int optopt = '?';
|
||||
|
||||
The special argument `--' forces an end of option-scanning regardless
|
||||
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
|
||||
`--' can cause `getopt' to return EOF with `optind' != ARGC. */
|
||||
`--' can cause `getopt' to return -1 with `optind' != ARGC. */
|
||||
|
||||
static enum
|
||||
{
|
||||
@@ -182,7 +198,7 @@ static enum
|
||||
/* Value of POSIXLY_CORRECT environment variable. */
|
||||
static char *posixly_correct;
|
||||
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* We want to avoid inclusion of string.h with non-GNU libraries
|
||||
because there are many ways it can cause trouble.
|
||||
On some systems, it contains special magic macros that don't work
|
||||
@@ -233,12 +249,31 @@ extern int strlen (const char *);
|
||||
static int first_nonopt;
|
||||
static int last_nonopt;
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Bash 2.0 gives us an environment variable containing flags
|
||||
indicating ARGV elements that should not be considered arguments. */
|
||||
|
||||
static const char *nonoption_flags;
|
||||
static int nonoption_flags_len;
|
||||
|
||||
static int original_argc;
|
||||
static char *const *original_argv;
|
||||
|
||||
/* Make sure the environment variable bash 2.0 puts in the environment
|
||||
is valid for the getopt call we must make sure that the ARGV passed
|
||||
to getopt is that one passed to the process. */
|
||||
static void store_args (int argc, char *const *argv) __attribute__ ((unused));
|
||||
static void
|
||||
store_args (int argc, char *const *argv)
|
||||
{
|
||||
/* XXX This is no good solution. We should rather copy the args so
|
||||
that we can compare them later. But we must not use malloc(3). */
|
||||
original_argc = argc;
|
||||
original_argv = argv;
|
||||
}
|
||||
text_set_element (__libc_subinit, store_args);
|
||||
#endif
|
||||
|
||||
/* Exchange two adjacent subsequences of ARGV.
|
||||
One subsequence is elements [first_nonopt,last_nonopt)
|
||||
which contains all the non-options that have been skipped so far.
|
||||
@@ -311,10 +346,12 @@ exchange (argv)
|
||||
/* Initialize the internal data when the first call is made. */
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
static const char *_getopt_initialize (const char *);
|
||||
static const char *_getopt_initialize (int, char *const *, const char *);
|
||||
#endif
|
||||
static const char *
|
||||
_getopt_initialize (optstring)
|
||||
_getopt_initialize (argc, argv, optstring)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *optstring;
|
||||
{
|
||||
/* Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||
@@ -344,7 +381,9 @@ _getopt_initialize (optstring)
|
||||
else
|
||||
ordering = PERMUTE;
|
||||
|
||||
if (posixly_correct == NULL)
|
||||
#ifdef _LIBC
|
||||
if (posixly_correct == NULL
|
||||
&& argc == original_argc && argv == original_argv)
|
||||
{
|
||||
/* Bash 2.0 puts a special variable in the environment for each
|
||||
command it runs, specifying which ARGV elements are the results of
|
||||
@@ -358,6 +397,9 @@ _getopt_initialize (optstring)
|
||||
else
|
||||
nonoption_flags_len = strlen (nonoption_flags);
|
||||
}
|
||||
else
|
||||
nonoption_flags_len = 0;
|
||||
#endif
|
||||
|
||||
return optstring;
|
||||
}
|
||||
@@ -375,7 +417,7 @@ _getopt_initialize (optstring)
|
||||
updating `optind' and `nextchar' so that the next call to `getopt' can
|
||||
resume the scan with the following option character or ARGV-element.
|
||||
|
||||
If there are no more option characters, `getopt' returns `EOF'.
|
||||
If there are no more option characters, `getopt' returns -1.
|
||||
Then `optind' is the index in ARGV of the first ARGV-element
|
||||
that is not an option. (The ARGV-elements have been permuted
|
||||
so that those that are not options now come last.)
|
||||
@@ -429,18 +471,24 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
{
|
||||
optarg = NULL;
|
||||
|
||||
if (optind == 0)
|
||||
if (!__getopt_initialized || optind == 0)
|
||||
{
|
||||
optstring = _getopt_initialize (optstring);
|
||||
optstring = _getopt_initialize (argc, argv, optstring);
|
||||
optind = 1; /* Don't scan ARGV[0], the program name. */
|
||||
__getopt_initialized = 1;
|
||||
}
|
||||
|
||||
/* Test whether ARGV[optind] points to a non-option argument.
|
||||
Either it does not have option syntax, or there is an environment flag
|
||||
from the shell indicating it is not an option. */
|
||||
from the shell indicating it is not an option. The later information
|
||||
is only used when the used in the GNU libc. */
|
||||
#ifdef _LIBC
|
||||
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|
||||
|| (optind < nonoption_flags_len \
|
||||
&& nonoption_flags[optind] == '1'))
|
||||
#else
|
||||
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
|
||||
#endif
|
||||
|
||||
if (nextchar == NULL || *nextchar == '\0')
|
||||
{
|
||||
@@ -498,7 +546,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
that we previously skipped, so the caller will digest them. */
|
||||
if (first_nonopt != last_nonopt)
|
||||
optind = first_nonopt;
|
||||
return EOF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If we have come to a non-option and did not permute it,
|
||||
@@ -507,7 +555,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
if (NONOPTION_P)
|
||||
{
|
||||
if (ordering == REQUIRE_ORDER)
|
||||
return EOF;
|
||||
return -1;
|
||||
optarg = argv[optind++];
|
||||
return 1;
|
||||
}
|
||||
@@ -543,22 +591,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
const struct option *pfound = NULL;
|
||||
int exact = 0;
|
||||
int ambig = 0;
|
||||
int indfound;
|
||||
int indfound = -1;
|
||||
int option_index;
|
||||
|
||||
for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
|
||||
/* Do nothing. */ ;
|
||||
|
||||
#ifdef lint /* Suppress `used before initialized' warning. */
|
||||
indfound = 0;
|
||||
#endif
|
||||
|
||||
/* Test all long options for either exact match
|
||||
or abbreviated matches. */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp (p->name, nextchar, nameend - nextchar))
|
||||
{
|
||||
if (nameend - nextchar == strlen (p->name))
|
||||
if ((unsigned int) (nameend - nextchar)
|
||||
== (unsigned int) strlen (p->name))
|
||||
{
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
@@ -601,16 +646,16 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
else
|
||||
{
|
||||
if (opterr)
|
||||
if (argv[optind - 1][1] == '-')
|
||||
/* --option */
|
||||
fprintf (stderr,
|
||||
_("%s: option `--%s' doesn't allow an argument\n"),
|
||||
argv[0], pfound->name);
|
||||
else
|
||||
/* +option or -option */
|
||||
fprintf (stderr,
|
||||
_("%s: option `%c%s' doesn't allow an argument\n"),
|
||||
argv[0], argv[optind - 1][0], pfound->name);
|
||||
if (argv[optind - 1][1] == '-')
|
||||
/* --option */
|
||||
fprintf (stderr,
|
||||
_("%s: option `--%s' doesn't allow an argument\n"),
|
||||
argv[0], pfound->name);
|
||||
else
|
||||
/* +option or -option */
|
||||
fprintf (stderr,
|
||||
_("%s: option `%c%s' doesn't allow an argument\n"),
|
||||
argv[0], argv[optind - 1][0], pfound->name);
|
||||
|
||||
nextchar += strlen (nextchar);
|
||||
|
||||
@@ -626,8 +671,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr,
|
||||
_("%s: option `%s' requires an argument\n"),
|
||||
argv[0], argv[optind - 1]);
|
||||
_("%s: option `%s' requires an argument\n"),
|
||||
argv[0], argv[optind - 1]);
|
||||
nextchar += strlen (nextchar);
|
||||
optopt = pfound->val;
|
||||
return optstring[0] == ':' ? ':' : '?';
|
||||
@@ -694,6 +739,130 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
optopt = c;
|
||||
return '?';
|
||||
}
|
||||
/* Convenience. Treat POSIX -W foo same as long option --foo */
|
||||
if (temp[0] == 'W' && temp[1] == ';')
|
||||
{
|
||||
char *nameend;
|
||||
const struct option *p;
|
||||
const struct option *pfound = NULL;
|
||||
int exact = 0;
|
||||
int ambig = 0;
|
||||
int indfound = 0;
|
||||
int option_index;
|
||||
|
||||
/* This is an option that requires an argument. */
|
||||
if (*nextchar != '\0')
|
||||
{
|
||||
optarg = nextchar;
|
||||
/* If we end this ARGV-element by taking the rest as an arg,
|
||||
we must advance to the next element now. */
|
||||
optind++;
|
||||
}
|
||||
else if (optind == argc)
|
||||
{
|
||||
if (opterr)
|
||||
{
|
||||
/* 1003.2 specifies the format of this message. */
|
||||
fprintf (stderr, _("%s: option requires an argument -- %c\n"),
|
||||
argv[0], c);
|
||||
}
|
||||
optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
c = ':';
|
||||
else
|
||||
c = '?';
|
||||
return c;
|
||||
}
|
||||
else
|
||||
/* We already incremented `optind' once;
|
||||
increment it again when taking next ARGV-elt as argument. */
|
||||
optarg = argv[optind++];
|
||||
|
||||
/* optarg is now the argument, see if it's in the
|
||||
table of longopts. */
|
||||
|
||||
for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
|
||||
/* Do nothing. */ ;
|
||||
|
||||
/* Test all long options for either exact match
|
||||
or abbreviated matches. */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp (p->name, nextchar, nameend - nextchar))
|
||||
{
|
||||
if ((unsigned int) (nameend - nextchar) == strlen (p->name))
|
||||
{
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
exact = 1;
|
||||
break;
|
||||
}
|
||||
else if (pfound == NULL)
|
||||
{
|
||||
/* First nonexact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
}
|
||||
else
|
||||
/* Second or later nonexact match found. */
|
||||
ambig = 1;
|
||||
}
|
||||
if (ambig && !exact)
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
|
||||
argv[0], argv[optind]);
|
||||
nextchar += strlen (nextchar);
|
||||
optind++;
|
||||
return '?';
|
||||
}
|
||||
if (pfound != NULL)
|
||||
{
|
||||
option_index = indfound;
|
||||
if (*nameend)
|
||||
{
|
||||
/* Don't test has_arg with >, because some C compilers don't
|
||||
allow it to be used on enums. */
|
||||
if (pfound->has_arg)
|
||||
optarg = nameend + 1;
|
||||
else
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr, _("\
|
||||
%s: option `-W %s' doesn't allow an argument\n"),
|
||||
argv[0], pfound->name);
|
||||
|
||||
nextchar += strlen (nextchar);
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
else if (pfound->has_arg == 1)
|
||||
{
|
||||
if (optind < argc)
|
||||
optarg = argv[optind++];
|
||||
else
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr,
|
||||
_("%s: option `%s' requires an argument\n"),
|
||||
argv[0], argv[optind - 1]);
|
||||
nextchar += strlen (nextchar);
|
||||
return optstring[0] == ':' ? ':' : '?';
|
||||
}
|
||||
}
|
||||
nextchar += strlen (nextchar);
|
||||
if (longind != NULL)
|
||||
*longind = option_index;
|
||||
if (pfound->flag)
|
||||
{
|
||||
*(pfound->flag) = pfound->val;
|
||||
return 0;
|
||||
}
|
||||
return pfound->val;
|
||||
}
|
||||
nextchar = NULL;
|
||||
return 'W'; /* Let the application handle it. */
|
||||
}
|
||||
if (temp[1] == ':')
|
||||
{
|
||||
if (temp[2] == ':')
|
||||
@@ -724,8 +893,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
{
|
||||
/* 1003.2 specifies the format of this message. */
|
||||
fprintf (stderr,
|
||||
_("%s: option requires an argument -- %c\n"),
|
||||
argv[0], c);
|
||||
_("%s: option requires an argument -- %c\n"),
|
||||
argv[0], c);
|
||||
}
|
||||
optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
@@ -756,7 +925,7 @@ getopt (argc, argv, optstring)
|
||||
0);
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
#endif /* Not ELIDE_CODE. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
@@ -776,7 +945,7 @@ main (argc, argv)
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
|
||||
c = getopt (argc, argv, "abc:d:0123456789");
|
||||
if (c == EOF)
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
|
||||
28
lib/getopt.h
28
lib/getopt.h
@@ -1,19 +1,23 @@
|
||||
/* Declarations for getopt.
|
||||
Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989,90,91,92,93,94,96,97 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 the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
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
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
#define _GETOPT_H 1
|
||||
@@ -36,7 +40,7 @@ extern char *optarg;
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns EOF, this is the index of the first of the
|
||||
When `getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97 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 the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
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
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
@@ -40,15 +43,21 @@
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
|
||||
#define GETOPT_INTERFACE_VERSION 2
|
||||
#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
|
||||
#include <gnu-versions.h>
|
||||
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
||||
#define ELIDE_CODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
char *getenv ();
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
@@ -83,7 +92,7 @@ getopt_long_only (argc, argv, options, long_options, opt_index)
|
||||
}
|
||||
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
#endif /* Not ELIDE_CODE. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
@@ -114,7 +123,7 @@ main (argc, argv)
|
||||
|
||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||
long_options, &option_index);
|
||||
if (c == EOF)
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
|
||||
@@ -46,10 +46,8 @@ parse_long_options (argc, argv, command_name, package, version, usage)
|
||||
{
|
||||
int c;
|
||||
int saved_opterr;
|
||||
int saved_optind;
|
||||
|
||||
saved_opterr = opterr;
|
||||
saved_optind = optind;
|
||||
|
||||
/* Don't print an error message for unrecognized options. */
|
||||
opterr = 0;
|
||||
@@ -75,6 +73,7 @@ parse_long_options (argc, argv, command_name, package, version, usage)
|
||||
/* Restore previous value. */
|
||||
opterr = saved_opterr;
|
||||
|
||||
/* Restore optind in case it has advanced past a leading `--'. */
|
||||
optind = saved_optind;
|
||||
/* Reset this to zero so that getopt internals get initialized from
|
||||
the probably-new parameters when/if getopt is called later. */
|
||||
optind = 0;
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
struct tabmntent *mntlist, *p;
|
||||
struct mntent *mnt;
|
||||
struct mount_entry *me;
|
||||
|
||||
|
||||
/* the third and fourth arguments could be used to filter mounts,
|
||||
but Crays doesn't seem to have any mounts that we want to
|
||||
remove. Specifically, automount create normal NFS mounts.
|
||||
|
||||
255
lib/strftime.c
255
lib/strftime.c
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C
|
||||
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
@@ -28,12 +28,15 @@
|
||||
# define HAVE_STRUCT_ERA_ENTRY 1
|
||||
# define HAVE_TM_GMTOFF 1
|
||||
# define HAVE_TM_ZONE 1
|
||||
# define HAVE_TZNAME 1
|
||||
# define HAVE_TZSET 1
|
||||
# define MULTIBYTE_IS_FORMAT_SAFE 1
|
||||
# define STDC_HEADERS 1
|
||||
# include <ansidecl.h>
|
||||
# include "../locale/localeinfo.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h> /* Some systems define `time_t' here. */
|
||||
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
@@ -46,7 +49,6 @@
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if HAVE_TZNAME
|
||||
extern char *tzname[];
|
||||
#endif
|
||||
@@ -80,27 +82,31 @@ extern char *tzname[];
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#else
|
||||
# define memcpy(d, s, n) bcopy (s, d, n)
|
||||
# define memcpy(d, s, n) bcopy ((s), (d), (n))
|
||||
#endif
|
||||
|
||||
#ifndef __P
|
||||
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
#define __P(args) args
|
||||
#else
|
||||
#define __P(args) ()
|
||||
#endif /* GCC. */
|
||||
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
# define __P(args) args
|
||||
# else
|
||||
# define __P(args) ()
|
||||
# endif /* GCC. */
|
||||
#endif /* Not __P. */
|
||||
|
||||
#ifndef PTR
|
||||
#ifdef __STDC__
|
||||
#define PTR void *
|
||||
#else
|
||||
#define PTR char *
|
||||
#endif
|
||||
# ifdef __STDC__
|
||||
# define PTR void *
|
||||
# else
|
||||
# define PTR char *
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
#define CHAR_BIT 8
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif
|
||||
|
||||
#define TYPE_SIGNED(t) ((t) -1 < 0)
|
||||
@@ -118,7 +124,7 @@ extern char *tzname[];
|
||||
#ifndef __isleap
|
||||
/* Nonzero if YEAR is a leap year (every 4 years,
|
||||
except every 100th isn't, and every 400th is). */
|
||||
#define __isleap(year) \
|
||||
# define __isleap(year) \
|
||||
((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
|
||||
#endif
|
||||
|
||||
@@ -126,11 +132,14 @@ extern char *tzname[];
|
||||
#ifdef _LIBC
|
||||
# define gmtime_r __gmtime_r
|
||||
# define localtime_r __localtime_r
|
||||
extern int __tz_compute __P ((time_t timer, const struct tm *tm));
|
||||
# define tzname __tzname
|
||||
# define tzset __tzset
|
||||
#else
|
||||
# if ! HAVE_LOCALTIME_R
|
||||
# if ! HAVE_TM_GMTOFF
|
||||
/* Approximate gmtime_r as best we can in its absence. */
|
||||
#define gmtime_r my_gmtime_r
|
||||
# define gmtime_r my_gmtime_r
|
||||
static struct tm *gmtime_r __P ((const time_t *, struct tm *));
|
||||
static struct tm *
|
||||
gmtime_r (t, tp)
|
||||
@@ -146,7 +155,7 @@ gmtime_r (t, tp)
|
||||
# endif /* ! HAVE_TM_GMTOFF */
|
||||
|
||||
/* Approximate localtime_r as best we can in its absence. */
|
||||
#define localtime_r my_localtime_r
|
||||
# define localtime_r my_localtime_r
|
||||
static struct tm *localtime_r __P ((const time_t *, struct tm *));
|
||||
static struct tm *
|
||||
localtime_r (t, tp)
|
||||
@@ -163,20 +172,95 @@ localtime_r (t, tp)
|
||||
#endif /* ! defined (_LIBC) */
|
||||
|
||||
|
||||
#define add(n, f) \
|
||||
#if !defined (memset) && !defined (HAVE_MEMSET) && !defined (_LIBC)
|
||||
/* Some systems lack the `memset' function and we don't want to
|
||||
introduce additional dependencies. */
|
||||
static const char spaces[16] = " ";
|
||||
|
||||
# define memset_space(P, Len) \
|
||||
do { \
|
||||
int _len = (Len); \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
int _this = _len > 16 ? 16 : _len; \
|
||||
memcpy ((P), spaces, _this); \
|
||||
(P) += _this; \
|
||||
_len -= _this; \
|
||||
} \
|
||||
while (_len > 0); \
|
||||
} while (0)
|
||||
#else
|
||||
# define memset_space(P, Len) memset ((P), ' ', (Len))
|
||||
#endif
|
||||
|
||||
#define add(n, f) \
|
||||
do \
|
||||
{ \
|
||||
i += (n); \
|
||||
if (i >= maxsize) \
|
||||
int _n = (n); \
|
||||
int _delta = width - _n; \
|
||||
int _incr = _n + (_delta > 0 ? _delta : 0); \
|
||||
if (i + _incr >= maxsize) \
|
||||
return 0; \
|
||||
else \
|
||||
if (p) \
|
||||
{ \
|
||||
f; \
|
||||
p += (n); \
|
||||
} \
|
||||
if (p) \
|
||||
{ \
|
||||
if (_delta > 0) \
|
||||
memset_space (p, _delta); \
|
||||
f; \
|
||||
p += _n; \
|
||||
} \
|
||||
i += _incr; \
|
||||
} while (0)
|
||||
#define cpy(n, s) add ((n), memcpy((PTR) p, (PTR) (s), (n)))
|
||||
|
||||
#define cpy(n, s) \
|
||||
add ((n), \
|
||||
if (to_lowcase) \
|
||||
memcpy_lowcase (p, (s), _n); \
|
||||
else if (to_uppcase) \
|
||||
memcpy_uppcase (p, (s), _n); \
|
||||
else \
|
||||
memcpy ((PTR) p, (PTR) (s), _n))
|
||||
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
# define TOUPPER(Ch) toupper (Ch)
|
||||
# define TOLOWER(Ch) tolower (Ch)
|
||||
#else
|
||||
# define TOUPPER(Ch) (islower (Ch) ? toupper (Ch) : (Ch))
|
||||
# define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
|
||||
#endif
|
||||
/* We don't use `isdigit' here since the locale dependent
|
||||
interpretation is not what we want here. We only need to accept
|
||||
the arabic digits in the ASCII range. One day there is perhaps a
|
||||
more reliable way to accept other sets of digits. */
|
||||
#define ISDIGIT(Ch) ((unsigned int) (Ch) - '0' <= 9)
|
||||
|
||||
static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len));
|
||||
|
||||
static char *
|
||||
memcpy_lowcase (dest, src, len)
|
||||
char *dest;
|
||||
const char *src;
|
||||
size_t len;
|
||||
{
|
||||
while (len-- > 0)
|
||||
dest[len] = TOLOWER (src[len]);
|
||||
return dest;
|
||||
}
|
||||
|
||||
static char *memcpy_uppcase __P ((char *dest, const char *src, size_t len));
|
||||
|
||||
static char *
|
||||
memcpy_uppcase (dest, src, len)
|
||||
char *dest;
|
||||
const char *src;
|
||||
size_t len;
|
||||
{
|
||||
while (len-- > 0)
|
||||
dest[len] = TOUPPER (src[len]);
|
||||
return dest;
|
||||
}
|
||||
|
||||
#if ! HAVE_TM_GMTOFF
|
||||
/* Yield the difference between *A and *B,
|
||||
@@ -245,6 +329,31 @@ static char const month_name[][10] =
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
|
||||
/* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
|
||||
Work around this bug by copying *tp before it might be munged. */
|
||||
size_t _strftime_copytm __P ((char *, size_t, const char *,
|
||||
const struct tm *));
|
||||
size_t
|
||||
strftime (s, maxsize, format, tp)
|
||||
char *s;
|
||||
size_t maxsize;
|
||||
const char *format;
|
||||
const struct tm *tp;
|
||||
{
|
||||
struct tm tmcopy;
|
||||
tmcopy = *tp;
|
||||
return _strftime_copytm (s, maxsize, format, &tmcopy);
|
||||
}
|
||||
# ifdef strftime
|
||||
# undef strftime
|
||||
# endif
|
||||
# define strftime _strftime_copytm
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Write information from TP into S according to the format
|
||||
string FORMAT, writing no more that MAXSIZE characters
|
||||
(including the terminating '\0') and returning number of
|
||||
@@ -256,7 +365,7 @@ strftime (s, maxsize, format, tp)
|
||||
char *s;
|
||||
size_t maxsize;
|
||||
const char *format;
|
||||
register const struct tm *tp;
|
||||
const struct tm *tp;
|
||||
{
|
||||
int hour12 = tp->tm_hour;
|
||||
#ifdef _NL_CURRENT
|
||||
@@ -283,15 +392,30 @@ strftime (s, maxsize, format, tp)
|
||||
size_t month_len = strlen (f_month);
|
||||
const char *zone;
|
||||
size_t zonelen;
|
||||
register size_t i = 0;
|
||||
register char *p = s;
|
||||
register const char *f;
|
||||
size_t i = 0;
|
||||
char *p = s;
|
||||
const char *f;
|
||||
|
||||
zone = 0;
|
||||
#if HAVE_TM_ZONE
|
||||
zone = NULL;
|
||||
#if !defined _LIBC && HAVE_TM_ZONE
|
||||
/* XXX We have some problems here. First, the string pointed to by
|
||||
tm_zone is dynamically allocated while loading the zone data. But
|
||||
when another zone is loaded since the information in TP were
|
||||
computed this would be a stale pointer.
|
||||
The second problem is the POSIX test suite which assumes setting
|
||||
the environment variable TZ to a new value before calling strftime()
|
||||
will influence the result (the %Z format) even if the information in
|
||||
TP is computed with a totally different time zone. --drepper@gnu */
|
||||
zone = (const char *) tp->tm_zone;
|
||||
#endif
|
||||
#if HAVE_TZNAME
|
||||
/* POSIX.1 8.1.1 requires that whenever strftime() is called, the
|
||||
time zone names contained in the external variable `tzname' shall
|
||||
be set as if the tzset() function had been called. */
|
||||
# if HAVE_TZSET
|
||||
tzset ();
|
||||
# endif
|
||||
|
||||
if (!(zone && *zone) && tp->tm_isdst >= 0)
|
||||
zone = tzname[tp->tm_isdst];
|
||||
#endif
|
||||
@@ -317,6 +441,9 @@ strftime (s, maxsize, format, tp)
|
||||
char buf[1 + (sizeof (int) < sizeof (time_t)
|
||||
? INT_STRLEN_BOUND (time_t)
|
||||
: INT_STRLEN_BOUND (int))];
|
||||
int width = -1;
|
||||
int to_lowcase = 0;
|
||||
int to_uppcase = 0;
|
||||
|
||||
#if DO_MULTIBYTE
|
||||
|
||||
@@ -391,20 +518,43 @@ strftime (s, maxsize, format, tp)
|
||||
|
||||
#endif /* ! DO_MULTIBYTE */
|
||||
|
||||
/* Check for flags that can modify a number format. */
|
||||
++f;
|
||||
switch (*f)
|
||||
/* Check for flags that can modify a format. */
|
||||
pad = 0;
|
||||
while (1)
|
||||
{
|
||||
case '_':
|
||||
case '-':
|
||||
pad = *f++;
|
||||
break;
|
||||
switch (*++f)
|
||||
{
|
||||
/* This influences the number formats. */
|
||||
case '_':
|
||||
case '-':
|
||||
case '0':
|
||||
pad = *f;
|
||||
continue;
|
||||
|
||||
default:
|
||||
pad = 0;
|
||||
/* This changes textual output. */
|
||||
case '^':
|
||||
to_uppcase = 1;
|
||||
continue;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* As a GNU extension we allow to specify the field width. */
|
||||
if (ISDIGIT (*f))
|
||||
{
|
||||
width = 0;
|
||||
do
|
||||
{
|
||||
width *= 10;
|
||||
width += *f - '0';
|
||||
++f;
|
||||
}
|
||||
while (ISDIGIT (*f));
|
||||
}
|
||||
|
||||
/* Check for modifiers. */
|
||||
switch (*f)
|
||||
{
|
||||
@@ -470,10 +620,18 @@ strftime (s, maxsize, format, tp)
|
||||
|
||||
subformat:
|
||||
{
|
||||
size_t len = strftime (p, maxsize - i, subfmt, tp);
|
||||
char *old_start = p;
|
||||
size_t len = strftime (NULL, maxsize - i, subfmt, tp);
|
||||
if (len == 0 && *subfmt)
|
||||
return 0;
|
||||
add (len, ;);
|
||||
add (len, strftime (p, maxsize - i, subfmt, tp));
|
||||
|
||||
if (to_uppcase)
|
||||
while (old_start < p)
|
||||
{
|
||||
*old_start = TOUPPER (*old_start);
|
||||
++old_start;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -529,8 +687,9 @@ strftime (s, maxsize, format, tp)
|
||||
jump to one of these two labels. */
|
||||
|
||||
do_number_spacepad:
|
||||
/* Force `_' flag. */
|
||||
pad = '_';
|
||||
/* Force `_' flag unless overwritten by `0' flag. */
|
||||
if (pad != '0')
|
||||
pad = '_';
|
||||
|
||||
do_number:
|
||||
/* Format the number according to the MODIFIER flag. */
|
||||
@@ -640,6 +799,10 @@ strftime (s, maxsize, format, tp)
|
||||
add (1, *p = '\n');
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
to_lowcase = 1;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 'p':
|
||||
cpy (ap_len, ampm);
|
||||
break;
|
||||
|
||||
@@ -91,15 +91,14 @@ __xstrtol (s, ptr, base, val, valid_suffixes)
|
||||
return LONGINT_OVERFLOW;
|
||||
if (*p == s)
|
||||
return LONGINT_INVALID;
|
||||
|
||||
/* Let valid_suffixes == NULL mean `allow any suffix'. */
|
||||
/* FIXME: update all callers except the one in tail.c changing
|
||||
last parameter NULL to `""'. */
|
||||
if (!valid_suffixes)
|
||||
{
|
||||
if (**p == '\0')
|
||||
{
|
||||
*val = tmp;
|
||||
return LONGINT_OK;
|
||||
}
|
||||
else
|
||||
return LONGINT_INVALID_SUFFIX_CHAR;
|
||||
*val = tmp;
|
||||
return LONGINT_OK;
|
||||
}
|
||||
|
||||
if (**p != '\0')
|
||||
|
||||
@@ -20,16 +20,19 @@
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
|
||||
#ifndef _STRTOL_ERROR
|
||||
enum strtol_error
|
||||
{
|
||||
LONGINT_OK, LONGINT_INVALID, LONGINT_INVALID_SUFFIX_CHAR, LONGINT_OVERFLOW
|
||||
};
|
||||
typedef enum strtol_error strtol_error;
|
||||
#endif
|
||||
|
||||
strtol_error
|
||||
__xstrtol PARAMS ((const char *s, char **ptr, int base,
|
||||
__unsigned long int *val, const char *valid_suffixes));
|
||||
|
||||
#undef _STRTOL_ERROR
|
||||
# define _STRTOL_ERROR(Exit_code, Str, Argument_type_string, Err) \
|
||||
do \
|
||||
{ \
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
# define XSTRTOUL_H_ 1
|
||||
|
||||
# define STRING_TO_UNSIGNED 1
|
||||
|
||||
/* Undefine this symbol so we can include xstrtol.h a second time.
|
||||
Otherwise, a program that wanted both xstrtol.h and xstrtoul.h
|
||||
would never get the declaration corresponding to the header file
|
||||
included after the first one. */
|
||||
# undef XSTRTOL_H_
|
||||
# include "xstrtol.h"
|
||||
|
||||
#endif /* not XSTRTOUL_H_ */
|
||||
|
||||
1
m4/.cvsignore
Normal file
1
m4/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
Makefile
|
||||
11
m4/Makefile.am
Normal file
11
m4/Makefile.am
Normal file
@@ -0,0 +1,11 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# Generate this list with
|
||||
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
|
||||
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
|
||||
EXTRA_DIST = README \
|
||||
ccstdc.m4 dmalloc.m4 error.m4 getgroups.m4 getline.m4 getloadavg.m4 \
|
||||
gettext.m4 header.m4 init.m4 install.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 lcmessage.m4 lispdir.m4 maintainer.m4 memcmp.m4 mktime.m4 \
|
||||
obstack.m4 progtest.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strftime.m4 \
|
||||
strtod.m4 termios.m4 uptime.m4 winsz.m4
|
||||
149
m4/Makefile.in
Normal file
149
m4/Makefile.in
Normal file
@@ -0,0 +1,149 @@
|
||||
# Makefile.in generated automatically by automake 1.1l from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
# Generate this list with
|
||||
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
|
||||
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
RANLIB = @RANLIB@
|
||||
GENCAT = @GENCAT@
|
||||
PERL = @PERL@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
CC = @CC@
|
||||
|
||||
EXTRA_DIST = README \
|
||||
ccstdc.m4 dmalloc.m4 error.m4 getgroups.m4 getline.m4 getloadavg.m4 \
|
||||
gettext.m4 header.m4 init.m4 install.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 lcmessage.m4 lispdir.m4 maintainer.m4 memcmp.m4 mktime.m4 \
|
||||
obstack.m4 progtest.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strftime.m4 \
|
||||
strtod.m4 termios.m4 uptime.m4 winsz.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = README Makefile.am Makefile.in README
|
||||
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \
|
||||
$(TEXINFOS) $(MANS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL)
|
||||
cd $(top_srcdir) && automake --gnu m4/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = m4
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall:
|
||||
|
||||
all: Makefile
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
rm -f Makefile $(DISTCLEANFILES)
|
||||
rm -f config.cache config.log stamp-h
|
||||
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-generic clean
|
||||
rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default tags distdir info dvi installcheck install-exec \
|
||||
install-data install uninstall all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
9
m4/README
Normal file
9
m4/README
Normal file
@@ -0,0 +1,9 @@
|
||||
These files are used by a program called aclocal (part of the GNU automake
|
||||
package). aclocal uses these files to create aclocal.m4 which is in turn
|
||||
used by autoconf to create the configure script at the the top level in
|
||||
this distribution.
|
||||
|
||||
Some of these files are copies of the ones in the automake-1.1l
|
||||
distribution. Others are specific to this package.
|
||||
Eventually, I expect that aclocal will evolve so that this directory
|
||||
can contain only the .m4 files specific to this package.
|
||||
61
m4/ccstdc.m4
Normal file
61
m4/ccstdc.m4
Normal file
@@ -0,0 +1,61 @@
|
||||
## ----------------------------------------- ##
|
||||
## ANSIfy the C compiler whenever possible. ##
|
||||
## From Franc,ois Pinard ##
|
||||
## ----------------------------------------- ##
|
||||
|
||||
# serial 1
|
||||
|
||||
# @defmac AC_PROG_CC_STDC
|
||||
# @maindex PROG_CC_STDC
|
||||
# @ovindex CC
|
||||
# If the C compiler in not in ANSI C mode by default, try to add an option
|
||||
# to output variable @code{CC} to make it so. This macro tries various
|
||||
# options that select ANSI C on some system or another. It considers the
|
||||
# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
|
||||
# handles function prototypes correctly.
|
||||
#
|
||||
# If you use this macro, you should check after calling it whether the C
|
||||
# compiler has been set to accept ANSI C; if not, the shell variable
|
||||
# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
|
||||
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
|
||||
# program @code{ansi2knr}, which comes with Ghostscript.
|
||||
# @end defmac
|
||||
|
||||
AC_DEFUN(AM_PROG_CC_STDC,
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
|
||||
AC_CACHE_VAL(am_cv_prog_cc_stdc,
|
||||
[am_cv_prog_cc_stdc=no
|
||||
ac_save_CC="$CC"
|
||||
# Don't try gcc -ansi; that turns off useful extensions and
|
||||
# breaks some systems' header files.
|
||||
# AIX -qlanglvl=ansi
|
||||
# Ultrix and OSF/1 -std1
|
||||
# HP-UX -Aa -D_HPUX_SOURCE
|
||||
# SVR4 -Xc -D__EXTENSIONS__
|
||||
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
|
||||
do
|
||||
CC="$ac_save_CC $ac_arg"
|
||||
AC_TRY_COMPILE(
|
||||
[#if !defined(__STDC__) || __STDC__ != 1
|
||||
choke me
|
||||
#endif
|
||||
/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
], [
|
||||
int test (int i, double x);
|
||||
struct s1 {int (*f) (int a);};
|
||||
struct s2 {int (*f) (double a);};],
|
||||
[am_cv_prog_cc_stdc="$ac_arg"; break])
|
||||
done
|
||||
CC="$ac_save_CC"
|
||||
])
|
||||
AC_MSG_RESULT($am_cv_prog_cc_stdc)
|
||||
case "x$am_cv_prog_cc_stdc" in
|
||||
x|xno) ;;
|
||||
*) CC="$CC $am_cv_prog_cc_stdc" ;;
|
||||
esac
|
||||
])
|
||||
21
m4/dmalloc.m4
Normal file
21
m4/dmalloc.m4
Normal file
@@ -0,0 +1,21 @@
|
||||
## ----------------------------------- ##
|
||||
## Check if --with-dmalloc was given. ##
|
||||
## From Franc,ois Pinard ##
|
||||
## ----------------------------------- ##
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_WITH_DMALLOC,
|
||||
[AC_MSG_CHECKING(if malloc debugging is wanted)
|
||||
AC_ARG_WITH(dmalloc,
|
||||
[ --with-dmalloc use dmalloc, as in
|
||||
ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
|
||||
[if test "$withval" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(WITH_DMALLOC)
|
||||
LIBS="$LIBS -ldmalloc"
|
||||
LDFLAGS="$LDFLAGS -g"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi], [AC_MSG_RESULT(no)])
|
||||
])
|
||||
13
m4/error.m4
Normal file
13
m4/error.m4
Normal file
@@ -0,0 +1,13 @@
|
||||
dnl From Jim Meyering. Use this if you use the GNU error.[ch].
|
||||
dnl FIXME: Migrate into libit
|
||||
|
||||
AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
|
||||
[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
|
||||
[AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
|
||||
am_cv_lib_error_at_line=yes,
|
||||
am_cv_lib_error_at_line=no)])
|
||||
if test $am_cv_lib_error_at_line = no; then
|
||||
LIBOBJS="$LIBOBJS error.o"
|
||||
fi
|
||||
AC_SUBST(LIBOBJS)dnl
|
||||
])
|
||||
49
m4/getgroups.m4
Normal file
49
m4/getgroups.m4
Normal file
@@ -0,0 +1,49 @@
|
||||
#serial 2
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl If you use this macro in a package, you should
|
||||
dnl add the following two lines to acconfig.h:
|
||||
dnl /* Define to rpl_getgroups if the replacement function should be used. */
|
||||
dnl #undef getgroups
|
||||
dnl
|
||||
dnl Invoking code should check $GETGROUPS_LIB something like this:
|
||||
dnl jm_FUNC_GETGROUPS
|
||||
dnl test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
|
||||
dnl
|
||||
|
||||
AC_DEFUN(jm_FUNC_GETGROUPS,
|
||||
[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_CHECK_FUNCS(getgroups)
|
||||
|
||||
# If we don't yet have getgroups, see if it's in -lbsd.
|
||||
# This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
|
||||
if test $ac_cv_func_getgroups = no; then
|
||||
jm_cv_sys_getgroups_saved_lib="$LIBS"
|
||||
AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
|
||||
LIBS="$jm_cv_sys_getgroups_saved_lib"
|
||||
fi
|
||||
|
||||
# Run the program to test the functionality of the system-supplied
|
||||
# getgroups function only if there is such a function.
|
||||
if test $ac_cv_func_getgroups = yes; then
|
||||
AC_CACHE_CHECK([for working getgroups], jm_cv_func_working_getgroups,
|
||||
[AC_TRY_RUN([
|
||||
int
|
||||
main ()
|
||||
{
|
||||
/* On Ultrix 4.3, getgroups (0, 0) always fails. */
|
||||
exit (getgroups (0, 0) == -1 ? 1 : 0);
|
||||
}
|
||||
],
|
||||
jm_cv_func_working_getgroups=yes,
|
||||
jm_cv_func_working_getgroups=no,
|
||||
dnl When crosscompiling, assume getgroups is broken.
|
||||
jm_cv_func_working_getgroups=no)
|
||||
])
|
||||
if test $jm_cv_func_working_getgroups = no; then
|
||||
LIBOBJS="$LIBOBJS getgroups.o"
|
||||
AC_DEFINE_UNQUOTED(getgroups, rpl_getgroups)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
45
m4/getline.m4
Normal file
45
m4/getline.m4
Normal file
@@ -0,0 +1,45 @@
|
||||
#serial 1
|
||||
|
||||
dnl See if there's a working, system-supplied version of the getline function.
|
||||
dnl We can't just to AC_REPLACE_FUNCS(getline) because some systems
|
||||
dnl have a function by that name in -linet that doesn't have anything
|
||||
dnl to do with the function we need.
|
||||
AC_DEFUN(AM_FUNC_GETLINE,
|
||||
[dnl
|
||||
am_getline_needs_run_time_check=no
|
||||
am_cv_func_working_getline=yes
|
||||
AC_CHECK_FUNC(getline,
|
||||
dnl Found it in some library. Verify that it works.
|
||||
am_getline_needs_run_time_check=yes,
|
||||
am_cv_func_working_getline=no)
|
||||
if test $am_getline_needs_run_time_check = yes; then
|
||||
AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
|
||||
[echo fooN |tr -d '\012'|tr N '\012' > conftestdata
|
||||
AC_TRY_RUN([
|
||||
# include <stdio.h>
|
||||
# include <sys/types.h>
|
||||
# if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
# endif
|
||||
int main ()
|
||||
{ /* Based on a test program from Karl Heuer. */
|
||||
char *line = NULL;
|
||||
size_t siz = 0;
|
||||
int len;
|
||||
FILE *in = fopen ("./conftestdata", "r");
|
||||
if (!in)
|
||||
return 1;
|
||||
len = getline (&line, &siz, in);
|
||||
exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
|
||||
}
|
||||
], am_cv_func_working_getline=yes dnl The library version works.
|
||||
, am_cv_func_working_getline=no dnl The library version does NOT work.
|
||||
, am_cv_func_working_getline=no dnl We're cross compiling.
|
||||
)])
|
||||
fi
|
||||
|
||||
if test $am_cv_func_working_getline = no; then
|
||||
LIBOBJS="$LIBOBJS getline.o"
|
||||
AC_SUBST(LIBOBJS)dnl
|
||||
fi
|
||||
])
|
||||
127
m4/getloadavg.m4
Normal file
127
m4/getloadavg.m4
Normal file
@@ -0,0 +1,127 @@
|
||||
#serial 3
|
||||
|
||||
AC_DEFUN(AM_FUNC_GETLOADAVG,
|
||||
[ac_have_func=no # yes means we've found a way to get the load average.
|
||||
|
||||
am_cv_saved_LIBS="$LIBS"
|
||||
|
||||
# On HPUX9, an unprivileged user can get load averages through this function.
|
||||
AC_CHECK_FUNCS(pstat_getdynamic)
|
||||
|
||||
# Solaris has libkstat which does not require root.
|
||||
AC_CHECK_LIB(kstat, kstat_open)
|
||||
if test $ac_cv_lib_kstat_kstat_open = yes ; then ac_have_func=yes ; fi
|
||||
|
||||
# Some systems with -lutil have (and need) -lkvm as well, some do not.
|
||||
# On Solaris, -lkvm requires nlist from -lelf, so check that first
|
||||
# to get the right answer into the cache.
|
||||
# For kstat on solaris, we need libelf to force the definition of SVR4 below.
|
||||
AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
|
||||
if test $ac_have_func = no; then
|
||||
AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
|
||||
# Check for the 4.4BSD definition of getloadavg.
|
||||
AC_CHECK_LIB(util, getloadavg,
|
||||
[LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
|
||||
fi
|
||||
|
||||
if test $ac_have_func = no; then
|
||||
# There is a commonly available library for RS/6000 AIX.
|
||||
# Since it is not a standard part of AIX, it might be installed locally.
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-L/usr/local/lib $LIBS"
|
||||
AC_CHECK_LIB(getloadavg, getloadavg,
|
||||
LIBS="-lgetloadavg $LIBS", LIBS="$ac_save_LIBS")
|
||||
fi
|
||||
|
||||
# Make sure it is really in the library, if we think we found it.
|
||||
AC_REPLACE_FUNCS(getloadavg)
|
||||
|
||||
if test $ac_cv_func_getloadavg = yes; then
|
||||
AC_DEFINE(HAVE_GETLOADAVG)
|
||||
ac_have_func=yes
|
||||
else
|
||||
AC_DEFINE(C_GETLOADAVG)
|
||||
# Figure out what our getloadavg.c needs.
|
||||
ac_have_func=no
|
||||
AC_CHECK_HEADER(sys/dg_sys_info.h,
|
||||
[ac_have_func=yes; AC_DEFINE(DGUX)
|
||||
AC_CHECK_LIB(dgc, dg_sys_info)])
|
||||
|
||||
# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
|
||||
# uses stabs), but it is still SVR4. We cannot check for <elf.h> because
|
||||
# Irix 4.0.5F has the header but not the library.
|
||||
if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then
|
||||
ac_have_func=yes; AC_DEFINE(SVR4)
|
||||
fi
|
||||
|
||||
if test $ac_have_func = no; then
|
||||
AC_CHECK_HEADER(inq_stats/cpustats.h,
|
||||
[ac_have_func=yes; AC_DEFINE(UMAX)
|
||||
AC_DEFINE(UMAX4_3)])
|
||||
fi
|
||||
|
||||
if test $ac_have_func = no; then
|
||||
AC_CHECK_HEADER(sys/cpustats.h,
|
||||
[ac_have_func=yes; AC_DEFINE(UMAX)])
|
||||
fi
|
||||
|
||||
if test $ac_have_func = no; then
|
||||
AC_CHECK_HEADERS(mach/mach.h)
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(nlist.h,
|
||||
[AC_DEFINE(NLIST_STRUCT)
|
||||
AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
|
||||
[AC_TRY_COMPILE([#include <nlist.h>],
|
||||
[struct nlist n; n.n_un.n_name = 0;],
|
||||
ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
|
||||
if test $ac_cv_struct_nlist_n_un = yes; then
|
||||
AC_DEFINE(NLIST_NAME_UNION)
|
||||
fi
|
||||
])dnl
|
||||
fi # Do not have getloadavg in system libraries.
|
||||
|
||||
# Some definitions of getloadavg require that the program be installed setgid.
|
||||
dnl FIXME Don't hardwire the path of getloadavg.c in the top-level directory.
|
||||
AC_CACHE_CHECK(whether getloadavg requires setgid,
|
||||
ac_cv_func_getloadavg_setgid,
|
||||
[AC_EGREP_CPP([Yowza Am I SETGID yet],
|
||||
[#include "$srcdir/lib/getloadavg.c"
|
||||
#ifdef LDAV_PRIVILEGED
|
||||
Yowza Am I SETGID yet
|
||||
#endif],
|
||||
ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])
|
||||
if test $ac_cv_func_getloadavg_setgid = yes; then
|
||||
NEED_SETGID=true; AC_DEFINE(GETLOADAVG_PRIVILEGED)
|
||||
else
|
||||
NEED_SETGID=false
|
||||
fi
|
||||
AC_SUBST(NEED_SETGID)dnl
|
||||
|
||||
if test $ac_cv_func_getloadavg_setgid = yes; then
|
||||
AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem,
|
||||
changequote(<<, >>)dnl
|
||||
<<
|
||||
# On Solaris, /dev/kmem is a symlink. Get info on the real file.
|
||||
ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
|
||||
# If we got an error (system does not support symlinks), try without -L.
|
||||
test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
|
||||
ac_cv_group_kmem=`echo $ac_ls_output \
|
||||
| sed -ne 's/[ ][ ]*/ /g;
|
||||
s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/;
|
||||
/ /s/.* //;p;'`
|
||||
>>
|
||||
changequote([, ])dnl
|
||||
)
|
||||
KMEM_GROUP=$ac_cv_group_kmem
|
||||
fi
|
||||
AC_SUBST(KMEM_GROUP)dnl
|
||||
|
||||
if test x = "x$am_cv_saved_LIBS"; then
|
||||
GETLOADAVG_LIBS="$LIBS"
|
||||
else
|
||||
GETLOADAVG_LIBS=`echo "$LIBS"|sed "s!$am_cv_saved_LIBS!!"`
|
||||
fi
|
||||
AC_SUBST(GETLOADAVG_LIBS)dnl
|
||||
LIBS="$am_cv_saved_LIBS"
|
||||
])
|
||||
286
m4/gettext.m4
Normal file
286
m4/gettext.m4
Normal file
@@ -0,0 +1,286 @@
|
||||
# Macro to add for using GNU gettext.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_WITH_NLS,
|
||||
[AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
[ --disable-nls do not use Native Language Support],
|
||||
USE_NLS=$enableval, USE_NLS=yes)
|
||||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS)
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
nls_cv_force_use_gnu_gettext=$withval,
|
||||
nls_cv_force_use_gnu_gettext=no)
|
||||
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
||||
|
||||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||
dnl User does not insist on using GNU NLS library. Figure out what
|
||||
dnl to use. If gettext or catgets are available (in this order) we
|
||||
dnl use this. Else we have to fall back to GNU NLS library.
|
||||
dnl catgets is only used if permitted by option --with-catgets.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
CATOBJEXT=NONE
|
||||
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CACHE_CHECK([for gettext in libintl],
|
||||
gt_cv_func_gettext_libintl,
|
||||
[AC_TRY_LINK([], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libintl=yes,
|
||||
gt_cv_func_gettext_libintl=no)])])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT)
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
if test "$MSGFMT" != "no"; then
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
|
||||
return _nl_msg_cat_cntr],
|
||||
[CATOBJEXT=.gmo
|
||||
DATADIRNAME=share],
|
||||
[CATOBJEXT=.mo
|
||||
DATADIRNAME=lib])
|
||||
INSTOBJEXT=.mo
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
AC_MSG_CHECKING([whether catgets can be used])
|
||||
AC_ARG_WITH(catgets,
|
||||
[ --with-catgets use catgets functions if available],
|
||||
nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
|
||||
AC_MSG_RESULT($nls_cv_use_catgets)
|
||||
|
||||
if test "$nls_cv_use_catgets" = "yes"; then
|
||||
dnl No gettext in C library. Try catgets next.
|
||||
AC_CHECK_LIB(i, main)
|
||||
AC_CHECK_FUNC(catgets,
|
||||
[AC_DEFINE(HAVE_CATGETS)
|
||||
INTLOBJS="\$(CATOBJS)"
|
||||
AC_PATH_PROG(GENCAT, gencat, no)dnl
|
||||
if test "$GENCAT" != "no"; then
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
|
||||
if test "$GMSGFMT" = "no"; then
|
||||
AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
|
||||
fi
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.cat
|
||||
INSTOBJEXT=.cat
|
||||
DATADIRNAME=lib
|
||||
INTLDEPS="../intl/libintl.a"
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
dnl Neither gettext nor catgets in included in the C library.
|
||||
dnl Fall back on GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Mark actions used to generate GNU NLS library.
|
||||
INTLOBJS="\$(GETTOBJS)"
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_SUBST(MSGFMT)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.gmo
|
||||
INSTOBJEXT=.mo
|
||||
DATADIRNAME=share
|
||||
INTLDEPS="../intl/libintl.a"
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi
|
||||
|
||||
dnl Test whether we really found GNU xgettext.
|
||||
if test "$XGETTEXT" != ":"; then
|
||||
dnl If it is no GNU xgettext we define it as : so that the
|
||||
dnl Makefiles still can work.
|
||||
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
|
||||
: ;
|
||||
else
|
||||
AC_MSG_RESULT(
|
||||
[found xgettext programs is not GNU xgettext; ignore it])
|
||||
XGETTEXT=":"
|
||||
fi
|
||||
fi
|
||||
|
||||
# We need to process the po/ directory.
|
||||
POSUB=po
|
||||
else
|
||||
DATADIRNAME=share
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi
|
||||
|
||||
# If this is used in GNU gettext we have to set USE_NLS to `yes'
|
||||
# because some of the sources are only built for this goal.
|
||||
if test "$PACKAGE" = gettext; then
|
||||
USE_NLS=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl These rules are solely for the distribution goal. While doing this
|
||||
dnl we only have to keep exactly one list of the available catalogs
|
||||
dnl in configure.in.
|
||||
for lang in $ALL_LINGUAS; do
|
||||
GMOFILES="$GMOFILES $lang.gmo"
|
||||
POFILES="$POFILES $lang.po"
|
||||
done
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||
AC_SUBST(CATALOGS)
|
||||
AC_SUBST(CATOBJEXT)
|
||||
AC_SUBST(DATADIRNAME)
|
||||
AC_SUBST(GMOFILES)
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
AC_SUBST(INTLDEPS)
|
||||
AC_SUBST(INTLLIBS)
|
||||
AC_SUBST(INTLOBJS)
|
||||
AC_SUBST(POFILES)
|
||||
AC_SUBST(POSUB)
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_GNU_GETTEXT,
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_C_CONST])dnl
|
||||
AC_REQUIRE([AC_C_INLINE])dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
|
||||
unistd.h values.h])
|
||||
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
|
||||
__argz_count __argz_stringify __argz_next])
|
||||
|
||||
if test "${ac_cv_func_stpcpy+set}" != "set"; then
|
||||
AC_CHECK_FUNCS(stpcpy)
|
||||
fi
|
||||
if test "${ac_cv_func_stpcpy}" = "yes"; then
|
||||
AC_DEFINE(HAVE_STPCPY)
|
||||
fi
|
||||
|
||||
AM_LC_MESSAGES
|
||||
AM_WITH_NLS
|
||||
|
||||
if test "x$CATOBJEXT" != "x"; then
|
||||
if test "x$ALL_LINGUAS" = "x"; then
|
||||
LINGUAS=
|
||||
else
|
||||
AC_MSG_CHECKING(for catalogs to be installed)
|
||||
NEW_LINGUAS=
|
||||
for lang in ${LINGUAS=$ALL_LINGUAS}; do
|
||||
case "$ALL_LINGUAS" in
|
||||
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
|
||||
esac
|
||||
done
|
||||
LINGUAS=$NEW_LINGUAS
|
||||
AC_MSG_RESULT($LINGUAS)
|
||||
fi
|
||||
|
||||
dnl Construct list of names of catalog files to be constructed.
|
||||
if test -n "$LINGUAS"; then
|
||||
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Determine which catalog format we have (if any is needed)
|
||||
dnl For now we know about two different formats:
|
||||
dnl Linux libc-5 and the normal X/Open format
|
||||
test -d intl || mkdir intl
|
||||
if test "$CATOBJEXT" = ".cat"; then
|
||||
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
|
||||
|
||||
dnl Transform the SED scripts while copying because some dumb SEDs
|
||||
dnl cannot handle comments.
|
||||
sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
|
||||
fi
|
||||
dnl po2tbl.sed is always needed.
|
||||
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
|
||||
$srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
|
||||
|
||||
dnl In the intl/Makefile.in we have a special dependency which makes
|
||||
dnl only sense for gettext. We comment this out for non-gettext
|
||||
dnl packages.
|
||||
if test "$PACKAGE" = "gettext"; then
|
||||
GT_NO="#NO#"
|
||||
GT_YES=
|
||||
else
|
||||
GT_NO=
|
||||
GT_YES="#YES#"
|
||||
fi
|
||||
AC_SUBST(GT_NO)
|
||||
AC_SUBST(GT_YES)
|
||||
|
||||
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
|
||||
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
|
||||
dnl Try to locate is.
|
||||
MKINSTALLDIRS=
|
||||
if test $ac_aux_dir; then
|
||||
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
|
||||
fi
|
||||
if test -z $MKINSTALLDIRS; then
|
||||
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
|
||||
fi
|
||||
AC_SUBST(MKINSTALLDIRS)
|
||||
|
||||
dnl Generate list of files to be processed by xgettext which will
|
||||
dnl be included in po/Makefile.
|
||||
test -d po || mkdir po
|
||||
if test "x$srcdir" != "x."; then
|
||||
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
|
||||
posrcprefix="$srcdir/"
|
||||
else
|
||||
posrcprefix="../$srcdir/"
|
||||
fi
|
||||
else
|
||||
posrcprefix="../"
|
||||
fi
|
||||
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||
])
|
||||
12
m4/header.m4
Normal file
12
m4/header.m4
Normal file
@@ -0,0 +1,12 @@
|
||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
||||
|
||||
AC_DEFUN(AM_CONFIG_HEADER,
|
||||
[AC_PREREQ([2.12])
|
||||
AC_CONFIG_HEADER([$1])
|
||||
dnl When config.status generates a header, we must update the stamp-h file.
|
||||
dnl This file resides in the same directory as the config header
|
||||
dnl that is generated. We must strip everything past the first ":",
|
||||
dnl and everything past the last "/".
|
||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
||||
test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl
|
||||
changequote([,]))])
|
||||
20
m4/init.m4
Normal file
20
m4/init.m4
Normal file
@@ -0,0 +1,20 @@
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
# some checks are only needed if your package does certain things.
|
||||
# But this isn't really a big deal.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version)
|
||||
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AM_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||
VERSION=[$2]
|
||||
AC_SUBST(VERSION)
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
|
||||
AM_SANITY_CHECK
|
||||
AC_ARG_PROGRAM
|
||||
AC_PROG_MAKE_SET])
|
||||
13
m4/install.m4
Normal file
13
m4/install.m4
Normal file
@@ -0,0 +1,13 @@
|
||||
## --------------------------------------------------------- ##
|
||||
## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
|
||||
## substitution. ##
|
||||
## From Franc,ois Pinard ##
|
||||
## --------------------------------------------------------- ##
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_PROG_INSTALL,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||
AC_SUBST(INSTALL_SCRIPT)dnl
|
||||
])
|
||||
14
m4/jm-mktime.m4
Normal file
14
m4/jm-mktime.m4
Normal file
@@ -0,0 +1,14 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl If you use this macro in a package, you should
|
||||
dnl add the following two lines to acconfig.h:
|
||||
dnl /* Define to rpl_mktime if the replacement function should be used. */
|
||||
dnl #undef mktime
|
||||
dnl
|
||||
AC_DEFUN(jm_FUNC_MKTIME,
|
||||
[AC_REQUIRE([AM_FUNC_MKTIME])dnl
|
||||
if test $am_cv_func_working_mktime = no; then
|
||||
AC_DEFINE_UNQUOTED(mktime, rpl_mktime)
|
||||
fi
|
||||
])
|
||||
19
m4/jm-winsz1.m4
Normal file
19
m4/jm-winsz1.m4
Normal file
@@ -0,0 +1,19 @@
|
||||
dnl From Jim Meyering.
|
||||
#serial 1
|
||||
AC_DEFUN(jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H,
|
||||
[AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
|
||||
AC_CACHE_CHECK([whether use of TIOCGWINSZ requires termios.h],
|
||||
jm_cv_sys_tiocgwinsz_needs_termios_h,
|
||||
[jm_cv_sys_tiocgwinsz_needs_termios_h=no
|
||||
|
||||
if test $am_cv_sys_posix_termios = yes; then
|
||||
AC_EGREP_CPP([yes],
|
||||
[#include <sys/types.h>
|
||||
# include <termios.h>
|
||||
# ifdef TIOCGWINSZ
|
||||
yes
|
||||
# endif
|
||||
], jm_cv_sys_tiocgwinsz_needs_termios_h=yes)
|
||||
fi
|
||||
])
|
||||
])
|
||||
22
m4/jm-winsz2.m4
Normal file
22
m4/jm-winsz2.m4
Normal file
@@ -0,0 +1,22 @@
|
||||
#serial 2
|
||||
|
||||
AC_DEFUN(jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
|
||||
[AC_REQUIRE([jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H])
|
||||
AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
|
||||
jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
|
||||
[jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
|
||||
|
||||
if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no; then
|
||||
AC_EGREP_CPP([yes],
|
||||
[#include <sys/types.h>
|
||||
# include <sys/ioctl.h>
|
||||
# ifdef TIOCGWINSZ
|
||||
yes
|
||||
# endif
|
||||
], jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
|
||||
fi
|
||||
])
|
||||
if test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
|
||||
AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
|
||||
fi
|
||||
])
|
||||
14
m4/lcmessage.m4
Normal file
14
m4/lcmessage.m4
Normal file
@@ -0,0 +1,14 @@
|
||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_LC_MESSAGES,
|
||||
[if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||
AC_DEFINE(HAVE_LC_MESSAGES)
|
||||
fi
|
||||
fi])
|
||||
38
m4/lispdir.m4
Normal file
38
m4/lispdir.m4
Normal file
@@ -0,0 +1,38 @@
|
||||
## ------------------------
|
||||
## Emacs LISP file handling
|
||||
## From Ulrich Drepper
|
||||
## ------------------------
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_PATH_LISPDIR,
|
||||
[# If set to t, that means we are running in a shell under Emacs.
|
||||
# If you have an Emacs named "t", then use the full path.
|
||||
test "$EMACS" = t && EMACS=
|
||||
AC_PATH_PROG(EMACS, emacs xemacs, no)
|
||||
if test $EMACS != "no"; then
|
||||
AC_MSG_CHECKING([where .elc files should go])
|
||||
dnl Set default value
|
||||
lispdir="\$(datadir)/emacs/site-lisp"
|
||||
if test "x$prefix" = "xNONE"; then
|
||||
if test -d $ac_default_prefix/share/emacs/site-lisp; then
|
||||
lispdir="\$(prefix)/share/emacs/site-lisp"
|
||||
else
|
||||
if test -d $ac_default_prefix/lib/emacs/site-lisp; then
|
||||
lispdir="\$(prefix)/lib/emacs/site-lisp"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if test -d $prefix/share/emacs/site-lisp; then
|
||||
lispdir="\$(prefix)/share/emacs/site-lisp"
|
||||
else
|
||||
if test -d $prefix/lib/emacs/site-lisp; then
|
||||
lispdir="\$(prefix)/lib/emacs/site-lisp"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT($lispdir)
|
||||
ELCFILES="\$(ELCFILES)"
|
||||
fi
|
||||
AC_SUBST(lispdir)
|
||||
AC_SUBST(ELCFILES)])
|
||||
22
m4/maintainer.m4
Normal file
22
m4/maintainer.m4
Normal file
@@ -0,0 +1,22 @@
|
||||
# Add --enable-maintainer-mode option to configure.
|
||||
# From Jim Meyering
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_MAINTAINER_MODE,
|
||||
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode is disabled by default
|
||||
AC_ARG_ENABLE(maintainer-mode,
|
||||
[ --enable-maintainer-mode enable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer],
|
||||
USE_MAINTAINER_MODE=$enableval,
|
||||
USE_MAINTAINER_MODE=no)
|
||||
AC_MSG_RESULT($USE_MAINTAINER_MODE)
|
||||
if test $USE_MAINTAINER_MODE = yes; then
|
||||
MAINT=
|
||||
else
|
||||
MAINT='#M#'
|
||||
fi
|
||||
AC_SUBST(MAINT)dnl
|
||||
]
|
||||
)
|
||||
13
m4/memcmp.m4
Normal file
13
m4/memcmp.m4
Normal file
@@ -0,0 +1,13 @@
|
||||
#serial 1
|
||||
|
||||
dnl If you use this macro in a package, you should
|
||||
dnl add the following two lines to acconfig.h:
|
||||
dnl /* Define to rpl_memcmp if the replacement function should be used. */
|
||||
dnl #undef memcmp
|
||||
dnl
|
||||
AC_DEFUN(jm_FUNC_MEMCMP,
|
||||
[AC_REQUIRE([AC_FUNC_MEMCMP])dnl
|
||||
if test $ac_cv_func_memcmp_clean = no; then
|
||||
AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp)
|
||||
fi
|
||||
])
|
||||
75
m4/mktime.m4
Normal file
75
m4/mktime.m4
Normal file
@@ -0,0 +1,75 @@
|
||||
#serial 2
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl FIXME: this should migrate into libit.
|
||||
|
||||
AC_DEFUN(AM_FUNC_MKTIME,
|
||||
[AC_REQUIRE([AC_HEADER_TIME])dnl
|
||||
AC_CHECK_HEADERS(sys/time.h)
|
||||
AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
|
||||
[AC_TRY_RUN(
|
||||
changequote(<<, >>)dnl
|
||||
<</* Test program from Paul Eggert (eggert@twinsun.com)
|
||||
and Tony Leneis (tony@plaza.ds.adp.com). */
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# if HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static time_t time_t_max;
|
||||
|
||||
/* Values we'll use to set the TZ environment variable. */
|
||||
static const char *const tz_strings[] = {
|
||||
NULL, "GMT0", "JST-9", "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
|
||||
};
|
||||
#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
|
||||
|
||||
static void
|
||||
mktime_test (now)
|
||||
time_t now;
|
||||
{
|
||||
if (mktime (localtime (&now)) != now)
|
||||
exit (1);
|
||||
now = time_t_max - now;
|
||||
if (mktime (localtime (&now)) != now)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
time_t t, delta;
|
||||
int i;
|
||||
|
||||
for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
|
||||
continue;
|
||||
time_t_max--;
|
||||
delta = time_t_max / 997; /* a suitable prime number */
|
||||
for (i = 0; i < N_STRINGS; i++)
|
||||
{
|
||||
if (tz_strings[i])
|
||||
putenv (tz_strings[i]);
|
||||
|
||||
for (t = 0; t <= time_t_max - delta; t += delta)
|
||||
mktime_test (t);
|
||||
mktime_test ((time_t) 60 * 60);
|
||||
mktime_test ((time_t) 60 * 60 * 24);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
>>,
|
||||
changequote([, ])dnl
|
||||
am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
|
||||
dnl When crosscompiling, assume mktime is missing or broken.
|
||||
am_cv_func_working_mktime=no)
|
||||
])
|
||||
if test $am_cv_func_working_mktime = no; then
|
||||
LIBOBJS="$LIBOBJS mktime.o"
|
||||
fi
|
||||
])
|
||||
15
m4/obstack.m4
Normal file
15
m4/obstack.m4
Normal file
@@ -0,0 +1,15 @@
|
||||
dnl From Jim Meyering.
|
||||
dnl FIXME: migrate into libit.
|
||||
|
||||
AC_DEFUN(AM_FUNC_OBSTACK,
|
||||
[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
|
||||
[AC_TRY_LINK([#include "obstack.h"],
|
||||
[struct obstack *mem;obstack_free(mem,(char *) 0)],
|
||||
am_cv_func_obstack=yes,
|
||||
am_cv_func_obstack=no)])
|
||||
if test $am_cv_func_obstack = yes; then
|
||||
AC_DEFINE(HAVE_OBSTACK)
|
||||
else
|
||||
LIBOBJS="$LIBOBJS obstack.o"
|
||||
fi
|
||||
])
|
||||
42
m4/progtest.m4
Normal file
42
m4/progtest.m4
Normal file
@@ -0,0 +1,42 @@
|
||||
# Search path for a program which passes the given test.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
/*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test -n "[$]$1"; then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
25
m4/protos.m4
Normal file
25
m4/protos.m4
Normal file
@@ -0,0 +1,25 @@
|
||||
## ------------------------------- ##
|
||||
## Check for function prototypes. ##
|
||||
## From Franc,ois Pinard ##
|
||||
## ------------------------------- ##
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_C_PROTOTYPES,
|
||||
[AC_REQUIRE([AM_PROG_CC_STDC])
|
||||
AC_BEFORE([$0], [AC_C_INLINE])
|
||||
AC_MSG_CHECKING([for function prototypes])
|
||||
if test "$am_cv_prog_cc_stdc" != no; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(PROTOTYPES)
|
||||
U= ANSI2KNR=
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
U=_ ANSI2KNR=./ansi2knr
|
||||
# Ensure some checks needed by ansi2knr itself.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(string.h)
|
||||
fi
|
||||
AC_SUBST(U)dnl
|
||||
AC_SUBST(ANSI2KNR)dnl
|
||||
])
|
||||
12
m4/ptrdiff.m4
Normal file
12
m4/ptrdiff.m4
Normal file
@@ -0,0 +1,12 @@
|
||||
# From Ulrich Drepper.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_TYPE_PTRDIFF_T,
|
||||
[AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
|
||||
[AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
|
||||
am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
|
||||
if test $am_cv_type_ptrdiff_t = yes; then
|
||||
AC_DEFINE(HAVE_PTRDIFF_T)
|
||||
fi
|
||||
])
|
||||
37
m4/regex.m4
Normal file
37
m4/regex.m4
Normal file
@@ -0,0 +1,37 @@
|
||||
## --------------------------------- ##
|
||||
## Check if --with-regex was given. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# serial 1
|
||||
|
||||
# The idea is to distribute rx.[hc] and regex.[hc] together, for a while.
|
||||
# The WITH_REGEX symbol (which should also be documented in acconfig.h)
|
||||
# is used to decide which of regex.h or rx.h should be included in the
|
||||
# application. If `./configure --with-regex' is given (the default), the
|
||||
# package will use gawk's regex. If `./configure --without-regex', a
|
||||
# check is made to see if rx is already installed, as with newer Linux'es.
|
||||
# If not found, the package will use the rx from the distribution.
|
||||
# If found, the package will use the system's rx which, on Linux at least,
|
||||
# will result in a smaller executable file.
|
||||
|
||||
AC_DEFUN(AM_WITH_REGEX,
|
||||
[AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted)
|
||||
AC_ARG_WITH(regex,
|
||||
[ --without-regex use GNU rx in lieu of gawk's regex for matching],
|
||||
[test "$withval" = yes && am_with_regex=1],
|
||||
[am_with_regex=1])
|
||||
if test -n "$am_with_regex"; then
|
||||
AC_MSG_RESULT(regex)
|
||||
AC_DEFINE(WITH_REGEX)
|
||||
AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
|
||||
AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1],
|
||||
am_cv_gnu_regex=yes, am_cv_gnu_regex=no))
|
||||
if test $am_cv_gnu_regex = no; then
|
||||
LIBOBJS="$LIBOBJS regex.o"
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(rx)
|
||||
AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
|
||||
fi
|
||||
AC_SUBST(LIBOBJS)dnl
|
||||
])
|
||||
19
m4/sanity.m4
Normal file
19
m4/sanity.m4
Normal file
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
AC_DEFUN(AM_SANITY_CHECK,
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
echo timestamp > conftestfile
|
||||
# Do this in a subshell so we don't clobber the current shell's
|
||||
# arguments. FIXME: maybe try `-L' hack like GETLOADAVG test?
|
||||
if (set X `ls -t $srcdir/configure conftestfile`; test "[$]2" = conftestfile)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
rm -f conftest*
|
||||
AC_MSG_RESULT(yes)])
|
||||
125
m4/strftime.m4
Normal file
125
m4/strftime.m4
Normal file
@@ -0,0 +1,125 @@
|
||||
#serial 3
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl If you use this macro in a package, you should
|
||||
dnl add the following two lines to acconfig.h:
|
||||
dnl /* Define to gnu_strftime if the replacement function should be used. */
|
||||
dnl #undef strftime
|
||||
dnl
|
||||
AC_DEFUN(jm_FUNC_GNU_STRFTIME,
|
||||
[AC_REQUIRE([AC_HEADER_TIME])dnl
|
||||
AC_REQUIRE([AC_C_CONST])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_CHECK_HEADERS(sys/time.h)
|
||||
AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime,
|
||||
[AC_TRY_RUN(
|
||||
changequote(<<, >>)dnl
|
||||
<< /* Ulrich Drepper provided parts of the test program. */
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# if HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static int
|
||||
compare (const char *fmt, const struct tm *tm, const char *expected)
|
||||
{
|
||||
char buf[99];
|
||||
strftime (buf, 99, fmt, tm);
|
||||
if (strcmp (buf, expected))
|
||||
{
|
||||
#ifdef SHOW_FAILURES
|
||||
printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n",
|
||||
fmt, expected, buf);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int n_fail = 0;
|
||||
struct tm *tm;
|
||||
time_t t = 738367; /* Fri Jan 9 13:06:07 1970 */
|
||||
tm = gmtime (&t);
|
||||
|
||||
/* This is necessary to make strftime give consistent zone strings and
|
||||
e.g., seconds since the epoch (%s). */
|
||||
putenv ("TZ=GMT0");
|
||||
|
||||
#undef CMP
|
||||
#define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
|
||||
|
||||
CMP ("%-m", "1"); /* GNU */
|
||||
CMP ("%A", "Friday");
|
||||
CMP ("%^A", "FRIDAY"); /* The ^ is a GNU extension. */
|
||||
CMP ("%B", "January");
|
||||
CMP ("%^B", "JANUARY");
|
||||
CMP ("%C", "19"); /* POSIX.2 */
|
||||
CMP ("%D", "01/09/70"); /* POSIX.2 */
|
||||
CMP ("%G", "1970"); /* GNU */
|
||||
CMP ("%H", "13");
|
||||
CMP ("%I", "01");
|
||||
CMP ("%M", "06");
|
||||
CMP ("%M", "06");
|
||||
CMP ("%R", "13:06"); /* POSIX.2 */
|
||||
CMP ("%S", "07");
|
||||
CMP ("%T", "13:06:07"); /* POSIX.2 */
|
||||
CMP ("%U", "01");
|
||||
CMP ("%V", "02");
|
||||
CMP ("%W", "01");
|
||||
CMP ("%X", "13:06:07");
|
||||
CMP ("%Y", "1970");
|
||||
CMP ("%Z", "GMT");
|
||||
CMP ("%_m", " 1"); /* GNU */
|
||||
CMP ("%a", "Fri");
|
||||
CMP ("%^a", "FRI");
|
||||
CMP ("%b", "Jan");
|
||||
CMP ("%^b", "JAN");
|
||||
CMP ("%c", "Fri Jan 9 13:06:07 1970");
|
||||
CMP ("%^c", "FRI JAN 9 13:06:07 1970");
|
||||
CMP ("%d", "09");
|
||||
CMP ("%e", " 9"); /* POSIX.2 */
|
||||
CMP ("%g", "70"); /* GNU */
|
||||
CMP ("%h", "Jan"); /* POSIX.2 */
|
||||
CMP ("%^h", "JAN");
|
||||
CMP ("%j", "009");
|
||||
CMP ("%k", "13"); /* GNU */
|
||||
CMP ("%l", " 1"); /* GNU */
|
||||
CMP ("%m", "01");
|
||||
CMP ("%n", "\n"); /* POSIX.2 */
|
||||
CMP ("%p", "PM");
|
||||
CMP ("%r", "01:06:07 PM"); /* POSIX.2 */
|
||||
CMP ("%s", "738367"); /* GNU */
|
||||
CMP ("%t", "\t"); /* POSIX.2 */
|
||||
CMP ("%u", "5"); /* POSIX.2 */
|
||||
CMP ("%w", "5");
|
||||
CMP ("%x", "01/09/70");
|
||||
CMP ("%y", "70");
|
||||
CMP ("%z", "+0000"); /* GNU */
|
||||
|
||||
exit (n_fail ? 1 : 0);
|
||||
}
|
||||
>>,
|
||||
changequote([, ])dnl
|
||||
jm_cv_func_working_gnu_strftime=yes,
|
||||
jm_cv_func_working_gnu_strftime=no,
|
||||
dnl When crosscompiling, assume strftime is missing or broken.
|
||||
jm_cv_func_working_gnu_strftime=no)
|
||||
])
|
||||
if test $jm_cv_func_working_gnu_strftime = no; then
|
||||
LIBOBJS="$LIBOBJS strftime.o"
|
||||
AC_DEFINE_UNQUOTED(strftime, gnu_strftime)
|
||||
fi
|
||||
])
|
||||
69
m4/strtod.m4
Normal file
69
m4/strtod.m4
Normal file
@@ -0,0 +1,69 @@
|
||||
## Copyright (C) 1996 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
|
||||
## the Free Software Foundation; either version 2, or (at your option)
|
||||
## any later version.
|
||||
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
## 02111-1307, USA.
|
||||
|
||||
## From Jim Meyering.
|
||||
|
||||
## serial 1
|
||||
|
||||
## @defmac AC_FUNC_STRTOD
|
||||
## @maindex FUNC_STRTOD
|
||||
## @ovindex LIBOBJS
|
||||
## If the @code{strtod} function is not available, or does not work
|
||||
## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
|
||||
## variable @code{LIBOBJS}.
|
||||
## @end defmac
|
||||
|
||||
AC_DEFUN(AM_FUNC_STRTOD,
|
||||
[AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
|
||||
[AC_TRY_RUN([
|
||||
double strtod ();
|
||||
int
|
||||
main()
|
||||
{
|
||||
{
|
||||
/* Some versions of Linux strtod mis-parse strings with leading '+'. */
|
||||
char *string = " +69";
|
||||
char *term;
|
||||
double value;
|
||||
value = strtod (string, &term);
|
||||
if (value != 69 || term != (string + 4))
|
||||
exit (1);
|
||||
}
|
||||
|
||||
{
|
||||
/* Under Solaris 2.4, strtod returns the wrong value for the
|
||||
terminating character under some conditions. */
|
||||
char *string = "NaN";
|
||||
char *term;
|
||||
strtod (string, &term);
|
||||
if (term != string && *(term - 1) == 0)
|
||||
exit (1);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)])
|
||||
test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
|
||||
AC_SUBST(LIBOBJS)dnl
|
||||
am_cv_func_strtod_needs_libm=no
|
||||
if test $am_cv_func_strtod = no; then
|
||||
AC_CHECK_FUNCS(pow)
|
||||
if test $ac_cv_func_pow = no; then
|
||||
AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes],
|
||||
[AC_MSG_WARN(can't find library containing definition of pow)])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
14
m4/termios.m4
Normal file
14
m4/termios.m4
Normal file
@@ -0,0 +1,14 @@
|
||||
dnl From Jim Meyering.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_SYS_POSIX_TERMIOS,
|
||||
[AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
|
||||
[AC_TRY_LINK([#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>],
|
||||
[/* SunOS 4.0.3 has termios.h but not the library calls. */
|
||||
tcgetattr(0, 0);],
|
||||
am_cv_sys_posix_termios=yes,
|
||||
am_cv_sys_posix_termios=no)])
|
||||
])
|
||||
15
m4/uptime.m4
Normal file
15
m4/uptime.m4
Normal file
@@ -0,0 +1,15 @@
|
||||
#serial 1
|
||||
|
||||
AC_DEFUN(jm_SYS_PROC_UPTIME,
|
||||
[ dnl Require AC_PROG_CC to see if we're cross compiling.
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_CACHE_CHECK([for /proc/uptime], jm_cv_have_proc_uptime,
|
||||
[jm_cv_have_proc_uptime=no
|
||||
test -f /proc/uptime \
|
||||
&& test $ac_cv_prog_cc_cross = no \
|
||||
&& cat < /proc/uptime >/dev/null 2>/dev/null \
|
||||
&& jm_cv_have_proc_uptime=yes])
|
||||
if test $jm_cv_have_proc_uptime = yes; then
|
||||
AC_DEFINE(HAVE_PROC_UPTIME)
|
||||
fi
|
||||
])
|
||||
35
m4/winsz.m4
Normal file
35
m4/winsz.m4
Normal file
@@ -0,0 +1,35 @@
|
||||
dnl From Jim Meyering.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
|
||||
[AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
|
||||
AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
|
||||
am_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
|
||||
[am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
|
||||
|
||||
gwinsz_in_termios_h=no
|
||||
if test $am_cv_sys_posix_termios = yes; then
|
||||
AC_EGREP_CPP([yes],
|
||||
[#include <sys/types.h>
|
||||
# include <termios.h>
|
||||
# ifdef TIOCGWINSZ
|
||||
yes
|
||||
# endif
|
||||
], gwinsz_in_termios_h=yes)
|
||||
fi
|
||||
|
||||
if test $gwinsz_in_termios_h = no; then
|
||||
AC_EGREP_CPP([yes],
|
||||
[#include <sys/types.h>
|
||||
# include <sys/ioctl.h>
|
||||
# ifdef TIOCGWINSZ
|
||||
yes
|
||||
# endif
|
||||
], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
|
||||
fi
|
||||
])
|
||||
if test $am_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
|
||||
AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
|
||||
fi
|
||||
])
|
||||
@@ -1,3 +1,188 @@
|
||||
Sat Jan 25 00:34:39 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/du.c (count_entry): Fix blatant bug (typo?) that made
|
||||
--megabytes report numbers in units of kilobytes.
|
||||
Reported by Galen Hazelwood.
|
||||
|
||||
* src/cp.h: Remove now-unnecessary prototype for is_ancestor.
|
||||
|
||||
* lib/Makefile.am (noinst_HEADERS): Add getdate.h.
|
||||
|
||||
* src/cp-aux.c (is_ancestor): Remove function.
|
||||
* src/cp.c (is_ancestor): Add function.
|
||||
|
||||
* src/cp.h: Remove spurious extern dcl of htab.
|
||||
|
||||
* m4/getgroups.m4: Move the code from configure.in into
|
||||
this macro that resorts to looking for getgroups in -lbsd.
|
||||
Set new shell variable, GETGROUPS_LIB (that callers should check),
|
||||
if it is found there.
|
||||
* configure.in: Check $GETGROUPS_LIB just after jm_FUNC_GETGROUPS.
|
||||
(AC_CHECK_FUNCS): Remove getgroups.
|
||||
Remove code that resorts to looking for getgroups in -lbsd.
|
||||
|
||||
* configure.in (jm_FUNC_GNU_STRFTIME): Use it -- because ls
|
||||
needs a version of strftime that supports the %e format and
|
||||
pretty many systems lack that: NextStep 3.3, Mips Ultrix ?.?.
|
||||
This is a little bit overkill (for now) in that if the strftime
|
||||
in your C library doesn't have all features of GNU strftime (even
|
||||
though it may support %e) ls will be linked with the version of
|
||||
strftime provided with this package. But for an upcoming release,
|
||||
GNU ls will provide an option to allow the user to specify the
|
||||
date format string -- and for that I want to make GNU strftime
|
||||
the default in any case. Think of this as an incentive to use
|
||||
the GNU C library.
|
||||
|
||||
Fri Jan 24 23:36:00 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/long-options.c (parse_long_options): Reset optind to zero
|
||||
before just returning so that getopt internals get initialized from
|
||||
the probably-new parameters when/if getopt is called later.
|
||||
From Ulrich Drepper.
|
||||
|
||||
Mon Jan 20 06:52:09 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* configure.in (fu_cv_sys_truncating_statfs): Add preprocessor
|
||||
guard to make sure that this test for Sun brokenness doesn't
|
||||
get a false positive on any other type of system. Eirik Fuller
|
||||
reported that Linux 2.1.20 <sys/vfs.h> has a f_spare member in
|
||||
the statfs struct. And that triggered a false positive.
|
||||
|
||||
Thu Jan 9 06:23:18 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* m4/gettext.m4: Remove AC_ISC_POSIX. From Karl Heuer.
|
||||
|
||||
Wed Jan 8 16:38:24 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Version 3.15.
|
||||
|
||||
* src/ls.c (print_long_format): Cast alloca return value to char*.
|
||||
|
||||
* lib/getopt.c (_getopt_internal): Use `_', rather than the
|
||||
(sometimes-)expansion `gettext'.
|
||||
|
||||
Tue Jan 7 22:49:55 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getopt.c: New (more POSIX compliant) version from GNU libc.
|
||||
[_]: Define to gettext also if ENABLE_NLS is defined.
|
||||
This is temporary.
|
||||
|
||||
Sun Jan 5 09:33:07 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/ls.c (print_long_format): Avoid making unnecessary copy of
|
||||
date/time string. Patch from Paul Eggert.
|
||||
(print_long_format): NUL-terminate line of output.
|
||||
(print_long_format): Detect and handle strftime failure
|
||||
due to pathologically long strings in locale tables.
|
||||
Patch from Paul Eggert.
|
||||
(print_long_format): Change references to BIGBUF in use of
|
||||
FPUTS macro to references to BUF.
|
||||
Use 11 (not 20) bytes for mode string buffer.
|
||||
|
||||
Sat Jan 4 21:14:36 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/ls.c (print_long_format): Clean up vestiges of legacy
|
||||
ctime-oriented code. With internationalization and strftime,
|
||||
you can't presume that %a expands to a 3-byte string.
|
||||
Reported by Ross Ridge.
|
||||
(print_long_format): Use POSIX-mandated %e (blank-padded numeric
|
||||
day of month), not %d (the same number, but *zero*-filled).
|
||||
|
||||
Fri Jan 3 21:08:29 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* acconfig.h (getgroups): Add #undef.
|
||||
From Marcus Daniels.
|
||||
|
||||
Thu Jan 2 21:16:16 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/Makefile.am (EXTRA_DIST): Add getgroups.c.
|
||||
|
||||
Wed Jan 1 17:30:26 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getgroups.c: New file.
|
||||
|
||||
* configure.in (AC_ARG_PROGRAM): Remove explicit use.
|
||||
It's implicit in AM_INIT_AUTOMAKE. From Wayne Stewart.
|
||||
(list_mounted_fs): Fix typo (by declaring NUMSYS) in test for
|
||||
getfsstat on osf1. From hitchens@epa001.enet.dec.com.
|
||||
|
||||
Sun Dec 29 21:55:13 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* configure.in (jm_FUNC_GETGROUPS): Use it.
|
||||
|
||||
Sat Dec 28 14:32:05 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/ls.c: Two problems fixed by these changes from Joakim Rosqvist.
|
||||
Quoting Joakim:
|
||||
1) The "total" number and the size of the first file as
|
||||
output from 'ls --color -s' did not get colorized according
|
||||
to the "no"-argument in LS_COLORS. Fixed by adding a function
|
||||
prep_non_filename_text which prints the C_LEFT C_NORM C_RIGHT
|
||||
strings (or C_END). It is called from main before any text is
|
||||
output, and from print_name_with_quoting after having output a
|
||||
colorized filename.
|
||||
2) If the "no"-argument of LS_COLORS is set, the terminal will be
|
||||
set to print in that color after ls exits. The man-pages suggests
|
||||
setting "no" and "fi" to the terminals default colors to avoid
|
||||
the problem, but that would mean I can't use anything but the
|
||||
default color for regular files and non-filename text. Fixed by
|
||||
outputting C_LEFT immediately followed by C_RIGHT right before
|
||||
exit, which restores the default color.
|
||||
|
||||
Fri Dec 27 17:29:02 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Makefile.am (aclocal.m4): No longer depend on acinclude.m4.
|
||||
|
||||
* configure.in: AC_REQUIRE version 2.12 of autoconf.
|
||||
|
||||
Sun Dec 22 23:29:10 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* acinclude.m4: Move macros to individual files in new directory, m4/.
|
||||
See ChangeLog entries in sh-utils for the details.
|
||||
|
||||
Wed Dec 18 23:09:19 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/dircolors.hin (ORPHAN): By default, color orphans red on
|
||||
a black background.
|
||||
|
||||
* src/dircolors.c (usage): Remove --print-data-base.
|
||||
Now only --print-database remains. Although it wasn't documented,
|
||||
--print-data-base was still accepted. But it made `--p', `--print',
|
||||
`--print-data', etc. ambiguous.
|
||||
|
||||
* src/ls.c (gobble_file): Stat symlinks also when printing with
|
||||
color and set linkok to reflect existence of referent.
|
||||
Patches from Joakim Rosqvist, James Antill, and Jesse Thilo.
|
||||
|
||||
Tue Dec 17 21:03:40 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/system.h (ISDIGIT): Replace with smaller, faster edition
|
||||
that yields nonzero only on ASCII digits.
|
||||
(ISDIGIT_LOCALE): New macro, with same meaning that ISDIGIT
|
||||
used to have. From Paul Eggert.
|
||||
* lib/backupfile.c (ISDIGIT): Likewise.
|
||||
* lib/getdate.y (ISDIGIT): Likewise.
|
||||
|
||||
* src/cp.c (ROOT_CHOWN_AFFECTS_SYMLINKS): New macro.
|
||||
(DO_CHOWN): Take an additional parameter.
|
||||
(LINK_CHOWN): Remove macro.
|
||||
(copy): When preserving owner and group of a symlink, use
|
||||
chown only if ROOT_CHOWN_AFFECTS_SYMLINKS and EUID == 0.
|
||||
Otherwise, the chown would affect the file referenced through
|
||||
the symlink.
|
||||
|
||||
Sat Dec 14 14:51:50 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* acinclude.m4 (jm_SYS_PROC_UPTIME): Fix typo in cache variable
|
||||
name for cross compiling.
|
||||
Remove definitions of gettext-related macros. The gettext
|
||||
installation procedure installs corresponding .m4 files so that
|
||||
aclocal will use them.
|
||||
|
||||
Wed Dec 11 19:34:22 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Version 3.14.
|
||||
|
||||
Tue Dec 10 00:14:24 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* configure.in: Bump version to 3.13k.
|
||||
|
||||
@@ -1,6 +1,25 @@
|
||||
Changes in release 3.16:
|
||||
[3.15a]
|
||||
* du --megabytes (-m) works
|
||||
* ls -l works even on systems with non-POSIX strftime in their C library
|
||||
|
||||
Changes in release 3.15:
|
||||
* touch --date=DATE bug (due to broken getdate.y) has been fixed
|
||||
* ls -l no longer misformats the date when run in a locale for which the
|
||||
locale's abbreviated week-day name (strftime's %a format) is shorter or
|
||||
longer than the `normal' three bytes (with LANG=de it's a two-byte string).
|
||||
* Using --program-prefix no longer applies the prefix twice
|
||||
* ls --color properly restores color attributes upon completion when the
|
||||
normal (`no') color attribute is not the default color.
|
||||
* with ls -s --color, the `total' and size of the first file are printed
|
||||
* ls --color stats symlinks and distinguishes between regular symlinks
|
||||
and orphan ones.
|
||||
* cp --preserve preserves owner and group of symlinks on Linux when run
|
||||
with EUID == 0
|
||||
* dircolors no longer accepts --print-data-base (alternate spelling of
|
||||
--print-database)
|
||||
|
||||
Changes in release 3.14:
|
||||
[3.13k]
|
||||
[3.13j]
|
||||
* ls --color highlights based on suffix rules only for regular files
|
||||
* touch --date=DATE accepts dates like those in an RCS log listing, e.g.,
|
||||
`1992/11/01 05:44:34'.
|
||||
@@ -8,7 +27,6 @@ Changes in release 3.14:
|
||||
* df accepts -F as a synonym for -t for compatibility with Solaris
|
||||
* cp -i /dev/null existing-file now prompts before overwriting the target
|
||||
* ls --color highlights orphaned symlinks text on terminals that support it
|
||||
[3.13i]
|
||||
* ls -l honors current locale with respect to abbreviated month names (and,
|
||||
with --full-time day names) on systems with a locale-supporting strftime
|
||||
function, e.g., ones based on recent versions of the GNU C library
|
||||
|
||||
@@ -1,3 +1,298 @@
|
||||
Sat Jan 25 21:01:13 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/factor.c (print_factors): Reflect changes to xstrtoul interface.
|
||||
|
||||
* tests/date/mk-script.pl: Generated script now reflects
|
||||
specification (in Test.pm) of default and per-test environment
|
||||
settings.
|
||||
|
||||
Fri Jan 24 23:36:00 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/long-options.c (parse_long_options): Reset optind to zero
|
||||
before just returning so that getopt internals get initialized from
|
||||
the probably-new parameters when/if getopt is called later.
|
||||
This solves the problem (reintroduced with 1.15) where `stty -tabs'
|
||||
would not work as advertised but instead act like `stty -a'.
|
||||
Reported by Arne Juul.
|
||||
Suggested fix from Ulrich Drepper.
|
||||
|
||||
Wed Jan 22 20:12:31 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getopt.c: Update from GNU C library.
|
||||
* lib/getopt1.c: Update from GNU C library.
|
||||
* lib/getopt.h: Update from GNU C library.
|
||||
|
||||
* tests/Makefile.am (EXTRA_DIST): Add README Makefile.am.in.
|
||||
(SUBDIRS): Set to `date'.
|
||||
|
||||
* configure.in: Check for perl.
|
||||
(AC_OUTPUT): Add tests/date/Makefile.
|
||||
* tests/date: New directory.
|
||||
|
||||
* m4/getgroups.m4: Move the code from configure.in into
|
||||
this macro that resorts to looking for getgroups in -lbsd.
|
||||
Set new shell variable, GETGROUPS_LIB (that callers should check),
|
||||
if it is found there.
|
||||
* configure.in: Check $GETGROUPS_LIB just after jm_FUNC_GETGROUPS.
|
||||
(AC_CHECK_FUNCS): Remove getgroups.
|
||||
Remove code that resorts to looking for getgroups in -lbsd.
|
||||
|
||||
* m4/mktime.m4 (AM_FUNC_MKTIME): Run tests for each of a few values
|
||||
for the TZ environment variable. Andre Novaes Cunha provided the
|
||||
hairy TZ setting that exercized the Solaris tzset bug.
|
||||
|
||||
1997-01-22 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/strftime.c (_strftime_copytm):
|
||||
New function, to work around Solaris 2.5 tzset bug.
|
||||
|
||||
* m4/mktime.m4: (AM_FUNC_MKTIME): Fix bug in mktime test -- don't
|
||||
test now, test a couple of thousand times.
|
||||
|
||||
* m4/strftime.m4 (main): Use TZ=GMT0, not TZ=GMT, since only GMT0 is
|
||||
specified by Posix.1.
|
||||
|
||||
Sat Jan 18 09:32:26 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getdate.y (get_date): Change prototype to reflect const'ness
|
||||
of parameters.
|
||||
Indent cpp-directives to reflect nesting.
|
||||
Indent with GNU indent.
|
||||
|
||||
* lib/getdate.h: New file.
|
||||
* src/date.c: Include getdate.h.
|
||||
(<time.h>, <sys/time.h>): Don't include -- now getdate.h does it.
|
||||
(get_date): Don't declare. getdate.h does it.
|
||||
|
||||
* lib/Makefile.am (noinst_HEADERS): Add getdate.h.
|
||||
|
||||
1997-01-06 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* getdate.y: Rewrite to use mktime.
|
||||
|
||||
<sys/timeb.h>: Don't include.
|
||||
(mktime): Declare.
|
||||
|
||||
(struct timeb, timezone, DOOMSDAY, SECSPERDAY, DSTMODE, yyDSTmode,
|
||||
ToSeconds, Convert, DSTcorrect, RelativeDate, RelativeMonth): Remove.
|
||||
(ToHour): New function (part of the old ToSeconds fn).
|
||||
(ToYear): New function (part of the old Convert fn).
|
||||
|
||||
(TABLE.value, yyDayOrdinal, yyDayNumber, yyTimezone, yyDay, yyHour,
|
||||
yyMinutes, yyMonth, yySeconds, yyYear, yyRelMonth, yyRelSeconds,
|
||||
Number): Now int instead of time_t.
|
||||
(HOUR): Don't cast to time_t.
|
||||
|
||||
(tDAY_UNIT, tHOUR_UNIT, tYEAR_UNIT): New %tokens.
|
||||
(UnitsTable): Use new units that are closer to the keywords.
|
||||
|
||||
(yyRelDay, yyRelHour, yyRelMinutes, yyRelYear): New variables.
|
||||
(rel, relunit, get_date): Add support for them.
|
||||
|
||||
(time): Fix timezone calculations for negative half-hour offsets
|
||||
when integer division truncates towards minus infinity.
|
||||
|
||||
(zone): Incorporiate DST calculation directly.
|
||||
|
||||
(get_date): 2nd arg is now time_t *, not struct timeb *.
|
||||
Use mktime to do most of the work, instead of computing it ourselves.
|
||||
Guard against falsely reporting errors near the time_t boundaries
|
||||
when parsing times in other time zones.
|
||||
|
||||
Thu Jan 16 20:58:40 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* m4/getloadavg.m4 (AM_FUNC_GETLOADAVG): Check for pstat_getdynamic.
|
||||
* configure.in (AC_CHECK_FUNCS): Don't check for pstat_getdynamic here.
|
||||
|
||||
Tue Jan 14 22:45:36 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* configure.in (AC_CHECK_FUNCS): Add pstat_getdynamic.
|
||||
Alphabetize functions.
|
||||
|
||||
* lib/getloadavg.c [hpux && HAVE_PSTAT_GETDYNAMIC]: Use HPUX's
|
||||
pstat_getdynamic function so we don't need any special privileges
|
||||
to determine load averages. Patch from Kaveh Ghazi, based on a
|
||||
sample implementation from Richard J. Rauenzahn.
|
||||
Indent cpp-directives to reflect nesting.
|
||||
|
||||
Wed Jan 8 16:38:24 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Version 1.15.
|
||||
|
||||
* lib/getopt.c (_getopt_internal): Use `_', rather than the
|
||||
(sometimes-)expansion `gettext'.
|
||||
|
||||
Tue Jan 7 22:10:51 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/nice.c (main): Work around failures induced by new version of
|
||||
getopt.c by not modifying optind before the first getopt_long call
|
||||
in main. With suggestions from Ulrich Drepper.
|
||||
|
||||
* lib/getopt.c: New (more POSIX compliant) version from GNU libc.
|
||||
[_]: Define to gettext also if ENABLE_NLS is defined.
|
||||
This is temporary.
|
||||
|
||||
Fri Jan 3 21:08:29 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* acconfig.h (getgroups): Add #undef.
|
||||
From Marcus Daniels.
|
||||
|
||||
Fri Dec 27 17:25:18 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/who-users.c [!WTMP_FILE]: Provide default path.
|
||||
(UTMP_FILE) [UTMPX_FILE]: Use UTMPX_FILE in favor of UTMP_FILE.
|
||||
Patch from Kaveh R. Ghazi.
|
||||
Indent cpp directives.
|
||||
|
||||
* m4/getgroups.m4: Rewrite the test so that systems lacking
|
||||
getgroups don't try to use the supplied replacement function --
|
||||
that depends on the existence of such a function.
|
||||
|
||||
* Makefile.am (aclocal.m4): No longer depend on acinclude.m4.
|
||||
|
||||
* configure.in (jm_FUNC_GETGROUPS): Use it.
|
||||
Reported by Marcus Daniels.
|
||||
AC_REQUIRE version 2.12 of autoconf.
|
||||
|
||||
Sun Dec 22 23:31:32 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* configure.in: Increment version to 1.14a.
|
||||
|
||||
* m4/Makefile.am (EXTRA_DIST): Add README.
|
||||
|
||||
Fri Dec 20 19:28:37 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/who-users.c (usage): Say that UTMP_FILE is the default FILE
|
||||
rather than hard-coding /etc/utmp. Replace hard-coded /etc/wtmp
|
||||
with WTMP_FILE. Suggestion from Eivind.
|
||||
|
||||
* src/seq.c (usage): Tweak --help text.
|
||||
|
||||
* configure.in (AC_OUTPUT): Add m4/Makefile.
|
||||
|
||||
* lib/Makefile.am (EXTRA_DIST): Add getgroups.c.
|
||||
|
||||
* Makefile.am (SUBDIRS): Add m4.
|
||||
(aclocal-files): Add rules that rely on (GNU) make's include
|
||||
directive that computes dependencies for aclocal.m4.
|
||||
(aclocal.m4): Override automake-generated rule.
|
||||
|
||||
* m4/Makefile.am: New file.
|
||||
|
||||
* lib/strftime.c: Update from GNU libc.
|
||||
|
||||
* m4/getline.m4: New file, extracted from acinclude.m4.
|
||||
* m4/getloadavg.m4: Likewise.
|
||||
* m4/jm-mktime.m4: Likewise.
|
||||
* m4/jm-winsz1.m4: Likewise.
|
||||
* m4/jm-winsz2.m4: Likewise.
|
||||
* m4/memcmp.m4: Likewise.
|
||||
* m4/strftime.m4: Likewise.
|
||||
* m4/uptime.m4: Likewise.
|
||||
|
||||
* m4/ccstdc.m4: Copied from automake-1.1l.
|
||||
* m4/dmalloc.m4: Likewise.
|
||||
* m4/error.m4: Likewise.
|
||||
* m4/gettext.m4: Likewise.
|
||||
* m4/header.m4: Likewise.
|
||||
* m4/init.m4: Likewise.
|
||||
* m4/install.m4: Likewise.
|
||||
* m4/lcmessage.m4: Likewise.
|
||||
* m4/lispdir.m4: Likewise.
|
||||
* m4/maintainer.m4: Likewise.
|
||||
* m4/mktime.m4: Likewise.
|
||||
* m4/obstack.m4: Likewise.
|
||||
* m4/progtest.m4: Likewise.
|
||||
* m4/protos.m4: Likewise.
|
||||
* m4/ptrdiff.m4: Likewise.
|
||||
* m4/regex.m4: Likewise.
|
||||
* m4/sanity.m4: Likewise.
|
||||
* m4/strtod.m4: Likewise.
|
||||
* m4/termios.m4: Likewise.
|
||||
* m4/winsz.m4: Likewise.
|
||||
|
||||
* m4/getgroups.m4: New file.
|
||||
(jm_FUNC_GETGROUPS): New macro
|
||||
* lib/getgroups.c: New file.
|
||||
|
||||
* m4: New directory.
|
||||
|
||||
Wed Dec 18 07:47:29 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* configure.in (AC_CHECK_HEADERS): Add paths.h.
|
||||
* src/su.c [HAVE_PATHS_H]: Include <paths.h>.
|
||||
[_PATH_DEFPATH]: Use this to define DEFAULT_LOGIN_PATH.
|
||||
[_PATH_DEFPATH_ROOT]: Use this to define DEFAULT_ROOT_LOGIN_PATH.
|
||||
From Rik Faith.
|
||||
|
||||
* acinclude.m4 (jm_FUNC_GNU_STRFTIME): Change m4 quote strings
|
||||
outside the quoted test program. Quote the test program with <<, >>.
|
||||
Reported by Andreas Schwab.
|
||||
(AM_FUNC_GETLOADAVG): Likewise.
|
||||
(jm_FUNC_GNU_STRFTIME): Add tests for new, upcasing ^ modifier
|
||||
|
||||
Tue Dec 17 18:54:32 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/Makefile.am (install-exec-local): Properly redirect stdout
|
||||
and stderr to /dev/null. From Eric Backus.
|
||||
|
||||
* lib/strftime.c: Update from GNU libc.
|
||||
|
||||
* acinclude.m4 (jm_SYS_PROC_UPTIME): Require AC_PROG_CC, rather than
|
||||
now-obsolete AC_C_CROSS.
|
||||
(jm_FUNC_MKTIME): When redefining, use rpl_ prefix, not gnu_ one
|
||||
since there's nothing GNU-specific about the replacement. Contrast
|
||||
with gnu_ prefix added to strftime.
|
||||
(jm_FUNC_MEMCMP): New macro.
|
||||
* configure.in: Use jm_FUNC_MEMCMP instead of AM_FUNC_MEMCMP.
|
||||
* acconfig.h: Add memcmp.
|
||||
|
||||
Sun Dec 15 18:37:08 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* configure.in (check for 3-argument setpriority function): Complete
|
||||
partial change made on Dec 12. From Arne Juul.
|
||||
|
||||
Sat Dec 14 14:51:50 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* acinclude.m4 (jm_SYS_PROC_UPTIME): Fix typo in cache variable
|
||||
name for cross compiling.
|
||||
Remove definitions of gettext-related macros. The gettext
|
||||
installation procedure installs corresponding .m4 files so that
|
||||
aclocal will use them.
|
||||
|
||||
Thu Dec 12 06:07:30 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Version 1.14.
|
||||
|
||||
* src/system.h (ISDIGIT): Replace with smaller, faster edition
|
||||
that yields nonzero only on ASCII digits.
|
||||
(ISDIGIT_LOCALE): New macro, with same meaning that ISDIGIT
|
||||
used to have. From Paul Eggert.
|
||||
|
||||
* configure.in: Bump version to 1.14.
|
||||
|
||||
* lib/getdate.y (IN_CTYPE_DOMAIN): Rename from ISASCII.
|
||||
(ISDIGIT): New definition from Paul Eggert.
|
||||
This one evaluates its argument exactly once.
|
||||
(yylex): Move increment out of ISALPHA argument. Use a
|
||||
comma-expression instead.
|
||||
|
||||
* src/false.sh (usage): Update bug-reporting address.
|
||||
* src/groups.sh (usage): Likewise.
|
||||
* src/nohup.sh (usage): Likewise.
|
||||
* src/true.sh (usage): Likewise.
|
||||
Reported by Karl Heuer.
|
||||
|
||||
* configure.in (check for 3-argument setpriority function): Add nohup
|
||||
to list of scripts, not the list of programs.
|
||||
From Karl Heuer.
|
||||
|
||||
* POTFILES.in: Add chroot.c. Reported by Michel Robitaille.
|
||||
|
||||
Wed Dec 11 19:33:36 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Version 1.13.
|
||||
|
||||
Tue Dec 10 06:36:57 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* acinclude.m4 (jm_SYS_PROC_UPTIME): New macro. Derived from the
|
||||
@@ -280,8 +575,7 @@ Mon Oct 28 17:40:54 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
* configure.in: Don't output confusing diagnostic: `checking for
|
||||
shadow password routines'. Suggestion from François Pinard.
|
||||
|
||||
Thu Oct 24 13:50:46 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund\
|
||||
.de>
|
||||
Thu Oct 24 13:50:46 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* src/tee.c (main): Ignore SIGPIPE.
|
||||
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
Changes in release 1.16
|
||||
1.15a
|
||||
* stty -tabs works properly
|
||||
|
||||
Changes in release 1.15
|
||||
* nice works with very recently-changed GNU libc getopt
|
||||
* fix several bugs in m4 macros used to create `configure' script
|
||||
* id works on systems with disfunctional getgroups function
|
||||
* uptime configure test detects /proc/uptime on Linux
|
||||
|
||||
Changes in release 1.14
|
||||
* fix bug in getdate.y that broke date's --date=DATE option on systems
|
||||
like SunOS4.
|
||||
* expr treats unadorned ? and + as literals. To make expr treat them as
|
||||
operators you have to use \? and \+.
|
||||
|
||||
Changes in release 1.13
|
||||
[1.12t]
|
||||
* two patches for ISC
|
||||
* Regenerate all Makefile.in using a patched version of automake-1.1l.
|
||||
[1.12s]
|
||||
|
||||
@@ -1,3 +1,230 @@
|
||||
Sat Jan 25 00:12:29 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/tail.c (parse_obsolescent_option): Comment.
|
||||
(parse_options): Remove unnecessary goto and label.
|
||||
|
||||
* tests/sort-test/mk-script.pl: Interpret `input arg is a hash
|
||||
reference' as meaning that the tested program will read no input.
|
||||
Most of the tests for the date program use this feature.
|
||||
Also for date, the generated script now reflects specification
|
||||
(in Test.pm) of default and per-test environment settings.
|
||||
|
||||
* src/csplit.c: Reflect changes to xstrtol and xstrtoul interfaces.
|
||||
* src/fold.c: Likewise.
|
||||
* src/head.c: Likewise.
|
||||
* src/join.c: Likewise.
|
||||
* src/nl.c: Likewise.
|
||||
* src/od.c: Likewise.
|
||||
* src/pr.c: Likewise.
|
||||
* src/uniq.c: Likewise.
|
||||
|
||||
* lib/xstrtoul.h (XSTRTOL_H): Undefine it.
|
||||
|
||||
* lib/xstrtol.h [!_STRTOL_ERROR]: Define the type `enum strtol_error'
|
||||
only if it hasn't already been defined.
|
||||
(_STRTOL_ERROR): Undefine.
|
||||
|
||||
* lib/xstrtol.c (__xstrtol): Change interpretation of
|
||||
VALID_SUFFIXES == NULL vs VALID_SUFFIXES == "". Use the former
|
||||
when any suffix is valid, the later when no suffix is allowed.
|
||||
|
||||
Fri Jan 24 23:36:00 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/long-options.c (parse_long_options): Reset optind to zero
|
||||
before just returning so that getopt internals get initialized from
|
||||
the probably-new parameters when/if getopt is called later.
|
||||
From Ulrich Drepper.
|
||||
|
||||
Thu Jan 23 19:17:03 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/tail.c (parse_obsolescent_option): Recognize and fail for
|
||||
more malformed obsolescent options. Makes for better diagnostics.
|
||||
|
||||
Wed Jan 22 21:34:50 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/Makefile.am (SUBDIRS): Add tail.
|
||||
* tests/tail: New directory.
|
||||
* configure.in (AC_OUTPUT): Add tests/tail/Makefile.
|
||||
|
||||
* src/tail.c (parse_options): New function.
|
||||
(parse_obsolescent_option): New function.
|
||||
(main): Use the new functions instead of open-coding them.
|
||||
This better fixes the bug in handling obsolescent `+Nc' options.
|
||||
General cleanup.
|
||||
|
||||
Tue Jan 21 22:49:00 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/tail.c (main): Properly handle what the POSIX spec calls
|
||||
the `obsolescent' usage (e.g., tail +2c). It didn't work.
|
||||
Reported by Karl Heuer.
|
||||
|
||||
Sun Jan 12 22:13:27 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/tr-test/Test.pm: Rename tests so that the associated files
|
||||
have names that are distinct even on filesystems on which file
|
||||
names are case insensitive.
|
||||
Reported by Fred Fish.
|
||||
* tests/cut-test/Test.pm: Likewise.
|
||||
|
||||
* tests/tr-test/Makefile.am: Regenerated to reflect renamed tests.
|
||||
* tests/cut-test/Makefile.am: Likewise.
|
||||
|
||||
Wed Jan 8 16:38:24 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Version 1.21.
|
||||
|
||||
* lib/getopt.c (_getopt_internal): Use `_', rather than the
|
||||
(sometimes-)expansion `gettext'.
|
||||
|
||||
Tue Jan 7 22:50:13 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getopt.c: New (more POSIX compliant) version from GNU libc.
|
||||
[_]: Define to gettext also if ENABLE_NLS is defined.
|
||||
This is temporary.
|
||||
|
||||
Thu Jan 2 21:17:50 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/pr.c (init_fps): Initialize lines_stored field in three places.
|
||||
This avoids uninitialized memory reads in close_file.
|
||||
|
||||
Wed Jan 1 17:32:18 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* configure.in (AC_ARG_PROGRAM): Remove explicit use.
|
||||
It's implicit in AM_INIT_AUTOMAKE. From Wayne Stewart.
|
||||
|
||||
Sun Dec 29 23:42:57 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/pr.c (init_header): Plug a small memory leak by using stack
|
||||
rather than heap for a 15-byte temporary buffer.
|
||||
|
||||
Sat Dec 28 00:03:23 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/pr.c (TAB_WIDTH): Parenthesize uses of parameters and renamed
|
||||
from tab_width.
|
||||
(POS_AFTER_TAB): Renamed from pos_after_tab. Define in terms of
|
||||
TAB_WIDTH rather than duplicating the expression.
|
||||
|
||||
Fri Dec 27 17:29:02 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/join-test/mk-script.pl: Fix a couple of thinkos and typos.
|
||||
Now it works with pr's tests, too.
|
||||
|
||||
* tests/pr-test/Makefile.am (explicit): Regenerate list of files,
|
||||
this time with duplicates removed.
|
||||
|
||||
* src/pr.c (usage): Break long string literal into two separate
|
||||
printf statements to accomodate default maximum of 2048 characters
|
||||
for Irix-4.0.5. Reported by Kaveh Ghazi.
|
||||
|
||||
* Makefile.am (aclocal.m4): No longer depend on acinclude.m4.
|
||||
|
||||
* tests/Makefile.am (SUBDIRS): Add pr-test.
|
||||
|
||||
* configure.in: AC_REQUIRE version 2.12 of autoconf.
|
||||
AC_OUTPUT: Add tests/pr-test/Makefile.
|
||||
|
||||
Sun Dec 22 08:11:27 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* acinclude.m4: Move macros to individual files in new directory, m4/.
|
||||
See ChangeLog entries in sh-utils for the details.
|
||||
|
||||
* configure.in: Increment version to 1.20a.
|
||||
|
||||
* tests/md5sum-test/Makefile.am: Use same framework as other tests.
|
||||
* tests/md5sum-test/Test.pm: New file.
|
||||
|
||||
Sat Dec 21 20:32:58 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/Makefile.am (EXTRA_DIST): Add README and Makefile.am.in.
|
||||
|
||||
* tests/Makefile.am.in: New file.
|
||||
|
||||
* tests/sort-test/Makefile.am: Clone the Makefile.am from join-test.
|
||||
Replace only the definition of $x and the auto-generated lists of
|
||||
test files.
|
||||
* tests/cut-test/Makefile.am: Likewise.
|
||||
* tests/tr-test/Makefile.am: Likewise.
|
||||
|
||||
* tests/join-test/Makefile.am: Add @MAINT@-protected rule for
|
||||
verifying that Makefile.am is consistent with Test.pm.
|
||||
|
||||
Fri Dec 20 00:08:36 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/join-test/Makefile.am (MAINTAINERCLEANFILES): Use $(in1)
|
||||
and $(in2), not $(in).
|
||||
|
||||
* tests/join-test/mk-script.pl: New option: --list.
|
||||
Generate lists of files used/generated.
|
||||
|
||||
Thu Dec 19 23:28:41 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/join-test/mk-script.pl: Rewrite to be more general -- so
|
||||
it can be used for join, cut, sort, tr, and soon, pr test suites.
|
||||
* tests/tr-test/mk-script.pl: Symlink through CVS repo to join's
|
||||
mk-script.pl.
|
||||
* tests/sort-test/mk-script.pl: Likewise.
|
||||
* tests/cut-test/mk-script.pl: Likewise.
|
||||
|
||||
* tests/tr-test/Test.pm: Adapted for new mk-script.pl.
|
||||
* tests/join-test/Test.pm: Likewise.
|
||||
|
||||
Tue Dec 17 16:48:51 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/join-test/Makefile.am (.pl): Make generated file read-only so
|
||||
I don't accidentally modify it instead of the one with the .pl suffix.
|
||||
|
||||
* acinclude.m4 (jm_SYS_PROC_UPTIME): Require AC_PROG_CC, rather than
|
||||
now-obsolete AC_C_CROSS.
|
||||
(jm_FUNC_MKTIME): When redefining, use rpl_ prefix, not gnu_ one
|
||||
since there's nothing GNU-specific about the replacement. Contrast
|
||||
with gnu_ prefix added to strftime.
|
||||
(jm_FUNC_MEMCMP): New macro.
|
||||
* configure.in: Use jm_FUNC_MEMCMP instead of AM_FUNC_MEMCMP.
|
||||
* acconfig.h: Add memcmp.
|
||||
* README: Remove warning about memcmp. The new macro handles it.
|
||||
|
||||
Mon Dec 16 23:03:27 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/Makefile.am (pkgdata_DATA): Remove unnecessary assignment.
|
||||
From Eric Backus.
|
||||
(AUTOMAKE_OPTIONS): Likewise.
|
||||
|
||||
Sat Dec 14 14:51:50 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* acinclude.m4 (jm_SYS_PROC_UPTIME): Fix typo in cache variable
|
||||
name for cross compiling.
|
||||
Remove definitions of gettext-related macros. The gettext
|
||||
installation procedure installs corresponding .m4 files so that
|
||||
aclocal will use them.
|
||||
|
||||
1996-12-12 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* system.h (ISDIGIT): Replace with smaller, faster edition
|
||||
that yields nonzero only on ASCII digits.
|
||||
(ISDIGIT_LOCALE): New macro, with same meaning that ISDIGIT
|
||||
used to have.
|
||||
|
||||
* tr.c (is_char_class_member): Use ISDIGIT_LOCALE instead of
|
||||
ISDIGIT to test for characters in CC_DIGIT class.
|
||||
|
||||
* sort.c (digits): Remove; subsumed by new ISDIGIT.
|
||||
(inittables): Remove initialization of `digits'.
|
||||
(fraccompare, numcompare, main): Use ISDIGIT (x) instead of digits[x].
|
||||
(fraccompare, numcompare): Avoid casts to unsigned char that are no
|
||||
longer needed.
|
||||
|
||||
* csplit.c (get_format_width, get_format_prec): Avoid
|
||||
unnecessary comparison of digit to '\0'.
|
||||
|
||||
Thu Dec 12 23:42:51 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/sort.c (usage): Clarify description of -u option.
|
||||
From Karl Berry.
|
||||
|
||||
Wed Dec 11 19:32:18 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Version 1.20.
|
||||
|
||||
Tue Dec 10 00:15:50 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
The file name, `build-script.pl' is longer than 14 characters.
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
Changes in release 1.22
|
||||
[1.21a]
|
||||
* Fix a bug in tail when invoked with an argument like `+NUMBERc'
|
||||
* Add test suite for tail
|
||||
|
||||
Changes in release 1.21
|
||||
* Using --program-prefix no longer applies the prefix twice
|
||||
|
||||
Changes in release 1.20
|
||||
Changes in test release 1.19r
|
||||
* see ChangeLog
|
||||
Changes in test release 1.19q
|
||||
* fix pr: -l now uses total number of lines per page also with -f
|
||||
* fix pr: use left-hand-side truncation of header string to avoid line
|
||||
overflow
|
||||
@@ -32,7 +37,7 @@ Changes in release 1.20
|
||||
* fix bug in sort -c that sometimes resulted in a segfault
|
||||
Changes in test release 1.19p
|
||||
* md5sum's --string option is being deprecated and is no longer documented.
|
||||
It is still accepted, but will be removed altogether in 1.21.
|
||||
It is still accepted, but will be removed altogether in 1.22.
|
||||
* tr '[:lower:]' '[:upper:]' no longer fails when LC_CTYPE is set to
|
||||
iso_8859_1 on Solaris -- or any other character set with differing
|
||||
numbers of uppercase and lowercase characters
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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 Richard Stallman and David MacKenzie. */
|
||||
|
||||
|
||||
803
src/copy.c
Normal file
803
src/copy.c
Normal file
@@ -0,0 +1,803 @@
|
||||
#ifdef _AIX
|
||||
#pragma alloca
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cp.h"
|
||||
#include "copy.h"
|
||||
#include "backupfile.h"
|
||||
|
||||
/* On Linux (from slackware-1.2.13 to 2.0.2?) there is no lchown function.
|
||||
To change ownership of symlinks, you must run chown with an effective
|
||||
UID of 0. */
|
||||
#ifdef __linux__
|
||||
# define ROOT_CHOWN_AFFECTS_SYMLINKS
|
||||
#endif
|
||||
|
||||
#define DO_CHOWN(Chown, File, New_uid, New_gid) \
|
||||
(Chown ((File), (x->myeuid == 0 ? (New_uid) : x->myeuid), (New_gid)) \
|
||||
/* If non-root uses -p, it's ok if we can't preserve ownership. \
|
||||
But root probably wants to know, e.g. if NFS disallows it. */ \
|
||||
&& (errno != EPERM || x->myeuid == 0))
|
||||
|
||||
/* Control creation of sparse files (files with holes). */
|
||||
enum Sparse_type
|
||||
{
|
||||
/* Never create holes in DEST. */
|
||||
SPARSE_NEVER,
|
||||
|
||||
/* This is the default. Use a crude (and sometimes inaccurate)
|
||||
heuristic to determine if SOURCE has holes. If so, try to create
|
||||
holes in DEST. */
|
||||
SPARSE_AUTO,
|
||||
|
||||
/* For every sufficiently long sequence of bytes in SOURCE, try to
|
||||
create a corresponding hole in DEST. There is a performance penalty
|
||||
here because CP has to search for holes in SRC. But if the holes are
|
||||
big enough, that penalty can be offset by the decrease in the amount
|
||||
of data written to disk. */
|
||||
SPARSE_ALWAYS
|
||||
};
|
||||
|
||||
struct flag
|
||||
{
|
||||
/* If nonzero, copy all files except (directories and, if not dereferencing
|
||||
them, symbolic links,) as if they were regular files. */
|
||||
int copy_as_regular;
|
||||
|
||||
/* If nonzero, dereference symbolic links (copy the files they point to). */
|
||||
int dereference;
|
||||
|
||||
/* If nonzero, remove existing destination nondirectories. */
|
||||
int force;
|
||||
|
||||
/* If nonzero, create hard links instead of copying files.
|
||||
Create destination directories as usual. */
|
||||
int hard_link;
|
||||
|
||||
/* If nonzero, query before overwriting existing destinations
|
||||
with regular files. */
|
||||
int interactive;
|
||||
|
||||
/* If nonzero, when copying recursively, skip any subdirectories that are
|
||||
on different filesystems from the one we started on. */
|
||||
int one_file_system;
|
||||
|
||||
/* If nonzero, give the copies the original files' permissions,
|
||||
ownership, and timestamps. */
|
||||
int preserve;
|
||||
|
||||
/* If nonzero, copy directories recursively and copy special files
|
||||
as themselves rather than copying their contents. */
|
||||
int recursive;
|
||||
|
||||
/* Control creation of sparse files. */
|
||||
enum Sparse_type sparse_mode;
|
||||
|
||||
/* If nonzero, create symbolic links instead of copying files.
|
||||
Create destination directories as usual. */
|
||||
int symbolic_link;
|
||||
|
||||
/* The bits to preserve in created files' modes. */
|
||||
int umask_kill;
|
||||
|
||||
/* If nonzero, do not copy a nondirectory that has an existing destination
|
||||
with the same or newer modification time. */
|
||||
int update;
|
||||
|
||||
/* If nonzero, display the names of the files before copying them. */
|
||||
int verbose;
|
||||
|
||||
/* This process's effective user ID. */
|
||||
uid_t myeuid;
|
||||
|
||||
/* A pointer to either lstat or stat, depending on
|
||||
whether dereferencing of symlinks is done. */
|
||||
int (*xstat) ();
|
||||
};
|
||||
|
||||
struct dir_list
|
||||
{
|
||||
struct dir_list *parent;
|
||||
ino_t ino;
|
||||
dev_t dev;
|
||||
};
|
||||
|
||||
int full_write ();
|
||||
int euidaccess ();
|
||||
|
||||
/* The invocation name of this program. */
|
||||
extern char *program_name;
|
||||
|
||||
static int
|
||||
is_ancestor (const struct stat *sb, const struct dir_list *ancestors)
|
||||
{
|
||||
while (ancestors != 0)
|
||||
{
|
||||
if (ancestors->ino == sb->st_ino && ancestors->dev == sb->st_dev)
|
||||
return 1;
|
||||
ancestors = ancestors->parent;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Read the contents of the directory SRC_PATH_IN, and recursively
|
||||
copy the contents to DST_PATH_IN. NEW_DST is nonzero if
|
||||
DST_PATH_IN is a directory that was created previously in the
|
||||
recursion. SRC_SB and ANCESTORS describe SRC_PATH_IN.
|
||||
Return 0 if successful, -1 if an error occurs. */
|
||||
|
||||
static int
|
||||
copy_dir (const char *src_path_in, const char *dst_path_in, int new_dst,
|
||||
const struct stat *src_sb, struct dir_list *ancestors,
|
||||
const struct flag *x)
|
||||
{
|
||||
char *name_space;
|
||||
char *namep;
|
||||
char *src_path;
|
||||
char *dst_path;
|
||||
int ret = 0;
|
||||
|
||||
errno = 0;
|
||||
name_space = savedir (src_path_in, src_sb->st_size);
|
||||
if (name_space == 0)
|
||||
{
|
||||
if (errno)
|
||||
{
|
||||
error (0, errno, "%s", src_path_in);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
}
|
||||
|
||||
namep = name_space;
|
||||
while (*namep != '\0')
|
||||
{
|
||||
int fn_length = strlen (namep) + 1;
|
||||
|
||||
dst_path = xmalloc (strlen (dst_path_in) + fn_length + 1);
|
||||
src_path = xmalloc (strlen (src_path_in) + fn_length + 1);
|
||||
|
||||
stpcpy (stpcpy (stpcpy (src_path, src_path_in), "/"), namep);
|
||||
stpcpy (stpcpy (stpcpy (dst_path, dst_path_in), "/"), namep);
|
||||
|
||||
ret |= copy (src_path, dst_path, new_dst, src_sb->st_dev, ancestors, x);
|
||||
|
||||
/* Free the memory for `src_path'. The memory for `dst_path'
|
||||
cannot be deallocated, since it is used to create multiple
|
||||
hard links. */
|
||||
|
||||
free (src_path);
|
||||
|
||||
namep += fn_length;
|
||||
}
|
||||
free (name_space);
|
||||
return -ret;
|
||||
}
|
||||
|
||||
/* Copy a regular file from SRC_PATH to DST_PATH.
|
||||
If the source file contains holes, copies holes and blocks of zeros
|
||||
in the source file as holes in the destination file.
|
||||
(Holes are read as zeroes by the `read' system call.)
|
||||
Return 0 if successful, -1 if an error occurred.
|
||||
FIXME: describe sparse_mode. */
|
||||
|
||||
static int
|
||||
copy_reg (const char *src_path, const char *dst_path,
|
||||
enum Sparse_type sparse_mode)
|
||||
{
|
||||
char *buf;
|
||||
int buf_size;
|
||||
int dest_desc;
|
||||
int source_desc;
|
||||
int n_read;
|
||||
struct stat sb;
|
||||
char *cp;
|
||||
int *ip;
|
||||
int return_val = 0;
|
||||
long n_read_total = 0;
|
||||
int last_write_made_hole = 0;
|
||||
int make_holes = (sparse_mode == SPARSE_ALWAYS);
|
||||
|
||||
source_desc = open (src_path, O_RDONLY);
|
||||
if (source_desc < 0)
|
||||
{
|
||||
error (0, errno, "%s", src_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Create the new regular file with small permissions initially,
|
||||
to not create a security hole. */
|
||||
|
||||
dest_desc = open (dst_path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||
if (dest_desc < 0)
|
||||
{
|
||||
error (0, errno, _("cannot create regular file `%s'"), dst_path);
|
||||
return_val = -1;
|
||||
goto ret2;
|
||||
}
|
||||
|
||||
/* Find out the optimal buffer size. */
|
||||
|
||||
if (fstat (dest_desc, &sb))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return_val = -1;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
buf_size = ST_BLKSIZE (sb);
|
||||
|
||||
#ifdef HAVE_ST_BLOCKS
|
||||
if (sparse_mode == SPARSE_AUTO && S_ISREG (sb.st_mode))
|
||||
{
|
||||
/* Use a heuristic to determine whether SRC_PATH contains any
|
||||
sparse blocks. */
|
||||
|
||||
if (fstat (source_desc, &sb))
|
||||
{
|
||||
error (0, errno, "%s", src_path);
|
||||
return_val = -1;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
/* If the file has fewer blocks than would normally
|
||||
be needed for a file of its size, then
|
||||
at least one of the blocks in the file is a hole. */
|
||||
if (S_ISREG (sb.st_mode)
|
||||
&& (size_t) (sb.st_size / 512) > (size_t) ST_NBLOCKS (sb))
|
||||
make_holes = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make a buffer with space for a sentinel at the end. */
|
||||
|
||||
buf = (char *) alloca (buf_size + sizeof (int));
|
||||
|
||||
for (;;)
|
||||
{
|
||||
n_read = read (source_desc, buf, buf_size);
|
||||
if (n_read < 0)
|
||||
{
|
||||
#ifdef EINTR
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
#endif
|
||||
error (0, errno, "%s", src_path);
|
||||
return_val = -1;
|
||||
goto ret;
|
||||
}
|
||||
if (n_read == 0)
|
||||
break;
|
||||
|
||||
n_read_total += n_read;
|
||||
|
||||
ip = 0;
|
||||
if (make_holes)
|
||||
{
|
||||
buf[n_read] = 1; /* Sentinel to stop loop. */
|
||||
|
||||
/* Find first nonzero *word*, or the word with the sentinel. */
|
||||
|
||||
ip = (int *) buf;
|
||||
while (*ip++ == 0)
|
||||
;
|
||||
|
||||
/* Find the first nonzero *byte*, or the sentinel. */
|
||||
|
||||
cp = (char *) (ip - 1);
|
||||
while (*cp++ == 0)
|
||||
;
|
||||
|
||||
/* If we found the sentinel, the whole input block was zero,
|
||||
and we can make a hole. */
|
||||
|
||||
if (cp > buf + n_read)
|
||||
{
|
||||
/* Make a hole. */
|
||||
if (lseek (dest_desc, (off_t) n_read, SEEK_CUR) < 0L)
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return_val = -1;
|
||||
goto ret;
|
||||
}
|
||||
last_write_made_hole = 1;
|
||||
}
|
||||
else
|
||||
/* Clear to indicate that a normal write is needed. */
|
||||
ip = 0;
|
||||
}
|
||||
if (ip == 0)
|
||||
{
|
||||
if (full_write (dest_desc, buf, n_read) < 0)
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return_val = -1;
|
||||
goto ret;
|
||||
}
|
||||
last_write_made_hole = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the file ends with a `hole', something needs to be written at
|
||||
the end. Otherwise the kernel would truncate the file at the end
|
||||
of the last write operation. */
|
||||
|
||||
if (last_write_made_hole)
|
||||
{
|
||||
#ifdef HAVE_FTRUNCATE
|
||||
/* Write a null character and truncate it again. */
|
||||
if (full_write (dest_desc, "", 1) < 0
|
||||
|| ftruncate (dest_desc, n_read_total) < 0)
|
||||
#else
|
||||
/* Seek backwards one character and write a null. */
|
||||
if (lseek (dest_desc, (off_t) -1, SEEK_CUR) < 0L
|
||||
|| full_write (dest_desc, "", 1) < 0)
|
||||
#endif
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return_val = -1;
|
||||
}
|
||||
}
|
||||
|
||||
ret:
|
||||
if (close (dest_desc) < 0)
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return_val = -1;
|
||||
}
|
||||
ret2:
|
||||
if (close (source_desc) < 0)
|
||||
{
|
||||
error (0, errno, "%s", src_path);
|
||||
return_val = -1;
|
||||
}
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
/* Copy the file SRC_PATH to the file DST_PATH. The files may be of
|
||||
any type. NEW_DST should be nonzero if the file DST_PATH cannot
|
||||
exist because its parent directory was just created; NEW_DST should
|
||||
be zero if DST_PATH might already exist. DEVICE is the device
|
||||
number of the parent directory, or 0 if the parent of this file is
|
||||
not known. ANCESTORS points to a linked, null terminated list of
|
||||
devices and inodes of parent directories of SRC_PATH.
|
||||
Return 0 if successful, 1 if an error occurs. */
|
||||
|
||||
static int
|
||||
copy_internal (const char *src_path, const char *dst_path,
|
||||
int new_dst, dev_t device, struct dir_list *ancestors,
|
||||
const struct flag *x)
|
||||
{
|
||||
struct stat src_sb;
|
||||
struct stat dst_sb;
|
||||
int src_mode;
|
||||
int src_type;
|
||||
char *earlier_file;
|
||||
char *dst_backup = NULL;
|
||||
int fix_mode = 0;
|
||||
|
||||
if ((*(x->xstat)) (src_path, &src_sb))
|
||||
{
|
||||
error (0, errno, "%s", src_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Are we crossing a file system boundary? */
|
||||
if (x->one_file_system && device != 0 && device != src_sb.st_dev)
|
||||
return 0;
|
||||
|
||||
/* We wouldn't insert a node unless nlink > 1, except that we need to
|
||||
find created files so as to not copy infinitely if a directory is
|
||||
copied into itself. */
|
||||
|
||||
earlier_file = remember_copied (dst_path, src_sb.st_ino, src_sb.st_dev);
|
||||
|
||||
/* Did we just create this file? */
|
||||
|
||||
if (earlier_file == &new_file)
|
||||
return 0;
|
||||
|
||||
src_mode = src_sb.st_mode;
|
||||
src_type = src_sb.st_mode;
|
||||
|
||||
if (S_ISDIR (src_type) && !x->recursive)
|
||||
{
|
||||
error (0, 0, _("%s: omitting directory"), src_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!new_dst)
|
||||
{
|
||||
if ((*(x->xstat)) (dst_path, &dst_sb))
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
new_dst = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The file exists already. */
|
||||
|
||||
if (src_sb.st_ino == dst_sb.st_ino && src_sb.st_dev == dst_sb.st_dev)
|
||||
{
|
||||
if (x->hard_link)
|
||||
return 0;
|
||||
|
||||
error (0, 0, _("`%s' and `%s' are the same file"),
|
||||
src_path, dst_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!S_ISDIR (src_type))
|
||||
{
|
||||
if (S_ISDIR (dst_sb.st_mode))
|
||||
{
|
||||
error (0, 0,
|
||||
_("%s: cannot overwrite directory with non-directory"),
|
||||
dst_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (x->update && src_sb.st_mtime <= dst_sb.st_mtime)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!S_ISDIR (src_type) && !x->force && x->interactive)
|
||||
{
|
||||
if (euidaccess (dst_path, W_OK) != 0)
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("%s: overwrite `%s', overriding mode %04o? "),
|
||||
program_name, dst_path,
|
||||
(unsigned int) (dst_sb.st_mode & 07777));
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, _("%s: overwrite `%s'? "),
|
||||
program_name, dst_path);
|
||||
}
|
||||
if (!yesno ())
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (backup_type != none && !S_ISDIR (dst_sb.st_mode))
|
||||
{
|
||||
char *tmp_backup = find_backup_file_name (dst_path);
|
||||
if (tmp_backup == NULL)
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
|
||||
/* Detect (and fail) when creating the backup file would
|
||||
destroy the source file. Before, running the commands
|
||||
cd /tmp; rm -f a a~; : > a; echo A > a~; cp -b -V simple a~ a
|
||||
would leave two zero-length files: a and a~. */
|
||||
if (STREQ (tmp_backup, src_path))
|
||||
{
|
||||
error (0, 0,
|
||||
_("backing up `%s' would destroy source; `%s' not copied"),
|
||||
dst_path, src_path);
|
||||
return 1;
|
||||
|
||||
}
|
||||
dst_backup = (char *) alloca (strlen (tmp_backup) + 1);
|
||||
strcpy (dst_backup, tmp_backup);
|
||||
free (tmp_backup);
|
||||
if (rename (dst_path, dst_backup))
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
error (0, errno, _("cannot backup `%s'"), dst_path);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
dst_backup = NULL;
|
||||
}
|
||||
new_dst = 1;
|
||||
}
|
||||
else if (x->force)
|
||||
{
|
||||
if (S_ISDIR (dst_sb.st_mode))
|
||||
{
|
||||
/* Temporarily change mode to allow overwriting. */
|
||||
if (euidaccess (dst_path, W_OK | X_OK) != 0)
|
||||
{
|
||||
if (chmod (dst_path, 0700))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
fix_mode = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (unlink (dst_path) && errno != ENOENT)
|
||||
{
|
||||
error (0, errno, _("cannot remove old link to `%s'"),
|
||||
dst_path);
|
||||
return 1;
|
||||
}
|
||||
new_dst = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the source is a directory, we don't always create the destination
|
||||
directory. So --verbose should not announce anything until we're
|
||||
sure we'll create a directory. */
|
||||
if (x->verbose && !S_ISDIR (src_type))
|
||||
printf ("%s -> %s\n", src_path, dst_path);
|
||||
|
||||
/* Did we copy this inode somewhere else (in this command line argument)
|
||||
and therefore this is a second hard link to the inode? */
|
||||
|
||||
if (!x->dereference && src_sb.st_nlink > 1 && earlier_file)
|
||||
{
|
||||
if (link (earlier_file, dst_path))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (S_ISDIR (src_type))
|
||||
{
|
||||
struct dir_list *dir;
|
||||
|
||||
/* If this directory has been copied before during the
|
||||
recursion, there is a symbolic link to an ancestor
|
||||
directory of the symbolic link. It is impossible to
|
||||
continue to copy this, unless we've got an infinite disk. */
|
||||
|
||||
if (is_ancestor (&src_sb, ancestors))
|
||||
{
|
||||
error (0, 0, _("%s: cannot copy cyclic symbolic link"), src_path);
|
||||
goto un_backup;
|
||||
}
|
||||
|
||||
/* Insert the current directory in the list of parents. */
|
||||
|
||||
dir = (struct dir_list *) alloca (sizeof (struct dir_list));
|
||||
dir->parent = ancestors;
|
||||
dir->ino = src_sb.st_ino;
|
||||
dir->dev = src_sb.st_dev;
|
||||
|
||||
if (new_dst || !S_ISDIR (dst_sb.st_mode))
|
||||
{
|
||||
/* Create the new directory writable and searchable, so
|
||||
we can create new entries in it. */
|
||||
|
||||
if (mkdir (dst_path, (src_mode & x->umask_kill) | 0700))
|
||||
{
|
||||
error (0, errno, _("cannot create directory `%s'"), dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
|
||||
/* Insert the created directory's inode and device
|
||||
numbers into the search structure, so that we can
|
||||
avoid copying it again. */
|
||||
|
||||
if (remember_created (dst_path))
|
||||
goto un_backup;
|
||||
|
||||
if (x->verbose)
|
||||
printf ("%s -> %s\n", src_path, dst_path);
|
||||
}
|
||||
|
||||
/* Copy the contents of the directory. */
|
||||
|
||||
if (copy_dir (src_path, dst_path, new_dst, &src_sb, dir, x))
|
||||
return 1;
|
||||
}
|
||||
#ifdef S_ISLNK
|
||||
else if (x->symbolic_link)
|
||||
{
|
||||
if (*src_path == '/'
|
||||
|| (!strncmp (dst_path, "./", 2) && strchr (dst_path + 2, '/') == 0)
|
||||
|| strchr (dst_path, '/') == 0)
|
||||
{
|
||||
if (symlink (src_path, dst_path))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
error (0, 0,
|
||||
_("%s: can make relative symbolic links only in current directory"),
|
||||
dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (x->hard_link)
|
||||
{
|
||||
if (link (src_path, dst_path))
|
||||
{
|
||||
error (0, errno, _("cannot create link `%s'"), dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (S_ISREG (src_type)
|
||||
|| (x->copy_as_regular && !S_ISDIR (src_type)
|
||||
#ifdef S_ISLNK
|
||||
&& !S_ISLNK (src_type)
|
||||
#endif
|
||||
))
|
||||
{
|
||||
if (copy_reg (src_path, dst_path, x->sparse_mode))
|
||||
goto un_backup;
|
||||
}
|
||||
else
|
||||
#ifdef S_ISFIFO
|
||||
if (S_ISFIFO (src_type))
|
||||
{
|
||||
if (mkfifo (dst_path, src_mode & x->umask_kill))
|
||||
{
|
||||
error (0, errno, _("cannot create fifo `%s'"), dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (S_ISBLK (src_type) || S_ISCHR (src_type)
|
||||
#ifdef S_ISSOCK
|
||||
|| S_ISSOCK (src_type)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (mknod (dst_path, src_mode & x->umask_kill, src_sb.st_rdev))
|
||||
{
|
||||
error (0, errno, _("cannot create special file `%s'"), dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
}
|
||||
else
|
||||
#ifdef S_ISLNK
|
||||
if (S_ISLNK (src_type))
|
||||
{
|
||||
char *link_val;
|
||||
int link_size;
|
||||
|
||||
link_val = (char *) alloca (PATH_MAX + 2);
|
||||
link_size = readlink (src_path, link_val, PATH_MAX + 1);
|
||||
if (link_size < 0)
|
||||
{
|
||||
error (0, errno, _("cannot read symbolic link `%s'"), src_path);
|
||||
goto un_backup;
|
||||
}
|
||||
link_val[link_size] = '\0';
|
||||
|
||||
if (symlink (link_val, dst_path))
|
||||
{
|
||||
error (0, errno, _("cannot create symbolic link `%s'"), dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
|
||||
if (x->preserve)
|
||||
{
|
||||
/* Preserve the owner and group of the just-`copied'
|
||||
symbolic link, if possible. */
|
||||
#ifdef HAVE_LCHOWN
|
||||
if (DO_CHOWN (lchown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
#else
|
||||
# ifdef ROOT_CHOWN_AFFECTS_SYMLINKS
|
||||
if (x->myeuid == 0)
|
||||
{
|
||||
if (DO_CHOWN (chown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: maybe give a diagnostic: you must be root
|
||||
to preserve ownership and group of symlinks. */
|
||||
}
|
||||
# else
|
||||
/* Can't preserve ownership of symlinks.
|
||||
FIXME: maybe give a warning or even error for symlinks
|
||||
in directories with the sticky bit set -- there, not
|
||||
preserving owner/group is a potential security problem. */
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
error (0, 0, _("%s: unknown file type"), src_path);
|
||||
goto un_backup;
|
||||
}
|
||||
|
||||
/* Adjust the times (and if possible, ownership) for the copy.
|
||||
chown turns off set[ug]id bits for non-root,
|
||||
so do the chmod last. */
|
||||
|
||||
if (x->preserve)
|
||||
{
|
||||
struct utimbuf utb;
|
||||
|
||||
utb.actime = src_sb.st_atime;
|
||||
utb.modtime = src_sb.st_mtime;
|
||||
|
||||
if (utime (dst_path, &utb))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (DO_CHOWN (chown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((x->preserve || new_dst)
|
||||
&& (x->copy_as_regular || S_ISREG (src_type) || S_ISDIR (src_type)))
|
||||
{
|
||||
if (chmod (dst_path, src_mode & x->umask_kill))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (fix_mode)
|
||||
{
|
||||
/* Reset the temporarily changed mode. */
|
||||
if (chmod (dst_path, dst_sb.st_mode))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
un_backup:
|
||||
if (dst_backup)
|
||||
{
|
||||
if (rename (dst_backup, dst_path))
|
||||
error (0, errno, _("cannot un-backup `%s'"), dst_path);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Copy the file SRC_PATH to the file DST_PATH. The files may be of
|
||||
any type. NONEXISTENT_DST should be nonzero if the file DST_PATH is
|
||||
not to exist (e.g., because its parent directory was just created);
|
||||
NONEXISTENT_DST should be zero if DST_PATH might already exist.
|
||||
DEVICE is the device number of the parent directory, or 0 if the
|
||||
parent of this file is not known. ANCESTORS points to a linked, null
|
||||
terminated list of devices and inodes of parent directories of SRC_PATH.
|
||||
Return 0 if successful, 1 if an error occurs. */
|
||||
|
||||
int
|
||||
copy (const char *src_path, const char *dst_path, int nonexistent_dst,
|
||||
const struct flag *x)
|
||||
{
|
||||
copy_internal (src_path, dst_path, ... , x);
|
||||
}
|
||||
79
src/cp.c
79
src/cp.c
@@ -37,14 +37,15 @@
|
||||
uid_t geteuid ();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LCHOWN
|
||||
# define LINK_CHOWN(FILE, OWNER, GROUP) lchown(FILE, OWNER, GROUP)
|
||||
#else
|
||||
# define LINK_CHOWN(FILE, OWNER, GROUP) chown(FILE, OWNER, GROUP)
|
||||
/* On Linux (from slackware-1.2.13 to 2.0.2?) there is no lchown function.
|
||||
To change ownership of symlinks, you must run chown with an effective
|
||||
UID of 0. */
|
||||
#ifdef __linux__
|
||||
# define ROOT_CHOWN_AFFECTS_SYMLINKS
|
||||
#endif
|
||||
|
||||
#define DO_CHOWN(FILE, NEW_UID, NEW_GID) \
|
||||
(LINK_CHOWN ((FILE), (myeuid == 0 ? (NEW_UID) : myeuid), (NEW_GID)) \
|
||||
#define DO_CHOWN(Chown, File, New_uid, New_gid) \
|
||||
(Chown ((File), (myeuid == 0 ? (New_uid) : myeuid), (New_gid)) \
|
||||
/* If non-root uses -p, it's ok if we can't preserve ownership. \
|
||||
But root probably wants to know, e.g. if NFS disallows it. */ \
|
||||
&& (errno != EPERM || myeuid == 0))
|
||||
@@ -210,6 +211,18 @@ static struct option const long_opts[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
static int
|
||||
is_ancestor (const struct stat *sb, const struct dir_list *ancestors)
|
||||
{
|
||||
while (ancestors != 0)
|
||||
{
|
||||
if (ancestors->ino == sb->st_ino && ancestors->dev == sb->st_dev)
|
||||
return 1;
|
||||
ancestors = ancestors->parent;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@@ -569,7 +582,7 @@ is not a directory"),
|
||||
usage (1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Copy the file SRC_PATH to the file DST_PATH. The files may be of
|
||||
any type. NEW_DST should be nonzero if the file DST_PATH cannot
|
||||
exist because its parent directory was just created; NEW_DST should
|
||||
@@ -823,17 +836,6 @@ copy (const char *src_path, const char *dst_path, int new_dst, dev_t device,
|
||||
goto un_backup;
|
||||
}
|
||||
|
||||
/* Change the owner and group of the just-created symbolic link
|
||||
if this system has the lchown function. */
|
||||
#ifdef HAVE_LCHOWN
|
||||
if (flag_preserve
|
||||
&& DO_CHOWN (dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@@ -910,16 +912,39 @@ copy (const char *src_path, const char *dst_path, int new_dst, dev_t device,
|
||||
goto un_backup;
|
||||
}
|
||||
|
||||
/* Change the owner and group of the just-created symbolic link
|
||||
if this system has the lchown function. */
|
||||
#ifdef HAVE_LCHOWN
|
||||
if (flag_preserve
|
||||
&& DO_CHOWN (dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
if (flag_preserve)
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
/* Preserve the owner and group of the just-`copied'
|
||||
symbolic link, if possible. */
|
||||
#ifdef HAVE_LCHOWN
|
||||
if (DO_CHOWN (lchown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
#else
|
||||
# ifdef ROOT_CHOWN_AFFECTS_SYMLINKS
|
||||
if (myeuid == 0)
|
||||
{
|
||||
if (DO_CHOWN (chown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: maybe give a diagnostic: you must be root
|
||||
to preserve ownership and group of symlinks. */
|
||||
}
|
||||
# else
|
||||
/* Can't preserve ownership of symlinks.
|
||||
FIXME: maybe give a warning or even error for symlinks
|
||||
in directories with the sticky bit set -- there, not
|
||||
preserving owner/group is a potential security problem. */
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -947,7 +972,7 @@ copy (const char *src_path, const char *dst_path, int new_dst, dev_t device,
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (DO_CHOWN (dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
if (DO_CHOWN (chown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
return 1;
|
||||
|
||||
22
src/csplit.c
22
src/csplit.c
@@ -12,8 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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 Stuart Kemp, cpsrk@groper.jcu.edu.au.
|
||||
Modified by David MacKenzie, djm@gnu.ai.mit.edu. */
|
||||
@@ -1129,7 +1129,7 @@ check_for_offset (struct control *p, const char *str, const char *num)
|
||||
if (*num != '-' && *num != '+')
|
||||
error (EXIT_FAILURE, 0, _("%s: `+' or `-' expected after delimeter"), str);
|
||||
|
||||
if (xstrtoul (num + 1, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
if (xstrtoul (num + 1, NULL, 10, &val, "") != LONGINT_OK
|
||||
|| val > UINT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("%s: integer expected after `%c'"), str, *num);
|
||||
p->offset = (unsigned int) val;
|
||||
@@ -1158,7 +1158,7 @@ parse_repeat_count (int argnum, struct control *p, char *str)
|
||||
p->repeat_forever = 1;
|
||||
else
|
||||
{
|
||||
if (xstrtoul (str + 1, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
if (xstrtoul (str + 1, NULL, 10, &val, "") != LONGINT_OK
|
||||
|| val > UINT_MAX)
|
||||
{
|
||||
error (EXIT_FAILURE, 0,
|
||||
@@ -1240,7 +1240,7 @@ parse_patterns (int argc, int start, char **argv)
|
||||
p = new_control_record ();
|
||||
p->argnum = i;
|
||||
|
||||
if (xstrtoul (argv[i], NULL, 10, &val, NULL) != LONGINT_OK
|
||||
if (xstrtoul (argv[i], NULL, 10, &val, "") != LONGINT_OK
|
||||
|| val > INT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("%s: invalid pattern"), argv[i]);
|
||||
if (val == 0)
|
||||
@@ -1306,9 +1306,8 @@ get_format_width (char **format_ptr)
|
||||
int ch_save;
|
||||
|
||||
start = *format_ptr;
|
||||
for (; **format_ptr; (*format_ptr)++)
|
||||
if (!ISDIGIT (**format_ptr))
|
||||
break;
|
||||
for (; ISDIGIT (**format_ptr); (*format_ptr)++)
|
||||
continue;
|
||||
|
||||
ch_save = **format_ptr;
|
||||
**format_ptr = '\0';
|
||||
@@ -1344,9 +1343,8 @@ get_format_prec (char **format_ptr)
|
||||
}
|
||||
|
||||
start = *format_ptr;
|
||||
for (; **format_ptr; (*format_ptr)++)
|
||||
if (!ISDIGIT (**format_ptr))
|
||||
break;
|
||||
for (; ISDIGIT (**format_ptr); (*format_ptr)++)
|
||||
continue;
|
||||
|
||||
/* ANSI 4.9.6.1 says that if the precision is negative, it's as good as
|
||||
not there. */
|
||||
@@ -1498,7 +1496,7 @@ main (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
if (xstrtoul (optarg, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
if (xstrtoul (optarg, NULL, 10, &val, "") != LONGINT_OK
|
||||
|| val > INT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("%s: invalid number"), optarg);
|
||||
digits = (int) val;
|
||||
|
||||
11
src/date.c
11
src/date.c
@@ -1,5 +1,6 @@
|
||||
/* date - print or set the system date and time
|
||||
Copyright (C) 89, 90, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 92, 93, 94, 95, 96, 1997
|
||||
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
|
||||
@@ -25,12 +26,7 @@
|
||||
#include "system.h"
|
||||
#include "getline.h"
|
||||
#include "error.h"
|
||||
|
||||
#ifdef TM_IN_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include "getdate.h"
|
||||
|
||||
#ifndef STDC_HEADERS
|
||||
size_t strftime ();
|
||||
@@ -41,7 +37,6 @@ int putenv ();
|
||||
int stime ();
|
||||
|
||||
char *xrealloc ();
|
||||
time_t get_date ();
|
||||
time_t posixtime ();
|
||||
|
||||
static void show_date __P ((const char *format, time_t when));
|
||||
|
||||
@@ -88,8 +88,6 @@ static struct option const long_options[] =
|
||||
{"csh", no_argument, NULL, 'c'},
|
||||
{"c-shell", no_argument, NULL, 'c'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
/* I deprecate --print-data-base. `database' is one word. */
|
||||
{"print-data-base", no_argument, NULL, 'p'},
|
||||
{"print-database", no_argument, NULL, 'p'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{NULL, 0, NULL, 0}
|
||||
|
||||
@@ -36,6 +36,7 @@ FIFO 40;33 # pipe
|
||||
SOCK 01;35 # socket
|
||||
BLK 40;33;01 # block device driver
|
||||
CHR 40;33;01 # character device driver
|
||||
ORPHAN 40;31;01 # symlink to nonexistent file
|
||||
|
||||
# This is for files with execute permission:
|
||||
EXEC 01;32
|
||||
|
||||
2
src/du.c
2
src/du.c
@@ -638,7 +638,7 @@ count_entry (char *ent, int top, dev_t last_dev)
|
||||
else
|
||||
{
|
||||
printf ("%ld\t%s\n", output_size == size_bytes ? size
|
||||
: convert_blocks (size, output_size == size_kilobytes),
|
||||
: convert_blocks (size, output_size),
|
||||
path->text);
|
||||
}
|
||||
fflush (stdout);
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* By default, convert all tabs to spaces.
|
||||
Preserves backspace characters in the output; they decrement the
|
||||
|
||||
@@ -136,7 +136,7 @@ print_factors (const char *s)
|
||||
int n_factors;
|
||||
int i;
|
||||
|
||||
if (xstrtoul (s, NULL, 10, &n, NULL) != LONGINT_OK)
|
||||
if (xstrtoul (s, NULL, 10, &n, "") != LONGINT_OK)
|
||||
{
|
||||
error (0, 0, _("`%s' is not a valid positive integer"), s);
|
||||
return 1;
|
||||
|
||||
@@ -12,9 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
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 Ross Paterson <rap@doc.ic.ac.uk>. */
|
||||
|
||||
@@ -382,7 +381,7 @@ main (register int argc, register char **argv)
|
||||
case 'w':
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("invalid line number increment: `%s'"),
|
||||
optarg);
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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 David MacKenzie, djm@gnu.ai.mit.edu. */
|
||||
|
||||
@@ -295,7 +295,7 @@ main (int argc, char **argv)
|
||||
case 'w': /* Line width. */
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid number of columns: `%s'"), optarg);
|
||||
|
||||
@@ -29,7 +29,7 @@ usage="Usage: $0 [OPTION]... [USERNAME]...
|
||||
|
||||
Same as id -Gn. If no USERNAME, use current process.
|
||||
|
||||
Report bugs to bug-gnu-utils@gnu.ai.mit.edu"
|
||||
Report bugs to sh-utils-bugs@gnu.ai.mit.edu"
|
||||
|
||||
case $# in
|
||||
1 )
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Options: (see usage)
|
||||
Reads from standard input if no files are given or when a filename of
|
||||
|
||||
14
src/join.c
14
src/join.c
@@ -12,8 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
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 Mike Haertel, mike@gnu.ai.mit.edu. */
|
||||
|
||||
@@ -678,7 +678,7 @@ decode_field_spec (const char *s, int *file_index, int *field_index)
|
||||
strtol_error s_err;
|
||||
long int tmp_long;
|
||||
|
||||
s_err = xstrtol (s + 2, NULL, 10, &tmp_long, NULL);
|
||||
s_err = xstrtol (s + 2, NULL, 10, &tmp_long, "");
|
||||
if (s_err != LONGINT_OK || tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
{
|
||||
error (0, 0, _("invalid field number: `%s'"), s + 2);
|
||||
@@ -787,7 +787,7 @@ main (int argc, char **argv)
|
||||
/* Fall through. */
|
||||
|
||||
case 'a':
|
||||
if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &val, "") != LONGINT_OK
|
||||
|| (val != 1 && val != 2))
|
||||
error (EXIT_FAILURE, 0, _("invalid field number: `%s'"), optarg);
|
||||
if (val == 1)
|
||||
@@ -805,7 +805,7 @@ main (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case '1':
|
||||
if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &val, "") != LONGINT_OK
|
||||
|| val <= 0 || val > INT_MAX)
|
||||
{
|
||||
error (EXIT_FAILURE, 0,
|
||||
@@ -815,7 +815,7 @@ main (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case '2':
|
||||
if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &val, "") != LONGINT_OK
|
||||
|| val <= 0 || val > INT_MAX)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid field number for file 2: `%s'"), optarg);
|
||||
@@ -823,7 +823,7 @@ main (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
if (xstrtol (optarg, NULL, 10, &val, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &val, "") != LONGINT_OK
|
||||
|| val <= 0 || val > INT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("invalid field number: `%s'"), optarg);
|
||||
join_field_1 = join_field_2 = (int) val - 1;
|
||||
|
||||
106
src/ls.c
106
src/ls.c
@@ -15,17 +15,17 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* If the macro MULTI_COL is defined,
|
||||
/* If ls_mode is LS_MULTI_COL,
|
||||
the multi-column format is the default regardless
|
||||
of the type of output device.
|
||||
This is for the `dir' program.
|
||||
|
||||
If the macro LONG_FORMAT is defined,
|
||||
If ls_mode is LS_LONG_FORMAT,
|
||||
the long format is the default regardless of the
|
||||
type of output device.
|
||||
This is for the `vdir' program.
|
||||
|
||||
If neither is defined,
|
||||
If ls_mode is LS_LS,
|
||||
the output format depends on whether the output
|
||||
device is a terminal.
|
||||
This is for the `ls' program. */
|
||||
@@ -131,7 +131,6 @@ struct bin_str
|
||||
};
|
||||
|
||||
#ifndef STDC_HEADERS
|
||||
char *ctime ();
|
||||
time_t time ();
|
||||
void free ();
|
||||
#endif
|
||||
@@ -194,6 +193,7 @@ static void print_long_format __P ((const struct fileinfo *f));
|
||||
static void print_many_per_line __P ((void));
|
||||
static void print_name_with_quoting __P ((const char *p, unsigned int mode,
|
||||
int linkok));
|
||||
static void prep_non_filename_text __P ((void));
|
||||
static void print_type_indicator __P ((unsigned int mode));
|
||||
static void print_with_commas __P ((void));
|
||||
static void queue_directory __P ((const char *name, const char *realname));
|
||||
@@ -673,7 +673,10 @@ main (int argc, char **argv)
|
||||
usage (EXIT_SUCCESS);
|
||||
|
||||
if (print_with_color)
|
||||
parse_ls_color ();
|
||||
{
|
||||
parse_ls_color ();
|
||||
prep_non_filename_text ();
|
||||
}
|
||||
|
||||
format_needs_stat = sort_type == sort_time || sort_type == sort_size
|
||||
|| format == long_format
|
||||
@@ -743,6 +746,13 @@ main (int argc, char **argv)
|
||||
if (fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
/* Restore default color before exiting */
|
||||
if (print_with_color)
|
||||
{
|
||||
put_indicator (&color_indicator[C_LEFT]);
|
||||
put_indicator (&color_indicator[C_RIGHT]);
|
||||
}
|
||||
|
||||
exit (exit_status);
|
||||
}
|
||||
|
||||
@@ -1285,7 +1295,7 @@ get_funky_string (char **dest, const char **src, int equals_end)
|
||||
*(q++) = *(p++) & 037;
|
||||
++count;
|
||||
}
|
||||
else if ( *p == '?' )
|
||||
else if ( *p == '?')
|
||||
{
|
||||
*(q++) = 127;
|
||||
++count;
|
||||
@@ -1630,7 +1640,7 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
|
||||
#ifdef S_ISLNK
|
||||
if (S_ISLNK (files[files_index].stat.st_mode)
|
||||
&& (explicit_arg || format == long_format))
|
||||
&& (explicit_arg || format == long_format || print_with_color))
|
||||
{
|
||||
char *linkpath;
|
||||
struct stat linkstats;
|
||||
@@ -1642,9 +1652,12 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
they won't be traced and when no indicator is needed. */
|
||||
if (linkpath
|
||||
&& ((explicit_arg && format != long_format)
|
||||
|| indicator_style != none)
|
||||
|| indicator_style != none
|
||||
|| print_with_color)
|
||||
&& stat (linkpath, &linkstats) == 0)
|
||||
{
|
||||
files[files_index].linkok = 1;
|
||||
|
||||
/* Symbolic links to directories that are mentioned on the
|
||||
command line are automatically traced if not being
|
||||
listed as files. */
|
||||
@@ -2021,18 +2034,20 @@ print_current_files (void)
|
||||
static void
|
||||
print_long_format (const struct fileinfo *f)
|
||||
{
|
||||
char modebuf[20];
|
||||
#define TIMEBUF_SIZE 40
|
||||
char timebuf[TIMEBUF_SIZE];
|
||||
char modebuf[11];
|
||||
|
||||
/* 7 fields that may (worst case: 64-bit integral values) require 20 bytes,
|
||||
1 10-character mode string,
|
||||
1 24-character time string,
|
||||
9 spaces, one following each of these fields,
|
||||
and 1 trailing NUL byte. */
|
||||
char bigbuf[7 * 20 + 10 + 24 + 9 + 1];
|
||||
1 10-byte mode string,
|
||||
1 24-byte time string (may be longer in some locales -- see below),
|
||||
9 spaces, one following each of these fields, and
|
||||
1 trailing NUL byte. */
|
||||
char init_bigbuf[7 * 20 + 10 + 24 + 9 + 1];
|
||||
char *buf = init_bigbuf;
|
||||
size_t bufsize = sizeof (init_bigbuf);
|
||||
size_t s;
|
||||
char *p;
|
||||
time_t when;
|
||||
const char *fmt;
|
||||
|
||||
#ifdef HAVE_ST_DM_MODE
|
||||
mode_string (f->stat.st_dm_mode, modebuf);
|
||||
@@ -2055,12 +2070,10 @@ print_long_format (const struct fileinfo *f)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Use strftime rather than ctime, because the former can produce
|
||||
locale-dependent names for the weekday (%a) and month (%b). */
|
||||
strftime (timebuf, TIMEBUF_SIZE, "%a %b %d %H:%M:%S %Y", localtime (&when));
|
||||
|
||||
if (full_time)
|
||||
timebuf[24] = '\0';
|
||||
{
|
||||
fmt = "%a %b %d %H:%M:%S %Y";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (current_time > when + 6L * 30L * 24L * 60L * 60L /* Old. */
|
||||
@@ -2072,12 +2085,15 @@ print_long_format (const struct fileinfo *f)
|
||||
Allow a 1 hour slop factor for what is considered "the future",
|
||||
to allow for NFS server/client clock disagreement.
|
||||
Show the year instead of the time of day. */
|
||||
strcpy (timebuf + 11, timebuf + 19);
|
||||
fmt = "%b %e %Y";
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt = "%b %e %H:%M";
|
||||
}
|
||||
timebuf[16] = 0;
|
||||
}
|
||||
|
||||
p = bigbuf;
|
||||
p = buf;
|
||||
|
||||
if (print_inode)
|
||||
{
|
||||
@@ -2120,11 +2136,25 @@ print_long_format (const struct fileinfo *f)
|
||||
sprintf (p, "%8lu ", (unsigned long) f->stat.st_size);
|
||||
p += strlen (p);
|
||||
|
||||
sprintf (p, "%s ", full_time ? timebuf : timebuf + 4);
|
||||
p += strlen (p);
|
||||
/* Use strftime rather than ctime, because the former can produce
|
||||
locale-dependent names for the weekday (%a) and month (%b). */
|
||||
|
||||
while (! (s = strftime (p, buf + bufsize - p, fmt, localtime (&when))))
|
||||
{
|
||||
char *newbuf = (char *) alloca (bufsize *= 2);
|
||||
memcpy (newbuf, buf, p - buf);
|
||||
p = newbuf + (p - buf);
|
||||
buf = newbuf;
|
||||
}
|
||||
|
||||
p += s;
|
||||
*p++ = ' ';
|
||||
|
||||
/* NUL-terminate the string -- fputs (via FPUTS) requires it. */
|
||||
*p = '\0';
|
||||
|
||||
DIRED_INDENT ();
|
||||
FPUTS (bigbuf, stdout, p - bigbuf);
|
||||
FPUTS (buf, stdout, p - buf);
|
||||
PUSH_CURRENT_DIRED_POS (&dired_obstack);
|
||||
print_name_with_quoting (f->name, f->stat.st_mode, f->linkok);
|
||||
PUSH_CURRENT_DIRED_POS (&dired_obstack);
|
||||
@@ -2134,7 +2164,7 @@ print_long_format (const struct fileinfo *f)
|
||||
if (f->linkname)
|
||||
{
|
||||
FPUTS_LITERAL (" -> ", stdout);
|
||||
print_name_with_quoting (f->linkname, f->linkmode, f->linkok-1);
|
||||
print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1);
|
||||
if (indicator_style != none)
|
||||
print_type_indicator (f->linkmode);
|
||||
}
|
||||
@@ -2297,15 +2327,19 @@ print_name_with_quoting (const char *p, unsigned int mode, int linkok)
|
||||
free (quoted);
|
||||
|
||||
if (print_with_color)
|
||||
prep_non_filename_text ();
|
||||
}
|
||||
|
||||
static void
|
||||
prep_non_filename_text (void)
|
||||
{
|
||||
if (color_indicator[C_END].string != NULL)
|
||||
put_indicator (&color_indicator[C_END]);
|
||||
else
|
||||
{
|
||||
if (color_indicator[C_END].string != NULL)
|
||||
put_indicator (&color_indicator[C_END]);
|
||||
else
|
||||
{
|
||||
put_indicator (&color_indicator[C_LEFT]);
|
||||
put_indicator (&color_indicator[C_NORM]);
|
||||
put_indicator (&color_indicator[C_RIGHT]);
|
||||
}
|
||||
put_indicator (&color_indicator[C_LEFT]);
|
||||
put_indicator (&color_indicator[C_NORM]);
|
||||
put_indicator (&color_indicator[C_RIGHT]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
26
src/nice.c
26
src/nice.c
@@ -59,6 +59,7 @@ main (int argc, char **argv)
|
||||
int adjustment = 0;
|
||||
int minusflag = 0;
|
||||
int adjustment_given = 0;
|
||||
int i;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
@@ -67,11 +68,9 @@ main (int argc, char **argv)
|
||||
|
||||
parse_long_options (argc, argv, "nice", GNU_PACKAGE, VERSION, usage);
|
||||
|
||||
for (optind = 1; optind < argc; /* empty */)
|
||||
for (i = 1; i < argc; /* empty */)
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = argv[optind];
|
||||
char *s = argv[i];
|
||||
|
||||
if (s[0] == '-' && s[1] == '-' && ISDIGIT (s[2]))
|
||||
{
|
||||
@@ -82,7 +81,7 @@ main (int argc, char **argv)
|
||||
/* FIXME: use xstrtol */
|
||||
adjustment = atoi (&s[2]);
|
||||
adjustment_given = 1;
|
||||
++optind;
|
||||
++i;
|
||||
}
|
||||
else if (s[0] == '-' && (ISDIGIT (s[1])
|
||||
|| (s[1] == '+' && ISDIGIT (s[2]))))
|
||||
@@ -96,12 +95,17 @@ main (int argc, char **argv)
|
||||
/* FIXME: use xstrtol */
|
||||
adjustment = atoi (&s[1]);
|
||||
adjustment_given = 1;
|
||||
++optind;
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
int optc;
|
||||
if ((optc = getopt_long (argc, argv, "+n:",
|
||||
char **fake_argv = argv + i - 1;
|
||||
|
||||
/* Initialize getopt_long's internal state. */
|
||||
optind = 0;
|
||||
|
||||
if ((optc = getopt_long (argc - (i - 1), fake_argv, "+n:",
|
||||
longopts, (int *) 0)) != EOF)
|
||||
{
|
||||
switch (optc)
|
||||
@@ -121,6 +125,8 @@ main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
i += optind - 1;
|
||||
|
||||
if (optc == EOF)
|
||||
break;
|
||||
}
|
||||
@@ -131,7 +137,7 @@ main (int argc, char **argv)
|
||||
if (!adjustment_given)
|
||||
adjustment = 10;
|
||||
|
||||
if (optind == argc)
|
||||
if (i == argc)
|
||||
{
|
||||
if (adjustment_given)
|
||||
{
|
||||
@@ -158,8 +164,8 @@ main (int argc, char **argv)
|
||||
#endif
|
||||
error (1, errno, _("cannot set priority"));
|
||||
|
||||
execvp (argv[optind], &argv[optind]);
|
||||
error (errno == ENOENT ? 127 : 126, errno, "%s", argv[optind]);
|
||||
execvp (argv[i], &argv[i]);
|
||||
error (errno == ENOENT ? 127 : 126, errno, "%s", argv[i]);
|
||||
}
|
||||
|
||||
/* Return nonzero if S represents a (possibly signed) decimal integer,
|
||||
|
||||
12
src/nl.c
12
src/nl.c
@@ -12,8 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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 Scott Bartram (nancy!scott@uunet.uu.net)
|
||||
Revised by David MacKenzie (djm@gnu.ai.mit.edu) */
|
||||
@@ -495,7 +495,7 @@ main (int argc, char **argv)
|
||||
case 'v':
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
/* Allow it to be negative. */
|
||||
|| tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("invalid starting line number: `%s'"),
|
||||
@@ -506,7 +506,7 @@ main (int argc, char **argv)
|
||||
case 'i':
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("invalid line number increment: `%s'"),
|
||||
optarg);
|
||||
@@ -519,7 +519,7 @@ main (int argc, char **argv)
|
||||
case 'l':
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("invalid number of blank lines: `%s'"),
|
||||
optarg);
|
||||
@@ -532,7 +532,7 @@ main (int argc, char **argv)
|
||||
case 'w':
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid line number field width: `%s'"),
|
||||
|
||||
@@ -33,7 +33,7 @@ usage_help="Run COMMAND, ignoring hangup signals.
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
Report bugs to bug-gnu-utils@gnu.ai.mit.edu"
|
||||
Report bugs to sh-utils-bugs@gnu.ai.mit.edu"
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo >&2 "$usage"
|
||||
|
||||
2
src/od.c
2
src/od.c
@@ -1776,7 +1776,7 @@ the maximum\nrepresentable value of type `long'"), optarg);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_err = xstrtoul (optarg, NULL, 10, &desired_width, NULL);
|
||||
s_err = xstrtoul (optarg, NULL, 10, &desired_width, "");
|
||||
if (s_err != LONGINT_OK)
|
||||
STRTOL_FATAL_ERROR (optarg, _("width specification"), s_err);
|
||||
}
|
||||
|
||||
68
src/pr.c
68
src/pr.c
@@ -12,8 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Author: Pete TerMaat. */
|
||||
|
||||
@@ -457,13 +457,13 @@ static int input_position;
|
||||
status if there were any. */
|
||||
static int failed_opens = 0;
|
||||
|
||||
/* The horizontal position we'll be at after printing a tab character
|
||||
of width c_ from the position h_. */
|
||||
#define pos_after_tab(c_, h_) h_ - h_ % c_ + c_
|
||||
|
||||
/* The number of spaces taken up if we print a tab character with width
|
||||
c_ from position h_. */
|
||||
#define tab_width(c_, h_) - h_ % c_ + c_
|
||||
#define TAB_WIDTH(c_, h_) ((c_) - ((h_) % (c_)))
|
||||
|
||||
/* The horizontal position we'll be at after printing a tab character
|
||||
of width c_ from the position h_. */
|
||||
#define POS_AFTER_TAB(c_, h_) ((h_) + TAB_WIDTH (c_, h_))
|
||||
|
||||
/* (-NNN) Number of columns of text to print. */
|
||||
static int columns = 1;
|
||||
@@ -634,7 +634,7 @@ first_last_page (char *pages)
|
||||
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (pages, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (pages, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("invalid starting page number: `%s'"),
|
||||
pages);
|
||||
@@ -646,7 +646,7 @@ first_last_page (char *pages)
|
||||
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (str1 + 1, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (str1 + 1, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("invalid ending page number: `%s'"),
|
||||
str1 + 1);
|
||||
@@ -775,7 +775,7 @@ main (int argc, char **argv)
|
||||
case 'l':
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
{
|
||||
error (EXIT_FAILURE, 0,
|
||||
@@ -799,7 +799,7 @@ main (int argc, char **argv)
|
||||
skip_count = FALSE;
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long > INT_MAX)
|
||||
{
|
||||
error (EXIT_FAILURE, 0,
|
||||
@@ -812,7 +812,7 @@ main (int argc, char **argv)
|
||||
case 'o':
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("`-o MARGIN' invalid line offset: `%s'"), optarg);
|
||||
@@ -842,7 +842,7 @@ main (int argc, char **argv)
|
||||
truncate_lines = TRUE;
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("`-w PAGE_WIDTH' invalid column number: `%s'"), optarg);
|
||||
@@ -919,7 +919,7 @@ getoptarg (char *arg, char switch_char, char *character, int *number)
|
||||
if (*arg)
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (arg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (arg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
{
|
||||
error (0, 0,
|
||||
@@ -996,7 +996,7 @@ init_parameters (int number_of_files)
|
||||
if (number_separator == input_tab_char)
|
||||
{
|
||||
number_width = chars_per_number +
|
||||
tab_width (chars_per_input_tab,
|
||||
TAB_WIDTH (chars_per_input_tab,
|
||||
(chars_per_margin + chars_per_number));
|
||||
}
|
||||
else
|
||||
@@ -1076,6 +1076,7 @@ init_fps (int number_of_files, char **av)
|
||||
if (open_file (*av, p) == 0)
|
||||
return 1;
|
||||
init_header (*av, fileno (p->fp));
|
||||
p->lines_stored = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1086,6 +1087,7 @@ init_fps (int number_of_files, char **av)
|
||||
p->full_page_printed = FALSE;
|
||||
++total_files;
|
||||
init_header ("", -1);
|
||||
p->lines_stored = 0;
|
||||
}
|
||||
|
||||
firstname = p->name;
|
||||
@@ -1096,6 +1098,7 @@ init_fps (int number_of_files, char **av)
|
||||
p->fp = firstfp;
|
||||
p->status = OPEN;
|
||||
p->full_page_printed = FALSE;
|
||||
p->lines_stored = 0;
|
||||
}
|
||||
}
|
||||
files_ready_to_read = total_files;
|
||||
@@ -1360,7 +1363,7 @@ init_header (char *filename, int desc)
|
||||
int chars_per_middle, chars_free, lhs_blanks, rhs_blanks;
|
||||
char *f = filename;
|
||||
char *no_middle = "";
|
||||
char *header_text, *t_buf;
|
||||
char *header_text;
|
||||
struct tm *tmptr;
|
||||
struct stat st;
|
||||
char *datim = "- Date/Time --";
|
||||
@@ -1376,18 +1379,16 @@ init_header (char *filename, int desc)
|
||||
sprintf (header, "%s", " "); /* blank line header */
|
||||
else
|
||||
{
|
||||
#define T_BUF_FMT "%y-%m-%d %H:%M" /* date/time short format */
|
||||
#define T_BUF_SIZE 15
|
||||
char t_buf[T_BUF_SIZE];
|
||||
|
||||
/* If parallel files or standard input, use current time. */
|
||||
if (desc < 0 || !strcmp (filename, "-") || fstat (desc, &st))
|
||||
st.st_mtime = time (NULL);
|
||||
|
||||
{
|
||||
size_t t_buf_size = 15;
|
||||
const char *fmt = "%y-%m-%d %H:%M"; /* date/time short format */
|
||||
|
||||
t_buf = (char *) xmalloc (t_buf_size);
|
||||
tmptr = localtime (&st.st_mtime);
|
||||
strftime (t_buf, t_buf_size, fmt, tmptr);
|
||||
}
|
||||
tmptr = localtime (&st.st_mtime);
|
||||
strftime (t_buf, T_BUF_SIZE, T_BUF_FMT, tmptr);
|
||||
|
||||
chars_per_middle = chars_per_line - CHARS_FOR_DATE_AND_PAGE;
|
||||
if (chars_per_middle < 3)
|
||||
@@ -1643,6 +1644,7 @@ init_store_cols (void)
|
||||
|
||||
if (line_vector != NULL)
|
||||
free ((int *) line_vector);
|
||||
/* FIXME: here's where it was allocated. */
|
||||
line_vector = (int *) xmalloc ((total_lines + 1) * sizeof (int *));
|
||||
|
||||
if (end_vector != NULL)
|
||||
@@ -1927,7 +1929,7 @@ print_white_space (void)
|
||||
register int goal = h_old + spaces_not_printed;
|
||||
|
||||
while (goal - h_old > 1
|
||||
&& (h_new = pos_after_tab (chars_per_output_tab, h_old)) <= goal)
|
||||
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
|
||||
{
|
||||
putchar (output_tab_char);
|
||||
h_old = h_new;
|
||||
@@ -2234,6 +2236,17 @@ print_stored (COLUMN *p)
|
||||
|
||||
int line = p->current_line++;
|
||||
register char *first = &buff[line_vector[line]];
|
||||
/* FIXME
|
||||
UMR: Uninitialized memory read:
|
||||
* This is occurring while in:
|
||||
print_stored [pr.c:2239]
|
||||
* Reading 4 bytes from 0x5148c in the heap.
|
||||
* Address 0x5148c is 4 bytes into a malloc'd block at 0x51488 of 676 bytes
|
||||
* This block was allocated from:
|
||||
malloc [rtlib.o]
|
||||
xmalloc [xmalloc.c:94]
|
||||
init_store_cols [pr.c:1648]
|
||||
*/
|
||||
register char *last = &buff[line_vector[line + 1]];
|
||||
|
||||
pad_vertically = TRUE;
|
||||
@@ -2298,7 +2311,7 @@ char_to_clump (int c)
|
||||
|
||||
if (c == input_tab_char)
|
||||
{
|
||||
width = tab_width (chars_per_input_tab, input_position);
|
||||
width = TAB_WIDTH (chars_per_input_tab, input_position);
|
||||
|
||||
if (untabify_input)
|
||||
{
|
||||
@@ -2427,7 +2440,8 @@ Paginate or columnate FILE(s) for printing.\n\
|
||||
-j merge full lines, turns off -w line truncation, no column\n\
|
||||
alignment, -s[STRING] sets separators\n\
|
||||
-l PAGE_LENGTH set the page length to PAGE_LENGTH (66) lines\n\
|
||||
(default number of lines of text 56, with -f 63)\n\
|
||||
(default number of lines of text 56, with -f 63)\n"));
|
||||
printf (_("\
|
||||
-m print all files in parallel, one in each column,\n\
|
||||
truncate lines, but join lines of full length with -j\n\
|
||||
-n[SEP[DIGITS]] number lines, use DIGITS (5) digits, then SEP (TAB)\n\
|
||||
|
||||
@@ -88,14 +88,15 @@ Usage: %s [OPTION]... LAST\n\
|
||||
or: %s [OPTION]... FIRST INCREMENT LAST\n\
|
||||
"), program_name, program_name, program_name);
|
||||
printf (_("\
|
||||
Print numbers from FIRST (default 1) to LAST, moving by STEP (default 1).\n\
|
||||
Print numbers from FIRST to LAST, in steps of INCREMENT.\n\
|
||||
\n\
|
||||
-f, --format FORMAT use printf(3) style FORMAT (default: %%g)\n\
|
||||
-s, --separator STRING use STRING for separating numbers (default: \\n)\n\
|
||||
-s, --separator STRING use STRING to separate numbers (default: \\n)\n\
|
||||
-w, --equal-width equalize width by padding with leading zeroes\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
If FIRST or INCREMENT is omitted, it defaults to 1.\n\
|
||||
FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\
|
||||
INCREMENT should be positive if FIRST is smaller than LAST, and negative\n\
|
||||
otherwise. When given, the FORMAT argument must contain exactly one of\n\
|
||||
|
||||
121
src/sort.c
121
src/sort.c
@@ -129,9 +129,6 @@ struct month
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* Table of digits. */
|
||||
static int digits[UCHAR_LIM];
|
||||
|
||||
/* Table of white space. */
|
||||
static int blanks[UCHAR_LIM];
|
||||
|
||||
@@ -236,8 +233,8 @@ Write sorted concatenation of all FILE(s) to standard output.\n\
|
||||
-s stabilize sort by disabling last resort comparison\n\
|
||||
-t SEP use SEParator instead of non- to whitespace transition\n\
|
||||
-T DIRECT use DIRECT for temporary files, not $TMPDIR or %s\n\
|
||||
-u with -c, check for strict ordering\n\
|
||||
-u with -m, only output the first of an equal sequence\n\
|
||||
-u with -c, check for strict ordering;\n\
|
||||
with -m, only output the first of an equal sequence\n\
|
||||
-z end lines with 0 byte, not newline, for find -print0\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
@@ -459,8 +456,6 @@ inittables (void)
|
||||
{
|
||||
if (ISBLANK (i))
|
||||
blanks[i] = 1;
|
||||
if (ISDIGIT (i))
|
||||
digits[i] = 1;
|
||||
if (!ISPRINT (i))
|
||||
nonprinting[i] = 1;
|
||||
if (!ISALNUM (i) && !ISBLANK (i))
|
||||
@@ -762,29 +757,29 @@ findlines (struct buffer *buf, struct lines *lines)
|
||||
static int
|
||||
fraccompare (register const char *a, register const char *b)
|
||||
{
|
||||
register int tmpa = UCHAR (*a);
|
||||
register int tmpb = UCHAR (*b);
|
||||
register int tmpa = *a;
|
||||
register int tmpb = *b;
|
||||
|
||||
if (tmpa == '.' && tmpb == '.')
|
||||
{
|
||||
do
|
||||
tmpa = UCHAR (*++a), tmpb = UCHAR (*++b);
|
||||
while (tmpa == tmpb && digits[tmpa]);
|
||||
if (digits[tmpa] && digits[tmpb])
|
||||
tmpa = *++a, tmpb = *++b;
|
||||
while (tmpa == tmpb && ISDIGIT (tmpa));
|
||||
if (ISDIGIT (tmpa) && ISDIGIT (tmpb))
|
||||
return tmpa - tmpb;
|
||||
if (digits[tmpa])
|
||||
if (ISDIGIT (tmpa))
|
||||
{
|
||||
while (tmpa == '0')
|
||||
tmpa = UCHAR (*++a);
|
||||
if (digits[tmpa])
|
||||
tmpa = *++a;
|
||||
if (ISDIGIT (tmpa))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
if (digits[tmpb])
|
||||
if (ISDIGIT (tmpb))
|
||||
{
|
||||
while (tmpb == '0')
|
||||
tmpb = UCHAR (*++b);
|
||||
if (digits[tmpb])
|
||||
tmpb = *++b;
|
||||
if (ISDIGIT (tmpb))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@@ -793,18 +788,18 @@ fraccompare (register const char *a, register const char *b)
|
||||
else if (tmpa == '.')
|
||||
{
|
||||
do
|
||||
tmpa = UCHAR (*++a);
|
||||
tmpa = *++a;
|
||||
while (tmpa == '0');
|
||||
if (digits[tmpa])
|
||||
if (ISDIGIT (tmpa))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
else if (tmpb == '.')
|
||||
{
|
||||
do
|
||||
tmpb = UCHAR (*++b);
|
||||
tmpb = *++b;
|
||||
while (tmpb == '0');
|
||||
if (digits[tmpb])
|
||||
if (ISDIGIT (tmpb))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@@ -831,44 +826,45 @@ numcompare (register const char *a, register const char *b)
|
||||
if (tmpa == '-')
|
||||
{
|
||||
do
|
||||
tmpa = UCHAR (*++a);
|
||||
tmpa = *++a;
|
||||
while (tmpa == '0');
|
||||
if (tmpb != '-')
|
||||
{
|
||||
if (tmpa == '.')
|
||||
do
|
||||
tmpa = UCHAR (*++a);
|
||||
tmpa = *++a;
|
||||
while (tmpa == '0');
|
||||
if (digits[tmpa])
|
||||
if (ISDIGIT (tmpa))
|
||||
return -1;
|
||||
while (tmpb == '0')
|
||||
tmpb = UCHAR (*++b);
|
||||
tmpb = *++b;
|
||||
if (tmpb == '.')
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == '0');
|
||||
if (digits[tmpb])
|
||||
if (ISDIGIT (tmpb))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
do
|
||||
tmpb = UCHAR (*++b);
|
||||
tmpb = *++b;
|
||||
while (tmpb == '0');
|
||||
|
||||
while (tmpa == tmpb && digits[tmpa])
|
||||
tmpa = UCHAR (*++a), tmpb = UCHAR (*++b);
|
||||
while (tmpa == tmpb && ISDIGIT (tmpa))
|
||||
tmpa = *++a, tmpb = *++b;
|
||||
|
||||
if ((tmpa == '.' && !digits[tmpb]) || (tmpb == '.' && !digits[tmpa]))
|
||||
if ((tmpa == '.' && !ISDIGIT (tmpb))
|
||||
|| (tmpb == '.' && !ISDIGIT (tmpa)))
|
||||
return -fraccompare (a, b);
|
||||
|
||||
if (digits[tmpa])
|
||||
for (loga = 1; digits[UCHAR (*++a)]; ++loga)
|
||||
if (ISDIGIT (tmpa))
|
||||
for (loga = 1; ISDIGIT (*++a); ++loga)
|
||||
;
|
||||
else
|
||||
loga = 0;
|
||||
|
||||
if (digits[tmpb])
|
||||
for (logb = 1; digits[UCHAR (*++b)]; ++logb)
|
||||
if (ISDIGIT (tmpb))
|
||||
for (logb = 1; ISDIGIT (*++b); ++logb)
|
||||
;
|
||||
else
|
||||
logb = 0;
|
||||
@@ -884,45 +880,46 @@ numcompare (register const char *a, register const char *b)
|
||||
else if (tmpb == '-')
|
||||
{
|
||||
do
|
||||
tmpb = UCHAR (*++b);
|
||||
tmpb = *++b;
|
||||
while (tmpb == '0');
|
||||
if (tmpb == '.')
|
||||
do
|
||||
tmpb = *++b;
|
||||
while (tmpb == '0');
|
||||
if (digits[tmpb])
|
||||
if (ISDIGIT (tmpb))
|
||||
return 1;
|
||||
while (tmpa == '0')
|
||||
tmpa = UCHAR (*++a);
|
||||
tmpa = *++a;
|
||||
if (tmpa == '.')
|
||||
do
|
||||
tmpa = UCHAR (*++a);
|
||||
tmpa = *++a;
|
||||
while (tmpa == '0');
|
||||
if (digits[tmpa])
|
||||
if (ISDIGIT (tmpa))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (tmpa == '0')
|
||||
tmpa = UCHAR (*++a);
|
||||
tmpa = *++a;
|
||||
while (tmpb == '0')
|
||||
tmpb = UCHAR (*++b);
|
||||
tmpb = *++b;
|
||||
|
||||
while (tmpa == tmpb && digits[tmpa])
|
||||
tmpa = UCHAR (*++a), tmpb = UCHAR (*++b);
|
||||
while (tmpa == tmpb && ISDIGIT (tmpa))
|
||||
tmpa = *++a, tmpb = *++b;
|
||||
|
||||
if ((tmpa == '.' && !digits[tmpb]) || (tmpb == '.' && !digits[tmpa]))
|
||||
if ((tmpa == '.' && !ISDIGIT (tmpb))
|
||||
|| (tmpb == '.' && !ISDIGIT (tmpa)))
|
||||
return fraccompare (a, b);
|
||||
|
||||
if (digits[tmpa])
|
||||
for (loga = 1; digits[UCHAR (*++a)]; ++loga)
|
||||
if (ISDIGIT (tmpa))
|
||||
for (loga = 1; ISDIGIT (*++a); ++loga)
|
||||
;
|
||||
else
|
||||
loga = 0;
|
||||
|
||||
if (digits[tmpb])
|
||||
for (logb = 1; digits[UCHAR (*++b)]; ++logb)
|
||||
if (ISDIGIT (tmpb))
|
||||
for (logb = 1; ISDIGIT (*++b); ++logb)
|
||||
;
|
||||
else
|
||||
logb = 0;
|
||||
@@ -1787,13 +1784,13 @@ main (int argc, char **argv)
|
||||
key = (struct keyfield *) xmalloc (sizeof (struct keyfield));
|
||||
key_init (key);
|
||||
s = argv[i] + 1;
|
||||
if (! (digits[UCHAR (*s)] || (*s == '.' && digits[UCHAR (s[1])])))
|
||||
if (! (ISDIGIT (*s) || (*s == '.' && ISDIGIT (s[1]))))
|
||||
badfieldspec (argv[i]);
|
||||
for (t = 0; digits[UCHAR (*s)]; ++s)
|
||||
for (t = 0; ISDIGIT (*s); ++s)
|
||||
t = 10 * t + *s - '0';
|
||||
t2 = 0;
|
||||
if (*s == '.')
|
||||
for (++s; digits[UCHAR (*s)]; ++s)
|
||||
for (++s; ISDIGIT (*s); ++s)
|
||||
t2 = 10 * t2 + *s - '0';
|
||||
if (t2 || t)
|
||||
{
|
||||
@@ -1809,7 +1806,7 @@ main (int argc, char **argv)
|
||||
else if (argv[i][0] == '-' && argv[i][1])
|
||||
{
|
||||
s = argv[i] + 1;
|
||||
if (digits[UCHAR (*s)] || (*s == '.' && digits[UCHAR (s[1])]))
|
||||
if (ISDIGIT (*s) || (*s == '.' && ISDIGIT (s[1])))
|
||||
{
|
||||
if (!key)
|
||||
{
|
||||
@@ -1818,11 +1815,11 @@ main (int argc, char **argv)
|
||||
key specifiers,\nthe +POS specifier must come first"));
|
||||
usage (SORT_FAILURE);
|
||||
}
|
||||
for (t = 0; digits[UCHAR (*s)]; ++s)
|
||||
for (t = 0; ISDIGIT (*s); ++s)
|
||||
t = t * 10 + *s - '0';
|
||||
t2 = 0;
|
||||
if (*s == '.')
|
||||
for (++s; digits[UCHAR (*s)]; ++s)
|
||||
for (++s; ISDIGIT (*s); ++s)
|
||||
t2 = t2 * 10 + *s - '0';
|
||||
key->eword = t;
|
||||
key->echar = t2;
|
||||
@@ -1860,9 +1857,9 @@ key specifiers,\nthe +POS specifier must come first"));
|
||||
xmalloc (sizeof (struct keyfield));
|
||||
key_init (key);
|
||||
/* Get POS1. */
|
||||
if (!digits[UCHAR (*s)])
|
||||
if (!ISDIGIT (*s))
|
||||
badfieldspec (argv[i]);
|
||||
for (t = 0; digits[UCHAR (*s)]; ++s)
|
||||
for (t = 0; ISDIGIT (*s); ++s)
|
||||
t = 10 * t + *s - '0';
|
||||
if (t == 0)
|
||||
{
|
||||
@@ -1875,14 +1872,14 @@ to the `-k' option must be positive"));
|
||||
t2 = 0;
|
||||
if (*s == '.')
|
||||
{
|
||||
if (!digits[UCHAR (s[1])])
|
||||
if (!ISDIGIT (s[1]))
|
||||
{
|
||||
/* Provoke with `sort -k1.' */
|
||||
error (0, 0, _("starting field spec has `.' but \
|
||||
lacks following character offset"));
|
||||
badfieldspec (argv[i]);
|
||||
}
|
||||
for (++s; digits[UCHAR (*s)]; ++s)
|
||||
for (++s; ISDIGIT (*s); ++s)
|
||||
t2 = 10 * t2 + *s - '0';
|
||||
if (t2 == 0)
|
||||
{
|
||||
@@ -1920,7 +1917,7 @@ lacks following field spec"));
|
||||
badfieldspec (argv[i]);
|
||||
}
|
||||
/* Get POS2. */
|
||||
for (t = 0; digits[UCHAR (*s)]; ++s)
|
||||
for (t = 0; ISDIGIT (*s); ++s)
|
||||
t = t * 10 + *s - '0';
|
||||
if (t == 0)
|
||||
{
|
||||
@@ -1933,14 +1930,14 @@ to the `-k' option must be positive"));
|
||||
t2 = 0;
|
||||
if (*s == '.')
|
||||
{
|
||||
if (!digits[UCHAR (s[1])])
|
||||
if (!ISDIGIT (s[1]))
|
||||
{
|
||||
/* Provoke with `sort -k1,1.' */
|
||||
error (0, 0, _("ending field spec has `.' \
|
||||
but lacks following character offset"));
|
||||
badfieldspec (argv[i]);
|
||||
}
|
||||
for (++s; digits[UCHAR (*s)]; ++s)
|
||||
for (++s; ISDIGIT (*s); ++s)
|
||||
t2 = t2 * 10 + *s - '0';
|
||||
}
|
||||
else
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* By tege@sics.se, with rms.
|
||||
|
||||
|
||||
12
src/su.c
12
src/su.c
@@ -114,11 +114,23 @@ uid_t getuid ();
|
||||
|
||||
#include "error.h"
|
||||
|
||||
#ifdef HAVE_PATHS_H
|
||||
#include <paths.h>
|
||||
#endif
|
||||
|
||||
/* The default PATH for simulated logins to non-superuser accounts. */
|
||||
#ifdef _PATH_DEFPATH
|
||||
#define DEFAULT_LOGIN_PATH _PATH_DEFPATH
|
||||
#else
|
||||
#define DEFAULT_LOGIN_PATH ":/usr/ucb:/bin:/usr/bin"
|
||||
#endif
|
||||
|
||||
/* The default PATH for simulated logins to superuser accounts. */
|
||||
#ifdef _PATH_DEFPATH_ROOT
|
||||
#define DEFAULT_ROOT_LOGIN_PATH _PATH_DEFPATH_ROOT
|
||||
#else
|
||||
#define DEFAULT_ROOT_LOGIN_PATH "/usr/ucb:/bin:/usr/bin:/etc"
|
||||
#endif
|
||||
|
||||
/* The shell to run if none is given in the user's passwd entry. */
|
||||
#define DEFAULT_SHELL "/bin/sh"
|
||||
|
||||
12
src/system.h
12
src/system.h
@@ -338,7 +338,6 @@ char *alloca ();
|
||||
#endif
|
||||
|
||||
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
|
||||
#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
||||
#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
|
||||
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
|
||||
#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
|
||||
@@ -347,6 +346,17 @@ char *alloca ();
|
||||
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
|
||||
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
|
||||
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
|
||||
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
||||
|
||||
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
|
||||
- Its arg may be any int or unsigned int; it need not be an unsigned char.
|
||||
- It's guaranteed to evaluate its argument exactly once.
|
||||
- It's typically faster.
|
||||
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
|
||||
only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
|
||||
it's important to use the locale's definition of `digit' even when the
|
||||
host does not conform to Posix. */
|
||||
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
|
||||
|
||||
#ifndef __P
|
||||
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
|
||||
362
src/tail.c
362
src/tail.c
@@ -12,8 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Can display any amount of data, unlike the Unix version, which uses
|
||||
a fixed size buffer and therefore can only deliver a limited number
|
||||
@@ -49,11 +49,27 @@
|
||||
#include <assert.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#if HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "xstrtol.h"
|
||||
#include "xstrtoul.h"
|
||||
#include "error.h"
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
#ifndef OFF_T_MIN
|
||||
# define OFF_T_MIN (0 < (off_t) -1 ? (off_t) 0 \
|
||||
: ~ (off_t) 0 << (sizeof (off_t) * CHAR_BIT - 1))
|
||||
#endif
|
||||
|
||||
#ifndef OFF_T_MAX
|
||||
# define OFF_T_MAX (~ (off_t) 0 - OFF_T_MIN)
|
||||
#endif
|
||||
|
||||
/* Disable assertions. Some systems have broken assert macros. */
|
||||
#define NDEBUG 1
|
||||
|
||||
@@ -837,17 +853,211 @@ tail_file (const char *filename, off_t n_units, int filenum)
|
||||
return errors;
|
||||
}
|
||||
|
||||
/* If the command line arguments are of the obsolescent form and the
|
||||
option string is well-formed, set *FAIL to zero, set *N_UNITS, the
|
||||
globals COUNT_LINES, FOREVER, and FROM_START, and return non-zero.
|
||||
Otherwise, if the command line arguments appear to be of the
|
||||
obsolescent form but the option string is malformed, set *FAIL to
|
||||
non-zero, don't modify any other parameter or global variable, and
|
||||
return non-zero. Otherwise, return zero and don't modify any parameter
|
||||
or global variable. */
|
||||
|
||||
static int
|
||||
parse_obsolescent_option (int argc, const char *const *argv,
|
||||
off_t *n_units, int *fail)
|
||||
{
|
||||
const char *p = argv[1];
|
||||
const char *n_string = NULL;
|
||||
const char *n_string_end;
|
||||
|
||||
int t_from_start;
|
||||
int t_count_lines;
|
||||
int t_forever;
|
||||
|
||||
/* With the obsolescent form, there is one option string and at most
|
||||
one file argument. */
|
||||
if (argc < 2 || argc > 3)
|
||||
return 0;
|
||||
|
||||
/* If I were implementing this in Perl, the rest of this function
|
||||
would be essentially this single statement:
|
||||
return $p ne '-' && $p ne '-c' && $p =~ /^[+-]\d*[cl]?f?$/; */
|
||||
|
||||
/* Test this:
|
||||
if (STREQ (p, "-") || STREQ (p, "-c"))
|
||||
but without using strcmp. */
|
||||
if (p[0] == '-' && (p[1] == 0 || (p[1] == 'c' && p[2] == 0)))
|
||||
return 0;
|
||||
|
||||
if (*p == '+')
|
||||
t_from_start = 1;
|
||||
else if (*p == '-')
|
||||
t_from_start = 0;
|
||||
else
|
||||
return 0;
|
||||
|
||||
++p;
|
||||
if (ISDIGIT (*p))
|
||||
{
|
||||
n_string = p;
|
||||
do
|
||||
{
|
||||
++p;
|
||||
}
|
||||
while (ISDIGIT (*p));
|
||||
}
|
||||
n_string_end = p;
|
||||
|
||||
t_count_lines = 1;
|
||||
if (*p == 'c')
|
||||
{
|
||||
t_count_lines = 0;
|
||||
++p;
|
||||
}
|
||||
else if (*p == 'l')
|
||||
{
|
||||
++p;
|
||||
}
|
||||
|
||||
t_forever = 0;
|
||||
if (*p == 'f')
|
||||
{
|
||||
t_forever = 1;
|
||||
++p;
|
||||
}
|
||||
|
||||
if (*p != '\0')
|
||||
{
|
||||
/* If (argv[1] begins with a `+' or if it begins with `-' followed
|
||||
by a digit), but has an invalid suffix character, give a diagnostic
|
||||
and indicate to caller that this *is* of the obsolescent form,
|
||||
but that it's an invalid option. */
|
||||
if (t_from_start || n_string)
|
||||
{
|
||||
error (0, 0,
|
||||
_("%c: invalid suffix character in obsolescent option" ), *p);
|
||||
*fail = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Otherwise, it might be a valid non-obsolescent option like -n. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
*fail = 0;
|
||||
if (n_string == NULL)
|
||||
*n_units = DEFAULT_N_LINES;
|
||||
else
|
||||
{
|
||||
strtol_error s_err;
|
||||
unsigned long int tmp_ulong;
|
||||
char *end;
|
||||
s_err = xstrtoul (n_string, &end, 0, &tmp_ulong, NULL);
|
||||
if (s_err == LONGINT_OK && tmp_ulong <= OFF_T_MAX)
|
||||
*n_units = (off_t) tmp_ulong;
|
||||
else
|
||||
{
|
||||
/* Extract a NUL-terminated string for the error message. */
|
||||
size_t len = n_string_end - n_string;
|
||||
char *n_string_tmp = xmalloc (len + 1);
|
||||
|
||||
strncpy (n_string_tmp, n_string, len);
|
||||
n_string_tmp[len] = '\0';
|
||||
|
||||
error (0, 0,
|
||||
_("%s, `%s' is so large that it is not representable"),
|
||||
count_lines ? _("number of lines") : _("number of bytes"),
|
||||
n_string_tmp);
|
||||
free (n_string_tmp);
|
||||
*fail = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!*fail)
|
||||
{
|
||||
/* Set globals. */
|
||||
from_start = t_from_start;
|
||||
count_lines = t_count_lines;
|
||||
forever = t_forever;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
parse_options (int argc, char **argv,
|
||||
off_t *n_units, enum header_mode *header_mode)
|
||||
{
|
||||
int c;
|
||||
|
||||
count_lines = 1;
|
||||
forever = forever_multiple = from_start = print_headers = 0;
|
||||
|
||||
while ((c = getopt_long (argc, argv, "c:n:fqv", long_options, (int *) 0))
|
||||
!= EOF)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
case 'n':
|
||||
count_lines = (c == 'n');
|
||||
if (*optarg == '+')
|
||||
from_start = 1;
|
||||
else if (*optarg == '-')
|
||||
++optarg;
|
||||
|
||||
{
|
||||
strtol_error s_err;
|
||||
unsigned long int tmp_ulong;
|
||||
s_err = xstrtoul (optarg, NULL, 0, &tmp_ulong, "bkm");
|
||||
if (s_err == LONGINT_INVALID)
|
||||
{
|
||||
error (EXIT_FAILURE, 0, "%s: %s", optarg,
|
||||
(c == 'n'
|
||||
? _("invalid number of lines")
|
||||
: _("invalid number of bytes")));
|
||||
}
|
||||
if (s_err != LONGINT_OK || tmp_ulong > OFF_T_MAX)
|
||||
{
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("%s: %s is so large that it is not representable"),
|
||||
optarg,
|
||||
c == 'n' ? _("number of lines") : _("number of bytes"));
|
||||
}
|
||||
*n_units = (off_t) tmp_ulong;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
forever = 1;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
*header_mode = never;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
*header_mode = always;
|
||||
break;
|
||||
|
||||
default:
|
||||
usage (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
enum header_mode header_mode = multiple_files;
|
||||
int exit_status = 0;
|
||||
/* If from_start, the number of items to skip before printing; otherwise,
|
||||
the number of items at the end of the file to print. Initially, -1
|
||||
means the value has not been set. */
|
||||
off_t n_units = -1;
|
||||
long int tmp_long;
|
||||
int c; /* Option character. */
|
||||
the number of items at the end of the file to print. Although the type
|
||||
is signed, the value is never negative. */
|
||||
off_t n_units = DEFAULT_N_LINES;
|
||||
int n_files;
|
||||
char **file;
|
||||
|
||||
@@ -857,123 +1067,24 @@ main (int argc, char **argv)
|
||||
textdomain (PACKAGE);
|
||||
|
||||
have_read_stdin = 0;
|
||||
count_lines = 1;
|
||||
forever = forever_multiple = from_start = print_headers = 0;
|
||||
|
||||
if (argc > 1
|
||||
&& ((argv[1][0] == '-' && ISDIGIT (argv[1][1]))
|
||||
|| (argv[1][0] == '+' && (ISDIGIT (argv[1][1])
|
||||
|| argv[1][1] == 0))))
|
||||
{
|
||||
/* Old option syntax: a dash or plus, one or more digits (zero digits
|
||||
are acceptable with a plus), and one or more option letters. */
|
||||
if (argv[1][0] == '+')
|
||||
from_start = 1;
|
||||
if (argv[1][1] != '\0')
|
||||
{
|
||||
strtol_error s_err;
|
||||
char *p;
|
||||
|
||||
s_err = xstrtol (++argv[1], &p, 0, &tmp_long, "bkm");
|
||||
n_units = tmp_long;
|
||||
if (s_err == LONGINT_OVERFLOW)
|
||||
{
|
||||
STRTOL_FATAL_ERROR (argv[1], _("argument"), s_err);
|
||||
}
|
||||
|
||||
/* If a [bkm] suffix was given then count bytes, not lines. */
|
||||
if (p[-1] == 'b' || p[-1] == 'k' || p[-1] == 'm')
|
||||
count_lines = 0;
|
||||
|
||||
/* Parse any appended option letters. */
|
||||
while (*p)
|
||||
{
|
||||
switch (*p)
|
||||
{
|
||||
case 'c':
|
||||
/* Interpret N_UNITS as # of bytes. */
|
||||
count_lines = 0;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
forever = 1;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
count_lines = 1;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
header_mode = never;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
header_mode = always;
|
||||
break;
|
||||
|
||||
default:
|
||||
error (0, 0, _("unrecognized option `-%c'"), *p);
|
||||
usage (1);
|
||||
}
|
||||
++p;
|
||||
}
|
||||
}
|
||||
/* Make the options we just parsed invisible to getopt. */
|
||||
argv[1] = argv[0];
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
|
||||
while ((c = getopt_long (argc, argv, "c:n:fqv", long_options, (int *) 0))
|
||||
!= EOF)
|
||||
{
|
||||
strtol_error s_err;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
count_lines = 0;
|
||||
goto getnum;
|
||||
|
||||
case 'n':
|
||||
count_lines = 1;
|
||||
getnum:
|
||||
if (*optarg == '+')
|
||||
{
|
||||
from_start = 1;
|
||||
}
|
||||
|
||||
s_err = xstrtol (optarg, NULL, 0, &tmp_long, "bkm");
|
||||
if (tmp_long < 0)
|
||||
tmp_long = -tmp_long;
|
||||
n_units = tmp_long;
|
||||
if (s_err != LONGINT_OK)
|
||||
{
|
||||
STRTOL_FATAL_ERROR (optarg, (c == 'n'
|
||||
? _("number of lines")
|
||||
: _("number of bytes")), s_err);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
forever = 1;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
header_mode = never;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
header_mode = always;
|
||||
break;
|
||||
|
||||
default:
|
||||
usage (1);
|
||||
}
|
||||
}
|
||||
{
|
||||
int found_obsolescent;
|
||||
int fail;
|
||||
found_obsolescent = parse_obsolescent_option (argc,
|
||||
(const char *const *) argv,
|
||||
&n_units, &fail);
|
||||
if (found_obsolescent)
|
||||
{
|
||||
if (fail)
|
||||
exit (EXIT_FAILURE);
|
||||
optind = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
parse_options (argc, argv, &n_units, &header_mode);
|
||||
}
|
||||
}
|
||||
|
||||
if (show_version)
|
||||
{
|
||||
@@ -984,9 +1095,6 @@ main (int argc, char **argv)
|
||||
if (show_help)
|
||||
usage (0);
|
||||
|
||||
if (n_units == -1)
|
||||
n_units = DEFAULT_N_LINES;
|
||||
|
||||
/* To start printing with item N_UNITS from the start of the file, skip
|
||||
N_UNITS - 1 items. `tail +0' is actually meaningless, but for Unix
|
||||
compatibility it's treated the same as `tail +1'. */
|
||||
|
||||
2
src/tr.c
2
src/tr.c
@@ -450,7 +450,7 @@ is_char_class_member (enum Char_class char_class, unsigned int c)
|
||||
result = ISCNTRL (c);
|
||||
break;
|
||||
case CC_DIGIT:
|
||||
result = ISDIGIT (c);
|
||||
result = ISDIGIT_LOCALE (c);
|
||||
break;
|
||||
case CC_GRAPH:
|
||||
result = ISGRAPH (c);
|
||||
|
||||
12
src/uniq.c
12
src/uniq.c
@@ -12,8 +12,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
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 Richard Stallman and David MacKenzie. */
|
||||
|
||||
@@ -336,7 +336,7 @@ main (int argc, char **argv)
|
||||
case 'f': /* Like '-#'. */
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid number of fields to skip: `%s'"),
|
||||
@@ -352,7 +352,7 @@ main (int argc, char **argv)
|
||||
case 's': /* Like '+#'. */
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid number of bytes to skip: `%s'"),
|
||||
@@ -368,7 +368,7 @@ main (int argc, char **argv)
|
||||
case 'w':
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid number of bytes to compare: `%s'"),
|
||||
@@ -399,7 +399,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
char *opt_str = argv[optind++];
|
||||
long int tmp_long;
|
||||
if (xstrtol (opt_str, NULL, 10, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtol (opt_str, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("invalid number of bytes to compare: `%s'"),
|
||||
|
||||
118
src/who-users.c
118
src/who-users.c
@@ -41,45 +41,58 @@
|
||||
#include <time.h>
|
||||
#include <getopt.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
|
||||
#if !defined (UTMP_FILE) && defined (_PATH_UTMP) /* 4.4BSD. */
|
||||
#define UTMP_FILE _PATH_UTMP
|
||||
#if !defined (UTMP_FILE) && defined (_PATH_UTMP)
|
||||
# define UTMP_FILE _PATH_UTMP
|
||||
#endif
|
||||
|
||||
#if defined (UTMPX_FILE) /* Solaris, SysVr4 */
|
||||
#undef UTMP_FILE
|
||||
#define UTMP_FILE UTMPX_FILE
|
||||
#if !defined (WTMP_FILE) && defined (_PATH_WTMP)
|
||||
# define WTMP_FILE _PATH_WTMP
|
||||
#endif
|
||||
|
||||
#ifdef UTMPX_FILE /* Solaris, SysVr4 */
|
||||
# undef UTMP_FILE
|
||||
# define UTMP_FILE UTMPX_FILE
|
||||
#endif
|
||||
|
||||
#ifdef WTMPX_FILE /* Solaris, SysVr4 */
|
||||
# undef WTMP_FILE
|
||||
# define WTMP_FILE WTMPX_FILE
|
||||
#endif
|
||||
|
||||
#ifndef UTMP_FILE
|
||||
#define UTMP_FILE "/etc/utmp"
|
||||
# define UTMP_FILE "/etc/utmp"
|
||||
#endif
|
||||
|
||||
#ifndef WTMP_FILE
|
||||
# define WTMP_FILE "/etc/wtmp"
|
||||
#endif
|
||||
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
#define MAXHOSTNAMELEN 64
|
||||
# define MAXHOSTNAMELEN 64
|
||||
#endif
|
||||
|
||||
#ifndef S_IWGRP
|
||||
#define S_IWGRP 020
|
||||
# define S_IWGRP 020
|
||||
#endif
|
||||
|
||||
#ifdef WHO
|
||||
#define COMMAND_NAME "who"
|
||||
#else
|
||||
#ifdef USERS
|
||||
#define COMMAND_NAME "users"
|
||||
#else
|
||||
#ifdef UPTIME
|
||||
#define COMMAND_NAME "uptime"
|
||||
# define COMMAND_NAME "who"
|
||||
#else
|
||||
# ifdef USERS
|
||||
# define COMMAND_NAME "users"
|
||||
# else
|
||||
# ifdef UPTIME
|
||||
# define COMMAND_NAME "uptime"
|
||||
# else
|
||||
error You must define one of WHO, UPTIME or USERS.
|
||||
#endif /* UPTIME */
|
||||
#endif /* USERS */
|
||||
# endif /* UPTIME */
|
||||
# endif /* USERS */
|
||||
#endif /* WHO */
|
||||
|
||||
int gethostname ();
|
||||
@@ -146,7 +159,7 @@ print_uptime (int n)
|
||||
struct tm *tmn;
|
||||
double avg[3];
|
||||
int loads;
|
||||
#ifdef HAVE_PROC_UPTIME
|
||||
# ifdef HAVE_PROC_UPTIME
|
||||
FILE *fp;
|
||||
double upsecs;
|
||||
|
||||
@@ -161,34 +174,34 @@ print_uptime (int n)
|
||||
uptime = (time_t) upsecs;
|
||||
fclose (fp);
|
||||
}
|
||||
#endif /* HAVE_PROC_UPTIME */
|
||||
# endif /* HAVE_PROC_UPTIME */
|
||||
/* Loop through all the utmp entries we just read and count up the valid
|
||||
ones, also in the process possibly gleaning boottime. */
|
||||
while (n--)
|
||||
{
|
||||
if (this->ut_name[0]
|
||||
#ifdef USER_PROCESS
|
||||
# ifdef USER_PROCESS
|
||||
&& this->ut_type == USER_PROCESS
|
||||
#endif
|
||||
# endif
|
||||
)
|
||||
{
|
||||
++entries;
|
||||
}
|
||||
/* If BOOT_MSG is defined, we can get boottime from utmp. This avoids
|
||||
possibly needing special privs to read /dev/kmem. */
|
||||
#ifdef BOOT_MSG
|
||||
# if HAVE_PROC_UPTIME
|
||||
# ifdef BOOT_MSG
|
||||
# if HAVE_PROC_UPTIME
|
||||
if (uptime == 0)
|
||||
# endif /* HAVE_PROC_UPTIME */
|
||||
# endif /* HAVE_PROC_UPTIME */
|
||||
if (!strcmp (this->ut_line, BOOT_MSG))
|
||||
boot_time = UT_TIME_MEMBER (this);
|
||||
#endif /* BOOT_MSG */
|
||||
# endif /* BOOT_MSG */
|
||||
++this;
|
||||
}
|
||||
time_now = time (0);
|
||||
#if defined HAVE_PROC_UPTIME
|
||||
# if defined HAVE_PROC_UPTIME
|
||||
if (uptime == 0)
|
||||
#endif
|
||||
# endif
|
||||
{
|
||||
if (boot_time == 0)
|
||||
error (1, errno, _("couldn't get boot time"));
|
||||
@@ -206,11 +219,11 @@ print_uptime (int n)
|
||||
printf (" %2d:%02d, %d %s", uphours, upmins, entries,
|
||||
(entries == 1) ? _("user") : _("users"));
|
||||
|
||||
#if defined (HAVE_GETLOADAVG) || defined (C_GETLOADAVG)
|
||||
# if defined (HAVE_GETLOADAVG) || defined (C_GETLOADAVG)
|
||||
loads = getloadavg (avg, 3);
|
||||
#else
|
||||
# else
|
||||
loads = -1;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (loads == -1)
|
||||
putchar ('\n');
|
||||
@@ -290,8 +303,8 @@ print_entry (STRUCT_UTMP *this)
|
||||
time_t last_change;
|
||||
char mesg;
|
||||
|
||||
#define DEV_DIR_WITH_TRAILING_SLASH "/dev/"
|
||||
#define DEV_DIR_LEN (sizeof (DEV_DIR_WITH_TRAILING_SLASH) - 1)
|
||||
# define DEV_DIR_WITH_TRAILING_SLASH "/dev/"
|
||||
# define DEV_DIR_LEN (sizeof (DEV_DIR_WITH_TRAILING_SLASH) - 1)
|
||||
|
||||
char line[sizeof (this->ut_line) + DEV_DIR_LEN + 1];
|
||||
time_t tm;
|
||||
@@ -343,7 +356,7 @@ print_entry (STRUCT_UTMP *this)
|
||||
else
|
||||
printf (" . ");
|
||||
}
|
||||
#ifdef HAVE_UT_HOST
|
||||
# ifdef HAVE_UT_HOST
|
||||
if (this->ut_host[0])
|
||||
{
|
||||
extern char *canon_host ();
|
||||
@@ -370,7 +383,7 @@ print_entry (STRUCT_UTMP *this)
|
||||
else
|
||||
printf (" (%s)", host);
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
putchar ('\n');
|
||||
}
|
||||
@@ -388,9 +401,9 @@ list_entries_who (int n)
|
||||
while (n--)
|
||||
{
|
||||
if (this->ut_name[0]
|
||||
#ifdef USER_PROCESS
|
||||
# ifdef USER_PROCESS
|
||||
&& this->ut_type == USER_PROCESS
|
||||
#endif
|
||||
# endif
|
||||
)
|
||||
{
|
||||
char *trimmed_name;
|
||||
@@ -431,9 +444,9 @@ list_entries_users (int n)
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
if (this->ut_name[0]
|
||||
#ifdef USER_PROCESS
|
||||
# ifdef USER_PROCESS
|
||||
&& this->ut_type == USER_PROCESS
|
||||
#endif
|
||||
# endif
|
||||
)
|
||||
{
|
||||
char *trimmed_name;
|
||||
@@ -491,9 +504,9 @@ scan_entries (int n)
|
||||
while (n--)
|
||||
{
|
||||
if (this->ut_name[0]
|
||||
#ifdef USER_PROCESS
|
||||
# ifdef USER_PROCESS
|
||||
&& this->ut_type == USER_PROCESS
|
||||
#endif
|
||||
# endif
|
||||
)
|
||||
print_entry (this);
|
||||
this++;
|
||||
@@ -550,13 +563,13 @@ who (char *filename)
|
||||
else
|
||||
scan_entries (users);
|
||||
#else
|
||||
#ifdef USERS
|
||||
# ifdef USERS
|
||||
list_entries_users (users);
|
||||
#else
|
||||
#ifdef UPTIME
|
||||
# else
|
||||
# ifdef UPTIME
|
||||
print_uptime (users);
|
||||
#endif /* UPTIME */
|
||||
#endif /* USERS */
|
||||
# endif /* UPTIME */
|
||||
# endif /* USERS */
|
||||
#endif /* WHO */
|
||||
}
|
||||
|
||||
@@ -575,9 +588,9 @@ search_entries (int n, char *line)
|
||||
while (n--)
|
||||
{
|
||||
if (this->ut_name[0]
|
||||
#ifdef USER_PROCESS
|
||||
# ifdef USER_PROCESS
|
||||
&& this->ut_type == USER_PROCESS
|
||||
#endif
|
||||
# endif
|
||||
&& !strncmp (line, this->ut_line, sizeof (this->ut_line)))
|
||||
return this;
|
||||
this++;
|
||||
@@ -639,9 +652,9 @@ usage (int status)
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
If FILE not given, uses /etc/utmp. /etc/wtmp as FILE is common.\n\
|
||||
If FILE is not specified, use %s. %s as FILE is common.\n\
|
||||
If ARG1 ARG2 given, -m presumed: `am i' or `mom likes' are usual.\n\
|
||||
"));
|
||||
"), UTMP_FILE, WTMP_FILE);
|
||||
puts (_("\nReport bugs to sh-utils-bugs@gnu.ai.mit.edu"));
|
||||
}
|
||||
exit (status);
|
||||
@@ -660,10 +673,11 @@ usage (int status)
|
||||
printf (_("Usage: %s [OPTION]... [ FILE ]\n"), program_name);
|
||||
printf (_("\
|
||||
Output who is currently logged in according to FILE.\n\
|
||||
If FILE not given, uses /etc/utmp. /etc/wtmp as FILE is common.\n\
|
||||
If FILE is not specified, use %s. %s as FILE is common.\n\
|
||||
\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n"));
|
||||
--version output version information and exit\n"),
|
||||
UTMP_FILE, WTMP_FILE);
|
||||
puts (_("\nReport bugs to sh-utils-bugs@gnu.ai.mit.edu"));
|
||||
}
|
||||
exit (status);
|
||||
|
||||
3
tests/README
Normal file
3
tests/README
Normal file
@@ -0,0 +1,3 @@
|
||||
A note about Makefile.am.in.
|
||||
It is used (usually only by the maintainer) to generate most of the
|
||||
Makefile.am files in these subdirectories.
|
||||
@@ -5,3 +5,4 @@ t*.exp
|
||||
t*.err
|
||||
build-script
|
||||
Makefile
|
||||
mk-script
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
##test-files-begin
|
||||
x = cut
|
||||
t = t1 t2 t3 t4 t5 t6 t7 t8 t9 tA tB tC tD ta tb tc td te tf tg th \
|
||||
ti tj tk tl tm tn to tp tq tr ts tt tu tv tw tx ty tz
|
||||
explicit =
|
||||
maint_gen = t1.in t1.exp t2.in t2.exp t3.in t3.exp t4.in t4.exp t5.in t5.exp \
|
||||
t6.in t6.exp t7.in t7.exp t8.in t8.exp t9.in t9.exp ta.in ta.exp tb.in tb.exp \
|
||||
tc.in tc.exp td.in td.exp te.in te.exp tf.in tf.exp tg.in tg.exp th.in th.exp \
|
||||
ti.in ti.exp tj.in tj.exp tk.in tk.exp tl.in tl.exp tm.in tm.exp tn.in tn.exp \
|
||||
to.in to.exp tp.in tp.exp tq.in tq.exp tr.in tr.exp ts.in ts.exp tt.in tt.exp \
|
||||
tu.in tu.exp tv.in tv.exp tw.in tw.exp tx.in tx.exp ty.in ty.exp tz.in tz.exp \
|
||||
tempty-fl.in tempty-fl.exp tmissing-fl.in tmissing-fl.exp tempty-bl.in \
|
||||
tempty-bl.exp tmissing-bl.in tmissing-bl.exp
|
||||
run_gen = t1.out t1.err t2.out t2.err t3.out t3.err t4.out t4.err t5.out \
|
||||
t5.err t6.out t6.err t7.out t7.err t8.out t8.err t9.out t9.err ta.out ta.err \
|
||||
tb.out tb.err tc.out tc.err td.out td.err te.out te.err tf.out tf.err tg.out \
|
||||
tg.err th.out th.err ti.out ti.err tj.out tj.err tk.out tk.err tl.out tl.err \
|
||||
tm.out tm.err tn.out tn.err to.out to.err tp.out tp.err tq.out tq.err tr.out \
|
||||
tr.err ts.out ts.err tt.out tt.err tu.out tu.err tv.out tv.err tw.out tw.err \
|
||||
tx.out tx.err ty.out ty.err tz.out tz.err tempty-fl.out tempty-fl.err \
|
||||
tmissing-fl.out tmissing-fl.err tempty-bl.out tempty-bl.err tmissing-bl.out \
|
||||
tmissing-bl.err
|
||||
##test-files-end
|
||||
|
||||
in = $(t:=.in)
|
||||
exp = $(t:=.exp)
|
||||
out = $(t:=.out)
|
||||
err = $(t:=.err)
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(in) $(exp)
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -26,7 +39,19 @@ SUFFIXES = .pl
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp && chmod +x $@.tmp && mv $@.tmp $@
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(in) $(exp)
|
||||
CLEANFILES = $(out) $(err)
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
|
||||
@MAINT@rebuild-check: Test.pm mk-script
|
||||
@MAINT@ rb=rb-check; rm -f $rb; \
|
||||
@MAINT@ m_template=../Makefile.am.in; \
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $$rb; \
|
||||
@MAINT@ ./mk-script --list >> $$rb; \
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
|
||||
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
|
||||
|
||||
@@ -43,15 +43,26 @@ GMSGFMT = @GMSGFMT@
|
||||
CC = @CC@
|
||||
|
||||
x = cut
|
||||
t = t1 t2 t3 t4 t5 t6 t7 t8 t9 tA tB tC tD ta tb tc td te tf tg th \
|
||||
ti tj tk tl tm tn to tp tq tr ts tt tu tv tw tx ty tz
|
||||
explicit =
|
||||
maint_gen = t1.in t1.exp t2.in t2.exp t3.in t3.exp t4.in t4.exp t5.in t5.exp \
|
||||
t6.in t6.exp t7.in t7.exp t8.in t8.exp t9.in t9.exp ta.in ta.exp tb.in tb.exp \
|
||||
tc.in tc.exp td.in td.exp te.in te.exp tf.in tf.exp tg.in tg.exp th.in th.exp \
|
||||
ti.in ti.exp tj.in tj.exp tk.in tk.exp tl.in tl.exp tm.in tm.exp tn.in tn.exp \
|
||||
to.in to.exp tp.in tp.exp tq.in tq.exp tr.in tr.exp ts.in ts.exp tt.in tt.exp \
|
||||
tu.in tu.exp tv.in tv.exp tw.in tw.exp tx.in tx.exp ty.in ty.exp tz.in tz.exp \
|
||||
tempty-fl.in tempty-fl.exp tmissing-fl.in tmissing-fl.exp tempty-bl.in \
|
||||
tempty-bl.exp tmissing-bl.in tmissing-bl.exp
|
||||
run_gen = t1.out t1.err t2.out t2.err t3.out t3.err t4.out t4.err t5.out \
|
||||
t5.err t6.out t6.err t7.out t7.err t8.out t8.err t9.out t9.err ta.out ta.err \
|
||||
tb.out tb.err tc.out tc.err td.out td.err te.out te.err tf.out tf.err tg.out \
|
||||
tg.err th.out th.err ti.out ti.err tj.out tj.err tk.out tk.err tl.out tl.err \
|
||||
tm.out tm.err tn.out tn.err to.out to.err tp.out tp.err tq.out tq.err tr.out \
|
||||
tr.err ts.out ts.err tt.out tt.err tu.out tu.err tv.out tv.err tw.out tw.err \
|
||||
tx.out tx.err ty.out ty.err tz.out tz.err tempty-fl.out tempty-fl.err \
|
||||
tmissing-fl.out tmissing-fl.err tempty-bl.out tempty-bl.err tmissing-bl.out \
|
||||
tmissing-bl.err
|
||||
|
||||
in = $(t:=.in)
|
||||
exp = $(t:=.exp)
|
||||
out = $(t:=.out)
|
||||
err = $(t:=.err)
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(in) $(exp)
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -61,8 +72,8 @@ TESTS = $x-tests
|
||||
|
||||
SUFFIXES = .pl
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(in) $(exp)
|
||||
CLEANFILES = $(out) $(err)
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@@ -185,7 +196,19 @@ $x-tests: @MAINT@mk-script Test.pm
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp && chmod +x $@.tmp && mv $@.tmp $@
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
@MAINT@rebuild-check: Test.pm mk-script
|
||||
@MAINT@ rb=rb-check; rm -f $rb; \
|
||||
@MAINT@ m_template=../Makefile.am.in; \
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $$rb; \
|
||||
@MAINT@ ./mk-script --list >> $$rb; \
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
|
||||
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
||||
@@ -2,27 +2,26 @@ package Test;
|
||||
require 5.002;
|
||||
use strict;
|
||||
|
||||
my $nl = "\n";
|
||||
@Test::t = (
|
||||
my @tv = (
|
||||
# test flags input expected output expected return code
|
||||
#
|
||||
['1', '-d: -f1,3-', "a:b:c$nl", "a:c\n", 0],
|
||||
['1', '-d: -f1,3-', "a:b:c\n", "a:c\n", 0],
|
||||
['2', '-d: -f1,3-', "a:b:c\n", "a:c\n", 0],
|
||||
['3', '-d: -f2-', "a:b:c$nl", "b:c\n", 0],
|
||||
['4', '-d: -f4', "a:b:c$nl", "\n", 0],
|
||||
['3', '-d: -f2-', "a:b:c\n", "b:c\n", 0],
|
||||
['4', '-d: -f4', "a:b:c\n", "\n", 0],
|
||||
['5', '-d: -f4', "", "", 0],
|
||||
['6', '-c4', "123$nl", "\n", 0],
|
||||
['6', '-c4', "123\n", "\n", 0],
|
||||
['7', '-c4', "123", "\n", 0],
|
||||
['8', '-c4', "123\n1", "\n\n", 0],
|
||||
['9', '-c4', "", "", 0],
|
||||
['a', '-s -d: -f3-', "a:b:c$nl", "c\n", 0],
|
||||
['b', '-s -d: -f2,3', "a:b:c$nl", "b:c\n", 0],
|
||||
['c', '-s -d: -f1,3', "a:b:c$nl", "a:c\n", 0],
|
||||
['a', '-s -d: -f3-', "a:b:c\n", "c\n", 0],
|
||||
['b', '-s -d: -f2,3', "a:b:c\n", "b:c\n", 0],
|
||||
['c', '-s -d: -f1,3', "a:b:c\n", "a:c\n", 0],
|
||||
# Trailing colon should not be output
|
||||
['d', '-s -d: -f1,3', "a:b:c:$nl", "a:c\n", 0],
|
||||
['e', '-s -d: -f3-', "a:b:c:$nl", "c:\n", 0],
|
||||
['f', '-s -d: -f3-4', "a:b:c:$nl", "c:\n", 0],
|
||||
['g', '-s -d: -f3,4', "a:b:c:$nl", "c:\n", 0],
|
||||
['d', '-s -d: -f1,3', "a:b:c:\n", "a:c\n", 0],
|
||||
['e', '-s -d: -f3-', "a:b:c:\n", "c:\n", 0],
|
||||
['f', '-s -d: -f3-4', "a:b:c:\n", "c:\n", 0],
|
||||
['g', '-s -d: -f3,4', "a:b:c:\n", "c:\n", 0],
|
||||
# Make sure -s suppresses non-delimited lines
|
||||
['h', '-s -d: -f2,3', "abc\n", "", 0],
|
||||
#
|
||||
@@ -50,13 +49,18 @@ my $nl = "\n";
|
||||
# You must specify bytes or fields (or chars)
|
||||
['z', '', ":\n", "", 1],
|
||||
# Empty field list
|
||||
['A', '-f \'\'', ":\n", "", 1],
|
||||
['empty-fl', '-f \'\'', ":\n", "", 1],
|
||||
# Missing field list
|
||||
['B', '-f', ":\n", "", 1],
|
||||
['missing-fl', '-f', ":\n", "", 1],
|
||||
# Empty byte list
|
||||
['C', '-b \'\'', ":\n", "", 1],
|
||||
['empty-bl', '-b \'\'', ":\n", "", 1],
|
||||
# Missing byte list
|
||||
['D', '-b', ":\n", "", 1],
|
||||
['missing-bl', '-b', ":\n", "", 1],
|
||||
);
|
||||
|
||||
sub test_vector
|
||||
{
|
||||
return @tv;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
681
tests/cut/cut-tests
Executable file
681
tests/cut/cut-tests
Executable file
@@ -0,0 +1,681 @@
|
||||
#! /bin/sh
|
||||
# This script was generated automatically by build-script.
|
||||
case $# in
|
||||
0) xx='../../src/cut';;
|
||||
*) xx="$1";;
|
||||
esac
|
||||
test "$VERBOSE" && echo=echo || echo=:
|
||||
$echo testing program: $xx
|
||||
errors=0
|
||||
test "$srcdir" || srcdir=.
|
||||
test "$VERBOSE" && $xx --version 2> /dev/null
|
||||
$xx -d: -f1,3- $srcdir/t1.in > t1.out 2> t1.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 1 failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t1.out $srcdir/t1.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 1"; fi ;;
|
||||
1) $echo "Test 1 failed: files t1.out and $srcdir/t1.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 1 may have failed." 1>&2;
|
||||
$echo The command "cmp t1.out $srcdir/t1.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t1.err || rm -f t1.err
|
||||
$xx -d: -f1,3- $srcdir/t2.in > t2.out 2> t2.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 2 failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t2.out $srcdir/t2.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 2"; fi ;;
|
||||
1) $echo "Test 2 failed: files t2.out and $srcdir/t2.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 2 may have failed." 1>&2;
|
||||
$echo The command "cmp t2.out $srcdir/t2.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t2.err || rm -f t2.err
|
||||
$xx -d: -f2- $srcdir/t3.in > t3.out 2> t3.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 3 failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t3.out $srcdir/t3.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 3"; fi ;;
|
||||
1) $echo "Test 3 failed: files t3.out and $srcdir/t3.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 3 may have failed." 1>&2;
|
||||
$echo The command "cmp t3.out $srcdir/t3.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t3.err || rm -f t3.err
|
||||
$xx -d: -f4 $srcdir/t4.in > t4.out 2> t4.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 4 failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t4.out $srcdir/t4.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 4"; fi ;;
|
||||
1) $echo "Test 4 failed: files t4.out and $srcdir/t4.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 4 may have failed." 1>&2;
|
||||
$echo The command "cmp t4.out $srcdir/t4.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t4.err || rm -f t4.err
|
||||
$xx -d: -f4 $srcdir/t5.in > t5.out 2> t5.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 5 failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t5.out $srcdir/t5.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 5"; fi ;;
|
||||
1) $echo "Test 5 failed: files t5.out and $srcdir/t5.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 5 may have failed." 1>&2;
|
||||
$echo The command "cmp t5.out $srcdir/t5.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t5.err || rm -f t5.err
|
||||
$xx -c4 $srcdir/t6.in > t6.out 2> t6.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 6 failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t6.out $srcdir/t6.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 6"; fi ;;
|
||||
1) $echo "Test 6 failed: files t6.out and $srcdir/t6.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 6 may have failed." 1>&2;
|
||||
$echo The command "cmp t6.out $srcdir/t6.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t6.err || rm -f t6.err
|
||||
$xx -c4 $srcdir/t7.in > t7.out 2> t7.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 7 failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t7.out $srcdir/t7.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 7"; fi ;;
|
||||
1) $echo "Test 7 failed: files t7.out and $srcdir/t7.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 7 may have failed." 1>&2;
|
||||
$echo The command "cmp t7.out $srcdir/t7.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t7.err || rm -f t7.err
|
||||
$xx -c4 $srcdir/t8.in > t8.out 2> t8.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 8 failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t8.out $srcdir/t8.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 8"; fi ;;
|
||||
1) $echo "Test 8 failed: files t8.out and $srcdir/t8.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 8 may have failed." 1>&2;
|
||||
$echo The command "cmp t8.out $srcdir/t8.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t8.err || rm -f t8.err
|
||||
$xx -c4 $srcdir/t9.in > t9.out 2> t9.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 9 failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t9.out $srcdir/t9.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 9"; fi ;;
|
||||
1) $echo "Test 9 failed: files t9.out and $srcdir/t9.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 9 may have failed." 1>&2;
|
||||
$echo The command "cmp t9.out $srcdir/t9.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t9.err || rm -f t9.err
|
||||
$xx -s -d: -f3- $srcdir/ta.in > ta.out 2> ta.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test a failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp ta.out $srcdir/ta.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed a"; fi ;;
|
||||
1) $echo "Test a failed: files ta.out and $srcdir/ta.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test a may have failed." 1>&2;
|
||||
$echo The command "cmp ta.out $srcdir/ta.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s ta.err || rm -f ta.err
|
||||
$xx -s -d: -f2,3 $srcdir/tb.in > tb.out 2> tb.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test b failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tb.out $srcdir/tb.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed b"; fi ;;
|
||||
1) $echo "Test b failed: files tb.out and $srcdir/tb.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test b may have failed." 1>&2;
|
||||
$echo The command "cmp tb.out $srcdir/tb.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tb.err || rm -f tb.err
|
||||
$xx -s -d: -f1,3 $srcdir/tc.in > tc.out 2> tc.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test c failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tc.out $srcdir/tc.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed c"; fi ;;
|
||||
1) $echo "Test c failed: files tc.out and $srcdir/tc.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test c may have failed." 1>&2;
|
||||
$echo The command "cmp tc.out $srcdir/tc.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tc.err || rm -f tc.err
|
||||
$xx -s -d: -f1,3 $srcdir/td.in > td.out 2> td.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test d failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp td.out $srcdir/td.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed d"; fi ;;
|
||||
1) $echo "Test d failed: files td.out and $srcdir/td.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test d may have failed." 1>&2;
|
||||
$echo The command "cmp td.out $srcdir/td.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s td.err || rm -f td.err
|
||||
$xx -s -d: -f3- $srcdir/te.in > te.out 2> te.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test e failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp te.out $srcdir/te.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed e"; fi ;;
|
||||
1) $echo "Test e failed: files te.out and $srcdir/te.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test e may have failed." 1>&2;
|
||||
$echo The command "cmp te.out $srcdir/te.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s te.err || rm -f te.err
|
||||
$xx -s -d: -f3-4 $srcdir/tf.in > tf.out 2> tf.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test f failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tf.out $srcdir/tf.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed f"; fi ;;
|
||||
1) $echo "Test f failed: files tf.out and $srcdir/tf.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test f may have failed." 1>&2;
|
||||
$echo The command "cmp tf.out $srcdir/tf.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tf.err || rm -f tf.err
|
||||
$xx -s -d: -f3,4 $srcdir/tg.in > tg.out 2> tg.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test g failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tg.out $srcdir/tg.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed g"; fi ;;
|
||||
1) $echo "Test g failed: files tg.out and $srcdir/tg.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test g may have failed." 1>&2;
|
||||
$echo The command "cmp tg.out $srcdir/tg.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tg.err || rm -f tg.err
|
||||
$xx -s -d: -f2,3 $srcdir/th.in > th.out 2> th.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test h failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp th.out $srcdir/th.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed h"; fi ;;
|
||||
1) $echo "Test h failed: files th.out and $srcdir/th.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test h may have failed." 1>&2;
|
||||
$echo The command "cmp th.out $srcdir/th.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s th.err || rm -f th.err
|
||||
$xx -d: -f1-3 $srcdir/ti.in > ti.out 2> ti.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test i failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp ti.out $srcdir/ti.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed i"; fi ;;
|
||||
1) $echo "Test i failed: files ti.out and $srcdir/ti.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test i may have failed." 1>&2;
|
||||
$echo The command "cmp ti.out $srcdir/ti.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s ti.err || rm -f ti.err
|
||||
$xx -d: -f1-4 $srcdir/tj.in > tj.out 2> tj.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test j failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tj.out $srcdir/tj.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed j"; fi ;;
|
||||
1) $echo "Test j failed: files tj.out and $srcdir/tj.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test j may have failed." 1>&2;
|
||||
$echo The command "cmp tj.out $srcdir/tj.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tj.err || rm -f tj.err
|
||||
$xx -d: -f2-3 $srcdir/tk.in > tk.out 2> tk.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test k failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tk.out $srcdir/tk.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed k"; fi ;;
|
||||
1) $echo "Test k failed: files tk.out and $srcdir/tk.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test k may have failed." 1>&2;
|
||||
$echo The command "cmp tk.out $srcdir/tk.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tk.err || rm -f tk.err
|
||||
$xx -d: -f2-4 $srcdir/tl.in > tl.out 2> tl.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test l failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tl.out $srcdir/tl.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed l"; fi ;;
|
||||
1) $echo "Test l failed: files tl.out and $srcdir/tl.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test l may have failed." 1>&2;
|
||||
$echo The command "cmp tl.out $srcdir/tl.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tl.err || rm -f tl.err
|
||||
$xx -s -d: -f1-3 $srcdir/tm.in > tm.out 2> tm.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test m failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tm.out $srcdir/tm.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed m"; fi ;;
|
||||
1) $echo "Test m failed: files tm.out and $srcdir/tm.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test m may have failed." 1>&2;
|
||||
$echo The command "cmp tm.out $srcdir/tm.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tm.err || rm -f tm.err
|
||||
$xx -s -d: -f1-4 $srcdir/tn.in > tn.out 2> tn.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test n failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tn.out $srcdir/tn.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed n"; fi ;;
|
||||
1) $echo "Test n failed: files tn.out and $srcdir/tn.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test n may have failed." 1>&2;
|
||||
$echo The command "cmp tn.out $srcdir/tn.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tn.err || rm -f tn.err
|
||||
$xx -s -d: -f2-3 $srcdir/to.in > to.out 2> to.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test o failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp to.out $srcdir/to.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed o"; fi ;;
|
||||
1) $echo "Test o failed: files to.out and $srcdir/to.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test o may have failed." 1>&2;
|
||||
$echo The command "cmp to.out $srcdir/to.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s to.err || rm -f to.err
|
||||
$xx -s -d: -f2-4 $srcdir/tp.in > tp.out 2> tp.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test p failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tp.out $srcdir/tp.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed p"; fi ;;
|
||||
1) $echo "Test p failed: files tp.out and $srcdir/tp.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test p may have failed." 1>&2;
|
||||
$echo The command "cmp tp.out $srcdir/tp.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tp.err || rm -f tp.err
|
||||
$xx -s -d: -f2-4 $srcdir/tq.in > tq.out 2> tq.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test q failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tq.out $srcdir/tq.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed q"; fi ;;
|
||||
1) $echo "Test q failed: files tq.out and $srcdir/tq.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test q may have failed." 1>&2;
|
||||
$echo The command "cmp tq.out $srcdir/tq.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tq.err || rm -f tq.err
|
||||
$xx -s -d: -f2-4 $srcdir/tr.in > tr.out 2> tr.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test r failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tr.out $srcdir/tr.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed r"; fi ;;
|
||||
1) $echo "Test r failed: files tr.out and $srcdir/tr.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test r may have failed." 1>&2;
|
||||
$echo The command "cmp tr.out $srcdir/tr.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tr.err || rm -f tr.err
|
||||
$xx -s -d: -f1-4 $srcdir/ts.in > ts.out 2> ts.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test s failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp ts.out $srcdir/ts.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed s"; fi ;;
|
||||
1) $echo "Test s failed: files ts.out and $srcdir/ts.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test s may have failed." 1>&2;
|
||||
$echo The command "cmp ts.out $srcdir/ts.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s ts.err || rm -f ts.err
|
||||
$xx -s -d: -f3- $srcdir/tt.in > tt.out 2> tt.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test t failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tt.out $srcdir/tt.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed t"; fi ;;
|
||||
1) $echo "Test t failed: files tt.out and $srcdir/tt.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test t may have failed." 1>&2;
|
||||
$echo The command "cmp tt.out $srcdir/tt.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tt.err || rm -f tt.err
|
||||
$xx -s -f3- $srcdir/tu.in > tu.out 2> tu.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test u failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tu.out $srcdir/tu.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed u"; fi ;;
|
||||
1) $echo "Test u failed: files tu.out and $srcdir/tu.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test u may have failed." 1>&2;
|
||||
$echo The command "cmp tu.out $srcdir/tu.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tu.err || rm -f tu.err
|
||||
$xx -f3- $srcdir/tv.in > tv.out 2> tv.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test v failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tv.out $srcdir/tv.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed v"; fi ;;
|
||||
1) $echo "Test v failed: files tv.out and $srcdir/tv.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test v may have failed." 1>&2;
|
||||
$echo The command "cmp tv.out $srcdir/tv.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tv.err || rm -f tv.err
|
||||
$xx -b 1 $srcdir/tw.in > tw.out 2> tw.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test w failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tw.out $srcdir/tw.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed w"; fi ;;
|
||||
1) $echo "Test w failed: files tw.out and $srcdir/tw.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test w may have failed." 1>&2;
|
||||
$echo The command "cmp tw.out $srcdir/tw.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tw.err || rm -f tw.err
|
||||
$xx -s -d: -f2-4 $srcdir/tx.in > tx.out 2> tx.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test x failed: ../../src/cut return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tx.out $srcdir/tx.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed x"; fi ;;
|
||||
1) $echo "Test x failed: files tx.out and $srcdir/tx.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test x may have failed." 1>&2;
|
||||
$echo The command "cmp tx.out $srcdir/tx.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tx.err || rm -f tx.err
|
||||
$xx -s -b4 $srcdir/ty.in > ty.out 2> ty.err
|
||||
code=$?
|
||||
if test $code != 1 ; then
|
||||
$echo "Test y failed: ../../src/cut return code $code differs from expected value 1" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp ty.out $srcdir/ty.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed y"; fi ;;
|
||||
1) $echo "Test y failed: files ty.out and $srcdir/ty.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test y may have failed." 1>&2;
|
||||
$echo The command "cmp ty.out $srcdir/ty.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s ty.err || rm -f ty.err
|
||||
$xx $srcdir/tz.in > tz.out 2> tz.err
|
||||
code=$?
|
||||
if test $code != 1 ; then
|
||||
$echo "Test z failed: ../../src/cut return code $code differs from expected value 1" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tz.out $srcdir/tz.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed z"; fi ;;
|
||||
1) $echo "Test z failed: files tz.out and $srcdir/tz.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test z may have failed." 1>&2;
|
||||
$echo The command "cmp tz.out $srcdir/tz.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tz.err || rm -f tz.err
|
||||
$xx -f '' $srcdir/tempty-fl.in > tempty-fl.out 2> tempty-fl.err
|
||||
code=$?
|
||||
if test $code != 1 ; then
|
||||
$echo "Test empty-fl failed: ../../src/cut return code $code differs from expected value 1" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tempty-fl.out $srcdir/tempty-fl.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed empty-fl"; fi ;;
|
||||
1) $echo "Test empty-fl failed: files tempty-fl.out and $srcdir/tempty-fl.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test empty-fl may have failed." 1>&2;
|
||||
$echo The command "cmp tempty-fl.out $srcdir/tempty-fl.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tempty-fl.err || rm -f tempty-fl.err
|
||||
$xx -f $srcdir/tmissing-fl.in > tmissing-fl.out 2> tmissing-fl.err
|
||||
code=$?
|
||||
if test $code != 1 ; then
|
||||
$echo "Test missing-fl failed: ../../src/cut return code $code differs from expected value 1" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tmissing-fl.out $srcdir/tmissing-fl.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed missing-fl"; fi ;;
|
||||
1) $echo "Test missing-fl failed: files tmissing-fl.out and $srcdir/tmissing-fl.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test missing-fl may have failed." 1>&2;
|
||||
$echo The command "cmp tmissing-fl.out $srcdir/tmissing-fl.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tmissing-fl.err || rm -f tmissing-fl.err
|
||||
$xx -b '' $srcdir/tempty-bl.in > tempty-bl.out 2> tempty-bl.err
|
||||
code=$?
|
||||
if test $code != 1 ; then
|
||||
$echo "Test empty-bl failed: ../../src/cut return code $code differs from expected value 1" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tempty-bl.out $srcdir/tempty-bl.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed empty-bl"; fi ;;
|
||||
1) $echo "Test empty-bl failed: files tempty-bl.out and $srcdir/tempty-bl.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test empty-bl may have failed." 1>&2;
|
||||
$echo The command "cmp tempty-bl.out $srcdir/tempty-bl.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tempty-bl.err || rm -f tempty-bl.err
|
||||
$xx -b $srcdir/tmissing-bl.in > tmissing-bl.out 2> tmissing-bl.err
|
||||
code=$?
|
||||
if test $code != 1 ; then
|
||||
$echo "Test missing-bl failed: ../../src/cut return code $code differs from expected value 1" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp tmissing-bl.out $srcdir/tmissing-bl.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed missing-bl"; fi ;;
|
||||
1) $echo "Test missing-bl failed: files tmissing-bl.out and $srcdir/tmissing-bl.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test missing-bl may have failed." 1>&2;
|
||||
$echo The command "cmp tmissing-bl.out $srcdir/tmissing-bl.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s tmissing-bl.err || rm -f tmissing-bl.err
|
||||
if test $errors = 0 ; then
|
||||
$echo Passed all 39 tests. 1>&2
|
||||
else
|
||||
$echo Failed $errors tests. 1>&2
|
||||
fi
|
||||
test $errors = 0 || errors=1
|
||||
exit $errors
|
||||
@@ -3,16 +3,197 @@
|
||||
# @configure_input@
|
||||
|
||||
require 5.002;
|
||||
use strict;
|
||||
use POSIX qw (assert);
|
||||
|
||||
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
|
||||
use strict;
|
||||
use Test;
|
||||
|
||||
$| = 1;
|
||||
sub validate
|
||||
{
|
||||
my %seen;
|
||||
my $test_vector;
|
||||
foreach $test_vector (Test::test_vector ())
|
||||
{
|
||||
my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
|
||||
@$test_vector;
|
||||
die "wrong number of elements in test $test_name\n"
|
||||
if (!defined $e_ret_code || defined $rest);
|
||||
assert (!ref $test_name);
|
||||
assert (!ref $flags);
|
||||
assert (!ref $e_ret_code);
|
||||
|
||||
my $xx = $ARGV[0];
|
||||
die "$0: $.: duplicate test name \`$test_name'\n"
|
||||
if (defined $seen{$test_name});
|
||||
$seen{$test_name} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
# Given a spec for the input file(s) or expected output file of a single
|
||||
# test, create a file for any string. A file is created for each literal
|
||||
# string -- not for named files. Whether a perl `string' is treated as
|
||||
# a string to be put in a file for a test or the name of an existing file
|
||||
# depends on how many references have to be traversed to get from
|
||||
# the top level variable to the actual string literal.
|
||||
# If $SPEC is a literal Perl string (not a reference), then treat $SPEC
|
||||
# as the contents of a file.
|
||||
# If $SPEC is a hash reference, then there are no inputs.
|
||||
# If $SPEC is an array reference, consider each element of the array.
|
||||
# If the element is a string reference, treat the string as the name of
|
||||
# an existing file. Otherwise, the element must be a string and is treated
|
||||
# just like a scalar $SPEC. When a file is created, its name is derived
|
||||
# from the name TEST_NAME of the corresponding test and the TYPE of file.
|
||||
# E.g., the inputs for test `3a' would be named t3a.in1 and t3a.in2, and
|
||||
# the expected output for test `7c' would be named t7c.exp.
|
||||
#
|
||||
# Also, return two lists of file names:
|
||||
# - maintainer-generated files -- names of files created by this function
|
||||
# - files named explicitly in Test.pm
|
||||
|
||||
sub spec_to_list ($$$)
|
||||
{
|
||||
my ($spec, $test_name, $type) = @_;
|
||||
|
||||
assert ($type eq 'in' || $type eq 'exp');
|
||||
|
||||
my @explicit_file;
|
||||
my @maint_gen_file;
|
||||
my @content_string;
|
||||
|
||||
# If SPEC is a hash reference, return empty lists.
|
||||
if (ref $spec eq 'HASH')
|
||||
{
|
||||
assert ($type eq 'in');
|
||||
return {
|
||||
EXPLICIT => \@explicit_file,
|
||||
MAINT_GEN => \@maint_gen_file
|
||||
};
|
||||
}
|
||||
|
||||
if (ref $spec)
|
||||
{
|
||||
assert (ref $spec eq 'ARRAY' || ref $spec eq 'HASH');
|
||||
my $file_spec;
|
||||
foreach $file_spec (@$spec)
|
||||
{
|
||||
# A file spec may be a string or a reference.
|
||||
# If it's a string, that string is to be the contents of a
|
||||
# generated (by this script) file with name derived from the
|
||||
# name of this test.
|
||||
# If it's a reference, then it must be the name of an existing
|
||||
# file.
|
||||
if (ref $file_spec)
|
||||
{
|
||||
my $r = ref $file_spec;
|
||||
die "bad test: $test_name is $r\n"
|
||||
if ref $file_spec ne 'SCALAR';
|
||||
my $existing_file = $$file_spec;
|
||||
# FIXME: make sure $existing_file exists somewhere.
|
||||
push (@explicit_file, $existing_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
push (@content_string, $file_spec);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
push (@content_string, $spec);
|
||||
}
|
||||
|
||||
my $i = 1;
|
||||
my $file_contents;
|
||||
foreach $file_contents (@content_string)
|
||||
{
|
||||
my $suffix = (@content_string > 1 ? $i : '');
|
||||
my $maint_gen_file = "t$test_name.$type$suffix";
|
||||
push (@maint_gen_file, $maint_gen_file);
|
||||
open (F, ">$maint_gen_file") || die "$0: $maint_gen_file: $!\n";
|
||||
print F $file_contents;
|
||||
close (F) || die "$0: $maint_gen_file: $!\n";
|
||||
++$i;
|
||||
}
|
||||
|
||||
my %h = (
|
||||
EXPLICIT => \@explicit_file,
|
||||
MAINT_GEN => \@maint_gen_file
|
||||
);
|
||||
|
||||
return \%h;
|
||||
}
|
||||
|
||||
sub wrap
|
||||
{
|
||||
my ($preferred_line_len, @tok) = @_;
|
||||
assert ($preferred_line_len > 0);
|
||||
my @lines;
|
||||
my $line = '';
|
||||
my $word;
|
||||
foreach $word (@tok)
|
||||
{
|
||||
if ($line && length ($line) + 1 + length ($word) > $preferred_line_len)
|
||||
{
|
||||
push (@lines, $line);
|
||||
$line = $word;
|
||||
next;
|
||||
}
|
||||
my $sp = ($line ? ' ' : '');
|
||||
$line .= "$sp$word";
|
||||
}
|
||||
push (@lines, $line);
|
||||
return @lines;
|
||||
}
|
||||
|
||||
# ~~~~~~~ main ~~~~~~~~
|
||||
{
|
||||
$| = 1;
|
||||
|
||||
die "Usage: $0: program-name\n" if @ARGV != 1;
|
||||
|
||||
my $xx = $ARGV[0];
|
||||
|
||||
if ($xx eq '--list')
|
||||
{
|
||||
validate ();
|
||||
# Output three lists of files:
|
||||
# EXPLICIT -- file names specified in Test.pm
|
||||
# MAINT_GEN -- maintainer-generated files
|
||||
# RUN_GEN -- files created when running the tests
|
||||
my $test_vector;
|
||||
my @exp;
|
||||
my @maint;
|
||||
my @run;
|
||||
foreach $test_vector (Test::test_vector ())
|
||||
{
|
||||
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
|
||||
= @$test_vector;
|
||||
|
||||
push (@run, ("t$test_name.out", "t$test_name.err"));
|
||||
|
||||
my $in = spec_to_list ($in_spec, $test_name, 'in');
|
||||
push (@exp, @{$in->{EXPLICIT}});
|
||||
push (@maint, @{$in->{MAINT_GEN}});
|
||||
|
||||
my $e = spec_to_list ($exp_spec, $test_name, 'exp');
|
||||
push (@exp, @{$e->{EXPLICIT}});
|
||||
push (@maint, @{$e->{MAINT_GEN}});
|
||||
}
|
||||
|
||||
# The list of explicitly mentioned files may contain duplicates.
|
||||
# Eliminated any duplicates.
|
||||
my %e = map {$_ => 1} @exp;
|
||||
@exp = sort keys %e;
|
||||
|
||||
my $len = 77;
|
||||
print join (" \\\n", wrap ($len, 'explicit =', @exp)), "\n";
|
||||
print join (" \\\n", wrap ($len, 'maint_gen =', @maint)), "\n";
|
||||
print join (" \\\n", wrap ($len, 'run_gen =', @run)), "\n";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
#! /bin/sh
|
||||
# This script was generated automatically by build-script.
|
||||
case \$# in
|
||||
@@ -26,63 +207,73 @@ test "\$srcdir" || srcdir=.
|
||||
test "\$VERBOSE" && \$xx --version 2> /dev/null
|
||||
EOF
|
||||
|
||||
my %seen;
|
||||
validate ();
|
||||
|
||||
my $test_vector;
|
||||
foreach $test_vector (@Test::t)
|
||||
{
|
||||
my ($test_name, $flags, $file1, $file2, $expected, $e_ret_code)
|
||||
= @{$test_vector};
|
||||
die "$0: $.: duplicate test name \`$test_name'\n"
|
||||
if (defined ($seen{$test_name}));
|
||||
$seen{$test_name} = 1;
|
||||
foreach $test_vector (Test::test_vector ())
|
||||
{
|
||||
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
|
||||
= @$test_vector;
|
||||
|
||||
my $in1 = "t$test_name.in1";
|
||||
my $in2 = "t$test_name.in2";
|
||||
my $exp_name = "t$test_name.exp";
|
||||
my $out = "t$test_name.out";
|
||||
my $in = spec_to_list ($in_spec, $test_name, 'in');
|
||||
|
||||
open (IN1, ">$in1") || die "$0: $in1: $!\n";
|
||||
print IN1 $file1;
|
||||
close (IN1) || die "$0: $in1: $!\n";
|
||||
my @srcdir_rel_in_file;
|
||||
my $f;
|
||||
foreach $f (@{$in->{EXPLICIT}}, @{$in->{MAINT_GEN}})
|
||||
{
|
||||
push (@srcdir_rel_in_file, "\$srcdir/$f");
|
||||
}
|
||||
|
||||
open (IN2, ">$in2") || die "$0: $in2: $!\n";
|
||||
print IN2 $file2;
|
||||
close (IN2) || die "$0: $in2: $!\n";
|
||||
my $exp = spec_to_list ($exp_spec, $test_name, 'exp');
|
||||
my @all = (@{$exp->{EXPLICIT}}, @{$exp->{MAINT_GEN}});
|
||||
assert (@all == 1);
|
||||
my $exp_name = "\$srcdir/$all[0]";
|
||||
my $out = "t$test_name.out";
|
||||
my $err_output = "t$test_name.err";
|
||||
|
||||
open (EXP, ">$exp_name") || die "$0: $exp_name: $!\n";
|
||||
print EXP $expected;
|
||||
close (EXP) || die "$0: $exp_name: $!\n";
|
||||
|
||||
my $err_output = "t$test_name.err";
|
||||
my $cmd = "\$xx $flags \$srcdir/$in1 \$srcdir/$in2 > $out 2> $err_output";
|
||||
$exp_name = "\$srcdir/$exp_name";
|
||||
print <<EOF ;
|
||||
$cmd
|
||||
my $redirect_stdin = ((@srcdir_rel_in_file == 1
|
||||
&& defined $Test::input_via_stdin
|
||||
&& $Test::input_via_stdin)
|
||||
? '< ' : '');
|
||||
my $z = $Test::common_option_prefix if defined $Test::common_option_prefix;
|
||||
$z ||= '';
|
||||
my $env = $Test::env{$test_name} || $Test::default_env || [''];
|
||||
my $cmd = "\$xx $z$flags $redirect_stdin" . join (' ', @srcdir_rel_in_file)
|
||||
. " > $out 2> $err_output";
|
||||
my $e;
|
||||
foreach $e (@$env)
|
||||
{
|
||||
my $t_name = ($e ? "$test_name($e)" : $test_name);
|
||||
my $e_cmd = ($e ? "$e " : '');
|
||||
print <<EOF;
|
||||
$e_cmd$cmd
|
||||
code=\$?
|
||||
if test \$code != $e_ret_code ; then
|
||||
\$echo Test $test_name failed: $xx return code \$code differs from expected value $e_ret_code 1>&2
|
||||
\$echo "Test $t_name failed: $xx return code \$code differs from expected value $e_ret_code" 1>&2
|
||||
errors=`expr \$errors + 1`
|
||||
else
|
||||
cmp $out $exp_name
|
||||
case \$? in
|
||||
0) if test "\$VERBOSE" ; then \$echo passed $test_name; fi ;; # equal files
|
||||
1) \$echo Test $test_name failed: files $out and $exp_name differ 1>&2;
|
||||
0) if test "\$VERBOSE" ; then \$echo "passed $t_name"; fi ;;
|
||||
1) \$echo "Test $t_name failed: files $out and $exp_name differ" 1>&2;
|
||||
errors=`expr \$errors + 1` ;;
|
||||
2) \$echo Test $test_name may have failed. 1>&2;
|
||||
2) \$echo "Test $t_name may have failed." 1>&2;
|
||||
\$echo The command \"cmp $out $exp_name\" failed. 1>&2 ;
|
||||
errors=`expr \$errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s $err_output || rm -f $err_output
|
||||
EOF
|
||||
}
|
||||
}
|
||||
my $n_tests = Test::test_vector ();
|
||||
print <<EOF2 ;
|
||||
if test \$errors = 0 ; then
|
||||
\$echo Passed all tests. 1>&2
|
||||
\$echo Passed all $n_tests tests. 1>&2
|
||||
else
|
||||
\$echo Failed \$errors tests. 1>&2
|
||||
fi
|
||||
test \$errors = 0 || errors=1
|
||||
exit \$errors
|
||||
EOF2
|
||||
}
|
||||
|
||||
41
tests/date/Makefile.am
Normal file
41
tests/date/Makefile.am
Normal file
@@ -0,0 +1,41 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
##test-files-begin
|
||||
x = date
|
||||
explicit =
|
||||
maint_gen =
|
||||
##test-files-end
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
SUFFIXES = .pl
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
|
||||
@MAINT@rebuild-check: Test.pm mk-script
|
||||
@MAINT@ rb=rb-check; rm -f $rb; \
|
||||
@MAINT@ m_template=../Makefile.am.in; \
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $$rb; \
|
||||
@MAINT@ ./mk-script --list >> $$rb; \
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
|
||||
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
|
||||
200
tests/date/Makefile.in
Normal file
200
tests/date/Makefile.in
Normal file
@@ -0,0 +1,200 @@
|
||||
# Makefile.in generated automatically by automake 1.1l from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ../..
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
YACC = @YACC@
|
||||
RANLIB = @RANLIB@
|
||||
GENCAT = @GENCAT@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
CC = @CC@
|
||||
|
||||
x = date
|
||||
explicit =
|
||||
maint_gen =
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
SUFFIXES = .pl
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SCRIPTS = $(noinst_SCRIPTS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \
|
||||
$(TEXINFOS) $(MANS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .pl
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL)
|
||||
cd $(top_srcdir) && automake --gnu tests/date/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = tests/date
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
for tst in $(TESTS); do \
|
||||
all=`expr $$all + 1`; \
|
||||
if test -f $$tst; then dir=.; \
|
||||
else dir="$(srcdir)"; fi; \
|
||||
if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
|
||||
echo "PASS: $$tst"; \
|
||||
else \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "FAIL: $$tst"; \
|
||||
fi; \
|
||||
done; \
|
||||
if test "$$failed" -eq 0; then \
|
||||
echo "========================"; \
|
||||
echo "All $$all tests passed"; \
|
||||
echo "========================"; \
|
||||
else \
|
||||
echo "$$failed of $$all tests failed"; \
|
||||
fi
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE) check-TESTS
|
||||
installcheck:
|
||||
install-exec:
|
||||
$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall:
|
||||
|
||||
all: $(SCRIPTS) Makefile
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
rm -f Makefile $(DISTCLEANFILES)
|
||||
rm -f config.cache config.log stamp-h
|
||||
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-generic clean
|
||||
rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default tags distdir check-TESTS info dvi installcheck \
|
||||
install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
@MAINT@rebuild-check: Test.pm mk-script
|
||||
@MAINT@ rb=rb-check; rm -f $rb; \
|
||||
@MAINT@ m_template=../Makefile.am.in; \
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $$rb; \
|
||||
@MAINT@ ./mk-script --list >> $$rb; \
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
|
||||
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
45
tests/date/Test.pm
Normal file
45
tests/date/Test.pm
Normal file
@@ -0,0 +1,45 @@
|
||||
# -*-perl-*-
|
||||
package Test;
|
||||
require 5.002;
|
||||
use strict;
|
||||
|
||||
# For each test...
|
||||
# Export LANG=C so that the locale-dependent strings match.
|
||||
# Export TZ=UTC so that zone-dependent strings match.
|
||||
$Test::default_env = ['LANG=C TZ=UTC'];
|
||||
|
||||
sub test_vector
|
||||
{
|
||||
|
||||
my $d1 = '1997-01-19 08:17:48 +0';
|
||||
my @tvec =
|
||||
(
|
||||
# test-name options input expected-output expected-return-code
|
||||
#
|
||||
['1', "-d '$d1' +'%% %a %A %b %B'", {}, '% Sun Sunday Jan January', 0],
|
||||
['2', "-d '$d1' +'%c'", {}, 'Sun Jan 19 08:17:48 1997', 0],
|
||||
['3', "-d '$d1' +'%d_%D_%e_%h_%H'", {}, '19_01/19/97_19_Jan_08', 0],
|
||||
['4', "-d '$d1' +'%I_%j_%k_%l_%m'", {}, '08_019_ 8_ 8_01', 0],
|
||||
['5', "-d '$d1' +'%M_%n_%p_%r'", {}, "17_\n_AM_08:17:48 AM", 0],
|
||||
['6', "-d '$d1' +'%s_%S_%t_%T'", {}, "853661868_48_\t_08:17:48", 0],
|
||||
['7', "-d '$d1' +'%U_%V_%w_%W'", {}, '03_03_0_02', 0],
|
||||
['8', "-d '$d1' +'%x_%X_%y_%Y'", {}, '01/19/97_08:17:48_97_1997', 0],
|
||||
['9', "-d '$d1' +'%z_%Z'", {}, '+0000_GMT', 0],
|
||||
);
|
||||
|
||||
my @tv;
|
||||
my $t;
|
||||
foreach $t (@tvec)
|
||||
{
|
||||
my ($test_name, $flags, $in, $exp, $ret) = @$t;
|
||||
# Append a newline to end of each expected string.
|
||||
push (@tv, [$test_name, $flags, $in, "$exp\n", $ret]);
|
||||
}
|
||||
# Verify that the test-script generation code properly handles
|
||||
# per-test overrides.
|
||||
$Test::env{2} = ['LANG=C TZ=GMT'];
|
||||
|
||||
return @tv;
|
||||
}
|
||||
|
||||
1;
|
||||
171
tests/date/date-tests
Executable file
171
tests/date/date-tests
Executable file
@@ -0,0 +1,171 @@
|
||||
#! /bin/sh
|
||||
# This script was generated automatically by build-script.
|
||||
case $# in
|
||||
0) xx='../../src/date';;
|
||||
*) xx="$1";;
|
||||
esac
|
||||
test "$VERBOSE" && echo=echo || echo=:
|
||||
$echo testing program: $xx
|
||||
errors=0
|
||||
test "$srcdir" || srcdir=.
|
||||
test "$VERBOSE" && $xx --version 2> /dev/null
|
||||
LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%% %a %A %b %B' > t1.out 2> t1.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 1(LANG=C TZ=UTC) failed: ../../src/date return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t1.out $srcdir/t1.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 1(LANG=C TZ=UTC)"; fi ;;
|
||||
1) $echo "Test 1(LANG=C TZ=UTC) failed: files t1.out and $srcdir/t1.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 1(LANG=C TZ=UTC) may have failed." 1>&2;
|
||||
$echo The command "cmp t1.out $srcdir/t1.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t1.err || rm -f t1.err
|
||||
LANG=C TZ=GMT $xx -d '1997-01-19 08:17:48 +0' +'%c' > t2.out 2> t2.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 2(LANG=C TZ=GMT) failed: ../../src/date return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t2.out $srcdir/t2.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 2(LANG=C TZ=GMT)"; fi ;;
|
||||
1) $echo "Test 2(LANG=C TZ=GMT) failed: files t2.out and $srcdir/t2.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 2(LANG=C TZ=GMT) may have failed." 1>&2;
|
||||
$echo The command "cmp t2.out $srcdir/t2.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t2.err || rm -f t2.err
|
||||
LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%d_%D_%e_%h_%H' > t3.out 2> t3.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 3(LANG=C TZ=UTC) failed: ../../src/date return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t3.out $srcdir/t3.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 3(LANG=C TZ=UTC)"; fi ;;
|
||||
1) $echo "Test 3(LANG=C TZ=UTC) failed: files t3.out and $srcdir/t3.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 3(LANG=C TZ=UTC) may have failed." 1>&2;
|
||||
$echo The command "cmp t3.out $srcdir/t3.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t3.err || rm -f t3.err
|
||||
LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%I_%j_%k_%l_%m' > t4.out 2> t4.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 4(LANG=C TZ=UTC) failed: ../../src/date return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t4.out $srcdir/t4.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 4(LANG=C TZ=UTC)"; fi ;;
|
||||
1) $echo "Test 4(LANG=C TZ=UTC) failed: files t4.out and $srcdir/t4.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 4(LANG=C TZ=UTC) may have failed." 1>&2;
|
||||
$echo The command "cmp t4.out $srcdir/t4.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t4.err || rm -f t4.err
|
||||
LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%M_%n_%p_%r' > t5.out 2> t5.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 5(LANG=C TZ=UTC) failed: ../../src/date return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t5.out $srcdir/t5.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 5(LANG=C TZ=UTC)"; fi ;;
|
||||
1) $echo "Test 5(LANG=C TZ=UTC) failed: files t5.out and $srcdir/t5.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 5(LANG=C TZ=UTC) may have failed." 1>&2;
|
||||
$echo The command "cmp t5.out $srcdir/t5.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t5.err || rm -f t5.err
|
||||
LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%s_%S_%t_%T' > t6.out 2> t6.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 6(LANG=C TZ=UTC) failed: ../../src/date return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t6.out $srcdir/t6.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 6(LANG=C TZ=UTC)"; fi ;;
|
||||
1) $echo "Test 6(LANG=C TZ=UTC) failed: files t6.out and $srcdir/t6.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 6(LANG=C TZ=UTC) may have failed." 1>&2;
|
||||
$echo The command "cmp t6.out $srcdir/t6.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t6.err || rm -f t6.err
|
||||
LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%U_%V_%w_%W' > t7.out 2> t7.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 7(LANG=C TZ=UTC) failed: ../../src/date return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t7.out $srcdir/t7.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 7(LANG=C TZ=UTC)"; fi ;;
|
||||
1) $echo "Test 7(LANG=C TZ=UTC) failed: files t7.out and $srcdir/t7.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 7(LANG=C TZ=UTC) may have failed." 1>&2;
|
||||
$echo The command "cmp t7.out $srcdir/t7.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t7.err || rm -f t7.err
|
||||
LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%x_%X_%y_%Y' > t8.out 2> t8.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 8(LANG=C TZ=UTC) failed: ../../src/date return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t8.out $srcdir/t8.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 8(LANG=C TZ=UTC)"; fi ;;
|
||||
1) $echo "Test 8(LANG=C TZ=UTC) failed: files t8.out and $srcdir/t8.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 8(LANG=C TZ=UTC) may have failed." 1>&2;
|
||||
$echo The command "cmp t8.out $srcdir/t8.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t8.err || rm -f t8.err
|
||||
LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%z_%Z' > t9.out 2> t9.err
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 9(LANG=C TZ=UTC) failed: ../../src/date return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t9.out $srcdir/t9.exp
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 9(LANG=C TZ=UTC)"; fi ;;
|
||||
1) $echo "Test 9(LANG=C TZ=UTC) failed: files t9.out and $srcdir/t9.exp differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 9(LANG=C TZ=UTC) may have failed." 1>&2;
|
||||
$echo The command "cmp t9.out $srcdir/t9.exp" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t9.err || rm -f t9.err
|
||||
if test $errors = 0 ; then
|
||||
$echo Passed all 9 tests. 1>&2
|
||||
else
|
||||
$echo Failed $errors tests. 1>&2
|
||||
fi
|
||||
test $errors = 0 || errors=1
|
||||
exit $errors
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user