mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
378 Commits
CPPI-1_8
...
FILEUTILS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f318f5c4d8 | ||
|
|
30bbbfe67a | ||
|
|
f06dd61f03 | ||
|
|
67998a215f | ||
|
|
94767ce8cf | ||
|
|
577a8f346e | ||
|
|
daf6c50b95 | ||
|
|
b221cf780f | ||
|
|
2bc68d2234 | ||
|
|
d6f931281e | ||
|
|
ae9d89cfe2 | ||
|
|
263fb2dc15 | ||
|
|
e5e92e670c | ||
|
|
d85aac6782 | ||
|
|
d54655c623 | ||
|
|
18656b733d | ||
|
|
ac4936b7b1 | ||
|
|
742625303d | ||
|
|
9e2606d77b | ||
|
|
c8d0d0ca6f | ||
|
|
0e3fea79f3 | ||
|
|
dcfda51801 | ||
|
|
fad08d3f31 | ||
|
|
d362235eed | ||
|
|
6ff755a69a | ||
|
|
c4bb1d449e | ||
|
|
e673a685ac | ||
|
|
37e38b4941 | ||
|
|
9eabf6d99a | ||
|
|
8efb6d5f7b | ||
|
|
928b1b8300 | ||
|
|
211a6642e2 | ||
|
|
fd1d1eaa80 | ||
|
|
ad41cbff8a | ||
|
|
71611d94f3 | ||
|
|
9beeae646e | ||
|
|
67450be04d | ||
|
|
84264973d6 | ||
|
|
5239228c17 | ||
|
|
29940657ab | ||
|
|
a5ab9f78c3 | ||
|
|
01bbd27a4d | ||
|
|
df06c5de7b | ||
|
|
706235da55 | ||
|
|
403b4c49eb | ||
|
|
c6014bc847 | ||
|
|
c148112941 | ||
|
|
19b3a9d102 | ||
|
|
7f9c804f7a | ||
|
|
4bdc202a00 | ||
|
|
a80ec26277 | ||
|
|
fcdbd9ff15 | ||
|
|
108694f32a | ||
|
|
59b34eded2 | ||
|
|
622dcc58ee | ||
|
|
770b6c1bb5 | ||
|
|
56c1cbf2e8 | ||
|
|
bd485671ff | ||
|
|
43be299a76 | ||
|
|
1493e0d650 | ||
|
|
592e22d509 | ||
|
|
c8e070ed62 | ||
|
|
ceb3908c6f | ||
|
|
4468f22968 | ||
|
|
eb3dc6a095 | ||
|
|
4a65486da9 | ||
|
|
07872e486f | ||
|
|
5aba961278 | ||
|
|
9be1481d17 | ||
|
|
eda1fa3268 | ||
|
|
633a2ace39 | ||
|
|
c2329c797c | ||
|
|
4d8de6887f | ||
|
|
5b2304d7b4 | ||
|
|
b6863fa3c9 | ||
|
|
c0ba4297c5 | ||
|
|
acc13fdc89 | ||
|
|
ee56fd2719 | ||
|
|
16863fa14e | ||
|
|
c957bbdeae | ||
|
|
c6a4fe00db | ||
|
|
30fc8c55a3 | ||
|
|
98c8115e96 | ||
|
|
d6b863b09c | ||
|
|
c730e2d9e8 | ||
|
|
81268e4b67 | ||
|
|
896a20a2a9 | ||
|
|
455ce0178b | ||
|
|
e268536dba | ||
|
|
e2aae9e166 | ||
|
|
8e4dbf5ab0 | ||
|
|
b7138e1052 | ||
|
|
5775f7e864 | ||
|
|
6deb757ba4 | ||
|
|
a0d25e62aa | ||
|
|
dc38e3a287 | ||
|
|
7b99d77bc6 | ||
|
|
1a79f34996 | ||
|
|
ad3ec0add1 | ||
|
|
a3ffafd3fe | ||
|
|
2d33b67399 | ||
|
|
e7e6c322a0 | ||
|
|
9ea9eed873 | ||
|
|
d882d1d100 | ||
|
|
b6e29912be | ||
|
|
687ef9f9fe | ||
|
|
4e1f4a8496 | ||
|
|
c1485dd854 | ||
|
|
35099b35ba | ||
|
|
2a5fb11132 | ||
|
|
a49513bedd | ||
|
|
fc6a8dcfb2 | ||
|
|
cbb4300cc2 | ||
|
|
deb79403bd | ||
|
|
9f43a52210 | ||
|
|
6bf0f043cd | ||
|
|
3f1cd6f52a | ||
|
|
d1da062806 | ||
|
|
bce88bc1ae | ||
|
|
8740ecf8c0 | ||
|
|
e92e87181b | ||
|
|
902dacb46a | ||
|
|
134bbf752c | ||
|
|
b27dd775ad | ||
|
|
e230d9a62b | ||
|
|
7709a02741 | ||
|
|
aaf9e9a820 | ||
|
|
674fed73ec | ||
|
|
98d1d862d5 | ||
|
|
aaef348f3d | ||
|
|
9bc96fd932 | ||
|
|
7b0658b00f | ||
|
|
f4034df457 | ||
|
|
5856751f41 | ||
|
|
4df9c47ca7 | ||
|
|
354a71cdc2 | ||
|
|
481c79dfac | ||
|
|
5e32f7c19a | ||
|
|
c5b4a727ab | ||
|
|
8c07ff563b | ||
|
|
fa997616ff | ||
|
|
0edd80c0f2 | ||
|
|
cc49da4ddf | ||
|
|
b7b4bec8df | ||
|
|
7aed2f97a5 | ||
|
|
89c7458b53 | ||
|
|
0809f17d77 | ||
|
|
550edf90b2 | ||
|
|
f3aa989205 | ||
|
|
f8a894c567 | ||
|
|
a0439c2405 | ||
|
|
edfabc70d3 | ||
|
|
9e14c22918 | ||
|
|
f3334434ea | ||
|
|
5686f159ab | ||
|
|
b7f12e5291 | ||
|
|
954daed8c2 | ||
|
|
b042ca3c0f | ||
|
|
5d3b5e175a | ||
|
|
1f13191b6f | ||
|
|
5aa665a624 | ||
|
|
85a5e683e8 | ||
|
|
e646037f4a | ||
|
|
536a6dd3ce | ||
|
|
701cc3fe2c | ||
|
|
22fc5f7ac9 | ||
|
|
4dcf0e2c7b | ||
|
|
67aea68e97 | ||
|
|
2320b98d89 | ||
|
|
4f90505509 | ||
|
|
4fcf9133ef | ||
|
|
1f29ee0e02 | ||
|
|
5285933ed8 | ||
|
|
1efbe325bd | ||
|
|
1f678f44f9 | ||
|
|
895cf6e91f | ||
|
|
682bc57d89 | ||
|
|
74ac72a78f | ||
|
|
f324aa68f9 | ||
|
|
88db6b6944 | ||
|
|
387d125c2d | ||
|
|
fd77d94155 | ||
|
|
137c6d5137 | ||
|
|
671567d496 | ||
|
|
aa3ef39ac8 | ||
|
|
b360fa26e5 | ||
|
|
168401bef2 | ||
|
|
9ecf7a54be | ||
|
|
b46b6af7e3 | ||
|
|
318e97ef64 | ||
|
|
9b525d2fe1 | ||
|
|
7a5e723600 | ||
|
|
9a2e78d703 | ||
|
|
b28d611552 | ||
|
|
f39ef82a14 | ||
|
|
c76348c318 | ||
|
|
dd9804a4fe | ||
|
|
f0018a3b9c | ||
|
|
9adb2c7cf1 | ||
|
|
857c948551 | ||
|
|
33cf956fc8 | ||
|
|
66816a3514 | ||
|
|
6417617d33 | ||
|
|
769b95b751 | ||
|
|
de0ebc7eb6 | ||
|
|
d8271b06b4 | ||
|
|
206205c6ee | ||
|
|
3336d7cf69 | ||
|
|
c319b5bf3b | ||
|
|
de577f3440 | ||
|
|
9f0489df43 | ||
|
|
46e7805428 | ||
|
|
d4b4519d8d | ||
|
|
b8d4bfe024 | ||
|
|
7046dfbc47 | ||
|
|
f119221740 | ||
|
|
fe38ed9d90 | ||
|
|
bc9ff8c14d | ||
|
|
a400a0e081 | ||
|
|
3abbefb5e4 | ||
|
|
51d5f8a438 | ||
|
|
e8c1aced2b | ||
|
|
9926b4ec03 | ||
|
|
20b09b0761 | ||
|
|
9d72d71f21 | ||
|
|
937873451a | ||
|
|
b7eb48d4fc | ||
|
|
2f67a24489 | ||
|
|
0fa2ce5716 | ||
|
|
1aef6a3960 | ||
|
|
e41d7c5bee | ||
|
|
37aa98f669 | ||
|
|
5c265cddbf | ||
|
|
da21549918 | ||
|
|
f46fed1458 | ||
|
|
fa9603b6d4 | ||
|
|
0f4de82749 | ||
|
|
46fa2b76aa | ||
|
|
1a8989fd9d | ||
|
|
f4795cc6b3 | ||
|
|
5688e294f7 | ||
|
|
3c1f0042f5 | ||
|
|
ca08f0ea65 | ||
|
|
61b343a3c8 | ||
|
|
ec76cb5726 | ||
|
|
d6c55effc3 | ||
|
|
788bdca00c | ||
|
|
c8b1db11d3 | ||
|
|
24ffc1a3c9 | ||
|
|
2cea3f1b14 | ||
|
|
73a15b2b5f | ||
|
|
3734f30bca | ||
|
|
7862d9f6fc | ||
|
|
7aa3fb3d47 | ||
|
|
6ac10d9b9a | ||
|
|
8c8f0df4f0 | ||
|
|
69e09f0559 | ||
|
|
1a18604b2e | ||
|
|
eae1c2b69c | ||
|
|
4c038111f8 | ||
|
|
a82d4c2b3d | ||
|
|
0cba2d7f5b | ||
|
|
a87ae161be | ||
|
|
275b1879c3 | ||
|
|
66cf2ad8ce | ||
|
|
0966c0f860 | ||
|
|
83a6c55c74 | ||
|
|
3c46adfe19 | ||
|
|
0787040b75 | ||
|
|
bf86c62a33 | ||
|
|
915dacbb85 | ||
|
|
b6b86da148 | ||
|
|
de38d76a18 | ||
|
|
166c00189a | ||
|
|
bca787f7c4 | ||
|
|
258f00968a | ||
|
|
bc40f9fcef | ||
|
|
d81418fd5e | ||
|
|
85ab4b9988 | ||
|
|
f75f8a4b1d | ||
|
|
dfada44550 | ||
|
|
5d4c822ef7 | ||
|
|
55f51356fb | ||
|
|
3f6afc4a7a | ||
|
|
dc87bf344c | ||
|
|
7a41a27413 | ||
|
|
8dc25234e0 | ||
|
|
24ad4ecf29 | ||
|
|
c9f0363bea | ||
|
|
c44bd5683d | ||
|
|
ae8bf0e8f1 | ||
|
|
fbba4d8d5e | ||
|
|
2b64713ac6 | ||
|
|
2464a2cd9d | ||
|
|
96e6715ebe | ||
|
|
72d973cb61 | ||
|
|
39d300f12b | ||
|
|
76f8538bf6 | ||
|
|
71411370e7 | ||
|
|
eb24d1f55c | ||
|
|
608b347584 | ||
|
|
6c4cbe6b5f | ||
|
|
ad31d9b60c | ||
|
|
8e2ee9a689 | ||
|
|
067af316b6 | ||
|
|
c0ab7dc021 | ||
|
|
8233adab59 | ||
|
|
be74434bbd | ||
|
|
bbc027cf8b | ||
|
|
43da73f064 | ||
|
|
ffc1ef87ea | ||
|
|
66e2135f07 | ||
|
|
e6a5c51ed7 | ||
|
|
d952853f74 | ||
|
|
3ebf224b28 | ||
|
|
9be2faa156 | ||
|
|
a8fff5ee1f | ||
|
|
4ab4534292 | ||
|
|
0e81b6b48e | ||
|
|
694c6b3a86 | ||
|
|
9724aab7a6 | ||
|
|
b6ca14a123 | ||
|
|
976f3796be | ||
|
|
1c643649b0 | ||
|
|
3337b5a092 | ||
|
|
b41ab84baa | ||
|
|
af996c06d0 | ||
|
|
2a21b4cf40 | ||
|
|
3614a52150 | ||
|
|
d2be99eb17 | ||
|
|
fca6110993 | ||
|
|
9bb0e5cdb7 | ||
|
|
cf302e3bc9 | ||
|
|
b50fed9980 | ||
|
|
baf047f89a | ||
|
|
a65f9eef4a | ||
|
|
9c149c3b6c | ||
|
|
d64368c699 | ||
|
|
97e76d3e24 | ||
|
|
a157495002 | ||
|
|
3c805daf45 | ||
|
|
8f55fdc385 | ||
|
|
26f88f15c8 | ||
|
|
6820c8729e | ||
|
|
78169b6a2f | ||
|
|
5a795ec749 | ||
|
|
d26ef4e978 | ||
|
|
40d911bc45 | ||
|
|
748db39d02 | ||
|
|
4db97b7a7d | ||
|
|
f8b26d3ade | ||
|
|
5c8eb8ec36 | ||
|
|
64f7bff756 | ||
|
|
040db4c3fe | ||
|
|
34ef74b11c | ||
|
|
de4a3dfb26 | ||
|
|
108881a3b2 | ||
|
|
7d5f893b7f | ||
|
|
8d977c3978 | ||
|
|
73f1bc31d7 | ||
|
|
497d1d9e97 | ||
|
|
764dd3149e | ||
|
|
b2b9bed164 | ||
|
|
9580e7cc87 | ||
|
|
a05267197a | ||
|
|
a90e5f5a69 | ||
|
|
1f47a082c4 | ||
|
|
7b55b7aa13 | ||
|
|
bcc94017bc | ||
|
|
b615d79ac3 | ||
|
|
04f549820f | ||
|
|
ded8b14afb | ||
|
|
4504b81f3b | ||
|
|
222412dbf1 | ||
|
|
71751f757d | ||
|
|
8c8424d0c2 | ||
|
|
e42f27d147 | ||
|
|
d1cca1ee9c |
5
THANKS
5
THANKS
@@ -34,6 +34,7 @@ Arne H. Juul arnej@solan.unit.no
|
||||
Arne Henrik Juul arnej@imf.unit.no
|
||||
Arthur Pool pool@commerce.uq.edu.au
|
||||
Austin Donnelly Austin.Donnelly@cl.cam.ac.uk
|
||||
Axel Kittenberger Anshil@gmx.net
|
||||
Bauke Jan Douma bjdouma@xs4all.nl
|
||||
Bengt Martensson bengt@mathematik.uni-Bremen.de
|
||||
Bernd Leibing bernd.leibing@rz.uni-ulm.de
|
||||
@@ -66,8 +67,10 @@ Collin Rogowski collin@rogowski.de
|
||||
Dan Hagerty hag@gnu.ai.it.edu
|
||||
Dan Pascu dan@services.iiruc.ro
|
||||
Daniel Bergstrom noa@melody.se
|
||||
Darren Salt ds@youmustbejoking.demon.co.uk
|
||||
David Dyck dcd@tc.fluke.COM
|
||||
David Godfrey dave@delta.demon.co.uk
|
||||
David Luyer david_luyer@pacific.net.au
|
||||
Dennis Henriksen opus@flamingo.osrl.dk
|
||||
Derek Clegg dclegg@next.com
|
||||
Dick Streefland dick_streefland@tasking.com
|
||||
@@ -198,6 +201,7 @@ Marty Leisner leisner@sdsp.mc.xerox.com
|
||||
Masami Takikawa takikawm@CS.ORST.EDU
|
||||
Mate Wierdl mw@moni.msci.memphis.edu
|
||||
Matej Vela mvela@public.srce.hr
|
||||
Matt Perry matt@primefactor.com
|
||||
Matthew Braun matthew@ans.net
|
||||
Matthew Clarke Matthew_Clarke@mindlink.bc.ca
|
||||
Matthew S. Levine mslevine@theory.lcs.mit.edu
|
||||
@@ -209,6 +213,7 @@ Michael ??? michael@roka.net
|
||||
Michael Deutschmann michael@talamasca.ocis.net
|
||||
Michael Hasselberg mikelh@zonta.ping.de
|
||||
Michael Hohn hohn@math.utah.edu
|
||||
Michael J. Croghan mcroghan@usatoday.com
|
||||
Michael Stone mstone@debian.org
|
||||
Michael Stutz stutz@dsl.org
|
||||
Michael Veksler mveksler@techunix.technion.ac.il
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
@@ -155,7 +155,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
$(srcdir)/version.texi: stamp-vti
|
||||
$(srcdir)/version.texi: $(srcdir)/stamp-vti
|
||||
@:
|
||||
|
||||
$(srcdir)/stamp-vti: fileutils.texi $(top_srcdir)/configure.in
|
||||
@@ -180,8 +180,8 @@ distclean-vti:
|
||||
maintainer-clean-vti:
|
||||
-rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi
|
||||
|
||||
fileutils.info: fileutils.texi version.texi
|
||||
fileutils.dvi: fileutils.texi version.texi
|
||||
fileutils.info: fileutils.texi $(srcdir)/version.texi
|
||||
fileutils.dvi: fileutils.texi $(srcdir)/version.texi
|
||||
|
||||
|
||||
DVIPS = dvips
|
||||
|
||||
@@ -69,11 +69,12 @@ matter what group the user who creates them is in.
|
||||
@cindex sticky
|
||||
@cindex swap space, saving text image in
|
||||
@cindex text image, saving in swap space
|
||||
@cindex append-only directories
|
||||
@cindex restricted deletion flag
|
||||
save the program's text image on the swap device so it will load more
|
||||
quickly when run (called the @dfn{sticky bit}). For directories on some
|
||||
systems, prevent users from removing files that they do not own in the
|
||||
directory; this is called making the directory @dfn{append-only}.
|
||||
systems, prevent users from removing or renaming a file in a directory
|
||||
unless they own the file or the directory; this is called the
|
||||
@dfn{restriction deletion flag} for the directory.
|
||||
@end enumerate
|
||||
|
||||
@node Symbolic Modes
|
||||
@@ -118,7 +119,7 @@ format:
|
||||
|
||||
@noindent
|
||||
The spaces between the three parts above are shown for readability only;
|
||||
symbolic modes can not contain spaces.
|
||||
symbolic modes cannot contain spaces.
|
||||
|
||||
The @var{users} part tells which users' access to the file is changed.
|
||||
It consists of one or more of the following letters (or it can be empty;
|
||||
@@ -427,7 +428,7 @@ This number is always interpreted in octal; you do not have to add a
|
||||
leading 0, as you do in C. Mode 0055 is the same as mode 55.
|
||||
|
||||
A numeric mode is usually shorter than the corresponding symbolic
|
||||
mode, but it is limited in that it can not take into account a file's
|
||||
mode, but it is limited in that it cannot take into account a file's
|
||||
previous permissions; it can only set them absolutely.
|
||||
|
||||
On most systems, the permissions granted to the user,
|
||||
|
||||
182
doc/texinfo.tex
182
doc/texinfo.tex
@@ -3,7 +3,7 @@
|
||||
% Load plain if necessary, i.e., if running under initex.
|
||||
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
|
||||
%
|
||||
\def\texinfoversion{2000-11-09.08}
|
||||
\def\texinfoversion{2000-12-11.07}
|
||||
%
|
||||
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
% Free Software Foundation, Inc.
|
||||
@@ -704,20 +704,35 @@ where each line of input produces a line of output.}
|
||||
% if you have multiple lines of stuff to put here, you'll need to
|
||||
% make the vbox yourself of the appropriate size.
|
||||
\ifx#1l%
|
||||
\llap{#2\hskip\inmarginspacing}%
|
||||
\llap{\ignorespaces #2\hskip\inmarginspacing}%
|
||||
\else
|
||||
\rlap{\hskip\hsize\hskip\inmarginspacing#2}%
|
||||
\rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
|
||||
\fi
|
||||
\null
|
||||
}%
|
||||
}}
|
||||
\def\inleftmargin{\doinmargin l}
|
||||
\def\inrightmargin{\doinmargin r}
|
||||
\def\inmargin{% not perfect, but better than nothing.
|
||||
\ifodd\pageno
|
||||
\let\temp=\inleftmargin
|
||||
%
|
||||
% @inmargin{TEXT [, RIGHT-TEXT]}
|
||||
% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
|
||||
% else use TEXT for both).
|
||||
%
|
||||
\def\inmargin#1{\parseinmargin #1,,\finish}
|
||||
\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
|
||||
\setbox0 = \hbox{\ignorespaces #2}%
|
||||
\ifdim\wd0 > 0pt
|
||||
\def\lefttext{#1}% have both texts
|
||||
\def\righttext{#2}%
|
||||
\else
|
||||
\let\temp=\inrightmargin
|
||||
\def\lefttext{#1}% have only one text
|
||||
\def\righttext{#1}%
|
||||
\fi
|
||||
%
|
||||
\ifodd\pageno
|
||||
\def\temp{\inleftmargin\lefttext}%
|
||||
\else
|
||||
\def\temp{\inrightmargin\righttext}%
|
||||
\fi
|
||||
\temp
|
||||
}
|
||||
@@ -4304,6 +4319,7 @@ width0pt\relax} \fi
|
||||
\gobble
|
||||
}
|
||||
|
||||
|
||||
% @quotation does normal linebreaking (hence we can't use \nonfillstart)
|
||||
% and narrows the margins.
|
||||
%
|
||||
@@ -4326,6 +4342,158 @@ width0pt\relax} \fi
|
||||
}
|
||||
|
||||
|
||||
% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
|
||||
% If we want to allow any <char> as delimiter,
|
||||
% we need the curly braces so that makeinfo sees the @verb command, eg:
|
||||
% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
|
||||
%
|
||||
% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
|
||||
%
|
||||
% [Knuth] p. 344; only we need to do '@' too
|
||||
\def\dospecials{%
|
||||
\do\ \do\\\do\@\do\{\do\}\do\$\do\&%
|
||||
\do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
|
||||
%
|
||||
% [Knuth] p. 380
|
||||
\def\uncatcodespecials{%
|
||||
\def\do##1{\catcode`##1=12}\dospecials}
|
||||
%
|
||||
% [Knuth] pp. 380,381,391
|
||||
% Disable Spanish ligatures ?` and !` of \tt font
|
||||
\begingroup
|
||||
\catcode`\`=\active\gdef`{\relax\lq}
|
||||
\endgroup
|
||||
%
|
||||
% Setup for the @verb command.
|
||||
%
|
||||
% Eight spaces for a tab
|
||||
\begingroup
|
||||
\catcode`\^^I=\active
|
||||
\gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
|
||||
\endgroup
|
||||
%
|
||||
\def\setupverb{%
|
||||
\tt % easiest (and conventionally used) font for verbatim
|
||||
\def\par{\leavevmode\endgraf}%
|
||||
\catcode`\`=\active
|
||||
\tabeightspaces
|
||||
% Respect line breaks,
|
||||
% print special symbols as themselves, and
|
||||
% make each space count
|
||||
% must do in this order:
|
||||
\obeylines \uncatcodespecials \sepspaces
|
||||
}
|
||||
|
||||
% Setup for the @verbatim environment
|
||||
%
|
||||
% Real tab expansion
|
||||
\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
|
||||
%
|
||||
\def\starttabbox{\setbox0=\hbox\bgroup}
|
||||
\begingroup
|
||||
\catcode`\^^I=\active
|
||||
\gdef\tabexpand{%
|
||||
\catcode`\^^I=\active
|
||||
\def^^I{\leavevmode\egroup
|
||||
\dimen0=\wd0 % the width so far, or since the previous tab
|
||||
\divide\dimen0 by\tabw
|
||||
\multiply\dimen0 by\tabw % compute previous multiple of \tabw
|
||||
\advance\dimen0 by\tabw % advance to next multiple of \tabw
|
||||
\wd0=\dimen0 \box0 \starttabbox
|
||||
}%
|
||||
}
|
||||
\endgroup
|
||||
\def\setupverbatim{%
|
||||
% Easiest (and conventionally used) font for verbatim
|
||||
\tt
|
||||
\def\par{\leavevmode\egroup\box0\endgraf}%
|
||||
\catcode`\`=\active
|
||||
\tabexpand
|
||||
% Respect line breaks,
|
||||
% print special symbols as themselves, and
|
||||
% make each space count
|
||||
% must do in this order:
|
||||
\obeylines \uncatcodespecials \sepspaces
|
||||
\everypar{\starttabbox}%
|
||||
}
|
||||
|
||||
% Do the @verb magic: verbatim text is quoted by unique
|
||||
% delimiter characters. Before first delimiter expect a
|
||||
% right brace, after last delimiter expect closing brace:
|
||||
%
|
||||
% \def\doverb'{'<char>#1<char>'}'{#1}
|
||||
%
|
||||
% [Knuth] p. 382; only eat outer {}
|
||||
\begingroup
|
||||
\catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
|
||||
\gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
|
||||
\endgroup
|
||||
%
|
||||
\def\verb{\begingroup\setupverb\doverb}
|
||||
%
|
||||
%
|
||||
% Do the @verbatim magic: define the macro \doverbatim so that
|
||||
% the (first) argument ends when '@end verbatim' is reached, ie:
|
||||
%
|
||||
% \def\doverbatim#1@end verbatim{#1}
|
||||
%
|
||||
% For Texinfo it's a lot easier than for LaTeX,
|
||||
% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
|
||||
% we need not redefine '\', '{' and '}'
|
||||
%
|
||||
% Inspired by LaTeX's verbatim command set [latex.ltx]
|
||||
%% Include LaTeX hack for completeness -- never know
|
||||
%% \begingroup
|
||||
%% \catcode`|=0 \catcode`[=1
|
||||
%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
|
||||
%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[
|
||||
%% #1|endgroup|def|Everbatim[]|end[verbatim]]
|
||||
%% |endgroup
|
||||
\begingroup
|
||||
\catcode`\ =\active
|
||||
\gdef\doverbatim#1@end verbatim{#1\end{verbatim}}
|
||||
\endgroup
|
||||
%
|
||||
\def\verbatim{%
|
||||
\def\Everbatim{\nonfillfinish\endgroup}%
|
||||
\begingroup
|
||||
\nonfillstart
|
||||
\advance\leftskip by -\defbodyindent
|
||||
\begingroup\setupverbatim\doverbatim
|
||||
}
|
||||
|
||||
% @verbatiminclude FILE - insert text of file in verbatim environment.
|
||||
%
|
||||
% Allow normal characters that we make active in the argument (a file name).
|
||||
\def\verbatiminclude{%
|
||||
\begingroup
|
||||
\catcode`\\=12
|
||||
\catcode`~=12
|
||||
\catcode`^=12
|
||||
\catcode`_=12
|
||||
\catcode`|=12
|
||||
\catcode`<=12
|
||||
\catcode`>=12
|
||||
\catcode`+=12
|
||||
\parsearg\doverbatiminclude
|
||||
}
|
||||
\def\setupverbatiminclude{%
|
||||
\begingroup
|
||||
\nonfillstart
|
||||
\advance\leftskip by -\defbodyindent
|
||||
\begingroup\setupverbatim
|
||||
}
|
||||
%
|
||||
\def\doverbatiminclude#1{%
|
||||
% Restore active chars for included file.
|
||||
\endgroup
|
||||
\begingroup
|
||||
\def\thisfile{#1}%
|
||||
\expandafter\expandafter\setupverbatiminclude\input\thisfile
|
||||
\endgroup\nonfillfinish\endgroup
|
||||
}
|
||||
|
||||
|
||||
\message{defuns,}
|
||||
% @defun etc.
|
||||
|
||||
|
||||
@@ -2260,6 +2260,24 @@ If @var{output-file} is one of the input files, @code{sort} copies
|
||||
it to a temporary file before sorting and writing the output to
|
||||
@var{output-file}.
|
||||
|
||||
@item -S @var{size}
|
||||
@opindex -S
|
||||
@cindex size for main memory sorting
|
||||
Use a main-memory sort buffer of the given @var{size}. By default,
|
||||
@var{size} is in units of 1,024 bytes. Appending @samp{%} causes
|
||||
@var{size} to be interpreted as a percentage of physical memory.
|
||||
Appending @samp{k} multiplies @var{size} by 1,024 (the default),
|
||||
@samp{M} by 1,048,576, @samp{G} by 1,073,741,824, and so on for
|
||||
@samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}. Appending
|
||||
@samp{b} causes @var{size} to be interpreted as a byte count, with no
|
||||
multiplication.
|
||||
|
||||
This option can improve the performance of @command{sort} by causing it
|
||||
to start with a larger or smaller sort buffer than the default.
|
||||
However, this option affects only the initial buffer size. The buffer
|
||||
grows beyond @var{size} if @command{sort} encounters input lines larger
|
||||
than @var{size}.
|
||||
|
||||
@item -t @var{separator}
|
||||
@opindex -t
|
||||
@cindex field separator character
|
||||
|
||||
122
lib/ChangeLog
122
lib/ChangeLog
@@ -1,3 +1,125 @@
|
||||
2001-01-26 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* quotearg.c: Include stddef.h.
|
||||
* quote.c: Include stddef.h.
|
||||
Reported by Axel Kittenberger.
|
||||
|
||||
* xmalloc.c [HAVE_DONE_WORKING_MALLOC_CHECK]: Enclose error-evoking
|
||||
line in double quotes so that it evokes a better diagnostic.
|
||||
[HAVE_DONE_WORKING_REALLOC_CHECK]: Likewise.
|
||||
Reported by Axel Kittenberger.
|
||||
|
||||
2001-01-15 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* unicodeio.c (print_unicode_char): Cast the second iconv() arg,
|
||||
to avoid a warning. Add back 'const' to inptr.
|
||||
|
||||
2001-01-16 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* basename.c: Include <stdio.h>, needed by assert on SunOS4.
|
||||
From Bruno Haible.
|
||||
|
||||
2001-01-14 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* rename.c: New file. From Volker Borchert.
|
||||
Include stdlib.h, string.h or strings.h, and xalloc.h.
|
||||
Use strip_trailing_slashes rather than open-coding it.
|
||||
|
||||
2001-01-03 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/strftime.c: Sync with glibc time/strftime.c 1.81.
|
||||
|
||||
2001-01-03 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* unicodeio.c (print_unicode_char): Remove `const' from declaration of
|
||||
local `inptr' to avoid warning with some system declarations of iconv.
|
||||
|
||||
2000-12-29 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/modechange.c: Do not assume that mode_t uses the
|
||||
traditional octal encoding. E.g. "chmod 1 FOO" should set
|
||||
the other-execute bit of FOO even if S_IXOTH != 1.
|
||||
|
||||
(SUID, SGID, SVTX, RUSR, WUSR, XUSR, RGRP, WGRP, XGRP, ROTH,
|
||||
WOTH, XOTH, ALLM): New macros.
|
||||
(S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR,
|
||||
S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH):
|
||||
Use them.
|
||||
(S_ISGID): Fix typo; it was defaulting to the same value as S_ISUID.
|
||||
(S_IRWXU, S_IRWXG, S_IRWXO): Specify defaults in terms of the above.
|
||||
(mode_compile):
|
||||
No need to use uintmax_t; unsigned long is long enough.
|
||||
Don't bother to get suffix since we don't use it.
|
||||
|
||||
2000-12-24 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* hash.c (is_prime): Return explicit boolean values.
|
||||
(hash_get_first): Return NULL to appease Irix5.6's 89.
|
||||
Reported by Nelson Beebe.
|
||||
|
||||
2000-10-31 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* localcharset.c (locale_charset): Add support for Win32.
|
||||
|
||||
2000-12-18 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* physmem.h, physmem.c: New files.
|
||||
|
||||
* Makefile.am (libfetish_a_SOURCES): Add physmem.c.
|
||||
(noinst_HEADERS): Add physmem.h.
|
||||
|
||||
* xstrtol.c (__xstrtol): Add undocumented suffixes 'g' and
|
||||
't' for compatibility with Solaris 8 sort.
|
||||
|
||||
2000-12-18 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* config.charset: Add support for BeOS.
|
||||
|
||||
2000-12-16 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* getusershell.c [!SHELLS_FILE && __DJGPP__]: Define
|
||||
SHELLS_FILE to a file name that's useful on djgpp systems.
|
||||
Include stdlib.h.
|
||||
(ADDITIONAL_DEFAULT_SHELLS): Define.
|
||||
(default_shells): Prepend ADDITIONAL_DEFAULT_SHELLS.
|
||||
Based mostly on a patch from Prashant TR.
|
||||
|
||||
2000-12-16 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
This bug had a serious impact on chown: `chown N:M FILE' (for integer
|
||||
N and M) would have treated it like `chown N:N FILE'.
|
||||
|
||||
* userspec.c (parse_user_spec): Fix typo: s/u/g/.
|
||||
|
||||
2000-10-31 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* config.charset: Add ISO-8859-3, BIG5HKSCS, GB18030, JOHAB, VISCII,
|
||||
CP874, CP949, CP950, CP1250, CP1253, CP1254, CP1255, CP1256, CP1257
|
||||
to the list of canonical encodings. Rename EUC-CN to GB2312.
|
||||
|
||||
2000-12-08 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* mbswidth.c (mbsnwidth): Don't loop endlessly when called with an
|
||||
invalid mulitbyte sequence and with the MBSW_ACCEPT_INVALID flag set.
|
||||
|
||||
2000-12-07 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* stripslash.c (ISSLASH): Define.
|
||||
(strip_trailing_slashes): Use ISSLASH rather than comparing against `/'.
|
||||
From Prashant TR.
|
||||
|
||||
* dirname.c (FILESYSTEM_PREFIX_LEN): Define.
|
||||
(dir_name_r): Declare this function as static.
|
||||
[BACKSLASH_IS_PATH_SEPARATOR]: Fix a bug that'd
|
||||
manifest itself on a name containing a mix of slashes and
|
||||
backslashes.
|
||||
Make this function work with names starting with a DOS-style
|
||||
drive letter and colon prefix.
|
||||
(dir_name): Append `.' if necessary.
|
||||
Based mostly on patches from Prashant TR and Eli Zaretskii.
|
||||
|
||||
* dirname.h (dir_name_r): Remove prototype.
|
||||
|
||||
2000-12-05 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* dirname.c (dir_name_r): Add `const' in a few local declarations.
|
||||
|
||||
@@ -13,7 +13,7 @@ libfetish_a_SOURCES = \
|
||||
full-write.c getopt.c getopt1.c getstr.c getugroups.c hard-locale.c hash.c \
|
||||
human.c idcache.c isdir.c linebuffer.c localcharset.c long-options.c \
|
||||
makepath.c mbswidth.c md5.c memcasecmp.c memcoll.c modechange.c \
|
||||
path-concat.c \
|
||||
path-concat.c physmem.c \
|
||||
quote.c quotearg.c readtokens.c safe-read.c same.c save-cwd.c \
|
||||
savedir.c sha.c stripslash.c unicodeio.c userspec.c version-etc.c xgetcwd.c \
|
||||
xgethostname.c xmalloc.c xstrdup.c xstrtod.c xstrtol.c xstrtoul.c \
|
||||
@@ -29,7 +29,8 @@ noinst_HEADERS = \
|
||||
getstr.h getpagesize.h group-member.h hard-locale.h hash.h human.h lchown.h \
|
||||
linebuffer.h long-options.h mbswidth.h md5.h memcasecmp.h memcoll.h \
|
||||
makepath.h mbswidth.h modechange.h mountlist.h nanosleep.h obstack.h \
|
||||
path-concat.h pathmax.h posixtm.h quote.h quotearg.h readtokens.h \
|
||||
path-concat.h pathmax.h physmem.h posixtm.h \
|
||||
quote.h quotearg.h readtokens.h \
|
||||
readutmp.h regex.h safe-read.h same.h save-cwd.h savedir.h sha.h \
|
||||
strverscmp.h unicodeio.h version-etc.h xalloc.h xstrtod.h xstrtol.h
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
@@ -129,7 +129,7 @@ libfetish_a_SOURCES = \
|
||||
full-write.c getopt.c getopt1.c getstr.c getugroups.c hard-locale.c hash.c \
|
||||
human.c idcache.c isdir.c linebuffer.c localcharset.c long-options.c \
|
||||
makepath.c mbswidth.c md5.c memcasecmp.c memcoll.c modechange.c \
|
||||
path-concat.c \
|
||||
path-concat.c physmem.c \
|
||||
quote.c quotearg.c readtokens.c safe-read.c same.c save-cwd.c \
|
||||
savedir.c sha.c stripslash.c unicodeio.c userspec.c version-etc.c xgetcwd.c \
|
||||
xgethostname.c xmalloc.c xstrdup.c xstrtod.c xstrtol.c xstrtoul.c \
|
||||
@@ -146,7 +146,8 @@ noinst_HEADERS = \
|
||||
getstr.h getpagesize.h group-member.h hard-locale.h hash.h human.h lchown.h \
|
||||
linebuffer.h long-options.h mbswidth.h md5.h memcasecmp.h memcoll.h \
|
||||
makepath.h mbswidth.h modechange.h mountlist.h nanosleep.h obstack.h \
|
||||
path-concat.h pathmax.h posixtm.h quote.h quotearg.h readtokens.h \
|
||||
path-concat.h pathmax.h physmem.h posixtm.h \
|
||||
quote.h quotearg.h readtokens.h \
|
||||
readutmp.h regex.h safe-read.h same.h save-cwd.h savedir.h sha.h \
|
||||
strverscmp.h unicodeio.h version-etc.h xalloc.h xstrtod.h xstrtol.h
|
||||
|
||||
@@ -180,11 +181,12 @@ diacrit$U.o dirname$U.o exclude$U.o filemode$U.o full-write$U.o \
|
||||
getopt$U.o getopt1$U.o getstr$U.o getugroups$U.o hard-locale$U.o \
|
||||
hash$U.o human$U.o idcache$U.o isdir$U.o linebuffer$U.o \
|
||||
localcharset$U.o long-options$U.o makepath$U.o mbswidth$U.o md5$U.o \
|
||||
memcasecmp$U.o memcoll$U.o modechange$U.o path-concat$U.o quote$U.o \
|
||||
quotearg$U.o readtokens$U.o safe-read$U.o same$U.o save-cwd$U.o \
|
||||
savedir$U.o sha$U.o stripslash$U.o unicodeio$U.o userspec$U.o \
|
||||
version-etc$U.o xgetcwd$U.o xgethostname$U.o xmalloc$U.o xstrdup$U.o \
|
||||
xstrtod$U.o xstrtol$U.o xstrtoul$U.o xstrtoumax$U.o yesno$U.o
|
||||
memcasecmp$U.o memcoll$U.o modechange$U.o path-concat$U.o physmem$U.o \
|
||||
quote$U.o quotearg$U.o readtokens$U.o safe-read$U.o same$U.o \
|
||||
save-cwd$U.o savedir$U.o sha$U.o stripslash$U.o unicodeio$U.o \
|
||||
userspec$U.o version-etc$U.o xgetcwd$U.o xgethostname$U.o xmalloc$U.o \
|
||||
xstrdup$U.o xstrtod$U.o xstrtol$U.o xstrtoul$U.o xstrtoumax$U.o \
|
||||
yesno$U.o
|
||||
libfetish_a_OBJECTS = $(am_libfetish_a_OBJECTS)
|
||||
AR = ar
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
@@ -217,9 +219,10 @@ $(DEPDIR)/memchr.Po $(DEPDIR)/memcmp.Po $(DEPDIR)/memcoll$U.Po \
|
||||
$(DEPDIR)/memcpy.Po $(DEPDIR)/memmove.Po $(DEPDIR)/memrchr.Po \
|
||||
$(DEPDIR)/memset.Po $(DEPDIR)/mktime.Po $(DEPDIR)/modechange$U.Po \
|
||||
$(DEPDIR)/mountlist.Po $(DEPDIR)/nanosleep.Po $(DEPDIR)/obstack.Po \
|
||||
$(DEPDIR)/path-concat$U.Po $(DEPDIR)/posixtm$U.Po $(DEPDIR)/putenv.Po \
|
||||
$(DEPDIR)/quote$U.Po $(DEPDIR)/quotearg$U.Po $(DEPDIR)/readtokens$U.Po \
|
||||
$(DEPDIR)/readutmp.Po $(DEPDIR)/realloc.Po $(DEPDIR)/regex.Po \
|
||||
$(DEPDIR)/path-concat$U.Po $(DEPDIR)/physmem$U.Po \
|
||||
$(DEPDIR)/posixtm$U.Po $(DEPDIR)/putenv.Po $(DEPDIR)/quote$U.Po \
|
||||
$(DEPDIR)/quotearg$U.Po $(DEPDIR)/readtokens$U.Po $(DEPDIR)/readutmp.Po \
|
||||
$(DEPDIR)/realloc.Po $(DEPDIR)/regex.Po $(DEPDIR)/rename.Po \
|
||||
$(DEPDIR)/rmdir.Po $(DEPDIR)/rpmatch.Po $(DEPDIR)/safe-read$U.Po \
|
||||
$(DEPDIR)/same$U.Po $(DEPDIR)/save-cwd$U.Po $(DEPDIR)/savedir$U.Po \
|
||||
$(DEPDIR)/sha$U.Po $(DEPDIR)/stat.Po $(DEPDIR)/stime.Po \
|
||||
@@ -240,10 +243,10 @@ error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
|
||||
getdate.c getgroups.c gethostname.c getline.c getloadavg.c getpass.c \
|
||||
getusershell.c group-member.c lchown.c malloc.c memchr.c memcmp.c \
|
||||
memcpy.c memmove.c memrchr.c memset.c mktime.c mountlist.c nanosleep.c \
|
||||
obstack.c obstack.h putenv.c readutmp.c realloc.c regex.c rmdir.c \
|
||||
rpmatch.c stime.c stpcpy.c strcasecmp.c strcspn.c strdup.c strftime.c \
|
||||
strncasecmp.c strndup.c strnlen.c strpbrk.c strstr.c strtod.c strtol.c \
|
||||
strtoul.c strtoull.c strtoumax.c strverscmp.c utime.c
|
||||
obstack.c obstack.h putenv.c readutmp.c realloc.c regex.c rename.c \
|
||||
rmdir.c rpmatch.c stime.c stpcpy.c strcasecmp.c strcspn.c strdup.c \
|
||||
strftime.c strncasecmp.c strndup.c strnlen.c strpbrk.c strstr.c \
|
||||
strtod.c strtol.c strtoul.c strtoull.c strtoumax.c strverscmp.c utime.c
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@@ -254,7 +257,7 @@ OBJECTS = $(am_libfetish_a_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .sed .sin .y
|
||||
.SUFFIXES: .sed .sin .c .o .y
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits lib/Makefile
|
||||
|
||||
@@ -425,6 +428,8 @@ obstack_.c: obstack.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obstack.c; then echo $(srcdir)/obstack.c; else echo obstack.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > obstack_.c
|
||||
path-concat_.c: path-concat.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/path-concat.c; then echo $(srcdir)/path-concat.c; else echo path-concat.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > path-concat_.c
|
||||
physmem_.c: physmem.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/physmem.c; then echo $(srcdir)/physmem.c; else echo physmem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > physmem_.c
|
||||
posixtm_.c: posixtm.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/posixtm.c; then echo $(srcdir)/posixtm.c; else echo posixtm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > posixtm_.c
|
||||
putenv_.c: putenv.c $(ANSI2KNR)
|
||||
@@ -441,6 +446,8 @@ realloc_.c: realloc.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > realloc_.c
|
||||
regex_.c: regex.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/regex.c; then echo $(srcdir)/regex.c; else echo regex.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > regex_.c
|
||||
rename_.c: rename.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rename.c; then echo $(srcdir)/rename.c; else echo rename.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > rename_.c
|
||||
rmdir_.c: rmdir.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rmdir.c; then echo $(srcdir)/rmdir.c; else echo rmdir.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > rmdir_.c
|
||||
rpmatch_.c: rpmatch.c $(ANSI2KNR)
|
||||
@@ -530,12 +537,12 @@ lchown_.o linebuffer_.o localcharset_.o long-options_.o lstat_.o \
|
||||
makepath_.o malloc_.o mbswidth_.o md5_.o memcasecmp_.o memchr_.o \
|
||||
memcmp_.o memcoll_.o memcpy_.o memmove_.o memrchr_.o memset_.o \
|
||||
mktime_.o modechange_.o mountlist_.o nanosleep_.o obstack_.o \
|
||||
path-concat_.o posixtm_.o putenv_.o quote_.o quotearg_.o readtokens_.o \
|
||||
readutmp_.o realloc_.o regex_.o rmdir_.o rpmatch_.o safe-read_.o \
|
||||
same_.o save-cwd_.o savedir_.o sha_.o stat_.o stime_.o stpcpy_.o \
|
||||
strcasecmp_.o strcspn_.o strdup_.o strftime_.o stripslash_.o \
|
||||
strncasecmp_.o strndup_.o strnlen_.o strpbrk_.o strstr_.o strtod_.o \
|
||||
strtol_.o strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o \
|
||||
path-concat_.o physmem_.o posixtm_.o putenv_.o quote_.o quotearg_.o \
|
||||
readtokens_.o readutmp_.o realloc_.o regex_.o rename_.o rmdir_.o \
|
||||
rpmatch_.o safe-read_.o same_.o save-cwd_.o savedir_.o sha_.o stat_.o \
|
||||
stime_.o stpcpy_.o strcasecmp_.o strcspn_.o strdup_.o strftime_.o \
|
||||
stripslash_.o strncasecmp_.o strndup_.o strnlen_.o strpbrk_.o strstr_.o \
|
||||
strtod_.o strtol_.o strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o \
|
||||
unicodeio_.o userspec_.o utime_.o version-etc_.o xgetcwd_.o \
|
||||
xgethostname_.o xmalloc_.o xstrdup_.o xstrtod_.o xstrtol_.o xstrtoul_.o \
|
||||
xstrtoumax_.o yesno_.o : $(ANSI2KNR)
|
||||
@@ -570,6 +577,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
|
||||
|
||||
GTAGS:
|
||||
here=`CDPATH=: && cd $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $$here
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
@@ -641,6 +653,7 @@ maintainer-clean-tags:
|
||||
@AMDEP@include $(DEPDIR)/nanosleep.Po
|
||||
@AMDEP@include $(DEPDIR)/obstack.Po
|
||||
@AMDEP@include $(DEPDIR)/path-concat$U.Po
|
||||
@AMDEP@include $(DEPDIR)/physmem$U.Po
|
||||
@AMDEP@include $(DEPDIR)/posixtm$U.Po
|
||||
@AMDEP@include $(DEPDIR)/putenv.Po
|
||||
@AMDEP@include $(DEPDIR)/quote$U.Po
|
||||
@@ -649,6 +662,7 @@ maintainer-clean-tags:
|
||||
@AMDEP@include $(DEPDIR)/readutmp.Po
|
||||
@AMDEP@include $(DEPDIR)/realloc.Po
|
||||
@AMDEP@include $(DEPDIR)/regex.Po
|
||||
@AMDEP@include $(DEPDIR)/rename.Po
|
||||
@AMDEP@include $(DEPDIR)/rmdir.Po
|
||||
@AMDEP@include $(DEPDIR)/rpmatch.Po
|
||||
@AMDEP@include $(DEPDIR)/safe-read$U.Po
|
||||
@@ -729,6 +743,9 @@ check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
all-recursive-am: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
install-exec-am: install-exec-local
|
||||
install-exec: install-exec-am
|
||||
|
||||
@@ -793,12 +810,12 @@ maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \
|
||||
maintainer-clean-kr tags mostlyclean-tags distclean-tags clean-tags \
|
||||
maintainer-clean-tags mostlyclean-depend distclean-depend clean-depend \
|
||||
maintainer-clean-depend distdir info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck install-exec-local install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-local uninstall-am uninstall all-local all-redirect all-am \
|
||||
all install-strip installdirs mostlyclean-generic distclean-generic \
|
||||
clean-generic maintainer-clean-generic clean mostlyclean distclean \
|
||||
maintainer-clean
|
||||
installcheck-am installcheck all-recursive-am install-exec-local \
|
||||
install-exec-am install-exec install-data-am install-data install-am \
|
||||
install uninstall-local uninstall-am uninstall all-local all-redirect \
|
||||
all-am all install-strip installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
lstat.c: xstat.in
|
||||
sed \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* basename.c -- return the last element in a path
|
||||
Copyright (C) 1990, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1998, 1999, 2000, 2001 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
|
||||
@@ -19,6 +19,7 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef FILESYSTEM_PREFIX_LEN
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd
|
||||
# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes
|
||||
# ISO-8859-2 glibc aix hpux irix solaris freebsd yes
|
||||
# ISO-8859-3 glibc yes
|
||||
# ISO-8859-4 solaris yes
|
||||
# ISO-8859-5 glibc aix hpux irix solaris yes
|
||||
# ISO-8859-6 glibc aix hpux solaris yes
|
||||
@@ -41,28 +42,41 @@
|
||||
# ISO-8859-8 glibc aix hpux solaris yes
|
||||
# ISO-8859-9 glibc aix hpux irix osf solaris yes
|
||||
# ISO-8859-13 glibc
|
||||
# ISO-8859-15 aix solaris freebsd
|
||||
# ISO-8859-15 glibc aix solaris freebsd
|
||||
# KOI8-R glibc solaris freebsd yes
|
||||
# KOI8-U glibc yes
|
||||
# CP850 aix osf
|
||||
# CP856 aix
|
||||
# CP866 freebsd
|
||||
# CP874 win32
|
||||
# CP922 aix
|
||||
# CP932 aix
|
||||
# CP932 aix win32
|
||||
# CP943 aix
|
||||
# CP949 win32
|
||||
# CP950 win32
|
||||
# CP1046 aix
|
||||
# CP1124 aix
|
||||
# CP1129 aix
|
||||
# CP1251 glibc
|
||||
# CP1252 aix
|
||||
# EUC-CN aix hpux irix solaris
|
||||
# EUC-JP aix hpux irix solaris yes
|
||||
# EUC-KR aix hpux irix solaris yes
|
||||
# EUC-TW aix hpux irix solaris
|
||||
# BIG5 aix hpux solaris yes
|
||||
# GBK aix
|
||||
# CP1250 win32
|
||||
# CP1251 glibc win32
|
||||
# CP1252 aix win32
|
||||
# CP1253 win32
|
||||
# CP1254 win32
|
||||
# CP1255 win32
|
||||
# CP1256 win32
|
||||
# CP1257 win32
|
||||
# GB2312 glibc aix hpux irix solaris yes
|
||||
# EUC-JP glibc aix hpux irix solaris yes
|
||||
# EUC-KR glibc aix hpux irix solaris yes
|
||||
# EUC-TW glibc aix hpux irix solaris
|
||||
# BIG5 glibc aix hpux solaris yes
|
||||
# BIG5HKSCS glibc
|
||||
# GBK aix win32
|
||||
# GB18030 glibc
|
||||
# SJIS hpux solaris
|
||||
# TIS-620 aix hpux solaris
|
||||
# JOHAB glibc win32
|
||||
# TIS-620 glibc aix hpux solaris
|
||||
# VISCII glibc yes
|
||||
# HP-ROMAN8 hpux
|
||||
# HP-ARABIC8 hpux
|
||||
# HP-GREEK8 hpux
|
||||
@@ -117,7 +131,7 @@ case "$os" in
|
||||
echo "IBM-1124 CP1124"
|
||||
echo "IBM-1129 CP1129"
|
||||
echo "IBM-1252 CP1252"
|
||||
echo "IBM-eucCN EUC-CN"
|
||||
echo "IBM-eucCN GB2312"
|
||||
echo "IBM-eucJP EUC-JP"
|
||||
echo "IBM-eucKR EUC-KR"
|
||||
echo "IBM-eucTW EUC-TW"
|
||||
@@ -146,7 +160,7 @@ case "$os" in
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "hp15CN EUC-CN"
|
||||
echo "hp15CN GB2312"
|
||||
#echo "ccdc ?" # what is this?
|
||||
echo "SJIS SJIS"
|
||||
echo "utf8 UTF-8"
|
||||
@@ -157,7 +171,7 @@ case "$os" in
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "eucCN EUC-CN"
|
||||
echo "eucCN GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
@@ -181,7 +195,7 @@ case "$os" in
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "koi8-r KOI8-R"
|
||||
echo "BIG5 BIG5"
|
||||
echo "gb2312 EUC-CN"
|
||||
echo "gb2312 GB2312"
|
||||
echo "cns11643 EUC-TW"
|
||||
echo "5601 EUC-KR"
|
||||
echo "eucJP EUC-JP"
|
||||
@@ -213,4 +227,8 @@ case "$os" in
|
||||
echo "$l.CP866 CP866"
|
||||
done
|
||||
;;
|
||||
beos*)
|
||||
# BeOS has a single locale, and it has UTF-8 encoding.
|
||||
echo "C UTF-8"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -43,17 +43,23 @@ void *memrchr ();
|
||||
|
||||
#include "dirname.h"
|
||||
|
||||
#ifndef FILESYSTEM_PREFIX_LEN
|
||||
# define FILESYSTEM_PREFIX_LEN(Filename) 0
|
||||
#endif
|
||||
|
||||
#ifndef ISSLASH
|
||||
# define ISSLASH(C) ((C) == '/')
|
||||
#endif
|
||||
|
||||
#define BACKSLASH_IS_PATH_SEPARATOR ISSLASH ('\\')
|
||||
|
||||
/* Return the length of `dirname (PATH)' and set *RESULT
|
||||
to point to PATH or to `"."', as appropriate.
|
||||
Works properly even if there are trailing slashes
|
||||
(by effectively ignoring them). */
|
||||
size_t
|
||||
/* Return the length of `dirname (PATH)' and set *RESULT to point
|
||||
to PATH or to `"."', as appropriate. Works properly even if
|
||||
there are trailing slashes (by effectively ignoring them).
|
||||
WARNING: This function doesn't work for cwd-relative names like
|
||||
`a:foo' that are specified with a drive-letter prefix. That case
|
||||
is handled in the caller. */
|
||||
static size_t
|
||||
dir_name_r (char const *path, char const **result)
|
||||
{
|
||||
char const *slash;
|
||||
@@ -78,10 +84,11 @@ dir_name_r (char const *path, char const **result)
|
||||
|
||||
if (path < slash)
|
||||
{
|
||||
slash = memrchr (path, '/', slash - path);
|
||||
size_t len = slash - path;
|
||||
slash = memrchr (path, '/', len);
|
||||
if (BACKSLASH_IS_PATH_SEPARATOR)
|
||||
{
|
||||
char const *b = memrchr (path, '\\', slash - path);
|
||||
char const *b = memrchr (path, '\\', len);
|
||||
if (b && slash < b)
|
||||
slash = b;
|
||||
}
|
||||
@@ -91,27 +98,23 @@ dir_name_r (char const *path, char const **result)
|
||||
if (slash == 0)
|
||||
{
|
||||
/* File is in the current directory. */
|
||||
path = ".";
|
||||
length = 1;
|
||||
|
||||
length = FILESYSTEM_PREFIX_LEN (path);
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
path = ".";
|
||||
length = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remove any trailing slashes from the result. */
|
||||
if (BACKSLASH_IS_PATH_SEPARATOR)
|
||||
{
|
||||
char const *lim = ((path[0] >= 'A' && path[0] <= 'z'
|
||||
&& path[1] == ':')
|
||||
? path + 2 : path);
|
||||
/* Remove any trailing slashes from the result. If we have a
|
||||
canonicalized "d:/path", leave alone the root case "d:/". */
|
||||
char const *lim = path + FILESYSTEM_PREFIX_LEN (path);
|
||||
|
||||
/* If canonicalized "d:/path", leave alone the root case "d:/". */
|
||||
while (slash > lim && ISSLASH (*slash))
|
||||
--slash;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (slash > path && ISSLASH (*slash))
|
||||
--slash;
|
||||
}
|
||||
while (lim < slash && ISSLASH (*slash))
|
||||
--slash;
|
||||
|
||||
length = slash - path + 1;
|
||||
}
|
||||
@@ -130,10 +133,14 @@ dir_name (char const *path)
|
||||
{
|
||||
char const *result;
|
||||
size_t length = dir_name_r (path, &result);
|
||||
char *newpath = (char *) malloc (length + 1);
|
||||
int append_dot = (length && length == FILESYSTEM_PREFIX_LEN (newpath));
|
||||
char *newpath = (char *) malloc (length + append_dot + 1);
|
||||
if (newpath == 0)
|
||||
return 0;
|
||||
strncpy (newpath, result, length);
|
||||
/* If PATH is "d:foo", return "d:.", the CWD on drive d: */
|
||||
if (append_dot)
|
||||
newpath[length++] = '.';
|
||||
newpath[length] = 0;
|
||||
return newpath;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,4 @@
|
||||
char *
|
||||
dir_name PARAMS ((const char *path));
|
||||
|
||||
size_t
|
||||
dir_name_r PARAMS ((const char *path, const char **result));
|
||||
|
||||
#endif /* not DIRNAME_H_ */
|
||||
|
||||
@@ -22,11 +22,19 @@
|
||||
#endif
|
||||
|
||||
#ifndef SHELLS_FILE
|
||||
# ifndef __DJGPP__
|
||||
/* File containing a list of nonrestricted shells, one per line. */
|
||||
# define SHELLS_FILE "/etc/shells"
|
||||
# define SHELLS_FILE "/etc/shells"
|
||||
# else
|
||||
/* This is a horrible kludge. Isn't there a better way? */
|
||||
# define SHELLS_FILE "/dev/env/DJDIR/etc/shells"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include "xalloc.h"
|
||||
|
||||
@@ -40,9 +48,17 @@
|
||||
|
||||
static int readname ();
|
||||
|
||||
#if ! defined ADDITIONAL_DEFAULT_SHELLS && defined __MSDOS__
|
||||
# define ADDITIONAL_DEFAULT_SHELLS \
|
||||
"c:/dos/command.com", "c:/windows/command.com", "c:/command.com",
|
||||
#else
|
||||
# define ADDITIONAL_DEFAULT_SHELLS /* empty */
|
||||
#endif
|
||||
|
||||
/* List of shells to use if the shells file is missing. */
|
||||
static char const* const default_shells[] =
|
||||
{
|
||||
ADDITIONAL_DEFAULT_SHELLS
|
||||
"/bin/sh", "/bin/csh", "/usr/bin/sh", "/usr/bin/csh", NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* hash - hashing table processing.
|
||||
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Written by Jim Meyering, 1992.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -263,6 +263,7 @@ hash_get_first (const Hash_table *table)
|
||||
return bucket->data;
|
||||
|
||||
assert (0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return the user data for the entry following ENTRY, where ENTRY has been
|
||||
@@ -422,7 +423,7 @@ is_prime (unsigned long candidate)
|
||||
divisor++;
|
||||
}
|
||||
|
||||
return candidate % divisor != 0;
|
||||
return (candidate % divisor ? true : false);
|
||||
}
|
||||
|
||||
/* Round a given CANDIDATE number up to the nearest prime, and return that
|
||||
|
||||
@@ -37,12 +37,22 @@
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LANGINFO_CODESET
|
||||
# include <langinfo.h>
|
||||
#else
|
||||
# if HAVE_SETLOCALE
|
||||
# include <locale.h>
|
||||
#if defined _WIN32 || defined __WIN32__
|
||||
# undef WIN32 /* avoid warning on mingw32 */
|
||||
# define WIN32
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
# include <langinfo.h>
|
||||
# else
|
||||
# if HAVE_SETLOCALE
|
||||
# include <locale.h>
|
||||
# endif
|
||||
# endif
|
||||
#else /* WIN32 */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef DIRECTORY_SEPARATOR
|
||||
@@ -73,6 +83,7 @@ get_charset_aliases ()
|
||||
cp = charset_aliases;
|
||||
if (cp == NULL)
|
||||
{
|
||||
#ifndef WIN32
|
||||
FILE *fp;
|
||||
const char *dir = LIBDIR;
|
||||
const char *base = "charset.alias";
|
||||
@@ -157,9 +168,20 @@ get_charset_aliases ()
|
||||
}
|
||||
}
|
||||
|
||||
charset_aliases = cp;
|
||||
if (file_name != NULL)
|
||||
free (file_name);
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
/* To avoid the troubles of installing a separate file in the same
|
||||
directory as the DLL and of retrieving the DLL's directory at
|
||||
runtime, simply inline the aliases here. */
|
||||
|
||||
cp = "CP936" "\0" "GBK" "\0"
|
||||
"CP1361" "\0" "JOHAB" "\0";
|
||||
#endif
|
||||
|
||||
charset_aliases = cp;
|
||||
}
|
||||
|
||||
return cp;
|
||||
@@ -180,19 +202,21 @@ locale_charset ()
|
||||
const char *codeset;
|
||||
const char *aliases;
|
||||
|
||||
#if HAVE_LANGINFO_CODESET
|
||||
#ifndef WIN32
|
||||
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Most systems support nl_langinfo (CODESET) nowadays. */
|
||||
codeset = nl_langinfo (CODESET);
|
||||
|
||||
#else
|
||||
# else
|
||||
|
||||
/* On old systems which lack it, use setlocale and getenv. */
|
||||
const char *locale = NULL;
|
||||
|
||||
# if HAVE_SETLOCALE
|
||||
# if HAVE_SETLOCALE
|
||||
locale = setlocale (LC_CTYPE, NULL);
|
||||
# endif
|
||||
# endif
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_ALL");
|
||||
@@ -209,6 +233,16 @@ locale_charset ()
|
||||
through the charset.alias file. */
|
||||
codeset = locale;
|
||||
|
||||
# endif
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
static char buf[2 + 10 + 1];
|
||||
|
||||
/* Win32 has a function returning the locale's codepage as a number. */
|
||||
sprintf (buf, "CP%u", GetACP ());
|
||||
codeset = buf;
|
||||
|
||||
#endif
|
||||
|
||||
if (codeset != NULL && codeset[0] != '\0')
|
||||
|
||||
@@ -153,7 +153,11 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
|
||||
/* An invalid multibyte sequence was encountered. */
|
||||
{
|
||||
if (flags & MBSW_ACCEPT_INVALID)
|
||||
break;
|
||||
{
|
||||
p++;
|
||||
width++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
@@ -162,7 +166,11 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
|
||||
/* An incomplete multibyte character at the end. */
|
||||
{
|
||||
if (flags & MBSW_ACCEPT_INVALID)
|
||||
break;
|
||||
{
|
||||
p = plimit;
|
||||
width++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* modechange.c -- file mode manipulation
|
||||
Copyright (C) 1989, 1990, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989, 1990, 1997, 1998, 1999, 2001 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
|
||||
@@ -50,50 +50,65 @@ char *malloc ();
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
/* The traditional octal values corresponding to each mode bit. */
|
||||
#define SUID 04000
|
||||
#define SGID 02000
|
||||
#define SVTX 01000
|
||||
#define RUSR 00400
|
||||
#define WUSR 00200
|
||||
#define XUSR 00100
|
||||
#define RGRP 00040
|
||||
#define WGRP 00020
|
||||
#define XGRP 00010
|
||||
#define ROTH 00004
|
||||
#define WOTH 00002
|
||||
#define XOTH 00001
|
||||
#define ALLM 07777 /* all octal mode bits */
|
||||
|
||||
#ifndef S_ISUID
|
||||
# define S_ISUID 04000
|
||||
# define S_ISUID SUID
|
||||
#endif
|
||||
#ifndef S_ISGID
|
||||
# define S_ISGID 04000
|
||||
# define S_ISGID SGID
|
||||
#endif
|
||||
#ifndef S_ISVTX
|
||||
# define S_ISVTX 01000
|
||||
# define S_ISVTX SVTX
|
||||
#endif
|
||||
#ifndef S_IRUSR
|
||||
# define S_IRUSR 0400
|
||||
# define S_IRUSR RUSR
|
||||
#endif
|
||||
#ifndef S_IWUSR
|
||||
# define S_IWUSR 0200
|
||||
# define S_IWUSR WUSR
|
||||
#endif
|
||||
#ifndef S_IXUSR
|
||||
# define S_IXUSR 0100
|
||||
# define S_IXUSR XUSR
|
||||
#endif
|
||||
#ifndef S_IRGRP
|
||||
# define S_IRGRP 0040
|
||||
# define S_IRGRP RGRP
|
||||
#endif
|
||||
#ifndef S_IWGRP
|
||||
# define S_IWGRP 0020
|
||||
# define S_IWGRP WGRP
|
||||
#endif
|
||||
#ifndef S_IXGRP
|
||||
# define S_IXGRP 0010
|
||||
# define S_IXGRP XGRP
|
||||
#endif
|
||||
#ifndef S_IROTH
|
||||
# define S_IROTH 0004
|
||||
# define S_IROTH ROTH
|
||||
#endif
|
||||
#ifndef S_IWOTH
|
||||
# define S_IWOTH 0002
|
||||
# define S_IWOTH WOTH
|
||||
#endif
|
||||
#ifndef S_IXOTH
|
||||
# define S_IXOTH 0001
|
||||
# define S_IXOTH XOTH
|
||||
#endif
|
||||
#ifndef S_IRWXU
|
||||
# define S_IRWXU 0700
|
||||
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
|
||||
#endif
|
||||
#ifndef S_IRWXG
|
||||
# define S_IRWXG 0070
|
||||
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
|
||||
#endif
|
||||
#ifndef S_IRWXO
|
||||
# define S_IRWXO 0007
|
||||
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
|
||||
#endif
|
||||
|
||||
/* All the mode bits that can be affected by chmod. */
|
||||
@@ -157,8 +172,7 @@ mode_compile (const char *mode_string, unsigned int masked_ops)
|
||||
{
|
||||
struct mode_change *head; /* First element of the linked list. */
|
||||
struct mode_change *tail; /* An element of the linked list. */
|
||||
uintmax_t mode_value; /* The mode value, if octal. */
|
||||
char *string_end; /* Pointer to end of parsed value. */
|
||||
unsigned long octal_value; /* The mode value, if octal. */
|
||||
mode_t umask_value; /* The umask value (surprise). */
|
||||
|
||||
head = NULL;
|
||||
@@ -166,12 +180,34 @@ mode_compile (const char *mode_string, unsigned int masked_ops)
|
||||
tail = NULL;
|
||||
#endif
|
||||
|
||||
if (xstrtoumax (mode_string, &string_end, 8, &mode_value, "") == LONGINT_OK)
|
||||
if (xstrtoul (mode_string, NULL, 8, &octal_value, "") == LONGINT_OK)
|
||||
{
|
||||
struct mode_change *p;
|
||||
if (mode_value != (mode_value & CHMOD_MODE_BITS))
|
||||
mode_t mode;
|
||||
if (octal_value != (octal_value & ALLM))
|
||||
return MODE_INVALID;
|
||||
p = make_node_op_equals ((mode_t) mode_value);
|
||||
|
||||
/* Help the compiler optimize the usual case where mode_t uses
|
||||
the traditional octal representation. */
|
||||
mode = ((S_ISUID == SUID && S_ISGID == SGID && S_ISVTX == SVTX
|
||||
&& S_IRUSR == RUSR && S_IWUSR == WUSR && S_IXUSR == XUSR
|
||||
&& S_IRGRP == RGRP && S_IWGRP == WGRP && S_IXGRP == XGRP
|
||||
&& S_IROTH == ROTH && S_IWOTH == WOTH && S_IXOTH == XOTH)
|
||||
? octal_value
|
||||
: ((octal_value & SUID ? S_ISUID : 0)
|
||||
| (octal_value & SGID ? S_ISGID : 0)
|
||||
| (octal_value & SVTX ? S_ISVTX : 0)
|
||||
| (octal_value & RUSR ? S_IRUSR : 0)
|
||||
| (octal_value & WUSR ? S_IWUSR : 0)
|
||||
| (octal_value & XUSR ? S_IXUSR : 0)
|
||||
| (octal_value & RGRP ? S_IRGRP : 0)
|
||||
| (octal_value & WGRP ? S_IWGRP : 0)
|
||||
| (octal_value & XGRP ? S_IXGRP : 0)
|
||||
| (octal_value & ROTH ? S_IROTH : 0)
|
||||
| (octal_value & WOTH ? S_IWOTH : 0)
|
||||
| (octal_value & XOTH ? S_IXOTH : 0)));
|
||||
|
||||
p = make_node_op_equals (mode);
|
||||
if (p == NULL)
|
||||
return MODE_MEMORY_EXHAUSTED;
|
||||
mode_append_entry (&head, &tail, p);
|
||||
@@ -393,7 +429,7 @@ mode_adjust (mode_t oldmode, const struct mode_change *changes)
|
||||
|
||||
/* In order to change only `u', `g', or `o' permissions,
|
||||
or some combination thereof, clear unselected bits.
|
||||
This can not be done in mode_compile because the value
|
||||
This cannot be done in mode_compile because the value
|
||||
to which the `changes->affected' mask is applied depends
|
||||
on the old mode of each file. */
|
||||
value &= changes->affected;
|
||||
|
||||
58
lib/physmem.c
Normal file
58
lib/physmem.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* Calculate the size of physical memory.
|
||||
Copyright 2000 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 Paul Eggert. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "physmem.h"
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Return the total amount of physical memory. */
|
||||
double
|
||||
physmem_total (void)
|
||||
{
|
||||
#if defined _SC_PHYS_PAGES && defined _SC_PAGESIZE
|
||||
double pages = sysconf (_SC_PHYS_PAGES);
|
||||
double pagesize = sysconf (_SC_PAGESIZE);
|
||||
if (0 <= pages && 0 <= pagesize)
|
||||
return pages * pagesize;
|
||||
#endif
|
||||
|
||||
/* Guess 64 MB. It's probably an older host, so guess small. */
|
||||
return 64 * 1024 * 1024;
|
||||
}
|
||||
|
||||
/* Return the amount of physical memory available. */
|
||||
double
|
||||
physmem_available (void)
|
||||
{
|
||||
#if defined _SC_AVPHYS_PAGES && defined _SC_PAGESIZE
|
||||
double pages = sysconf (_SC_AVPHYS_PAGES);
|
||||
double pagesize = sysconf (_SC_PAGESIZE);
|
||||
if (0 <= pages && 0 <= pagesize)
|
||||
return pages * pagesize;
|
||||
#endif
|
||||
|
||||
/* Guess 25% of physical memory. */
|
||||
return physmem_total () / 4;
|
||||
}
|
||||
19
lib/physmem.h
Normal file
19
lib/physmem.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef PHYSMEM_H_
|
||||
# define PHYSMEM_H_ 1
|
||||
|
||||
# if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# endif
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
|
||||
double physmem_total PARAMS ((void));
|
||||
double physmem_available PARAMS ((void));
|
||||
|
||||
#endif /* PHYSMEM_H_ */
|
||||
@@ -4,6 +4,9 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDDEF_H
|
||||
# include <stddef.h> /* For the definition of size_t on windows w/MSVC. */
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <quotearg.h>
|
||||
#include <quote.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* quotearg.c - quote arguments for output
|
||||
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999, 2000, 2001 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
|
||||
@@ -21,6 +21,9 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDDEF_H
|
||||
# include <stddef.h> /* For the definition of size_t on windows w/MSVC. */
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <quotearg.h>
|
||||
#include <xalloc.h>
|
||||
|
||||
68
lib/rename.c
Normal file
68
lib/rename.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/* Work around the bug in some systems whereby rename fails when the source
|
||||
path has a trailing slash. The rename from SunOS 4.1.1_U1 has this bug.
|
||||
Copyright (C) 2001 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 Volker Borchert */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <xalloc.h>
|
||||
|
||||
#ifndef HAVE_DECL_FREE
|
||||
"this configure-time declaration test was not run"
|
||||
#endif
|
||||
#if !HAVE_DECL_FREE
|
||||
void free ();
|
||||
#endif
|
||||
|
||||
void strip_trailing_slashes ();
|
||||
|
||||
/* Rename the file SRC_PATH to DST_PATH, removing any trailing
|
||||
slashes from SRC_PATH. Needed for SunOS 4.1.1_U1. */
|
||||
|
||||
int
|
||||
rpl_rename (const char *src_path, const char *dst_path)
|
||||
{
|
||||
char *src_temp;
|
||||
int ret_val;
|
||||
size_t s_len = strlen (src_path);
|
||||
|
||||
if (s_len && src_path[s_len - 1] == '/')
|
||||
{
|
||||
src_temp = xstrdup (src_path);
|
||||
strip_trailing_slashes (src_temp);
|
||||
}
|
||||
else
|
||||
src_temp = (char *) src_path;
|
||||
|
||||
ret_val = rename (src_temp, dst_path);
|
||||
|
||||
if (src_temp != src_path)
|
||||
free (src_temp);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */
|
||||
else if (to_uppcase) \
|
||||
memcpy_uppcase (p, (s), _n); \
|
||||
else \
|
||||
MEMCPY ((PTR) p, (PTR) (s), _n))
|
||||
MEMCPY ((PTR) p, (const PTR) (s), _n))
|
||||
|
||||
#ifdef COMPILE_WIDE
|
||||
# define widen(os, ws, l) \
|
||||
@@ -793,10 +793,11 @@ my_strftime (s, maxsize, format, tp ut_argument)
|
||||
goto bad_format;
|
||||
#ifdef _NL_CURRENT
|
||||
if (! (modifier == 'E'
|
||||
&& (*(subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME,
|
||||
NLW(ERA_D_T_FMT)))
|
||||
&& (*(subfmt =
|
||||
(const CHAR_T *) _NL_CURRENT (LC_TIME,
|
||||
NLW(ERA_D_T_FMT)))
|
||||
!= '\0')))
|
||||
subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_T_FMT));
|
||||
subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_T_FMT));
|
||||
#else
|
||||
# if HAVE_STRFTIME
|
||||
goto underlying_strftime;
|
||||
@@ -887,10 +888,10 @@ my_strftime (s, maxsize, format, tp ut_argument)
|
||||
goto bad_format;
|
||||
#ifdef _NL_CURRENT
|
||||
if (! (modifier == L_('E')
|
||||
&& (*(subfmt = (CHAR_T *)_NL_CURRENT (LC_TIME,
|
||||
NLW(ERA_D_FMT)))
|
||||
&& (*(subfmt =
|
||||
(const CHAR_T *)_NL_CURRENT (LC_TIME, NLW(ERA_D_FMT)))
|
||||
!= L_('\0'))))
|
||||
subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_FMT));
|
||||
subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_FMT));
|
||||
goto subformat;
|
||||
#else
|
||||
# if HAVE_STRFTIME
|
||||
@@ -1073,8 +1074,9 @@ my_strftime (s, maxsize, format, tp ut_argument)
|
||||
|
||||
case L_('r'): /* POSIX.2 extension. */
|
||||
#ifdef _NL_CURRENT
|
||||
if (*(subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME,
|
||||
NLW(T_FMT_AMPM))) == L_('\0'))
|
||||
if (*(subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME,
|
||||
NLW(T_FMT_AMPM)))
|
||||
== L_('\0'))
|
||||
#endif
|
||||
subfmt = L_("%I:%M:%S %p");
|
||||
goto subformat;
|
||||
@@ -1129,10 +1131,10 @@ my_strftime (s, maxsize, format, tp ut_argument)
|
||||
goto bad_format;
|
||||
#ifdef _NL_CURRENT
|
||||
if (! (modifier == L_('E')
|
||||
&& (*(subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME,
|
||||
NLW(ERA_T_FMT)))
|
||||
&& (*(subfmt =
|
||||
(const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ERA_T_FMT)))
|
||||
!= L_('\0'))))
|
||||
subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME, NLW(T_FMT));
|
||||
subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(T_FMT));
|
||||
goto subformat;
|
||||
#else
|
||||
# if HAVE_STRFTIME
|
||||
|
||||
@@ -19,12 +19,16 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
#if STDC_HEADERS || HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifndef ISSLASH
|
||||
# define ISSLASH(C) ((C) == '/')
|
||||
#endif
|
||||
|
||||
/* Remove trailing slashes from PATH.
|
||||
This is useful when using filename completion from a shell that
|
||||
adds a "/" after directory names (such as tcsh and bash), because
|
||||
@@ -37,6 +41,6 @@ strip_trailing_slashes (char *path)
|
||||
int last;
|
||||
|
||||
last = strlen (path) - 1;
|
||||
while (last > 0 && path[last] == '/')
|
||||
while (0 < last && ISSLASH (path[last]))
|
||||
path[last--] = '\0';
|
||||
}
|
||||
|
||||
@@ -170,7 +170,9 @@ print_unicode_char (FILE *stream, unsigned int code)
|
||||
outbytesleft = sizeof (outbuf);
|
||||
|
||||
/* Convert the character from UTF-8 to the locale's charset. */
|
||||
res = iconv (utf8_to_local, &inptr, &inbytesleft, &outptr, &outbytesleft);
|
||||
res = iconv (utf8_to_local,
|
||||
(ICONV_CONST char **)&inptr, &inbytesleft,
|
||||
&outptr, &outbytesleft);
|
||||
if (inbytesleft > 0 || res == (size_t)(-1)
|
||||
/* Irix iconv() inserts a NUL byte if it cannot convert. */
|
||||
# if !defined _LIBICONV_VERSION && (defined sgi || defined __sgi)
|
||||
|
||||
@@ -163,8 +163,8 @@ is_number (const char *str)
|
||||
use the given user's login group.
|
||||
If SPEC_ARG contains a `:', then use that as the separator, ignoring
|
||||
any `.'s. If there is no `:', but there is a `.', then first look
|
||||
up SPEC_ARG as a login name. If that look-up fails, then try again
|
||||
interpreting the `.' as a separator.
|
||||
up the entire SPEC_ARG as a login name. If that look-up fails, then
|
||||
try again interpreting the `.' as a separator.
|
||||
|
||||
USERNAME and GROUPNAME will be in newly malloc'd memory.
|
||||
Either one might be NULL instead, indicating that it was not
|
||||
@@ -304,7 +304,7 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
|
||||
else
|
||||
{
|
||||
unsigned long int tmp_long;
|
||||
if (xstrtoul (u, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|
||||
if (xstrtoul (g, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long > MAXGID)
|
||||
return _(E_invalid_group);
|
||||
*gid = tmp_long;
|
||||
|
||||
@@ -47,11 +47,11 @@ void free ();
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DONE_WORKING_MALLOC_CHECK
|
||||
you must run the autoconf test for a properly working malloc -- see malloc.m4
|
||||
"you must run the autoconf test for a properly working malloc -- see malloc.m4"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DONE_WORKING_REALLOC_CHECK
|
||||
you must run the autoconf test for a properly working realloc -- see realloc.m4
|
||||
"you must run the autoconf test for a properly working realloc --see realloc.m4"
|
||||
#endif
|
||||
|
||||
/* Exit value when the requested amount of memory is not available.
|
||||
|
||||
@@ -199,6 +199,7 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
|
||||
break;
|
||||
|
||||
case 'G': /* Giga */
|
||||
case 'g': /* 'g' is undocumented; for compatibility only */
|
||||
overflow = bkm_scale_by_power (&tmp, base, 3);
|
||||
break;
|
||||
|
||||
@@ -207,7 +208,7 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
|
||||
break;
|
||||
|
||||
case 'M': /* Mega */
|
||||
case 'm': /* 'm' is undocumented; for backward compatibility only */
|
||||
case 'm': /* 'm' is undocumented; for compatibility only */
|
||||
overflow = bkm_scale_by_power (&tmp, base, 2);
|
||||
break;
|
||||
|
||||
@@ -216,6 +217,7 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
|
||||
break;
|
||||
|
||||
case 'T': /* Tera */
|
||||
case 't': /* 't' is undocumented; for compatibility only */
|
||||
overflow = bkm_scale_by_power (&tmp, base, 4);
|
||||
break;
|
||||
|
||||
|
||||
91
m4/ChangeLog
91
m4/ChangeLog
@@ -1,8 +1,99 @@
|
||||
2001-01-27 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* ls-mntd-fs.m4 (jm_LIST_MOUNTED_FILESYSTEMS): Open-code what was
|
||||
a use of AS_IF.
|
||||
* fsusage.m4 (jm_FILE_SYSTEM_USAGE): Likewise.
|
||||
|
||||
2001-01-26 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* prereq.m4 (jm_PREREQ_QUOTEARG): Check for stddef.h, now that
|
||||
quotearg.c includes it.
|
||||
|
||||
2001-01-15 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* iconv.m4 (jm_ICONV): Also check whether the iconv declaration
|
||||
has const.
|
||||
|
||||
2001-01-20 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
Be sure that headers are checked before used in code compiled
|
||||
for the type checks.
|
||||
* jm-macros.m4 (jm_MACROS): Remove all header checks.
|
||||
In place of that, invoke jm_CHECK_ALL_TYPES.
|
||||
(jm_CHECK_ALL_HEADERS): New functions with the above checks.
|
||||
(jm_CHECK_ALL_TYPES): Require jm_CHECK_ALL_HEADERS.
|
||||
Alan Iwi reported a build failure on an f300-fujitsu-uxpv4.1_ES;
|
||||
The check for ssize_t was mistakenly run before the test for unistd.h.
|
||||
|
||||
The configure-time check for stdbool.h was missing.
|
||||
* prereq.m4 (jm_PREREQ): Add jm_PREREQ_HASH.
|
||||
(jm_PREREQ_HASH): New function.
|
||||
|
||||
2001-01-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* fsusage.m4 (jm_FILE_SYSTEM_USAGE): Use AS_IF, not AS_IFELSE,
|
||||
for autoconf-2.49c.
|
||||
* ls-mntd-fs.m4 (jm_LIST_MOUNTED_FILESYSTEMS): Likewise.
|
||||
|
||||
2001-01-14 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* rename.m4: Use temporary directories named conftestdir{,2}, not
|
||||
foo and bar. Create conftestdir/ in the script, not in the C code.
|
||||
Remove directories in the script, not in the C code.
|
||||
Remove conftestdir{,2} before trying to create the directory.
|
||||
Make the entire configure script fail if the mkdir fails.
|
||||
|
||||
2001-01-02 Volker Borchert <bt@teknon.de>
|
||||
|
||||
* rename.m4: New file.
|
||||
* jm-macros.m4 (jm_MACROS): Require vb_FUNC_RENAME.
|
||||
|
||||
2001-01-01 Alexandre Duret-Lutz <duret_g@epita.fr>
|
||||
|
||||
* libintl.m4 (AM_GNU_GETTEXT): Define MKINSTALLDIRS by
|
||||
expanding the value of $ac_aux_dir, as in AM_MISSING_HAS_RUN,
|
||||
so `make install' also works in VPATH builds.
|
||||
|
||||
2001-01-01 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* prereq.m4 (jm_PREREQ_READUTMP): Include utmp.h (if available), even
|
||||
on systems with utmpx.h. It's necessary for the declaration of utmp's
|
||||
ut_user member. Reported by Andreas Jaeger.
|
||||
|
||||
* check-decl.m4 (jm_CHECK_DECLS): Include grp.h and pwd.h if available.
|
||||
They are required for the declarations of getgrgid and getpwuid resp.
|
||||
(_jm_DECL_HEADERS): Check for grp.h and pwd.h.
|
||||
Reported by Andreas Jaeger.
|
||||
|
||||
2000-12-25 Alexandre Duret-Lutz <duret_g@epita.fr>
|
||||
|
||||
* libintl.m4 (AM_WITH_NLS): When using AC_CONFIG_AUX_DIR,
|
||||
prepend $(top_srcdir) to the value of MKINSTALLDIRS so that it
|
||||
can be used in subdirectories.
|
||||
|
||||
2000-12-26 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* dos.m4 (jm_AC_DOS): Rewrite (though it's still a stub) to work better
|
||||
with autoheader.
|
||||
|
||||
2000-12-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* dos.m4 (jm_AC_DOS): New file and macro.
|
||||
* jm-macros.m4 (jm_MACROS): Require jm_AC_DOS.
|
||||
|
||||
2000-12-06 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* off_t-format.m4: Remove this file.
|
||||
* jm-macros.m4 (jm_MACROS): Remove jm_SYS_OFF_T_PRINTF_FORMAT.
|
||||
|
||||
2000-12-06 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* xstrtoumax.m4 (jm_AC_PREREQ_XSTRTOUMAX): If we need the replacement
|
||||
strtoull, we may well need the replacement strtoul, too.
|
||||
Check for declarations of strtoul and strtoull.
|
||||
Check for strtol. Mainly as a cue to cause automake to include
|
||||
strtol.c -- that file is included by each of strtoul.c and strtoull.c.
|
||||
Check for limits.h -- strtol.c needs it.
|
||||
|
||||
2000-12-02 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ chown.m4 \
|
||||
codeset.m4 \
|
||||
d-ino.m4 \
|
||||
d-type.m4 \
|
||||
dos.m4 \
|
||||
error.m4 \
|
||||
fnmatch.m4 \
|
||||
fpending.m4 \
|
||||
@@ -44,7 +45,6 @@ mbstate_t.m4 \
|
||||
mbswidth.m4 \
|
||||
memcmp.m4 \
|
||||
nanosleep.m4 \
|
||||
off_t-format.m4 \
|
||||
perl.m4 \
|
||||
prereq.m4 \
|
||||
progtest.m4 \
|
||||
@@ -52,6 +52,7 @@ putenv.m4 \
|
||||
readdir.m4 \
|
||||
realloc.m4 \
|
||||
regex.m4 \
|
||||
rename.m4 \
|
||||
rmdir-errno.m4 \
|
||||
search-libs.m4 \
|
||||
st_dm_mode.m4 \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
@@ -126,6 +126,7 @@ chown.m4 \
|
||||
codeset.m4 \
|
||||
d-ino.m4 \
|
||||
d-type.m4 \
|
||||
dos.m4 \
|
||||
error.m4 \
|
||||
fnmatch.m4 \
|
||||
fpending.m4 \
|
||||
@@ -159,7 +160,6 @@ mbstate_t.m4 \
|
||||
mbswidth.m4 \
|
||||
memcmp.m4 \
|
||||
nanosleep.m4 \
|
||||
off_t-format.m4 \
|
||||
perl.m4 \
|
||||
prereq.m4 \
|
||||
progtest.m4 \
|
||||
@@ -167,6 +167,7 @@ putenv.m4 \
|
||||
readdir.m4 \
|
||||
realloc.m4 \
|
||||
regex.m4 \
|
||||
rename.m4 \
|
||||
rmdir-errno.m4 \
|
||||
search-libs.m4 \
|
||||
st_dm_mode.m4 \
|
||||
|
||||
@@ -3,7 +3,7 @@ and textutils packages.
|
||||
|
||||
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
|
||||
used by autoconf to create the configure script at the top level in
|
||||
this distribution.
|
||||
|
||||
The Makefile.am file in this directory is automatically generated
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 16
|
||||
#serial 17
|
||||
|
||||
dnl This is just a wrapper function to encapsulate this kludge.
|
||||
dnl Putting it in a separate file like this helps share it between
|
||||
@@ -41,6 +41,14 @@ AC_DEFUN(jm_CHECK_DECLS,
|
||||
#if HAVE_UTMP_H
|
||||
# include <utmp.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_GRP_H
|
||||
# include <grp.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_PWD_H
|
||||
# include <pwd.h>
|
||||
#endif
|
||||
'
|
||||
|
||||
AC_CHECK_DECLS([
|
||||
@@ -72,6 +80,6 @@ dnl This is a little helper so we can require these header checks.
|
||||
AC_DEFUN(_jm_DECL_HEADERS,
|
||||
[
|
||||
AC_REQUIRE([AC_HEADER_STDC])
|
||||
AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h sys/time.h \
|
||||
utmp.h utmpx.h)
|
||||
AC_CHECK_HEADERS(grp.h memory.h pwd.h string.h strings.h stdlib.h \
|
||||
unistd.h sys/time.h utmp.h utmpx.h)
|
||||
])
|
||||
|
||||
41
m4/dos.m4
Normal file
41
m4/dos.m4
Normal file
@@ -0,0 +1,41 @@
|
||||
# serial 2
|
||||
|
||||
# Define some macros required for proper operation of code in lib/*.c
|
||||
# on MSDOS/Windows systems.
|
||||
|
||||
# From Jim Meyering.
|
||||
|
||||
AC_DEFUN(jm_AC_DOS,
|
||||
[
|
||||
# FIXME: this is incomplete. Add a compile-test that does something
|
||||
# like this:
|
||||
#if defined _WIN32 || defined __WIN32__ || defined __MSDOS__
|
||||
|
||||
AH_VERBATIM(FILESYSTEM_PREFIX_LEN,
|
||||
[#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
|
||||
# define FILESYSTEM_PREFIX_LEN(Filename) \
|
||||
((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
|
||||
else
|
||||
# define FILESYSTEM_PREFIX_LEN(Filename) 0
|
||||
#endif])
|
||||
|
||||
ac_fs_accepts_drive_letter_prefix=0
|
||||
AC_DEFINE_UNQUOTED([FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
|
||||
$ac_fs_accepts_drive_letter_prefix,
|
||||
[Define on systems for which file names may have a so-called
|
||||
`drive letter' prefix, define this to compute the length of that
|
||||
prefix, including the colon.])
|
||||
|
||||
AH_VERBATIM(ISSLASH,
|
||||
[#if FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
|
||||
# define ISSLASH(C) ((C) == '/' || (C) == '\\\\')
|
||||
#else
|
||||
# define ISSLASH(C) ((C) == '/')
|
||||
#endif])
|
||||
|
||||
ac_fs_backslash_is_file_name_separator=0
|
||||
AC_DEFINE_UNQUOTED([FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
|
||||
$ac_fs_backslash_is_file_name_separator,
|
||||
[Define if the backslash character may also serve as a file name
|
||||
component separator.])
|
||||
])
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 4
|
||||
#serial 6
|
||||
|
||||
# From fileutils/configure.in
|
||||
|
||||
@@ -179,14 +179,21 @@ if test $ac_fsusage_space = no; then
|
||||
fi
|
||||
|
||||
if test $ac_fsusage_space = no; then
|
||||
# SVR2
|
||||
AC_TRY_CPP([#include <sys/filsys.h>],
|
||||
AC_DEFINE(STAT_READ_FILSYS, 1,
|
||||
[ Define if there is no specific function for reading filesystems usage
|
||||
information and you have the <sys/filsys.h> header file. (SVR2)])
|
||||
ac_fsusage_space=yes)
|
||||
# SVR2
|
||||
AC_TRY_CPP([#include <sys/filsys.h>
|
||||
],
|
||||
AC_DEFINE(STAT_READ_FILSYS, 1,
|
||||
[Define if there is no specific function for reading filesystems usage
|
||||
information and you have the <sys/filsys.h> header file. (SVR2)])
|
||||
ac_fsusage_space=yes)
|
||||
fi
|
||||
|
||||
AS_IFELSE([test $ac_fsusage_space = yes], [$1], [$2])dnl
|
||||
dnl FIXME: this should use AS_IF instead:
|
||||
dnl AS_IF([test $ac_fsusage_space = found], [$1], [$2])
|
||||
if test $ac_fsusage_space = yes; then
|
||||
$1
|
||||
else
|
||||
$2
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
23
m4/iconv.m4
23
m4/iconv.m4
@@ -1,4 +1,4 @@
|
||||
#serial 1
|
||||
#serial 2
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
@@ -30,6 +30,27 @@ AC_DEFUN(jm_ICONV,
|
||||
])
|
||||
if test "$jm_cv_func_iconv" = yes; then
|
||||
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
||||
AC_MSG_CHECKING([for iconv declaration])
|
||||
AC_CACHE_VAL(jm_cv_proto_iconv, [
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t* outbytesleft);
|
||||
#else
|
||||
size_t iconv();
|
||||
#endif
|
||||
], [], jm_cv_proto_iconv_arg1="", jm_cv_proto_iconv_arg1="const")
|
||||
jm_cv_proto_iconv="extern size_t iconv (iconv_t cd, $jm_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t* outbytesleft);"])
|
||||
jm_cv_proto_iconv=`echo "[$]jm_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
|
||||
AC_MSG_RESULT([$]{ac_t:-
|
||||
}[$]jm_cv_proto_iconv)
|
||||
AC_DEFINE_UNQUOTED(ICONV_CONST, $jm_cv_proto_iconv_arg1,
|
||||
[Define as const if the declaration of iconv() needs const.])
|
||||
fi
|
||||
LIBICONV=
|
||||
if test "$jm_cv_lib_iconv" = yes; then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 28 -*- autoconf -*-
|
||||
#serial 31 -*- autoconf -*-
|
||||
|
||||
dnl Misc type-related macros for fileutils, sh-utils, textutils.
|
||||
|
||||
@@ -19,45 +19,7 @@ AC_DEFUN(jm_MACROS,
|
||||
dnl This macro actually runs replacement code. See isc-posix.m4.
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
|
||||
AC_CHECK_HEADERS( \
|
||||
errno.h \
|
||||
fcntl.h \
|
||||
fenv.h \
|
||||
float.h \
|
||||
limits.h \
|
||||
memory.h \
|
||||
mntent.h \
|
||||
mnttab.h \
|
||||
netdb.h \
|
||||
paths.h \
|
||||
stdlib.h \
|
||||
stddef.h \
|
||||
stdint.h \
|
||||
string.h \
|
||||
sys/acl.h \
|
||||
sys/filsys.h \
|
||||
sys/fs/s5param.h \
|
||||
sys/fs_types.h \
|
||||
sys/fstyp.h \
|
||||
sys/ioctl.h \
|
||||
sys/mntent.h \
|
||||
sys/mount.h \
|
||||
sys/param.h \
|
||||
sys/socket.h \
|
||||
sys/statfs.h \
|
||||
sys/statvfs.h \
|
||||
sys/systeminfo.h \
|
||||
sys/time.h \
|
||||
sys/timeb.h \
|
||||
sys/vfs.h \
|
||||
sys/wait.h \
|
||||
syslog.h \
|
||||
termios.h \
|
||||
unistd.h \
|
||||
utime.h \
|
||||
values.h \
|
||||
)
|
||||
|
||||
jm_CHECK_ALL_TYPES
|
||||
jm_INCLUDED_REGEX([lib/regex.c])
|
||||
|
||||
AC_REQUIRE([jm_BISON])
|
||||
@@ -70,7 +32,6 @@ AC_DEFUN(jm_MACROS,
|
||||
|
||||
AC_REQUIRE([jm_PREREQ])
|
||||
|
||||
AC_REQUIRE([jm_SYS_OFF_T_PRINTF_FORMAT])
|
||||
AC_REQUIRE([jm_FUNC_LCHOWN])
|
||||
AC_REQUIRE([fetish_FUNC_RMDIR_NOTEMPTY])
|
||||
AC_REQUIRE([jm_FUNC_CHOWN])
|
||||
@@ -104,6 +65,7 @@ AC_DEFUN(jm_MACROS,
|
||||
AC_FUNC_GETLOADAVG([lib])
|
||||
AC_REQUIRE([jm_SYS_PROC_UPTIME])
|
||||
AC_REQUIRE([jm_FUNC_FTRUNCATE])
|
||||
AC_REQUIRE([vb_FUNC_RENAME])
|
||||
|
||||
AC_REPLACE_FUNCS(strcasecmp strncasecmp)
|
||||
AC_REPLACE_FUNCS(dup2)
|
||||
@@ -224,9 +186,55 @@ AC_DEFUN(jm_MACROS,
|
||||
AC_LIBOBJ(fsusage)
|
||||
AC_LIBOBJ(mountlist)
|
||||
fi
|
||||
AC_REQUIRE([jm_AC_DOS])
|
||||
|
||||
])
|
||||
|
||||
# These tests must be run before any use of AC_CHECK_TYPE,
|
||||
# because that macro compiles code that tests e.g., HAVE_UNISTD_H.
|
||||
# See the definition of ac_includes_default in `configure'.
|
||||
AC_DEFUN(jm_CHECK_ALL_HEADERS,
|
||||
[
|
||||
AC_CHECK_HEADERS( \
|
||||
errno.h \
|
||||
fcntl.h \
|
||||
fenv.h \
|
||||
float.h \
|
||||
limits.h \
|
||||
memory.h \
|
||||
mntent.h \
|
||||
mnttab.h \
|
||||
netdb.h \
|
||||
paths.h \
|
||||
stdlib.h \
|
||||
stddef.h \
|
||||
stdint.h \
|
||||
string.h \
|
||||
sys/acl.h \
|
||||
sys/filsys.h \
|
||||
sys/fs/s5param.h \
|
||||
sys/fs_types.h \
|
||||
sys/fstyp.h \
|
||||
sys/ioctl.h \
|
||||
sys/mntent.h \
|
||||
sys/mount.h \
|
||||
sys/param.h \
|
||||
sys/socket.h \
|
||||
sys/statfs.h \
|
||||
sys/statvfs.h \
|
||||
sys/systeminfo.h \
|
||||
sys/time.h \
|
||||
sys/timeb.h \
|
||||
sys/vfs.h \
|
||||
sys/wait.h \
|
||||
syslog.h \
|
||||
termios.h \
|
||||
unistd.h \
|
||||
utime.h \
|
||||
values.h \
|
||||
)
|
||||
])
|
||||
|
||||
# This macro must be invoked before any tests that run the compiler.
|
||||
AC_DEFUN(jm_CHECK_ALL_TYPES,
|
||||
[
|
||||
@@ -253,6 +261,7 @@ AC_DEFUN(jm_CHECK_ALL_TYPES,
|
||||
AC_REQUIRE([AC_C_INLINE])
|
||||
AC_REQUIRE([AC_C_LONG_DOUBLE])
|
||||
|
||||
AC_REQUIRE([jm_CHECK_ALL_HEADERS])
|
||||
AC_REQUIRE([AC_HEADER_DIRENT])
|
||||
AC_REQUIRE([AC_HEADER_STDC])
|
||||
AC_CHECK_MEMBERS([struct stat.st_blksize],,,[$ac_includes_default
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 109
|
||||
# serial 110
|
||||
|
||||
AC_PREREQ(2.13) dnl Minimum Autoconf version required.
|
||||
|
||||
@@ -289,7 +289,7 @@ strdup __argz_count __argz_stringify __argz_next])
|
||||
dnl Try to locate it.
|
||||
MKINSTALLDIRS=
|
||||
if test -n "$ac_aux_dir"; then
|
||||
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
|
||||
MKINSTALLDIRS="`CDPATH=:; cd $ac_aux_dir && pwd`/mkinstalldirs"
|
||||
fi
|
||||
if test -z "$MKINSTALLDIRS"; then
|
||||
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 6
|
||||
#serial 8
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl
|
||||
@@ -6,8 +6,6 @@ dnl This is not pretty. I've just taken the autoconf code and wrapped
|
||||
dnl it in an AC_DEFUN.
|
||||
dnl
|
||||
|
||||
AC_PREREQ(2.14a)
|
||||
|
||||
# jm_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
AC_DEFUN(jm_LIST_MOUNTED_FILESYSTEMS,
|
||||
[
|
||||
@@ -239,6 +237,12 @@ if test -z "$ac_list_mounted_fs"; then
|
||||
# Can't build mountlist.c or anything that needs its functions
|
||||
fi
|
||||
|
||||
AS_IFELSE([test $ac_list_mounted_fs = found], [$1], [$2])dnl
|
||||
dnl FIXME: this should use AS_IF instead:
|
||||
dnl AS_IF([test $ac_list_mounted_fs = found], [$1], [$2])
|
||||
if test $ac_list_mounted_fs = found; then
|
||||
$1
|
||||
else
|
||||
$2
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#serial 1 -*- autoconf -*-
|
||||
|
||||
dnl FIXME
|
||||
AC_DEFUN(jm_SYS_OFF_T_PRINTF_FORMAT,
|
||||
[dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])
|
||||
AC_CHECK_HEADERS(string.h stdlinb.h)
|
||||
AC_CACHE_CHECK([for printf format that works with type off_t],
|
||||
jm_cv_sys_off_t_printf_format,
|
||||
[
|
||||
jm_cv_sys_off_t_printf_format=undef
|
||||
for jm_fmt in '' L ll q; do
|
||||
jm_OFF_T_FORMAT="$jm_fmt"
|
||||
export jm_OFF_T_FORMAT
|
||||
AC_TRY_RUN([
|
||||
# include <sys/types.h>
|
||||
# include <stdio.h>
|
||||
# if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
# if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
# endif
|
||||
int
|
||||
main()
|
||||
{
|
||||
static off_t x[] = {1, 255, 65535, 99999999};
|
||||
char buf[50], fmt[50];
|
||||
|
||||
/* this should be one of these values: "", "L", "ll", "q" */
|
||||
char *f = getenv ("jm_OFF_T_FORMAT");
|
||||
|
||||
sprintf (fmt, "%%%sd %%%sx %%%sx %%%sd", f, f, f, f);
|
||||
sprintf (buf, fmt, x[0], x[1], x[2], x[3]);
|
||||
exit (strcmp (buf, "1 ff ffff 99999999"));
|
||||
}
|
||||
], jm_cv_sys_off_t_printf_format=$jm_fmt; break
|
||||
, dnl didn't work
|
||||
dnl Cross compiling -- you lose. Specify it via the cache.
|
||||
)
|
||||
done
|
||||
|
||||
# Die if none of the above worked.
|
||||
# FIXME: If this failure become a problem that we can't work around,
|
||||
# an alternative would be to arrange not to build od.
|
||||
if test "$jm_cv_sys_off_t_printf_format" = undef; then
|
||||
AC_MSG_ERROR(dnl
|
||||
[couldn't find a printf format that works with the type, off_t])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED(OFF_T_PRINTF_FORMAT_STRING,
|
||||
"$jm_cv_sys_off_t_printf_format",
|
||||
[printf format string for type off_t, without the `%'])
|
||||
])
|
||||
14
m4/prereq.m4
14
m4/prereq.m4
@@ -1,4 +1,4 @@
|
||||
#serial 13
|
||||
#serial 16
|
||||
|
||||
dnl These are the prerequisite macros for files in the lib/
|
||||
dnl directories of the fileutils, sh-utils, and textutils packages.
|
||||
@@ -10,6 +10,7 @@ AC_DEFUN(jm_PREREQ,
|
||||
jm_PREREQ_DIRNAME
|
||||
jm_PREREQ_ERROR
|
||||
jm_PREREQ_GETPAGESIZE
|
||||
jm_PREREQ_HASH
|
||||
jm_PREREQ_HUMAN
|
||||
jm_PREREQ_MBSWIDTH
|
||||
jm_PREREQ_MEMCHR
|
||||
@@ -53,6 +54,12 @@ AC_DEFUN(jm_PREREQ_GETPAGESIZE,
|
||||
AC_CHECK_HEADERS(OS.h unistd.h)
|
||||
])
|
||||
|
||||
AC_DEFUN(jm_PREREQ_HASH,
|
||||
[
|
||||
AC_CHECK_HEADERS(stdlib.h stdbool.h)
|
||||
AC_REQUIRE([jm_CHECK_DECLS])
|
||||
])
|
||||
|
||||
# If you use human.c, you need the following files:
|
||||
# uintmax_t.m4 inttypes_h.m4 ulonglong.m4
|
||||
AC_DEFUN(jm_PREREQ_HUMAN,
|
||||
@@ -71,7 +78,7 @@ AC_DEFUN(jm_PREREQ_MEMCHR,
|
||||
AC_DEFUN(jm_PREREQ_QUOTEARG,
|
||||
[
|
||||
AC_CHECK_FUNCS(isascii iswprint mbrtowc)
|
||||
AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
|
||||
AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h)
|
||||
AC_HEADER_STDC
|
||||
AC_C_BACKSLASH_A
|
||||
AC_MBSTATE_T
|
||||
@@ -91,7 +98,8 @@ AC_DEFUN(jm_PREREQ_READUTMP,
|
||||
$ac_includes_default
|
||||
#ifdef HAVE_UTMPX_H
|
||||
# include <utmpx.h>
|
||||
#else
|
||||
#endif
|
||||
#ifdef HAVE_UTMP_H
|
||||
# include <utmp.h>
|
||||
#endif
|
||||
"
|
||||
|
||||
40
m4/rename.m4
Normal file
40
m4/rename.m4
Normal file
@@ -0,0 +1,40 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Volker Borchert.
|
||||
dnl Determine whether rename works for source paths with a trailing slash.
|
||||
dnl The rename from SunOS 4.1.1_U1 doesn't.
|
||||
dnl
|
||||
dnl If it doesn't, then define RENAME_TRAILING_SLASH_BUG and arrange
|
||||
dnl to compile the wrapper function.
|
||||
dnl
|
||||
|
||||
AC_DEFUN(vb_FUNC_RENAME,
|
||||
[
|
||||
AC_CACHE_CHECK([whether rename is broken],
|
||||
vb_cv_func_rename_trailing_slash_bug,
|
||||
[
|
||||
rm -rf conftestdir conftestdir2
|
||||
mkdir conftestdir ||
|
||||
AC_MSG_ERROR([cannot create temporary directory])
|
||||
AC_TRY_RUN([
|
||||
# include <stdio.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
exit (rename ("conftestdir/", "conftestdir2") ? 1 : 0);
|
||||
}
|
||||
],
|
||||
vb_cv_func_rename_trailing_slash_bug=no,
|
||||
vb_cv_func_rename_trailing_slash_bug=yes,
|
||||
dnl When crosscompiling, assume rename is broken.
|
||||
vb_cv_func_rename_trailing_slash_bug=yes)
|
||||
|
||||
rm -rf conftestdir conftestdir2
|
||||
])
|
||||
if test $vb_cv_func_rename_trailing_slash_bug = yes; then
|
||||
AC_LIBOBJ(rename)
|
||||
AC_DEFINE_UNQUOTED(RENAME_TRAILING_SLASH_BUG, 1,
|
||||
[Define if rename does not work for source paths with a trailing slash,
|
||||
like the one from SunOS 4.1.1_U1.])
|
||||
fi
|
||||
])
|
||||
37
man/help2man
37
man/help2man
@@ -27,7 +27,7 @@ use Text::Tabs qw(expand);
|
||||
use POSIX qw(strftime setlocale LC_TIME);
|
||||
|
||||
my $this_program = 'help2man';
|
||||
my $this_version = '1.23';
|
||||
my $this_version = '1.24';
|
||||
my $version_info = <<EOT;
|
||||
GNU $this_program $this_version
|
||||
|
||||
@@ -59,18 +59,20 @@ EOT
|
||||
|
||||
my $section = 1;
|
||||
my ($opt_name, @opt_include, $opt_output, $opt_no_info);
|
||||
|
||||
# Parse options.
|
||||
Getopt::Long::config('bundling');
|
||||
GetOptions (
|
||||
my %opt_def = (
|
||||
'n|name=s' => \$opt_name,
|
||||
's|section=s' => \$section,
|
||||
'i|include=s' => sub { push @opt_include, [ pop, 1 ] },
|
||||
'I|opt-include=s' => sub { push @opt_include, [ pop, 0 ] },
|
||||
'o|output=s' => \$opt_output,
|
||||
'N|no-info' => \$opt_no_info,
|
||||
help => sub { print $help_info; exit },
|
||||
version => sub { print $version_info; exit },
|
||||
);
|
||||
|
||||
# Parse options.
|
||||
Getopt::Long::config('bundling');
|
||||
GetOptions (%opt_def,
|
||||
help => sub { print $help_info; exit },
|
||||
version => sub { print $version_info; exit },
|
||||
) or die $help_info;
|
||||
|
||||
die $help_info unless @ARGV == 1;
|
||||
@@ -93,9 +95,9 @@ BEGIN { eval q(sub qr { '' =~ $_[0]; $_[0] }) if $] < 5.005 }
|
||||
# verbatim text
|
||||
#
|
||||
|
||||
for (@opt_include)
|
||||
while (@opt_include)
|
||||
{
|
||||
my ($inc, $required) = @$_;
|
||||
my ($inc, $required) = @{shift @opt_include};
|
||||
|
||||
next unless -f $inc or $required;
|
||||
die "$this_program: can't open `$inc' ($!)\n"
|
||||
@@ -134,9 +136,20 @@ for (@opt_include)
|
||||
next;
|
||||
}
|
||||
|
||||
# Silently ignore anything before the first
|
||||
# section--allows for comments and revision info.
|
||||
next unless $key;
|
||||
# Check for options before the first section--anything else is
|
||||
# silently ignored, allowing the first for comments and
|
||||
# revision info.
|
||||
unless ($key)
|
||||
{
|
||||
# handle options
|
||||
if (/^-/)
|
||||
{
|
||||
local @ARGV = split;
|
||||
GetOptions %opt_def;
|
||||
}
|
||||
|
||||
next;
|
||||
}
|
||||
|
||||
$hash->{$key} ||= '';
|
||||
$hash->{$key} .= $_;
|
||||
|
||||
@@ -1,7 +1,433 @@
|
||||
2000-12-03 Jim Meyering <meyering@lucent.com>
|
||||
2001-01-28 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.38.
|
||||
|
||||
* configure, aclocal.m4, etc.: Regenerate using autoconf-2.49c.
|
||||
|
||||
* src/ls.c (gobble_file): Add a FIXME comment.
|
||||
|
||||
* TODO: Add a few items.
|
||||
|
||||
* src/ls.c (enum) [FULL_TIME]: Define.
|
||||
(long_options): Use it.
|
||||
(decode_switches): Make --full-time imply -l.
|
||||
Prompted by a report from Karl Eichwalder.
|
||||
|
||||
2001-01-22 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/remove.c (remove_file): Correct an expression to avoid making
|
||||
an unnecessary call to euidaccess for each file.
|
||||
|
||||
2001-01-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.37.
|
||||
|
||||
2001-01-20 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* configure.in: Remove jm_CHECK_ALL_TYPES.
|
||||
Now it's invoked by jm_MACROS.
|
||||
|
||||
2001-01-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/sys2.h (case_GETOPT_VERSION_CHAR): Use PACKAGE, not GNU_PACKAGE.
|
||||
* src/sync.c (main): Likewise.
|
||||
* src/shred.c (PACKAGE): Likewise.
|
||||
* src/dd.c (main): Likewise.
|
||||
|
||||
2001-01-14 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.36.
|
||||
|
||||
* src/shred.c (UINT_MAX_32_BITS): Define.
|
||||
Use UINT_MAX_32_BITS in the cpp conditions that determine
|
||||
the `word32' typedef. Using a literal `0xffffffff' failed with
|
||||
HPUX10.20's /bin/cc.
|
||||
|
||||
* config.sub: Update from master repository.
|
||||
* config.guess: Likewise.
|
||||
|
||||
2001-01-02 Volker Borchert <bt@teknon.de>
|
||||
|
||||
Work around a broken rename system call, e.g. on SunOS 4.1.1_U1,
|
||||
that fails when the source path has a trailing slash.
|
||||
* src/copy.h [RENAME_TRAILING_SLASH_BUG]: Use the rename wrapper.
|
||||
* tests/mv/trailing-slash: Test whether the workaround works.
|
||||
* tests/m4/Makefile.am (TESTS): Add trailing-slash.
|
||||
|
||||
2001-01-03 Alexandre Duret-Lutz <duret_g@epita.fr>
|
||||
|
||||
* po/Makefile.in.in (update-po): Merge po-files in temporary files
|
||||
in the build directory, and update the source directory only when
|
||||
the merged catalog differs from the original. This fixes the known
|
||||
`make distcheck' failure due to `make update-po' being called
|
||||
on up-to-date but read-only files.
|
||||
|
||||
2001-01-13 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/copy.c (same_file_ok): When moving a symlink onto itself,
|
||||
don't remove the symlink. Reported by David Luyer as Debian bug#82089,
|
||||
via Michael Stone.
|
||||
* tests/mv/into-self-4: New test for the above.
|
||||
* tests/mv/Makefile.am (TESTS): Add into-self-4.
|
||||
|
||||
* tests/chmod/setgid: If `chmod g+s d' fails, then try to chgrp
|
||||
to a group of which we're a member, then try the chmod again.
|
||||
|
||||
2001-01-11 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* depcomp: New version, from automake.
|
||||
|
||||
2001-01-10 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/copy.c (copy_internal): Add a comment.
|
||||
Set *copy_into_self in the new code that detects that.
|
||||
Make diagnostic more consistent: s/won't/will not/.
|
||||
[move_mode, copy_into_self]: Give a diagnstic here, now that
|
||||
we have the top_level_* globals. Remove the corresponding diagnostic
|
||||
from mv.c.
|
||||
Add a FIXME comment.
|
||||
* src/mv.c (do_move): Remove diagnostic, now that copy.c issues it.
|
||||
Set `fail' to nonzero in the primary `if (copy_into_self)' block
|
||||
rather than in its own tiny one below.
|
||||
|
||||
* src/copy.c (copy_internal): Don't allow cp (or mv, when working
|
||||
across a partition boundary) to overwrite a non-directory with a
|
||||
directory. Reported by Michael J. Croghan.
|
||||
* tests/cp/dir-vs-file: New test for the above.
|
||||
* tests/cp/Makefile.am (TESTS): Add dir-vs-file.
|
||||
|
||||
2001-01-09 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
Give a better diagnostic for `cp -R a a'.
|
||||
* src/copy.c (top_level_src_path, top_level_dst_path): New globals.
|
||||
(copy_internal): Use them.
|
||||
(copy): Set them.
|
||||
* src/cp-hash.c [struct entry] (node): Describe how it's used,
|
||||
now that we've overloaded it, in order to detect and diagnose
|
||||
the copying-directory-into-self problem.
|
||||
(new_file): Remove global.
|
||||
(htab): Declare global to be static.
|
||||
(remember_created): Insert file name instead of dummy pointer, so
|
||||
that copy.c can use the just-created directory name to detect
|
||||
the copying-directory-into-self problem.
|
||||
* tests/cp/into-self: New test for the above.
|
||||
* tests/cp/Makefile.am (TESTS): Add into-self.
|
||||
|
||||
2001-01-07 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/cp.c (usage): Split a string that was longer than 2048 bytes.
|
||||
|
||||
* doc/perm.texi: s/can not/cannot/
|
||||
|
||||
2001-01-07 Karl Eichwalder <ke@suse.de>
|
||||
|
||||
* src/chown.c (usage): Split long message string.
|
||||
|
||||
2001-01-07 Karl Eichwalder <ke@suse.de>
|
||||
|
||||
* src/ls.c (usage): Untabify.
|
||||
|
||||
* src/chgrp.c (parse_group): Normalize spelling.
|
||||
|
||||
2001-01-03 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* NEWS: Document the planned --full-time change.
|
||||
* doc/fileutils.texi: Likewise.
|
||||
* NEWS: Document that time stamps depend on LC_TIME, not LC_MESSAGES.
|
||||
|
||||
2001-01-03 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Use the more precise algorithm of GNU "make" to decide whether
|
||||
a file is in the future, by looking at high-resolution time
|
||||
stamps if available.
|
||||
|
||||
* src/ls.c:
|
||||
(TIMESPEC_NS): New macro.
|
||||
(current_time): Initialize to the minimum value.
|
||||
(current_time_ns): New var.
|
||||
(main): Do not bother to initialize current_time;
|
||||
it's no longer needed.
|
||||
(get_current_time): New function.
|
||||
(print_long_format): Use it when a file appears to be in the future.
|
||||
Get the nanoseconds of the file's time stamp, if available,
|
||||
and use that to decide whether the file appears to be in the future.
|
||||
|
||||
* src/Makefile.am (dir_LDADD, ls_LDADD, vdir_LDADD): New macros.
|
||||
|
||||
2001-01-02 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/ls.c (long_time_expected_width, print_long_format): Fix
|
||||
bug: the initial byte passed to strftime wasn't initialized to
|
||||
a nonzero value after the buffer was reallocated.
|
||||
|
||||
2001-01-02 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Make ls -l compatible with POSIX, which requires that the
|
||||
behavior of time formats must depend only on LC_TIME, not on
|
||||
LC_MESSAGES.
|
||||
|
||||
* po/Makefile.in.in (install-data-yes): If the package is
|
||||
fileutils, install LC_TIME as an alias for LC_MESSAGES.
|
||||
* src/sys2.h (dcgettext): New macro.
|
||||
* src/ls.c (decode_switches): Use dcgettext with LC_TIME,
|
||||
not plain gettext, to get the translations of time formats.
|
||||
|
||||
2001-01-02 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/ls.c (long_time_expected_width): New function.
|
||||
(print_long_format): Use it, so that we don't assume a
|
||||
particular width for time stamps in an internationalized
|
||||
environment.
|
||||
|
||||
2001-01-01 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* doc/fileutils.texi, NEWS:
|
||||
ls -l now reports the year for files even slightly in the future, as
|
||||
POSIX requires. This helps warn users about clock skew problems.
|
||||
|
||||
* src/ls.c (print_long_format):
|
||||
Report the year for files even slightly in the future.
|
||||
Avoid overflow problems near Y2038 on 32-bit hosts.
|
||||
To calculate "six months", take half the average Gregorian
|
||||
year, not 180 days.
|
||||
|
||||
2001-01-01 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/chmod/Makefile.am (TESTS): Add setgid.
|
||||
* tests/chmod/setgid: Test for chmod's existing behavior.
|
||||
Based on a report from Paul Eggert.
|
||||
|
||||
2000-12-29 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Clean up the terminology a tad: some directories were called "sticky"
|
||||
when they were really setgid.
|
||||
* tests/Makefile.am (EXTRA_DIST): sticky-check -> setgid-check
|
||||
* tests/chmod/c-option, tests/cp/cp-parents, tests/mkdir/parents,
|
||||
tests/mkdir/perm: Likewise.
|
||||
* tests/setgid-check: File renamed from tests/sticky-check.
|
||||
All uses of "sticky" changed to "setgid".
|
||||
|
||||
2000-12-31 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/cp/Makefile.am (TESTS): Add deref-slink.
|
||||
* tests/cp/deref-slink: New file. Test for the bug fixed by my
|
||||
2000-12-28 change to copy.c.
|
||||
|
||||
2000-12-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/ls.c: Improve performance by invoking gettext twice at the start,
|
||||
instead of once for each file.
|
||||
(long_time_format): New var.
|
||||
(decode_switches): Initialize it, if format == long_format.
|
||||
(print_long_format): Use it.
|
||||
|
||||
2000-12-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/ls.c (print_long_format): Don't dump core if strftime
|
||||
returns the empty string.
|
||||
|
||||
2000-12-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/ls.c (gobble_file): If not using long format, don't
|
||||
invoke acl; it's not needed.
|
||||
|
||||
2000-12-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
Avoid an unnecessary `stat' when using --dereference.
|
||||
* src/copy.c (same_file_ok): Use stat only if lstat reported that
|
||||
the file was a symbolic link.
|
||||
|
||||
2000-12-29 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* doc/perm.texi: append-only directories -> restricted deletion flag,
|
||||
which is the term that POSIX d5 uses for this notion.
|
||||
|
||||
2000-12-28 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* tests/group-names: Try /usr/xpg4/bin/id (Solaris 7) if plain
|
||||
'id' doesn't work.
|
||||
|
||||
2000-12-28 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/cp/cp-parents: Run sticky-check from just-created directory.
|
||||
|
||||
2000-12-28 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/copy.c (same_file_ok): Fix two typos from my 2000-09-03 change:
|
||||
s/tmp_dst_sb/tmp_src_sb/.
|
||||
|
||||
2000-12-27 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* tests/sticky-check: Turn off the working directory's sticky
|
||||
bit, so that we don't have to worry about it later.
|
||||
|
||||
* src/copy.c (same_file_ok): Use a single auto var for
|
||||
tmp_dst_sb, instead of two static vars. Likewise for
|
||||
tmp_src_sb.
|
||||
|
||||
2000-12-26 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.35.
|
||||
|
||||
* Regenerate build/config framework to use automake-1.4b and
|
||||
the latest CVS version autoconf.
|
||||
|
||||
* tests/mkdir/perm: Disable the test if the working directory has
|
||||
the sticky bit set.
|
||||
* tests/cp/cp-parents: Likewise.
|
||||
Reported by Nelson Beebe.
|
||||
|
||||
2000-12-25 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
Clean-up to avoid warnings from Irix's c89.
|
||||
|
||||
* src/remove.c (hash_compare_active_dir_ents): Return explicit `true'
|
||||
or `false', rather than relying on implicit int-to-enum cast.
|
||||
* src/copy.c (same_file_ok): Remove declaration and set of unused
|
||||
variables: src_sb_no_link, dst_sb_no_link.
|
||||
* src/ls.c (extract_dirs_from_files): Remove unused variable.
|
||||
Reported by Nelson Beebe.
|
||||
|
||||
* src/ls.c (gobble_file): Move decl of local, val, into the scope
|
||||
where it's used.
|
||||
|
||||
2000-12-24 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
For both ln and install, when using `--backup=simple --suffix=S',
|
||||
the suffix `S' wasn't used.
|
||||
|
||||
* src/ln.c (main): Actually use the local variable,
|
||||
`backup_suffix_string'.
|
||||
* src/install.c (main): Likewise.
|
||||
Nelson Beebe reported the unused variables.
|
||||
* tests/ln/misc: Add a test for this (for all of cp, mv, ln, install).
|
||||
|
||||
* man/help2man: Update to version 1.24.
|
||||
|
||||
2000-12-22 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.34.
|
||||
|
||||
* src/shred.c (isaac_seed_machdep) [_ARCH_PPC]: Disable the code
|
||||
that would use the PPC mfspr `asm' code. Suggestion from Michael Stone.
|
||||
|
||||
2000-12-19 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/fileutils.texi: Use `ref_file' in place of `file' to make
|
||||
descriptions of the various --reference=... options clearer.
|
||||
|
||||
2000-12-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/texinfo.tex: Update from master repository.
|
||||
* config.sub: Likewise.
|
||||
* config.guess: Likewise.
|
||||
|
||||
2000-12-16 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/chown-core.c (uint_to_string): New function.
|
||||
(uid_to_name): Use it.
|
||||
(gid_to_name): Use it.
|
||||
Rename locals, user/group, to uid/gid.
|
||||
|
||||
* src/chown-core.h (enum Change_status): Start with 1.
|
||||
|
||||
* src/chown.c (main): Rename locals, user/group, to uid/gid.
|
||||
* src/chgrp.c (main): Rename local, group, to gid.
|
||||
|
||||
* tests/group-names: New file.
|
||||
* tests/Makefile.am (EXTRA_DIST): Add group-names.
|
||||
* tests/chgrp/basic: Use group-names.
|
||||
* tests/chgrp/deref: Likewise.
|
||||
* tests/chgrp/recurse: Likewise.
|
||||
|
||||
* tests/chgrp/basic: Don't assume that creating a file gives it
|
||||
group $g1.
|
||||
|
||||
* tests/chgrp/Makefile.am (TESTS): Add recurse.
|
||||
|
||||
2000-12-15 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/chown-core.h [enum Dereference_symlink] (dereference): Rename
|
||||
from change_symlinks.
|
||||
* src/chown-core.c: Declare lstat.
|
||||
Rename change_symlinks member to `dereference' and use the DEREF_*
|
||||
enum values.
|
||||
(describe_change): Merge the chgrp and chown switch statements.
|
||||
Use xmalloc to form the `user:group' string.
|
||||
(change_file_owner): Record (and later, use) is_symlink and is_directory
|
||||
from the lstat stats, in order to control whether we operate on symlinks
|
||||
and whether (with -R) we traverse symlinks to directories.
|
||||
When dereferencing, use open/fchown (rather than chown) on symlinks.
|
||||
* src/chown.c (main): Reflect renaming: s/dereference/change_symlinks/.
|
||||
* src/chgrp.c (main): Likewise.
|
||||
|
||||
* src/chown-core.c (describe_change): Use `:' (not `.') to separate the
|
||||
username and group in messages evoked by the --verbose and --changes
|
||||
options.
|
||||
|
||||
2000-12-09 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/Makefile.am (noinst_HEADERS): Add chown-core.h.
|
||||
(chown_SOURCES): Define.
|
||||
(chgrp_SOURCES): Define.
|
||||
|
||||
* src/chgrp.c: Include "chown-core.h".
|
||||
[enum Change_status, enum Verbosity]: Remove declarations.
|
||||
Remove decls of globals that are now part of struct Chown_option.
|
||||
Remove decl of xstat.
|
||||
(describe_change): Remove function.
|
||||
(change_file_group): Likewise.
|
||||
(change_dir_group): Likewise.
|
||||
(parse_group): Don't set global, groupname, here...
|
||||
(main): ... instead, initialize `chopt.group_name' here.
|
||||
Initialize chopt and update uses of the now-members.
|
||||
Set group_name also when it's obtained via a --reference=FILE option.
|
||||
Call change_file_owner (with -1 for uids), not change_file_group.
|
||||
|
||||
* src/chown.c: Don't include pwd.h or grp.h -- no longer needed.
|
||||
Include "chown-core.h".
|
||||
[enum Change_status, enum Verbosity]: Remove declarations.
|
||||
Remove decls of globals that are now part of struct Chown_option.
|
||||
(describe_change): Remove function.
|
||||
(change_file_owner): Likewise.
|
||||
(change_dir_owner): Likewise.
|
||||
(main): Initialize chopt and update uses of the now-members.
|
||||
Set user_name and group_name also when they're obtained via a
|
||||
--reference=FILE option.
|
||||
Pass `chopt' to change_file_owner.
|
||||
|
||||
* src/chown-core.c: Include <pwd.h>, <grp.h>, and "xalloc.h".
|
||||
[!_POSIX_VERSION]: Declare getgrnam and getgrgid.
|
||||
(gid_to_name): New function.
|
||||
(uid_to_name): Likewise.
|
||||
(chopt_free): Likewise.
|
||||
|
||||
Factor out code that's common to chgrp.c and chown.c.
|
||||
* src/chown-core.h: New file.
|
||||
* src/chown-core.c (chopt_init): New function.
|
||||
(describe_change): Extracted/combined from chgrp.c and chown.c.
|
||||
(change_dir_owner): Likewise.
|
||||
(change_file_owner): Likewise.
|
||||
* po/POTFILES.in: Add src/chown-core.c.
|
||||
|
||||
* configure.in (AC_OUTPUT): Add tests/chgrp/Makefile.
|
||||
* tests/Makefile.am (SUBDIRS): Add chgrp.
|
||||
* tests/chgrp: New directory.
|
||||
* tests/chgrp/basic: New test.
|
||||
* tests/chgrp/deref: Likewise.
|
||||
* tests/chgrp/Makefile.am: New file.
|
||||
|
||||
* src/chown.c (change_file_owner): Restore special file permission
|
||||
bits, since calling chown resets them on some systems.
|
||||
Reported by Matt Perry.
|
||||
|
||||
2000-12-08 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* tests/mv/mv-special-1: Don't make the success of the test depend
|
||||
on the order in which directory entries are processed.
|
||||
|
||||
2000-12-03 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/ls.c (gobble_file) [USE_ACL]: Set have_acl member unconditionally
|
||||
to avoid uninitialized memory reference via FILE_HAS_ACL.
|
||||
|
||||
|
||||
@@ -1,5 +1,32 @@
|
||||
Changes in release 4.01:
|
||||
[4.0.38]
|
||||
* ls --full-time now implies -l; before, without -l it was a no-op
|
||||
[4.0.37]
|
||||
* portability fixes for SunOS4.1.1, Fujitsu (f300-fujitsu-uxpv4.1_ES),
|
||||
and Unicos (alphaev5-cray-unicosmk2.0.5.X)
|
||||
[4.0.36]
|
||||
* `mv dir/ new-name' no longer fails on SunOS4.1.1U
|
||||
* attempting to use mv to move a symlink onto itself no longer removes
|
||||
the symlink
|
||||
* `cp -R directory file' no longer removes `file'. now it fails and gives
|
||||
a diagnostic
|
||||
* The manual now warns that ls's --full-time format string is planned
|
||||
to change in a future release.
|
||||
* ls -l's time stamp format now depends on LC_TIME, not LC_MESSAGES,
|
||||
as POSIX requires.
|
||||
* ls -l now reports the year for files even slightly in the future, as
|
||||
POSIX requires. This helps warn users about clock skew problems.
|
||||
* `cp -d file symlink-to-some-other-file' no longer fails
|
||||
* performance improvements for ls
|
||||
[4.0.35]
|
||||
* ln --backup=simple --suffix=SUFFIX once again uses SUFFIX
|
||||
* install: Likewise.
|
||||
[4.0.34]
|
||||
* fix a bug (introduced in 4.0z) that made `chown 123:456 file' act like
|
||||
`chown 123:123 file'. Other uses with a numeric group ID would cause
|
||||
chown to fail when it shouldn't have.
|
||||
* the chown and chgrp programs preserve set-uid and set-gid bits, even on
|
||||
systems for which the chown function call resets those bits.
|
||||
* `ls -L dangling-symlink' now fails (per POSIX) rather than printing the
|
||||
link name
|
||||
* dd no longer honors the just-added `B' suffix on skip= and seek= arguments.
|
||||
@@ -7,7 +34,9 @@ Changes in release 4.01:
|
||||
[4.0.33]
|
||||
* dd now accepts skip=nB and seek=nB, to advance past some number of bytes, n,
|
||||
that need not be a multiple of the block size.
|
||||
* dd (without conv=notrunc) now uses ftruncate only on regular files
|
||||
* dd (without conv=notrunc) now complains only when ftruncate fails on a
|
||||
regular file, a directory, or a shared memory object -- not when it fails
|
||||
to truncate other types of files, like /dev/fd0.
|
||||
* chmod --changes (-c) once again issues diagnostics only for the files
|
||||
with changed permissions
|
||||
* mkdir now gives one diagnostic (rather than two) for certain failures
|
||||
|
||||
@@ -1,6 +1,32 @@
|
||||
2000-12-02 Jim Meyering <meyering@lucent.com>
|
||||
2001-01-20 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 2.0.12.
|
||||
* configure.in: Remove jm_CHECK_ALL_TYPES.
|
||||
Now it's invoked by jm_MACROS.
|
||||
|
||||
2001-01-04 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/date.c (main): Fail when --rfc-822 (-R) is specified along
|
||||
with a format string. Reported by Jochen Hein.
|
||||
|
||||
2000-12-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/texinfo.tex: Update from master repository.
|
||||
* config.sub: Likewise.
|
||||
* config.guess: Likewise.
|
||||
|
||||
* djgpp: New directory.
|
||||
* djgpp/*: New files.
|
||||
* Makefile.am (SUBDIRS): Add djgpp.
|
||||
* configure.in (AC_OUTPUT): Add djgpp/Makefile.
|
||||
From Prashant TR.
|
||||
|
||||
2000-12-08 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/dirname.c: Include xalloc.h.
|
||||
(main): Use dir_name rather than the underlying dir_name_r.
|
||||
The former now handles cwd-relative names with drive-letter prefixes.
|
||||
|
||||
2000-12-02 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/seq.c (valid_format): Move pre-increment to a separate statement
|
||||
to avoid a warning.
|
||||
|
||||
@@ -1,3 +1,100 @@
|
||||
2001-01-20 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* configure.in: Remove jm_CHECK_ALL_TYPES.
|
||||
Now it's invoked by jm_MACROS.
|
||||
|
||||
2001-01-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/cksum.c (main): Use PACKAGE, not GNU_PACKAGE.
|
||||
* src/tsort.c (main): Likewise.
|
||||
* src/sort.c (main): Likewise.
|
||||
(usage): Convert each TAB in --help output to a sequence of 8 spaces.
|
||||
|
||||
2001-01-07 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/tail.c (usage): Split a string that was longer than 2048 bytes.
|
||||
|
||||
2001-01-03 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/sort.c (main): Remove embedded \n from diagnostic.
|
||||
|
||||
2001-01-02 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/od.c (ulonglong_t): Define place-holder type to avoid some #if
|
||||
directives.
|
||||
(LONGEST_INTEGRAL_TYPE): Remove definition.
|
||||
(MAX_INTEGRAL_TYPE_SIZE): Use ulonglong_t instead of
|
||||
LONGEST_INTEGRAL_TYPE.
|
||||
(print_long_long): Compile this function even on systems without
|
||||
long long support.
|
||||
(decode_one_format): Remove #if directive.
|
||||
|
||||
* src/od.c (decode_one_format): Guard use of print_long_long with
|
||||
`#if HAVE_UNSIGNED_LONG_LONG'. From Darren Salt.
|
||||
Change all `#ifdef HAVE_UNSIGNED_LONG_LONG' to use `#if' instead.
|
||||
|
||||
2000-12-23 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/sys2.h [HAVE_INTTYPES_H]: Include <inttypes.h>.
|
||||
|
||||
2000-12-19 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 2.0.11.
|
||||
|
||||
2000-12-18 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* NEWS, doc/textutils.texi: New "sort" option -S SIZE.
|
||||
|
||||
* src/sys2.h (UINTMAX_MAX): New macro, taken from C99.
|
||||
|
||||
* src/sort.c: Include physmem.h.
|
||||
(SORTALLOC, mergealloc, LINEALLOC): Remove.
|
||||
(sortalloc): Default to zero at program startup.
|
||||
(SORTALLOC_MIN, SORTALLOC_DEFAULT_MIN): New macros.
|
||||
(usage, main): Add support for new -S SIZE option.
|
||||
(specify_sort_size, default_sort_size): New functions.
|
||||
(initlines): Do not let alloc exceed limit.
|
||||
(findlines): Likewise.
|
||||
(checkfp, mergefps, sort): Use sortalloc to size everything
|
||||
else, instead of relying on precomputed sizes.
|
||||
|
||||
2000-12-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/texinfo.tex: Update from master repository.
|
||||
* config.sub: Likewise.
|
||||
* config.guess: Likewise.
|
||||
|
||||
2000-12-11 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 2.0.10.
|
||||
|
||||
2000-12-07 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/od.c (address_base): Declare to be static.
|
||||
|
||||
2000-12-06 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/od.c (address_base, address_pad_len): New var.
|
||||
(output_address_fmt_string, address_fmt_buffer, address_pad): Remove.
|
||||
(flag_pseudo_start): Now int, not long int.
|
||||
(pseudo_offset): Now off_t, not long int.
|
||||
(n_specs, n_specs_allocated): Now size_t, not unsigned int.
|
||||
(format_address, format_address_none, format_address_std,
|
||||
format_address_label): Now accepts an extra char argument (an extra
|
||||
char to print if nonzero), and prints instead of returning a string.
|
||||
All callers changed.
|
||||
(bytes_per_block): Now size_t, not int.
|
||||
(format_address_none): Do not even print the extra char argument.
|
||||
This simplifies the callers.
|
||||
(format_address_std, format_address_label): Print off_t ourself
|
||||
instead of trying to use autoconfigured format. This is faster and
|
||||
more portable.
|
||||
(format_address_paren): New function.
|
||||
(dump): Remove unnecessary cast.
|
||||
(expand_address_fmt): Remove.
|
||||
(main): Use size_t, off_t, etc. instead of builtin types where this is
|
||||
advisable. Adjust to above changes. Remove unnecessary cast.
|
||||
|
||||
2000-12-03 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/tail.c (tail_file): Initialize ignore, dev, and ino members,
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
Changes in release 2.1
|
||||
[2.0.11]
|
||||
* sort accepts new -S SIZE option, to specify main-memory usage.
|
||||
[2.0.10]
|
||||
* od is faster and more portable than it was in 2.0.9
|
||||
* tail avoids an uninitialized memory reference
|
||||
[2.0.9]
|
||||
* od now prints valid addresses for offsets of 2^32 and larger, and allows
|
||||
the byte offset (-j) and byte count (-N) arguments to be 2^32 and larger.
|
||||
|
||||
@@ -150,6 +150,13 @@ install-data-yes: all
|
||||
true; \
|
||||
fi; \
|
||||
fi; \
|
||||
if test "$(PACKAGE)" = "fileutils"; then \
|
||||
timedir=$$destdir/$$lang/LC_TIME; \
|
||||
rm -fr $$timedir; \
|
||||
ln -s LC_MESSAGES $$timedir \
|
||||
|| (mkdir $$timedir && ln $$dir/* $$timedir); \
|
||||
echo "installing $$timedir as an alias for $$dir"; \
|
||||
fi; \
|
||||
done
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
if test -x "$(MKINSTALLDIRS)"; then \
|
||||
@@ -206,20 +213,25 @@ dist distdir: update-po $(DISTFILES)
|
||||
|
||||
update-po: Makefile
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
PATH=`pwd`/../src:$$PATH; \
|
||||
cd $(srcdir); \
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
mv $$lang.po $$lang.old.po; \
|
||||
echo "$$lang:"; \
|
||||
if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
|
||||
rm -f $$lang.old.po; \
|
||||
if $(MSGMERGE) $(srcdir)/$$lang.po \
|
||||
$(srcdir)/$(PACKAGE).pot -o $$lang.new.po; then \
|
||||
if cmp $$lang.new.po $(srcdir)/$$lang.po >/dev/null; then \
|
||||
echo "$$lang.po is unchanged"; \
|
||||
rm -f $$lang.new.po; \
|
||||
else \
|
||||
echo "updating $$lang.po"; \
|
||||
rm -f $(srcdir)/$$lang.po; \
|
||||
mv $$lang.new.po $(srcdir)/$$lang.po; \
|
||||
fi; \
|
||||
else \
|
||||
echo "msgmerge for $$cat failed!"; \
|
||||
rm -f $$lang.po; \
|
||||
mv $$lang.old.po $$lang.po; \
|
||||
rm -f $$lang.new.po; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
|
||||
251
src/chgrp.c
251
src/chgrp.c
@@ -1,5 +1,5 @@
|
||||
/* chgrp -- change group ownership of files
|
||||
Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 1995-2001 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
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "quote.h"
|
||||
#include "savedir.h"
|
||||
#include "xstrtol.h"
|
||||
#include "chown-core.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "chgrp"
|
||||
@@ -52,54 +53,9 @@ struct group *getgrnam ();
|
||||
# define endgrent() ((void) 0)
|
||||
#endif
|
||||
|
||||
enum Change_status
|
||||
{
|
||||
CH_NOT_APPLIED,
|
||||
CH_SUCCEEDED,
|
||||
CH_FAILED,
|
||||
CH_NO_CHANGE_REQUESTED
|
||||
};
|
||||
|
||||
enum Verbosity
|
||||
{
|
||||
/* Print a message for each file that is processed. */
|
||||
V_high,
|
||||
|
||||
/* Print a message for each file whose attributes we change. */
|
||||
V_changes_only,
|
||||
|
||||
/* Do not be verbose. This is the default. */
|
||||
V_off
|
||||
};
|
||||
|
||||
int lstat ();
|
||||
|
||||
static int change_dir_group PARAMS ((const char *dir, gid_t group,
|
||||
const struct stat *statp));
|
||||
|
||||
/* The name the program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* If nonzero, and the systems has support for it, change the ownership
|
||||
of symbolic links rather than any files they point to. */
|
||||
static int change_symlinks = 1;
|
||||
|
||||
/* When change_symlinks is set, this should be set to `lstat', otherwise,
|
||||
it should be `stat'. */
|
||||
static int (*xstat) ();
|
||||
|
||||
/* If nonzero, change the ownership of directories recursively. */
|
||||
static int recurse;
|
||||
|
||||
/* If nonzero, force silence (no error messages). */
|
||||
static int force_silent;
|
||||
|
||||
/* Level of verbosity. */
|
||||
static enum Verbosity verbosity = V_off;
|
||||
|
||||
/* The name of the group to which ownership of the files is being given. */
|
||||
static const char *groupname;
|
||||
|
||||
/* The argument to the --reference option. Use the group ID of this file.
|
||||
This file must exist. */
|
||||
static char *reference_file;
|
||||
@@ -127,38 +83,6 @@ static struct option const long_options[] =
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* Tell the user how/if the group of FILE has been changed.
|
||||
CHANGED describes what (if anything) has happened. */
|
||||
|
||||
static void
|
||||
describe_change (const char *file, enum Change_status changed)
|
||||
{
|
||||
const char *fmt;
|
||||
|
||||
if (changed == CH_NOT_APPLIED)
|
||||
{
|
||||
printf (_("neither symbolic link %s nor referent has been changed\n"),
|
||||
quote (file));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (changed)
|
||||
{
|
||||
case CH_SUCCEEDED:
|
||||
fmt = _("group of %s changed to %s\n");
|
||||
break;
|
||||
case CH_FAILED:
|
||||
fmt = _("failed to change group of %s to %s\n");
|
||||
break;
|
||||
case CH_NO_CHANGE_REQUESTED:
|
||||
fmt = _("group of %s retained as %s\n");
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
printf (fmt, quote (file), groupname);
|
||||
}
|
||||
|
||||
/* Set *G according to NAME. */
|
||||
|
||||
static void
|
||||
@@ -166,9 +90,8 @@ parse_group (const char *name, gid_t *g)
|
||||
{
|
||||
struct group *grp;
|
||||
|
||||
groupname = name;
|
||||
if (*name == '\0')
|
||||
error (1, 0, _("can not change to null group"));
|
||||
error (1, 0, _("cannot change to null group"));
|
||||
|
||||
grp = getgrnam (name);
|
||||
if (grp == NULL)
|
||||
@@ -193,139 +116,6 @@ parse_group (const char *name, gid_t *g)
|
||||
endgrent (); /* Save a file descriptor. */
|
||||
}
|
||||
|
||||
/* Change the ownership of FILE to GID GROUP.
|
||||
If it is a directory and -R is given, recurse.
|
||||
Return 0 if successful, 1 if errors occurred. */
|
||||
|
||||
static int
|
||||
change_file_group (int cmdline_arg, const char *file, gid_t group)
|
||||
{
|
||||
struct stat file_stats;
|
||||
int errors = 0;
|
||||
|
||||
if ((*xstat) (file, &file_stats))
|
||||
{
|
||||
if (force_silent == 0)
|
||||
error (0, errno, _("getting attributes of %s"), quote (file));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (group != file_stats.st_gid)
|
||||
{
|
||||
int fail;
|
||||
int symlink_changed = 1;
|
||||
int saved_errno;
|
||||
|
||||
if (S_ISLNK (file_stats.st_mode) && change_symlinks)
|
||||
{
|
||||
fail = lchown (file, (uid_t) -1, group);
|
||||
|
||||
/* Ignore the failure if it's due to lack of support (ENOSYS)
|
||||
and this is not a command line argument. */
|
||||
if (!cmdline_arg && fail && errno == ENOSYS)
|
||||
{
|
||||
fail = 0;
|
||||
symlink_changed = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fail = chown (file, (uid_t) -1, group);
|
||||
}
|
||||
|
||||
/* Save errno, since in verbose mode, describe_change might change it. */
|
||||
saved_errno = errno;
|
||||
|
||||
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
|
||||
{
|
||||
enum Change_status ch_status = (! symlink_changed ? CH_NOT_APPLIED
|
||||
: (fail ? CH_FAILED : CH_SUCCEEDED));
|
||||
describe_change (file, ch_status);
|
||||
}
|
||||
|
||||
if (fail)
|
||||
{
|
||||
errors = 1;
|
||||
if (force_silent == 0)
|
||||
{
|
||||
/* Give a more specific message. Some systems set errno
|
||||
to EPERM for both `inaccessible file' and `user not a member
|
||||
of the specified group' errors. */
|
||||
if (saved_errno == EPERM && !group_member (group))
|
||||
{
|
||||
error (0, saved_errno, _("you are not a member of group %s"),
|
||||
quote (groupname));
|
||||
}
|
||||
else if (saved_errno == EINVAL && group > MAXUID)
|
||||
{
|
||||
error (0, 0, _("%s: invalid group number"),
|
||||
quote (groupname));
|
||||
}
|
||||
else
|
||||
{
|
||||
error (0, saved_errno, _("changing group of %s"),
|
||||
quote (file));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (verbosity == V_high)
|
||||
{
|
||||
describe_change (file, CH_NO_CHANGE_REQUESTED);
|
||||
}
|
||||
|
||||
if (recurse && S_ISDIR (file_stats.st_mode))
|
||||
errors |= change_dir_group (file, group, &file_stats);
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/* Recursively change the ownership of the files in directory DIR
|
||||
to GID GROUP.
|
||||
STATP points to the results of lstat on DIR.
|
||||
Return 0 if successful, 1 if errors occurred. */
|
||||
|
||||
static int
|
||||
change_dir_group (const char *dir, gid_t group, const struct stat *statp)
|
||||
{
|
||||
char *name_space, *namep;
|
||||
char *path; /* Full path of each entry to process. */
|
||||
unsigned dirlength; /* Length of `dir' and '\0'. */
|
||||
unsigned filelength; /* Length of each pathname to process. */
|
||||
unsigned pathlength; /* Bytes allocated for `path'. */
|
||||
int errors = 0;
|
||||
|
||||
name_space = savedir (dir, statp->st_size);
|
||||
if (name_space == NULL)
|
||||
{
|
||||
if (force_silent == 0)
|
||||
error (0, errno, "%s", quote (dir));
|
||||
return 1;
|
||||
}
|
||||
|
||||
dirlength = strlen (dir) + 1; /* + 1 is for the trailing '/'. */
|
||||
pathlength = dirlength + 1;
|
||||
/* Give `path' a dummy value; it will be reallocated before first use. */
|
||||
path = xmalloc (pathlength);
|
||||
strcpy (path, dir);
|
||||
path[dirlength - 1] = '/';
|
||||
|
||||
for (namep = name_space; *namep; namep += filelength - dirlength)
|
||||
{
|
||||
filelength = dirlength + strlen (namep) + 1;
|
||||
if (filelength > pathlength)
|
||||
{
|
||||
pathlength = filelength * 2;
|
||||
path = xrealloc (path, pathlength);
|
||||
}
|
||||
strcpy (path + dirlength, namep);
|
||||
errors |= change_file_group (0, path, group);
|
||||
}
|
||||
free (path);
|
||||
free (name_space);
|
||||
return errors;
|
||||
}
|
||||
|
||||
void
|
||||
usage (int status)
|
||||
{
|
||||
@@ -364,9 +154,10 @@ Change the group membership of each FILE to GROUP.\n\
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
gid_t group;
|
||||
gid_t gid;
|
||||
int errors = 0;
|
||||
int optc;
|
||||
struct Chown_option chopt;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
@@ -375,7 +166,7 @@ main (int argc, char **argv)
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
recurse = force_silent = 0;
|
||||
chopt_init (&chopt);
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, NULL)) != -1)
|
||||
{
|
||||
@@ -387,22 +178,22 @@ main (int argc, char **argv)
|
||||
reference_file = optarg;
|
||||
break;
|
||||
case DEREFERENCE_OPTION:
|
||||
change_symlinks = 0;
|
||||
chopt.dereference = DEREF_ALWAYS;
|
||||
break;
|
||||
case 'R':
|
||||
recurse = 1;
|
||||
chopt.recurse = 1;
|
||||
break;
|
||||
case 'c':
|
||||
verbosity = V_changes_only;
|
||||
chopt.verbosity = V_changes_only;
|
||||
break;
|
||||
case 'f':
|
||||
force_silent = 1;
|
||||
chopt.force_silent = 1;
|
||||
break;
|
||||
case 'h':
|
||||
change_symlinks = 1;
|
||||
chopt.dereference = DEREF_NEVER;
|
||||
break;
|
||||
case 'v':
|
||||
verbosity = V_high;
|
||||
chopt.verbosity = V_high;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
@@ -417,24 +208,26 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
if (change_symlinks)
|
||||
xstat = lstat;
|
||||
else
|
||||
xstat = stat;
|
||||
|
||||
if (reference_file)
|
||||
{
|
||||
struct stat ref_stats;
|
||||
if (stat (reference_file, &ref_stats))
|
||||
error (1, errno, _("getting attributes of %s"), quote (reference_file));
|
||||
|
||||
group = ref_stats.st_gid;
|
||||
chopt.group_name = gid_to_name (ref_stats.st_gid);
|
||||
gid = ref_stats.st_gid;
|
||||
}
|
||||
else
|
||||
parse_group (argv[optind++], &group);
|
||||
{
|
||||
chopt.group_name = argv[optind++];
|
||||
parse_group (chopt.group_name, &gid);
|
||||
}
|
||||
|
||||
for (; optind < argc; ++optind)
|
||||
errors |= change_file_group (1, argv[optind], group);
|
||||
errors |= change_file_owner (1, argv[optind], (uid_t) -1, gid,
|
||||
(uid_t) -1, (gid_t) -1, &chopt);
|
||||
|
||||
chopt_free (&chopt);
|
||||
|
||||
exit (errors);
|
||||
}
|
||||
|
||||
366
src/chown-core.c
Normal file
366
src/chown-core.c
Normal file
@@ -0,0 +1,366 @@
|
||||
/* chown-core.c -- core functions for changing ownership.
|
||||
Copyright (C) 2000 Free Software Foundation.
|
||||
|
||||
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. */
|
||||
|
||||
/* Extracted from chown.c/chgrp.c and librarified by Jim Meyering. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "lchown.h"
|
||||
#include "quote.h"
|
||||
#include "savedir.h"
|
||||
#include "chown-core.h"
|
||||
#include "xalloc.h"
|
||||
|
||||
/* The number of decimal digits required to represent the largest value of
|
||||
type `unsigned int'. This is enough for an 8-byte unsigned int type. */
|
||||
#define UINT_MAX_DECIMAL_DIGITS 20
|
||||
|
||||
#ifndef _POSIX_VERSION
|
||||
struct group *getgrnam ();
|
||||
struct group *getgrgid ();
|
||||
#endif
|
||||
|
||||
int lstat ();
|
||||
|
||||
void
|
||||
chopt_init (struct Chown_option *chopt)
|
||||
{
|
||||
chopt->verbosity = V_off;
|
||||
chopt->dereference = DEREF_NEVER;
|
||||
chopt->recurse = 0;
|
||||
chopt->force_silent = 0;
|
||||
chopt->user_name = 0;
|
||||
chopt->group_name = 0;
|
||||
}
|
||||
|
||||
void
|
||||
chopt_free (struct Chown_option *chopt)
|
||||
{
|
||||
/* Deliberately do not free chopt->user_name or ->group_name.
|
||||
They're not always allocated. */
|
||||
}
|
||||
|
||||
/* Convert N to a string, and return a pointer to that string in memory
|
||||
allocated from the heap. */
|
||||
|
||||
static char *
|
||||
uint_to_string (unsigned int n)
|
||||
{
|
||||
char buf[UINT_MAX_DECIMAL_DIGITS + 1];
|
||||
char *p = buf + sizeof buf;
|
||||
|
||||
*--p = '\0';
|
||||
|
||||
do
|
||||
*--p = '0' + (n % 10);
|
||||
while ((n /= 10) != 0);
|
||||
|
||||
return xstrdup (p);
|
||||
}
|
||||
|
||||
/* Convert the numeric group-id, GID, to a string stored in xmalloc'd memory,
|
||||
and return it. If there's no corresponding group name, use the decimal
|
||||
representation of the ID. */
|
||||
|
||||
char *
|
||||
gid_to_name (gid_t gid)
|
||||
{
|
||||
struct group *grp = getgrgid (gid);
|
||||
return grp ? xstrdup (grp->gr_name) : uint_to_string (gid);
|
||||
}
|
||||
|
||||
/* Convert the numeric user-id, UID, to a string stored in xmalloc'd memory,
|
||||
and return it. If there's no corresponding user name, use the decimal
|
||||
representation of the ID. */
|
||||
|
||||
char *
|
||||
uid_to_name (uid_t uid)
|
||||
{
|
||||
struct passwd *pwd = getpwuid (uid);
|
||||
return pwd ? xstrdup (pwd->pw_name) : uint_to_string (uid);
|
||||
}
|
||||
|
||||
/* Tell the user how/if the user and group of FILE have been changed.
|
||||
If USER is NULL, give the group-oriented messages.
|
||||
CHANGED describes what (if anything) has happened. */
|
||||
|
||||
static void
|
||||
describe_change (const char *file, enum Change_status changed,
|
||||
char const *user, char const *group)
|
||||
{
|
||||
const char *fmt;
|
||||
char *spec;
|
||||
int spec_allocated = 0;
|
||||
|
||||
if (changed == CH_NOT_APPLIED)
|
||||
{
|
||||
printf (_("neither symbolic link %s nor referent has been changed\n"),
|
||||
quote (file));
|
||||
return;
|
||||
}
|
||||
|
||||
if (user)
|
||||
{
|
||||
if (group)
|
||||
{
|
||||
spec = xmalloc (strlen (user) + 1 + strlen (group) + 1);
|
||||
stpcpy (stpcpy (stpcpy (spec, user), ":"), group);
|
||||
spec_allocated = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
spec = (char *) user;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
spec = (char *) group;
|
||||
}
|
||||
|
||||
switch (changed)
|
||||
{
|
||||
case CH_SUCCEEDED:
|
||||
fmt = (user
|
||||
? _("changed ownership of %s to %s\n")
|
||||
: _("changed group of %s to %s\n"));
|
||||
break;
|
||||
case CH_FAILED:
|
||||
fmt = (user
|
||||
? _("failed to change ownership of %s to %s\n")
|
||||
: _("failed to change group of %s to %s\n"));
|
||||
break;
|
||||
case CH_NO_CHANGE_REQUESTED:
|
||||
fmt = (user
|
||||
? _("ownership of %s retained as %s\n")
|
||||
: _("group of %s retained as %s\n"));
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
printf (fmt, quote (file), spec);
|
||||
|
||||
if (spec_allocated)
|
||||
free (spec);
|
||||
}
|
||||
|
||||
/* Recursively change the ownership of the files in directory DIR to user-id,
|
||||
UID, and group-id, GID, according to the options specified by CHOPT.
|
||||
STATP points to the results of lstat on DIR.
|
||||
Return 0 if successful, 1 if errors occurred. */
|
||||
|
||||
static int
|
||||
change_dir_owner (const char *dir, uid_t uid, gid_t gid,
|
||||
uid_t old_uid, gid_t old_gid,
|
||||
const struct stat *statp,
|
||||
struct Chown_option const *chopt)
|
||||
{
|
||||
char *name_space, *namep;
|
||||
char *path; /* Full path of each entry to process. */
|
||||
unsigned dirlength; /* Length of `dir' and '\0'. */
|
||||
unsigned filelength; /* Length of each pathname to process. */
|
||||
unsigned pathlength; /* Bytes allocated for `path'. */
|
||||
int errors = 0;
|
||||
|
||||
name_space = savedir (dir, statp->st_size);
|
||||
if (name_space == NULL)
|
||||
{
|
||||
if (chopt->force_silent == 0)
|
||||
error (0, errno, "%s", quote (dir));
|
||||
return 1;
|
||||
}
|
||||
|
||||
dirlength = strlen (dir) + 1; /* + 1 is for the trailing '/'. */
|
||||
pathlength = dirlength + 1;
|
||||
/* Give `path' a dummy value; it will be reallocated before first use. */
|
||||
path = xmalloc (pathlength);
|
||||
strcpy (path, dir);
|
||||
path[dirlength - 1] = '/';
|
||||
|
||||
for (namep = name_space; *namep; namep += filelength - dirlength)
|
||||
{
|
||||
filelength = dirlength + strlen (namep) + 1;
|
||||
if (filelength > pathlength)
|
||||
{
|
||||
pathlength = filelength * 2;
|
||||
path = xrealloc (path, pathlength);
|
||||
}
|
||||
strcpy (path + dirlength, namep);
|
||||
errors |= change_file_owner (0, path, uid, gid, old_uid, old_gid,
|
||||
chopt);
|
||||
}
|
||||
free (path);
|
||||
free (name_space);
|
||||
return errors;
|
||||
}
|
||||
|
||||
/* Change the ownership of FILE to user-id, UID, and group-id, GID,
|
||||
provided it presently has owner OLD_UID and group OLD_GID.
|
||||
Honor the options specified by CHOPT.
|
||||
If FILE is a directory and -R is given, recurse.
|
||||
Return 0 if successful, 1 if errors occurred. */
|
||||
|
||||
int
|
||||
change_file_owner (int cmdline_arg, const char *file, uid_t uid, gid_t gid,
|
||||
uid_t old_uid, gid_t old_gid,
|
||||
struct Chown_option const *chopt)
|
||||
{
|
||||
struct stat file_stats;
|
||||
uid_t new_uid;
|
||||
gid_t new_gid;
|
||||
int errors = 0;
|
||||
int is_symlink;
|
||||
int is_directory;
|
||||
|
||||
if (lstat (file, &file_stats))
|
||||
{
|
||||
if (chopt->force_silent == 0)
|
||||
error (0, errno, _("getting attributes of %s"), quote (file));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* If it's a symlink and we're dereferencing, then use stat
|
||||
to get the attributes of the referent. */
|
||||
if (S_ISLNK (file_stats.st_mode))
|
||||
{
|
||||
if (chopt->dereference == DEREF_ALWAYS
|
||||
&& stat (file, &file_stats))
|
||||
{
|
||||
if (chopt->force_silent == 0)
|
||||
error (0, errno, _("getting attributes of %s"), quote (file));
|
||||
return 1;
|
||||
}
|
||||
|
||||
is_symlink = 1;
|
||||
|
||||
/* With -R, don't traverse through symlinks-to-directories.
|
||||
But of course, this will all change with POSIX's new
|
||||
-H, -L, -P options. */
|
||||
is_directory = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
is_symlink = 0;
|
||||
is_directory = S_ISDIR (file_stats.st_mode);
|
||||
}
|
||||
|
||||
if ((old_uid == (uid_t) -1 || file_stats.st_uid == old_uid)
|
||||
&& (old_gid == (gid_t) -1 || file_stats.st_gid == old_gid))
|
||||
{
|
||||
new_uid = (uid == (uid_t) -1 ? file_stats.st_uid : uid);
|
||||
new_gid = (gid == (gid_t) -1 ? file_stats.st_gid : gid);
|
||||
if (new_uid != file_stats.st_uid || new_gid != file_stats.st_gid)
|
||||
{
|
||||
int fail;
|
||||
int symlink_changed = 1;
|
||||
int saved_errno;
|
||||
int called_lchown = 0;
|
||||
|
||||
if (is_symlink)
|
||||
{
|
||||
if (chopt->dereference == DEREF_NEVER)
|
||||
{
|
||||
called_lchown = 1;
|
||||
fail = lchown (file, new_uid, new_gid);
|
||||
|
||||
/* Ignore the failure if it's due to lack of support (ENOSYS)
|
||||
and this is not a command line argument. */
|
||||
if (!cmdline_arg && fail && errno == ENOSYS)
|
||||
{
|
||||
fail = 0;
|
||||
symlink_changed = 0;
|
||||
}
|
||||
}
|
||||
else if (chopt->dereference == DEREF_ALWAYS)
|
||||
{
|
||||
/* Applying chown to a symlink and expecting it to affect
|
||||
the referent is not portable. So instead, open the
|
||||
file and use fchown on the resulting descriptor. */
|
||||
int fd = open (file, O_RDONLY | O_NONBLOCK | O_NOCTTY);
|
||||
fail = (fd == -1 ? 1 : fchown (fd, new_uid, new_gid));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME */
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fail = chown (file, new_uid, new_gid);
|
||||
}
|
||||
saved_errno = errno;
|
||||
|
||||
if (chopt->verbosity == V_high
|
||||
|| (chopt->verbosity == V_changes_only && !fail))
|
||||
{
|
||||
enum Change_status ch_status = (! symlink_changed
|
||||
? CH_NOT_APPLIED
|
||||
: (fail
|
||||
? CH_FAILED : CH_SUCCEEDED));
|
||||
describe_change (file, ch_status,
|
||||
chopt->user_name, chopt->group_name);
|
||||
}
|
||||
|
||||
if (fail)
|
||||
{
|
||||
if (chopt->force_silent == 0)
|
||||
error (0, saved_errno, (uid != (uid_t) -1
|
||||
? _("changing ownership of %s")
|
||||
: _("changing group of %s")),
|
||||
quote (file));
|
||||
errors = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The change succeeded. On some systems, the chown function
|
||||
resets the `special' permission bits. When run by a
|
||||
`privileged' user, this program must ensure that at least
|
||||
the set-uid and set-group ones are still set. */
|
||||
if (file_stats.st_mode & ~(S_IFMT | S_IRWXUGO)
|
||||
/* If we called lchown above (which means this is a symlink),
|
||||
then skip it. */
|
||||
&& ! called_lchown)
|
||||
{
|
||||
if (chmod (file, file_stats.st_mode))
|
||||
{
|
||||
error (0, saved_errno,
|
||||
_("unable to restore permissions of %s"),
|
||||
quote (file));
|
||||
fail = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (chopt->verbosity == V_high)
|
||||
{
|
||||
describe_change (file, CH_NO_CHANGE_REQUESTED,
|
||||
chopt->user_name, chopt->group_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (chopt->recurse && is_directory)
|
||||
errors |= change_dir_owner (file, uid, gid,
|
||||
old_uid, old_gid, &file_stats, chopt);
|
||||
return errors;
|
||||
}
|
||||
89
src/chown-core.h
Normal file
89
src/chown-core.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* chown-core.h -- types and prototypes shared by chown and chgrp.
|
||||
Copyright (C) 2000 Free Software Foundation.
|
||||
|
||||
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. */
|
||||
|
||||
#ifndef CHOWN_CORE_H
|
||||
# define CHOWN_CORE_H
|
||||
|
||||
enum Change_status
|
||||
{
|
||||
CH_NOT_APPLIED = 1,
|
||||
CH_SUCCEEDED,
|
||||
CH_FAILED,
|
||||
CH_NO_CHANGE_REQUESTED
|
||||
};
|
||||
|
||||
enum Verbosity
|
||||
{
|
||||
/* Print a message for each file that is processed. */
|
||||
V_high,
|
||||
|
||||
/* Print a message for each file whose attributes we change. */
|
||||
V_changes_only,
|
||||
|
||||
/* Do not be verbose. This is the default. */
|
||||
V_off
|
||||
};
|
||||
|
||||
enum Dereference_symlink
|
||||
{
|
||||
DEREF_UNDEFINED = 1,
|
||||
DEREF_NEVER, /* -P */
|
||||
DEREF_COMMAND_LINE_ARGUMENTS, /* -H */
|
||||
DEREF_ALWAYS /* -L */
|
||||
};
|
||||
|
||||
struct Chown_option
|
||||
{
|
||||
/* Level of verbosity. */
|
||||
enum Verbosity verbosity;
|
||||
|
||||
/* If nonzero, change the ownership of directories recursively. */
|
||||
int recurse;
|
||||
|
||||
/* This is useful only on systems with support for changing the
|
||||
ownership of symbolic links. */
|
||||
enum Dereference_symlink dereference;
|
||||
|
||||
/* If nonzero, force silence (no error messages). */
|
||||
int force_silent;
|
||||
|
||||
/* The name of the user to which ownership of the files is being given. */
|
||||
char *user_name;
|
||||
|
||||
/* The name of the group to which ownership of the files is being given. */
|
||||
char *group_name;
|
||||
};
|
||||
|
||||
void
|
||||
chopt_init (struct Chown_option *);
|
||||
|
||||
void
|
||||
chopt_free (struct Chown_option *);
|
||||
|
||||
char *
|
||||
gid_to_name (gid_t);
|
||||
|
||||
char *
|
||||
uid_to_name (uid_t);
|
||||
|
||||
int
|
||||
change_file_owner PARAMS ((int, const char *,
|
||||
uid_t, gid_t,
|
||||
uid_t, gid_t,
|
||||
struct Chown_option const *));
|
||||
|
||||
#endif /* CHOWN_CORE_H */
|
||||
260
src/chown.c
260
src/chown.c
@@ -1,5 +1,5 @@
|
||||
/* chown -- change user and group ownership of files
|
||||
Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 1995-2001 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
|
||||
@@ -31,8 +31,6 @@
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "system.h"
|
||||
@@ -40,6 +38,7 @@
|
||||
#include "lchown.h"
|
||||
#include "quote.h"
|
||||
#include "savedir.h"
|
||||
#include "chown-core.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "chown"
|
||||
@@ -59,52 +58,9 @@ struct group *getgrgid ();
|
||||
char *parse_user_spec ();
|
||||
void strip_trailing_slashes ();
|
||||
|
||||
enum Change_status
|
||||
{
|
||||
CH_NOT_APPLIED,
|
||||
CH_SUCCEEDED,
|
||||
CH_FAILED,
|
||||
CH_NO_CHANGE_REQUESTED
|
||||
};
|
||||
|
||||
enum Verbosity
|
||||
{
|
||||
/* Print a message for each file that is processed. */
|
||||
V_high,
|
||||
|
||||
/* Print a message for each file whose attributes we change. */
|
||||
V_changes_only,
|
||||
|
||||
/* Do not be verbose. This is the default. */
|
||||
V_off
|
||||
};
|
||||
|
||||
static int change_dir_owner PARAMS ((const char *dir, uid_t user, gid_t group,
|
||||
uid_t old_user, gid_t old_group,
|
||||
const struct stat *statp));
|
||||
|
||||
/* The name the program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* If nonzero, and the systems has support for it, change the ownership
|
||||
of symbolic links rather than any files they point to. */
|
||||
static int change_symlinks = 1;
|
||||
|
||||
/* If nonzero, change the ownership of directories recursively. */
|
||||
static int recurse;
|
||||
|
||||
/* If nonzero, force silence (no error messages). */
|
||||
static int force_silent;
|
||||
|
||||
/* Level of verbosity. */
|
||||
static enum Verbosity verbosity = V_off;
|
||||
|
||||
/* The name of the user to which ownership of the files is being given. */
|
||||
static char *username;
|
||||
|
||||
/* The name of the group to which ownership of the files is being given. */
|
||||
static const char *groupname;
|
||||
|
||||
/* The argument to the --reference option. Use the owner and group IDs
|
||||
of this file. This file must exist. */
|
||||
static char *reference_file;
|
||||
@@ -134,169 +90,6 @@ static struct option const long_options[] =
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* Tell the user how/if the user and group of FILE have been changed.
|
||||
CHANGED describes what (if anything) has happened. */
|
||||
|
||||
static void
|
||||
describe_change (const char *file, enum Change_status changed)
|
||||
{
|
||||
const char *fmt;
|
||||
|
||||
if (changed == CH_NOT_APPLIED)
|
||||
{
|
||||
printf (_("neither symbolic link %s nor referent has been changed\n"),
|
||||
quote (file));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (changed)
|
||||
{
|
||||
case CH_SUCCEEDED:
|
||||
fmt = _("owner of %s changed to ");
|
||||
break;
|
||||
case CH_FAILED:
|
||||
fmt = _("failed to change owner of %s to ");
|
||||
break;
|
||||
case CH_NO_CHANGE_REQUESTED:
|
||||
fmt = _("owner of %s retained as ");
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
printf (fmt, file);
|
||||
if (groupname)
|
||||
printf ("%s.%s\n", username, groupname);
|
||||
else
|
||||
printf ("%s\n", username);
|
||||
}
|
||||
|
||||
/* Change the ownership of FILE to UID USER and GID GROUP
|
||||
provided it presently has UID OLDUSER and GID OLDGROUP.
|
||||
If it is a directory and -R is given, recurse.
|
||||
Return 0 if successful, 1 if errors occurred. */
|
||||
|
||||
static int
|
||||
change_file_owner (int cmdline_arg, const char *file, uid_t user, gid_t group,
|
||||
uid_t old_user, gid_t old_group)
|
||||
{
|
||||
struct stat file_stats;
|
||||
uid_t newuser;
|
||||
gid_t newgroup;
|
||||
int errors = 0;
|
||||
|
||||
if (lstat (file, &file_stats))
|
||||
{
|
||||
if (force_silent == 0)
|
||||
error (0, errno, _("getting attributes of %s"), quote (file));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((old_user == (uid_t) -1 || file_stats.st_uid == old_user) &&
|
||||
(old_group == (gid_t) -1 || file_stats.st_gid == old_group))
|
||||
{
|
||||
newuser = user == (uid_t) -1 ? file_stats.st_uid : user;
|
||||
newgroup = group == (gid_t) -1 ? file_stats.st_gid : group;
|
||||
if (newuser != file_stats.st_uid || newgroup != file_stats.st_gid)
|
||||
{
|
||||
int fail;
|
||||
int symlink_changed = 1;
|
||||
int saved_errno;
|
||||
|
||||
if (S_ISLNK (file_stats.st_mode) && change_symlinks)
|
||||
{
|
||||
fail = lchown (file, newuser, newgroup);
|
||||
|
||||
/* Ignore the failure if it's due to lack of support (ENOSYS)
|
||||
and this is not a command line argument. */
|
||||
if (!cmdline_arg && fail && errno == ENOSYS)
|
||||
{
|
||||
fail = 0;
|
||||
symlink_changed = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fail = chown (file, newuser, newgroup);
|
||||
}
|
||||
saved_errno = errno;
|
||||
|
||||
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
|
||||
{
|
||||
enum Change_status ch_status = (! symlink_changed
|
||||
? CH_NOT_APPLIED
|
||||
: (fail
|
||||
? CH_FAILED : CH_SUCCEEDED));
|
||||
describe_change (file, ch_status);
|
||||
}
|
||||
|
||||
if (fail)
|
||||
{
|
||||
if (force_silent == 0)
|
||||
error (0, saved_errno, _("changing ownership of %s"),
|
||||
quote (file));
|
||||
errors = 1;
|
||||
}
|
||||
}
|
||||
else if (verbosity == V_high)
|
||||
{
|
||||
describe_change (file, CH_NO_CHANGE_REQUESTED);
|
||||
}
|
||||
}
|
||||
|
||||
if (recurse && S_ISDIR (file_stats.st_mode))
|
||||
errors |= change_dir_owner (file, user, group,
|
||||
old_user, old_group, &file_stats);
|
||||
return errors;
|
||||
}
|
||||
|
||||
/* Recursively change the ownership of the files in directory DIR
|
||||
to UID USER and GID GROUP.
|
||||
STATP points to the results of lstat on DIR.
|
||||
Return 0 if successful, 1 if errors occurred. */
|
||||
|
||||
static int
|
||||
change_dir_owner (const char *dir, uid_t user, gid_t group,
|
||||
uid_t old_user, gid_t old_group,
|
||||
const struct stat *statp)
|
||||
{
|
||||
char *name_space, *namep;
|
||||
char *path; /* Full path of each entry to process. */
|
||||
unsigned dirlength; /* Length of `dir' and '\0'. */
|
||||
unsigned filelength; /* Length of each pathname to process. */
|
||||
unsigned pathlength; /* Bytes allocated for `path'. */
|
||||
int errors = 0;
|
||||
|
||||
name_space = savedir (dir, statp->st_size);
|
||||
if (name_space == NULL)
|
||||
{
|
||||
if (force_silent == 0)
|
||||
error (0, errno, "%s", quote (dir));
|
||||
return 1;
|
||||
}
|
||||
|
||||
dirlength = strlen (dir) + 1; /* + 1 is for the trailing '/'. */
|
||||
pathlength = dirlength + 1;
|
||||
/* Give `path' a dummy value; it will be reallocated before first use. */
|
||||
path = xmalloc (pathlength);
|
||||
strcpy (path, dir);
|
||||
path[dirlength - 1] = '/';
|
||||
|
||||
for (namep = name_space; *namep; namep += filelength - dirlength)
|
||||
{
|
||||
filelength = dirlength + strlen (namep) + 1;
|
||||
if (filelength > pathlength)
|
||||
{
|
||||
pathlength = filelength * 2;
|
||||
path = xrealloc (path, pathlength);
|
||||
}
|
||||
strcpy (path + dirlength, namep);
|
||||
errors |= change_file_owner (0, path, user, group, old_user, old_group);
|
||||
}
|
||||
free (path);
|
||||
free (name_space);
|
||||
return errors;
|
||||
}
|
||||
|
||||
void
|
||||
usage (int status)
|
||||
{
|
||||
@@ -333,6 +126,8 @@ Change the owner and/or group of each FILE to OWNER and/or GROUP.\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
"));
|
||||
printf (_("\
|
||||
Owner is unchanged if missing. Group is unchanged if missing, but changed\n\
|
||||
to login group if implied by a `:'. OWNER and GROUP may be numeric as well\n\
|
||||
as symbolic.\n\
|
||||
@@ -345,10 +140,11 @@ as symbolic.\n\
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
uid_t user = (uid_t) -1; /* New uid; -1 if not to be changed. */
|
||||
gid_t group = (uid_t) -1; /* New gid; -1 if not to be changed. */
|
||||
uid_t old_user = (uid_t) -1; /* Old uid; -1 if unrestricted. */
|
||||
gid_t old_group = (uid_t) -1; /* Old gid; -1 if unrestricted. */
|
||||
uid_t uid = (uid_t) -1; /* New uid; -1 if not to be changed. */
|
||||
gid_t gid = (uid_t) -1; /* New gid; -1 if not to be changed. */
|
||||
uid_t old_uid = (uid_t) -1; /* Old uid; -1 if unrestricted. */
|
||||
gid_t old_gid = (uid_t) -1; /* Old gid; -1 if unrestricted. */
|
||||
struct Chown_option chopt;
|
||||
|
||||
int errors = 0;
|
||||
int optc;
|
||||
@@ -360,7 +156,7 @@ main (int argc, char **argv)
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
recurse = force_silent = 0;
|
||||
chopt_init (&chopt);
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, NULL)) != -1)
|
||||
{
|
||||
@@ -372,32 +168,32 @@ main (int argc, char **argv)
|
||||
reference_file = optarg;
|
||||
break;
|
||||
case DEREFERENCE_OPTION:
|
||||
change_symlinks = 0;
|
||||
chopt.dereference = DEREF_ALWAYS;
|
||||
break;
|
||||
case FROM_OPTION:
|
||||
{
|
||||
char *u_dummy, *g_dummy;
|
||||
const char *e = parse_user_spec (argv[optind],
|
||||
&old_user, &old_group,
|
||||
&old_uid, &old_gid,
|
||||
&u_dummy, &g_dummy);
|
||||
if (e)
|
||||
error (1, 0, "%s: %s", quote (argv[optind]), e);
|
||||
break;
|
||||
}
|
||||
case 'R':
|
||||
recurse = 1;
|
||||
chopt.recurse = 1;
|
||||
break;
|
||||
case 'c':
|
||||
verbosity = V_changes_only;
|
||||
chopt.verbosity = V_changes_only;
|
||||
break;
|
||||
case 'f':
|
||||
force_silent = 1;
|
||||
chopt.force_silent = 1;
|
||||
break;
|
||||
case 'h':
|
||||
change_symlinks = 1;
|
||||
chopt.dereference = DEREF_NEVER;
|
||||
break;
|
||||
case 'v':
|
||||
verbosity = V_high;
|
||||
chopt.verbosity = V_high;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
@@ -419,17 +215,21 @@ main (int argc, char **argv)
|
||||
if (stat (reference_file, &ref_stats))
|
||||
error (1, errno, _("getting attributes of %s"), quote (reference_file));
|
||||
|
||||
user = ref_stats.st_uid;
|
||||
group = ref_stats.st_gid;
|
||||
uid = ref_stats.st_uid;
|
||||
gid = ref_stats.st_gid;
|
||||
chopt.user_name = uid_to_name (ref_stats.st_uid);
|
||||
chopt.group_name = gid_to_name (ref_stats.st_gid);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *e = parse_user_spec (argv[optind], &user, &group,
|
||||
&username, &groupname);
|
||||
const char *e = parse_user_spec (argv[optind], &uid, &gid,
|
||||
&chopt.user_name, &chopt.group_name);
|
||||
if (e)
|
||||
error (1, 0, "%s: %s", argv[optind], e);
|
||||
if (username == NULL)
|
||||
username = "";
|
||||
|
||||
/* FIXME: set it to the empty string? */
|
||||
if (chopt.user_name == NULL)
|
||||
chopt.user_name = "";
|
||||
|
||||
optind++;
|
||||
}
|
||||
@@ -437,9 +237,11 @@ main (int argc, char **argv)
|
||||
for (; optind < argc; ++optind)
|
||||
{
|
||||
strip_trailing_slashes (argv[optind]);
|
||||
errors |= change_file_owner (1, argv[optind], user, group,
|
||||
old_user, old_group);
|
||||
errors |= change_file_owner (1, argv[optind], uid, gid,
|
||||
old_uid, old_gid, &chopt);
|
||||
}
|
||||
|
||||
chopt_free (&chopt);
|
||||
|
||||
exit (errors);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* cksum -- calculate and print POSIX.2 checksums and sizes of files
|
||||
Copyright (C) 92, 1995-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 92, 1995-2001 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
|
||||
@@ -296,7 +296,7 @@ main (int argc, char **argv)
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
|
||||
AUTHORS, usage);
|
||||
|
||||
have_read_stdin = 0;
|
||||
|
||||
94
src/copy.c
94
src/copy.c
@@ -1,5 +1,5 @@
|
||||
/* copy.c -- core functions for copying files and directories
|
||||
Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation.
|
||||
Copyright (C) 89, 90, 91, 1995-2001 Free Software Foundation.
|
||||
|
||||
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
|
||||
@@ -67,6 +67,11 @@ static int copy_internal PARAMS ((const char *src_path, const char *dst_path,
|
||||
int *copy_into_self,
|
||||
int *rename_succeeded));
|
||||
|
||||
/* Pointers to the file names: they're used in the diagnostic that is issued
|
||||
when we detect the user is trying to copy a directory into itself. */
|
||||
static char const *top_level_src_path;
|
||||
static char const *top_level_dst_path;
|
||||
|
||||
/* The invocation name of this program. */
|
||||
extern char *program_name;
|
||||
|
||||
@@ -392,8 +397,8 @@ same_file_ok (const char *src_path, const struct stat *src_sb,
|
||||
{
|
||||
const struct stat *src_sb_link;
|
||||
const struct stat *dst_sb_link;
|
||||
const struct stat *src_sb_no_link;
|
||||
const struct stat *dst_sb_no_link;
|
||||
struct stat tmp_dst_sb;
|
||||
struct stat tmp_src_sb;
|
||||
|
||||
int same_link;
|
||||
int same = (SAME_INODE (*src_sb, *dst_sb));
|
||||
@@ -417,17 +422,15 @@ same_file_ok (const char *src_path, const struct stat *src_sb,
|
||||
|
||||
/* If both the source and destination files are symlinks (and we'll
|
||||
know this here IFF preserving symlinks (aka xstat == lstat),
|
||||
then it's ok. */
|
||||
then it's ok -- as long as they are distinct. */
|
||||
if (S_ISLNK (src_sb->st_mode) && S_ISLNK (dst_sb->st_mode))
|
||||
return 1;
|
||||
return ! same_name (src_path, dst_path);
|
||||
|
||||
src_sb_link = src_sb;
|
||||
dst_sb_link = dst_sb;
|
||||
}
|
||||
else
|
||||
{
|
||||
static struct stat tmp_dst_sb;
|
||||
static struct stat tmp_src_sb;
|
||||
if (!same)
|
||||
return 1;
|
||||
|
||||
@@ -491,7 +494,7 @@ same_file_ok (const char *src_path, const struct stat *src_sb,
|
||||
return 1;
|
||||
|
||||
/* If neither is a symlink, then it's ok as long as they aren't
|
||||
links to the same file. */
|
||||
hard links to the same file. */
|
||||
if (!S_ISLNK (src_sb_link->st_mode) && !S_ISLNK (dst_sb_link->st_mode))
|
||||
{
|
||||
if (!SAME_INODE (*src_sb_link, *dst_sb_link))
|
||||
@@ -506,19 +509,25 @@ same_file_ok (const char *src_path, const struct stat *src_sb,
|
||||
}
|
||||
|
||||
/* It's ok to remove a destination symlink. But that works only when we
|
||||
unlink before opening the destination and when they're on the same
|
||||
partition. */
|
||||
unlink before opening the destination and when the source and destination
|
||||
files are on the same partition. */
|
||||
if (x->unlink_dest_before_opening
|
||||
&& S_ISLNK (dst_sb_link->st_mode))
|
||||
return src_sb_link->st_dev == src_sb_link->st_dev;
|
||||
return dst_sb_link->st_dev == src_sb_link->st_dev;
|
||||
|
||||
if (x->xstat == lstat)
|
||||
{
|
||||
static struct stat tmp_dst_sb;
|
||||
static struct stat tmp_src_sb;
|
||||
if (stat (dst_path, &tmp_dst_sb)
|
||||
|| stat (src_path, &tmp_src_sb)
|
||||
|| ! SAME_INODE (tmp_dst_sb, tmp_dst_sb))
|
||||
if ( ! S_ISLNK (src_sb_link->st_mode))
|
||||
tmp_src_sb = *src_sb_link;
|
||||
else if (stat (src_path, &tmp_src_sb))
|
||||
return 1;
|
||||
|
||||
if ( ! S_ISLNK (dst_sb_link->st_mode))
|
||||
tmp_dst_sb = *dst_sb_link;
|
||||
else if (stat (dst_path, &tmp_dst_sb))
|
||||
return 1;
|
||||
|
||||
if ( ! SAME_INODE (tmp_src_sb, tmp_dst_sb))
|
||||
return 1;
|
||||
|
||||
/* FIXME: shouldn't this be testing whether we're making symlinks? */
|
||||
@@ -527,13 +536,6 @@ same_file_ok (const char *src_path, const struct stat *src_sb,
|
||||
*return_now = 1;
|
||||
return 1;
|
||||
}
|
||||
src_sb_no_link = &tmp_src_sb;
|
||||
dst_sb_no_link = &tmp_dst_sb;
|
||||
}
|
||||
else
|
||||
{
|
||||
src_sb_no_link = src_sb;
|
||||
dst_sb_no_link = dst_sb;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -586,6 +588,10 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
find created files so as to not copy infinitely if a directory is
|
||||
copied into itself. */
|
||||
|
||||
/* Associate the destination path with the source device and inode
|
||||
so that if we encounter a matching dev/ino pair in the source tree
|
||||
we can arrange to create a hard link between the corresponding names
|
||||
in the destination tree. */
|
||||
earlier_file = remember_copied (dst_path, src_sb.st_ino, src_sb.st_dev);
|
||||
|
||||
src_mode = src_sb.st_mode;
|
||||
@@ -626,6 +632,14 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (S_ISDIR (src_type) && !S_ISDIR (dst_sb.st_mode))
|
||||
{
|
||||
error (0, 0,
|
||||
_("cannot overwrite non-directory %s with directory %s"),
|
||||
quote_n (0, dst_path), quote_n (1, src_path));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!S_ISDIR (src_type))
|
||||
{
|
||||
if (S_ISDIR (dst_sb.st_mode))
|
||||
@@ -759,8 +773,21 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
directories). */
|
||||
if (S_ISDIR (src_type))
|
||||
{
|
||||
error (0, 0, _("won't create hard link %s to directory %s"),
|
||||
quote_n (0, dst_path), quote_n (1, earlier_file));
|
||||
/* If src_path and earlier_file refer to the same directory entry,
|
||||
then warn about copying a directory into itself. */
|
||||
if (same_name (src_path, earlier_file))
|
||||
{
|
||||
error (0, 0, _("cannot copy a directory, %s, into itself, %s"),
|
||||
quote_n (0, top_level_src_path),
|
||||
quote_n (1, top_level_dst_path));
|
||||
*copy_into_self = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
error (0, 0, _("will not create hard link %s to directory %s"),
|
||||
quote_n (0, dst_path), quote_n (1, earlier_file));
|
||||
}
|
||||
|
||||
goto un_backup;
|
||||
}
|
||||
|
||||
@@ -806,7 +833,13 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
/* FIXME: this is a little fragile in that it relies on rename(2)
|
||||
failing with a specific errno value. Expect problems on
|
||||
non-POSIX systems. */
|
||||
error (0, 0, _("cannot move %s to a subdirectory of itself, %s"),
|
||||
quote_n (0, top_level_src_path),
|
||||
quote_n (1, top_level_dst_path));
|
||||
*copy_into_self = 1;
|
||||
/* FIXME-cleanup: Don't return zero here; adjust mv.c accordingly.
|
||||
The only caller that uses this code (mv.c) ends up setting its
|
||||
exit status to nonzero when copy_into_self is nonzero. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1170,6 +1203,17 @@ copy (const char *src_path, const char *dst_path,
|
||||
int move_mode = options->move_mode;
|
||||
|
||||
assert (valid_options (options));
|
||||
|
||||
/* Record the file names: they're used in case of error, when copying
|
||||
a directory into itself. I don't like to make these tools do *any*
|
||||
extra work in the common case when that work is solely to handle
|
||||
exceptional cases, but in this case, I don't see a way to derive the
|
||||
top level source and destination directory names where they're used.
|
||||
An alternative is to use COPY_INTO_SELF and print the diagnostic
|
||||
from every caller -- but I don't wan't to do that. */
|
||||
top_level_src_path = src_path;
|
||||
top_level_dst_path = dst_path;
|
||||
|
||||
return copy_internal (src_path, dst_path, nonexistent_dst, 0, NULL,
|
||||
options, move_mode, copy_into_self, rename_succeeded);
|
||||
}
|
||||
|
||||
11
src/copy.h
11
src/copy.h
@@ -142,6 +142,17 @@ int rpl_lstat PARAMS((const char *, struct stat *));
|
||||
# define lstat rpl_lstat
|
||||
# endif
|
||||
|
||||
int rename ();
|
||||
|
||||
/* Arrange to make rename calls go through the wrapper function
|
||||
on systems with a rename function that fails for a source path
|
||||
specified with a trailing slash. */
|
||||
# if RENAME_TRAILING_SLASH_BUG
|
||||
int rpl_rename PARAMS((const char *, const char *));
|
||||
# undef rename
|
||||
# define rename rpl_rename
|
||||
# endif
|
||||
|
||||
int
|
||||
copy PARAMS ((const char *src_path, const char *dst_path,
|
||||
int nonexistent_dst, const struct cp_options *options,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* cp-hash.c -- file copying (hash search routines)
|
||||
Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation.
|
||||
Copyright (C) 89, 90, 91, 1995-2001 Free Software Foundation.
|
||||
|
||||
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
|
||||
@@ -33,7 +33,11 @@ struct entry
|
||||
{
|
||||
ino_t ino;
|
||||
dev_t dev;
|
||||
char *node; /* Path name, or &new_file for new inodes. */
|
||||
/* Destination path name (of non-directory or pre-existing directory)
|
||||
corresponding to the dev/ino of a copied file, or the destination path
|
||||
name corresponding to a dev/ino pair for a newly-created directory. */
|
||||
char *node;
|
||||
|
||||
struct entry *coll_link; /* 0 = entry not occupied. */
|
||||
};
|
||||
|
||||
@@ -46,8 +50,7 @@ struct htab
|
||||
struct entry *hash[1]; /* Vector of pointers in `entry_tab'. */
|
||||
};
|
||||
|
||||
struct htab *htab;
|
||||
char new_file;
|
||||
static struct htab *htab;
|
||||
|
||||
static char *cph_hash_insert PARAMS ((ino_t ino, dev_t dev, const char *node));
|
||||
|
||||
@@ -65,7 +68,7 @@ remember_created (const char *path)
|
||||
return 1;
|
||||
}
|
||||
|
||||
cph_hash_insert (sb.st_ino, sb.st_dev, &new_file);
|
||||
cph_hash_insert (sb.st_ino, sb.st_dev, path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
4
src/cp.c
4
src/cp.c
@@ -1,5 +1,5 @@
|
||||
/* cp.c -- file copying (main routines)
|
||||
Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation.
|
||||
Copyright (C) 89, 90, 91, 1995-2001 Free Software Foundation.
|
||||
|
||||
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
|
||||
@@ -172,6 +172,8 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
|
||||
special files like FIFOs or /dev/zero\n\
|
||||
--remove-destination remove each existing destination file before\n\
|
||||
attempting to open it (contrast with --force)\n\
|
||||
"));
|
||||
printf (_("\
|
||||
--sparse=WHEN control creation of sparse files\n\
|
||||
-R, --recursive copy directories recursively\n\
|
||||
--strip-trailing-slashes remove any trailing slashes from each SOURCE\n\
|
||||
|
||||
11
src/date.c
11
src/date.c
@@ -1,5 +1,5 @@
|
||||
/* date - print or set the system date and time
|
||||
Copyright (C) 1989-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989-2001 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
|
||||
@@ -355,6 +355,15 @@ argument must be a format string beginning with `+'."),
|
||||
usage (1);
|
||||
}
|
||||
|
||||
/* Simply ignore --rfc-822 if specified when setting the date. */
|
||||
if (rfc_format && !set_date && n_args > 0)
|
||||
{
|
||||
error (0, 0,
|
||||
_("a format string may not be specified when using\
|
||||
the --rfc-822 (-R) option"));
|
||||
usage (1);
|
||||
}
|
||||
|
||||
if (set_date)
|
||||
datestr = set_datestr;
|
||||
|
||||
|
||||
4
src/dd.c
4
src/dd.c
@@ -1,5 +1,5 @@
|
||||
/* dd -- convert a file while copying it.
|
||||
Copyright (C) 85, 90, 91, 1995-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 85, 90, 91, 1995-2001 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
|
||||
@@ -1111,7 +1111,7 @@ main (int argc, char **argv)
|
||||
/* Arrange to close stdout if parse_long_options exits. */
|
||||
atexit (close_stdout_wrapper);
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
|
||||
AUTHORS, usage);
|
||||
|
||||
/* Don't close stdout on exit from here on. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* dirname -- strip filename suffix from pathname
|
||||
Copyright (C) 1990-1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990-1997, 1999, 2000, 2001 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
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "error.h"
|
||||
#include "dirname.h"
|
||||
#include "closeout.h"
|
||||
#include "xalloc.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "dirname"
|
||||
@@ -65,8 +66,7 @@ output `.' (meaning the current directory).\n\
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
const char *result;
|
||||
size_t len;
|
||||
char *result;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
@@ -92,9 +92,11 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
len = dir_name_r (argv[1], &result);
|
||||
fwrite (result, 1, len, stdout);
|
||||
putchar ('\n');
|
||||
result = dir_name (argv[1]);
|
||||
if (result == NULL)
|
||||
xalloc_die ();
|
||||
puts (result);
|
||||
free (result);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
@@ -273,8 +273,13 @@ main (int argc, char **argv)
|
||||
error (1, 0,
|
||||
_("the strip option may not be used when installing a directory"));
|
||||
|
||||
if (make_backups)
|
||||
x.backup_type = xget_version ("backup type", version_control_string);
|
||||
if (backup_suffix_string)
|
||||
simple_backup_suffix = xstrdup (backup_suffix_string);
|
||||
|
||||
x.backup_type = (make_backups
|
||||
? xget_version (_("backup type"),
|
||||
version_control_string)
|
||||
: none);
|
||||
|
||||
n_files = argc - optind;
|
||||
file = argv + optind;
|
||||
|
||||
3
src/ln.c
3
src/ln.c
@@ -511,6 +511,9 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
if (backup_suffix_string)
|
||||
simple_backup_suffix = xstrdup (backup_suffix_string);
|
||||
|
||||
backup_type = (make_backups
|
||||
? xget_version (_("backup type"), version_control_string)
|
||||
: none);
|
||||
|
||||
192
src/ls.c
192
src/ls.c
@@ -1,5 +1,5 @@
|
||||
/* `dir', `vdir' and `ls' directory listing programs for GNU.
|
||||
Copyright (C) 85, 88, 90, 91, 1995-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 85, 88, 90, 91, 1995-2001 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
|
||||
@@ -205,6 +205,12 @@ int rpl_lstat PARAMS((const char *, struct stat *));
|
||||
# define DT_INIT(Val) /* empty */
|
||||
#endif
|
||||
|
||||
#ifdef ST_MTIM_NSEC
|
||||
# define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC)
|
||||
#else
|
||||
# define TIMESPEC_NS(timespec) 0
|
||||
#endif
|
||||
|
||||
enum filetype
|
||||
{
|
||||
unknown DT_INIT (DT_UNKNOWN),
|
||||
@@ -383,10 +389,11 @@ struct pending
|
||||
|
||||
static struct pending *pending_dirs;
|
||||
|
||||
/* Current time (seconds since 1970). When we are printing a file's time,
|
||||
include the year if it is more than 6 months before this time. */
|
||||
/* Current time in seconds and nanoseconds since 1970, updated as
|
||||
needed when deciding whether a file is recent. */
|
||||
|
||||
static time_t current_time;
|
||||
static time_t current_time = TYPE_MINIMUM (time_t);
|
||||
static int current_time_ns = -1;
|
||||
|
||||
/* The number of digits to use for block sizes.
|
||||
4, or more if needed for bigger numbers. */
|
||||
@@ -648,6 +655,11 @@ static int format_needs_stat;
|
||||
|
||||
static int format_needs_type;
|
||||
|
||||
/* strftime formats for non-recent and recent files, respectively, in
|
||||
-l output. */
|
||||
|
||||
static char const *long_time_format[2];
|
||||
|
||||
/* The exit status to use if we don't get any fatal errors. */
|
||||
|
||||
static int exit_status;
|
||||
@@ -659,6 +671,7 @@ enum
|
||||
BLOCK_SIZE_OPTION = CHAR_MAX + 1,
|
||||
COLOR_OPTION,
|
||||
FORMAT_OPTION,
|
||||
FULL_TIME,
|
||||
INDICATOR_STYLE_OPTION,
|
||||
QUOTING_STYLE_OPTION,
|
||||
SHOW_CONTROL_CHARS_OPTION,
|
||||
@@ -672,7 +685,7 @@ static struct option const long_options[] =
|
||||
{"escape", no_argument, 0, 'b'},
|
||||
{"directory", no_argument, 0, 'd'},
|
||||
{"dired", no_argument, 0, 'D'},
|
||||
{"full-time", no_argument, &full_time, 1},
|
||||
{"full-time", no_argument, 0, FULL_TIME},
|
||||
{"human-readable", no_argument, 0, 'h'},
|
||||
{"inode", no_argument, 0, 'i'},
|
||||
{"kilobytes", no_argument, 0, 'k'},
|
||||
@@ -861,7 +874,6 @@ main (int argc, char **argv)
|
||||
dir_defaulted = 1;
|
||||
print_dir_name = 1;
|
||||
pending_dirs = 0;
|
||||
current_time = time ((time_t *) 0);
|
||||
|
||||
i = decode_switches (argc, argv);
|
||||
|
||||
@@ -1277,6 +1289,11 @@ decode_switches (int argc, char **argv)
|
||||
format = XARGMATCH ("--format", optarg, format_args, format_types);
|
||||
break;
|
||||
|
||||
case FULL_TIME:
|
||||
format = long_format;
|
||||
full_time = 1;
|
||||
break;
|
||||
|
||||
case COLOR_OPTION:
|
||||
if (optarg)
|
||||
i = XARGMATCH ("--color", optarg, color_args, color_types);
|
||||
@@ -1352,6 +1369,18 @@ decode_switches (int argc, char **argv)
|
||||
sort_type = sort_time;
|
||||
}
|
||||
|
||||
if (format == long_format)
|
||||
{
|
||||
if (full_time)
|
||||
long_time_format[0] = long_time_format[1] =
|
||||
dcgettext (NULL, "%a %b %d %H:%M:%S %Y", LC_TIME);
|
||||
else
|
||||
{
|
||||
long_time_format[0] = dcgettext (NULL, "%b %e %Y", LC_TIME);
|
||||
long_time_format[1] = dcgettext (NULL, "%b %e %H:%M", LC_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
return optind;
|
||||
}
|
||||
|
||||
@@ -1860,7 +1889,6 @@ gobble_file (const char *name, enum filetype type, int explicit_arg,
|
||||
const char *dirname)
|
||||
{
|
||||
register uintmax_t blocks;
|
||||
register int val;
|
||||
register char *path;
|
||||
|
||||
if (files_index == nfiles)
|
||||
@@ -1874,10 +1902,15 @@ gobble_file (const char *name, enum filetype type, int explicit_arg,
|
||||
files[files_index].linkmode = 0;
|
||||
files[files_index].linkok = 0;
|
||||
|
||||
/* FIXME: this use of ls: `mkdir a; touch a/{b,c,d}; ls -R a'
|
||||
shouldn't require that ls stat b, c, and d -- at least
|
||||
not on systems with usable d_type. The problem is that
|
||||
format_needs_stat is set, because of the -R. */
|
||||
if (explicit_arg || format_needs_stat
|
||||
|| (format_needs_type && type == unknown))
|
||||
{
|
||||
/* `path' is the absolute pathname of this file. */
|
||||
int val;
|
||||
|
||||
if (name[0] == '/' || dirname[0] == 0)
|
||||
path = (char *) name;
|
||||
@@ -1899,9 +1932,10 @@ gobble_file (const char *name, enum filetype type, int explicit_arg,
|
||||
}
|
||||
|
||||
#if USE_ACL
|
||||
files[files_index].have_acl =
|
||||
(! S_ISLNK (files[files_index].stat.st_mode)
|
||||
&& 4 < acl (path, GETACLCNT, 0, NULL));
|
||||
if (format == long_format)
|
||||
files[files_index].have_acl =
|
||||
(! S_ISLNK (files[files_index].stat.st_mode)
|
||||
&& 4 < acl (path, GETACLCNT, 0, NULL));
|
||||
#endif
|
||||
|
||||
if (S_ISLNK (files[files_index].stat.st_mode)
|
||||
@@ -2068,9 +2102,7 @@ static void
|
||||
extract_dirs_from_files (const char *dirname, int recursive)
|
||||
{
|
||||
register int i, j;
|
||||
int dirlen;
|
||||
|
||||
dirlen = strlen (dirname) + 2;
|
||||
/* Queue the directories last one first, because queueing reverses the
|
||||
order. */
|
||||
for (i = files_index - 1; i >= 0; i--)
|
||||
@@ -2328,6 +2360,80 @@ print_current_files (void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the expected number of columns in a long-format time stamp,
|
||||
or zero if it cannot be calculated. */
|
||||
|
||||
static int
|
||||
long_time_expected_width (void)
|
||||
{
|
||||
static int width = -1;
|
||||
|
||||
if (width < 0)
|
||||
{
|
||||
time_t epoch = 0;
|
||||
struct tm const *tm = localtime (&epoch);
|
||||
char const *fmt = long_time_format[0];
|
||||
char initbuf[100];
|
||||
char *buf = initbuf;
|
||||
size_t bufsize = sizeof initbuf;
|
||||
size_t len;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
*buf = '\1';
|
||||
len = strftime (buf, bufsize, fmt, tm);
|
||||
if (len || ! *buf)
|
||||
break;
|
||||
buf = alloca (bufsize *= 2);
|
||||
}
|
||||
|
||||
width = mbsnwidth (buf, len, 0);
|
||||
if (width < 0)
|
||||
width = 0;
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
/* Get the current time. */
|
||||
|
||||
static void
|
||||
get_current_time (void)
|
||||
{
|
||||
#if HAVE_CLOCK_GETTIME && defined CLOCK_REALTIME
|
||||
{
|
||||
struct timespec timespec;
|
||||
if (clock_gettime (CLOCK_REALTIME, ×pec) == 0)
|
||||
{
|
||||
current_time = timespec.tv_sec;
|
||||
current_time_ns = timespec.tv_nsec;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The clock does not have nanosecond resolution, so get the maximum
|
||||
possible value for the current time that is consistent with the
|
||||
reported clock. That way, files are not considered to be in the
|
||||
future merely because their time stamps have higher resolution
|
||||
than the clock resolution. */
|
||||
|
||||
#if HAVE_GETTIMEOFDAY
|
||||
{
|
||||
struct timeval timeval;
|
||||
if (gettimeofday (&timeval, NULL) == 0)
|
||||
{
|
||||
current_time = timeval.tv_sec;
|
||||
current_time_ns = timeval.tv_usec * 1000 + 999;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
current_time = time (NULL);
|
||||
current_time_ns = 999999999;
|
||||
}
|
||||
|
||||
static void
|
||||
print_long_format (const struct fileinfo *f)
|
||||
{
|
||||
@@ -2347,8 +2453,8 @@ print_long_format (const struct fileinfo *f)
|
||||
size_t s;
|
||||
char *p;
|
||||
time_t when;
|
||||
int when_ns IF_LINT (= 0);
|
||||
struct tm *when_local;
|
||||
const char *fmt;
|
||||
char *user_name;
|
||||
|
||||
#if HAVE_ST_DM_MODE
|
||||
@@ -2365,38 +2471,18 @@ print_long_format (const struct fileinfo *f)
|
||||
{
|
||||
case time_ctime:
|
||||
when = f->stat.st_ctime;
|
||||
when_ns = TIMESPEC_NS (f->stat.st_ctim);
|
||||
break;
|
||||
case time_mtime:
|
||||
when = f->stat.st_mtime;
|
||||
when_ns = TIMESPEC_NS (f->stat.st_mtim);
|
||||
break;
|
||||
case time_atime:
|
||||
when = f->stat.st_atime;
|
||||
when_ns = TIMESPEC_NS (f->stat.st_atim);
|
||||
break;
|
||||
}
|
||||
|
||||
if (full_time)
|
||||
{
|
||||
fmt = _("%a %b %d %H:%M:%S %Y");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (current_time > when + 6L * 30L * 24L * 60L * 60L /* Old. */
|
||||
|| current_time < when - 60L * 60L) /* In the future. */
|
||||
{
|
||||
/* The file is fairly old or in the future.
|
||||
POSIX says the cutoff is 6 months old;
|
||||
approximate this by 6*30 days.
|
||||
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. */
|
||||
fmt = _("%b %e %Y");
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt = _("%b %e %H:%M");
|
||||
}
|
||||
}
|
||||
|
||||
p = buf;
|
||||
|
||||
if (print_inode)
|
||||
@@ -2454,9 +2540,35 @@ print_long_format (const struct fileinfo *f)
|
||||
|
||||
if ((when_local = localtime (&when)))
|
||||
{
|
||||
while (! (s = strftime (p, buf + bufsize - p - 1, fmt, when_local)))
|
||||
time_t six_months_ago;
|
||||
int recent;
|
||||
char const *fmt;
|
||||
|
||||
/* If the file appears to be in the future, update the current
|
||||
time, in case the file happens to have been modified since
|
||||
the last time we checked the clock. */
|
||||
if (current_time < when
|
||||
|| (current_time == when && current_time_ns < when_ns))
|
||||
get_current_time ();
|
||||
|
||||
/* Consider a time to be recent if it is within the past six
|
||||
months. A Gregorian year has 365.2425 * 24 * 60 * 60 ==
|
||||
31556952 seconds on the average. Write this value as an
|
||||
integer constant to avoid floating point hassles. */
|
||||
six_months_ago = current_time - 31556952 / 2;
|
||||
recent = (six_months_ago <= when
|
||||
&& (when < current_time
|
||||
|| (when == current_time && when_ns <= current_time_ns)));
|
||||
fmt = long_time_format[recent];
|
||||
|
||||
for (;;)
|
||||
{
|
||||
char *newbuf = (char *) alloca (bufsize *= 2);
|
||||
char *newbuf;
|
||||
*p = '\1';
|
||||
s = strftime (p, buf + bufsize - p - 1, fmt, when_local);
|
||||
if (s || ! *p)
|
||||
break;
|
||||
newbuf = alloca (bufsize *= 2);
|
||||
memcpy (newbuf, buf, p - buf);
|
||||
p = newbuf + (p - buf);
|
||||
buf = newbuf;
|
||||
@@ -2473,7 +2585,7 @@ print_long_format (const struct fileinfo *f)
|
||||
/* The time cannot be represented as a local time;
|
||||
print it as a huge integer number of seconds. */
|
||||
char hbuf[LONGEST_HUMAN_READABLE + 1];
|
||||
int width = full_time ? 24 : 12;
|
||||
int width = long_time_expected_width ();
|
||||
|
||||
if (when < 0)
|
||||
{
|
||||
@@ -3150,7 +3262,7 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
|
||||
--block-size=SIZE use SIZE-byte blocks\n\
|
||||
-B, --ignore-backups do not list implied entries ending with ~\n\
|
||||
-c with -lt: sort by, and show, ctime (time of last\n\
|
||||
modification of file status information)\n\
|
||||
modification of file status information)\n\
|
||||
with -l: show ctime and sort by name\n\
|
||||
otherwise: sort by ctime\n\
|
||||
-C list entries by columns\n\
|
||||
|
||||
9
src/mv.c
9
src/mv.c
@@ -1,5 +1,5 @@
|
||||
/* mv -- move or rename files
|
||||
Copyright (C) 86, 89, 90, 91, 1995-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 86, 89, 90, 91, 1995-2001 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
|
||||
@@ -195,9 +195,7 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
|
||||
and failing. */
|
||||
|
||||
dir_to_remove = NULL;
|
||||
error (0, 0,
|
||||
_("cannot move %s to a subdirectory of itself, %s"),
|
||||
quote_n (0, source), quote_n (1, dest));
|
||||
fail = 1;
|
||||
}
|
||||
else if (rename_succeeded)
|
||||
{
|
||||
@@ -259,9 +257,6 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
|
||||
if (fail)
|
||||
error (0, errno, _("cannot remove %s"), quote (dir_to_remove));
|
||||
}
|
||||
|
||||
if (copy_into_self)
|
||||
fail = 1;
|
||||
}
|
||||
|
||||
return fail;
|
||||
|
||||
206
src/od.c
206
src/od.c
@@ -1,5 +1,5 @@
|
||||
/* od -- dump files in octal and other formats
|
||||
Copyright (C) 92, 1995-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 92, 1995-2001 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
|
||||
@@ -150,17 +150,15 @@ static const char *const charname[33] =
|
||||
"sp"
|
||||
};
|
||||
|
||||
/* A printf control string for printing a file offset. */
|
||||
static const char *output_address_fmt_string;
|
||||
/* Address base (8, 10 or 16). */
|
||||
static int address_base;
|
||||
|
||||
/* The number of octal digits required to represent the largest off_t value. */
|
||||
#define MAX_ADDRESS_LENGTH \
|
||||
((sizeof (off_t) * CHAR_BIT + CHAR_BIT - 1) / 3)
|
||||
|
||||
/* Space for a normal address, a space, a pseudo address, parentheses
|
||||
around the pseudo address, and a trailing zero byte. */
|
||||
static char address_fmt_buffer[2 * MAX_ADDRESS_LENGTH + 4];
|
||||
static char address_pad[MAX_ADDRESS_LENGTH + 1];
|
||||
/* Width of a normal address. */
|
||||
static int address_pad_len;
|
||||
|
||||
static size_t string_min;
|
||||
static int flag_dump_strings;
|
||||
@@ -171,15 +169,15 @@ static int flag_dump_strings;
|
||||
static int traditional;
|
||||
|
||||
/* Non-zero if an old-style `pseudo-address' was specified. */
|
||||
static long int flag_pseudo_start;
|
||||
static int flag_pseudo_start;
|
||||
|
||||
/* The difference between the old-style pseudo starting address and
|
||||
the number of bytes to skip. */
|
||||
static long int pseudo_offset;
|
||||
static off_t pseudo_offset;
|
||||
|
||||
/* Function to format an address and optionally an additional parenthesized
|
||||
pseudo-address; it returns the formatted string. */
|
||||
static const char *(*format_address) PARAMS ((off_t));
|
||||
/* Function that accepts an address and an optional following char,
|
||||
and prints the address and char to stdout. */
|
||||
static void (*format_address) PARAMS ((off_t, char));
|
||||
|
||||
/* The number of input bytes to skip before formatting and writing. */
|
||||
static off_t n_bytes_to_skip = 0;
|
||||
@@ -201,16 +199,16 @@ static int abbreviate_duplicate_blocks = 1;
|
||||
static struct tspec *spec;
|
||||
|
||||
/* The number of format specs. */
|
||||
static unsigned int n_specs;
|
||||
static size_t n_specs;
|
||||
|
||||
/* The allocated length of SPEC. */
|
||||
static unsigned int n_specs_allocated;
|
||||
static size_t n_specs_allocated;
|
||||
|
||||
/* The number of input bytes formatted per output line. It must be
|
||||
a multiple of the least common multiple of the sizes associated with
|
||||
the specified output types. It should be as large as possible, but
|
||||
no larger than 16 -- unless specified with the -w option. */
|
||||
static unsigned int bytes_per_block;
|
||||
static size_t bytes_per_block;
|
||||
|
||||
/* Human-readable representation of *file_list (for error messages).
|
||||
It differs from *file_list only when *file_list is "-". */
|
||||
@@ -227,13 +225,15 @@ static FILE *in_stream;
|
||||
/* If nonzero, at least one of the files we read was standard input. */
|
||||
static int have_read_stdin;
|
||||
|
||||
#ifdef HAVE_UNSIGNED_LONG_LONG
|
||||
# define LONGEST_INTEGRAL_TYPE unsigned long long
|
||||
#if HAVE_UNSIGNED_LONG_LONG
|
||||
typedef unsigned long long ulonglong_t;
|
||||
#else
|
||||
# define LONGEST_INTEGRAL_TYPE long int
|
||||
/* This is just a place-holder to avoid a few `#if' directives.
|
||||
In this case, the type isn't actually used. */
|
||||
typedef unsigned long int ulonglong_t;
|
||||
#endif
|
||||
|
||||
#define MAX_INTEGRAL_TYPE_SIZE sizeof(LONGEST_INTEGRAL_TYPE)
|
||||
#define MAX_INTEGRAL_TYPE_SIZE sizeof (ulonglong_t)
|
||||
static enum size_spec integral_type_size[MAX_INTEGRAL_TYPE_SIZE + 1];
|
||||
|
||||
#define MAX_FP_TYPE_SIZE sizeof(LONG_DOUBLE)
|
||||
@@ -437,19 +437,17 @@ print_long (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_UNSIGNED_LONG_LONG
|
||||
static void
|
||||
print_long_long (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
{
|
||||
off_t i;
|
||||
for (i = n_bytes / sizeof (unsigned long long); i > 0; i--)
|
||||
for (i = n_bytes / sizeof (ulonglong_t); i > 0; i--)
|
||||
{
|
||||
unsigned long long tmp = *(const unsigned long long *) block;
|
||||
ulonglong_t tmp = *(const ulonglong_t *) block;
|
||||
printf (fmt_string, tmp);
|
||||
block += sizeof (unsigned long long);
|
||||
block += sizeof (ulonglong_t);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
print_float (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
@@ -1042,32 +1040,64 @@ skip (off_t n_skip)
|
||||
return err;
|
||||
}
|
||||
|
||||
static const char *
|
||||
format_address_none (off_t address ATTRIBUTE_UNUSED)
|
||||
static void
|
||||
format_address_none (off_t address ATTRIBUTE_UNUSED, char c ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
static const char *
|
||||
format_address_std (off_t address)
|
||||
static void
|
||||
format_address_std (off_t address, char c)
|
||||
{
|
||||
const char *address_string;
|
||||
char buf[MAX_ADDRESS_LENGTH + 2];
|
||||
char *p = buf + sizeof buf;
|
||||
char const *pbound;
|
||||
|
||||
sprintf (address_fmt_buffer, output_address_fmt_string, address);
|
||||
address_string = address_fmt_buffer;
|
||||
return address_string;
|
||||
*--p = '\0';
|
||||
*--p = c;
|
||||
pbound = p - address_pad_len;
|
||||
|
||||
/* Use a special case of the code for each base. This is measurably
|
||||
faster than generic code. */
|
||||
switch (address_base)
|
||||
{
|
||||
case 8:
|
||||
do
|
||||
*--p = '0' + (address & 7);
|
||||
while ((address >>= 3) != 0);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
do
|
||||
*--p = '0' + (address % 10);
|
||||
while ((address /= 10) != 0);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
do
|
||||
*--p = "0123456789abcdef"[address & 15];
|
||||
while ((address >>= 4) != 0);
|
||||
break;
|
||||
}
|
||||
|
||||
while (pbound < p)
|
||||
*--p = '0';
|
||||
|
||||
fputs (p, stdout);
|
||||
}
|
||||
|
||||
static const char *
|
||||
format_address_label (off_t address)
|
||||
static void
|
||||
format_address_paren (off_t address, char c)
|
||||
{
|
||||
const char *address_string;
|
||||
assert (output_address_fmt_string != NULL);
|
||||
putchar ('(');
|
||||
format_address_std (address, ')');
|
||||
putchar (c);
|
||||
}
|
||||
|
||||
sprintf (address_fmt_buffer, output_address_fmt_string,
|
||||
address, address + pseudo_offset);
|
||||
address_string = address_fmt_buffer;
|
||||
return address_string;
|
||||
static void
|
||||
format_address_label (off_t address, char c)
|
||||
{
|
||||
format_address_std (address, ' ');
|
||||
format_address_paren (address + pseudo_offset, c);
|
||||
}
|
||||
|
||||
/* Write N_BYTES bytes from CURR_BLOCK to standard output once for each
|
||||
@@ -1107,16 +1137,15 @@ write_block (off_t current_offset, off_t n_bytes,
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
prev_pair_equal = 0;
|
||||
for (i = 0; i < n_specs; i++)
|
||||
{
|
||||
const char *addr_or_pad = (i == 0
|
||||
? format_address (current_offset)
|
||||
: address_pad);
|
||||
|
||||
fputs (addr_or_pad, stdout);
|
||||
if (i == 0)
|
||||
format_address (current_offset, '\0');
|
||||
else
|
||||
printf ("%*s", address_pad_len, "");
|
||||
(*spec[i].print_function) (n_bytes, curr_block, spec[i].fmt_string);
|
||||
if (spec[i].hexl_mode_trailer)
|
||||
{
|
||||
@@ -1307,7 +1336,7 @@ read_block (size_t n, char *block, size_t *n_bytes_in_buffer)
|
||||
static int
|
||||
get_lcm (void)
|
||||
{
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
int l_c_m = 1;
|
||||
|
||||
for (i = 0; i < n_specs; i++)
|
||||
@@ -1436,7 +1465,7 @@ dump (void)
|
||||
|
||||
/* Make bytes_to_write the smallest multiple of l_c_m that
|
||||
is at least as large as n_bytes_read. */
|
||||
bytes_to_write = l_c_m * (int) ((n_bytes_read + l_c_m - 1) / l_c_m);
|
||||
bytes_to_write = l_c_m * ((n_bytes_read + l_c_m - 1) / l_c_m);
|
||||
|
||||
memset (block[idx] + n_bytes_read, 0, bytes_to_write - n_bytes_read);
|
||||
write_block (current_offset, bytes_to_write,
|
||||
@@ -1444,8 +1473,7 @@ dump (void)
|
||||
current_offset += n_bytes_read;
|
||||
}
|
||||
|
||||
if (output_address_fmt_string != NULL)
|
||||
printf ("%s\n", format_address (current_offset));
|
||||
format_address (current_offset, '\n');
|
||||
|
||||
if (limit_bytes_to_format && current_offset > end_offset)
|
||||
err |= check_and_close ();
|
||||
@@ -1523,10 +1551,8 @@ dump_strings (void)
|
||||
/* If we get here, the string is all printable and null-terminated,
|
||||
so print it. It is all in `buf' and `i' is its length. */
|
||||
buf[i] = 0;
|
||||
if (output_address_fmt_string != NULL)
|
||||
{
|
||||
printf ("%s ", format_address (address - i - 1));
|
||||
}
|
||||
format_address (address - i - 1, ' ');
|
||||
|
||||
for (i = 0; (c = buf[i]); i++)
|
||||
{
|
||||
switch (c)
|
||||
@@ -1575,42 +1601,21 @@ dump_strings (void)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* There must be exactly one %s format specifier in FORMAT_TEMPLATE.
|
||||
Return the just-malloc'd result of using sprintf to insert
|
||||
OFF_T_PRINTF_FORMAT_STRING into FORMAT_TEMPLATE.
|
||||
Technically, the caller should free this memory, but IMHO it's not
|
||||
worth it in this case. */
|
||||
static char *
|
||||
expand_address_fmt (char const *format_template)
|
||||
{
|
||||
size_t len = strlen (format_template);
|
||||
char *fmt = xmalloc (len + 1);
|
||||
/* Ensure that the literal we're inserting is no longer than the two-byte
|
||||
string `%s' it's replacing. There's also the %%, so technically we don't
|
||||
even need the `+ 1' above. */
|
||||
assert (OFF_T_PRINTF_FORMAT_STRING[0] == 0
|
||||
|| OFF_T_PRINTF_FORMAT_STRING[1] == 0
|
||||
|| OFF_T_PRINTF_FORMAT_STRING[2] == 0);
|
||||
sprintf (fmt, format_template, OFF_T_PRINTF_FORMAT_STRING);
|
||||
return fmt;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int n_files;
|
||||
unsigned int i;
|
||||
unsigned int l_c_m;
|
||||
unsigned int address_pad_len;
|
||||
unsigned long int desired_width IF_LINT (= 0);
|
||||
size_t i;
|
||||
int l_c_m;
|
||||
size_t desired_width IF_LINT (= 0);
|
||||
int width_specified = 0;
|
||||
int n_failed_decodes = 0;
|
||||
int err;
|
||||
|
||||
/* The old-style `pseudo starting address' to be printed in parentheses
|
||||
after any true address. */
|
||||
long int pseudo_start IF_LINT (= 0);
|
||||
off_t pseudo_start IF_LINT (= 0);
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
@@ -1628,8 +1633,8 @@ main (int argc, char **argv)
|
||||
integral_type_size[sizeof (short int)] = SHORT;
|
||||
integral_type_size[sizeof (int)] = INT;
|
||||
integral_type_size[sizeof (long int)] = LONG;
|
||||
#ifdef HAVE_UNSIGNED_LONG_LONG
|
||||
integral_type_size[sizeof (long long)] = LONG_LONG;
|
||||
#if HAVE_UNSIGNED_LONG_LONG
|
||||
integral_type_size[sizeof (ulonglong_t)] = LONG_LONG;
|
||||
#endif
|
||||
|
||||
for (i = 0; i <= MAX_FP_TYPE_SIZE; i++)
|
||||
@@ -1646,8 +1651,8 @@ main (int argc, char **argv)
|
||||
n_specs_allocated = 5;
|
||||
spec = (struct tspec *) xmalloc (n_specs_allocated * sizeof (struct tspec));
|
||||
|
||||
output_address_fmt_string = expand_address_fmt ("%%07%so");
|
||||
format_address = format_address_std;
|
||||
address_base = 8;
|
||||
address_pad_len = 7;
|
||||
flag_dump_strings = 0;
|
||||
|
||||
@@ -1666,22 +1671,21 @@ main (int argc, char **argv)
|
||||
switch (optarg[0])
|
||||
{
|
||||
case 'd':
|
||||
output_address_fmt_string = expand_address_fmt ("%%07%sd");
|
||||
format_address = format_address_std;
|
||||
address_base = 10;
|
||||
address_pad_len = 7;
|
||||
break;
|
||||
case 'o':
|
||||
output_address_fmt_string = expand_address_fmt ("%%07%so");
|
||||
format_address = format_address_std;
|
||||
address_base = 8;
|
||||
address_pad_len = 7;
|
||||
break;
|
||||
case 'x':
|
||||
output_address_fmt_string = expand_address_fmt ("%%06%sx");
|
||||
format_address = format_address_std;
|
||||
address_base = 16;
|
||||
address_pad_len = 6;
|
||||
break;
|
||||
case 'n':
|
||||
output_address_fmt_string = NULL;
|
||||
format_address = format_address_none;
|
||||
address_pad_len = 0;
|
||||
break;
|
||||
@@ -1785,7 +1789,7 @@ it must be one character from [doxn]"),
|
||||
s_err = xstrtoumax (optarg, NULL, 10, &w_tmp, "");
|
||||
if (s_err != LONGINT_OK)
|
||||
STRTOL_FATAL_ERROR (optarg, _("width specification"), s_err);
|
||||
if (ULONG_MAX < w_tmp)
|
||||
if (SIZE_MAX < w_tmp)
|
||||
error (EXIT_FAILURE, 0, _("%s is too large"), optarg);
|
||||
desired_width = w_tmp;
|
||||
}
|
||||
@@ -1885,29 +1889,17 @@ it must be one character from [doxn]"),
|
||||
|
||||
if (flag_pseudo_start)
|
||||
{
|
||||
static char buf[10];
|
||||
|
||||
if (output_address_fmt_string == NULL)
|
||||
if (format_address == format_address_none)
|
||||
{
|
||||
output_address_fmt_string = expand_address_fmt ("(%%07%so)");
|
||||
format_address = format_address_std;
|
||||
address_base = 8;
|
||||
address_pad_len = 7;
|
||||
format_address = format_address_paren;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (buf, "%s (%s)",
|
||||
output_address_fmt_string,
|
||||
output_address_fmt_string);
|
||||
output_address_fmt_string = buf;
|
||||
format_address = format_address_label;
|
||||
}
|
||||
format_address = format_address_label;
|
||||
}
|
||||
}
|
||||
|
||||
assert (address_pad_len <= MAX_ADDRESS_LENGTH);
|
||||
for (i = 0; i < address_pad_len; i++)
|
||||
address_pad[i] = ' ';
|
||||
address_pad[address_pad_len] = '\0';
|
||||
|
||||
if (n_specs == 0)
|
||||
{
|
||||
if (decode_one_format ("o2", "o2", NULL, &(spec[0])))
|
||||
@@ -1948,14 +1940,14 @@ it must be one character from [doxn]"),
|
||||
else
|
||||
{
|
||||
error (0, 0, _("warning: invalid width %lu; using %d instead"),
|
||||
desired_width, l_c_m);
|
||||
(unsigned long) desired_width, l_c_m);
|
||||
bytes_per_block = l_c_m;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (l_c_m < DEFAULT_BYTES_PER_BLOCK)
|
||||
bytes_per_block = l_c_m * (int) (DEFAULT_BYTES_PER_BLOCK / l_c_m);
|
||||
bytes_per_block = l_c_m * (DEFAULT_BYTES_PER_BLOCK / l_c_m);
|
||||
else
|
||||
bytes_per_block = l_c_m;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* remove.c -- core functions for removing files and directories
|
||||
Copyright (C) 88, 90, 91, 1994-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 88, 90, 91, 1994-2001 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
|
||||
@@ -171,7 +171,7 @@ hash_compare_active_dir_ents (void const *x, void const *y)
|
||||
{
|
||||
struct active_dir_ent const *a = x;
|
||||
struct active_dir_ent const *b = y;
|
||||
return SAME_INODE (*a, *b);
|
||||
return SAME_INODE (*a, *b) ? true : false;
|
||||
}
|
||||
|
||||
/* A hash function for null-terminated char* strings using
|
||||
@@ -615,7 +615,7 @@ remove_file (struct File_spec *fs, const struct rm_options *x)
|
||||
int asked = 0;
|
||||
char *pathname = fs->filename;
|
||||
|
||||
if (!x->ignore_missing_files && (x->interactive || x->stdin_tty)
|
||||
if (!x->ignore_missing_files && x->interactive && x->stdin_tty
|
||||
&& euidaccess (pathname, W_OK))
|
||||
{
|
||||
if (!S_ISLNK (fspec_filetype_mode (fs)))
|
||||
|
||||
24
src/shred.c
24
src/shred.c
@@ -117,7 +117,7 @@ char *xstrdup PARAMS ((char const *));
|
||||
# include <sys/time.h> /* For struct timeval */
|
||||
# include <sys/stat.h> /* For struct stat */
|
||||
|
||||
# define GNU_PACKAGE "standalone"
|
||||
# define PACKAGE "standalone"
|
||||
# define VERSION "2.0" /* Kind of arbitrary... */
|
||||
|
||||
# if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5 || __STRICT_ANSI__
|
||||
@@ -508,16 +508,22 @@ files, most people use the --remove option.\n\
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if ULONG_MAX == 0xffffffff
|
||||
#if defined __STDC__ && __STDC__
|
||||
# define UINT_MAX_32_BITS 4294967295U
|
||||
#else
|
||||
# define UINT_MAX_32_BITS 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
#if ULONG_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned long word32;
|
||||
#else
|
||||
# if UINT_MAX == 0xffffffff
|
||||
# if UINT_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned word32;
|
||||
# else
|
||||
# if USHRT_MAX == 0xffffffff
|
||||
# if USHRT_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned short word32;
|
||||
# else
|
||||
# if UCHAR_MAX == 0xffffffff
|
||||
# if UCHAR_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned char word32;
|
||||
# else
|
||||
"No 32-bit type available!"
|
||||
@@ -779,7 +785,7 @@ isaac_seed_finish (struct isaac_state *s)
|
||||
#define ISAAC_SEED(s,x) isaac_seed_data (s, &(x), sizeof (x))
|
||||
|
||||
|
||||
#if __GNUC__ >= 2 && (__i386__ || __alpha__ || _ARCH_PPC)
|
||||
#if __GNUC__ >= 2 && (__i386__ || __alpha__)
|
||||
/*
|
||||
* Many processors have very-high-resolution timer registers,
|
||||
* The timer registers can be made inaccessible, so we have to deal with the
|
||||
@@ -815,6 +821,8 @@ isaac_seed_machdep (struct isaac_state *s)
|
||||
__asm__ __volatile__ ("rpcc %0" : "=r" (t));
|
||||
# endif
|
||||
# if _ARCH_PPC
|
||||
/* Code not used because this instruction is available only on first-
|
||||
generation PPCs and evokes a SIGBUS on some Linux 2.4 kernels. */
|
||||
word32 t;
|
||||
__asm__ __volatile__ ("mfspr %0,22" : "=r" (t));
|
||||
# endif
|
||||
@@ -833,12 +841,12 @@ isaac_seed_machdep (struct isaac_state *s)
|
||||
}
|
||||
}
|
||||
|
||||
#else /* !(__i386__ || __alpha__ || _ARCH_PPC) */
|
||||
#else /* !(__i386__ || __alpha__) */
|
||||
|
||||
/* Do-nothing stub */
|
||||
# define isaac_seed_machdep(s) (void) 0
|
||||
|
||||
#endif /* !(__i386__ || __alpha__ || _ARCH_PPC) */
|
||||
#endif /* !(__i386__ || __alpha__) */
|
||||
|
||||
|
||||
/*
|
||||
|
||||
139
src/sort.c
139
src/sort.c
@@ -1,5 +1,5 @@
|
||||
/* sort - sort lines of text (with all kinds of options).
|
||||
Copyright (C) 88, 1991-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 88, 1991-2001 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
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "hard-locale.h"
|
||||
#include "human.h"
|
||||
#include "memcoll.h"
|
||||
#include "physmem.h"
|
||||
#include "xalloc.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -57,6 +58,7 @@ double strtod ();
|
||||
#endif
|
||||
|
||||
/* Undefine, to avoid warning about redefinition on some systems. */
|
||||
/* FIXME: Remove these: use MIN/MAX from sys2.h. */
|
||||
#undef min
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#undef max
|
||||
@@ -215,21 +217,19 @@ static MONTHTAB_CONST struct month monthtab[] =
|
||||
/* During the merge phase, the number of files to merge at once. */
|
||||
#define NMERGE 16
|
||||
|
||||
/* Initial buffer size for in-core sorting. The buffer will grow only
|
||||
if a line longer than this is seen. */
|
||||
#define SORTALLOC (8 * 1024 * 1024)
|
||||
static size_t const sortalloc = SORTALLOC;
|
||||
/* Minimum text buffer size. */
|
||||
#define SORTALLOC_MIN (4 * NMERGE * sizeof (struct line))
|
||||
|
||||
/* Initial buffer size for in core merge buffers. Bear in mind that
|
||||
up to NMERGE * mergealloc bytes may be allocated for merge buffers. */
|
||||
static size_t const mergealloc = SORTALLOC / NMERGE / 2;
|
||||
/* Minimum text buffer size if the user does not specify a size. */
|
||||
#define SORTALLOC_DEFAULT_MIN max (SORTALLOC_MIN, 1024 * 1024)
|
||||
|
||||
/* Initial text buffer size for main-memory sorting. The buffer will
|
||||
grow only if a line longer than this is seen. */
|
||||
static size_t sortalloc;
|
||||
|
||||
/* Guess of average line length. */
|
||||
static size_t const linelength = 30;
|
||||
|
||||
/* Maximum number of elements for the array(s) of struct line's, in bytes. */
|
||||
#define LINEALLOC (SORTALLOC / 2)
|
||||
|
||||
/* Array of directory names in which any temporary files are to be created. */
|
||||
static char const **temp_dirs;
|
||||
|
||||
@@ -281,7 +281,7 @@ Usage: %s [OPTION]... [FILE]...\n\
|
||||
Write sorted concatenation of all FILE(s) to standard output.\n\
|
||||
\n\
|
||||
+POS1 [-POS2] start a key at POS1, end it *before* POS2 (obsolescent)\n\
|
||||
field numbers and character offsets are numbered\n\
|
||||
field numbers and character offsets are numbered\n\
|
||||
starting with zero (contrast with the -k option)\n\
|
||||
-b ignore leading blanks in sort fields or keys\n\
|
||||
-c check if given files already sorted, do not sort\n\
|
||||
@@ -290,7 +290,7 @@ Write sorted concatenation of all FILE(s) to standard output.\n\
|
||||
-g compare according to general numerical value, imply -b\n\
|
||||
-i consider only printable characters in keys\n\
|
||||
-k POS1[,POS2] start a key at POS1, end it *at* POS2\n\
|
||||
field numbers and character offsets are numbered\n\
|
||||
field numbers and character offsets are numbered\n\
|
||||
starting with one (contrast with zero-based +POS form)\n\
|
||||
-m merge already sorted files, do not sort\n\
|
||||
-M compare (unknown) < `JAN' < ... < `DEC', imply -b\n\
|
||||
@@ -298,9 +298,10 @@ Write sorted concatenation of all FILE(s) to standard output.\n\
|
||||
-o FILE write result on FILE instead of standard output\n\
|
||||
-r reverse the result of comparisons\n\
|
||||
-s stabilize sort by disabling last resort comparison\n\
|
||||
-S SIZE use SIZE for main memory sorting\n\
|
||||
-t SEP use SEParator instead of non- to whitespace transition\n\
|
||||
-T DIRECTORY use DIRECTORY for temporary files, not $TMPDIR or %s\n\
|
||||
multiple -T options specify multiple directories\n\
|
||||
multiple -T options specify multiple directories\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\
|
||||
@@ -314,7 +315,12 @@ POS is F[.C][OPTS], where F is the field number and C the character position\n\
|
||||
in the field, both counted from one with -k, from zero with the obsolescent\n\
|
||||
form. OPTS is made up of one or more of Mbdfinr; this effectively disables\n\
|
||||
global -Mbdfinr settings for that key. If no key is given, use the entire\n\
|
||||
line as the key. With no FILE, or when FILE is -, read standard input.\n\
|
||||
line as the key.\n\
|
||||
\n\
|
||||
SIZE may be followed by the following multiplicative suffixes:\n\
|
||||
%% 1%% of memory, b 1, k 1024 (default), and so on for M, G, T, P, E, Z, Y.\n\
|
||||
\n\
|
||||
With no FILE, or when FILE is -, read standard input.\n\
|
||||
\n\
|
||||
*** WARNING ***\n\
|
||||
The locale specified by the environment affects sort order.\n\
|
||||
@@ -558,6 +564,79 @@ inittables (void)
|
||||
#endif /* NLS */
|
||||
}
|
||||
|
||||
/* Specify the amount of main memory to use when sorting. */
|
||||
static void
|
||||
specify_sort_size (char const *s)
|
||||
{
|
||||
uintmax_t n;
|
||||
char *suffix;
|
||||
enum strtol_error e = xstrtoumax (s, &suffix, 10, &n, "EgGkmMPtTYZ");
|
||||
|
||||
/* The default unit is kB. */
|
||||
if (e == LONGINT_OK && ISDIGIT (suffix[-1]))
|
||||
{
|
||||
if (n <= UINTMAX_MAX / 1024)
|
||||
n *= 1024;
|
||||
else
|
||||
e = LONGINT_OVERFLOW;
|
||||
}
|
||||
|
||||
/* A 'b' suffix means bytes; a '%' suffix means percent of memory. */
|
||||
if (e == LONGINT_INVALID_SUFFIX_CHAR && ISDIGIT (suffix[-1]) && ! suffix[1])
|
||||
switch (suffix[0])
|
||||
{
|
||||
case 'b':
|
||||
e = LONGINT_OK;
|
||||
break;
|
||||
|
||||
case '%':
|
||||
{
|
||||
double mem = physmem_total () * n / 100;
|
||||
|
||||
/* Use "<", not "<=", to avoid problems with rounding. */
|
||||
if (mem < UINTMAX_MAX)
|
||||
{
|
||||
n = mem;
|
||||
e = LONGINT_OK;
|
||||
}
|
||||
else
|
||||
e = LONGINT_OVERFLOW;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (e == LONGINT_OK)
|
||||
{
|
||||
/* Normally a buffer is allocated with sortalloc bytes, and a
|
||||
line table with at most sortalloc / 2 bytes. So adjust the
|
||||
size so that size * 1.5 is about n. */
|
||||
sortalloc = (n / 3) * 2;
|
||||
if (sortalloc == (n / 3) * 2)
|
||||
{
|
||||
if (sortalloc < SORTALLOC_MIN)
|
||||
sortalloc = SORTALLOC_MIN;
|
||||
return;
|
||||
}
|
||||
|
||||
e = LONGINT_OVERFLOW;
|
||||
}
|
||||
|
||||
STRTOL_FATAL_ERROR (s, _("sort size"), e);
|
||||
}
|
||||
|
||||
/* Set the sort size to the default. */
|
||||
static void
|
||||
default_sort_size (void)
|
||||
{
|
||||
/* Set sortalloc to 50% of available memory, unless it overflows. */
|
||||
double mem = physmem_available ();
|
||||
sortalloc = min (mem, SIZE_MAX);
|
||||
sortalloc >>= 1;
|
||||
|
||||
if (sortalloc < SORTALLOC_DEFAULT_MIN)
|
||||
sortalloc = SORTALLOC_DEFAULT_MIN;
|
||||
}
|
||||
|
||||
/* Initialize BUF, allocating ALLOC bytes initially. */
|
||||
|
||||
static void
|
||||
@@ -631,6 +710,8 @@ fillbuf (struct buffer *buf, FILE *fp)
|
||||
static void
|
||||
initlines (struct lines *lines, size_t alloc, size_t limit)
|
||||
{
|
||||
if (limit < alloc)
|
||||
alloc = limit;
|
||||
lines->alloc = alloc;
|
||||
if (SIZE_MAX / sizeof (struct line) < alloc)
|
||||
xalloc_die ();
|
||||
@@ -806,7 +887,7 @@ findlines (struct buffer *buf, struct lines *lines)
|
||||
|
||||
if (lines->used == lines->alloc)
|
||||
{
|
||||
lines->alloc *= 2;
|
||||
lines->alloc = min (2 * lines->alloc, lines->limit);
|
||||
if (SIZE_MAX / sizeof (struct line) < lines->alloc)
|
||||
xalloc_die ();
|
||||
lines->lines = (struct line *)
|
||||
@@ -1360,10 +1441,11 @@ checkfp (FILE *fp, const char *file_name)
|
||||
struct line *disorder_line IF_LINT (= NULL);
|
||||
uintmax_t disorder_line_number = 0;
|
||||
struct keyfield *key = keylist;
|
||||
size_t mergealloc = sortalloc / (2 * NMERGE);
|
||||
|
||||
initbuf (&buf, mergealloc);
|
||||
initlines (&lines, mergealloc / linelength + 1,
|
||||
LINEALLOC / ((NMERGE + NMERGE) * sizeof (struct line)));
|
||||
sortalloc / (4 * NMERGE * sizeof (struct line)));
|
||||
alloc = linelength;
|
||||
temp.text = xmalloc (alloc);
|
||||
|
||||
@@ -1460,6 +1542,7 @@ mergefps (FILE **fps, register int nfps, FILE *ofp, const char *output_file)
|
||||
struct line saved; /* Saved line storage for unique check. */
|
||||
struct line const *savedline IF_LINT (= NULL);
|
||||
/* &saved if there is a saved line. */
|
||||
size_t mergealloc = sortalloc / (2 * NMERGE);
|
||||
size_t savealloc IF_LINT (= 0); /* Size allocated for the saved line. */
|
||||
size_t cur[NMERGE]; /* Current line in each line table. */
|
||||
int ord[NMERGE]; /* Table representing a permutation of fps,
|
||||
@@ -1494,7 +1577,7 @@ mergefps (FILE **fps, register int nfps, FILE *ofp, const char *output_file)
|
||||
else
|
||||
{
|
||||
initlines (&lines[i], mergealloc / linelength + 1,
|
||||
LINEALLOC / ((NMERGE + NMERGE) * sizeof (struct line)));
|
||||
sortalloc / (4 * NMERGE * sizeof (struct line)));
|
||||
findlines (&buffer[i], &lines[i]);
|
||||
cur[i] = 0;
|
||||
}
|
||||
@@ -1721,7 +1804,7 @@ sort (char **files, int nfiles, FILE *ofp, const char *output_file)
|
||||
|
||||
initbuf (&buf, sortalloc);
|
||||
initlines (&lines, sortalloc / linelength + 1,
|
||||
LINEALLOC / sizeof (struct line));
|
||||
sortalloc / (2 * sizeof (struct line)));
|
||||
|
||||
while (nfiles--)
|
||||
{
|
||||
@@ -1966,7 +2049,7 @@ main (int argc, char **argv)
|
||||
|
||||
#endif /* NLS */
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
|
||||
AUTHORS, usage);
|
||||
|
||||
have_read_stdin = 0;
|
||||
@@ -2105,7 +2188,7 @@ lacks following character offset"));
|
||||
{
|
||||
/* Provoke with `sort -k1.0' */
|
||||
error (0, 0, _("starting field character offset \
|
||||
argument to the `-k' option\nmust be positive"));
|
||||
argument to the `-k' option must be positive"));
|
||||
badfieldspec (argv[i]);
|
||||
}
|
||||
}
|
||||
@@ -2181,6 +2264,15 @@ but lacks following character offset"));
|
||||
case 's':
|
||||
stable = 1;
|
||||
break;
|
||||
case 'S':
|
||||
if (s[1])
|
||||
specify_sort_size (++s);
|
||||
else if (i < argc - 1)
|
||||
specify_sort_size (argv[++i]);
|
||||
else
|
||||
error (SORT_FAILURE, 0,
|
||||
_("option `-S' requires an argument"));
|
||||
goto outer;
|
||||
case 't':
|
||||
if (s[1])
|
||||
tab = *++s;
|
||||
@@ -2239,7 +2331,7 @@ but lacks following character offset"));
|
||||
for (key = keylist; key; key = key->next)
|
||||
if (!key->ignore && !key->translate && !key->skipsblanks && !key->reverse
|
||||
&& !key->skipeblanks && !key->month && !key->numeric
|
||||
&& !key->general_numeric)
|
||||
&& !key->general_numeric)
|
||||
{
|
||||
key->ignore = gkey.ignore;
|
||||
key->translate = gkey.translate;
|
||||
@@ -2269,6 +2361,9 @@ but lacks following character offset"));
|
||||
files = −
|
||||
}
|
||||
|
||||
if (sortalloc == 0)
|
||||
default_sort_size ();
|
||||
|
||||
if (checkonly)
|
||||
{
|
||||
if (nfiles > 1)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* sync - update the super block
|
||||
Copyright (C) 1994-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994-2001 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
|
||||
@@ -63,7 +63,7 @@ main (int argc, char **argv)
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
|
||||
AUTHORS, usage);
|
||||
|
||||
if (argc != 1)
|
||||
|
||||
15
src/sys2.h
15
src/sys2.h
@@ -171,6 +171,10 @@ char *alloca ();
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h> /* for the definition of UINTMAX_MAX */
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
/* Jim Meyering writes:
|
||||
@@ -260,12 +264,17 @@ char *alloca ();
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# if HAVE_GETTEXT && !HAVE_DCGETTEXT && !defined dcgettext
|
||||
# define dcgettext(Domain, Text, Category) Text
|
||||
# endif
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# undef bindtextdomain
|
||||
# define bindtextdomain(Domain, Directory) /* empty */
|
||||
# undef textdomain
|
||||
# define textdomain(Domain) /* empty */
|
||||
# undef dcgettext
|
||||
# define dcgettext(Domainname, Text, Category) Text
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
#define N_(Text) Text
|
||||
@@ -455,7 +464,7 @@ enum
|
||||
|
||||
#define case_GETOPT_VERSION_CHAR(Program_name, Authors) \
|
||||
case GETOPT_VERSION_CHAR: \
|
||||
version_etc (stdout, Program_name, GNU_PACKAGE, VERSION, Authors); \
|
||||
version_etc (stdout, Program_name, PACKAGE, VERSION, Authors); \
|
||||
exit (EXIT_SUCCESS); \
|
||||
break;
|
||||
|
||||
@@ -527,6 +536,10 @@ enum
|
||||
# define SIZE_MAX TYPE_MAXIMUM (size_t)
|
||||
#endif
|
||||
|
||||
#ifndef UINTMAX_MAX
|
||||
# define UINTMAX_MAX TYPE_MAXIMUM (uintmax_t)
|
||||
#endif
|
||||
|
||||
#ifndef OFF_T_MIN
|
||||
# define OFF_T_MIN TYPE_MINIMUM (off_t)
|
||||
#endif
|
||||
|
||||
12
src/tail.c
12
src/tail.c
@@ -1,5 +1,5 @@
|
||||
/* tail -- output the last part of file(s)
|
||||
Copyright (C) 1989, 90, 91, 1995-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989, 90, 91, 1995-2001 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
|
||||
@@ -263,6 +263,11 @@ With no FILE, or when FILE is -, read standard input.\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
"),
|
||||
DEFAULT_N_LINES, DEFAULT_N_LINES,
|
||||
DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS
|
||||
);
|
||||
printf (_("\
|
||||
If the first character of N (the number of bytes or lines) is a `+',\n\
|
||||
print beginning with the Nth item from the start of each file, otherwise,\n\
|
||||
print the last N items in the file. N may have a multiplier suffix:\n\
|
||||
@@ -279,10 +284,7 @@ rotation). Use --follow=name in that case. That causes tail to track the\n\
|
||||
named file by reopening it periodically to see if it has been removed and\n\
|
||||
recreated by some other program.\n\
|
||||
\n\
|
||||
"),
|
||||
DEFAULT_N_LINES, DEFAULT_N_LINES,
|
||||
DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS
|
||||
);
|
||||
"));
|
||||
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
|
||||
}
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* tsort - topological sort.
|
||||
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999, 2000, 2001 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
|
||||
@@ -556,7 +556,7 @@ main (int argc, char **argv)
|
||||
|
||||
exit_status = 0;
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
|
||||
AUTHORS, usage);
|
||||
|
||||
while ((opt = getopt_long (argc, argv, "", long_options, NULL)) != -1)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
1
tests/chgrp/.cvsignore
Normal file
1
tests/chgrp/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
Makefile
|
||||
7
tests/chgrp/Makefile.am
Normal file
7
tests/chgrp/Makefile.am
Normal file
@@ -0,0 +1,7 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
AUTOMAKE_OPTIONS = 1.4 gnits
|
||||
|
||||
TESTS = basic deref recurse
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
PATH=`pwd`/../../src:$$PATH
|
||||
283
tests/chgrp/Makefile.in
Normal file
283
tests/chgrp/Makefile.in
Normal file
@@ -0,0 +1,283 @@
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
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 = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_FLAG =
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
|
||||
@SET_MAKE@
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AMDEP = @AMDEP@
|
||||
AMTAR = @AMTAR@
|
||||
AWK = @AWK@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
DF_PROG = @DF_PROG@
|
||||
FESETROUND_LIBM = @FESETROUND_LIBM@
|
||||
GENCAT = @GENCAT@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
GLIBC21 = @GLIBC21@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GNU_PACKAGE = @GNU_PACKAGE@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
LIB_NANOSLEEP = @LIB_NANOSLEEP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
NEED_SETGID = @NEED_SETGID@
|
||||
OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@
|
||||
OPTIONAL_BIN_ZCRIPTS = @OPTIONAL_BIN_ZCRIPTS@
|
||||
PACKAGE = @PACKAGE@
|
||||
PERL = @PERL@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
POW_LIBM = @POW_LIBM@
|
||||
RANLIB = @RANLIB@
|
||||
SEQ_LIBM = @SEQ_LIBM@
|
||||
SQRT_LIBM = @SQRT_LIBM@
|
||||
U = @U@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.4 gnits
|
||||
|
||||
TESTS = basic deref recurse
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
PATH=`pwd`/../../src:$$PATH
|
||||
|
||||
subdir = tests/chgrp
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/chgrp/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
list='$(TESTS)'; \
|
||||
if test -n "$$list"; then \
|
||||
for tst in $$list; do \
|
||||
if test -f ./$$tst; then dir=./; \
|
||||
elif test -f $$tst; then dir=; \
|
||||
else dir="$(srcdir)/"; fi; \
|
||||
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
|
||||
all=`expr $$all + 1`; \
|
||||
case " $(XFAIL_TESTS) " in \
|
||||
*" $$tst "*) \
|
||||
xpass=`expr $$xpass + 1`; \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "XPASS: $$tst"; \
|
||||
;; \
|
||||
*) \
|
||||
echo "PASS: $$tst"; \
|
||||
;; \
|
||||
esac; \
|
||||
elif test $$? -ne 77; then \
|
||||
all=`expr $$all + 1`; \
|
||||
case " $(XFAIL_TESTS) " in \
|
||||
*" $$tst "*) \
|
||||
xfail=`expr $$xfail + 1`; \
|
||||
echo "XFAIL: $$tst"; \
|
||||
;; \
|
||||
*) \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "FAIL: $$tst"; \
|
||||
;; \
|
||||
esac; \
|
||||
fi; \
|
||||
done; \
|
||||
if test "$$failed" -eq 0; then \
|
||||
if test "$$xfail" -eq 0; then \
|
||||
banner="All $$all tests passed"; \
|
||||
else \
|
||||
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
|
||||
fi; \
|
||||
else \
|
||||
if test "$$xpass" -eq 0; then \
|
||||
banner="$$failed of $$all tests failed"; \
|
||||
else \
|
||||
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"; \
|
||||
test "$$failed" -eq 0; \
|
||||
fi
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir) \
|
||||
|| exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am:
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
-rm -f Makefile.in
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-generic clean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: tags check-TESTS distdir info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-am install-data install-am install uninstall-am uninstall \
|
||||
all-redirect all-am all install-strip 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:
|
||||
89
tests/chgrp/basic
Executable file
89
tests/chgrp/basic
Executable file
@@ -0,0 +1,89 @@
|
||||
#!/bin/sh
|
||||
# make sure chgrp is reasonable
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chgrp --version
|
||||
fi
|
||||
|
||||
. $srcdir/../envvar-check
|
||||
. $srcdir/../lang-default
|
||||
. $srcdir/../group-names
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=basic.$$
|
||||
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework' 1>&2
|
||||
(exit 1); exit
|
||||
fi
|
||||
|
||||
fail=0
|
||||
|
||||
set _ $groups; shift
|
||||
g1=$1
|
||||
g2=$2
|
||||
mkdir d
|
||||
touch f f2 d/f3
|
||||
chgrp $g1 f || fail=1
|
||||
chgrp $g2 f || fail=1
|
||||
chgrp $g2 f2 || fail=1
|
||||
|
||||
(
|
||||
chgrp -c $g1 f
|
||||
chgrp -c $g2 f
|
||||
chgrp -c $g2 f
|
||||
chgrp --verbose $g1 f
|
||||
chgrp --verbose $g1 f
|
||||
chgrp --verbose --reference=f2 f
|
||||
chgrp -R --verbose $g2 d
|
||||
chgrp -R --verbose $g1 d
|
||||
chgrp -R -c $g2 d
|
||||
chgrp -R -c $g1 d
|
||||
chgrp -c $g2 d
|
||||
|
||||
rm -f f
|
||||
touch f
|
||||
ln -s f symlink
|
||||
chgrp $g1 f
|
||||
chgrp $g2 symlink 2> /dev/null
|
||||
# This should not change the group of f.
|
||||
chgrp -c $g2 symlink 2> /dev/null
|
||||
chgrp -c $g2 f
|
||||
|
||||
# This *should* change the group of f.
|
||||
# Though note that the diagnostic is misleading in that
|
||||
# it says the `group of `symlink'' has been changed.
|
||||
chgrp --dereference -c $g1 symlink
|
||||
|
||||
) 2>&1 | sed "s/ $g1$/ G1/;s/ $g2$/ G2/" > actual
|
||||
|
||||
cat <<\EOF > expected
|
||||
changed group of `f' to G1
|
||||
changed group of `f' to G2
|
||||
changed group of `f' to G1
|
||||
group of `f' retained as G1
|
||||
changed group of `f' to G2
|
||||
changed group of `d' to G2
|
||||
changed group of `d/f3' to G2
|
||||
changed group of `d' to G1
|
||||
changed group of `d/f3' to G1
|
||||
changed group of `d' to G2
|
||||
changed group of `d/f3' to G2
|
||||
changed group of `d' to G1
|
||||
changed group of `d/f3' to G1
|
||||
changed group of `d' to G2
|
||||
changed group of `f' to G2
|
||||
changed group of `symlink' to G1
|
||||
EOF
|
||||
|
||||
cmp expected actual \
|
||||
|| { diff -u expected actual 1>&2; fail=1; }
|
||||
|
||||
(exit $fail); exit
|
||||
67
tests/chgrp/deref
Executable file
67
tests/chgrp/deref
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/bin/sh
|
||||
# see if chgrp can change the group of a symlink
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chgrp --version
|
||||
fi
|
||||
|
||||
. $srcdir/../group-names
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=slink.$$
|
||||
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework' 1>&2
|
||||
(exit 1); exit
|
||||
fi
|
||||
|
||||
set _ $groups; shift
|
||||
g1=$1
|
||||
g2=$2
|
||||
|
||||
touch f
|
||||
ln -s f symlink
|
||||
|
||||
chgrp $g2 symlink 2> /dev/null
|
||||
set _ `ls -l symlink`
|
||||
g=$5
|
||||
test "$g" = $g2 || {
|
||||
cat <<EOF 1>&2
|
||||
$0: skipping this test; your system doesn't support changing
|
||||
the owner or group of a symbolic link.
|
||||
EOF
|
||||
(exit 77); exit
|
||||
}
|
||||
|
||||
fail=0
|
||||
|
||||
chgrp $g1 f
|
||||
set _ `ls -l f`; g=$5; test "$g" = $g1 || fail=1
|
||||
|
||||
chgrp $g2 symlink || fail=1
|
||||
set _ `ls -l f`; g=$5; test "$g" = $g1 || fail=1
|
||||
set _ `ls -l symlink`; g=$5; test "$g" = $g2 || fail=1
|
||||
|
||||
# This should not change the group of f.
|
||||
chgrp $g2 symlink || fail=1
|
||||
set _ `ls -l f`; g=$5; test "$g" = $g1 || fail=1
|
||||
set _ `ls -l symlink`; g=$5; test "$g" = $g2 || fail=1
|
||||
|
||||
chgrp $g2 f
|
||||
set _ `ls -l f`; g=$5; test "$g" = $g2 || fail=1
|
||||
|
||||
# This *should* change the group of f.
|
||||
# Though note that the diagnostic you'd get with -c is misleading in that
|
||||
# it says the `group of `symlink'' has been changed.
|
||||
chgrp --dereference $g1 symlink
|
||||
set _ `ls -l f`; g=$5; test "$g" = $g1 || fail=1
|
||||
set _ `ls -l symlink`; g=$5; test "$g" = $g2 || fail=1
|
||||
|
||||
(exit $fail); exit
|
||||
47
tests/chgrp/recurse
Executable file
47
tests/chgrp/recurse
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
# make sure chgrp handles --recursive w/symlinks
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chgrp --version
|
||||
fi
|
||||
|
||||
. $srcdir/../group-names
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=slink.$$
|
||||
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework' 1>&2
|
||||
(exit 1); exit
|
||||
fi
|
||||
|
||||
set _ $groups; shift
|
||||
g1=$1
|
||||
g2=$2
|
||||
|
||||
fail=0
|
||||
|
||||
# chgrp -R should not traverse a symlink to a directory.
|
||||
mkdir d e
|
||||
touch e/f
|
||||
ln -s ../e d/s
|
||||
chgrp -R $g1 e/f || fail=1
|
||||
# Neither of the following should change the group of e/f
|
||||
chgrp -R $g2 d
|
||||
set _ `ls -l e/f`; g=$5; test "$g" = $g1 || fail=1
|
||||
chgrp --deref -R $g2 d
|
||||
set _ `ls -l e/f`; g=$5; test "$g" = $g1 || fail=1
|
||||
|
||||
# Even when the symlink-to-directory is a command line argument, it should
|
||||
# not be traversed. So this shouldn't change the group of e/f either.
|
||||
chgrp --deref -R $g2 d/s || fail=1
|
||||
set _ `ls -l e/f`; g=$5; test "$g" = $g1 || fail=1
|
||||
|
||||
(exit $fail); exit
|
||||
@@ -1,7 +1,7 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
AUTOMAKE_OPTIONS = 1.4 gnits
|
||||
|
||||
TESTS = equal-x c-option
|
||||
TESTS = equal-x c-option setgid
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
PATH=`pwd`/../../src:$$PATH
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
@@ -118,7 +118,7 @@ l = @l@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.4 gnits
|
||||
|
||||
TESTS = equal-x c-option
|
||||
TESTS = equal-x c-option setgid
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
PATH=`pwd`/../../src:$$PATH
|
||||
|
||||
@@ -33,7 +33,7 @@ if test $framework_failure = 1; then
|
||||
(exit 1); exit
|
||||
fi
|
||||
|
||||
. $abs_srcdir/../sticky-check
|
||||
. $abs_srcdir/../setgid-check
|
||||
|
||||
fail=0
|
||||
|
||||
|
||||
73
tests/chmod/setgid
Executable file
73
tests/chmod/setgid
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/bin/sh
|
||||
# Make sure GNU chmod works the same way as those of Solaris, HPUX, AIX
|
||||
# wrt directories with the setgid bit set.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chmod --version
|
||||
fi
|
||||
|
||||
. $srcdir/../envvar-check
|
||||
. $srcdir/../lang-default
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=setgid.$$
|
||||
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
framework_failure=0
|
||||
|
||||
# Record absolute path of srcdir and cd back to current dir.
|
||||
cd $srcdir || framework_failure=1
|
||||
abs_srcdir=`pwd`
|
||||
cd $pwd || framework_failure=1
|
||||
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
|
||||
. $abs_srcdir/../setgid-check
|
||||
|
||||
umask 0
|
||||
mkdir d || framework_failure=1
|
||||
|
||||
chmod g+s d 2> /dev/null ||
|
||||
{
|
||||
# This is required because on some systems (at least NetBSD 1.4.2A),
|
||||
# it may happen that when you create a directory, its group isn't one
|
||||
# to which you belong. When that happens, the above chmod fails. So
|
||||
# here, upon failure, we try to set the group, then rerun the chmod command.
|
||||
group=${FETISH_GROUP-`(id -ng || /usr/xpg4/bin/id -ng) 2>/dev/null`}
|
||||
if test "$group"; then
|
||||
chgrp "$group" d || framework_failure=1
|
||||
chmod g+s d || framework_failure=1
|
||||
else
|
||||
framework_failure=1
|
||||
fi
|
||||
}
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework' 1>&2
|
||||
(exit 1); exit
|
||||
fi
|
||||
|
||||
fail=0
|
||||
|
||||
chmod 755 d
|
||||
|
||||
# To be compatible with chmod from other vendors,
|
||||
# GNU chmod must not reset a directory's setgid bit.
|
||||
# The latest POSIX draft (d5) allows either behavior. It says:
|
||||
#
|
||||
# For regular files, for each bit set in the octal number
|
||||
# corresponding to the set-user-ID-on-execution or the
|
||||
# set-group-ID-on-execution, bits shown in the following table shall
|
||||
# be set; if these bits are not set in the octal number, they are
|
||||
# cleared. For other file types, it is implementation-defined whether
|
||||
# or not requests to set or clear the set-user-ID-on-execution or
|
||||
# set-group-ID-on-execution bits are honored.
|
||||
|
||||
# FIXME: consider changing GNU chmod to work like other versions of chmod.
|
||||
# For now, this test simply confirms the existing behavior.
|
||||
p=`ls -ld d|sed 's/ .*//'`; case $p in drwxr-xr-x);; *) fail=1;; esac
|
||||
|
||||
(exit $fail); exit
|
||||
@@ -4,7 +4,8 @@ AUTOMAKE_OPTIONS = 1.1 gnits
|
||||
TESTS = \
|
||||
backup-1 no-deref-link1 no-deref-link2 no-deref-link3 backup-is-src \
|
||||
same-file cp-mv-backup symlink-slash slink-2-slink fail-perm dir-slash \
|
||||
perm cp-HL special-bits link dir-rm-dest cp-parents
|
||||
perm cp-HL special-bits link dir-rm-dest cp-parents deref-slink \
|
||||
dir-vs-file into-self
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
MAKE=$(MAKE) \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
@@ -121,7 +121,8 @@ AUTOMAKE_OPTIONS = 1.1 gnits
|
||||
TESTS = \
|
||||
backup-1 no-deref-link1 no-deref-link2 no-deref-link3 backup-is-src \
|
||||
same-file cp-mv-backup symlink-slash slink-2-slink fail-perm dir-slash \
|
||||
perm cp-HL special-bits link dir-rm-dest cp-parents
|
||||
perm cp-HL special-bits link dir-rm-dest cp-parents deref-slink \
|
||||
dir-vs-file into-self
|
||||
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
|
||||
@@ -14,11 +14,20 @@ tmp=cp-parents.$$
|
||||
trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
framework_failure=0
|
||||
|
||||
# Record absolute path of srcdir and cd back to current dir.
|
||||
cd $srcdir || framework_failure=1
|
||||
abs_srcdir=`pwd`
|
||||
cd $pwd || framework_failure=1
|
||||
|
||||
. $srcdir/../envvar-check
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
|
||||
. $abs_srcdir/../setgid-check
|
||||
|
||||
mkdir foo bar || framework_failure=1
|
||||
mkdir -p a/b/c d e || framework_failure=1
|
||||
|
||||
|
||||
32
tests/cp/deref-slink
Executable file
32
tests/cp/deref-slink
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# Demonstrate bug when using -d with an existing destination file
|
||||
# that is a symlink.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/../envvar-check
|
||||
. $srcdir/../lang-default
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=FIXME.$$
|
||||
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
touch f slink-target || framework_failure=1
|
||||
ln -s slink-target slink || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework' 1>&2
|
||||
(exit 1); exit
|
||||
fi
|
||||
|
||||
fail=0
|
||||
cp -d f slink || fail=1
|
||||
|
||||
(exit $fail); exit
|
||||
37
tests/cp/dir-vs-file
Executable file
37
tests/cp/dir-vs-file
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
# A directory may not replace an existing file.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/../envvar-check
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=dirvfile.$$
|
||||
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
|
||||
mkdir dir || framework_failure=1
|
||||
touch file || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework' 1>&2
|
||||
(exit 1); exit
|
||||
fi
|
||||
|
||||
fail=0
|
||||
|
||||
# In 4.0.35, this cp invocation silently succeeded.
|
||||
cp -R dir file 2>/dev/null && fail=1
|
||||
|
||||
# Make sure file is not replaced with a directory.
|
||||
# In 4.0.35, it was.
|
||||
test -f file || fail=1
|
||||
|
||||
(exit $fail); exit
|
||||
45
tests/cp/into-self
Executable file
45
tests/cp/into-self
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
# Confirm that copying a directory into itself gets a proper diagnostic.
|
||||
# In 4.0.35 and earlier, `mkdir dir && cp -R dir dir' would produce this:
|
||||
# cp: won't create hard link `dir/dir/dir' to directory `'
|
||||
# Now it gives this:
|
||||
# cp: can't copy a directory `dir' into itself `dir/dir'
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/../envvar-check
|
||||
. $srcdir/../lang-default
|
||||
|
||||
pwd=`pwd`
|
||||
tmp=into-self.$$
|
||||
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
|
||||
mkdir dir || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework' 1>&2
|
||||
(exit 1); exit
|
||||
fi
|
||||
|
||||
fail=0
|
||||
|
||||
# This command should exit nonzero.
|
||||
cp -R dir dir 2> out && fail=1
|
||||
|
||||
cat > exp <<\EOF
|
||||
cp: cannot copy a directory, `dir', into itself, `dir/dir'
|
||||
EOF
|
||||
#'
|
||||
|
||||
cmp out exp || fail=1
|
||||
test $fail = 1 && diff out exp 2> /dev/null
|
||||
|
||||
(exit $fail); exit
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
19
tests/group-names
Normal file
19
tests/group-names
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- sh -*-
|
||||
# Set `groups' to a space-separated list of at least two groups of which
|
||||
# the user is a member.
|
||||
|
||||
groups=${FETISH_GROUPS-`(id -nG || /usr/xpg4/bin/id -nG) 2>/dev/null`}
|
||||
case "$groups" in
|
||||
*' '*) ;;
|
||||
*) cat <<EOF 1>&2
|
||||
$0: this test requires that you be a member of more than one group,
|
||||
but running \`id -nG' either failed or found just one. If you really
|
||||
are a member of at least two group, then rerun this test with FETISH_GROUPS
|
||||
set in your environment to the space-separated list of names. E.g.,
|
||||
|
||||
env FETISH_GROUPS='users cdrom' make check
|
||||
|
||||
EOF
|
||||
(exit 77); exit
|
||||
;;
|
||||
esac
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4b from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user