mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
193 Commits
FILEUTILS-
...
FILEUTILS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b15af47b49 | ||
|
|
9199178402 | ||
|
|
f82c03de2d | ||
|
|
1a162983f4 | ||
|
|
63ceb4f304 | ||
|
|
12838cec9b | ||
|
|
b5bfb1d399 | ||
|
|
9497429d9b | ||
|
|
b80e127286 | ||
|
|
e53076d42c | ||
|
|
01fe7e76f4 | ||
|
|
bcf9971e84 | ||
|
|
e107deb940 | ||
|
|
7bf1f374e0 | ||
|
|
ede498bfb0 | ||
|
|
2b00f4f4b6 | ||
|
|
e93093d5e1 | ||
|
|
f2606a6ba0 | ||
|
|
58a77bf4f6 | ||
|
|
344f43313d | ||
|
|
e68c81a48f | ||
|
|
0e49de1acb | ||
|
|
a3e473c522 | ||
|
|
6408b52640 | ||
|
|
e28821d5f8 | ||
|
|
621691b296 | ||
|
|
72c9472cc0 | ||
|
|
7dfd5ca1cd | ||
|
|
c5195207db | ||
|
|
8a644a90ef | ||
|
|
29ab746b79 | ||
|
|
7cf7f3706f | ||
|
|
297e2cb744 | ||
|
|
9507d3559a | ||
|
|
876d24a3ed | ||
|
|
1384f07f77 | ||
|
|
8ff77278a2 | ||
|
|
8c97b5c46e | ||
|
|
4ff6b43025 | ||
|
|
af36c75750 | ||
|
|
fd65b86607 | ||
|
|
bc0c0e635c | ||
|
|
0e65b3e861 | ||
|
|
458aad90ab | ||
|
|
74235b07fa | ||
|
|
a17cdb1173 | ||
|
|
b2747b91a8 | ||
|
|
0963c4ba11 | ||
|
|
b4640ed990 | ||
|
|
1698d53f72 | ||
|
|
5ae5d486a9 | ||
|
|
ef234641de | ||
|
|
52dedbfebb | ||
|
|
f5e9896c18 | ||
|
|
572632b8eb | ||
|
|
a467be8ae8 | ||
|
|
5551e54672 | ||
|
|
b7e610bfdb | ||
|
|
7e6c89fc63 | ||
|
|
7273e22923 | ||
|
|
6f5e749ea6 | ||
|
|
376d67374f | ||
|
|
7d60769bea | ||
|
|
604b3b397d | ||
|
|
a68f3dee80 | ||
|
|
dd3bad9b7c | ||
|
|
6207f6f804 | ||
|
|
16c8a66a54 | ||
|
|
9069b306dc | ||
|
|
76223aedef | ||
|
|
2ec7385fb0 | ||
|
|
46dd5092ee | ||
|
|
e5f51be9f1 | ||
|
|
1e422ea7ec | ||
|
|
9d7c18290e | ||
|
|
90dbea92c4 | ||
|
|
d9878753d1 | ||
|
|
4dbf57ed78 | ||
|
|
438a33770b | ||
|
|
f7cd44c64c | ||
|
|
32df3704e4 | ||
|
|
955d2c6ae5 | ||
|
|
75d5ed8b58 | ||
|
|
b9c6c84a8c | ||
|
|
3c6a1e9f08 | ||
|
|
bb6a835cc1 | ||
|
|
78f7236408 | ||
|
|
976ca67266 | ||
|
|
aba712c3bc | ||
|
|
3ec7a99af6 | ||
|
|
d60ac7e850 | ||
|
|
4c15e09a2c | ||
|
|
a1d63c6f15 | ||
|
|
e781ee9e60 | ||
|
|
9764f6e3e1 | ||
|
|
e77961586a | ||
|
|
11135e1307 | ||
|
|
d8a0eef528 | ||
|
|
b7657496c3 | ||
|
|
01c7f17f33 | ||
|
|
a211252152 | ||
|
|
24c0a0a99d | ||
|
|
df521a1b29 | ||
|
|
686a7e9ff3 | ||
|
|
1d738b51d1 | ||
|
|
84c2d0e52e | ||
|
|
6c0c08eb29 | ||
|
|
7de9edecfc | ||
|
|
9e3f43b368 | ||
|
|
d7b702d0d0 | ||
|
|
ed5b1cad23 | ||
|
|
532074e1c7 | ||
|
|
deef42170f | ||
|
|
b808de586b | ||
|
|
ac7f057d98 | ||
|
|
2daa912c53 | ||
|
|
7bf8c634eb | ||
|
|
c091e6fe83 | ||
|
|
dc61111cc6 | ||
|
|
920680fe4f | ||
|
|
c9f0e3d343 | ||
|
|
b4c9bd2b7e | ||
|
|
453be366da | ||
|
|
f51e80f564 | ||
|
|
993a56e8e0 | ||
|
|
d8e4dccdca | ||
|
|
427e67b196 | ||
|
|
90ffddc87e | ||
|
|
8458f55338 | ||
|
|
bf5ef10371 | ||
|
|
d087967041 | ||
|
|
cfb54dec88 | ||
|
|
e1958a7253 | ||
|
|
cf50a06294 | ||
|
|
c96d9a880f | ||
|
|
25bf05e45e | ||
|
|
99b35637c4 | ||
|
|
09b8756e33 | ||
|
|
9c5d11d5c5 | ||
|
|
bf6c2a07af | ||
|
|
c729fe037e | ||
|
|
02cde32c0a | ||
|
|
7741f87086 | ||
|
|
9e630b86cb | ||
|
|
2e19f14a91 | ||
|
|
65b1a6ec82 | ||
|
|
06d1a87e3b | ||
|
|
f417e8b9d4 | ||
|
|
4fb556ee0e | ||
|
|
c850393032 | ||
|
|
61ece919c6 | ||
|
|
843b44b3f7 | ||
|
|
5edb65b5c4 | ||
|
|
a71cb7cad1 | ||
|
|
e2d1b297e7 | ||
|
|
70bea7fd3e | ||
|
|
ec936db8d7 | ||
|
|
2b69ce2d89 | ||
|
|
0a25bc498d | ||
|
|
6cc7e13732 | ||
|
|
0e1c643956 | ||
|
|
2e29b32116 | ||
|
|
082787996c | ||
|
|
edef42bf40 | ||
|
|
efce5c3bdf | ||
|
|
18ac22d2fc | ||
|
|
c20eae80c7 | ||
|
|
6f43239736 | ||
|
|
c6b7de061f | ||
|
|
10d64e02c4 | ||
|
|
852a30165b | ||
|
|
e4d0cf679c | ||
|
|
57c0968203 | ||
|
|
761ed79f4d | ||
|
|
f49ea966c3 | ||
|
|
8c6d49c84d | ||
|
|
061a10d1ff | ||
|
|
787dfe9c83 | ||
|
|
9e3949fa6f | ||
|
|
62b64a0e92 | ||
|
|
37c289ea31 | ||
|
|
297a13a5a3 | ||
|
|
2aae4df6ef | ||
|
|
8670ecb6cb | ||
|
|
1b1bcc5e29 | ||
|
|
03d1ff2dea | ||
|
|
1381664a56 | ||
|
|
3ed45d5062 | ||
|
|
dfd3465715 | ||
|
|
86488adef8 | ||
|
|
3564013e18 | ||
|
|
a019f34623 | ||
|
|
0e2247a55b |
@@ -18,7 +18,7 @@ cvs-dist: maintainer-check
|
||||
ver=`echo "$(VERSION)" | sed 's/\./_/g'`; \
|
||||
tag="$$pkg-$$ver"; \
|
||||
echo tag=$$tag; \
|
||||
if cvs -n log -h README| grep -e $$tag > /dev/null; then \
|
||||
if cvs -n log -h README| grep -e $$tag: > /dev/null; then \
|
||||
echo "VERSION not new; not tagging" 1>&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
@@ -33,7 +33,7 @@ my-distcheck: dist
|
||||
GZIP=$(GZIP) $(TAR) -C $(t) -zxf $(distdir).tar.gz
|
||||
cd $(t)/$(distdir) \
|
||||
&& ./configure --disable-nls \
|
||||
&& $(MAKE) \
|
||||
&& $(MAKE) CFLAGS='-Wformat -Werror' \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(MAKE) check \
|
||||
&& $(MAKE) distclean
|
||||
@@ -50,7 +50,8 @@ THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||
PREV_VERSION := $(shell echo $(VERSION)|tr a-z Xa-y)
|
||||
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
|
||||
v = Version
|
||||
url = ftp://alpha.gnu.org/gnu/fetish/$(distdir).tar.gz
|
||||
url-host-prefix = ftp://alpha.gnu.org
|
||||
url = $(url-host-prefix)/gnu/fetish/$(distdir).tar.gz
|
||||
md5 = $(shell md5sum < $(distdir).tar.gz|sed 's/ -//')
|
||||
|
||||
rel-check:
|
||||
@@ -87,7 +88,7 @@ alpha:
|
||||
ln $(distdir).tar.gz ../release
|
||||
chmod a-w $(distdir).tar.gz
|
||||
@echo =====================================
|
||||
@echo 'ncftp -u $(dir $(url))'
|
||||
@echo 'ncftp -u $(url-host-prefix)/fs/share/ftp/gnu/fetish/'
|
||||
@echo '# put $(distdir).tar.gz'
|
||||
@echo '# send the /tmp/announcement e-mail'
|
||||
@echo 'pot-mail $(distdir).tar.gz | bash'
|
||||
|
||||
8
THANKS
8
THANKS
@@ -2,7 +2,9 @@ This is just a start at listing e-mail addresses of contributors.
|
||||
The rest of the addresses are still in the ChangeLog.
|
||||
|
||||
Achim Blumensath: blume@corona.oche.de
|
||||
aldomel: aldomel@ix.netcom.com
|
||||
Akim Demaille: demaille@inf.enst.fr
|
||||
Andreas Jaeger: jaeger@gnu.org
|
||||
Andreas Schwab: schwab@issan.informatik.uni-dortmund.de
|
||||
Andries Brouwer: Andries.Brouwer@cwi.nl
|
||||
Arne Henrik Juul: arnej@imf.unit.no
|
||||
@@ -10,6 +12,7 @@ Bauke Jan Douma: bjdouma@xs4all.nl
|
||||
Bengt Martensson: bengt@mathematik.uni-Bremen.de
|
||||
Bernd Leibing: bernd.leibing@rz.uni-ulm.de
|
||||
Bjorn Helgaas: helgaas@rsn.hp.com
|
||||
Bob McCracken: kerouac@ravenet.com
|
||||
Brendan O'Dea: bod@compusol.com.au
|
||||
Charles Karney: karney@pppl.gov
|
||||
Christian von Roques: roques@pond.sub.org
|
||||
@@ -28,8 +31,11 @@ James Antill: jmanti%essex.ac.uk@seralph21.essex.ac.uk
|
||||
James Tanis: jtt@soscorp.com
|
||||
Jesse Thilo: jgt2@eecs.lehigh.edu
|
||||
Joakim Rosqvist: dvljrt@cs.umu.se
|
||||
Johan Danielsson: joda@pdc.kth.se
|
||||
John Gatewood Ham: zappaman@alphabox.compsci.buu.ac.th
|
||||
Karl Heuer: kwzh@gnu.org
|
||||
Kjetil Torgrim Homme: kjetilho@ifi.uio.no
|
||||
Lars Hecking: lhecking@nmrc.ucc.ie
|
||||
Lorne Baker: lbaker@nitro.avint.net
|
||||
Marcus Daniels: marcus@sysc.pdx.edu
|
||||
Mark A. Thomas: thommark@access.digex.net
|
||||
@@ -38,9 +44,11 @@ Mark Kettenis: kettenis@phys.uva.nl
|
||||
Marty Leisner: leisner@sdsp.mc.xerox.com
|
||||
Masami Takikawa: takikawm@CS.ORST.EDU
|
||||
Matthew S. Levine: mslevine@theory.lcs.mit.edu
|
||||
Michiel Bacchiani: bacchian@raven.bu.edu
|
||||
Miles Bader: miles@gnu.ai.mit.edu
|
||||
Noel Cragg: noel@red-bean.com
|
||||
Olav Morkrid: olav@funcom.com
|
||||
Per Kristian Hove: perhov@math.ntnu.no
|
||||
Peter Eriksson: peter@ifm.liu.se
|
||||
Paul Eggert: eggert@twinsun.com
|
||||
Philippe De Muyter: phdm@macqel.be
|
||||
|
||||
@@ -3,8 +3,12 @@ info_TEXINFOS = fileutils.texi
|
||||
|
||||
EXTRA_DIST = perm.texi getdate.texi
|
||||
|
||||
# Tell makeinfo to put everything in a single info file: sh-utils.info.
|
||||
# Otherwise, it would also generate files with names like sh-utils.info-[123],
|
||||
# and those names all map to one 14-byte name (sh-utils.info-) on some crufty
|
||||
# The following is necessary if the package name is 8 characters or longer.
|
||||
# If the info documentation would be split into 10 or more separate files,
|
||||
# then this is necessary even if the package name is 7 characters long.
|
||||
#
|
||||
# Tell makeinfo to put everything in a single info file: <package>.info.
|
||||
# Otherwise, it would also generate files with names like <package>.info-[123],
|
||||
# and those names all map to one 14-byte name (<package>.info-) on some crufty
|
||||
# old systems.
|
||||
MAKEINFO = makeinfo --no-split
|
||||
|
||||
@@ -93,9 +93,13 @@ info_TEXINFOS = fileutils.texi
|
||||
|
||||
EXTRA_DIST = perm.texi getdate.texi
|
||||
|
||||
# Tell makeinfo to put everything in a single info file: sh-utils.info.
|
||||
# Otherwise, it would also generate files with names like sh-utils.info-[123],
|
||||
# and those names all map to one 14-byte name (sh-utils.info-) on some crufty
|
||||
# The following is necessary if the package name is 8 characters or longer.
|
||||
# If the info documentation would be split into 10 or more separate files,
|
||||
# then this is necessary even if the package name is 7 characters long.
|
||||
#
|
||||
# Tell makeinfo to put everything in a single info file: <package>.info.
|
||||
# Otherwise, it would also generate files with names like <package>.info-[123],
|
||||
# and those names all map to one 14-byte name (<package>.info-) on some crufty
|
||||
# old systems.
|
||||
MAKEINFO = makeinfo --no-split
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
@@ -245,10 +249,11 @@ dist-info: $(INFO_DEPS)
|
||||
|
||||
mostlyclean-aminfo:
|
||||
-rm -f fileutils.aux fileutils.cp fileutils.cps fileutils.dvi \
|
||||
fileutils.fn fileutils.fns fileutils.ky fileutils.kys \
|
||||
fileutils.ps fileutils.log fileutils.pg fileutils.toc \
|
||||
fileutils.tp fileutils.tps fileutils.vr fileutils.vrs \
|
||||
fileutils.op fileutils.tr fileutils.cv fileutils.cn
|
||||
fileutils.fl fileutils.fn fileutils.fns fileutils.ky \
|
||||
fileutils.kys fileutils.ps fileutils.log fileutils.pg \
|
||||
fileutils.toc fileutils.tp fileutils.tps fileutils.vr \
|
||||
fileutils.vrs fileutils.op fileutils.tr fileutils.cv \
|
||||
fileutils.cn
|
||||
|
||||
clean-aminfo:
|
||||
|
||||
|
||||
131
doc/texinfo.tex
131
doc/texinfo.tex
@@ -1,5 +1,9 @@
|
||||
% texinfo.tex -- TeX macros to handle Texinfo files.
|
||||
\def\texinfoversion{1998-09-30}%
|
||||
%
|
||||
% Load plain if necessary, i.e., if running under initex.
|
||||
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
|
||||
%
|
||||
\def\texinfoversion{1998-12-19}%
|
||||
%
|
||||
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98
|
||||
% Free Software Foundation, Inc.
|
||||
@@ -50,12 +54,6 @@
|
||||
% Sometimes one run after texindex suffices, and sometimes you need more
|
||||
% than two; texi2dvi does it as many times as necessary.
|
||||
|
||||
|
||||
% Make it possible to create a .fmt file just by loading this file:
|
||||
% if the underlying format is not loaded, start by loading it now.
|
||||
% Added by gildea November 1993.
|
||||
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
|
||||
|
||||
\message{Loading texinfo [version \texinfoversion]:}
|
||||
|
||||
% If in a .fmt file, print the version number
|
||||
@@ -189,13 +187,16 @@
|
||||
\shipout\vbox{%
|
||||
\ifcropmarks \vbox to \outervsize\bgroup
|
||||
\hsize = \outerhsize
|
||||
\line{\ewtop\hfil\ewtop}%
|
||||
\nointerlineskip
|
||||
\line{%
|
||||
\vbox{\moveleft\cornerthick\nstop}%
|
||||
\hfill
|
||||
\vbox{\moveright\cornerthick\nstop}%
|
||||
}%
|
||||
\vskip-\topandbottommargin
|
||||
\vtop to0pt{%
|
||||
\line{\ewtop\hfil\ewtop}%
|
||||
\nointerlineskip
|
||||
\line{%
|
||||
\vbox{\moveleft\cornerthick\nstop}%
|
||||
\hfill
|
||||
\vbox{\moveright\cornerthick\nstop}%
|
||||
}%
|
||||
\vss}%
|
||||
\vskip\topandbottommargin
|
||||
\line\bgroup
|
||||
\hfil % center the page within the outer (page) hsize.
|
||||
@@ -218,13 +219,15 @@
|
||||
\hfil\egroup % end of (centering) \line\bgroup
|
||||
\vskip\topandbottommargin plus1fill minus1fill
|
||||
\boxmaxdepth = \cornerthick
|
||||
\line{%
|
||||
\vbox{\moveleft\cornerthick\nsbot}%
|
||||
\hfill
|
||||
\vbox{\moveright\cornerthick\nsbot}%
|
||||
\vbox to0pt{\vss
|
||||
\line{%
|
||||
\vbox{\moveleft\cornerthick\nsbot}%
|
||||
\hfill
|
||||
\vbox{\moveright\cornerthick\nsbot}%
|
||||
}%
|
||||
\nointerlineskip
|
||||
\line{\ewbot\hfil\ewbot}%
|
||||
}%
|
||||
\nointerlineskip
|
||||
\line{\ewbot\hfil\ewbot}%
|
||||
\egroup % \vbox from first cropmarks clause
|
||||
\fi
|
||||
}% end of \shipout\vbox
|
||||
@@ -846,7 +849,7 @@ where each line of input produces a line of output.}
|
||||
\immediate\write16{If you are running another version of TeX, relax.}
|
||||
\immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
|
||||
\immediate\write16{ Then upgrade your TeX installation if you can.}
|
||||
\immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
|
||||
\immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
|
||||
\immediate\write16{If you are stuck with version 3.0, run the}
|
||||
\immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
|
||||
\immediate\write16{ to use a workaround.}
|
||||
@@ -980,7 +983,7 @@ where each line of input produces a line of output.}
|
||||
%
|
||||
\def\expandablevalue#1{%
|
||||
\expandafter\ifx\csname SET#1\endcsname\relax
|
||||
{[No value for ``#1'']v}%
|
||||
{[No value for ``#1'']}%
|
||||
\else
|
||||
\csname SET#1\endcsname
|
||||
\fi
|
||||
@@ -1536,7 +1539,7 @@ where each line of input produces a line of output.}
|
||||
\newif\iffinishedtitlepage
|
||||
|
||||
% Do an implicit @contents or @shortcontents after @end titlepage if the
|
||||
% user says @contentsaftertitlepage or @shortcontentsaftertitlepage.
|
||||
% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
|
||||
%
|
||||
\newif\ifsetcontentsaftertitlepage
|
||||
\let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
|
||||
@@ -2142,31 +2145,44 @@ July\or August\or September\or October\or November\or December\fi
|
||||
\def\xcolumnfractions{\columnfractions}
|
||||
\newif\ifsetpercent
|
||||
|
||||
% 2/1/96, to allow fractions to be given with more than one digit.
|
||||
\def\pickupwholefraction#1 {\global\advance\colcount by1 %
|
||||
\expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
|
||||
\setuptable}
|
||||
% #1 is the part of the @columnfraction before the decimal point, which
|
||||
% is presumably either 0 or the empty string (but we don't check, we
|
||||
% just throw it away). #2 is the decimal part, which we use as the
|
||||
% percent of \hsize for this column.
|
||||
\def\pickupwholefraction#1.#2 {%
|
||||
\global\advance\colcount by 1
|
||||
\expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
|
||||
\setuptable
|
||||
}
|
||||
|
||||
\newcount\colcount
|
||||
\def\setuptable#1{\def\firstarg{#1}%
|
||||
\ifx\firstarg\xendsetuptable\let\go\relax%
|
||||
\else
|
||||
\ifx\firstarg\xcolumnfractions\global\setpercenttrue%
|
||||
\def\setuptable#1{%
|
||||
\def\firstarg{#1}%
|
||||
\ifx\firstarg\xendsetuptable
|
||||
\let\go = \relax
|
||||
\else
|
||||
\ifsetpercent
|
||||
\let\go\pickupwholefraction % In this case arg of setuptable
|
||||
% is the decimal point before the
|
||||
% number given in percent of hsize.
|
||||
% We don't need this so we don't use it.
|
||||
\ifx\firstarg\xcolumnfractions
|
||||
\global\setpercenttrue
|
||||
\else
|
||||
\global\advance\colcount by1
|
||||
\setbox0=\hbox{#1 }% Add a normal word space as a separator;
|
||||
% typically that is always in the input, anyway.
|
||||
\expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
|
||||
\ifsetpercent
|
||||
\let\go\pickupwholefraction
|
||||
\else
|
||||
\global\advance\colcount by 1
|
||||
\setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
|
||||
% typically that is always in the input, anyway.
|
||||
\expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
|
||||
\fi
|
||||
\fi
|
||||
\ifx\go\pickupwholefraction
|
||||
% Put the argument back for the \pickupwholefraction call, so
|
||||
% we'll always have a period there to be parsed.
|
||||
\def\go{\pickupwholefraction#1}%
|
||||
\else
|
||||
\let\go = \setuptable
|
||||
\fi%
|
||||
\fi%
|
||||
\ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
|
||||
\fi\go}
|
||||
\fi
|
||||
\go
|
||||
}
|
||||
|
||||
% multitable syntax
|
||||
\def\tab{&\hskip1sp\relax} % 2/2/96
|
||||
@@ -2174,7 +2190,7 @@ July\or August\or September\or October\or November\or December\fi
|
||||
% maintained, even if it is never used.
|
||||
|
||||
% @multitable ... @end multitable definitions:
|
||||
|
||||
%
|
||||
\def\multitable{\parsearg\dotable}
|
||||
\def\dotable#1{\bgroup
|
||||
\vskip\parskip
|
||||
@@ -2385,8 +2401,9 @@ width0pt\relax} \fi
|
||||
% (Must be a way to avoid doing expansion at all, and thus not have to
|
||||
% laboriously list every single command here.)
|
||||
\def\@{@}% will be @@ when we switch to @ as escape char.
|
||||
%\let\{ = \lbracecmd
|
||||
%\let\} = \rbracecmd
|
||||
% need these in case \tex is in effect and \{ is a \delimiter again.
|
||||
\let\{ = \lbracecmd
|
||||
\let\} = \rbracecmd
|
||||
\def\_{{\realbackslash _}}%
|
||||
\def\w{\realbackslash w }%
|
||||
\def\bf{\realbackslash bf }%
|
||||
@@ -2408,6 +2425,11 @@ width0pt\relax} \fi
|
||||
\def\copyright{\realbackslash copyright}%
|
||||
\def\tclose##1{\realbackslash tclose {##1}}%
|
||||
\def\code##1{\realbackslash code {##1}}%
|
||||
\def\uref##1{\realbackslash uref {##1}}%
|
||||
\def\url##1{\realbackslash url {##1}}%
|
||||
\def\env##1{\realbackslash env {##1}}%
|
||||
\def\command##1{\realbackslash command {##1}}%
|
||||
\def\option##1{\realbackslash option {##1}}%
|
||||
\def\dotless##1{\realbackslash dotless {##1}}%
|
||||
\def\samp##1{\realbackslash samp {##1}}%
|
||||
\def\,##1{\realbackslash ,{##1}}%
|
||||
@@ -2423,6 +2445,7 @@ width0pt\relax} \fi
|
||||
\def\kbd##1{\realbackslash kbd {##1}}%
|
||||
\def\dfn##1{\realbackslash dfn {##1}}%
|
||||
\def\emph##1{\realbackslash emph {##1}}%
|
||||
\def\acronym##1{\realbackslash acronym {##1}}%
|
||||
%
|
||||
% Handle some cases of @value -- where the variable name does not
|
||||
% contain - or _, and the value does not contain any
|
||||
@@ -2486,6 +2509,11 @@ width0pt\relax} \fi
|
||||
%\let\tt=\indexdummyfont
|
||||
\let\tclose=\indexdummyfont
|
||||
\let\code=\indexdummyfont
|
||||
\let\url=\indexdummyfont
|
||||
\let\uref=\indexdummyfont
|
||||
\let\env=\indexdummyfont
|
||||
\let\command=\indexdummyfont
|
||||
\let\option=\indexdummyfont
|
||||
\let\file=\indexdummyfont
|
||||
\let\samp=\indexdummyfont
|
||||
\let\kbd=\indexdummyfont
|
||||
@@ -5205,7 +5233,7 @@ width0pt\relax} \fi
|
||||
\vsize = #1\relax
|
||||
\advance\vsize by \topskip
|
||||
\outervsize = \vsize
|
||||
\advance\outervsize by 0.6in
|
||||
\advance\outervsize by 2\topandbottommargin
|
||||
\pageheight = \vsize
|
||||
%
|
||||
\hsize = #2\relax
|
||||
@@ -5445,10 +5473,9 @@ width0pt\relax} \fi
|
||||
@rm
|
||||
|
||||
@c Local variables:
|
||||
@c eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
@c page-delimiter: "^\\\\message"
|
||||
@c update-date-leading-regexp: "def\\texinfoversion{"
|
||||
@c update-date-date-regexp: "[-0-9.]+"
|
||||
@c update-date-format-string: "%Y-%m-%d"
|
||||
@c update-date-trailing-regexp: "}"
|
||||
@c eval: (and(load "update-date" t t)(add-hook 'write-file-hooks 'update-date))
|
||||
@c time-stamp-start: "def\\\\texinfoversion{"
|
||||
@c time-stamp-format: "%:y-%02m-%02d"
|
||||
@c time-stamp-end: "}"
|
||||
@c End:
|
||||
|
||||
@@ -2327,7 +2327,7 @@ all GNU extensions and revert to traditional mode, thus introducing some
|
||||
limitations, and changes several of the program's default option values.
|
||||
When @samp{-G} is not specified, GNU extensions are always enabled. GNU
|
||||
extensions to @code{ptx} are documented wherever appropriate in this
|
||||
document. See @xref{Compatibility in ptx} for an explicit list of them.
|
||||
document. For the full list, see @xref{Compatibility in ptx}.
|
||||
|
||||
Individual options are explained in incoming sections.
|
||||
|
||||
@@ -2471,9 +2471,9 @@ only if it is given in the Only file and not given in the Ignore file.
|
||||
|
||||
On each input line, the leading sequence of non white characters will be
|
||||
taken to be a reference that has the purpose of identifying this input
|
||||
line on the produced permuted index. See @xref{Output formatting in ptx} for
|
||||
more information about reference production. Using this option change
|
||||
the default value for option @code{-S}.
|
||||
line on the produced permuted index. For more information about reference
|
||||
production, see @xref{Output formatting in ptx}.
|
||||
Using this option changes the default value for option @code{-S}.
|
||||
|
||||
Using this option, the program does not try very hard to remove
|
||||
references from contexts in output, but it succeeds in doing so
|
||||
|
||||
@@ -6,3 +6,5 @@ safe-lstat.c
|
||||
safe-lstat.h
|
||||
getdate.tab.c
|
||||
.deps
|
||||
stat.c
|
||||
lstat.c
|
||||
|
||||
@@ -18,10 +18,19 @@ libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
|
||||
|
||||
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
|
||||
error.h exclude.h filemode.h fnmatch.h fsusage.h \
|
||||
dirname.h error.h exclude.h filemode.h fnmatch.h fsusage.h \
|
||||
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
|
||||
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
|
||||
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
|
||||
xalloc.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c
|
||||
BUILT_SOURCES = getdate.c lstat.c stat.c
|
||||
|
||||
EXTRA_DIST = xstat.in
|
||||
lstat.c: xstat.in
|
||||
sed -e '/@IGNORE@/d' -e 's/@xstat@/lstat/g' $(srcdir)/xstat.in > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
stat.c: xstat.in
|
||||
sed -e '/@IGNORE@/d' -e 's/@xstat@/stat/g' $(srcdir)/xstat.in > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
@@ -108,13 +108,15 @@ libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
|
||||
|
||||
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
|
||||
error.h exclude.h filemode.h fnmatch.h fsusage.h \
|
||||
dirname.h error.h exclude.h filemode.h fnmatch.h fsusage.h \
|
||||
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
|
||||
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
|
||||
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
|
||||
xalloc.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c
|
||||
BUILT_SOURCES = getdate.c lstat.c stat.c
|
||||
|
||||
EXTRA_DIST = xstat.in
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@@ -159,17 +161,18 @@ DEP_FILES = .deps/addext.P .deps/alloca.P .deps/argmatch.P \
|
||||
.deps/ftruncate.P .deps/full-write.P .deps/getdate .deps/getdate.P \
|
||||
.deps/getgroups.P .deps/getline.P .deps/getopt.P .deps/getopt1.P \
|
||||
.deps/group-member.P .deps/hash.P .deps/human.P .deps/idcache.P \
|
||||
.deps/isdir.P .deps/lchown.P .deps/long-options.P .deps/lstat.P \
|
||||
.deps/makepath.P .deps/malloc.P .deps/memcmp.P .deps/memcpy.P \
|
||||
.deps/memset.P .deps/mkdir.P .deps/mktime.P .deps/modechange.P \
|
||||
.deps/mountlist.P .deps/obstack.P .deps/path-concat.P .deps/posixtm.P \
|
||||
.deps/quotearg.P .deps/realloc.P .deps/regex.P .deps/rename.P \
|
||||
.deps/rmdir.P .deps/rpmatch.P .deps/safe-read.P .deps/save-cwd.P \
|
||||
.deps/savedir.P .deps/stat.P .deps/stpcpy.P .deps/strcasecmp.P \
|
||||
.deps/strdup.P .deps/strftime.P .deps/stripslash.P .deps/strndup.P \
|
||||
.deps/strstr.P .deps/strtol.P .deps/strtoul.P .deps/strverscmp.P \
|
||||
.deps/userspec.P .deps/utime.P .deps/xgetcwd.P .deps/xmalloc.P \
|
||||
.deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
|
||||
.deps/isdir.P .deps/lchown.P .deps/long-options.P .deps/lstat \
|
||||
.deps/lstat.P .deps/makepath.P .deps/malloc.P .deps/memcmp.P \
|
||||
.deps/memcpy.P .deps/memset.P .deps/mkdir.P .deps/mktime.P \
|
||||
.deps/modechange.P .deps/mountlist.P .deps/obstack.P \
|
||||
.deps/path-concat.P .deps/posixtm.P .deps/quotearg.P .deps/realloc.P \
|
||||
.deps/regex.P .deps/rename.P .deps/rmdir.P .deps/rpmatch.P \
|
||||
.deps/safe-read.P .deps/save-cwd.P .deps/savedir.P .deps/stat \
|
||||
.deps/stat.P .deps/stpcpy.P .deps/strcasecmp.P .deps/strdup.P \
|
||||
.deps/strftime.P .deps/stripslash.P .deps/strndup.P .deps/strstr.P \
|
||||
.deps/strtol.P .deps/strtoul.P .deps/strverscmp.P .deps/userspec.P \
|
||||
.deps/utime.P .deps/xgetcwd.P .deps/xmalloc.P .deps/xstrdup.P \
|
||||
.deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
|
||||
SOURCES = $(libfu_a_SOURCES)
|
||||
OBJECTS = $(libfu_a_OBJECTS)
|
||||
|
||||
@@ -513,6 +516,13 @@ install-data install uninstall all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
lstat.c: xstat.in
|
||||
sed -e '/@IGNORE@/d' -e 's/@xstat@/lstat/g' $(srcdir)/xstat.in > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
stat.c: xstat.in
|
||||
sed -e '/@IGNORE@/d' -e 's/@xstat@/stat/g' $(srcdir)/xstat.in > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -161,8 +161,7 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
|
||||
implementations of C, for example under Gould's UTX/32. */
|
||||
|
||||
pointer
|
||||
alloca (size)
|
||||
unsigned size;
|
||||
alloca (unsigned size)
|
||||
{
|
||||
auto char probe; /* Probes stack depth: */
|
||||
register char *depth = ADDRESS_FUNCTION (probe);
|
||||
|
||||
@@ -34,10 +34,7 @@
|
||||
/* FIXME: describe. */
|
||||
|
||||
int
|
||||
rpl_chown (file, uid, gid)
|
||||
const char *file;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
rpl_chown (const char *file, uid_t uid, gid_t gid)
|
||||
{
|
||||
if (gid == (gid_t) -1 || uid == (uid_t) -1)
|
||||
{
|
||||
|
||||
@@ -33,14 +33,15 @@ char *malloc ();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "dirname.h"
|
||||
|
||||
/* Return the leading directories part of PATH,
|
||||
allocated with malloc. If out of memory, return 0.
|
||||
Assumes that trailing slashes have already been
|
||||
removed. */
|
||||
|
||||
char *
|
||||
dirname (path)
|
||||
char *path;
|
||||
dir_name (const char *path)
|
||||
{
|
||||
char *newpath;
|
||||
char *slash;
|
||||
|
||||
31
lib/dirname.h
Normal file
31
lib/dirname.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/* Copyright (C) 1998 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. */
|
||||
|
||||
#ifndef DIRNAME_H_
|
||||
# define DIRNAME_H_ 1
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
|
||||
char *
|
||||
dir_name PARAMS ((const char *path));
|
||||
|
||||
#endif /* not DIRNAME_H_ */
|
||||
@@ -152,7 +152,10 @@ error (status, errnum, message, va_alist)
|
||||
{
|
||||
#if defined HAVE_STRERROR_R || defined _LIBC
|
||||
char errbuf[1024];
|
||||
fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
|
||||
/* Don't use __strerror_r's return value because on some systems
|
||||
(at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */
|
||||
__strerror_r (errnum, errbuf, sizeof errbuf);
|
||||
fprintf (stderr, ": %s", errbuf);
|
||||
#else
|
||||
fprintf (stderr, ": %s", strerror (errnum));
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* euidaccess -- check if effective user id can access file
|
||||
Copyright (C) 1990, 1991, 1995 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1991, 1995, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@@ -127,9 +127,7 @@ int group_member ();
|
||||
filesystem, text busy, etc. */
|
||||
|
||||
int
|
||||
euidaccess (path, mode)
|
||||
const char *path;
|
||||
int mode;
|
||||
euidaccess (const char *path, int mode)
|
||||
{
|
||||
struct stat stats;
|
||||
int granted;
|
||||
|
||||
@@ -50,8 +50,7 @@ typedef long daddr_t; /* for disk address */
|
||||
/* Return the number of 512-byte blocks in a file of SIZE bytes. */
|
||||
|
||||
off_t
|
||||
st_blocks (size)
|
||||
off_t size;
|
||||
st_blocks (off_t size)
|
||||
{
|
||||
off_t datablks = size / 512 + (size % 512 != 0);
|
||||
off_t indrblks = 0;
|
||||
|
||||
@@ -55,10 +55,7 @@ extern int errno;
|
||||
/* Match STRING against the filename pattern PATTERN, returning zero if
|
||||
it matches, nonzero if not. */
|
||||
int
|
||||
fnmatch (pattern, string, flags)
|
||||
const char *pattern;
|
||||
const char *string;
|
||||
int flags;
|
||||
fnmatch (const char *pattern, const char *string, int flags)
|
||||
{
|
||||
register const char *p = pattern, *n = string;
|
||||
register char c;
|
||||
|
||||
@@ -101,10 +101,7 @@ int safe_read ();
|
||||
ERRNO is either a system error value, or zero if DISK is NULL
|
||||
on a system that requires a non-NULL value. */
|
||||
int
|
||||
get_fs_usage (path, disk, fsp)
|
||||
const char *path;
|
||||
const char *disk;
|
||||
struct fs_usage *fsp;
|
||||
get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp)
|
||||
{
|
||||
#ifdef STAT_STATFS3_OSF1
|
||||
|
||||
@@ -262,9 +259,7 @@ get_fs_usage (path, disk, fsp)
|
||||
/* AIX PS/2 does not supply statfs. */
|
||||
|
||||
int
|
||||
statfs (path, fsb)
|
||||
char *path;
|
||||
struct statfs *fsb;
|
||||
statfs (char *path, struct statfs *fsb)
|
||||
{
|
||||
struct stat stats;
|
||||
struct dustat fsd;
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
#ifdef F_CHSIZE
|
||||
|
||||
int
|
||||
ftruncate (fd, length)
|
||||
int fd;
|
||||
off_t length;
|
||||
ftruncate (int fd, off_t length)
|
||||
{
|
||||
return fcntl (fd, F_CHSIZE, length);
|
||||
}
|
||||
@@ -30,9 +28,7 @@ ftruncate (fd, length)
|
||||
# endif
|
||||
|
||||
int
|
||||
ftruncate (fd, length)
|
||||
int fd;
|
||||
off_t length;
|
||||
ftruncate (int fd, off_t length)
|
||||
{
|
||||
struct flock fl;
|
||||
struct stat filebuf;
|
||||
@@ -75,9 +71,7 @@ ftruncate (fd, length)
|
||||
# if HAVE_CHSIZE
|
||||
|
||||
int
|
||||
ftruncate (fd, length)
|
||||
int fd;
|
||||
off_t length;
|
||||
ftruncate (int fd, off_t length)
|
||||
{
|
||||
return chsize (fd, length);
|
||||
}
|
||||
@@ -90,9 +84,7 @@ extern int errno;
|
||||
# endif
|
||||
|
||||
int
|
||||
ftruncate (fd, length)
|
||||
int fd;
|
||||
off_t length;
|
||||
ftruncate (int fd, off_t length)
|
||||
{
|
||||
errno = EIO;
|
||||
return -1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* getline.c -- Replacement for GNU C library function getline
|
||||
|
||||
Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1996, 1997, 1998 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
|
||||
@@ -34,10 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#if defined __GNU_LIBRARY__ && HAVE_GETDELIM
|
||||
|
||||
int
|
||||
getline (lineptr, n, stream)
|
||||
char **lineptr;
|
||||
size_t *n;
|
||||
FILE *stream;
|
||||
getline (char **lineptr, size_t *n, FILE *stream)
|
||||
{
|
||||
return getdelim (lineptr, n, '\n', stream);
|
||||
}
|
||||
@@ -64,12 +61,7 @@ char *malloc (), *realloc ();
|
||||
null terminator), or -1 on error or EOF. */
|
||||
|
||||
int
|
||||
getstr (lineptr, n, stream, terminator, offset)
|
||||
char **lineptr;
|
||||
size_t *n;
|
||||
FILE *stream;
|
||||
char terminator;
|
||||
size_t offset;
|
||||
getstr (char **lineptr, size_t *n, FILE *stream, char terminator, size_t offset)
|
||||
{
|
||||
int nchars_avail; /* Allocated but unused chars in *LINEPTR. */
|
||||
char *read_pos; /* Where we're reading into *LINEPTR. */
|
||||
@@ -138,20 +130,13 @@ getstr (lineptr, n, stream, terminator, offset)
|
||||
}
|
||||
|
||||
int
|
||||
getline (lineptr, n, stream)
|
||||
char **lineptr;
|
||||
size_t *n;
|
||||
FILE *stream;
|
||||
getline (char **lineptr, size_t *n, FILE *stream)
|
||||
{
|
||||
return getstr (lineptr, n, stream, '\n', 0);
|
||||
}
|
||||
|
||||
int
|
||||
getdelim (lineptr, n, delimiter, stream)
|
||||
char **lineptr;
|
||||
size_t *n;
|
||||
int delimiter;
|
||||
FILE *stream;
|
||||
getdelim (char **lineptr, size_t *n, int delimiter, FILE *stream)
|
||||
{
|
||||
return getstr (lineptr, n, stream, delimiter, 0);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* getversion.c -- select backup filename type
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1998 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
|
||||
@@ -46,8 +46,7 @@ static const enum backup_type backup_types[] =
|
||||
Unique abbreviations are accepted. */
|
||||
|
||||
enum backup_type
|
||||
get_version (version)
|
||||
char *version;
|
||||
get_version (const char *version)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* idcache.c -- map user and group IDs, cached for speed
|
||||
Copyright (C) 1985, 1988, 1989, 1990, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1985, 1988, 1989, 1990, 1997, 1998 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,8 +34,7 @@
|
||||
return nonzero, else 0. */
|
||||
|
||||
int
|
||||
isdir (path)
|
||||
char *path;
|
||||
isdir (const char *path)
|
||||
{
|
||||
struct stat stats;
|
||||
|
||||
|
||||
50
lib/lstat.c
50
lib/lstat.c
@@ -1,50 +0,0 @@
|
||||
/* Work around the bug in some systems whereby lstat succeeds when
|
||||
given the zero-length file name argument. The lstat from SunOS4.1.4
|
||||
has this bug.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* written by Jim Meyering */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Disable the definition of lstat to rpl_lstat (from config.h) in this
|
||||
file. Otherwise, we'd get conflicting prototypes for rpl_lstat on
|
||||
most systems. */
|
||||
#undef lstat
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
/* FIXME: describe. */
|
||||
|
||||
int
|
||||
rpl_lstat (file, sbuf)
|
||||
const char *file;
|
||||
struct stat *sbuf;
|
||||
{
|
||||
if (file && *file == 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return lstat (file, sbuf);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Work around bug on some systems where malloc (0) fails.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998 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,8 +30,7 @@ char *malloc ();
|
||||
If N is zero, allocate a 1-byte block. */
|
||||
|
||||
char *
|
||||
rpl_malloc (n)
|
||||
size_t n;
|
||||
rpl_malloc (size_t n)
|
||||
{
|
||||
if (n == 0)
|
||||
n = 1;
|
||||
|
||||
18
lib/memcmp.c
18
lib/memcmp.c
@@ -104,8 +104,7 @@ static int memcmp_bytes __P((op_t, op_t));
|
||||
__inline
|
||||
# endif
|
||||
static int
|
||||
memcmp_bytes (a, b)
|
||||
op_t a, b;
|
||||
memcmp_bytes (long unsigned int a, long unsigned int b)
|
||||
{
|
||||
long int srcp1 = (long int) &a;
|
||||
long int srcp2 = (long int) &b;
|
||||
@@ -132,10 +131,7 @@ static int memcmp_common_alignment __P((long, long, size_t));
|
||||
__inline
|
||||
#endif
|
||||
static int
|
||||
memcmp_common_alignment (srcp1, srcp2, len)
|
||||
long int srcp1;
|
||||
long int srcp2;
|
||||
size_t len;
|
||||
memcmp_common_alignment (long int srcp1, long int srcp2, size_t len)
|
||||
{
|
||||
op_t a0, a1;
|
||||
op_t b0, b1;
|
||||
@@ -222,10 +218,7 @@ static int memcmp_not_common_alignment __P((long, long, size_t));
|
||||
__inline
|
||||
#endif
|
||||
static int
|
||||
memcmp_not_common_alignment (srcp1, srcp2, len)
|
||||
long int srcp1;
|
||||
long int srcp2;
|
||||
size_t len;
|
||||
memcmp_not_common_alignment (long int srcp1, long int srcp2, size_t len)
|
||||
{
|
||||
op_t a0, a1, a2, a3;
|
||||
op_t b0, b1, b2, b3;
|
||||
@@ -325,10 +318,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len)
|
||||
}
|
||||
|
||||
int
|
||||
rpl_memcmp (s1, s2, len)
|
||||
const __ptr_t s1;
|
||||
const __ptr_t s2;
|
||||
size_t len;
|
||||
rpl_memcmp (const void *s1, const void *s2, size_t len)
|
||||
{
|
||||
op_t a0;
|
||||
op_t b0;
|
||||
|
||||
@@ -16,10 +16,7 @@
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
char *
|
||||
memset (str, c, len)
|
||||
char *str;
|
||||
int c;
|
||||
unsigned len;
|
||||
memset (char *str, int c, unsigned int len)
|
||||
{
|
||||
register char *st = str;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* BSD compatible make directory function for System V
|
||||
Copyright (C) 1988, 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988, 1990, 1998 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
|
||||
@@ -48,9 +48,7 @@ extern int errno;
|
||||
subroutine didn't return EEXIST. It does now. */
|
||||
|
||||
int
|
||||
mkdir (dpath, dmode)
|
||||
char *dpath;
|
||||
int dmode;
|
||||
mkdir (const char *dpath, int dmode)
|
||||
{
|
||||
int cpid, status;
|
||||
struct stat statbuf;
|
||||
|
||||
78
lib/mktime.c
78
lib/mktime.c
@@ -1,4 +1,4 @@
|
||||
/* mktime: convert a `struct tm' to a time_t value zzzzzz
|
||||
/* mktime: convert a `struct tm' to a time_t value
|
||||
Copyright (C) 1993-1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Paul Eggert (eggert@twinsun.com).
|
||||
|
||||
@@ -28,14 +28,8 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Some systems need this in order to declare localtime_r properly. */
|
||||
#ifndef _REENTRANT
|
||||
# define _REENTRANT 1
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# define HAVE_LIMITS_H 1
|
||||
# define HAVE_LOCALTIME_R 1
|
||||
# define STDC_HEADERS 1
|
||||
#endif
|
||||
|
||||
@@ -125,16 +119,14 @@ time_t __mktime_internal __P ((struct tm *,
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
# define localtime_r __localtime_r
|
||||
# define my_mktime_localtime_r __localtime_r
|
||||
#else
|
||||
# if ! HAVE_LOCALTIME_R && ! defined localtime_r
|
||||
/* Approximate localtime_r as best we can in its absence. */
|
||||
# define localtime_r my_mktime_localtime_r
|
||||
static struct tm *localtime_r __P ((const time_t *, struct tm *));
|
||||
/* If we're a mktime substitute in a GNU program, then prefer
|
||||
localtime to localtime_r, since many localtime_r implementations
|
||||
are buggy. */
|
||||
static struct tm *my_mktime_localtime_r __P ((const time_t *, struct tm *));
|
||||
static struct tm *
|
||||
localtime_r (t, tp)
|
||||
const time_t *t;
|
||||
struct tm *tp;
|
||||
my_mktime_localtime_r (const time_t *t, struct tm *tp)
|
||||
{
|
||||
struct tm *l = localtime (t);
|
||||
if (! l)
|
||||
@@ -142,7 +134,6 @@ localtime_r (t, tp)
|
||||
*tp = *l;
|
||||
return tp;
|
||||
}
|
||||
# endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
|
||||
#endif /* ! _LIBC */
|
||||
|
||||
|
||||
@@ -153,9 +144,8 @@ localtime_r (t, tp)
|
||||
If TP is null, return a nonzero value.
|
||||
If overflow occurs, yield the low order bits of the correct answer. */
|
||||
static time_t
|
||||
ydhms_tm_diff (year, yday, hour, min, sec, tp)
|
||||
int year, yday, hour, min, sec;
|
||||
const struct tm *tp;
|
||||
ydhms_tm_diff (int year, int yday, int hour, int min, int sec,
|
||||
const struct tm *tp)
|
||||
{
|
||||
if (!tp)
|
||||
return 1;
|
||||
@@ -187,8 +177,7 @@ static time_t localtime_offset;
|
||||
|
||||
/* Convert *TP to a time_t value. */
|
||||
time_t
|
||||
mktime (tp)
|
||||
struct tm *tp;
|
||||
mktime (struct tm *tp)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
/* POSIX.1 8.1.1 requires that whenever mktime() is called, the
|
||||
@@ -197,17 +186,15 @@ mktime (tp)
|
||||
__tzset ();
|
||||
#endif
|
||||
|
||||
return __mktime_internal (tp, localtime_r, &localtime_offset);
|
||||
return __mktime_internal (tp, my_mktime_localtime_r, &localtime_offset);
|
||||
}
|
||||
|
||||
/* Use CONVERT to convert *T to a broken down time in *TP.
|
||||
If *T is out of range for conversion, adjust it so that
|
||||
it is the nearest in-range value and then convert that. */
|
||||
static struct tm *
|
||||
ranged_convert (convert, t, tp)
|
||||
struct tm *(*convert) __P ((const time_t *, struct tm *));
|
||||
time_t *t;
|
||||
struct tm *tp;
|
||||
ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
|
||||
time_t *t, struct tm *tp)
|
||||
{
|
||||
struct tm *r;
|
||||
|
||||
@@ -254,19 +241,18 @@ ranged_convert (convert, t, tp)
|
||||
compared to what the result would be for UTC without leap seconds.
|
||||
If *OFFSET's guess is correct, only one CONVERT call is needed. */
|
||||
time_t
|
||||
__mktime_internal (tp, convert, offset)
|
||||
struct tm *tp;
|
||||
struct tm *(*convert) __P ((const time_t *, struct tm *));
|
||||
time_t *offset;
|
||||
__mktime_internal (struct tm *tp,
|
||||
struct tm *(*convert) (const time_t *, struct tm *),
|
||||
time_t *offset)
|
||||
{
|
||||
time_t t, dt, t0;
|
||||
time_t t, dt, t0, t1, t2;
|
||||
struct tm tm;
|
||||
|
||||
/* The maximum number of probes (calls to CONVERT) should be enough
|
||||
to handle any combinations of time zone rule changes, solar time,
|
||||
and leap seconds. POSIX.1 prohibits leap seconds, but some hosts
|
||||
have them anyway. */
|
||||
int remaining_probes = 4;
|
||||
leap seconds, and oscillations around a spring-forward gap.
|
||||
POSIX.1 prohibits leap seconds, but some hosts have them anyway. */
|
||||
int remaining_probes = 6;
|
||||
|
||||
/* Time requested. Copy it in case CONVERT modifies *TP; this can
|
||||
occur if TP is localtime's returned value and CONVERT is localtime. */
|
||||
@@ -312,15 +298,27 @@ __mktime_internal (tp, convert, offset)
|
||||
tm.tm_yday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
|
||||
t0 = ydhms_tm_diff (year, yday, hour, min, sec, &tm);
|
||||
|
||||
for (t = t0 + *offset;
|
||||
for (t = t1 = t2 = t0 + *offset;
|
||||
(dt = ydhms_tm_diff (year, yday, hour, min, sec,
|
||||
ranged_convert (convert, &t, &tm)));
|
||||
t += dt)
|
||||
if (--remaining_probes == 0)
|
||||
t1 = t2, t2 = t, t += dt)
|
||||
if (t == t1 && t != t2
|
||||
&& (isdst < 0 || tm.tm_isdst < 0
|
||||
|| (isdst != 0) != (tm.tm_isdst != 0)))
|
||||
/* We can't possibly find a match, as we are oscillating
|
||||
between two values. The requested time probably falls
|
||||
within a spring-forward gap of size DT. Follow the common
|
||||
practice in this case, which is to return a time that is DT
|
||||
away from the requested time, preferring a time whose
|
||||
tm_isdst differs from the requested value. In practice,
|
||||
this is more useful than returning -1. */
|
||||
break;
|
||||
else if (--remaining_probes == 0)
|
||||
return -1;
|
||||
|
||||
/* Check whether tm.tm_isdst has the requested value, if any. */
|
||||
if (0 <= isdst && 0 <= tm.tm_isdst)
|
||||
/* If we have a match, check whether tm.tm_isdst has the requested
|
||||
value, if any. */
|
||||
if (dt == 0 && 0 <= isdst && 0 <= tm.tm_isdst)
|
||||
{
|
||||
int dst_diff = (isdst != 0) - (tm.tm_isdst != 0);
|
||||
if (dst_diff)
|
||||
@@ -531,6 +529,6 @@ main (argc, argv)
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
compile-command: "gcc -DDEBUG -D__EXTENSIONS__ -DHAVE_LIMITS_H -DHAVE_LOCALTIME_R -DSTDC_HEADERS -Wall -W -O -g mktime.c -o mktime"
|
||||
compile-command: "gcc -DDEBUG -DHAVE_LIMITS_H -DSTDC_HEADERS -Wall -W -O -g mktime.c -o mktime"
|
||||
End:
|
||||
*/
|
||||
|
||||
@@ -42,10 +42,7 @@ char *malloc ();
|
||||
BASE in the returned concatenation. */
|
||||
|
||||
char *
|
||||
path_concat (dir, base, base_in_result)
|
||||
const char *dir;
|
||||
const char *base;
|
||||
char **base_in_result;
|
||||
path_concat (const char *dir, const char *base, char **base_in_result)
|
||||
{
|
||||
char *p;
|
||||
char *p_concat;
|
||||
|
||||
18
lib/putenv.c
18
lib/putenv.c
@@ -23,16 +23,15 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Disable the definition of putenv to rpl_putenv (from config.h) in this
|
||||
file. Otherwise, we'd get conflicting prototypes for rpl_putenv on
|
||||
systems like Irix 5.3. */
|
||||
#undef putenv
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (__GNU_LIBRARY__) || defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
/* Don't include stdlib.h because some (e.g., Solaris 2.7) declare putenv
|
||||
with a non-const argument. That would conflict with the declaration of
|
||||
rpl_putenv below (due to the #define putenv rpl_putenv from config.h). */
|
||||
|
||||
char *malloc ();
|
||||
void free ();
|
||||
|
||||
#if defined (__GNU_LIBRARY__) || defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#endif
|
||||
@@ -60,8 +59,7 @@ extern char **environ;
|
||||
|
||||
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
|
||||
int
|
||||
rpl_putenv (string)
|
||||
const char *string;
|
||||
rpl_putenv (const char *string)
|
||||
{
|
||||
const char *const name_end = strchr (string, '=');
|
||||
register size_t size;
|
||||
|
||||
@@ -258,8 +258,8 @@ quotearg_buffer (char *buffer, size_t buffersize,
|
||||
{
|
||||
STORE ('\\');
|
||||
STORE ('0' + (c >> 6));
|
||||
STORE ('0' + ((c >> 3) & 3));
|
||||
c = '0' + (c & 3);
|
||||
STORE ('0' + ((c >> 3) & 7));
|
||||
c = '0' + (c & 7);
|
||||
goto store_c;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -38,9 +38,7 @@ extern int errno;
|
||||
Return 0 if successful, -1 if not. */
|
||||
|
||||
int
|
||||
rename (from, to)
|
||||
char *from;
|
||||
char *to;
|
||||
rename (char *from, char *to)
|
||||
{
|
||||
struct stat from_stats, to_stats;
|
||||
int pid, status;
|
||||
|
||||
@@ -29,24 +29,15 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <sys/types.h>
|
||||
# include <regex.h>
|
||||
# include <libintl.h>
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
|
||||
static int
|
||||
try (response, pattern, match, nomatch, lastp, re)
|
||||
const char *response;
|
||||
const char *pattern;
|
||||
const int match;
|
||||
const int nomatch;
|
||||
const char **lastp;
|
||||
regex_t *re;
|
||||
try (const char *response, const char *pattern, const int match,
|
||||
const int nomatch, const char **lastp, regex_t *re)
|
||||
{
|
||||
if (pattern != *lastp)
|
||||
{
|
||||
@@ -66,12 +57,13 @@ try (response, pattern, match, nomatch, lastp, re)
|
||||
/* See if the regular expression matches RESPONSE. */
|
||||
return regexec (re, response, 0, NULL, 0) == 0 ? match : nomatch;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
rpmatch (response)
|
||||
const char *response;
|
||||
rpmatch (const char *response)
|
||||
{
|
||||
#if ENABLE_NLS
|
||||
/* Match against one of the response patterns, compiling the pattern
|
||||
first if necessary. */
|
||||
|
||||
@@ -84,4 +76,9 @@ rpmatch (response)
|
||||
&yesexpr, &yesre))
|
||||
? result
|
||||
: try (response, _("^[nN]"), 0, -1, &noexpr, &nore));
|
||||
#else
|
||||
/* Test against "^[yY]" and "^[nN]", hardcoded to avoid requiring regex */
|
||||
return (*response == 'y' || *response == 'Y' ? 1
|
||||
: *response == 'n' || *response == 'N' ? 0 : -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -57,8 +57,7 @@ char *xgetcwd PARAMS ((void));
|
||||
called, but doing so is ok. Otherwise, return zero. */
|
||||
|
||||
int
|
||||
save_cwd (cwd)
|
||||
struct saved_cwd *cwd;
|
||||
save_cwd (struct saved_cwd *cwd)
|
||||
{
|
||||
static int have_working_fchdir = 1;
|
||||
|
||||
@@ -118,10 +117,7 @@ save_cwd (cwd)
|
||||
*/
|
||||
|
||||
int
|
||||
restore_cwd (cwd, dest, from)
|
||||
const struct saved_cwd *cwd;
|
||||
const char *dest;
|
||||
const char *from;
|
||||
restore_cwd (const struct saved_cwd *cwd, const char *dest, const char *from)
|
||||
{
|
||||
int fail = 0;
|
||||
if (cwd->desc >= 0)
|
||||
@@ -144,8 +140,7 @@ restore_cwd (cwd, dest, from)
|
||||
}
|
||||
|
||||
void
|
||||
free_cwd (cwd)
|
||||
struct saved_cwd *cwd;
|
||||
free_cwd (struct saved_cwd *cwd)
|
||||
{
|
||||
if (cwd->desc >= 0)
|
||||
close (cwd->desc);
|
||||
|
||||
@@ -76,9 +76,7 @@ char *stpcpy ();
|
||||
Return NULL if DIR cannot be opened or if out of memory. */
|
||||
|
||||
char *
|
||||
savedir (dir, name_size)
|
||||
const char *dir;
|
||||
unsigned int name_size;
|
||||
savedir (const char *dir, unsigned int name_size)
|
||||
{
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
|
||||
@@ -34,9 +34,7 @@
|
||||
|
||||
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
|
||||
char *
|
||||
__stpcpy (dest, src)
|
||||
char *dest;
|
||||
const char *src;
|
||||
__stpcpy (char *dest, const char *src)
|
||||
{
|
||||
register char *d = dest;
|
||||
register const char *s = src;
|
||||
|
||||
@@ -31,8 +31,7 @@ char *strcpy ();
|
||||
or 0 if out of memory. */
|
||||
|
||||
char *
|
||||
strdup (str)
|
||||
const char *str;
|
||||
strdup (const char *str)
|
||||
{
|
||||
char *newstr;
|
||||
|
||||
|
||||
256
lib/strftime.c
256
lib/strftime.c
@@ -22,11 +22,6 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Some systems need this in order to declare localtime_r properly. */
|
||||
#ifndef _REENTRANT
|
||||
# define _REENTRANT 1
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# define HAVE_LIMITS_H 1
|
||||
# define HAVE_MBLEN 1
|
||||
@@ -136,7 +131,7 @@ extern char *tzname[];
|
||||
add one for integer division truncation;
|
||||
add one more for a minus sign if t is signed. */
|
||||
#define INT_STRLEN_BOUND(t) \
|
||||
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 100 + 1 + TYPE_SIGNED (t))
|
||||
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 + 1 + TYPE_SIGNED (t))
|
||||
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
@@ -149,21 +144,20 @@ extern char *tzname[];
|
||||
|
||||
|
||||
#ifdef _LIBC
|
||||
# define gmtime_r __gmtime_r
|
||||
# define localtime_r __localtime_r
|
||||
# define my_strftime_gmtime_r __gmtime_r
|
||||
# define my_strftime_localtime_r __localtime_r
|
||||
# define tzname __tzname
|
||||
# define tzset __tzset
|
||||
#else
|
||||
# if ! HAVE_LOCALTIME_R
|
||||
# if ! HAVE_TM_GMTOFF
|
||||
/* Approximate gmtime_r as best we can in its absence. */
|
||||
# undef gmtime_r
|
||||
# define gmtime_r my_gmtime_r
|
||||
static struct tm *gmtime_r __P ((const time_t *, struct tm *));
|
||||
|
||||
/* If we're a strftime substitute in a GNU program, then prefer gmtime
|
||||
to gmtime_r, since many gmtime_r implementations are buggy.
|
||||
Similarly for localtime_r. */
|
||||
|
||||
# if ! HAVE_TM_GMTOFF
|
||||
static struct tm *my_strftime_gmtime_r __P ((const time_t *, struct tm *));
|
||||
static struct tm *
|
||||
gmtime_r (t, tp)
|
||||
const time_t *t;
|
||||
struct tm *tp;
|
||||
my_strftime_gmtime_r (const time_t *t, struct tm *tp)
|
||||
{
|
||||
struct tm *l = gmtime (t);
|
||||
if (! l)
|
||||
@@ -171,16 +165,11 @@ gmtime_r (t, tp)
|
||||
*tp = *l;
|
||||
return tp;
|
||||
}
|
||||
# endif /* ! HAVE_TM_GMTOFF */
|
||||
# endif /* ! HAVE_TM_GMTOFF */
|
||||
|
||||
/* Approximate localtime_r as best we can in its absence. */
|
||||
# undef localtime_r
|
||||
# define localtime_r my_ftime_localtime_r
|
||||
static struct tm *localtime_r __P ((const time_t *, struct tm *));
|
||||
static struct tm *my_strftime_localtime_r __P ((const time_t *, struct tm *));
|
||||
static struct tm *
|
||||
localtime_r (t, tp)
|
||||
const time_t *t;
|
||||
struct tm *tp;
|
||||
my_strftime_localtime_r (const time_t *t, struct tm *tp)
|
||||
{
|
||||
struct tm *l = localtime (t);
|
||||
if (! l)
|
||||
@@ -188,7 +177,6 @@ localtime_r (t, tp)
|
||||
*tp = *l;
|
||||
return tp;
|
||||
}
|
||||
# endif /* ! HAVE_LOCALTIME_R */
|
||||
#endif /* ! defined _LIBC */
|
||||
|
||||
|
||||
@@ -282,10 +270,7 @@ static const char zeroes[16] = /* "0000000000000000" */
|
||||
static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len));
|
||||
|
||||
static char *
|
||||
memcpy_lowcase (dest, src, len)
|
||||
char *dest;
|
||||
const char *src;
|
||||
size_t len;
|
||||
memcpy_lowcase (char *dest, const char *src, size_t len)
|
||||
{
|
||||
while (len-- > 0)
|
||||
dest[len] = TOLOWER ((unsigned char) src[len]);
|
||||
@@ -295,10 +280,7 @@ memcpy_lowcase (dest, src, len)
|
||||
static char *memcpy_uppcase __P ((char *dest, const char *src, size_t len));
|
||||
|
||||
static char *
|
||||
memcpy_uppcase (dest, src, len)
|
||||
char *dest;
|
||||
const char *src;
|
||||
size_t len;
|
||||
memcpy_uppcase (char *dest, const char *src, size_t len)
|
||||
{
|
||||
while (len-- > 0)
|
||||
dest[len] = TOUPPER ((unsigned char) src[len]);
|
||||
@@ -312,9 +294,7 @@ memcpy_uppcase (dest, src, len)
|
||||
# define tm_diff ftime_tm_diff
|
||||
static int tm_diff __P ((const struct tm *, const struct tm *));
|
||||
static int
|
||||
tm_diff (a, b)
|
||||
const struct tm *a;
|
||||
const struct tm *b;
|
||||
tm_diff (const struct tm *a, const struct tm *b)
|
||||
{
|
||||
/* Compute intervening leap days correctly even if year is negative.
|
||||
Take care to avoid int overflow in leap day calculations,
|
||||
@@ -349,9 +329,7 @@ static int iso_week_days __P ((int, int));
|
||||
__inline__
|
||||
#endif
|
||||
static int
|
||||
iso_week_days (yday, wday)
|
||||
int yday;
|
||||
int wday;
|
||||
iso_week_days (int yday, int wday)
|
||||
{
|
||||
/* Add enough to the first operand of % to make it nonnegative. */
|
||||
int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
|
||||
@@ -376,34 +354,35 @@ static char const month_name[][10] =
|
||||
|
||||
|
||||
#ifdef emacs
|
||||
# define my_strftime emacs_strftime
|
||||
/* Emacs 20.2 uses `-Dstrftime=emacs_strftime' when compiling,
|
||||
because that's how strftime used to be configured.
|
||||
Undo this, since it gets in the way of accessing the underlying strftime,
|
||||
which is needed for things like %Ec in Solaris.
|
||||
The following two lines can be removed once Emacs stops compiling with
|
||||
`-Dstrftime=emacs_strftime'. */
|
||||
# undef strftime
|
||||
size_t strftime __P ((char *, size_t, const char *, const struct tm *));
|
||||
# define my_strftime emacs_strftimeu
|
||||
# define ut_argument , ut
|
||||
# define ut_argument_spec int ut;
|
||||
# define ut_argument_spec_iso , int ut
|
||||
#else
|
||||
# define my_strftime strftime
|
||||
# define ut_argument
|
||||
# define ut_argument_spec
|
||||
# define ut_argument_spec_iso
|
||||
/* We don't have this information in general. */
|
||||
# define ut 0
|
||||
#endif
|
||||
|
||||
#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
|
||||
/* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
|
||||
Work around this bug by copying *tp before it might be munged. */
|
||||
size_t _strftime_copytm __P ((char *, size_t, const char *,
|
||||
const struct tm *));
|
||||
const struct tm * ut_argument_spec_iso));
|
||||
size_t
|
||||
my_strftime (s, maxsize, format, tp)
|
||||
my_strftime (s, maxsize, format, tp ut_argument)
|
||||
char *s;
|
||||
size_t maxsize;
|
||||
const char *format;
|
||||
const struct tm *tp;
|
||||
ut_argument_spec
|
||||
{
|
||||
struct tm tmcopy;
|
||||
tmcopy = *tp;
|
||||
return _strftime_copytm (s, maxsize, format, &tmcopy);
|
||||
return _strftime_copytm (s, maxsize, format, &tmcopy ut_argument);
|
||||
}
|
||||
# undef my_strftime
|
||||
# define my_strftime(S, Maxsize, Format, Tp) \
|
||||
@@ -418,41 +397,40 @@ size_t strftime __P ((char *, size_t, const char *, const struct tm *));
|
||||
anywhere, so to determine how many characters would be
|
||||
written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
|
||||
size_t
|
||||
my_strftime (s, maxsize, format, tp)
|
||||
char *s;
|
||||
size_t maxsize;
|
||||
const char *format;
|
||||
const struct tm *tp;
|
||||
my_strftime (char *s, size_t maxsize, const char *format, const struct tm *tp
|
||||
ut_argument_spec)
|
||||
{
|
||||
int hour12 = tp->tm_hour;
|
||||
#ifdef _NL_CURRENT
|
||||
const char *const a_wkday = _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday);
|
||||
const char *const f_wkday = _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday);
|
||||
const char *const a_month = _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon);
|
||||
const char *const f_month = _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon);
|
||||
const char *const ampm = _NL_CURRENT (LC_TIME,
|
||||
hour12 > 11 ? PM_STR : AM_STR);
|
||||
size_t aw_len = strlen (a_wkday);
|
||||
size_t am_len = strlen (a_month);
|
||||
size_t ap_len = strlen (ampm);
|
||||
/* We cannot make the following values variables since we must delay
|
||||
the evaluation of these values until really needed since some
|
||||
expressions might not be valid in every situation. The `struct tm'
|
||||
might be generated by a strptime() call that initialized
|
||||
only a few elements. Dereference the pointers only if the format
|
||||
requires this. Then it is ok to fail if the pointers are invalid. */
|
||||
# define a_wkday _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday)
|
||||
# define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday)
|
||||
# define a_month _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon)
|
||||
# define f_month _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon)
|
||||
# define ampm _NL_CURRENT (LC_TIME, tp->tm_hour > 11 ? PM_STR : AM_STR)
|
||||
|
||||
# define aw_len strlen (a_wkday)
|
||||
# define am_len strlen (a_month)
|
||||
# define ap_len strlen (ampm)
|
||||
#else
|
||||
# if !HAVE_STRFTIME
|
||||
const char *const f_wkday = weekday_name[tp->tm_wday];
|
||||
const char *const f_month = month_name[tp->tm_mon];
|
||||
const char *const a_wkday = f_wkday;
|
||||
const char *const a_month = f_month;
|
||||
const char *const ampm = "AMPM" + 2 * (hour12 > 11);
|
||||
# define f_wkday (weekday_name[tp->tm_wday])
|
||||
# define f_month (month_name[tp->tm_mon])
|
||||
# define a_wkday f_wkday
|
||||
# define a_month f_month
|
||||
# define ampm ("AMPM" + 2 * (tp->tm_hour > 11))
|
||||
|
||||
size_t aw_len = 3;
|
||||
size_t am_len = 3;
|
||||
size_t ap_len = 2;
|
||||
# endif
|
||||
#endif
|
||||
#if defined _NL_CURRENT || !HAVE_STRFTIME
|
||||
size_t wkday_len = strlen (f_wkday);
|
||||
size_t month_len = strlen (f_month);
|
||||
#endif
|
||||
const char *zone;
|
||||
size_t zonelen;
|
||||
size_t i = 0;
|
||||
char *p = s;
|
||||
const char *f;
|
||||
@@ -468,25 +446,27 @@ my_strftime (s, maxsize, format, tp)
|
||||
zone = (const char *) tp->tm_zone;
|
||||
#endif
|
||||
#if HAVE_TZNAME
|
||||
/* POSIX.1 8.1.1 requires that whenever strftime() is called, the
|
||||
time zone names contained in the external variable `tzname' shall
|
||||
be set as if the tzset() function had been called. */
|
||||
if (ut)
|
||||
{
|
||||
if (! (zone && *zone))
|
||||
zone = "GMT";
|
||||
}
|
||||
else
|
||||
{
|
||||
/* POSIX.1 8.1.1 requires that whenever strftime() is called, the
|
||||
time zone names contained in the external variable `tzname' shall
|
||||
be set as if the tzset() function had been called. */
|
||||
# if HAVE_TZSET
|
||||
tzset ();
|
||||
tzset ();
|
||||
# endif
|
||||
|
||||
if (!(zone && *zone) && tp->tm_isdst >= 0)
|
||||
zone = tzname[tp->tm_isdst];
|
||||
}
|
||||
#endif
|
||||
if (! zone)
|
||||
zone = ""; /* POSIX.2 requires the empty string here. */
|
||||
|
||||
zonelen = strlen (zone);
|
||||
|
||||
if (hour12 > 12)
|
||||
hour12 -= 12;
|
||||
else
|
||||
if (hour12 == 0) hour12 = 12;
|
||||
if (hour12 == 0)
|
||||
hour12 = 12;
|
||||
|
||||
for (f = format; *f != '\0'; ++f)
|
||||
{
|
||||
@@ -552,7 +532,13 @@ my_strftime (s, maxsize, format, tp)
|
||||
if (bytes == 0)
|
||||
break;
|
||||
|
||||
if (bytes == (size_t) -2 || bytes == (size_t) -1)
|
||||
if (bytes == (size_t) -2)
|
||||
{
|
||||
len += strlen (f + len);
|
||||
break;
|
||||
}
|
||||
|
||||
if (bytes == (size_t) -1)
|
||||
{
|
||||
len++;
|
||||
break;
|
||||
@@ -563,6 +549,7 @@ my_strftime (s, maxsize, format, tp)
|
||||
while (! mbsinit (&mbstate));
|
||||
|
||||
cpy (len, f);
|
||||
f += len - 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -672,7 +659,7 @@ my_strftime (s, maxsize, format, tp)
|
||||
to_lowcase = 0;
|
||||
}
|
||||
#if defined _NL_CURRENT || !HAVE_STRFTIME
|
||||
cpy (wkday_len, f_wkday);
|
||||
cpy (strlen (f_wkday), f_wkday);
|
||||
break;
|
||||
#else
|
||||
goto underlying_strftime;
|
||||
@@ -698,7 +685,7 @@ my_strftime (s, maxsize, format, tp)
|
||||
to_lowcase = 0;
|
||||
}
|
||||
#if defined _NL_CURRENT || !HAVE_STRFTIME
|
||||
cpy (month_len, f_month);
|
||||
cpy (strlen (f_month), f_month);
|
||||
break;
|
||||
#else
|
||||
goto underlying_strftime;
|
||||
@@ -722,9 +709,7 @@ my_strftime (s, maxsize, format, tp)
|
||||
subformat:
|
||||
{
|
||||
char *old_start = p;
|
||||
size_t len = my_strftime (NULL, maxsize - i, subfmt, tp);
|
||||
if (len == 0 && *subfmt)
|
||||
return 0;
|
||||
size_t len = my_strftime (NULL, (size_t) -1, subfmt, tp);
|
||||
add (len, my_strftime (p, maxsize - i, subfmt, tp));
|
||||
|
||||
if (to_uppcase)
|
||||
@@ -750,7 +735,6 @@ my_strftime (s, maxsize, format, tp)
|
||||
*u++ = modifier;
|
||||
*u++ = format_char;
|
||||
*u = '\0';
|
||||
ubuf[0] = '\1';
|
||||
len = strftime (ubuf, sizeof ubuf, ufmt, tp);
|
||||
if (len == 0 && ubuf[0] != '\0')
|
||||
return 0;
|
||||
@@ -1150,7 +1134,16 @@ my_strftime (s, maxsize, format, tp)
|
||||
to_uppcase = 0;
|
||||
to_lowcase = 1;
|
||||
}
|
||||
cpy (zonelen, zone);
|
||||
|
||||
#if HAVE_TZNAME
|
||||
/* The tzset() call might have changed the value. */
|
||||
if (!(zone && *zone) && tp->tm_isdst >= 0)
|
||||
zone = tzname[tp->tm_isdst];
|
||||
#endif
|
||||
if (! zone)
|
||||
zone = ""; /* POSIX.2 requires the empty string here. */
|
||||
|
||||
cpy (strlen (zone), zone);
|
||||
break;
|
||||
|
||||
case 'z': /* GNU extension. */
|
||||
@@ -1162,34 +1155,39 @@ my_strftime (s, maxsize, format, tp)
|
||||
#if HAVE_TM_GMTOFF
|
||||
diff = tp->tm_gmtoff;
|
||||
#else
|
||||
struct tm gtm;
|
||||
struct tm ltm;
|
||||
time_t lt;
|
||||
|
||||
ltm = *tp;
|
||||
lt = mktime (<m);
|
||||
|
||||
if (lt == (time_t) -1)
|
||||
if (ut)
|
||||
diff = 0;
|
||||
else
|
||||
{
|
||||
/* mktime returns -1 for errors, but -1 is also a
|
||||
valid time_t value. Check whether an error really
|
||||
occurred. */
|
||||
struct tm tm;
|
||||
localtime_r (<, &tm);
|
||||
struct tm gtm;
|
||||
struct tm ltm;
|
||||
time_t lt;
|
||||
|
||||
if ((ltm.tm_sec ^ tm.tm_sec)
|
||||
| (ltm.tm_min ^ tm.tm_min)
|
||||
| (ltm.tm_hour ^ tm.tm_hour)
|
||||
| (ltm.tm_mday ^ tm.tm_mday)
|
||||
| (ltm.tm_mon ^ tm.tm_mon)
|
||||
| (ltm.tm_year ^ tm.tm_year))
|
||||
ltm = *tp;
|
||||
lt = mktime (<m);
|
||||
|
||||
if (lt == (time_t) -1)
|
||||
{
|
||||
/* mktime returns -1 for errors, but -1 is also a
|
||||
valid time_t value. Check whether an error really
|
||||
occurred. */
|
||||
struct tm tm;
|
||||
|
||||
if (! my_strftime_localtime_r (<, &tm)
|
||||
|| ((ltm.tm_sec ^ tm.tm_sec)
|
||||
| (ltm.tm_min ^ tm.tm_min)
|
||||
| (ltm.tm_hour ^ tm.tm_hour)
|
||||
| (ltm.tm_mday ^ tm.tm_mday)
|
||||
| (ltm.tm_mon ^ tm.tm_mon)
|
||||
| (ltm.tm_year ^ tm.tm_year)))
|
||||
break;
|
||||
}
|
||||
|
||||
if (! my_strftime_gmtime_r (<, >m))
|
||||
break;
|
||||
|
||||
diff = tm_diff (<m, >m);
|
||||
}
|
||||
|
||||
if (! gmtime_r (<, >m))
|
||||
break;
|
||||
|
||||
diff = tm_diff (<m, >m);
|
||||
#endif
|
||||
|
||||
if (diff < 0)
|
||||
@@ -1222,7 +1220,23 @@ my_strftime (s, maxsize, format, tp)
|
||||
}
|
||||
}
|
||||
|
||||
if (p)
|
||||
if (p && i < maxsize)
|
||||
*p = '\0';
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
#ifdef emacs
|
||||
/* For Emacs we have a separate interface which corresponds to the normal
|
||||
strftime function and does not have the extra information whether the
|
||||
TP arguments comes from a `gmtime' call or not. */
|
||||
size_t
|
||||
emacs_strftime (s, maxsize, format, tp)
|
||||
char *s;
|
||||
size_t maxsize;
|
||||
const char *format;
|
||||
const struct tm *tp;
|
||||
{
|
||||
return my_strftime (s, maxsize, format, tp, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
when given a path that ends in "/" (except for the root directory). */
|
||||
|
||||
void
|
||||
strip_trailing_slashes (path)
|
||||
char *path;
|
||||
strip_trailing_slashes (char *path)
|
||||
{
|
||||
int last;
|
||||
|
||||
|
||||
@@ -33,9 +33,7 @@ char *malloc ();
|
||||
|
||||
/* Duplicate S, returning an identical malloc'd string. */
|
||||
char *
|
||||
strndup (s, n)
|
||||
const char *s;
|
||||
size_t n;
|
||||
strndup (const char *s, size_t n)
|
||||
{
|
||||
char *new = malloc (n + 1);
|
||||
|
||||
|
||||
@@ -30,9 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
typedef unsigned chartype;
|
||||
|
||||
char *
|
||||
strstr (phaystack, pneedle)
|
||||
const char *phaystack;
|
||||
const char *pneedle;
|
||||
strstr (const char *phaystack, const char *pneedle)
|
||||
{
|
||||
register const unsigned char *haystack, *needle;
|
||||
register chartype b, c;
|
||||
|
||||
@@ -43,9 +43,7 @@
|
||||
*/
|
||||
|
||||
int
|
||||
strverscmp (s1, s2)
|
||||
const char *s1;
|
||||
const char *s2;
|
||||
strverscmp (const char *s1, const char *s2)
|
||||
{
|
||||
const unsigned char *p1 = (const unsigned char *) s1;
|
||||
const unsigned char *p2 = (const unsigned char *) s2;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* userspec.c -- Parse a user and group string.
|
||||
Copyright (C) 1989, 1990, 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989-1992, 1997, 1998 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
|
||||
@@ -93,8 +93,7 @@ char *strdup ();
|
||||
otherwise return 0. */
|
||||
|
||||
static int
|
||||
is_number (str)
|
||||
const char *str;
|
||||
is_number (const char *str)
|
||||
{
|
||||
for (; *str; str++)
|
||||
if (!isdigit (*str))
|
||||
@@ -115,11 +114,8 @@ is_number (str)
|
||||
Return NULL if successful, a static error message string if not. */
|
||||
|
||||
const char *
|
||||
parse_user_spec (spec_arg, uid, gid, username_arg, groupname_arg)
|
||||
const char *spec_arg;
|
||||
uid_t *uid;
|
||||
gid_t *gid;
|
||||
char **username_arg, **groupname_arg;
|
||||
parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
|
||||
char **username_arg, char **groupname_arg)
|
||||
{
|
||||
static const char *tired = "virtual memory exhausted";
|
||||
const char *error_msg;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xmalloc.c -- malloc with out of memory checking
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990-1997, 98 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
|
||||
@@ -78,7 +78,7 @@ void error ();
|
||||
#endif
|
||||
|
||||
static void
|
||||
xalloc_fail ()
|
||||
xalloc_fail (void)
|
||||
{
|
||||
if (xalloc_fail_func)
|
||||
(*xalloc_fail_func) ();
|
||||
@@ -88,8 +88,7 @@ xalloc_fail ()
|
||||
/* Allocate N bytes of memory dynamically, with error checking. */
|
||||
|
||||
void *
|
||||
xmalloc (n)
|
||||
size_t n;
|
||||
xmalloc (size_t n)
|
||||
{
|
||||
void *p;
|
||||
|
||||
@@ -104,9 +103,7 @@ xmalloc (n)
|
||||
If P is NULL, run xmalloc. */
|
||||
|
||||
void *
|
||||
xrealloc (p, n)
|
||||
void *p;
|
||||
size_t n;
|
||||
xrealloc (void *p, size_t n)
|
||||
{
|
||||
p = realloc (p, n);
|
||||
if (p == 0)
|
||||
@@ -119,8 +116,7 @@ xrealloc (p, n)
|
||||
/* Allocate memory for N elements of S bytes, with error checking. */
|
||||
|
||||
void *
|
||||
xcalloc (n, s)
|
||||
size_t n, s;
|
||||
xcalloc (size_t n, size_t s)
|
||||
{
|
||||
void *p;
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/* Work around the bug in some systems whereby stat succeeds when
|
||||
given the zero-length file name argument. The stat from SunOS4.1.4
|
||||
/* @IGNORE@ -*- c -*- */
|
||||
/* @IGNORE@ This file is a template from which both stat.c and lstat.c
|
||||
@IGNORE@ are generated. */
|
||||
/* Work around the bug in some systems whereby @xstat@ succeeds when
|
||||
given the zero-length file name argument. The @xstat@ from SunOS4.1.4
|
||||
has this bug.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
@@ -21,11 +24,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Disable the definition of stat to rpl_stat (from config.h) in this
|
||||
file. Otherwise, we'd get conflicting prototypes for rpl_stat on
|
||||
most systems. */
|
||||
#undef stat
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
@@ -33,18 +31,16 @@
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
/* This is a wrapper for stat(2).
|
||||
/* This is a wrapper for @xstat@(2).
|
||||
If FILE is the empty string, fail with errno == ENOENT.
|
||||
Otherwise, return the result of calling the real stat.
|
||||
Otherwise, return the result of calling the real @xstat@.
|
||||
|
||||
This works around the bug in some systems whereby stat succeeds when
|
||||
given the zero-length file name argument. The stat from SunOS4.1.4
|
||||
This works around the bug in some systems whereby @xstat@ succeeds when
|
||||
given the zero-length file name argument. The @xstat@ from SunOS4.1.4
|
||||
has this bug. */
|
||||
|
||||
int
|
||||
rpl_stat (file, sbuf)
|
||||
const char *file;
|
||||
struct stat *sbuf;
|
||||
rpl_@xstat@ (const char *file, struct stat *sbuf)
|
||||
{
|
||||
if (file && *file == 0)
|
||||
{
|
||||
@@ -52,5 +48,5 @@ rpl_stat (file, sbuf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return stat (file, sbuf);
|
||||
return @xstat@ (file, sbuf);
|
||||
}
|
||||
50
m4/ChangeLog
50
m4/ChangeLog
@@ -1,3 +1,53 @@
|
||||
1998-12-18 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Makefile.am.in (Makefile.am): Simplify rule.
|
||||
Based on a suggestion from Lars Hecking.
|
||||
|
||||
1998-11-16 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lfs.m4: Double-quote the `uname...` expression.
|
||||
|
||||
1998-11-16 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lfs.m4 (AC_LFS): Add support for HP-UX 10.20 and HP-UX 11.
|
||||
|
||||
1998-11-14 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lstat.m4: Correct comment. POSIX does not permit it to succeed.
|
||||
* stat.m4: Likewise.
|
||||
|
||||
1998-11-03 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* stat.m4: Rewrite to set HAVE_STAT_EMPTY_STRING_BUG.
|
||||
* lstat.m4: Rewrite to set HAVE_LSTAT_EMPTY_STRING_BUG.
|
||||
|
||||
1998-10-18 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* check-decl.m4 (jm_CHECK_DECL_LOCALTIME_R): Remove macro.
|
||||
|
||||
1998-10-17 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* decl.m4 (jm_CHECK_DECLARATION): Don't hard-code which headers to
|
||||
include, though we still hard-code the `require'-like AC_CHECK_HEADERS
|
||||
calls for those previously hard-coded headers. Instead, take a new
|
||||
parameter.
|
||||
(jm_CHECK_DECLARATIONS): Reflect interface change.
|
||||
* check-decl.m4 (jm_CHECK_DECLS): Likewise.
|
||||
(jm_CHECK_DECL_LOCALTIME_R): New macro.
|
||||
|
||||
* mktime.m4: Test for spring-forward gap before long-running test.
|
||||
|
||||
1998-10-14 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* mktime.m4: Use the more portable "TZ=PST8PDT,M4.1.0,M10.5.0"
|
||||
instead of "TZ=America/Vancouver". From Paul Eggert.
|
||||
|
||||
1998-10-11 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* mktime.m4 (jm_AM_FUNC_MKTIME): New file and macro.
|
||||
This adds a test for a recently added compatibility fix for mktime.c.
|
||||
* jm-mktime.m4: Require jm_AM_FUNC_MKTIME, not AM_FUNC_MKTIME.
|
||||
|
||||
1998-09-27 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* jm-macros.m4 (jm_MACROS): Require jm_FUNC_FNMATCH.
|
||||
|
||||
@@ -6,8 +6,8 @@ chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 fnmatch.m4 \
|
||||
fstypename.m4 getgroups.m4 getline.m4 getloadavg.m4 gettext.m4 glibc.m4 \
|
||||
inttypes_h.m4 isc-posix.m4 jm-glibc-io.m4 jm-macros.m4 jm-mktime.m4 \
|
||||
jm-winsz1.m4 jm-winsz2.m4 lchown.m4 lcmessage.m4 lfs.m4 ls-mntd-fs.m4 \
|
||||
lstat.m4 malloc.m4 memcmp.m4 perl.m4 prereq.m4 progtest.m4 putenv.m4 \
|
||||
readdir.m4 realloc.m4 regex.m4 st_dm_mode.m4 st_mtim.m4 stat.m4 \
|
||||
lstat.m4 malloc.m4 memcmp.m4 mktime.m4 perl.m4 prereq.m4 progtest.m4 \
|
||||
putenv.m4 readdir.m4 realloc.m4 regex.m4 st_dm_mode.m4 st_mtim.m4 stat.m4 \
|
||||
strftime.m4 uintmax_t.m4 uptime.m4 utimbuf.m4 utime.m4 utimes.m4
|
||||
|
||||
##m4-files-end
|
||||
@@ -15,10 +15,9 @@ strftime.m4 uintmax_t.m4 uptime.m4 utimbuf.m4 utime.m4 utimes.m4
|
||||
Makefile.am: Makefile.am.in
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##m4-files-begin/p' $< > $@t
|
||||
( echo EXTRA_DIST = README Makefile.am.in; \
|
||||
find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \
|
||||
|fmt | (tr '\012' @; echo) \
|
||||
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
|
||||
echo EXTRA_DIST = README Makefile.am.in *.m4 \
|
||||
|fmt | (tr '\012' @; echo) \
|
||||
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
|
||||
>> $@t
|
||||
sed -n '/^##m4-files-end/,$$p' $< >> $@t
|
||||
chmod a-w $@t
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
Makefile.am: Makefile.am.in
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##m4-files-begin/p' $< > $@t
|
||||
( echo EXTRA_DIST = README Makefile.am.in; \
|
||||
find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \
|
||||
|fmt | (tr '\012' @; echo) \
|
||||
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
|
||||
echo EXTRA_DIST = README Makefile.am.in *.m4 \
|
||||
|fmt | (tr '\012' @; echo) \
|
||||
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
|
||||
>> $@t
|
||||
sed -n '/^##m4-files-end/,$$p' $< >> $@t
|
||||
chmod a-w $@t
|
||||
|
||||
@@ -95,8 +95,8 @@ chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 fnmatch.m4 \
|
||||
fstypename.m4 getgroups.m4 getline.m4 getloadavg.m4 gettext.m4 glibc.m4 \
|
||||
inttypes_h.m4 isc-posix.m4 jm-glibc-io.m4 jm-macros.m4 jm-mktime.m4 \
|
||||
jm-winsz1.m4 jm-winsz2.m4 lchown.m4 lcmessage.m4 lfs.m4 ls-mntd-fs.m4 \
|
||||
lstat.m4 malloc.m4 memcmp.m4 perl.m4 prereq.m4 progtest.m4 putenv.m4 \
|
||||
readdir.m4 realloc.m4 regex.m4 st_dm_mode.m4 st_mtim.m4 stat.m4 \
|
||||
lstat.m4 malloc.m4 memcmp.m4 mktime.m4 perl.m4 prereq.m4 progtest.m4 \
|
||||
putenv.m4 readdir.m4 realloc.m4 regex.m4 st_dm_mode.m4 st_mtim.m4 stat.m4 \
|
||||
strftime.m4 uintmax_t.m4 uptime.m4 utimbuf.m4 utime.m4 utimes.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
@@ -187,10 +187,9 @@ maintainer-clean
|
||||
Makefile.am: Makefile.am.in
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##m4-files-begin/p' $< > $@t
|
||||
( echo EXTRA_DIST = README Makefile.am.in; \
|
||||
find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \
|
||||
|fmt | (tr '\012' @; echo) \
|
||||
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
|
||||
echo EXTRA_DIST = README Makefile.am.in *.m4 \
|
||||
|fmt | (tr '\012' @; echo) \
|
||||
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
|
||||
>> $@t
|
||||
sed -n '/^##m4-files-end/,$$p' $< >> $@t
|
||||
chmod a-w $@t
|
||||
|
||||
@@ -4,5 +4,4 @@ used by autoconf to create the configure script at the the top level in
|
||||
this distribution.
|
||||
|
||||
The Makefile.am file in this directory is automatically generated
|
||||
from the template file, Makefile.am.in. The generation will fail
|
||||
if you don't have all the right tools.
|
||||
from the template file, Makefile.am.in.
|
||||
|
||||
@@ -1,10 +1,29 @@
|
||||
#serial 2
|
||||
#serial 4
|
||||
|
||||
dnl This is just a wrapper function to encapsulate this kludge.
|
||||
dnl Putting it in a separate file like this helps share it between
|
||||
dnl different packages.
|
||||
AC_DEFUN(jm_CHECK_DECLS,
|
||||
[
|
||||
headers='
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||
# include <memory.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
#else
|
||||
# ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
'
|
||||
if test x = y; then
|
||||
dnl This code is deliberately never run via ./configure.
|
||||
dnl FIXME: this is a gross hack to make autoheader put entries
|
||||
@@ -14,5 +33,6 @@ AC_DEFUN(jm_CHECK_DECLS,
|
||||
AC_CHECK_FUNCS(DECL_FREE DECL_LSEEK DECL_MALLOC DECL_MEMCHR DECL_REALLOC \
|
||||
DECL_STPCPY DECL_STRSTR)
|
||||
fi
|
||||
jm_CHECK_DECLARATIONS(free lseek malloc memchr realloc stpcpy strstr)
|
||||
jm_CHECK_DECLARATIONS($headers, free lseek malloc \
|
||||
memchr realloc stpcpy strstr)
|
||||
])
|
||||
|
||||
33
m4/decl.m4
33
m4/decl.m4
@@ -1,4 +1,4 @@
|
||||
#serial 2
|
||||
#serial 3
|
||||
|
||||
AC_DEFUN(jm_CHECK_DECLARATION,
|
||||
[
|
||||
@@ -10,24 +10,7 @@ AC_DEFUN(jm_CHECK_DECLARATION,
|
||||
test -z "$ac_cv_header_unistd_h" && AC_CHECK_HEADERS(unistd.h)
|
||||
AC_MSG_CHECKING([whether $1 is declared])
|
||||
AC_CACHE_VAL(jm_cv_func_decl_$1,
|
||||
[AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||
# include <memory.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
#else
|
||||
# ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif],
|
||||
[AC_TRY_COMPILE($2,
|
||||
[
|
||||
#ifndef $1
|
||||
char *(*pfn) = (char *(*)) $1
|
||||
@@ -38,23 +21,23 @@ char *(*pfn) = (char *(*)) $1
|
||||
|
||||
if eval "test \"`echo '$jm_cv_func_decl_'$1`\" = yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
ifelse([$3], , :, [$3])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
ifelse([$3], , , [$3
|
||||
ifelse([$4], , , [$4
|
||||
])dnl
|
||||
fi
|
||||
])dnl
|
||||
|
||||
dnl jm_CHECK_DECLARATIONS(FUNCTION... [, ACTION-IF-DECLARED
|
||||
dnl jm_CHECK_DECLARATIONS(INCLUDES, FUNCTION... [, ACTION-IF-DECLARED
|
||||
dnl [, ACTION-IF-NOT-DECLARED]])
|
||||
AC_DEFUN(jm_CHECK_DECLARATIONS,
|
||||
[
|
||||
for jm_func in $1
|
||||
for jm_func in $2
|
||||
do
|
||||
jm_CHECK_DECLARATION($jm_func,
|
||||
jm_CHECK_DECLARATION($jm_func, $1,
|
||||
[
|
||||
jm_tr_func=HAVE_DECL_`echo $jm_func | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
|
||||
AC_DEFINE_UNQUOTED($jm_tr_func) $2], $3)dnl
|
||||
AC_DEFINE_UNQUOTED($jm_tr_func) $3], $4)dnl
|
||||
done
|
||||
])
|
||||
|
||||
@@ -7,12 +7,12 @@ dnl /* Define to rpl_mktime if the replacement function should be used. */
|
||||
dnl #undef mktime
|
||||
dnl
|
||||
AC_DEFUN(jm_FUNC_MKTIME,
|
||||
[AC_REQUIRE([AM_FUNC_MKTIME])dnl
|
||||
[AC_REQUIRE([jm_AM_FUNC_MKTIME])dnl
|
||||
|
||||
dnl mktime.c uses localtime_r if it exists. Check for it.
|
||||
AC_CHECK_FUNCS(localtime_r)
|
||||
|
||||
if test $am_cv_func_working_mktime = no; then
|
||||
if test $jm_am_cv_func_working_mktime = no; then
|
||||
AC_DEFINE_UNQUOTED(mktime, rpl_mktime)
|
||||
fi
|
||||
])
|
||||
|
||||
15
m4/lfs.m4
15
m4/lfs.m4
@@ -1,4 +1,4 @@
|
||||
#serial 1
|
||||
#serial 2
|
||||
|
||||
dnl The problem is that the default compilation flags in Solaris 2.6 won't
|
||||
dnl let programs access large files; you need to tell the compiler that
|
||||
@@ -28,6 +28,19 @@ AC_DEFUN(AC_LFS,
|
||||
ac_getconfs=$ac_getconfs$ac_getconf
|
||||
eval ac_test_$ac_shellvar=\$ac_getconf
|
||||
done
|
||||
case "$ac_result" in
|
||||
no)
|
||||
case "`(uname -s -r) 2>/dev/null`" in
|
||||
HP-UX' '?.10.[[2-9]][[0-9]]* | HP-UX' '?.1[[1-9]]* | HP-UX' '?.[[2-9]][[0-9]]*)
|
||||
# HP-UX 10.20 and later support large files,
|
||||
# but do not support `getconf LFS_CFLAGS'.
|
||||
ac_test_CPPFLAGS='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
|
||||
ac_test_LDFLAGS=
|
||||
ac_test_LIBS=
|
||||
ac_getconfs=nonempty
|
||||
ac_result=yes ;;
|
||||
esac ;;
|
||||
esac
|
||||
case "$ac_result$ac_getconfs" in
|
||||
yes) ac_result=no ;;
|
||||
esac
|
||||
|
||||
43
m4/lstat.m4
43
m4/lstat.m4
@@ -1,20 +1,18 @@
|
||||
#serial 1
|
||||
#serial 2
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl Determine whether lstat has the bug that it succeeds when given the
|
||||
dnl zero-length file name argument. The lstat from SunOS4.1.4 does this.
|
||||
dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
|
||||
dnl (as of 1998-11-01) do this.
|
||||
dnl
|
||||
dnl If it doesn't, arrange to use the replacement function.
|
||||
dnl
|
||||
dnl If you use this macro in a package, you should
|
||||
dnl add the following two lines to acconfig.h:
|
||||
dnl /* Define to rpl_lstat if the replacement function should be used. */
|
||||
dnl #undef lstat
|
||||
dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
|
||||
dnl compile the wrapper function.
|
||||
dnl
|
||||
|
||||
AC_DEFUN(jm_FUNC_LSTAT,
|
||||
[
|
||||
AC_CACHE_CHECK([for working lstat], jm_cv_func_working_lstat,
|
||||
AC_CACHE_CHECK([whether lstat accepts an empty string],
|
||||
jm_cv_func_lstat_empty_string_bug,
|
||||
[AC_TRY_RUN([
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
@@ -23,16 +21,31 @@ AC_DEFUN(jm_FUNC_LSTAT,
|
||||
main ()
|
||||
{
|
||||
struct stat sbuf;
|
||||
exit (lstat ("", &sbuf) == 0 ? 1 : 0);
|
||||
exit (lstat ("", &sbuf) ? 1 : 0);
|
||||
}
|
||||
],
|
||||
jm_cv_func_working_lstat=yes,
|
||||
jm_cv_func_working_lstat=no,
|
||||
jm_cv_func_lstat_empty_string_bug=yes,
|
||||
jm_cv_func_lstat_empty_string_bug=no,
|
||||
dnl When crosscompiling, assume lstat is broken.
|
||||
jm_cv_func_working_lstat=no)
|
||||
jm_cv_func_lstat_empty_string_bug=yes)
|
||||
])
|
||||
if test $jm_cv_func_working_lstat = no; then
|
||||
if test $jm_cv_func_lstat_empty_string_bug = yes; then
|
||||
|
||||
LIBOBJS="$LIBOBJS lstat.o"
|
||||
AC_DEFINE_UNQUOTED(lstat, rpl_lstat)
|
||||
|
||||
if test $jm_cv_func_lstat_empty_string_bug = yes; then
|
||||
if test x = y; then
|
||||
# This code is deliberately never run via ./configure.
|
||||
# FIXME: this is a hack to make autoheader put the corresponding
|
||||
# HAVE_* undef for this symbol in config.h.in. This saves me the
|
||||
# trouble of having to maintain the #undef in acconfig.h manually.
|
||||
AC_CHECK_FUNCS(LSTAT_EMPTY_STRING_BUG)
|
||||
fi
|
||||
# Defining it this way (rather than via AC_DEFINE) short-circuits the
|
||||
# autoheader check -- autoheader doesn't know it's already been taken
|
||||
# care of by the hack above.
|
||||
ac_kludge=HAVE_LSTAT_EMPTY_STRING_BUG
|
||||
AC_DEFINE_UNQUOTED($ac_kludge)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
166
m4/mktime.m4
Normal file
166
m4/mktime.m4
Normal file
@@ -0,0 +1,166 @@
|
||||
#serial 1001
|
||||
|
||||
dnl Just like mktime.m4 from automake-1.3b, but with an additional test.
|
||||
dnl Renamed to have jm_ prefix and to use jm_ prefix on cache variable names.
|
||||
|
||||
AC_DEFUN(jm_AM_FUNC_MKTIME,
|
||||
[AC_REQUIRE([AC_HEADER_TIME])dnl
|
||||
AC_CHECK_HEADERS(sys/time.h unistd.h)
|
||||
AC_CHECK_FUNCS(alarm)
|
||||
AC_CACHE_CHECK([for working mktime], jm_am_cv_func_working_mktime,
|
||||
[AC_TRY_RUN(
|
||||
changequote(<<, >>)dnl
|
||||
<</* Test program from Paul Eggert (eggert@twinsun.com)
|
||||
and Tony Leneis (tony@plaza.ds.adp.com). */
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# if HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if !HAVE_ALARM
|
||||
# define alarm(X) /* empty */
|
||||
#endif
|
||||
|
||||
/* Work around redefinition to rpl_putenv by other config tests. */
|
||||
#undef putenv
|
||||
|
||||
static time_t time_t_max;
|
||||
|
||||
/* Values we'll use to set the TZ environment variable. */
|
||||
static const char *const tz_strings[] = {
|
||||
(const char *) 0, "TZ=GMT0", "TZ=JST-9",
|
||||
"TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
|
||||
};
|
||||
#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
|
||||
|
||||
/* Fail if mktime fails to convert a date in the spring-forward gap.
|
||||
Based on a problem report from Andreas Jaeger. */
|
||||
static void
|
||||
spring_forward_gap ()
|
||||
{
|
||||
/* glibc (up to about 1998-10-07) failed this test) */
|
||||
struct tm tm;
|
||||
|
||||
/* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
|
||||
instead of "TZ=America/Vancouver" in order to detect the bug even
|
||||
on systems that don't support the Olson extension, or don't have the
|
||||
full zoneinfo tables installed. */
|
||||
putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
|
||||
tm.tm_year = 98;
|
||||
tm.tm_mon = 3;
|
||||
tm.tm_mday = 5;
|
||||
tm.tm_hour = 2;
|
||||
tm.tm_min = 0;
|
||||
tm.tm_sec = 0;
|
||||
tm.tm_isdst = -1;
|
||||
if (mktime (&tm) == (time_t)-1)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static void
|
||||
mktime_test (now)
|
||||
time_t now;
|
||||
{
|
||||
struct tm *lt;
|
||||
if ((lt = localtime (&now)) && mktime (lt) != now)
|
||||
exit (1);
|
||||
now = time_t_max - now;
|
||||
if ((lt = localtime (&now)) && mktime (lt) != now)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static void
|
||||
irix_6_4_bug ()
|
||||
{
|
||||
/* Based on code from Ariel Faigon. */
|
||||
struct tm tm;
|
||||
tm.tm_year = 96;
|
||||
tm.tm_mon = 3;
|
||||
tm.tm_mday = 0;
|
||||
tm.tm_hour = 0;
|
||||
tm.tm_min = 0;
|
||||
tm.tm_sec = 0;
|
||||
tm.tm_isdst = -1;
|
||||
mktime (&tm);
|
||||
if (tm.tm_mon != 2 || tm.tm_mday != 31)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static void
|
||||
bigtime_test (j)
|
||||
int j;
|
||||
{
|
||||
struct tm tm;
|
||||
time_t now;
|
||||
tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
|
||||
/* This test makes some buggy mktime implementations loop.
|
||||
Give up after 10 seconds. */
|
||||
alarm (10);
|
||||
now = mktime (&tm);
|
||||
alarm (0);
|
||||
if (now != (time_t) -1)
|
||||
{
|
||||
struct tm *lt = localtime (&now);
|
||||
if (! (lt
|
||||
&& lt->tm_year == tm.tm_year
|
||||
&& lt->tm_mon == tm.tm_mon
|
||||
&& lt->tm_mday == tm.tm_mday
|
||||
&& lt->tm_hour == tm.tm_hour
|
||||
&& lt->tm_min == tm.tm_min
|
||||
&& lt->tm_sec == tm.tm_sec
|
||||
&& lt->tm_yday == tm.tm_yday
|
||||
&& lt->tm_wday == tm.tm_wday
|
||||
&& ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
|
||||
== (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
time_t t, delta;
|
||||
int i, j;
|
||||
|
||||
spring_forward_gap ();
|
||||
for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
|
||||
continue;
|
||||
time_t_max--;
|
||||
delta = time_t_max / 997; /* a suitable prime number */
|
||||
for (i = 0; i < N_STRINGS; i++)
|
||||
{
|
||||
if (tz_strings[i])
|
||||
putenv (tz_strings[i]);
|
||||
|
||||
for (t = 0; t <= time_t_max - delta; t += delta)
|
||||
mktime_test (t);
|
||||
mktime_test ((time_t) 60 * 60);
|
||||
mktime_test ((time_t) 60 * 60 * 24);
|
||||
|
||||
for (j = 1; 0 < j; j *= 2)
|
||||
bigtime_test (j);
|
||||
bigtime_test (j - 1);
|
||||
}
|
||||
irix_6_4_bug ();
|
||||
exit (0);
|
||||
}
|
||||
>>,
|
||||
changequote([, ])dnl
|
||||
jm_am_cv_func_working_mktime=yes, jm_am_cv_func_working_mktime=no,
|
||||
dnl When crosscompiling, assume mktime is missing or broken.
|
||||
jm_am_cv_func_working_mktime=no)
|
||||
])
|
||||
if test $jm_am_cv_func_working_mktime = no; then
|
||||
LIBOBJS="$LIBOBJS mktime.o"
|
||||
fi
|
||||
])
|
||||
43
m4/stat.m4
43
m4/stat.m4
@@ -1,20 +1,18 @@
|
||||
#serial 1
|
||||
#serial 2
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl Determine whether stat has the bug that it succeeds when given the
|
||||
dnl zero-length file name argument. The stat from SunOS4.1.4 does this.
|
||||
dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
|
||||
dnl (as of 1998-11-01) do this.
|
||||
dnl
|
||||
dnl If it doesn't, arrange to use the replacement function.
|
||||
dnl
|
||||
dnl If you use this macro in a package, you should
|
||||
dnl add the following two lines to acconfig.h:
|
||||
dnl /* Define to rpl_stat if the replacement function should be used. */
|
||||
dnl #undef stat
|
||||
dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
|
||||
dnl compile the wrapper function.
|
||||
dnl
|
||||
|
||||
AC_DEFUN(jm_FUNC_STAT,
|
||||
[
|
||||
AC_CACHE_CHECK([for working stat], jm_cv_func_working_stat,
|
||||
AC_CACHE_CHECK([whether stat accepts an empty string],
|
||||
jm_cv_func_stat_empty_string_bug,
|
||||
[AC_TRY_RUN([
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
@@ -23,16 +21,31 @@ AC_DEFUN(jm_FUNC_STAT,
|
||||
main ()
|
||||
{
|
||||
struct stat sbuf;
|
||||
exit (stat ("", &sbuf) == 0 ? 1 : 0);
|
||||
exit (stat ("", &sbuf) ? 1 : 0);
|
||||
}
|
||||
],
|
||||
jm_cv_func_working_stat=yes,
|
||||
jm_cv_func_working_stat=no,
|
||||
jm_cv_func_stat_empty_string_bug=yes,
|
||||
jm_cv_func_stat_empty_string_bug=no,
|
||||
dnl When crosscompiling, assume stat is broken.
|
||||
jm_cv_func_working_stat=no)
|
||||
jm_cv_func_stat_empty_string_bug=yes)
|
||||
])
|
||||
if test $jm_cv_func_working_stat = no; then
|
||||
if test $jm_cv_func_stat_empty_string_bug = yes; then
|
||||
|
||||
LIBOBJS="$LIBOBJS stat.o"
|
||||
AC_DEFINE_UNQUOTED(stat, rpl_stat)
|
||||
|
||||
if test $jm_cv_func_stat_empty_string_bug = yes; then
|
||||
if test x = y; then
|
||||
# This code is deliberately never run via ./configure.
|
||||
# FIXME: this is a hack to make autoheader put the corresponding
|
||||
# HAVE_* undef for this symbol in config.h.in. This saves me the
|
||||
# trouble of having to maintain the #undef in acconfig.h manually.
|
||||
AC_CHECK_FUNCS(STAT_EMPTY_STRING_BUG)
|
||||
fi
|
||||
# Defining it this way (rather than via AC_DEFINE) short-circuits the
|
||||
# autoheader check -- autoheader doesn't know it's already been taken
|
||||
# care of by the hack above.
|
||||
ac_kludge=HAVE_STAT_EMPTY_STRING_BUG
|
||||
AC_DEFINE_UNQUOTED($ac_kludge)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
65
man/help2man
65
man/help2man
@@ -18,30 +18,22 @@
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Written by Brendan O'Dea <bod@compusol.com.au>
|
||||
# and François Pinard <pinard@IRO.UMontreal.CA>
|
||||
|
||||
require 5.003;
|
||||
|
||||
use 5.004;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use POSIX 'strftime';
|
||||
use POSIX qw(strftime setlocale LC_TIME);
|
||||
|
||||
my $RCS_Id = '$Id: help2man,v 1.2 1998/10/03 19:15:41 meyering Exp $';
|
||||
my $this_program = 'help2man';
|
||||
my $this_version = '0.0';
|
||||
|
||||
if ($RCS_Id =~ /\$Id:\s+(\S+)\s+(\S+)/)
|
||||
{
|
||||
$this_version = $2;
|
||||
($this_program = $1) =~ s/(\.\w+)?,v$//;
|
||||
}
|
||||
|
||||
my $this_version = '1.006';
|
||||
my $version_info = <<EOT;
|
||||
$this_program $this_version
|
||||
|
||||
Copyright (C) 1997, 98 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Written by Brendan O'Dea <bod\@compusol.com.au>
|
||||
EOT
|
||||
|
||||
my $help_info = <<EOT;
|
||||
@@ -53,14 +45,14 @@ Usage: $this_program [OPTION]... EXECUTABLE
|
||||
--include=FILE include material from `FILE'
|
||||
--opt-include=FILE include material from `FILE' if it exists
|
||||
--output=FILE send output to `FILE'
|
||||
--no-info suppress pointer to Texinfo manual
|
||||
--help print this help, then exit
|
||||
--version print $this_program program version number, then exit
|
||||
|
||||
EXECUTABLE should accept `--help' and `version' options.
|
||||
EOT
|
||||
|
||||
my ($include, $opt_name, $opt_include, $opt_output, $opt_help,
|
||||
$opt_version);
|
||||
my ($include, $opt_name, $opt_include, $opt_output, $opt_no_info);
|
||||
|
||||
# Parse options.
|
||||
GetOptions (
|
||||
@@ -68,6 +60,7 @@ GetOptions (
|
||||
'include=s' => \$include,
|
||||
'opt-include=s' => \$opt_include,
|
||||
'output=s' => \$opt_output,
|
||||
'no-info' => \$opt_no_info,
|
||||
help => sub { print $help_info; exit },
|
||||
version => sub { print $version_info; exit },
|
||||
) or die $help_info;
|
||||
@@ -112,7 +105,7 @@ if ($include or $opt_include)
|
||||
die "$this_program: no valid information found in `$include'\n"
|
||||
unless %include;
|
||||
|
||||
# Compress trailing blank lines
|
||||
# Compress trailing blank lines.
|
||||
for (keys %include)
|
||||
{
|
||||
$include{$_} =~ s/\n+$//;
|
||||
@@ -128,17 +121,16 @@ if ($include or $opt_include)
|
||||
# Turn off localisation of executable's ouput.
|
||||
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
|
||||
|
||||
# Turn off localisation of date (for strftime)
|
||||
setlocale LC_TIME, 'C';
|
||||
|
||||
# Grab help and version paragraphs from executable
|
||||
# Invoke program with `--manhelp' only if --name=STRING not specified.
|
||||
my @help = split /\n\n+/, `$ARGV[0] --manhelp 2>/dev/null`
|
||||
if !defined $opt_name;
|
||||
my @help = split /\n\n+/, `$ARGV[0] --help 2>/dev/null`
|
||||
or die "$this_program: can't get `--help' info from $ARGV[0]\n";
|
||||
|
||||
my @version = split /\n\n+/, `$ARGV[0] --version 2>/dev/null`
|
||||
or die "$this_program: can't get `--version' info from $ARGV[0]\n";
|
||||
|
||||
@help = split /\n\n+/, `$ARGV[0] --help 2>/dev/null`
|
||||
or die "$this_program: can't get `--help' info from $ARGV[0]\n"
|
||||
unless @help;
|
||||
|
||||
my $date = strftime "%B %Y", localtime;
|
||||
(my $program = $ARGV[0]) =~ s!.*/!!;
|
||||
my $package = $program;
|
||||
@@ -187,14 +179,10 @@ else
|
||||
|
||||
$program =~ s!.*/!!;
|
||||
|
||||
# Check for name in help output
|
||||
if ($help[0] =~ s/^(?:name|oneliner):\s*(\S.*)//)
|
||||
{
|
||||
($include{NAME} = "$program \\- $1") =~ s/\s+$//;
|
||||
shift @help unless length $help[0];
|
||||
}
|
||||
# no info for `info' itself
|
||||
$opt_no_info = 1 if $program eq 'info';
|
||||
|
||||
# --name overrides --include contents and/or --manhelp oneliner
|
||||
# --name overrides --include contents
|
||||
$include{NAME} = "$program \\- $opt_name" if $opt_name;
|
||||
|
||||
# Default (useless) NAME paragraph
|
||||
@@ -239,14 +227,14 @@ for (@help)
|
||||
$accumulate = 0;
|
||||
} while s/^(?:Usage|\s*or):\s+\S+\s+(.*)\n?//;
|
||||
|
||||
# Include file overrides SYNOPSIS
|
||||
# Include file overrides SYNOPSIS.
|
||||
print ".SH SYNOPSIS\n", $include{SYNOPSIS} || $synopsis;
|
||||
|
||||
# Dump any accumulated description text.
|
||||
print ".SH DESCRIPTION\n";
|
||||
print @description;
|
||||
|
||||
# Add additional description text from include file
|
||||
# Add additional description text from include file.
|
||||
if ($include{DESCRIPTION})
|
||||
{
|
||||
print ".PP\n" unless $include{DESCRIPTION} =~ /^\..P/;
|
||||
@@ -324,12 +312,12 @@ for (@include)
|
||||
}
|
||||
|
||||
# Refer to the real documentation.
|
||||
if ($include{'SEE ALSO'} or $program ne 'info')
|
||||
if ($include{'SEE ALSO'} or !$opt_no_info)
|
||||
{
|
||||
print qq(.SH "SEE ALSO"\n);
|
||||
print $include{'SEE ALSO'}, ".PP\n" if $include{'SEE ALSO'};
|
||||
|
||||
print <<EOT unless $program eq 'info';
|
||||
print <<EOT unless $opt_no_info;
|
||||
The full documentation for
|
||||
.B $program
|
||||
is maintained as a Texinfo manual. If the
|
||||
@@ -349,16 +337,19 @@ for (@version)
|
||||
{
|
||||
chomp;
|
||||
|
||||
# Convert copyright symbol or (c) to nroff character
|
||||
# Join hyphenated lines.
|
||||
s/([A-Za-z])-\n */$1/g;
|
||||
|
||||
# Convert copyright symbol or (c) to nroff character.
|
||||
s/Copyright\s+(?:\xa9|\([Cc]\))/Copyright \\(co/g;
|
||||
|
||||
# Insert appropriate headings for copyright and author
|
||||
# Insert appropriate headings for copyright and author.
|
||||
if (/^Copyright\s\\/) { print ".SH COPYRIGHT\n" }
|
||||
elsif (/^Written\s+by/) { print ".SH AUTHOR\n" }
|
||||
else { print ".PP\n"; }
|
||||
|
||||
# Insert line breaks before additional copyright messages and the
|
||||
# disclaimer
|
||||
# disclaimer.
|
||||
s/(.)\n(Copyright\s|This is free software)/$1\n.br\n$2/g;
|
||||
|
||||
print "$_\n";
|
||||
|
||||
@@ -1,3 +1,252 @@
|
||||
1998-12-22 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 4.1-b1.
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add chinese (zh).
|
||||
|
||||
1998-12-19 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* tests/ln/misc: Use absolute path for final rm.
|
||||
|
||||
* Makefile.maint (my-distcheck): Run make with
|
||||
CFLAGS='-Wformat -Werror'.
|
||||
|
||||
1998-12-18 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/copy.c (copy_internal): Remove errnoeous `%s: ' prefix
|
||||
from format string. From Michiel Bacchiani.
|
||||
|
||||
* src/chgrp.c (MAXGID): Define.
|
||||
Use gid_t (not int) as the type for `group' variables.
|
||||
(parse_group): Use MAXGID, not INT_MAX.
|
||||
|
||||
* src/install.c (UID_T_MAX, GID_T_MAX): Remove definitions.
|
||||
* src/sys2.h (UID_T_MAX, GID_T_MAX): Define them here instead.
|
||||
|
||||
1998-12-13 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/Makefile.am (EXTRA_DIST): Add xstat.in.
|
||||
|
||||
1998-12-12 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
1998-10-15 Akim Demaille <demaille@inf.enst.fr>
|
||||
* src/ls.c: Group DIRED's code together.
|
||||
(full_time, inhibit_group, col_ext_type): Declare static.
|
||||
(dired_dump_obstack): Apply sizeof to variable, instead of its type.
|
||||
(parse_ls_color): Rename ext2 as e2. Move into the block where it
|
||||
is used.
|
||||
|
||||
1998-10-15 Akim Demaille <demaille@inf.enst.fr>
|
||||
* src/ls.c: In order to distinguish col(umn|or):
|
||||
(init_column_info): Renamed from init_col_info.
|
||||
(struct column_info): Renamed from struct col_info.
|
||||
(struct color_ext_type): Renamed from struct col_ext_type.
|
||||
|
||||
1998-12-11 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/Makefile.am (lstat.c): Add rule to generate this from xstat.in.
|
||||
(stat.c): Likewise.
|
||||
* lib/stat.c: Remove file.
|
||||
* lib/lstat.c: Remove file.
|
||||
* lib/xstat.in (xstat@): New file.
|
||||
|
||||
* lib/quotearg.c (quotearg_buffer): Use `7' as the mask, not `3'.
|
||||
From Bruno Haible.
|
||||
* tests/ls-2/tests: Add a test for this.
|
||||
|
||||
* man/help2man: import version 1.006.
|
||||
|
||||
1998-12-07 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/copy.c: Use dir_name, not dirname. Include dirname.h.
|
||||
* src/cp.c: Likewise.
|
||||
* src/df.c: Likewise.
|
||||
* src/install.c: Likewise.
|
||||
* src/ln.c: Likewise.
|
||||
* src/mvdir.c: Likewise.
|
||||
|
||||
* lib/dirname.c (dir_name): Rename from dirname.
|
||||
Make argument `const'. Include "dirname.h"
|
||||
* lib/dirname.h: New file.
|
||||
* lib/Makefile.am (noinst_HEADERS): Add dirname.h.
|
||||
|
||||
1998-12-06 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/rpmatch.c (rpmatch) [!ENABLE_NLS]: Hard-code tests to use
|
||||
`^[yY]' and `^[nN]' (avoiding regex). From Karl Heuer.
|
||||
|
||||
* lib/*.c: Ansideclify.
|
||||
|
||||
Fix `ls -R .' formatting bug that broke mktexlsr.
|
||||
* src/ls.c: Include path-concat.h.
|
||||
(basename_is_dot_or_dotdot): New function, derived from
|
||||
is_not_dot_or_dotdot.
|
||||
(is_not_dot_or_dotdot): Remove function.
|
||||
(extract_dirs_from_files): Use `!basename_is_dot_or_dotdot'
|
||||
instead of is_not_dot_or_dotdot and use path_concat instead of attach.
|
||||
|
||||
* tests/ls-2/tests: New file (renamed from quoting),
|
||||
with new test for the `ls -R .' fix.
|
||||
* tests/ls-2/quoting: Remove file.
|
||||
* tests/ls-2/Makefile.am (TESTS): s/quoting/tests/.
|
||||
|
||||
1998-11-29 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/remove.c (DOT_OR_DOTDOT): Move definition from this file...
|
||||
* src/sys2.h (DOT_OR_DOTDOT): ...to this one.
|
||||
|
||||
* src/dd.c (dd_copy): Rename function from `copy'.
|
||||
|
||||
* src/cp.c (do_copy): Rename local: s/unused/copy_into_self/.
|
||||
|
||||
Per Kristian Hove reported that a certain move-directory-into-self
|
||||
wasn't properly diagnosed.
|
||||
|
||||
* tests/mv/into-self-3: New file.
|
||||
* tests/mv/Makefile.am (TESTS): Add into-self-3.
|
||||
* src/copy.c (copy_internal): Remove earlier (but less effective)
|
||||
test for move/copy-into-self.
|
||||
Instead, deduce the move-into-self condition from errno==EINVAL
|
||||
after a failed rename.
|
||||
* src/mv.c (do_move): Don't arrange to remove DEST in the
|
||||
copied-into-self case.
|
||||
|
||||
1998-11-15 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
Bob McCracken reported that mv couldn't handle certain combinations
|
||||
of hard linked source files.
|
||||
|
||||
* tests/mv/hard-link-1: New file.
|
||||
* tests/mv/Makefile.am (TESTS): Add hard-link-1.
|
||||
* src/mv.c (movefile): Don't free new_dest.
|
||||
|
||||
* lib/error.c (error): Don't use strerror_r's return value.
|
||||
From Johan Danielsson.
|
||||
|
||||
1998-11-14 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 4.0.
|
||||
|
||||
* Makefile.maint (cvs-dist): Search for `$tag:' rather than just $tag
|
||||
to avoid matching a prefix of another tag.
|
||||
|
||||
1998-11-10 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add greek (el).
|
||||
|
||||
1998-11-07 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 4.0-b7.
|
||||
|
||||
Accommodate the Hurd (defining lstat to rpl_lstat via config.h didn't
|
||||
work on Hurd systems because of an inline definition of lstat in a
|
||||
system header file). This also makes it so that you may run `ls '' '
|
||||
on systems that let l?stat operate on the empty string.
|
||||
|
||||
* src/remove.c [HAVE_LSTAT_EMPTY_STRING_BUG]: Define lstat to rpl_lstat
|
||||
and declare the latter.
|
||||
* lib/stat.c [stat]: Remove #undef.
|
||||
(rpl_stat): Protoize.
|
||||
* lib/lstat.c [lstat]: Remove #undef.
|
||||
(rpl_lstat): Protoize. Use ENOENT, not EINVAL, to be consistent
|
||||
with lib/stat.c.
|
||||
* acconfig.h: Remove #undef's for lstat and stat.
|
||||
|
||||
1998-10-31 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* tests/rm/Makefile.am (TESTS): Add new test `empty-name',
|
||||
but comment it out.
|
||||
* tests/rm/empty-name: New file.
|
||||
|
||||
* acconfig.h (stat): New #undef.
|
||||
This omission was uncovered when Mark Kettenis reported that
|
||||
`rm -r ''' got a failed assertion on the Hurd. This change
|
||||
doesn't fix *that* problem -- see above.
|
||||
|
||||
1998-10-25 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 4.0-b6.
|
||||
|
||||
* README: Man pages will now be supported to the extent that
|
||||
people send patches.
|
||||
|
||||
* tests/rm/unreadable: Two new tests.
|
||||
* tests/rm/Makefile.am (TESTS): Add new test `unreadable'. But comment
|
||||
it out since we're so close to release and since the test compares the
|
||||
text of diagnostics that are likely to vary between systems.
|
||||
(TEST_ENVIRONMENT): Add required framework.
|
||||
|
||||
* src/remove.c (remove_cwd_entries): Don't apply CLOSEDIR to a NULL
|
||||
pointer. (provoke with `mkdir -m 0100 x; rm -rf x')
|
||||
Upon CLOSEDIR failure, set `status' to RM_ERROR, not RM_OK.
|
||||
(remove_dir): Return `status', rather than always RM_OK.
|
||||
|
||||
1998-10-18 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 4.0-b5.
|
||||
|
||||
* lib/mktime.c: Update from libc with this additional change from Paul.
|
||||
* lib/strftime.c: Likewise.
|
||||
|
||||
1998-10-17 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Don't invoke localtime_r or gmtime_r unless it's the GNU C
|
||||
library's localtime_r and gmtime_r; there are too many buggy
|
||||
implementations of localtime_r and gmtime_r out there, and
|
||||
it's not worth keeping track of all the different bugs.
|
||||
|
||||
* mktime.c (__EXTENSIONS__, HAVE_LOCALTIME_R): Remove.
|
||||
(my_mktime_localtime_r): Renamed from localtime_r; all uses changed.
|
||||
Base it on localtime unless _LIBC.
|
||||
|
||||
* strftime.c (__EXTENSIONS__): Remove.
|
||||
(my_strftime_gmtime_r): Renamed from gmtime_r; all uses changed.
|
||||
(my_strftime_localtime_r): Renamed from localtime_r; all uses changed.
|
||||
Base them on localtime/gmtime if not _LIBC.
|
||||
|
||||
1998-10-17 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 4.0-b4.
|
||||
|
||||
* lib/mktime.c: Declare localtime_r if necessary.
|
||||
* lib/strftime.c: Likewise.
|
||||
|
||||
* tests/Fetish.pm (run_tests): Run $prog with --version only
|
||||
if $verbose.
|
||||
|
||||
1998-10-11 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 4.0-b3.
|
||||
|
||||
1998-10-08 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* mktime.c (__mktime_internal): When the requested time falls
|
||||
in a spring-forward gap of size DT, return a time that is DT
|
||||
away from the requested time, preferring a time whose tm_isdst
|
||||
differs from the requested value. Bump the max number of
|
||||
probes from 4 to 6 to account for the extra probes needed to
|
||||
discover a spring-forward gap in the worst case.
|
||||
|
||||
1998-10-08 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* mktime.c (my_mktime_localtime_r): Renamed from localtime_r.
|
||||
Define also if HAVE_LOCALTIME_R && defined (localtime_r), with
|
||||
a body that merely expands localtime_r; this works around a
|
||||
bug in Digital Unix 4.0A and 4.0D.
|
||||
|
||||
1998-10-05 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* po/Makefile.in.in (uninstall): Remove (historical?) command that
|
||||
removed po-Makefile.in.in. From Akim Demaille.
|
||||
|
||||
* src/install.c (long_options): Add entry for --suffix=SUFFIX option.
|
||||
From aldomel.
|
||||
|
||||
1998-10-04 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* tests/mv/Makefile.am (TESTS_ENVIRONMENT): Define PERL.
|
||||
From Kaveh Ghazi.
|
||||
|
||||
1998-10-03 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 4.0-b2.
|
||||
|
||||
@@ -1,4 +1,26 @@
|
||||
Changes in release 3.17:
|
||||
Changes in release 4.1:
|
||||
[4.1-b1]
|
||||
* ls --quoting-style=c prints correct octal escapes for certain nonprinting
|
||||
characters in file names.
|
||||
* fix `ls -R .' formatting bug that broke mktexlsr
|
||||
* moving a directory into itself is properly diagnosed in more cases
|
||||
* moving a directory containing hard-linked files now works
|
||||
|
||||
Changes in release 4.0:
|
||||
[4.0-b7]
|
||||
* rm -rf '' no longer gets a failed assertion on the Hurd
|
||||
[4.0-b6]
|
||||
* rm simply fails as it should (rather than segfaulting) for
|
||||
`mkdir -m 0100 x; rm -rf x'
|
||||
[4.0-b5]
|
||||
* still *more* mktime.c portability tweaks
|
||||
[4.0-b4]
|
||||
* mktime.c portability tweak for headers with GNU libc 5.4.44.
|
||||
[4.0-b3]
|
||||
* mktime.c works around problems with Digital Unix 4.0A and 4.0D.
|
||||
* mktime.c handles dates in the spring-forward gap the same way other
|
||||
implementations do
|
||||
* install accepts long option --suffix=SUFFIX
|
||||
[4.0-b2]
|
||||
* man/Makefile.maint framework tweaks
|
||||
* add test for `mv -i' bug
|
||||
|
||||
@@ -1,3 +1,28 @@
|
||||
1998-12-10 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
|
||||
|
||||
* src/date.c (main): Arrange to exit unsuccessfully when stime fails.
|
||||
|
||||
1998-12-07 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add Russian (ru).
|
||||
|
||||
1998-12-06 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/putenv.c: Redefine putenv before including stdlib.h to work
|
||||
around Solaris 2.7's conflicting prototype. Reported by Karl Berry.
|
||||
|
||||
1998-10-31 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* tests/Makefile.am (EXTRA_DIST): Add Fetish.pm.
|
||||
* tests/Fetish.pm: New file.
|
||||
|
||||
* tests/factor/Makefile.am: Rewrite to use new testing framework.
|
||||
* tests/factor/Test.pm: Remove file.
|
||||
* tests/factor/factor-tests: Remove file.
|
||||
* tests/factor/basic: New file (rewrite of Test.pm).
|
||||
|
||||
* acconfig.h (stat): New #undef.
|
||||
|
||||
1998-10-03 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* man/Makefile.am: Switch to using help2man.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Changes in release 1.17
|
||||
[1.16f]
|
||||
* `date -s' now exits with nonzero status upon failure
|
||||
* new autoconf tests detect bugs in vendor mktime from Irix-6.4 and SunOS4.1.4
|
||||
Your executables will be a little larger on such systems because you'll use
|
||||
GNU's mktime function, but date will work more reliably.
|
||||
|
||||
@@ -1,8 +1,35 @@
|
||||
1998-10-22 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 1.22g.
|
||||
|
||||
* src/fold.c (usage): Add mention of --version and --help.
|
||||
Reported by Matej Vela <mvela@public.srce.hr>.
|
||||
|
||||
1998-10-04 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/fnmatch.h: New file. (unused)
|
||||
* lib/fnmatch.c: New file. (unused)
|
||||
* lib/Makefile.am (noinst_HEADERS): Add fnmatch.h.
|
||||
|
||||
1998-10-03 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* man/Makefile.am: Switch to using help2man.
|
||||
(EXTRA_DIST): Add Makefile.summ.
|
||||
|
||||
* man/help2man: Invoke program with --manhelp option only if
|
||||
--name=STRING not specified. Otherwise, this would fail with `yes'.
|
||||
* man/Makefile.summ: New file.
|
||||
* man/Makefile.maint: Include it.
|
||||
* man/help2man: New file.
|
||||
* man/GNUmakefile: New file.
|
||||
* man/Makefile.maint: New file.
|
||||
* man/*.x: New files.
|
||||
* man/*.1: Remove files.
|
||||
|
||||
* src/md5sum.c (split_3): Rename local variable, to `escaped_filename'.
|
||||
(main): Output the leading backslash not just when there's a newline
|
||||
in the file name, but also when there's a backslash.
|
||||
Reported by Jim Dennis.
|
||||
|
||||
* tests/md5sum/basic-1: Add tests with filenames containing newline
|
||||
and backslash characters. (for the bug fixed above)
|
||||
|
||||
17
src/chgrp.c
17
src/chgrp.c
@@ -32,7 +32,10 @@
|
||||
|
||||
/* MAXUID may come from limits.h *or* sys/params.h (via system.h) above. */
|
||||
#ifndef MAXUID
|
||||
# define MAXUID INT_MAX
|
||||
# define MAXUID UID_T_MAX
|
||||
#endif
|
||||
#ifndef MAXGID
|
||||
# define MAXGID GID_T_MAX
|
||||
#endif
|
||||
|
||||
#ifndef _POSIX_VERSION
|
||||
@@ -68,7 +71,7 @@ enum Verbosity
|
||||
V_off
|
||||
};
|
||||
|
||||
static int change_dir_group PARAMS ((const char *dir, int group,
|
||||
static int change_dir_group PARAMS ((const char *dir, gid_t group,
|
||||
const struct stat *statp));
|
||||
|
||||
/* The name the program was run with. */
|
||||
@@ -141,7 +144,7 @@ describe_change (const char *file, enum Change_status changed)
|
||||
/* Set *G according to NAME. */
|
||||
|
||||
static void
|
||||
parse_group (const char *name, int *g)
|
||||
parse_group (const char *name, gid_t *g)
|
||||
{
|
||||
struct group *grp;
|
||||
|
||||
@@ -162,7 +165,7 @@ parse_group (const char *name, int *g)
|
||||
if (s_err != LONGINT_OK)
|
||||
STRTOL_FATAL_ERROR (name, _("group number"), s_err);
|
||||
|
||||
if (tmp_long > INT_MAX)
|
||||
if (tmp_long > MAXGID)
|
||||
error (1, 0, _("invalid group number `%s'"), name);
|
||||
|
||||
*g = tmp_long;
|
||||
@@ -177,7 +180,7 @@ parse_group (const char *name, int *g)
|
||||
Return 0 if successful, 1 if errors occurred. */
|
||||
|
||||
static int
|
||||
change_file_group (const char *file, int group)
|
||||
change_file_group (const char *file, gid_t group)
|
||||
{
|
||||
struct stat file_stats;
|
||||
int errors = 0;
|
||||
@@ -242,7 +245,7 @@ change_file_group (const char *file, int group)
|
||||
Return 0 if successful, 1 if errors occurred. */
|
||||
|
||||
static int
|
||||
change_dir_group (const char *dir, int group, const struct stat *statp)
|
||||
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. */
|
||||
@@ -323,7 +326,7 @@ Change the group membership of each FILE to GROUP.\n\
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int group;
|
||||
gid_t group;
|
||||
int errors = 0;
|
||||
int optc;
|
||||
|
||||
|
||||
43
src/copy.c
43
src/copy.c
@@ -33,6 +33,7 @@
|
||||
#include "copy.h"
|
||||
#include "cp-hash.h"
|
||||
#include "path-concat.h"
|
||||
#include "dirname.h"
|
||||
|
||||
#define DO_CHOWN(Chown, File, New_uid, New_gid) \
|
||||
(Chown ((File), (x->myeuid == 0 ? (New_uid) : x->myeuid), (New_gid)) \
|
||||
@@ -51,7 +52,6 @@ struct dir_list
|
||||
int full_write ();
|
||||
int euidaccess ();
|
||||
int yesno ();
|
||||
char *dirname ();
|
||||
|
||||
static int copy_internal PARAMS ((const char *src_path, const char *dst_path,
|
||||
int new_dst, dev_t device,
|
||||
@@ -387,14 +387,6 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
|
||||
earlier_file = remember_copied (dst_path, src_sb.st_ino, src_sb.st_dev);
|
||||
|
||||
/* Did we just create this file? */
|
||||
|
||||
if (earlier_file == &new_file)
|
||||
{
|
||||
*copy_into_self = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
src_mode = src_sb.st_mode;
|
||||
src_type = src_sb.st_mode;
|
||||
|
||||
@@ -603,7 +595,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
directories). */
|
||||
if (S_ISDIR (src_type))
|
||||
{
|
||||
error (0, 0, _("%s: won't create hard link `%s' to directory `%s'"),
|
||||
error (0, 0, _("won't create hard link `%s' to directory `%s'"),
|
||||
dst_path, earlier_file);
|
||||
goto un_backup;
|
||||
}
|
||||
@@ -617,13 +609,30 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (move_mode && rename (src_path, dst_path) == 0)
|
||||
if (move_mode)
|
||||
{
|
||||
if (x->verbose && S_ISDIR (src_type))
|
||||
printf ("%s -> %s\n", src_path, dst_path);
|
||||
if (rename_succeeded)
|
||||
*rename_succeeded = 1;
|
||||
return 0;
|
||||
if (rename (src_path, dst_path) == 0)
|
||||
{
|
||||
if (x->verbose && S_ISDIR (src_type))
|
||||
printf ("%s -> %s\n", src_path, dst_path);
|
||||
if (rename_succeeded)
|
||||
*rename_succeeded = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: someday, consider what to do when moving a directory into
|
||||
itself but when source and destination are on different devices. */
|
||||
|
||||
/* This happens when attempting to rename a directory to a
|
||||
subdirectory of itself. */
|
||||
if (errno == EINVAL)
|
||||
{
|
||||
/* FIXME: this is a little fragile in that it relies on rename(2)
|
||||
returning a specific errno (EINVAL). Expect problems on
|
||||
non-POSIX systems. */
|
||||
*copy_into_self = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (S_ISDIR (src_type))
|
||||
@@ -691,7 +700,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
char *dst_parent;
|
||||
int in_current_dir;
|
||||
|
||||
dst_parent = dirname (dst_path);
|
||||
dst_parent = dir_name (dst_path);
|
||||
if (dst_parent == NULL)
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
|
||||
|
||||
12
src/cp.c
12
src/cp.c
@@ -35,6 +35,7 @@
|
||||
#include "cp-hash.h"
|
||||
#include "copy.h"
|
||||
#include "error.h"
|
||||
#include "dirname.h"
|
||||
|
||||
#ifndef _POSIX_VERSION
|
||||
uid_t geteuid ();
|
||||
@@ -54,7 +55,6 @@ int stat ();
|
||||
int lstat ();
|
||||
|
||||
char *base_name ();
|
||||
char *dirname ();
|
||||
enum backup_type get_version ();
|
||||
void strip_trailing_slashes ();
|
||||
char *xstrdup ();
|
||||
@@ -308,7 +308,7 @@ make_path_private (const char *const_dirpath, int src_offset, int mode,
|
||||
|
||||
src = dirpath + src_offset;
|
||||
|
||||
tmp_dst_dirname = dirname (dirpath);
|
||||
tmp_dst_dirname = dir_name (dirpath);
|
||||
dst_dirname = (char *) alloca (strlen (tmp_dst_dirname) + 1);
|
||||
strcpy (dst_dirname, tmp_dst_dirname);
|
||||
free (tmp_dst_dirname);
|
||||
@@ -444,7 +444,7 @@ do_copy (int argc, char **argv, const struct cp_options *x)
|
||||
char *arg;
|
||||
char *ap;
|
||||
char *dst_path;
|
||||
int parent_exists = 1; /* True if dirname (dst_path) exists. */
|
||||
int parent_exists = 1; /* True if dir_name (dst_path) exists. */
|
||||
struct dir_attr *attr_list;
|
||||
char *arg_in_concat = NULL;
|
||||
|
||||
@@ -460,7 +460,7 @@ do_copy (int argc, char **argv, const struct cp_options *x)
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
|
||||
/* For --parents, we have to make sure that the directory
|
||||
dirname (dst_path) exists. We may have to create a few
|
||||
dir_name (dst_path) exists. We may have to create a few
|
||||
leading directories. */
|
||||
parent_exists = !make_path_private (dst_path,
|
||||
arg_in_concat - dst_path,
|
||||
@@ -488,8 +488,8 @@ do_copy (int argc, char **argv, const struct cp_options *x)
|
||||
}
|
||||
else
|
||||
{
|
||||
int unused;
|
||||
ret |= copy (arg, dst_path, new_dst, x, &unused, NULL);
|
||||
int copy_into_self;
|
||||
ret |= copy (arg, dst_path, new_dst, x, ©_into_self, NULL);
|
||||
forget_all ();
|
||||
|
||||
if (flag_path)
|
||||
|
||||
@@ -344,7 +344,10 @@ argument must be a format string beginning with `+'."),
|
||||
/* Set the system clock to the specified date, then regardless of
|
||||
the success of that operation, format and print that date. */
|
||||
if (stime (&when) == -1)
|
||||
error (0, errno, _("cannot set date"));
|
||||
{
|
||||
error (0, errno, _("cannot set date"));
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* When given a universal time option, set TZ to UTC0 after
|
||||
|
||||
4
src/dd.c
4
src/dd.c
@@ -932,7 +932,7 @@ copy_with_unblock (unsigned char *buf, int nread)
|
||||
/* The main loop. */
|
||||
|
||||
static int
|
||||
copy (void)
|
||||
dd_copy (void)
|
||||
{
|
||||
unsigned char *ibuf, *bufstart; /* Input buffer. */
|
||||
int nread; /* Bytes read in the current block. */
|
||||
@@ -1174,7 +1174,7 @@ main (int argc, char **argv)
|
||||
install_handler (SIGPIPE, interrupt_handler);
|
||||
install_handler (SIGINFO, siginfo_handler);
|
||||
|
||||
exit_status = copy ();
|
||||
exit_status = dd_copy ();
|
||||
|
||||
quit (exit_status);
|
||||
}
|
||||
|
||||
4
src/df.c
4
src/df.c
@@ -35,8 +35,8 @@
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "human.h"
|
||||
#include "dirname.h"
|
||||
|
||||
char *dirname ();
|
||||
void strip_trailing_slashes ();
|
||||
char *xstrdup ();
|
||||
char *xgetcwd ();
|
||||
@@ -411,7 +411,7 @@ find_mount_point (const char *file, const struct stat *file_stat)
|
||||
char *dir;
|
||||
|
||||
strip_trailing_slashes (tmp);
|
||||
dir = dirname (tmp);
|
||||
dir = dir_name (tmp);
|
||||
free (tmp);
|
||||
rv = chdir (dir);
|
||||
free (dir);
|
||||
|
||||
@@ -74,6 +74,8 @@ standard output.\n\
|
||||
-b, --bytes count bytes rather than columns\n\
|
||||
-s, --spaces break at spaces\n\
|
||||
-w, --width=WIDTH use WIDTH columns instead of 80\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
#include "path-concat.h"
|
||||
#include "cp-hash.h"
|
||||
#include "copy.h"
|
||||
#include "dirname.h"
|
||||
|
||||
#if HAVE_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
@@ -118,16 +119,7 @@ gid_t getgid ();
|
||||
/* Number of bytes of a file to copy at a time. */
|
||||
#define READ_SIZE (32 * 1024)
|
||||
|
||||
#ifndef UID_T_MAX
|
||||
# define UID_T_MAX TYPE_MAXIMUM (uid_t)
|
||||
#endif
|
||||
|
||||
#ifndef GID_T_MAX
|
||||
# define GID_T_MAX TYPE_MAXIMUM (gid_t)
|
||||
#endif
|
||||
|
||||
char *base_name ();
|
||||
char *dirname ();
|
||||
int full_write ();
|
||||
int isdir ();
|
||||
enum backup_type get_version ();
|
||||
@@ -193,6 +185,7 @@ static struct option const long_options[] =
|
||||
{"owner", required_argument, NULL, 'o'},
|
||||
{"preserve-timestamps", no_argument, NULL, 'p'},
|
||||
{"backup", no_argument, NULL, 'b'},
|
||||
{"suffix", required_argument, NULL, 'S'},
|
||||
{"version-control", required_argument, NULL, 'V'},
|
||||
{"verbose", no_argument, NULL, 'v'},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
@@ -410,7 +403,7 @@ install_file_to_path (const char *from, const char *to,
|
||||
char *dest_dir;
|
||||
int fail;
|
||||
|
||||
dest_dir = dirname (to);
|
||||
dest_dir = dir_name (to);
|
||||
|
||||
/* check to make sure this is a path (not install a b ) */
|
||||
if (!STREQ (dest_dir, ".")
|
||||
|
||||
6
src/ln.c
6
src/ln.c
@@ -30,6 +30,7 @@
|
||||
#include "backupfile.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "dirname.h"
|
||||
|
||||
int link (); /* Some systems don't declare this anywhere. */
|
||||
|
||||
@@ -58,7 +59,6 @@ int symlink ();
|
||||
while (0)
|
||||
|
||||
char *base_name ();
|
||||
char *dirname ();
|
||||
enum backup_type get_version ();
|
||||
int isdir ();
|
||||
int yesno ();
|
||||
@@ -131,8 +131,8 @@ same_name (const char *source, const char *dest)
|
||||
struct stat dest_dir_stats;
|
||||
char *source_dirname, *dest_dirname;
|
||||
|
||||
source_dirname = dirname (source);
|
||||
dest_dirname = dirname (dest);
|
||||
source_dirname = dir_name (source);
|
||||
dest_dirname = dir_name (dest);
|
||||
if (source_dirname == NULL || dest_dirname == NULL)
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
|
||||
|
||||
221
src/ls.c
221
src/ls.c
@@ -73,6 +73,7 @@
|
||||
#include "strverscmp.h"
|
||||
#include "quotearg.h"
|
||||
#include "filemode.h"
|
||||
#include "path-concat.h"
|
||||
|
||||
#define obstack_chunk_alloc malloc
|
||||
#define obstack_chunk_free free
|
||||
@@ -133,11 +134,12 @@ struct bin_str
|
||||
time_t time ();
|
||||
#endif
|
||||
|
||||
char *base_name ();
|
||||
char *getgroup ();
|
||||
char *getuser ();
|
||||
void invalid_arg ();
|
||||
void strip_trailing_slashes ();
|
||||
char *xstrdup ();
|
||||
void invalid_arg ();
|
||||
|
||||
static size_t quote_name PARAMS ((FILE *out, const char *name,
|
||||
struct quoting_options const *options));
|
||||
@@ -174,7 +176,6 @@ static int decode_switches PARAMS ((int argc, char **argv));
|
||||
static int file_interesting PARAMS ((const struct dirent *next));
|
||||
static uintmax_t gobble_file PARAMS ((const char *name, int explicit_arg,
|
||||
const char *dirname));
|
||||
static int is_not_dot_or_dotdot PARAMS ((const char *name));
|
||||
static void print_color_indicator PARAMS ((const char *name, unsigned int mode,
|
||||
int linkok));
|
||||
static void put_indicator PARAMS ((const struct bin_str *ind));
|
||||
@@ -186,7 +187,7 @@ static void extract_dirs_from_files PARAMS ((const char *dirname,
|
||||
int recursive));
|
||||
static void get_link_name PARAMS ((const char *filename, struct fileinfo *f));
|
||||
static void indent PARAMS ((int from, int to));
|
||||
static void init_col_info PARAMS ((void));
|
||||
static void init_column_info PARAMS ((void));
|
||||
static void print_current_files PARAMS ((void));
|
||||
static void print_dir PARAMS ((const char *name, const char *realname));
|
||||
static void print_file_name_and_frills PARAMS ((const struct fileinfo *f));
|
||||
@@ -283,7 +284,7 @@ static enum time_type time_type;
|
||||
|
||||
/* print the full time, otherwise the standard unix heuristics. */
|
||||
|
||||
int full_time;
|
||||
static int full_time;
|
||||
|
||||
/* The file characteristic to sort by. Controlled by -t, -S, -U, -X, -v. */
|
||||
|
||||
@@ -309,7 +310,7 @@ static int sort_reverse;
|
||||
|
||||
/* Nonzero means to NOT display group information. -G */
|
||||
|
||||
int inhibit_group;
|
||||
static int inhibit_group;
|
||||
|
||||
/* Nonzero means print the user and group id's as numbers rather
|
||||
than as names. -n */
|
||||
@@ -377,11 +378,11 @@ static const char *const indicator_name[]=
|
||||
"bd", "cd", "mi", "or", "ex", NULL
|
||||
};
|
||||
|
||||
struct col_ext_type
|
||||
struct color_ext_type
|
||||
{
|
||||
struct bin_str ext; /* The extension we're looking for */
|
||||
struct bin_str seq; /* The sequence to output when we do */
|
||||
struct col_ext_type *next; /* Next in list */
|
||||
struct color_ext_type *next; /* Next in list */
|
||||
};
|
||||
|
||||
static struct bin_str color_indicator[] =
|
||||
@@ -403,7 +404,7 @@ static struct bin_str color_indicator[] =
|
||||
};
|
||||
|
||||
/* FIXME: comment */
|
||||
struct col_ext_type *col_ext_list = NULL;
|
||||
static struct color_ext_type *color_ext_list = NULL;
|
||||
|
||||
/* Buffer for color sequences */
|
||||
static char *color_buf;
|
||||
@@ -565,6 +566,46 @@ static char const *const time_args[] =
|
||||
"atime", "access", "use", "ctime", "status", 0
|
||||
};
|
||||
|
||||
static enum time_type const time_types[] =
|
||||
{
|
||||
time_atime, time_atime, time_atime, time_ctime, time_ctime
|
||||
};
|
||||
|
||||
static char const *const color_args[] =
|
||||
{
|
||||
/* Note: "no" is a prefix of "none" so we don't include it. */
|
||||
/* force and none are for compatibility with another color-ls version */
|
||||
"always", "yes", "force",
|
||||
"never", "none",
|
||||
"auto", "tty", "if-tty", 0
|
||||
};
|
||||
|
||||
static enum color_type const color_types[] =
|
||||
{
|
||||
color_always, color_always, color_always,
|
||||
color_never, color_never,
|
||||
color_if_tty, color_if_tty, color_if_tty
|
||||
};
|
||||
|
||||
/* Information about filling a column. */
|
||||
struct column_info
|
||||
{
|
||||
int valid_len;
|
||||
int line_len;
|
||||
int *col_arr;
|
||||
};
|
||||
|
||||
/* Array with information about column filledness. */
|
||||
static struct column_info *column_info;
|
||||
|
||||
/* Maximum number of columns ever possible for this display. */
|
||||
static int max_idx;
|
||||
|
||||
/* The minimum width of a colum is 3: 1 character for the name and 2
|
||||
for the separating white space. */
|
||||
#define MIN_COLUMN_WIDTH 3
|
||||
|
||||
|
||||
/* This zero-based index is used solely with the --dired option.
|
||||
When that option is in effect, this counter is incremented for each
|
||||
character of output generated by this program so that the beginning
|
||||
@@ -611,46 +652,6 @@ static struct obstack subdired_obstack;
|
||||
} \
|
||||
while (0)
|
||||
|
||||
static enum time_type const time_types[] =
|
||||
{
|
||||
time_atime, time_atime, time_atime, time_ctime, time_ctime
|
||||
};
|
||||
|
||||
static char const *const color_args[] =
|
||||
{
|
||||
/* Note: "no" is a prefix of "none" so we don't include it. */
|
||||
/* force and none are for compatibility with another color-ls version */
|
||||
"always", "yes", "force",
|
||||
"never", "none",
|
||||
"auto", "tty", "if-tty", 0
|
||||
};
|
||||
|
||||
static enum color_type const color_types[] =
|
||||
{
|
||||
color_always, color_always, color_always,
|
||||
color_never, color_never,
|
||||
color_if_tty, color_if_tty, color_if_tty
|
||||
};
|
||||
|
||||
|
||||
/* Information about filling a column. */
|
||||
struct col_info
|
||||
{
|
||||
int valid_len;
|
||||
int line_len;
|
||||
int *col_arr;
|
||||
};
|
||||
|
||||
/* Array with information about column filledness. */
|
||||
static struct col_info *col_info;
|
||||
|
||||
/* Maximum number of columns ever possible for this display. */
|
||||
static int max_idx;
|
||||
|
||||
/* The minimum width of a colum is 3: 1 character for the name and 2
|
||||
for the separating white space. */
|
||||
#define MIN_COLUMN_WIDTH 3
|
||||
|
||||
|
||||
/* Write to standard output PREFIX, followed by the quoting style and
|
||||
a space-separated list of the integers stored in OS all on one line. */
|
||||
@@ -660,7 +661,7 @@ dired_dump_obstack (const char *prefix, struct obstack *os)
|
||||
{
|
||||
int n_pos;
|
||||
|
||||
n_pos = obstack_object_size (os) / sizeof (size_t);
|
||||
n_pos = obstack_object_size (os) / sizeof (dired_pos);
|
||||
if (n_pos > 0)
|
||||
{
|
||||
int i;
|
||||
@@ -1382,7 +1383,7 @@ get_funky_string (char **dest, const char **src, int equals_end)
|
||||
*(q++) = *(p++) & 037;
|
||||
++count;
|
||||
}
|
||||
else if ( *p == '?')
|
||||
else if (*p == '?')
|
||||
{
|
||||
*(q++) = 127;
|
||||
++count;
|
||||
@@ -1392,7 +1393,7 @@ get_funky_string (char **dest, const char **src, int equals_end)
|
||||
break;
|
||||
|
||||
default:
|
||||
abort();
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1410,8 +1411,7 @@ parse_ls_color (void)
|
||||
int state; /* State of parser */
|
||||
int ind_no; /* Indicator number */
|
||||
char label[3]; /* Indicator label */
|
||||
struct col_ext_type *ext; /* Extension we are working on */
|
||||
struct col_ext_type *ext2; /* Extra pointer */
|
||||
struct color_ext_type *ext; /* Extension we are working on */
|
||||
|
||||
if ((p = getenv ("LS_COLORS")) == NULL || *p == '\0')
|
||||
return;
|
||||
@@ -1443,10 +1443,10 @@ parse_ls_color (void)
|
||||
override an earlier one, which can be useful for
|
||||
having terminal-specific defs override global). */
|
||||
|
||||
ext = (struct col_ext_type *)
|
||||
xmalloc (sizeof (struct col_ext_type));
|
||||
ext->next = col_ext_list;
|
||||
col_ext_list = ext;
|
||||
ext = (struct color_ext_type *)
|
||||
xmalloc (sizeof (struct color_ext_type));
|
||||
ext->next = color_ext_list;
|
||||
color_ext_list = ext;
|
||||
|
||||
++p;
|
||||
ext->ext.string = buf;
|
||||
@@ -1510,16 +1510,17 @@ parse_ls_color (void)
|
||||
|
||||
if (state < 0)
|
||||
{
|
||||
struct col_ext_type *e;
|
||||
struct color_ext_type *e;
|
||||
struct color_ext_type *e2;
|
||||
|
||||
error (0, 0,
|
||||
_("unparsable value for LS_COLORS environment variable"));
|
||||
free (color_buf);
|
||||
for (e = col_ext_list; e != NULL ; /* empty */)
|
||||
for (e = color_ext_list; e != NULL; /* empty */)
|
||||
{
|
||||
ext2 = e;
|
||||
e2 = e;
|
||||
e = e->next;
|
||||
free (ext2);
|
||||
free (e2);
|
||||
}
|
||||
print_with_color = 0;
|
||||
}
|
||||
@@ -1873,6 +1874,16 @@ make_link_path (const char *path, const char *linkname)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return nonzero if base_name (NAME) ends in `.' or `..'
|
||||
This is so we don't try to recurse on `././././. ...' */
|
||||
|
||||
static int
|
||||
basename_is_dot_or_dotdot (const char *name)
|
||||
{
|
||||
char *base = base_name (name);
|
||||
return DOT_OR_DOTDOT (base);
|
||||
}
|
||||
|
||||
/* Remove any entries from `files' that are for directories,
|
||||
and queue them to be listed as directories instead.
|
||||
`dirname' is the prefix to prepend to each dirname
|
||||
@@ -1884,7 +1895,6 @@ static void
|
||||
extract_dirs_from_files (const char *dirname, int recursive)
|
||||
{
|
||||
register int i, j;
|
||||
register char *path;
|
||||
int dirlen;
|
||||
|
||||
dirlen = strlen (dirname) + 2;
|
||||
@@ -1892,7 +1902,7 @@ extract_dirs_from_files (const char *dirname, int recursive)
|
||||
order. */
|
||||
for (i = files_index - 1; i >= 0; i--)
|
||||
if ((files[i].filetype == directory || files[i].filetype == arg_directory)
|
||||
&& (!recursive || is_not_dot_or_dotdot (files[i].name)))
|
||||
&& (!recursive || !basename_is_dot_or_dotdot (files[i].name)))
|
||||
{
|
||||
if (files[i].name[0] == '/' || dirname[0] == 0)
|
||||
{
|
||||
@@ -1900,8 +1910,7 @@ extract_dirs_from_files (const char *dirname, int recursive)
|
||||
}
|
||||
else
|
||||
{
|
||||
path = (char *) xmalloc (strlen (files[i].name) + dirlen);
|
||||
attach (path, dirname, files[i].name);
|
||||
char *path = path_concat (dirname, files[i].name, NULL);
|
||||
queue_directory (path, files[i].linkname);
|
||||
free (path);
|
||||
}
|
||||
@@ -1918,26 +1927,6 @@ extract_dirs_from_files (const char *dirname, int recursive)
|
||||
files_index = j;
|
||||
}
|
||||
|
||||
/* Return nonzero if `name' doesn't end in `.' or `..'
|
||||
This is so we don't try to recurse on `././././. ...' */
|
||||
|
||||
static int
|
||||
is_not_dot_or_dotdot (const char *name)
|
||||
{
|
||||
char *t;
|
||||
|
||||
t = strrchr (name, '/');
|
||||
if (t)
|
||||
name = t + 1;
|
||||
|
||||
if (name[0] == '.'
|
||||
&& (name[1] == '\0'
|
||||
|| (name[1] == '.' && name[2] == '\0')))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Sort the files now in the table. */
|
||||
|
||||
static void
|
||||
@@ -2143,12 +2132,12 @@ print_current_files (void)
|
||||
break;
|
||||
|
||||
case many_per_line:
|
||||
init_col_info ();
|
||||
init_column_info ();
|
||||
print_many_per_line ();
|
||||
break;
|
||||
|
||||
case horizontal:
|
||||
init_col_info ();
|
||||
init_column_info ();
|
||||
print_horizontal ();
|
||||
break;
|
||||
|
||||
@@ -2464,7 +2453,7 @@ static void
|
||||
print_color_indicator (const char *name, unsigned int mode, int linkok)
|
||||
{
|
||||
int type = C_FILE;
|
||||
struct col_ext_type *ext; /* Color extension */
|
||||
struct color_ext_type *ext; /* Color extension */
|
||||
size_t len; /* Length of name */
|
||||
|
||||
/* Is this a nonexistent file? If so, linkok == -1. */
|
||||
@@ -2516,7 +2505,7 @@ print_color_indicator (const char *name, unsigned int mode, int linkok)
|
||||
|
||||
len = strlen (name);
|
||||
name += len; /* Pointer to final \0. */
|
||||
for (ext = col_ext_list; ext != NULL; ext = ext->next)
|
||||
for (ext = color_ext_list; ext != NULL; ext = ext->next)
|
||||
{
|
||||
if ((size_t) ext->ext.len <= len
|
||||
&& strncmp (name - ext->ext.len, ext->ext.string,
|
||||
@@ -2587,7 +2576,7 @@ length_of_file_name_and_frills (const struct fileinfo *f)
|
||||
static void
|
||||
print_many_per_line (void)
|
||||
{
|
||||
struct col_info *line_fmt;
|
||||
struct column_info *line_fmt;
|
||||
int filesno; /* Index into files. */
|
||||
int row; /* Current row. */
|
||||
int max_name_length; /* Length of longest file name + frills. */
|
||||
@@ -2611,17 +2600,17 @@ print_many_per_line (void)
|
||||
|
||||
for (i = 0; i < max_cols; ++i)
|
||||
{
|
||||
if (col_info[i].valid_len)
|
||||
if (column_info[i].valid_len)
|
||||
{
|
||||
int idx = filesno / ((files_index + i) / (i + 1));
|
||||
int real_length = name_length + (idx == i ? 0 : 2);
|
||||
|
||||
if (real_length > col_info[i].col_arr[idx])
|
||||
if (real_length > column_info[i].col_arr[idx])
|
||||
{
|
||||
col_info[i].line_len += (real_length
|
||||
- col_info[i].col_arr[idx]);
|
||||
col_info[i].col_arr[idx] = real_length;
|
||||
col_info[i].valid_len = col_info[i].line_len < line_length;
|
||||
column_info[i].line_len += (real_length
|
||||
- column_info[i].col_arr[idx]);
|
||||
column_info[i].col_arr[idx] = real_length;
|
||||
column_info[i].valid_len = column_info[i].line_len < line_length;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2630,11 +2619,11 @@ print_many_per_line (void)
|
||||
/* Find maximum allowed columns. */
|
||||
for (cols = max_cols; cols > 1; --cols)
|
||||
{
|
||||
if (col_info[cols - 1].valid_len)
|
||||
if (column_info[cols - 1].valid_len)
|
||||
break;
|
||||
}
|
||||
|
||||
line_fmt = &col_info[cols - 1];
|
||||
line_fmt = &column_info[cols - 1];
|
||||
|
||||
/* Calculate the number of rows that will be in each column except possibly
|
||||
for a short column on the right. */
|
||||
@@ -2666,7 +2655,7 @@ print_many_per_line (void)
|
||||
static void
|
||||
print_horizontal (void)
|
||||
{
|
||||
struct col_info *line_fmt;
|
||||
struct column_info *line_fmt;
|
||||
int filesno;
|
||||
int max_name_length;
|
||||
int name_length;
|
||||
@@ -2689,17 +2678,17 @@ print_horizontal (void)
|
||||
|
||||
for (i = 0; i < max_cols; ++i)
|
||||
{
|
||||
if (col_info[i].valid_len)
|
||||
if (column_info[i].valid_len)
|
||||
{
|
||||
int idx = filesno % (i + 1);
|
||||
int real_length = name_length + (idx == i ? 0 : 2);
|
||||
|
||||
if (real_length > col_info[i].col_arr[idx])
|
||||
if (real_length > column_info[i].col_arr[idx])
|
||||
{
|
||||
col_info[i].line_len += (real_length
|
||||
- col_info[i].col_arr[idx]);
|
||||
col_info[i].col_arr[idx] = real_length;
|
||||
col_info[i].valid_len = col_info[i].line_len < line_length;
|
||||
column_info[i].line_len += (real_length
|
||||
- column_info[i].col_arr[idx]);
|
||||
column_info[i].col_arr[idx] = real_length;
|
||||
column_info[i].valid_len = column_info[i].line_len < line_length;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2708,11 +2697,11 @@ print_horizontal (void)
|
||||
/* Find maximum allowed columns. */
|
||||
for (cols = max_cols; cols > 1; --cols)
|
||||
{
|
||||
if (col_info[cols - 1].valid_len)
|
||||
if (column_info[cols - 1].valid_len)
|
||||
break;
|
||||
}
|
||||
|
||||
line_fmt = &col_info[cols - 1];
|
||||
line_fmt = &column_info[cols - 1];
|
||||
|
||||
pos = 0;
|
||||
|
||||
@@ -2799,6 +2788,8 @@ indent (int from, int to)
|
||||
}
|
||||
|
||||
/* Put DIRNAME/NAME into DEST, handling `.' and `/' properly. */
|
||||
/* FIXME: maybe remove this function someday. See about using a
|
||||
non-malloc'ing version of path_concat. */
|
||||
|
||||
static void
|
||||
attach (char *dest, const char *dirname, const char *name)
|
||||
@@ -2820,7 +2811,7 @@ attach (char *dest, const char *dirname, const char *name)
|
||||
}
|
||||
|
||||
static void
|
||||
init_col_info (void)
|
||||
init_column_info (void)
|
||||
{
|
||||
int i;
|
||||
int allocate = 0;
|
||||
@@ -2829,10 +2820,10 @@ init_col_info (void)
|
||||
if (max_idx == 0)
|
||||
max_idx = 1;
|
||||
|
||||
if (col_info == NULL)
|
||||
if (column_info == NULL)
|
||||
{
|
||||
col_info = (struct col_info *) xmalloc (max_idx
|
||||
* sizeof (struct col_info));
|
||||
column_info = (struct column_info *) xmalloc (max_idx
|
||||
* sizeof (struct column_info));
|
||||
allocate = 1;
|
||||
}
|
||||
|
||||
@@ -2840,14 +2831,14 @@ init_col_info (void)
|
||||
{
|
||||
int j;
|
||||
|
||||
col_info[i].valid_len = 1;
|
||||
col_info[i].line_len = (i + 1) * MIN_COLUMN_WIDTH;
|
||||
column_info[i].valid_len = 1;
|
||||
column_info[i].line_len = (i + 1) * MIN_COLUMN_WIDTH;
|
||||
|
||||
if (allocate)
|
||||
col_info[i].col_arr = (int *) xmalloc ((i + 1) * sizeof (int));
|
||||
column_info[i].col_arr = (int *) xmalloc ((i + 1) * sizeof (int));
|
||||
|
||||
for (j = 0; j <= i; ++j)
|
||||
col_info[i].col_arr[j] = MIN_COLUMN_WIDTH;
|
||||
column_info[i].col_arr[j] = MIN_COLUMN_WIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
6
src/mv.c
6
src/mv.c
@@ -195,7 +195,7 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
|
||||
copied-into-self directory, DEST (`b/b' in the example),
|
||||
and failing. */
|
||||
|
||||
dir_to_remove = dest;
|
||||
dir_to_remove = NULL;
|
||||
error (0, 0,
|
||||
_("cannot move `%s' to a subdirectory of itself, `%s'"),
|
||||
source, dest);
|
||||
@@ -308,7 +308,9 @@ movefile (char *source, char *dest, int dest_is_dir, const struct cp_options *x)
|
||||
if (new_dest == NULL)
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
fail = do_move (source, new_dest, x);
|
||||
free (new_dest);
|
||||
|
||||
/* Do not free new_dest. It may have been squirelled away by
|
||||
the remember_copied function. */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
24
src/remove.c
24
src/remove.c
@@ -51,6 +51,13 @@ typedef enum {false = 0, true = 1} bool;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* On systems with an lstat function that accepts the empty string,
|
||||
arrange to make lstat calls go through the wrapper function. */
|
||||
#if HAVE_LSTAT_EMPTY_STRING_BUG
|
||||
int rpl_lstat PARAMS((const char *, struct stat *));
|
||||
# define lstat(Name, Stat_buf) rpl_lstat(Name, Stat_buf)
|
||||
#endif
|
||||
|
||||
#ifdef D_INO_IN_DIRENT
|
||||
# define D_INO(dp) ((dp)->d_ino)
|
||||
# define ENABLE_CYCLE_CHECK
|
||||
@@ -63,10 +70,6 @@ typedef enum {false = 0, true = 1} bool;
|
||||
# define S_ISLNK(Mode) 0
|
||||
#endif
|
||||
|
||||
#define DOT_OR_DOTDOT(Basename) \
|
||||
(Basename[0] == '.' && (Basename[1] == '\0' \
|
||||
|| (Basename[1] == '.' && Basename[2] == '\0')))
|
||||
|
||||
#if defined strdupa
|
||||
# define ASSIGN_STRDUPA(DEST, S) \
|
||||
do { DEST = strdupa(S); } while (0)
|
||||
@@ -575,12 +578,15 @@ remove_cwd_entries (const struct rm_options *x)
|
||||
}
|
||||
while (dirp == NULL);
|
||||
|
||||
if (CLOSEDIR (dirp))
|
||||
if (dirp)
|
||||
{
|
||||
error (0, errno, "%s", full_filename ("."));
|
||||
status = RM_OK;
|
||||
if (CLOSEDIR (dirp))
|
||||
{
|
||||
error (0, errno, "%s", full_filename ("."));
|
||||
status = RM_ERROR;
|
||||
}
|
||||
dirp = NULL;
|
||||
}
|
||||
dirp = NULL;
|
||||
|
||||
if (ht)
|
||||
{
|
||||
@@ -766,7 +772,7 @@ remove_dir (struct File_spec *fs, int need_save_cwd, const struct rm_options *x)
|
||||
return RM_ERROR;
|
||||
}
|
||||
|
||||
return RM_OK;
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Remove the file or directory specified by FS after checking appropriate
|
||||
|
||||
@@ -340,6 +340,8 @@ xtmpfopen (const char *file)
|
||||
FILE *fp;
|
||||
int fd;
|
||||
|
||||
/* Open temporary file exclusively, to foil a common
|
||||
denial-of-service attack. */
|
||||
fd = open (file, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600);
|
||||
if (fd < 0 || (fp = fdopen (fd, "w")) == NULL)
|
||||
{
|
||||
|
||||
12
src/sys2.h
12
src/sys2.h
@@ -3,6 +3,14 @@
|
||||
more time, I'll merge the remaining things in system.h and everything
|
||||
in this file will go back there. */
|
||||
|
||||
#ifndef UID_T_MAX
|
||||
# define UID_T_MAX TYPE_MAXIMUM (uid_t)
|
||||
#endif
|
||||
|
||||
#ifndef GID_T_MAX
|
||||
# define GID_T_MAX TYPE_MAXIMUM (gid_t)
|
||||
#endif
|
||||
|
||||
#ifndef RETSIGTYPE
|
||||
# define RETSIGTYPE void
|
||||
#endif
|
||||
@@ -220,3 +228,7 @@ off_t lseek ();
|
||||
#define SAME_INODE(Stat_buf_1, Stat_buf_2) \
|
||||
((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
|
||||
&& (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
|
||||
|
||||
#define DOT_OR_DOTDOT(Basename) \
|
||||
(Basename[0] == '.' && (Basename[1] == '\0' \
|
||||
|| (Basename[1] == '.' && Basename[2] == '\0')))
|
||||
|
||||
@@ -394,6 +394,8 @@ save_stdin (FILE **g_tmp, char **g_tempfile)
|
||||
sprintf (template, "%s/tacXXXXXX", tempdir);
|
||||
tempfile = mktemp (template);
|
||||
|
||||
/* Open temporary file exclusively, to foil a common
|
||||
denial-of-service attack. */
|
||||
fd = open (tempfile, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
|
||||
if (fd == -1)
|
||||
error (EXIT_FAILURE, errno, "%s", tempfile);
|
||||
|
||||
170
src/tail.c
170
src/tail.c
@@ -31,6 +31,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "argmatch.h"
|
||||
#include "xstrtoul.h"
|
||||
#include "error.h"
|
||||
#include "safe-read.h"
|
||||
@@ -51,13 +52,30 @@
|
||||
# define BUFSIZ (512 * 8)
|
||||
#endif
|
||||
|
||||
/* FIXME: make Follow_name the default? */
|
||||
#define DEFAULT_FOLLOW_MODE Follow_descriptor
|
||||
|
||||
enum Follow_mode
|
||||
{
|
||||
/* FIXME: describe */
|
||||
follow_name,
|
||||
/* Follow the name of each file: if the file is renamed, try to reopen
|
||||
that name and track the end of the new file if/when it's recreated.
|
||||
This is useful for tracking logs that are occasionally rotated. */
|
||||
Follow_name = 1,
|
||||
|
||||
/* FIXME: describe */
|
||||
follow_descriptor,
|
||||
/* Follow each descriptor obtained upon opening a file.
|
||||
That means we'll continue to follow the end of a file even after
|
||||
it has been renamed or unlinked. */
|
||||
Follow_descriptor = 2,
|
||||
};
|
||||
|
||||
static char const *const follow_mode_string[] =
|
||||
{
|
||||
"descriptor", "name", 0
|
||||
};
|
||||
|
||||
static enum Follow_mode const follow_mode_map[] =
|
||||
{
|
||||
Follow_descriptor, Follow_name,
|
||||
};
|
||||
|
||||
struct File_spec
|
||||
@@ -81,6 +99,9 @@ struct File_spec
|
||||
/* FIXME: describe */
|
||||
unsigned int n_unchanged_stats;
|
||||
|
||||
/* FIXME: describe */
|
||||
unsigned int n_consecutive_size_changes;
|
||||
|
||||
/* FIXME: describe */
|
||||
int missing;
|
||||
};
|
||||
@@ -94,8 +115,7 @@ static int count_lines;
|
||||
|
||||
/* Whether we follow the name of each file or the file descriptor
|
||||
that is initially associated with each name. */
|
||||
/* FIXME: make follow_name the default? */
|
||||
static enum Follow_mode follow_mode;
|
||||
static enum Follow_mode follow_mode = Follow_descriptor;
|
||||
|
||||
/* If nonzero, read from the ends of all specified files until killed. */
|
||||
static int forever;
|
||||
@@ -113,7 +133,10 @@ enum header_mode
|
||||
};
|
||||
|
||||
/* FIXME: describe -- add option */
|
||||
static unsigned long max_n_unchanged_stats = 5;
|
||||
static unsigned long max_n_unchanged_stats_between_opens = 5;
|
||||
|
||||
/* FIXME: describe -- add option */
|
||||
static unsigned long max_n_consecutive_size_changes = 200;
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
@@ -132,11 +155,9 @@ static int show_version;
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"allow-missing", required_argument, NULL, CHAR_MAX + 1},
|
||||
{"allow-missing", no_argument, NULL, CHAR_MAX + 1},
|
||||
{"bytes", required_argument, NULL, 'c'},
|
||||
{"follow", no_argument, NULL, 'f'},
|
||||
{"follow-descriptor", no_argument, NULL, CHAR_MAX + 2},
|
||||
{"follow-name", no_argument, NULL, CHAR_MAX + 3},
|
||||
{"follow", optional_argument, NULL, 'f'},
|
||||
{"lines", required_argument, NULL, 'n'},
|
||||
{"quiet", no_argument, NULL, 'q'},
|
||||
{"silent", no_argument, NULL, 'q'},
|
||||
@@ -164,8 +185,9 @@ Print last 10 lines of each FILE to standard output.\n\
|
||||
With more than one FILE, precede each with a header giving the file name.\n\
|
||||
With no FILE, or when FILE is -, read standard input.\n\
|
||||
\n\
|
||||
--allow-missing FIXME\n\
|
||||
-c, --bytes=N output the last N bytes\n\
|
||||
-f, --follow output appended data as the file grows\n\
|
||||
-f, --follow[={name|descriptor}] output appended data as the file grows\n\
|
||||
-n, --lines=N output the last N lines, instead of last 10\n\
|
||||
-q, --quiet, --silent never output headers giving file names\n\
|
||||
-s, --sleep-interval=S with -f, sleep S seconds between iterations\n\
|
||||
@@ -180,6 +202,7 @@ b for 512, k for 1024, m for 1048576 (1 Meg). A first OPTION of -VALUE\n\
|
||||
or +VALUE is treated like -n VALUE or -n +VALUE unless VALUE has one of\n\
|
||||
the [bkm] suffix multipliers, in which case it is treated like -c VALUE\n\
|
||||
or -c +VALUE.\n\
|
||||
FIXME: describe name vs descriptor\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
|
||||
}
|
||||
@@ -563,7 +586,7 @@ start_lines (const char *pretty_filename, int fd, long int n_lines)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Display file FILENAME from the current position in FD to the end.
|
||||
/* Display file PRETTY_FILENAME from the current position in FD to the end.
|
||||
Return the number of bytes read from the file. */
|
||||
|
||||
static long
|
||||
@@ -593,12 +616,12 @@ dump_remainder (const char *pretty_filename, int fd)
|
||||
static void
|
||||
recheck (struct File_spec *f)
|
||||
{
|
||||
/* open/fstat the file and announce if dev/ino
|
||||
have changed */
|
||||
/* open/fstat the file and announce if dev/ino have changed */
|
||||
struct stat new_stats;
|
||||
int fd;
|
||||
int fail = 0;
|
||||
int is_stdin = (STREQ (f->name, "-"));
|
||||
int was_missing = f->missing;
|
||||
|
||||
fd = (is_stdin ? STDIN_FILENO : open (f->name, O_RDONLY));
|
||||
|
||||
@@ -609,14 +632,26 @@ recheck (struct File_spec *f)
|
||||
if (fd == -1 || fstat (fd, &new_stats) < 0)
|
||||
{
|
||||
fail = 1;
|
||||
error (0, errno, "%s", pretty_name (f));
|
||||
if (f->missing)
|
||||
{
|
||||
if (!was_missing)
|
||||
error (0, 0, "`%s' has been removed", pretty_name (f));
|
||||
else
|
||||
{
|
||||
/* say nothing... it's still missing */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error (0, errno, "%s", pretty_name (f));
|
||||
}
|
||||
}
|
||||
else if (!S_ISREG (new_stats.st_mode)
|
||||
&& !S_ISFIFO (new_stats.st_mode))
|
||||
{
|
||||
fail = 1;
|
||||
error (0, 0,
|
||||
_("%s has been replaced with a non-regular file; \
|
||||
_("`%s' has been replaced with a non-regular file; \
|
||||
cannot follow end of non-regular file"),
|
||||
pretty_name (f));
|
||||
}
|
||||
@@ -629,26 +664,36 @@ cannot follow end of non-regular file"),
|
||||
}
|
||||
else if (f->ino != new_stats.st_ino || f->dev != new_stats.st_dev)
|
||||
{
|
||||
/* Close the old one. */
|
||||
close_fd (f->fd, pretty_name (f));
|
||||
if (f->fd == -1)
|
||||
{
|
||||
error (0, 0,
|
||||
_("`%s' has appeared; following end of new file"),
|
||||
pretty_name (f));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Close the old one. */
|
||||
close_fd (f->fd, pretty_name (f));
|
||||
|
||||
/* File has been replaced (e.g., via log rotation) --
|
||||
tail the new one. */
|
||||
error (0, 0,
|
||||
_("%s has been replaced; following end of new file"),
|
||||
pretty_name (f));
|
||||
/* File has been replaced (e.g., via log rotation) --
|
||||
tail the new one. */
|
||||
error (0, 0,
|
||||
_("`%s' has been replaced; following end of new file"),
|
||||
pretty_name (f));
|
||||
}
|
||||
|
||||
f->fd = fd;
|
||||
f->size = new_stats.st_size;
|
||||
f->dev = new_stats.st_dev;
|
||||
f->ino = new_stats.st_ino;
|
||||
f->n_unchanged_stats = 0;
|
||||
f->n_consecutive_size_changes = 0;
|
||||
/* FIXME: check lseek return value */
|
||||
lseek (f->fd, new_stats.st_size, SEEK_SET);
|
||||
}
|
||||
else if (f->missing)
|
||||
{
|
||||
error (0, 0, _("%s has reappeared"), pretty_name (f));
|
||||
error (0, 0, _("`%s' has reappeared"), pretty_name (f));
|
||||
f->missing = 0;
|
||||
|
||||
f->fd = fd;
|
||||
@@ -656,6 +701,7 @@ cannot follow end of non-regular file"),
|
||||
f->dev = new_stats.st_dev;
|
||||
f->ino = new_stats.st_ino;
|
||||
f->n_unchanged_stats = 0;
|
||||
f->n_consecutive_size_changes = 0;
|
||||
/* FIXME: check lseek return value */
|
||||
lseek (f->fd, new_stats.st_size, SEEK_SET);
|
||||
}
|
||||
@@ -665,6 +711,22 @@ cannot follow end of non-regular file"),
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: describe */
|
||||
|
||||
static unsigned int
|
||||
n_live_files (const struct File_spec *f, int n_files)
|
||||
{
|
||||
int i;
|
||||
unsigned int n_live = 0;
|
||||
|
||||
for (i = 0; i < n_files; i++)
|
||||
{
|
||||
if (f[i].fd >= 0)
|
||||
++n_live;
|
||||
}
|
||||
return n_live;
|
||||
}
|
||||
|
||||
/* Tail NFILES files forever, or until killed.
|
||||
The pertinent information for each file is stored in an entry of F.
|
||||
Loop over each of them, doing an fstat to see if they have changed size,
|
||||
@@ -683,18 +745,18 @@ tail_forever (struct File_spec *f, int nfiles)
|
||||
{
|
||||
int i;
|
||||
int any_changed;
|
||||
int any_live_files;
|
||||
|
||||
any_live_files = 0;
|
||||
any_changed = 0;
|
||||
for (i = 0; i < nfiles; i++)
|
||||
{
|
||||
struct stat stats;
|
||||
|
||||
if (f[i].fd < 0 && !f[i].missing)
|
||||
continue;
|
||||
|
||||
any_live_files = 1;
|
||||
if (f[i].fd < 0)
|
||||
{
|
||||
if (f[i].missing)
|
||||
recheck (&f[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fstat (f[i].fd, &stats) < 0)
|
||||
{
|
||||
@@ -705,8 +767,9 @@ tail_forever (struct File_spec *f, int nfiles)
|
||||
|
||||
if (stats.st_size == f[i].size)
|
||||
{
|
||||
if (++f[i].n_unchanged_stats > max_n_unchanged_stats
|
||||
&& follow_mode == follow_name)
|
||||
f[i].n_consecutive_size_changes = 0;
|
||||
if (++f[i].n_unchanged_stats > max_n_unchanged_stats_between_opens
|
||||
&& follow_mode == Follow_name)
|
||||
{
|
||||
recheck (&f[i]);
|
||||
f[i].n_unchanged_stats = 0;
|
||||
@@ -715,9 +778,18 @@ tail_forever (struct File_spec *f, int nfiles)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* FIXME-now:
|
||||
Otherwise, a file that's unlinked or moved aside, yet always
|
||||
growing will never be recognized has having been renamed. */
|
||||
/* Size changed. */
|
||||
++f[i].n_consecutive_size_changes;
|
||||
|
||||
/* Ensure that a file that's unlinked or moved aside, yet always
|
||||
growing will be recognized has having been renamed. */
|
||||
if (follow_mode == Follow_name
|
||||
&& (f[i].n_consecutive_size_changes
|
||||
> max_n_consecutive_size_changes))
|
||||
{
|
||||
f[i].n_consecutive_size_changes = 0;
|
||||
recheck (&f[i]);
|
||||
}
|
||||
|
||||
/* This file has changed size. Print out what we can, and
|
||||
then keep looping. */
|
||||
@@ -746,7 +818,7 @@ tail_forever (struct File_spec *f, int nfiles)
|
||||
f[i].size += dump_remainder (pretty_name (&f[i]), f[i].fd);
|
||||
}
|
||||
|
||||
if (!any_live_files /* FIXME-now: && ! allow_missing */ )
|
||||
if (n_live_files (f, nfiles) == 0 && ! allow_missing)
|
||||
{
|
||||
error (0, 0, _("no files remaining"));
|
||||
break;
|
||||
@@ -951,6 +1023,7 @@ tail_file (struct File_spec *f, off_t n_units)
|
||||
f->dev = stats.st_dev;
|
||||
f->ino = stats.st_ino;
|
||||
f->n_unchanged_stats = 0;
|
||||
f->n_consecutive_size_changes = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1127,7 +1200,8 @@ parse_options (int argc, char **argv,
|
||||
count_lines = 1;
|
||||
forever = from_start = print_headers = 0;
|
||||
|
||||
while ((c = getopt_long (argc, argv, "c:n:fqs:v", long_options, NULL)) != -1)
|
||||
while ((c = getopt_long (argc, argv, "c:n:f::qs:v", long_options, NULL))
|
||||
!= -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
@@ -1166,20 +1240,24 @@ parse_options (int argc, char **argv,
|
||||
|
||||
case 'f':
|
||||
forever = 1;
|
||||
if (optarg == NULL)
|
||||
follow_mode = DEFAULT_FOLLOW_MODE;
|
||||
else
|
||||
{
|
||||
int i = argmatch (optarg, follow_mode_string);
|
||||
if (i < 0)
|
||||
{
|
||||
invalid_arg (_("follow mode"), optarg, i);
|
||||
usage (1);
|
||||
}
|
||||
follow_mode = follow_mode_map[i];
|
||||
}
|
||||
break;
|
||||
|
||||
case CHAR_MAX + 1:
|
||||
allow_missing = 1;
|
||||
break;
|
||||
|
||||
case CHAR_MAX + 2:
|
||||
follow_mode = follow_descriptor;
|
||||
break;
|
||||
|
||||
case CHAR_MAX + 3:
|
||||
follow_mode = follow_name;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
*header_mode = never;
|
||||
break;
|
||||
|
||||
@@ -12,7 +12,7 @@ use FileHandle;
|
||||
use File::Compare qw(compare);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
($VERSION = '$Revision: 1.5 $ ') =~ tr/[0-9].//cd;
|
||||
($VERSION = '$Revision: 1.6 $ ') =~ tr/[0-9].//cd;
|
||||
@EXPORT = qw (run_tests);
|
||||
|
||||
my $debug = $ENV{DEBUG};
|
||||
@@ -123,7 +123,7 @@ sub run_tests ($$$$$)
|
||||
return 1 if $found_duplicate;
|
||||
|
||||
# FIXME check exit status
|
||||
system ($prog, '--version');
|
||||
system ($prog, '--version') if $verbose;
|
||||
|
||||
my @junk_files;
|
||||
my $fail = 0;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.3b from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 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
|
||||
@@ -31,7 +32,7 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
@@ -187,7 +188,7 @@ check-TESTS: $(TESTS)
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE) check-TESTS
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
@@ -201,24 +202,21 @@ install: install-exec install-data all
|
||||
uninstall:
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.3b from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
@@ -32,7 +32,7 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
@@ -202,7 +202,7 @@ check-TESTS: $(TESTS)
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE) check-TESTS
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
@@ -216,24 +216,21 @@ install: install-exec install-data all
|
||||
uninstall:
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
@@ -1,40 +1,11 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
AUTOMAKE_OPTIONS = 1.3b gnits
|
||||
|
||||
##test-files-begin
|
||||
x = factor
|
||||
explicit =
|
||||
maint_gen = 1.X 1a.X 2.X 3.X 4.X a.X b.X c.X d.X e.X f.X g.X h.X i.X j.X k.X \
|
||||
l.X m.X n.X o.X p.X q.X s.X t.X u.X v.X w.X x.X y.X z.X
|
||||
run_gen = 1.O 1.E 1a.O 1a.E 2.O 2.E 3.O 3.E 4.O 4.E a.O a.E b.O b.E c.O c.E \
|
||||
d.O d.E e.O e.E f.O f.E g.O g.E h.O h.E i.O i.E j.O j.E k.O k.E l.O l.E m.O \
|
||||
m.E n.O n.E o.O o.E p.O p.E q.O q.E s.O s.E t.O t.E u.O u.E v.O v.E w.O w.E \
|
||||
x.O x.E y.O y.E z.O z.E
|
||||
##test-files-end
|
||||
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -I. -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
|
||||
check: $(maint_gen)
|
||||
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -I. -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
TESTS = basic
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
top_srcdir=$(top_srcdir) \
|
||||
srcdir=$(srcdir) \
|
||||
PERL="@PERL@" \
|
||||
PATH=../../src:$$PATH \
|
||||
PROG=factor
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.3b from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 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
|
||||
@@ -31,7 +32,7 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
@@ -85,6 +86,7 @@ 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@
|
||||
@@ -98,32 +100,19 @@ VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
l = @l@
|
||||
|
||||
x = factor
|
||||
explicit =
|
||||
maint_gen = 1.X 1a.X 2.X 3.X 4.X a.X b.X c.X d.X e.X f.X g.X h.X i.X j.X k.X \
|
||||
l.X m.X n.X o.X p.X q.X s.X t.X u.X v.X w.X x.X y.X z.X
|
||||
run_gen = 1.O 1.E 1a.O 1a.E 2.O 2.E 3.O 3.E 4.O 4.E a.O a.E b.O b.E c.O c.E \
|
||||
d.O d.E e.O e.E f.O f.E g.O g.E h.O h.E i.O i.E j.O j.E k.O k.E l.O l.E m.O \
|
||||
m.E n.O n.E o.O o.E p.O p.E q.O q.E s.O s.E t.O t.E u.O u.E v.O v.E w.O w.E \
|
||||
x.O x.E y.O y.E z.O z.E
|
||||
AUTOMAKE_OPTIONS = 1.3b gnits
|
||||
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
TESTS = basic
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
top_srcdir=$(top_srcdir) \
|
||||
srcdir=$(srcdir) \
|
||||
PERL="@PERL@" \
|
||||
PATH=../../src:$$PATH \
|
||||
PROG=factor
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SCRIPTS = $(noinst_SCRIPTS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
@@ -131,7 +120,7 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: Makefile $(SCRIPTS)
|
||||
all: Makefile
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
@@ -189,7 +178,7 @@ check-TESTS: $(TESTS)
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE) check-TESTS
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
@@ -203,24 +192,19 @@ install: install-exec install-data all
|
||||
uninstall:
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
@@ -237,21 +221,6 @@ install-data install uninstall all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -I. -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
check: $(maint_gen)
|
||||
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -I. -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
# -*-perl-*-
|
||||
package Test;
|
||||
require 5.002;
|
||||
use strict;
|
||||
|
||||
sub test_vector
|
||||
{
|
||||
my @tvec =
|
||||
(
|
||||
# test-name options input expected-output expected-return-code
|
||||
#
|
||||
['1', '9', {}, '3 3', 0],
|
||||
['1a', '7', {}, '7', 0],
|
||||
['2', '4294967291', {}, '4294967291', 0],
|
||||
['3', '4294967292', {}, '2 2 3 3 7 11 31 151 331', 0],
|
||||
['4', '4294967293', {}, '9241 464773', 0],
|
||||
|
||||
['a', '4294966201', {}, '12197 352133', 0],
|
||||
['b', '4294966339', {}, '13187 325697', 0],
|
||||
['c', '4294966631', {}, '13729 312839', 0],
|
||||
['d', '4294966457', {}, '14891 288427', 0],
|
||||
['e', '4294966759', {}, '21649 198391', 0],
|
||||
['f', '4294966573', {}, '23071 186163', 0],
|
||||
['g', '4294967101', {}, '23603 181967', 0],
|
||||
['h', '4294966519', {}, '34583 124193', 0],
|
||||
['i', '4294966561', {}, '36067 119083', 0],
|
||||
['j', '4294966901', {}, '37747 113783', 0],
|
||||
['k', '4294966691', {}, '39241 109451', 0],
|
||||
['l', '4294966969', {}, '44201 97169', 0],
|
||||
['m', '4294967099', {}, '44483 96553', 0],
|
||||
['n', '4294966271', {}, '44617 96263', 0],
|
||||
['o', '4294966789', {}, '50411 85199', 0],
|
||||
['p', '4294966189', {}, '53197 80737', 0],
|
||||
['q', '4294967213', {}, '57139 75167', 0],
|
||||
['s', '4294967071', {}, '65521 65551', 0],
|
||||
['t', '4294966194', {}, '2 3 3 3 3 3 3 3 53 97 191', 0],
|
||||
['u', '4294966272', {}, '2 2 2 2 2 2 2 2 2 2 3 23 89 683', 0],
|
||||
['v', '4294966400', {}, '2 2 2 2 2 2 2 5 5 1342177', 0],
|
||||
['w', '4294966464', {}, '2 2 2 2 2 2 3 3 3 2485513', 0],
|
||||
['x', '4294966896', {}, '2 2 2 2 3 3 3 11 607 1489', 0],
|
||||
['y', '4294966998', {}, '2 3 7 3917 26107', 0],
|
||||
['z', '-1', {}, '', 1],
|
||||
);
|
||||
|
||||
my @tv;
|
||||
my $t;
|
||||
foreach $t (@tvec)
|
||||
{
|
||||
my ($test_name, $arg, $in, $exp, $ret) = @$t;
|
||||
# Append a newline to end of each expected string.
|
||||
my $prefixed_result = ($ret == 0 ? "$arg: $exp\n" : $exp);
|
||||
push (@tv, [$test_name, $arg, $in, $prefixed_result, $ret]);
|
||||
}
|
||||
|
||||
return @tv;
|
||||
}
|
||||
|
||||
1;
|
||||
81
tests/factor/basic
Executable file
81
tests/factor/basic
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/bin/sh
|
||||
|
||||
: ${PERL=perl}
|
||||
: ${srcdir=.}
|
||||
|
||||
case "$PERL" in
|
||||
*'missing perl')
|
||||
echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test"
|
||||
exit 77
|
||||
;;
|
||||
esac
|
||||
|
||||
exec $PERL -w -I$srcdir/.. -MFetish -- - << \EOF
|
||||
require 5.003;
|
||||
use strict;
|
||||
|
||||
(my $program_name = $0) =~ s|.*/||;
|
||||
|
||||
# Turn off localisation of executable's ouput.
|
||||
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
|
||||
|
||||
my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
|
||||
|
||||
my @Tests =
|
||||
(
|
||||
['1', '9', {OUT => '3 3'}],
|
||||
['1a', '7', {OUT => '7'}],
|
||||
['2', '4294967291', {OUT => '4294967291'}],
|
||||
['3', '4294967292', {OUT => '2 2 3 3 7 11 31 151 331'}],
|
||||
['4', '4294967293', {OUT => '9241 464773'}],
|
||||
|
||||
['a', '4294966201', {OUT => '12197 352133'}],
|
||||
['b', '4294966339', {OUT => '13187 325697'}],
|
||||
['c', '4294966631', {OUT => '13729 312839'}],
|
||||
['d', '4294966457', {OUT => '14891 288427'}],
|
||||
['e', '4294966759', {OUT => '21649 198391'}],
|
||||
['f', '4294966573', {OUT => '23071 186163'}],
|
||||
['g', '4294967101', {OUT => '23603 181967'}],
|
||||
['h', '4294966519', {OUT => '34583 124193'}],
|
||||
['i', '4294966561', {OUT => '36067 119083'}],
|
||||
['j', '4294966901', {OUT => '37747 113783'}],
|
||||
['k', '4294966691', {OUT => '39241 109451'}],
|
||||
['l', '4294966969', {OUT => '44201 97169'}],
|
||||
['m', '4294967099', {OUT => '44483 96553'}],
|
||||
['n', '4294966271', {OUT => '44617 96263'}],
|
||||
['o', '4294966789', {OUT => '50411 85199'}],
|
||||
['p', '4294966189', {OUT => '53197 80737'}],
|
||||
['q', '4294967213', {OUT => '57139 75167'}],
|
||||
['s', '4294967071', {OUT => '65521 65551'}],
|
||||
['t', '4294966194', {OUT => '2 3 3 3 3 3 3 3 53 97 191'}],
|
||||
['u', '4294966272', {OUT => '2 2 2 2 2 2 2 2 2 2 3 23 89 683'}],
|
||||
['v', '4294966400', {OUT => '2 2 2 2 2 2 2 5 5 1342177'}],
|
||||
['w', '4294966464', {OUT => '2 2 2 2 2 2 3 3 3 2485513'}],
|
||||
['x', '4294966896', {OUT => '2 2 2 2 3 3 3 11 607 1489'}],
|
||||
['y', '4294966998', {OUT => '2 3 7 3917 26107'}],
|
||||
['z', '-1',
|
||||
{ERR => "$prog: `-1' is not a valid positive integer\n"
|
||||
. "Try `factor --help' for more information.\n"},
|
||||
{EXIT => 1}],
|
||||
);
|
||||
|
||||
# Prepend the command line argument and append a newline to end
|
||||
# of each expected `OUT' string.
|
||||
my $t;
|
||||
foreach $t (@Tests)
|
||||
{
|
||||
my $arg1 = $t->[1];
|
||||
my $e;
|
||||
foreach $e (@$t)
|
||||
{
|
||||
$e->{OUT} = "$arg1: $e->{OUT}\n"
|
||||
if ref $e eq 'HASH' and exists $e->{OUT};
|
||||
}
|
||||
}
|
||||
|
||||
my $save_temps = $ENV{SAVE_TEMPS};
|
||||
my $verbose = $ENV{VERBOSE};
|
||||
|
||||
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
|
||||
exit $fail;
|
||||
EOF
|
||||
@@ -1,537 +0,0 @@
|
||||
#! /bin/sh
|
||||
# This script was generated automatically by build-script.
|
||||
case $# in
|
||||
0) xx='../../src/factor';;
|
||||
*) xx="$1";;
|
||||
esac
|
||||
test "$VERBOSE" && echo=echo || echo=:
|
||||
$echo testing program: $xx
|
||||
errors=0
|
||||
test "$srcdir" || srcdir=.
|
||||
test "$VERBOSE" && $xx --version 2> /dev/null
|
||||
|
||||
# Make sure we get English translations.
|
||||
LANGUAGE=C
|
||||
export LANGUAGE
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LANG=C
|
||||
export LANG
|
||||
|
||||
$xx 9 > 1.O 2> 1.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 1 failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp 1.O $srcdir/1.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 1"; fi ;;
|
||||
1) $echo "Test 1 failed: files 1.O and $srcdir/1.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 1 may have failed." 1>&2;
|
||||
$echo The command "cmp 1.O $srcdir/1.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s 1.E || rm -f 1.E
|
||||
$xx 7 > 1a.O 2> 1a.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 1a failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp 1a.O $srcdir/1a.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 1a"; fi ;;
|
||||
1) $echo "Test 1a failed: files 1a.O and $srcdir/1a.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 1a may have failed." 1>&2;
|
||||
$echo The command "cmp 1a.O $srcdir/1a.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s 1a.E || rm -f 1a.E
|
||||
$xx 4294967291 > 2.O 2> 2.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 2 failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp 2.O $srcdir/2.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 2"; fi ;;
|
||||
1) $echo "Test 2 failed: files 2.O and $srcdir/2.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 2 may have failed." 1>&2;
|
||||
$echo The command "cmp 2.O $srcdir/2.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s 2.E || rm -f 2.E
|
||||
$xx 4294967292 > 3.O 2> 3.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 3 failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp 3.O $srcdir/3.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 3"; fi ;;
|
||||
1) $echo "Test 3 failed: files 3.O and $srcdir/3.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 3 may have failed." 1>&2;
|
||||
$echo The command "cmp 3.O $srcdir/3.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s 3.E || rm -f 3.E
|
||||
$xx 4294967293 > 4.O 2> 4.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test 4 failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp 4.O $srcdir/4.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed 4"; fi ;;
|
||||
1) $echo "Test 4 failed: files 4.O and $srcdir/4.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test 4 may have failed." 1>&2;
|
||||
$echo The command "cmp 4.O $srcdir/4.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s 4.E || rm -f 4.E
|
||||
$xx 4294966201 > a.O 2> a.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test a failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp a.O $srcdir/a.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed a"; fi ;;
|
||||
1) $echo "Test a failed: files a.O and $srcdir/a.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test a may have failed." 1>&2;
|
||||
$echo The command "cmp a.O $srcdir/a.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s a.E || rm -f a.E
|
||||
$xx 4294966339 > b.O 2> b.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test b failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp b.O $srcdir/b.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed b"; fi ;;
|
||||
1) $echo "Test b failed: files b.O and $srcdir/b.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test b may have failed." 1>&2;
|
||||
$echo The command "cmp b.O $srcdir/b.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s b.E || rm -f b.E
|
||||
$xx 4294966631 > c.O 2> c.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test c failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp c.O $srcdir/c.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed c"; fi ;;
|
||||
1) $echo "Test c failed: files c.O and $srcdir/c.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test c may have failed." 1>&2;
|
||||
$echo The command "cmp c.O $srcdir/c.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s c.E || rm -f c.E
|
||||
$xx 4294966457 > d.O 2> d.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test d failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp d.O $srcdir/d.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed d"; fi ;;
|
||||
1) $echo "Test d failed: files d.O and $srcdir/d.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test d may have failed." 1>&2;
|
||||
$echo The command "cmp d.O $srcdir/d.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s d.E || rm -f d.E
|
||||
$xx 4294966759 > e.O 2> e.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test e failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp e.O $srcdir/e.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed e"; fi ;;
|
||||
1) $echo "Test e failed: files e.O and $srcdir/e.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test e may have failed." 1>&2;
|
||||
$echo The command "cmp e.O $srcdir/e.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s e.E || rm -f e.E
|
||||
$xx 4294966573 > f.O 2> f.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test f failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp f.O $srcdir/f.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed f"; fi ;;
|
||||
1) $echo "Test f failed: files f.O and $srcdir/f.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test f may have failed." 1>&2;
|
||||
$echo The command "cmp f.O $srcdir/f.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s f.E || rm -f f.E
|
||||
$xx 4294967101 > g.O 2> g.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test g failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp g.O $srcdir/g.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed g"; fi ;;
|
||||
1) $echo "Test g failed: files g.O and $srcdir/g.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test g may have failed." 1>&2;
|
||||
$echo The command "cmp g.O $srcdir/g.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s g.E || rm -f g.E
|
||||
$xx 4294966519 > h.O 2> h.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test h failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp h.O $srcdir/h.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed h"; fi ;;
|
||||
1) $echo "Test h failed: files h.O and $srcdir/h.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test h may have failed." 1>&2;
|
||||
$echo The command "cmp h.O $srcdir/h.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s h.E || rm -f h.E
|
||||
$xx 4294966561 > i.O 2> i.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test i failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp i.O $srcdir/i.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed i"; fi ;;
|
||||
1) $echo "Test i failed: files i.O and $srcdir/i.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test i may have failed." 1>&2;
|
||||
$echo The command "cmp i.O $srcdir/i.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s i.E || rm -f i.E
|
||||
$xx 4294966901 > j.O 2> j.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test j failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp j.O $srcdir/j.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed j"; fi ;;
|
||||
1) $echo "Test j failed: files j.O and $srcdir/j.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test j may have failed." 1>&2;
|
||||
$echo The command "cmp j.O $srcdir/j.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s j.E || rm -f j.E
|
||||
$xx 4294966691 > k.O 2> k.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test k failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp k.O $srcdir/k.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed k"; fi ;;
|
||||
1) $echo "Test k failed: files k.O and $srcdir/k.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test k may have failed." 1>&2;
|
||||
$echo The command "cmp k.O $srcdir/k.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s k.E || rm -f k.E
|
||||
$xx 4294966969 > l.O 2> l.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test l failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp l.O $srcdir/l.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed l"; fi ;;
|
||||
1) $echo "Test l failed: files l.O and $srcdir/l.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test l may have failed." 1>&2;
|
||||
$echo The command "cmp l.O $srcdir/l.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s l.E || rm -f l.E
|
||||
$xx 4294967099 > m.O 2> m.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test m failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp m.O $srcdir/m.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed m"; fi ;;
|
||||
1) $echo "Test m failed: files m.O and $srcdir/m.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test m may have failed." 1>&2;
|
||||
$echo The command "cmp m.O $srcdir/m.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s m.E || rm -f m.E
|
||||
$xx 4294966271 > n.O 2> n.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test n failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp n.O $srcdir/n.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed n"; fi ;;
|
||||
1) $echo "Test n failed: files n.O and $srcdir/n.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test n may have failed." 1>&2;
|
||||
$echo The command "cmp n.O $srcdir/n.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s n.E || rm -f n.E
|
||||
$xx 4294966789 > o.O 2> o.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test o failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp o.O $srcdir/o.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed o"; fi ;;
|
||||
1) $echo "Test o failed: files o.O and $srcdir/o.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test o may have failed." 1>&2;
|
||||
$echo The command "cmp o.O $srcdir/o.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s o.E || rm -f o.E
|
||||
$xx 4294966189 > p.O 2> p.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test p failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp p.O $srcdir/p.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed p"; fi ;;
|
||||
1) $echo "Test p failed: files p.O and $srcdir/p.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test p may have failed." 1>&2;
|
||||
$echo The command "cmp p.O $srcdir/p.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s p.E || rm -f p.E
|
||||
$xx 4294967213 > q.O 2> q.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test q failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp q.O $srcdir/q.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed q"; fi ;;
|
||||
1) $echo "Test q failed: files q.O and $srcdir/q.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test q may have failed." 1>&2;
|
||||
$echo The command "cmp q.O $srcdir/q.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s q.E || rm -f q.E
|
||||
$xx 4294967071 > s.O 2> s.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test s failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp s.O $srcdir/s.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed s"; fi ;;
|
||||
1) $echo "Test s failed: files s.O and $srcdir/s.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test s may have failed." 1>&2;
|
||||
$echo The command "cmp s.O $srcdir/s.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s s.E || rm -f s.E
|
||||
$xx 4294966194 > t.O 2> t.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test t failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp t.O $srcdir/t.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed t"; fi ;;
|
||||
1) $echo "Test t failed: files t.O and $srcdir/t.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test t may have failed." 1>&2;
|
||||
$echo The command "cmp t.O $srcdir/t.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s t.E || rm -f t.E
|
||||
$xx 4294966272 > u.O 2> u.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test u failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp u.O $srcdir/u.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed u"; fi ;;
|
||||
1) $echo "Test u failed: files u.O and $srcdir/u.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test u may have failed." 1>&2;
|
||||
$echo The command "cmp u.O $srcdir/u.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s u.E || rm -f u.E
|
||||
$xx 4294966400 > v.O 2> v.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test v failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp v.O $srcdir/v.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed v"; fi ;;
|
||||
1) $echo "Test v failed: files v.O and $srcdir/v.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test v may have failed." 1>&2;
|
||||
$echo The command "cmp v.O $srcdir/v.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s v.E || rm -f v.E
|
||||
$xx 4294966464 > w.O 2> w.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test w failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp w.O $srcdir/w.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed w"; fi ;;
|
||||
1) $echo "Test w failed: files w.O and $srcdir/w.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test w may have failed." 1>&2;
|
||||
$echo The command "cmp w.O $srcdir/w.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s w.E || rm -f w.E
|
||||
$xx 4294966896 > x.O 2> x.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test x failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp x.O $srcdir/x.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed x"; fi ;;
|
||||
1) $echo "Test x failed: files x.O and $srcdir/x.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test x may have failed." 1>&2;
|
||||
$echo The command "cmp x.O $srcdir/x.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s x.E || rm -f x.E
|
||||
$xx 4294966998 > y.O 2> y.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test y failed: ../../src/factor return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp y.O $srcdir/y.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed y"; fi ;;
|
||||
1) $echo "Test y failed: files y.O and $srcdir/y.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test y may have failed." 1>&2;
|
||||
$echo The command "cmp y.O $srcdir/y.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s y.E || rm -f y.E
|
||||
$xx -1 > z.O 2> z.E
|
||||
code=$?
|
||||
if test $code != 1 ; then
|
||||
$echo "Test z failed: ../../src/factor return code $code differs from expected value 1" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp z.O $srcdir/z.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed z"; fi ;;
|
||||
1) $echo "Test z failed: files z.O and $srcdir/z.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test z may have failed." 1>&2;
|
||||
$echo The command "cmp z.O $srcdir/z.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s z.E || rm -f z.E
|
||||
if test $errors = 0 ; then
|
||||
$echo Passed all 30 tests. 1>&2
|
||||
else
|
||||
$echo Failed $errors tests. 1>&2
|
||||
fi
|
||||
test $errors = 0 || errors=1
|
||||
exit $errors
|
||||
@@ -1,9 +1,10 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.3b from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 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
|
||||
@@ -31,7 +32,7 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
@@ -182,7 +183,7 @@ check-TESTS: $(TESTS)
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE) check-TESTS
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
@@ -196,24 +197,21 @@ install: install-exec install-data all
|
||||
uninstall:
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.3b from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 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
|
||||
@@ -31,7 +32,7 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
@@ -185,7 +186,7 @@ check-TESTS: $(TESTS)
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE) check-TESTS
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
@@ -199,24 +200,21 @@ install: install-exec install-data all
|
||||
uninstall:
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
PATH=../../../src:$PATH
|
||||
tmp=t2-ln.$$
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$LN --version
|
||||
fi
|
||||
|
||||
test_failure=0
|
||||
mkdir $tmp || test_failure=1
|
||||
cd $tmp || test_failure=1
|
||||
@@ -84,6 +89,6 @@ test -f $ld || fail=1
|
||||
rm -rf $d $f $ld
|
||||
|
||||
cd ..
|
||||
rm -rf $tmp
|
||||
../../src/rm -rf $tmp
|
||||
|
||||
exit $fail
|
||||
|
||||
@@ -9,4 +9,4 @@ TESTS_ENVIRONMENT = \
|
||||
PATH=../../src:$$PATH \
|
||||
PROG=ls
|
||||
|
||||
TESTS = quoting
|
||||
TESTS = tests
|
||||
|
||||
@@ -99,7 +99,7 @@ TESTS_ENVIRONMENT = \
|
||||
PATH=../../src:$$PATH \
|
||||
PROG=ls
|
||||
|
||||
TESTS = quoting
|
||||
TESTS = tests
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
|
||||
@@ -27,6 +27,7 @@ my @Tests =
|
||||
(
|
||||
# test-name options input expected-output
|
||||
#
|
||||
# quoting tests............................................
|
||||
['q-', $q_bell, {OUT => "q\a\n"}, {EXIT => 0}],
|
||||
['q-N', '-N', $q_bell, {OUT => "q\a\n"}, {ERR => ''}],
|
||||
['q-q', '-q', $q_bell, {OUT => "q?\n"}],
|
||||
@@ -38,10 +39,16 @@ my @Tests =
|
||||
['q-qs-sh-a', '--quoting=shell-always', $q_bell, {OUT => "'q\a'\n"}],
|
||||
['q-qs-c', '--quoting=c', $q_bell, {OUT => "\"q\\a\"\n"}],
|
||||
['q-qs-esc', '--quoting=escape', $q_bell, {OUT => "q\\a\n"}],
|
||||
['q-qs-c-1', '--quoting=c',
|
||||
{IN => {"t\004" => ''}}, {OUT => "\"t\\004\"\n"}],
|
||||
|
||||
['emptydir', 'd', {OUT => ''}, $mkdir, $rmdir],
|
||||
['emptydir-x2', 'd d', {OUT => "d:\n\nd:\n"}, $mkdir, $rmdir],
|
||||
['emptydir-R', '-R d', {OUT => "d:\n"}, $mkdir, $rmdir],
|
||||
|
||||
# test `ls -R .' ............................................
|
||||
['R-dot', '--ignore="[a-ce-zA-Z]*" -R .', {OUT => ".:\nd\n\n\./d:\n"},
|
||||
$mkdir, $rmdir],
|
||||
);
|
||||
|
||||
my $save_temps = $ENV{SAVE_TEMPS};
|
||||
@@ -1,7 +1,9 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
AUTOMAKE_OPTIONS = 1.3 gnits
|
||||
|
||||
TESTS = mv-special-1 into-self into-self-2 backup-is-src i-1
|
||||
TESTS = mv-special-1 into-self into-self-2 into-self-3 backup-is-src \
|
||||
i-1 hard-link-1
|
||||
|
||||
EXTRA_DIST = $(TESTS) setup
|
||||
TESTS_ENVIRONMENT = \
|
||||
DF=../../src/df \
|
||||
@@ -12,5 +14,6 @@ TESTS_ENVIRONMENT = \
|
||||
MV=../../src/mv \
|
||||
RM=../../src/rm \
|
||||
TOUCH=../../src/touch \
|
||||
PERL="@PERL@" \
|
||||
PATH=../../src:$$PATH \
|
||||
PROG=mv
|
||||
|
||||
@@ -92,7 +92,9 @@ l = @l@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.3 gnits
|
||||
|
||||
TESTS = mv-special-1 into-self into-self-2 backup-is-src i-1
|
||||
TESTS = mv-special-1 into-self into-self-2 into-self-3 backup-is-src \
|
||||
i-1 hard-link-1
|
||||
|
||||
EXTRA_DIST = $(TESTS) setup
|
||||
TESTS_ENVIRONMENT = \
|
||||
DF=../../src/df \
|
||||
@@ -103,6 +105,7 @@ TESTS_ENVIRONMENT = \
|
||||
MV=../../src/mv \
|
||||
RM=../../src/rm \
|
||||
TOUCH=../../src/touch \
|
||||
PERL="@PERL@" \
|
||||
PATH=../../src:$$PATH \
|
||||
PROG=mv
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
|
||||
54
tests/mv/hard-link-1
Executable file
54
tests/mv/hard-link-1
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
# move a directory containing hard-linked files and
|
||||
# make sure the links are preserved
|
||||
|
||||
: ${MV=mv}
|
||||
: ${RM=rm}
|
||||
: ${MKDIR=mkdir}
|
||||
: ${LN=ln}
|
||||
: ${LS=ls}
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$MV --version
|
||||
fi
|
||||
|
||||
. $srcdir/setup
|
||||
|
||||
if test -z "$other_partition_tmpdir"; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
dir=hlink
|
||||
|
||||
framework_failure=0
|
||||
$MKDIR $dir || framework_failure=1
|
||||
> $dir/a || framework_failure=1
|
||||
$LN $dir/a $dir/b || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make sure we get English translations.
|
||||
LANGUAGE=C
|
||||
export LANGUAGE
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LANG=C
|
||||
export LANG
|
||||
|
||||
$MV $dir $other_partition_tmpdir || fail=1
|
||||
|
||||
# Display inode numbers, one per line.
|
||||
$LS -1i $other_partition_tmpdir/$dir > out || fail=1
|
||||
|
||||
# Make sure the inode numbers are the same.
|
||||
a=`sed -n 's/ a$//p' out`
|
||||
b=`sed -n 's/ b$//p' out`
|
||||
test "$a" = "$b" || fail=1
|
||||
|
||||
$RM -fr out $dir $other_partition_tmpdir
|
||||
|
||||
exit $fail
|
||||
@@ -6,6 +6,11 @@
|
||||
: ${RM=rm}
|
||||
: ${TOUCH=touch}
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$MV --version
|
||||
fi
|
||||
|
||||
dir=into-self-dir
|
||||
file=into-self-file
|
||||
|
||||
|
||||
48
tests/mv/into-self-3
Executable file
48
tests/mv/into-self-3
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
# move a directory into itself, with a twist
|
||||
|
||||
: ${MV=mv}
|
||||
: ${RM=rm}
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$MV --version
|
||||
fi
|
||||
|
||||
dir1=is3-dir1
|
||||
dir2=is3-dir2
|
||||
|
||||
framework_failure=0
|
||||
$RM -rf $dir1 $dir2 || framework_failure=1
|
||||
mkdir $dir1 $dir2 || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make sure we get English translations.
|
||||
LANGUAGE=C
|
||||
export LANGUAGE
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LANG=C
|
||||
export LANG
|
||||
|
||||
# This mv command should exit nonzero.
|
||||
$MV $dir1 $dir2 $dir2 > out 2>&1 && fail=1
|
||||
|
||||
sed \
|
||||
-e "s,$MV:,XXX:,g" \
|
||||
-e "s,$dir2,ZZZ,g" \
|
||||
out > out2
|
||||
|
||||
cat > exp <<\EOF
|
||||
XXX: cannot move `ZZZ' to a subdirectory of itself, `ZZZ/ZZZ'
|
||||
EOF
|
||||
|
||||
cmp out2 exp || fail=1
|
||||
|
||||
$RM -fr out out2 exp $dir1 $dir2
|
||||
|
||||
exit $fail
|
||||
@@ -1,9 +1,10 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.3b from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 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
|
||||
@@ -31,7 +32,7 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
@@ -225,7 +226,7 @@ check-TESTS: $(TESTS)
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE) check-TESTS
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
@@ -239,24 +240,21 @@ install: install-exec install-data all
|
||||
uninstall:
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user