mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
168 Commits
FILEUTILS-
...
FILEUTILS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9df5f7720b | ||
|
|
f2de5d5212 | ||
|
|
c5ed5e05ea | ||
|
|
7092835d3b | ||
|
|
af6d4ad6ca | ||
|
|
70cc369588 | ||
|
|
b3faf79a75 | ||
|
|
50de4d0751 | ||
|
|
60f3f576c7 | ||
|
|
05fcf7df27 | ||
|
|
d5d6d965ed | ||
|
|
d9fd3ba617 | ||
|
|
8c3df2e678 | ||
|
|
847d050688 | ||
|
|
18f381afea | ||
|
|
1128d1dffb | ||
|
|
1d54f66fd0 | ||
|
|
84226463b1 | ||
|
|
b32cecce88 | ||
|
|
99c51ad97e | ||
|
|
4c746d7a4c | ||
|
|
dc33452012 | ||
|
|
f71e656070 | ||
|
|
34c6851c4a | ||
|
|
b1dee02eb1 | ||
|
|
0335111c76 | ||
|
|
2dc33d421e | ||
|
|
0ac76a646b | ||
|
|
64003d937b | ||
|
|
936a26728a | ||
|
|
5f22e8234b | ||
|
|
0ecbb73025 | ||
|
|
fc7ceba21b | ||
|
|
c5494ca49a | ||
|
|
c94e214238 | ||
|
|
5db04594ae | ||
|
|
eb19369c84 | ||
|
|
1c49904e91 | ||
|
|
d134d00bb4 | ||
|
|
9cd6962a4a | ||
|
|
21039f0b39 | ||
|
|
ff9eed5ff5 | ||
|
|
176efa5092 | ||
|
|
1206a834dd | ||
|
|
bda1bae801 | ||
|
|
67e3d46292 | ||
|
|
3551f63a62 | ||
|
|
38d48aa7e9 | ||
|
|
94aebe4774 | ||
|
|
759da836f6 | ||
|
|
222389a6d0 | ||
|
|
621a5a5d61 | ||
|
|
1796cbe0c6 | ||
|
|
aa07786952 | ||
|
|
771ec09cd4 | ||
|
|
f9dd65cfc8 | ||
|
|
372ce8d3ce | ||
|
|
7769c416ef | ||
|
|
c077ecf83c | ||
|
|
50075bf532 | ||
|
|
b04f00f3d4 | ||
|
|
036b3bdae7 | ||
|
|
f802f28675 | ||
|
|
4a1f449cbe | ||
|
|
0d9e008da2 | ||
|
|
7902c47089 | ||
|
|
566fb840b3 | ||
|
|
3d58863d57 | ||
|
|
a595998975 | ||
|
|
c8707dcc2f | ||
|
|
4d8a95eff3 | ||
|
|
fa468393ae | ||
|
|
dd1a7723a6 | ||
|
|
0c578407e0 | ||
|
|
bce84b024a | ||
|
|
a260bc04c8 | ||
|
|
68a35b96ce | ||
|
|
a9afc5a7d0 | ||
|
|
96c183f34f | ||
|
|
b9aa56bec4 | ||
|
|
04aa739146 | ||
|
|
ac31ad442b | ||
|
|
a47deedda7 | ||
|
|
a9c3d9197f | ||
|
|
4d90b0efc9 | ||
|
|
c8ad493e6b | ||
|
|
99aa95f945 | ||
|
|
927b1d42fb | ||
|
|
b5123778b7 | ||
|
|
5c2322aacc | ||
|
|
0c7c8c2992 | ||
|
|
c8d452098b | ||
|
|
3182653495 | ||
|
|
7efcffd2e6 | ||
|
|
63324e5e7e | ||
|
|
488028199d | ||
|
|
c71815ac7b | ||
|
|
6ff905699a | ||
|
|
d3d701080b | ||
|
|
c6025b9d1e | ||
|
|
b026aa85d0 | ||
|
|
4c0b11a8e7 | ||
|
|
5ac2b8e39b | ||
|
|
5214179c29 | ||
|
|
e8ff25dd70 | ||
|
|
fc8e7363d2 | ||
|
|
022194de49 | ||
|
|
eb06f705a1 | ||
|
|
aeabe74421 | ||
|
|
46b6c26e4f | ||
|
|
919f2ce3da | ||
|
|
6cbabe63d4 | ||
|
|
1aa50fd72e | ||
|
|
6845fc7c96 | ||
|
|
84339c827f | ||
|
|
be3748ddad | ||
|
|
392a965229 | ||
|
|
5cb18377bc | ||
|
|
93c2c18a80 | ||
|
|
dd002c22fd | ||
|
|
f447e97462 | ||
|
|
3abc240e82 | ||
|
|
ff8f4dde22 | ||
|
|
f880990daf | ||
|
|
7306126ef0 | ||
|
|
305e2306be | ||
|
|
2b10e67d59 | ||
|
|
dc74b3a1e7 | ||
|
|
2f21a269fe | ||
|
|
69408d229e | ||
|
|
f05badd230 | ||
|
|
6763fa97d2 | ||
|
|
b1b10e1e40 | ||
|
|
5810f4bee5 | ||
|
|
91b5e686d5 | ||
|
|
8c096b86ef | ||
|
|
698fd02798 | ||
|
|
28bac510d9 | ||
|
|
2413369d22 | ||
|
|
091109470c | ||
|
|
9481a7bd36 | ||
|
|
2be3dc067a | ||
|
|
c4542a7e8c | ||
|
|
6c9e0d702a | ||
|
|
062906c83a | ||
|
|
2c3fa56cef | ||
|
|
346edb7361 | ||
|
|
b9c91d0570 | ||
|
|
e20a9b89d2 | ||
|
|
0baa523154 | ||
|
|
d5f7b2a2db | ||
|
|
4c05896b20 | ||
|
|
ec974f5c39 | ||
|
|
15d2e7a86b | ||
|
|
069610a0f0 | ||
|
|
5617251659 | ||
|
|
398516f242 | ||
|
|
8e1452ffea | ||
|
|
6b36a017db | ||
|
|
30d2b031ab | ||
|
|
f72f631fa0 | ||
|
|
d10b18f2b9 | ||
|
|
511cd5b6ae | ||
|
|
09282a24f6 | ||
|
|
f36a801a9a | ||
|
|
1e219d6b71 | ||
|
|
2e0f5a2bac | ||
|
|
9234f12d32 |
@@ -68,18 +68,15 @@ v = Version
|
||||
|
||||
a_host=alpha.gnu.org
|
||||
b_host=tug.org
|
||||
c_host=ftp.enst.fr
|
||||
|
||||
a_url_dir=gnu/fetish
|
||||
b_url_dir=gnu/fetish
|
||||
c_url_dir=pub/gnu/gnits/fetish
|
||||
|
||||
a_real_dir=/fs/share/ftp/gnu/fetish
|
||||
b_real_dir=/home/ftp/pub/gnu/fetish
|
||||
c_real_dir=/pub/gnu/gnits/fetish
|
||||
|
||||
url_dir_list = $(foreach x,a b c,ftp://$($(x)_host)/$($(x)_url_dir))
|
||||
real_dir_list = $(foreach x,a b c,ftp://$($(x)_host)$($(x)_real_dir))
|
||||
url_dir_list = $(foreach x,a b,ftp://$($(x)_host)/$($(x)_url_dir))
|
||||
real_dir_list = $(foreach x,a b,ftp://$($(x)_host)$($(x)_real_dir))
|
||||
|
||||
md5 = $(shell md5sum < $(distdir).tar.gz|sed 's/ -//')
|
||||
|
||||
|
||||
8
THANKS
8
THANKS
@@ -8,7 +8,7 @@ Akim Demaille: demaille@inf.enst.fr
|
||||
Alain Magloire: alain@qnx.com
|
||||
Alexey Solovyov: alekso@math.uu.se
|
||||
Andreas Jaeger: jaeger@gnu.org
|
||||
Andreas Schwab: schwab@issan.informatik.uni-dortmund.de
|
||||
Andreas Schwab: schwab@suse.de
|
||||
Andres Soolo: andres@soolo.matti.ee
|
||||
Andrew Dalke: dalke@bioreason.com
|
||||
Andrew Tridgell: tridge@samba.org
|
||||
@@ -17,6 +17,7 @@ Arne Henrik Juul: arnej@imf.unit.no
|
||||
Bauke Jan Douma: bjdouma@xs4all.nl
|
||||
Bengt Martensson: bengt@mathematik.uni-Bremen.de
|
||||
Bernd Leibing: bernd.leibing@rz.uni-ulm.de
|
||||
Bernhard Rosenkraenzer: bero@redhat.de
|
||||
Bjorn Helgaas: helgaas@rsn.hp.com
|
||||
Bob McCracken: kerouac@ravenet.com
|
||||
Bob Proulx: rwp@fc.hp.com
|
||||
@@ -48,12 +49,14 @@ Jamie Lokier: jamie@imbolc.ucc.ie
|
||||
Janos Farkas: chexum@shadow.banki.hu
|
||||
Jesse Thilo: jgt2@eecs.lehigh.edu
|
||||
Joakim Rosqvist: dvljrt@cs.umu.se
|
||||
Joe Orton: joe@orton.demon.co.uk
|
||||
Johan Danielsson: joda@pdc.kth.se
|
||||
John Bley: jbb6@acpub.duke.edu
|
||||
John Gatewood Ham: zappaman@alphabox.compsci.buu.ac.th
|
||||
John Gotts: jgotts@umich.edu
|
||||
Jürgen Fluk: louis@dachau.marco.de
|
||||
jvogel: jvogel@linkny.com
|
||||
Kalle Olavi Niemitalo: tosi@stekt.oulu.fi
|
||||
Karl Heuer: kwzh@gnu.org
|
||||
Kjetil Torgrim Homme: kjetilho@ifi.uio.no
|
||||
Larry McVoy: lm@sgi.com
|
||||
@@ -74,6 +77,7 @@ Michael ???:michael@roka.net
|
||||
Michael Veksler: mveksler@techunix.technion.ac.il
|
||||
Michael Stone: mstone@debian.org
|
||||
Miles Bader: miles@gnu.ai.mit.edu
|
||||
Nelson H. F. Beebe: beebe@math.utah.edu
|
||||
Noel Cragg: noel@red-bean.com
|
||||
Olav Morkrid: olav@funcom.com
|
||||
Per Kristian Hove: perhov@math.ntnu.no
|
||||
@@ -81,6 +85,7 @@ Peter Eriksson: peter@ifm.liu.se
|
||||
Peter Moulder: reiter@netspace.net.au
|
||||
Peter Samuelson: psamuels@sampo.creighton.edu
|
||||
Paul Eggert: eggert@twinsun.com
|
||||
Paul Slootman: paul@debian.org
|
||||
Philippe De Muyter: phdm@macqel.be
|
||||
Rainer Orth: ro@TechFak.Uni-Bielefeld.DE
|
||||
Richard Braakman: dark@xs4all.nl
|
||||
@@ -98,4 +103,5 @@ Ulrich Drepper: drepper@cygnus.com
|
||||
Vin Shelton: acs@alumni.princeton.edu
|
||||
Volker Borchert: bt@teknon.de
|
||||
Wayne Stewart: wstewa@atl.com
|
||||
Wichert Akkerman: wichert@cistron.nl
|
||||
William Bader: william@nscs.fast.net
|
||||
|
||||
@@ -300,7 +300,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
|
||||
info-am: $(INFO_DEPS)
|
||||
info: info-am
|
||||
|
||||
@@ -3041,7 +3041,7 @@ the values of the command line arguments.
|
||||
Synopsis:
|
||||
|
||||
@example
|
||||
sleep [@var{number}[smhd]]@dots{}
|
||||
sleep @var{number}[smhd]@dots{}
|
||||
@end example
|
||||
|
||||
@cindex time units
|
||||
|
||||
@@ -33,9 +33,19 @@ DISTCLEANFILES = 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
|
||||
sed \
|
||||
-e '/@IGNORE@/d' \
|
||||
-e 's/@xstat@/lstat/g' \
|
||||
-e '/_LSTAT_ONLY@/d' \
|
||||
-e '/@BEGIN_STAT_ONLY@/,/@END_STAT_ONLY@/d' \
|
||||
$(srcdir)/xstat.in > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
stat.c: xstat.in
|
||||
sed -e '/@IGNORE@/d' -e 's/@xstat@/stat/g' $(srcdir)/xstat.in > $@-t
|
||||
sed \
|
||||
-e '/@IGNORE@/d' \
|
||||
-e 's/@xstat@/stat/g' \
|
||||
-e '/_STAT_ONLY@/d' \
|
||||
-e '/@BEGIN_LSTAT_ONLY@/,/@END_LSTAT_ONLY@/d' \
|
||||
$(srcdir)/xstat.in > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
@@ -169,10 +169,10 @@ DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in TODO alloca.c \
|
||||
chown.c dup2.c error.c error.h euidaccess.c fileblocks.c fnmatch.c \
|
||||
fsusage.c ftruncate.c getdate.c getgroups.c getline.c group-member.c \
|
||||
lchown.c malloc.c memchr.c memcmp.c memcpy.c memmove.c memset.c mkdir.c \
|
||||
mktime.c mountlist.c obstack.c obstack.h realloc.c regex.c rmdir.c \
|
||||
rpmatch.c stpcpy.c strcasecmp.c strdup.c strftime.c strncasecmp.c \
|
||||
strndup.c strstr.c strtol.c strtoul.c strtoull.c strtoumax.c \
|
||||
strverscmp.c utime.c
|
||||
mktime.c mountlist.c nanosleep.c obstack.c obstack.h realloc.c regex.c \
|
||||
rmdir.c rpmatch.c stpcpy.c strcasecmp.c strdup.c strftime.c \
|
||||
strncasecmp.c strndup.c strstr.c strtol.c strtoul.c strtoull.c \
|
||||
strtoumax.c strverscmp.c utime.c
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@@ -193,8 +193,8 @@ $(DEPDIR)/lchown.Po $(DEPDIR)/long-options$U.Po $(DEPDIR)/lstat.Po \
|
||||
$(DEPDIR)/makepath$U.Po $(DEPDIR)/malloc.Po $(DEPDIR)/memchr.Po \
|
||||
$(DEPDIR)/memcmp.Po $(DEPDIR)/memcpy.Po $(DEPDIR)/memmove.Po \
|
||||
$(DEPDIR)/memset.Po $(DEPDIR)/mkdir.Po $(DEPDIR)/mktime.Po \
|
||||
$(DEPDIR)/modechange$U.Po $(DEPDIR)/mountlist.Po $(DEPDIR)/obstack.Po \
|
||||
$(DEPDIR)/path-concat$U.Po $(DEPDIR)/posixtm$U.Po \
|
||||
$(DEPDIR)/modechange$U.Po $(DEPDIR)/mountlist.Po $(DEPDIR)/nanosleep.Po \
|
||||
$(DEPDIR)/obstack.Po $(DEPDIR)/path-concat$U.Po $(DEPDIR)/posixtm$U.Po \
|
||||
$(DEPDIR)/quotearg$U.Po $(DEPDIR)/realloc.Po $(DEPDIR)/regex.Po \
|
||||
$(DEPDIR)/rmdir.Po $(DEPDIR)/rpmatch.Po $(DEPDIR)/safe-read$U.Po \
|
||||
$(DEPDIR)/same$U.Po $(DEPDIR)/save-cwd$U.Po $(DEPDIR)/savedir$U.Po \
|
||||
@@ -342,6 +342,8 @@ modechange_.c: modechange.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/modechange.c; then echo $(srcdir)/modechange.c; else echo modechange.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > modechange_.c
|
||||
mountlist_.c: mountlist.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mountlist.c; then echo $(srcdir)/mountlist.c; else echo mountlist.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > mountlist_.c
|
||||
nanosleep_.c: nanosleep.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/nanosleep.c; then echo $(srcdir)/nanosleep.c; else echo nanosleep.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > nanosleep_.c
|
||||
obstack_.c: obstack.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obstack.c; then echo $(srcdir)/obstack.c; else echo obstack.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > obstack_.c
|
||||
path-concat_.c: path-concat.c $(ANSI2KNR)
|
||||
@@ -421,13 +423,13 @@ full-write_.o getdate_.o getgroups_.o getline_.o getopt_.o getopt1_.o \
|
||||
group-member_.o hash_.o human_.o idcache_.o isdir_.o lchown_.o \
|
||||
long-options_.o lstat_.o makepath_.o malloc_.o memchr_.o memcmp_.o \
|
||||
memcpy_.o memmove_.o memset_.o mkdir_.o mktime_.o modechange_.o \
|
||||
mountlist_.o obstack_.o path-concat_.o posixtm_.o quotearg_.o \
|
||||
realloc_.o regex_.o rmdir_.o rpmatch_.o safe-read_.o same_.o \
|
||||
save-cwd_.o savedir_.o stat_.o stpcpy_.o strcasecmp_.o strdup_.o \
|
||||
strftime_.o stripslash_.o strncasecmp_.o strndup_.o strstr_.o strtol_.o \
|
||||
strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o userspec_.o utime_.o \
|
||||
version-etc_.o xgetcwd_.o xmalloc_.o xstrdup_.o xstrtol_.o xstrtoul_.o \
|
||||
xstrtoumax_.o yesno_.o : $(ANSI2KNR)
|
||||
mountlist_.o nanosleep_.o obstack_.o path-concat_.o posixtm_.o \
|
||||
quotearg_.o realloc_.o regex_.o rmdir_.o rpmatch_.o safe-read_.o \
|
||||
same_.o save-cwd_.o savedir_.o stat_.o stpcpy_.o strcasecmp_.o \
|
||||
strdup_.o strftime_.o stripslash_.o strncasecmp_.o strndup_.o strstr_.o \
|
||||
strtol_.o strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o userspec_.o \
|
||||
utime_.o version-etc_.o xgetcwd_.o xmalloc_.o xstrdup_.o xstrtol_.o \
|
||||
xstrtoul_.o xstrtoumax_.o yesno_.o : $(ANSI2KNR)
|
||||
.y.c:
|
||||
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
|
||||
if test -f y.tab.h; then \
|
||||
@@ -482,7 +484,6 @@ distdir: $(DISTFILES)
|
||||
fi; \
|
||||
done
|
||||
|
||||
|
||||
@AMDEP@include $(DEPDIR)/addext$U.Po
|
||||
@AMDEP@include $(DEPDIR)/alloca.Po
|
||||
@AMDEP@include $(DEPDIR)/argmatch$U.Po
|
||||
@@ -525,6 +526,7 @@ distdir: $(DISTFILES)
|
||||
@AMDEP@include $(DEPDIR)/mktime.Po
|
||||
@AMDEP@include $(DEPDIR)/modechange$U.Po
|
||||
@AMDEP@include $(DEPDIR)/mountlist.Po
|
||||
@AMDEP@include $(DEPDIR)/nanosleep.Po
|
||||
@AMDEP@include $(DEPDIR)/obstack.Po
|
||||
@AMDEP@include $(DEPDIR)/path-concat$U.Po
|
||||
@AMDEP@include $(DEPDIR)/posixtm$U.Po
|
||||
@@ -657,11 +659,21 @@ 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
|
||||
sed \
|
||||
-e '/@IGNORE@/d' \
|
||||
-e 's/@xstat@/lstat/g' \
|
||||
-e '/_LSTAT_ONLY@/d' \
|
||||
-e '/@BEGIN_STAT_ONLY@/,/@END_STAT_ONLY@/d' \
|
||||
$(srcdir)/xstat.in > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
stat.c: xstat.in
|
||||
sed -e '/@IGNORE@/d' -e 's/@xstat@/stat/g' $(srcdir)/xstat.in > $@-t
|
||||
sed \
|
||||
-e '/@IGNORE@/d' \
|
||||
-e 's/@xstat@/stat/g' \
|
||||
-e '/_STAT_ONLY@/d' \
|
||||
-e '/@BEGIN_LSTAT_ONLY@/,/@END_LSTAT_ONLY@/d' \
|
||||
$(srcdir)/xstat.in > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
|
||||
@@ -99,7 +99,7 @@ enum { MERam, MERpm, MER24 };
|
||||
|
||||
/* Information passed to and from the parser. */
|
||||
struct parser_control
|
||||
{
|
||||
{
|
||||
/* The input string remaining to be parsed. */
|
||||
const char *input;
|
||||
|
||||
@@ -1014,7 +1014,7 @@ get_date (const char *p, const time_t *now)
|
||||
if (! gmt)
|
||||
return -1;
|
||||
delta = pc.time_zone * 60 + difftm (gmt, &tm);
|
||||
if ((Start - delta < Start) != (delta < 0))
|
||||
if ((Start < Start - delta) != (delta < 0))
|
||||
return -1; /* time_t overflow */
|
||||
Start -= delta;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ make_path (const char *argpath,
|
||||
if (newly_created_dir)
|
||||
{
|
||||
if (verbose_fmt_string)
|
||||
fprintf (stderr, verbose_fmt_string, dirpath);
|
||||
error (0, 0, verbose_fmt_string, dirpath);
|
||||
|
||||
if ((owner != (uid_t) -1 || group != (gid_t) -1)
|
||||
&& chown (basename_dir, owner, group)
|
||||
|
||||
104
lib/nanosleep.c
Normal file
104
lib/nanosleep.c
Normal file
@@ -0,0 +1,104 @@
|
||||
/* Provide a replacement for the POSIX nanosleep function.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* written by Jim Meyering */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
/* FIXME: is including both like this kosher? */
|
||||
#include <sys/time.h>
|
||||
|
||||
static int suspended;
|
||||
int first_call = 1;
|
||||
|
||||
/* Handle SIGCONT. */
|
||||
|
||||
static void
|
||||
sighandler (int sig)
|
||||
{
|
||||
suspended = 1;
|
||||
}
|
||||
|
||||
/* FIXME: comment */
|
||||
|
||||
static void
|
||||
my_usleep (const struct timespec *ts_delay)
|
||||
{
|
||||
struct timeval tv_delay;
|
||||
tv_delay.tv_sec = ts_delay->tv_sec;
|
||||
tv_delay.tv_usec = ts_delay->tv_nsec / 1000;
|
||||
select (0, (void *) 0, (void *) 0, (void *) 0, &tv_delay);
|
||||
}
|
||||
|
||||
/* FIXME: comment */
|
||||
|
||||
int
|
||||
nanosleep (const struct timespec *requested_delay,
|
||||
struct timespec *remaining_delay)
|
||||
{
|
||||
#ifdef SA_INTERRUPT
|
||||
struct sigaction oldact, newact;
|
||||
#endif
|
||||
|
||||
suspended = 0;
|
||||
|
||||
/* set up sig handler */
|
||||
if (first_call)
|
||||
{
|
||||
#ifdef SA_INTERRUPT
|
||||
newact.sa_handler = sighandler;
|
||||
sigemptyset (&newact.sa_mask);
|
||||
newact.sa_flags = 0;
|
||||
|
||||
sigaction (SIGCONT, NULL, &oldact);
|
||||
if (oldact.sa_handler != SIG_IGN)
|
||||
sigaction (SIGCONT, &newact, NULL);
|
||||
#else
|
||||
if (signal (SIGCONT, SIG_IGN) != SIG_IGN)
|
||||
signal (SIGCONT, sighandler);
|
||||
#endif
|
||||
first_call = 0;
|
||||
}
|
||||
|
||||
my_usleep (requested_delay);
|
||||
|
||||
if (suspended)
|
||||
{
|
||||
/* Calculate time remaining. */
|
||||
/* FIXME: the code in sleep doesn't use this, so there's no
|
||||
rush to implement it. */
|
||||
|
||||
errno = EINTR;
|
||||
}
|
||||
|
||||
/* FIXME: Restore sig handler? */
|
||||
|
||||
return suspended;
|
||||
}
|
||||
@@ -493,7 +493,7 @@ my_strftime (char *s, size_t maxsize, const char *format, const struct tm *tp
|
||||
case '%':
|
||||
break;
|
||||
|
||||
case '\a': case '\b': case '\t': case '\n':
|
||||
case '\b': case '\t': case '\n':
|
||||
case '\v': case '\f': case '\r':
|
||||
case ' ': case '!': case '"': case '#': case '&': case'\'':
|
||||
case '(': case ')': case '*': case '+': case ',': case '-':
|
||||
@@ -511,10 +511,11 @@ my_strftime (char *s, size_t maxsize, const char *format, const struct tm *tp
|
||||
case 'r': case 's': case 't': case 'u': case 'v': case 'w':
|
||||
case 'x': case 'y': case 'z': case '{': case '|': case '}':
|
||||
case '~':
|
||||
/* The C Standard requires these 98 characters (plus '%') to
|
||||
/* The C Standard requires these 97 characters (plus '%', '\a') to
|
||||
be in the basic execution character set. None of these
|
||||
characters can start a multibyte sequence, so they need
|
||||
not be analyzed further. */
|
||||
not be analyzed further. Some old compilers object to
|
||||
'\a', so don't bother optimizing for it. */
|
||||
add (1, *p = *f);
|
||||
continue;
|
||||
|
||||
|
||||
66
lib/xstat.in
66
lib/xstat.in
@@ -4,7 +4,7 @@
|
||||
/* 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.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -30,6 +30,58 @@
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
@BEGIN_LSTAT_ONLY@
|
||||
|
||||
#ifdef STAT_MACROS_BROKEN
|
||||
# undef S_ISLNK
|
||||
#endif
|
||||
#if !defined(S_ISLNK) && defined(S_IFLNK)
|
||||
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
|
||||
char *xmalloc ();
|
||||
|
||||
/* lstat works different on Linux and Solaris systems. POSIX (see
|
||||
`pathname resolution' in the glossary) requires that programs like `ls'
|
||||
take into consideration the fact that FILE has a trailing slash when
|
||||
FILE is a symbolic link. On Linux systems, the lstat function already
|
||||
has the desired semantics (in treating `lstat("symlink/",sbuf)' just like
|
||||
`lstat("symlink/.",sbuf)', but on Solaris it does not.
|
||||
|
||||
If FILE has a trailing slash and specifies a symbolic link,
|
||||
then append a `.' to FILE and call lstat a second time. */
|
||||
|
||||
static int
|
||||
slash_aware_lstat (const char *file, struct stat *sbuf)
|
||||
{
|
||||
size_t len;
|
||||
char *new_file;
|
||||
|
||||
int lstat_result = lstat (file, sbuf);
|
||||
|
||||
if (lstat_result != 0 || !S_ISLNK (sbuf->st_mode))
|
||||
return lstat_result;
|
||||
|
||||
len = strlen (file);
|
||||
if (file[len - 1] != '/')
|
||||
return lstat_result;
|
||||
|
||||
/* FILE refers to a symbolic link and the name ends with a slash.
|
||||
Append a `.' to FILE and repeat the lstat call. */
|
||||
|
||||
/* Add one for the `.' we might have to append, and one more
|
||||
for the trailing NUL. */
|
||||
new_file = xmalloc (len + 1 + 1);
|
||||
memcpy (new_file, file, len);
|
||||
new_file[len] = '.';
|
||||
new_file[len + 1] = 0;
|
||||
|
||||
lstat_result = lstat (new_file, sbuf);
|
||||
free (new_file);
|
||||
|
||||
return lstat_result;
|
||||
}
|
||||
@END_LSTAT_ONLY@
|
||||
|
||||
/* This is a wrapper for @xstat@(2).
|
||||
If FILE is the empty string, fail with errno == ENOENT.
|
||||
@@ -38,6 +90,11 @@ extern int errno;
|
||||
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. */
|
||||
@BEGIN_LSTAT_ONLY@
|
||||
|
||||
/* This function also provides a version of lstat with consistent semantics
|
||||
when FILE specifies a symbolic link and has a trailing slash. */
|
||||
@END_LSTAT_ONLY@
|
||||
|
||||
int
|
||||
rpl_@xstat@ (const char *file, struct stat *sbuf)
|
||||
@@ -48,5 +105,10 @@ rpl_@xstat@ (const char *file, struct stat *sbuf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return @xstat@ (file, sbuf);
|
||||
@BEGIN_LSTAT_ONLY@
|
||||
return slash_aware_lstat (file, sbuf);
|
||||
@END_LSTAT_ONLY@
|
||||
@BEGIN_STAT_ONLY@
|
||||
return stat (file, sbuf);
|
||||
@END_STAT_ONLY@
|
||||
}
|
||||
|
||||
30
m4/ChangeLog
30
m4/ChangeLog
@@ -1,3 +1,33 @@
|
||||
1999-12-26 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* jm-macros.m4: Use it here.
|
||||
* nanosleep.m4 (jm_FUNC_NANOSLEEP): New file/macro.
|
||||
|
||||
1999-12-23 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* jm-macros.m4: Check for clock_gettime (moved from
|
||||
fileutils/configure.in)
|
||||
Check for gettimeofday.
|
||||
|
||||
1999-12-20 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* strftime.m4: Remove kludge, now that I'm using the fixed
|
||||
autoconf-2.14a-1999-12-20.
|
||||
|
||||
1999-12-19 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lstat-slash.m4: New file.
|
||||
* jm-macros.m4: Use the new macro:
|
||||
jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK.
|
||||
|
||||
1999-12-07 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* perl.m4: Require that File::Compare be available, too.
|
||||
Too many systems seem to lack it.
|
||||
|
||||
* strftime.m4: Add checks for most of the cpp macros tested in
|
||||
GNU's strftime.c. Prompted by a patch from Paul Eggert.
|
||||
|
||||
1999-11-18 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* m4/largefile.m4 (AC_SYS_LARGEFILE_FLAGS): Work around a
|
||||
|
||||
@@ -31,9 +31,11 @@ lchown.m4 \
|
||||
lcmessage.m4 \
|
||||
link-follow.m4 \
|
||||
ls-mntd-fs.m4 \
|
||||
lstat-slash.m4 \
|
||||
lstat.m4 \
|
||||
malloc.m4 \
|
||||
memcmp.m4 \
|
||||
nanosleep.m4 \
|
||||
perl.m4 \
|
||||
prereq.m4 \
|
||||
progtest.m4 \
|
||||
|
||||
@@ -131,9 +131,11 @@ lchown.m4 \
|
||||
lcmessage.m4 \
|
||||
link-follow.m4 \
|
||||
ls-mntd-fs.m4 \
|
||||
lstat-slash.m4 \
|
||||
lstat.m4 \
|
||||
malloc.m4 \
|
||||
memcmp.m4 \
|
||||
nanosleep.m4 \
|
||||
perl.m4 \
|
||||
prereq.m4 \
|
||||
progtest.m4 \
|
||||
@@ -191,7 +193,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 10
|
||||
#serial 11
|
||||
|
||||
dnl Misc type-related macros for fileutils, sh-utils, textutils.
|
||||
|
||||
@@ -30,9 +30,11 @@ AC_DEFUN(jm_MACROS,
|
||||
AC_REQUIRE([jm_FUNC_CHOWN])
|
||||
AC_REQUIRE([jm_FUNC_MKTIME])
|
||||
AC_REQUIRE([jm_FUNC_LSTAT])
|
||||
AC_REQUIRE([jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
|
||||
AC_REQUIRE([jm_FUNC_STAT])
|
||||
AC_REQUIRE([jm_FUNC_REALLOC])
|
||||
AC_REQUIRE([jm_FUNC_MALLOC])
|
||||
AC_REQUIRE([jm_FUNC_NANOSLEEP])
|
||||
AC_REQUIRE([jm_FUNC_READDIR])
|
||||
AC_REQUIRE([jm_FUNC_MEMCMP])
|
||||
AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
|
||||
@@ -62,6 +64,13 @@ AC_DEFUN(jm_MACROS,
|
||||
dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
|
||||
AC_FUNC_SETVBUF_REVERSED
|
||||
|
||||
# used by sleep and shred
|
||||
# Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
|
||||
# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
|
||||
AC_SEARCH_LIBS(clock_gettime, [rt posix4])
|
||||
AC_CHECK_FUNCS(clock_gettime)
|
||||
AC_CHECK_FUNCS(gettimeofday)
|
||||
|
||||
AM_FUNC_GETLINE
|
||||
if test $am_cv_func_working_getline != yes; then
|
||||
AC_CHECK_FUNCS(getdelim)
|
||||
|
||||
57
m4/lstat-slash.m4
Normal file
57
m4/lstat-slash.m4
Normal file
@@ -0,0 +1,57 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl FIXME: describe
|
||||
|
||||
AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK,
|
||||
[
|
||||
AC_CACHE_CHECK(
|
||||
[whether lstat dereferences a symlink specified with a trailing slash],
|
||||
jm_cv_func_lstat_dereferences_slashed_symlink,
|
||||
[
|
||||
rm -f conftest.sym conftest.file
|
||||
: > conftest.file
|
||||
if ln -s conftest.file conftest.sym; then
|
||||
AC_TRY_RUN([
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct stat sbuf;
|
||||
/* Linux will dereference the symlink and fail.
|
||||
That is better in the sense that it means we will not
|
||||
have to compile and use the lstat wrapper. */
|
||||
exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
|
||||
}
|
||||
],
|
||||
jm_cv_func_lstat_dereferences_slashed_symlink=yes,
|
||||
jm_cv_func_lstat_dereferences_slashed_symlink=no,
|
||||
dnl When crosscompiling, be pessimistic so we will end up using the
|
||||
dnl replacement version of lstat that checkes for trailing slashes
|
||||
dnl and calls lstat a second time when necessary.
|
||||
jm_cv_func_lstat_dereferences_slashed_symlink=no
|
||||
)
|
||||
else
|
||||
# If the `ln -s' command failed, then we probably don't even
|
||||
# have an lstat function.
|
||||
jm_cv_func_lstat_dereferences_slashed_symlink=no
|
||||
fi
|
||||
])
|
||||
|
||||
test $jm_cv_func_lstat_dereferences_slashed_symlink = yes \
|
||||
&& zero_one=1 \
|
||||
|| zero_one=0
|
||||
AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, $zero_one,
|
||||
[Define if lstat dereferences a symlink specified with a trailing slash])
|
||||
|
||||
if test $jm_cv_func_lstat_dereferences_slashed_symlink = no; then
|
||||
AC_SUBST(LIBOBJS)
|
||||
# Append lstat.o if it's not already in $LIBOBJS.
|
||||
case "$LIBOBJS" in
|
||||
*lstat.$ac_objext*) ;;
|
||||
*) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
34
m4/nanosleep.m4
Normal file
34
m4/nanosleep.m4
Normal file
@@ -0,0 +1,34 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl FIXME
|
||||
dnl
|
||||
|
||||
AC_DEFUN(jm_FUNC_NANOSLEEP,
|
||||
[
|
||||
AC_CACHE_CHECK([whether nanosleep works],
|
||||
jm_cv_func_nanosleep_works,
|
||||
[AC_TRY_RUN([
|
||||
# include <time.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct timespec ts_sleep, ts_remaining;
|
||||
ts_sleep.tv_sec = 0;
|
||||
ts_sleep.tv_nsec = 1;
|
||||
exit (nanosleep (&ts_sleep, &ts_remaining) == 0 ? 0 : 1);
|
||||
}
|
||||
],
|
||||
jm_cv_func_nanosleep_works=yes,
|
||||
jm_cv_func_nanosleep_works=no,
|
||||
dnl When crosscompiling, assume the worst.
|
||||
jm_cv_func_nanosleep_works=yes)
|
||||
])
|
||||
if test $jm_cv_func_nanosleep_works = no; then
|
||||
AC_SUBST(LIBOBJS)
|
||||
LIBOBJS="$LIBOBJS nanosleep.$ac_objext"
|
||||
AC_DEFINE_UNQUOTED(nanosleep, gnu_nanosleep,
|
||||
[Define to gnu_nanosleep if the replacement function should be used.])
|
||||
fi
|
||||
])
|
||||
12
m4/perl.m4
12
m4/perl.m4
@@ -1,4 +1,4 @@
|
||||
#serial 1
|
||||
#serial 2
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl Find a new-enough version of Perl.
|
||||
@@ -24,7 +24,7 @@ AC_DEFUN(jm_PERL,
|
||||
for perl in $candidate_perl_names; do
|
||||
# Run test in a subshell; some versions of sh will print an error if
|
||||
# an executable is not found, even if stderr is redirected.
|
||||
if ( $perl -e 'require 5.003' ) > /dev/null 2>&1; then
|
||||
if ( $perl -e 'require 5.003; use File::Compare' ) > /dev/null 2>&1; then
|
||||
PERL=$perl
|
||||
found=yes
|
||||
break
|
||||
@@ -33,7 +33,9 @@ AC_DEFUN(jm_PERL,
|
||||
|
||||
AC_MSG_RESULT($found)
|
||||
test $found = no && AC_MSG_WARN([
|
||||
*** You don't seem to have perl5.003 or newer installed.
|
||||
*** Because of that, you may be unable to regenerate certain files
|
||||
*** if you modify the sources from which they are derived.] )
|
||||
*** You don't seem to have perl5.003 or newer installed, or you lack
|
||||
*** a usable version of the Perl File::Compare module. As a result,
|
||||
*** you may be unable to run a few tests or to regenerate certain
|
||||
*** files if you modify the sources from which they are derived.
|
||||
] )
|
||||
])
|
||||
|
||||
@@ -1,14 +1,25 @@
|
||||
#serial 6
|
||||
#serial 8
|
||||
|
||||
dnl This macro is intended to be used solely in this file.
|
||||
dnl These are the prerequisite macros for GNU's strftime.c replacement.
|
||||
dnl FIXME: the list is far from complete
|
||||
AC_DEFUN(_jm_STRFTIME_PREREQS,
|
||||
[
|
||||
dnl strftime.c uses localtime_r if it exists. Check for it.
|
||||
AC_CHECK_FUNCS(localtime_r)
|
||||
dnl FIXME: add tests for everything in strftime.c: e.g., HAVE_BCOPY,
|
||||
dnl HAVE_TZNAME, HAVE_TZSET, HAVE_TM_ZONE, etc.
|
||||
|
||||
AC_CHECK_HEADERS(limits.h)
|
||||
AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
|
||||
|
||||
# This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
|
||||
AC_STRUCT_TIMEZONE
|
||||
|
||||
AC_CHECK_FUNCS(mblen mbrlen)
|
||||
|
||||
AC_CHECK_MEMBER(struct tm.tm_gmtoff,
|
||||
[AC_DEFINE(HAVE_TM_GMTOFF, 1,
|
||||
[Define if struct tm has the tm_gmtoff member.])],
|
||||
,
|
||||
[#include <time.h>])
|
||||
])
|
||||
|
||||
dnl Determine if the strftime function has all the features of the GNU one.
|
||||
|
||||
@@ -1,5 +1,206 @@
|
||||
2000-01-02 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 4.0m.
|
||||
|
||||
* src/mv.c: New option: --strip-trailing-slashes.
|
||||
|
||||
1999-11-18 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/strftime.c (my_strftime): Some old compilers object to
|
||||
'\a', so don't bother optimizing for it.
|
||||
|
||||
2000-01-01 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Fix bug: `df PATH' sometimes misbehaves when there is an
|
||||
inaccessible mount point unrelated to PATH.
|
||||
* configure.in (AC_CHECK_FUNCS): Add realpath, resolvepath.
|
||||
* src/df.c (#pragma alloca): Add if _AIX is defined.
|
||||
(path-concat.h): Include.
|
||||
(show_point): If HAVE_REALPATH or HAVE_RESOLVEPATH is defined,
|
||||
find the real absolute path for PATH, and use that to find the
|
||||
mount point.
|
||||
|
||||
(show_point): Prefer non-dummy entries in shortcuts, too.
|
||||
Disable bogus mount dirs instead of restatting them each time.
|
||||
|
||||
1999-12-30 Jim Meyering <meyering@ascend.com>
|
||||
1999-12-17 Kalle Olavi Niemitalo <tosi@stekt.oulu.fi>
|
||||
|
||||
* src/rmdir.c (remove_parents, main): Don't pass errno to error
|
||||
when printing "removing directory" message. Failure of rmdir is
|
||||
handled elsewhere.
|
||||
|
||||
1999-12-23 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in: Remove clock_gettime tests.
|
||||
Now they're in m4/jm-macros.m4.
|
||||
|
||||
* src/ln.c (usage): Correct typos.
|
||||
List new --target-directory=... usage.
|
||||
Reported by Göran Uddeborg
|
||||
|
||||
* src/mv.c (usage): List new --target-directory=... usage.
|
||||
|
||||
1999-12-22 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/getdate.y (get_date): Fix typo in time_t overflow test.
|
||||
From Michael Stone.
|
||||
|
||||
1999-12-21 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* tests/shred/remove: Use $file, not $tmp/file. Exit 77 if run as
|
||||
root.
|
||||
|
||||
1999-12-20 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/df.c (ceil_percent): Remove.
|
||||
(show_dev): Avoid overflow problems when calculating percent.
|
||||
Do not display negative percents.
|
||||
|
||||
1999-12-19 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 4.0l.
|
||||
|
||||
* doc/fileutils.texi: Clarify and combine descriptions of -c and of
|
||||
--time=ctime.
|
||||
Likewise for -u/--time=atime.
|
||||
|
||||
* src/ls.c [! LSTAT_FOLLOWS_SLASHED_SYMLINK]: Use lstat wrapper.
|
||||
[Notice the new configure-time test in m4/lstat-slash.m4. ]
|
||||
(main): Back out change from 1999-02-19 that made ls remove
|
||||
trailing slashes from command line arguments to accommodate early
|
||||
versions of Linux. Now, `ls symlink-to-dir/' acts like
|
||||
`ls symlink-to-dir/.' thus following the symbolic link, as POSIX says
|
||||
it should. Suggestion from Bruno Haible and Andreas Schwab.
|
||||
|
||||
* lib/xstat.in (slash_aware_lstat): New function.
|
||||
(rpl_@xstat@): Use it.
|
||||
* lib/Makefile.am (lstat.c): Adapt rule to handle new parts of xstat.in.
|
||||
(lstat.c): Likewise.
|
||||
|
||||
Make sure ls does the right thing with symlinks and trailing slashes.
|
||||
* tests/ls/Makefile.am (TESTS): Add symlink-slash.
|
||||
* tests/ls/symlink-slash: New test, for above-fixed bug.
|
||||
|
||||
1999-12-18 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/shred.c (wipename): When repeatedly renaming a file, making the
|
||||
name shorter and shorter, skip to the next shorter length length if a
|
||||
rename fails (e.g. due to permission denied). Otherwise, this loop
|
||||
would iterate for so long that shred would appear to be stuck in an
|
||||
infinite loop for any but the shortest file names.
|
||||
Reported by Joe Orton.
|
||||
|
||||
* configure.in (AC_OUTPUT): Add tests/shred/Makefile.
|
||||
* tests/Makefile.am (SUBDIRS): Add shred.
|
||||
* tests/shred: New directory
|
||||
* tests/shred/remove: New file. Tests for the above-fixed bug.
|
||||
|
||||
1999-12-13 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/makepath.c (make_path): Consistently use `error' to output
|
||||
the verbose, `created directory ...' messages.
|
||||
Reported by Bernhard Rosenkraenzer.
|
||||
|
||||
1999-12-12 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
Move 120+ lines of stat.h-related macros from system.h (not shared)
|
||||
to sys2.h, which is shared between fileutils, sh-utils, textutils.
|
||||
* src/system.h: Move them from here...
|
||||
* src/sys2.h: ... to here.
|
||||
|
||||
* src/system.h (S_IRUSR, S_IRGRP, S_IWGRP, S_IROTH, S_IWOTH): Define
|
||||
if not defined. This was necessary on a NeXT Turbostation running
|
||||
Mach 3.3. Reported by Nelson H. F. Beebe.
|
||||
|
||||
* src/ls.c (decode_switches): If -c or -u is specified and not -l
|
||||
(or any other option that implies -l), and no sort-type was specified,
|
||||
then sort by the ctime (-c) or atime (-u). Part of this change reverts
|
||||
the 1998-01-10 delta.
|
||||
(usage): Update to reflect this change.
|
||||
Reported by Paul Slootman via Michael Stone.
|
||||
|
||||
1999-12-09 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/df.c (BLOCK_SIZE_OPTION, SYNC_OPTION, NO_SYNC_OPTION): Define
|
||||
these and use them instead of `CHAR_MAX + n'.
|
||||
* src/du.c (BLOCK_SIZE_OPTION, EXCLUDE_OPTION, MAX_DEPTH_OPTION):
|
||||
Likewise.
|
||||
* src/touch.c (TIME_OPTION): Likewise.
|
||||
* src/rmdir.c (IGNORE_FAIL_ON_NON_EMPTY_OPTION): Likewise.
|
||||
|
||||
* tests/ls/time-1: Test more of the framework (touch's -a and -m
|
||||
options) before running the actual ls test.
|
||||
|
||||
1999-12-07 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* tests/cp/cp-mv-backup: Use 1>&2 rather than `1<&-'.
|
||||
Suggestion from Volker Borchert.
|
||||
|
||||
1999-12-05 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Makefile.maint: Remove ftp.enst.fr.
|
||||
|
||||
1999-12-04 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 4.0k.
|
||||
|
||||
* tests/mv/into-self-2: Adapt to reflect this change in behavior.
|
||||
Make sure the VERSION_CONTROL envvar is not set.
|
||||
Run diff if comparison fails.
|
||||
|
||||
* src/copy.c (copy_internal): In move mode, if the rename attempt
|
||||
fails, then unlink any existing destination file. This makes a
|
||||
cross-device `mv' more consistent with the intra-device behavior.
|
||||
This change is required by POSIX to make a cross-device move act with
|
||||
semantics similar to those of the rename syscall. For example now
|
||||
`mv' can move a file onto a symlink to itself when that symlink
|
||||
is on a separate partition. With fileutils-4.0j, it would fail with
|
||||
a diagnostic saying they were the same file.
|
||||
Reported by Bruno Haible.
|
||||
|
||||
* tests/mv/to-symlink: New file. Adds test for the above.
|
||||
* tests/mv/Makefile.am (TESTS): Add to-symlink.
|
||||
|
||||
* tests/cp/cp-mv-backup (trap): Be careful to close $actual before
|
||||
removing the containing directory. Otherwise, on some systems rmdir
|
||||
fails to remove the containing directory.
|
||||
|
||||
* tests/ls/time-1: List --full-time dates upon failure.
|
||||
|
||||
1999-12-02 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* src/ls.c (check_symlink_color): New variable.
|
||||
(main): Set it if we need to check for dangling symlinks when
|
||||
displaying colors.
|
||||
(gobble_file): Check check_symlink_color instead of print_with_color.
|
||||
|
||||
1999-11-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/ls.c (usage): Shorten help for --show-control-chars.
|
||||
|
||||
1999-11-30 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
Give the right diagnostic when failing to create a file in an
|
||||
unwritable directory.
|
||||
* src/touch.c (touch): Record errno upon failed errno and use that
|
||||
saved value if a subsequent fstat, stat or utime call fails.
|
||||
Reported by Wichert Akkerman via Michael Stone.
|
||||
|
||||
1999-11-27 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
Clean up test scripts.
|
||||
* tests/mv/setup: Don't set/use DF or MKDIR. Use df and mkdir instead.
|
||||
* tests/mv/mv-special-1: Likewise for these: LS MV MKDIR MKNOD RM TOUCH
|
||||
* tests/mv/backup-is-src: Likewise for RM and MV.
|
||||
* tests/mv/hard-link-1: Likewise.
|
||||
* tests/mv/into-self: Likewise.
|
||||
* tests/mv/into-self-3: Likewise.
|
||||
|
||||
Add test for 1999-05-23 change to src/copy.c (copy_internal).
|
||||
* tests/mv/partition-perm: New file.
|
||||
* tests/mv/Makefile.am (TESTS): Add partition-perm.
|
||||
|
||||
* Version 4.0j.
|
||||
|
||||
1999-11-22 Paul Eggert <eggert@twinsun.com>
|
||||
@@ -121,7 +322,7 @@
|
||||
* tests/ln/misc: Use --b=simple, not the now-deprecated `-V simple'.
|
||||
* tests/ln/backup-1: Likewise.
|
||||
|
||||
* configure.in (AC_OUTPUT): Add tests/dd/Makefile.
|
||||
* configure.in (AC_OUTPUT): Add tests/rmdir/Makefile.
|
||||
* tests/Makefile.am (SUBDIRS): Add rmdir.
|
||||
* tests/rmdir: New directory
|
||||
* tests/rmdir/ignore: New file.
|
||||
@@ -591,7 +792,6 @@
|
||||
|
||||
1999-05-23 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
FIXME: add a test for this
|
||||
* src/copy.c (copy_internal): Don't apply the umask in move_mode.
|
||||
Otherwise, `mv' would not preserve the permissions when copying
|
||||
between partitions. Reported by David Godfrey
|
||||
|
||||
@@ -1,4 +1,23 @@
|
||||
Changes in release 4.1:
|
||||
[4.0m]
|
||||
* mv accepts new option: --strip-trailing-slashes (soon, many other
|
||||
programs will, too)
|
||||
* df no longer hangs when there is inaccessible mount point unrelated to PATH
|
||||
* rmdir --verbose no longer prints extra, bogus diagnosic upon failure
|
||||
* fix df bug that made it print bogus values in the `Use%' column.
|
||||
* touch -d once again parses dates with `hh:mm ZONE' time zone info.
|
||||
[4.0l]
|
||||
* ls -l honors a trailing slash on a symlink argument, per POSIX.
|
||||
* shred no longer appears to infloop when asked to remove files in
|
||||
unwritable directories
|
||||
* `ls -ul' and `ls -uc' sort by name once again, as they should
|
||||
[4.0k]
|
||||
* mv may now be used to move a file onto a symlink to itself when that
|
||||
symlink is on a separate partition. With fileutils-4.0j, it would
|
||||
fail with a diagnostic saying they were the same file.
|
||||
* touch would fail with the misleading diagnostic `no such file' when asked
|
||||
to create a file in an unwritable directory. Now it says something like
|
||||
`permission denied' or `read-only file system'.
|
||||
[4.0j]
|
||||
* mkdir may now be used to set special bits e.g., `mkdir -m o+t dir' works
|
||||
* touch can now change the time(s) of a file you own even if you don't have
|
||||
|
||||
@@ -1,3 +1,54 @@
|
||||
1999-12-26 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/nanosleep.c (nanosleep): New file.
|
||||
|
||||
1999-12-23 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/sleep.c (USE_CLOCK_GETTIME): Define.
|
||||
[USE_CLOCK_GETTIME]: Include sys/time.h.
|
||||
(timespec_subtract): New function.
|
||||
(clock_get_realtime): New function.
|
||||
(sighandler): Remove function.
|
||||
(main): Reimplement again, using nanosleep and clock_gettime.
|
||||
|
||||
* configure.in: Remove check for gettimeofday.
|
||||
Now it's in m4/jm-macros.m4
|
||||
|
||||
* man/Makefile.summ: Remove now-unused summaries.
|
||||
|
||||
1999-12-22 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/getdate.y (get_date): Fix typo in time_t overflow test.
|
||||
From Michael Stone.
|
||||
|
||||
* tests/date/Test.pm (regress-1): New test for the above.
|
||||
|
||||
1999-12-18 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/who.c (print_entry): Correct do_lookup test so that who
|
||||
prints whatever host information it has, even without --lookup.
|
||||
Reported by Bill Peters.
|
||||
|
||||
1999-12-12 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
Move 120+ lines of stat.h-related macros from system.h (not shared)
|
||||
to sys2.h, which is shared between fileutils, sh-utils, textutils.
|
||||
* src/system.h: Move them from here...
|
||||
* src/sys2.h: ... to here.
|
||||
|
||||
1999-11-27 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
Rewrite to allow fractional seconds and to handle SIGCONT.
|
||||
* src/sleep.c (main): Rewrite.
|
||||
(sighandler): New function.
|
||||
(apply_suffix): New function.
|
||||
(timeval_subtract): New function.
|
||||
Reported by Raul Miller.
|
||||
|
||||
* src/sleep.c (argdecode): Move definition to precede use.
|
||||
Remove prototype.
|
||||
(usage): Add elipses to show that sleep allows more than one argument.
|
||||
|
||||
1999-11-22 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/Makefile.am (DISTCLEANFILES): Add lstat.c and stat.c.
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
Changes in release 2.1
|
||||
[2.0a]
|
||||
* sleep accepts floating point arguments on command line
|
||||
* sleep continues sleeping after being suspended and continued
|
||||
* who once again prints whatever host information it has, even without --lookup
|
||||
Changes in release 2.0
|
||||
* disable stty tests (otherwise they fail) when `make check' is run via rsh
|
||||
[1.16m]
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
2000-01-01 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 2.0a.
|
||||
|
||||
* lib/Makefile.am (lstat.c): Adapt rule to handle new parts of xstat.in.
|
||||
|
||||
1999-12-12 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
Move 120+ lines of stat.h-related macros from system.h (not shared)
|
||||
to sys2.h, which is shared between fileutils, sh-utils, textutils.
|
||||
* src/system.h: Move them from here...
|
||||
* src/sys2.h: ... to here.
|
||||
|
||||
1999-12-09 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add Galician (gl).
|
||||
|
||||
1999-12-06 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* tests/tail-2/fflush: New test for latest change.
|
||||
* tests/tail-2/Makefile.am (TESTS): Add fflush.
|
||||
|
||||
1999-10-26 Marc Boucher <marc@mbsi.ca>
|
||||
|
||||
* src/tail.c (main): Flush stdout before switching to unbuffered mode
|
||||
and calling tail_forever. Required only on Solaris2.7 -- on other
|
||||
systems, using setvbuf to switch to unbufferd mode does the flush.
|
||||
|
||||
1999-11-22 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/Makefile.am (DISTCLEANFILES): Put $(BUILT_SOURCES) here rather
|
||||
@@ -77,6 +105,10 @@
|
||||
* man/Makefile.maint ($(man_MANS)): Remove use of --name=... option.
|
||||
* man/*.x: Include one-line summary in [NAME] section.
|
||||
* man/Makefile.summ (cat-summary): Remove now-unused file.
|
||||
* man/Makefile.am (EXTRA_DIST): Remove Makefile.summ.
|
||||
* man/Makefile.maint: Include Makefile.summ with leading `-'.
|
||||
This file is shared by fileutils and sh-utils, both of which still
|
||||
have the file (albeit nearly empty now).
|
||||
Suggestion for clean-up from Akim Demaille.
|
||||
|
||||
1999-11-01 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
26
src/copy.c
26
src/copy.c
@@ -371,6 +371,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
char *earlier_file;
|
||||
char *dst_backup = NULL;
|
||||
int fix_mode = 0;
|
||||
int rename_errno;
|
||||
|
||||
if (move_mode && rename_succeeded)
|
||||
*rename_succeeded = 0;
|
||||
@@ -428,12 +429,13 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
/* If we'll remove DST_PATH first, then this doesn't matter. */
|
||||
&& ! x->force
|
||||
|
||||
/* Allow them to be the same (and don't set `same') if
|
||||
we're in move mode and the target is a symlink
|
||||
on the same partition. */
|
||||
/* Allow them to be the same (and don't set `same') if we're
|
||||
in move mode and the target is a symlink. That is ok, since
|
||||
we remove any existing destination file before opening it --
|
||||
via `rename' if they're on the same file system,
|
||||
via `unlink(DST_PATH)' otherwise. */
|
||||
&& !(move_mode
|
||||
&& S_ISLNK (dst_sb.st_mode)
|
||||
&& src_sb.st_dev == dst_sb.st_dev)
|
||||
&& S_ISLNK (dst_sb.st_mode))
|
||||
|
||||
/* If we're making a backup, we'll detect the problem case in
|
||||
copy_reg because SRC_PATH will no longer exist. Allowing
|
||||
@@ -656,6 +658,20 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
|
||||
/* Ignore other types of failure (e.g. EXDEV), since the following
|
||||
code will try to perform a copy, then remove. */
|
||||
|
||||
/* Save this value of errno to use in case the unlink fails. */
|
||||
rename_errno = errno;
|
||||
|
||||
/* The rename attempt has failed. Remove any existing destination
|
||||
file so that a cross-device `mv' acts as if it were really using
|
||||
the rename syscall. */
|
||||
if (unlink (dst_path) && errno != ENOENT)
|
||||
{
|
||||
/* Use the value of errno from the failed rename. */
|
||||
error (0, rename_errno, _("cannot move `%s' to `%s'"),
|
||||
src_path, dst_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (S_ISDIR (src_type))
|
||||
|
||||
4
src/cp.c
4
src/cp.c
@@ -60,7 +60,7 @@ struct dir_attr
|
||||
enum
|
||||
{
|
||||
TARGET_DIRECTORY_OPTION = CHAR_MAX + 1,
|
||||
SPARSE_OPTION = CHAR_MAX + 2
|
||||
SPARSE_OPTION
|
||||
};
|
||||
|
||||
int stat ();
|
||||
@@ -151,7 +151,7 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
|
||||
-R, --recursive copy directories recursively\n\
|
||||
-s, --symbolic-link make symbolic links instead of copying\n\
|
||||
-S, --suffix=SUFFIX override the usual backup suffix\n\
|
||||
--target-directory=DIR move all SOURCE arguments into directory DIR\n\
|
||||
--target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY\n\
|
||||
-u, --update copy only when the SOURCE file is newer\n\
|
||||
than the destination file or when the\n\
|
||||
destination file is missing\n\
|
||||
|
||||
224
src/df.c
224
src/df.c
@@ -1,5 +1,5 @@
|
||||
/* df - summarize free disk space
|
||||
Copyright (C) 91, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 91, 1995-2000 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -19,6 +19,10 @@
|
||||
--human-readable and --megabyte options added by lm@sgi.com.
|
||||
--si and large file support added by eggert@twinsun.com. */
|
||||
|
||||
#ifdef _AIX
|
||||
#pragma alloca
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
@@ -34,6 +38,7 @@
|
||||
#include "fsusage.h"
|
||||
#include "human.h"
|
||||
#include "mountlist.h"
|
||||
#include "path-concat.h"
|
||||
#include "save-cwd.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
@@ -110,10 +115,19 @@ static struct mount_entry *mount_list;
|
||||
/* If nonzero, print filesystem type as well. */
|
||||
static int print_type;
|
||||
|
||||
/* For long options that have no equivalent short option, use a
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
{
|
||||
SYNC_OPTION = CHAR_MAX + 1,
|
||||
NO_SYNC_OPTION,
|
||||
BLOCK_SIZE_OPTION
|
||||
};
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"all", no_argument, NULL, 'a'},
|
||||
{"block-size", required_argument, NULL, CHAR_MAX + 3},
|
||||
{"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
|
||||
{"inodes", no_argument, NULL, 'i'},
|
||||
{"human-readable", no_argument, NULL, 'h'},
|
||||
{"si", no_argument, NULL, 'H'},
|
||||
@@ -122,8 +136,8 @@ static struct option const long_options[] =
|
||||
{"megabytes", no_argument, NULL, 'm'},
|
||||
{"portability", no_argument, NULL, 'P'},
|
||||
{"print-type", no_argument, NULL, 'T'},
|
||||
{"sync", no_argument, NULL, CHAR_MAX + 1},
|
||||
{"no-sync", no_argument, NULL, CHAR_MAX + 2},
|
||||
{"sync", no_argument, NULL, SYNC_OPTION},
|
||||
{"no-sync", no_argument, NULL, NO_SYNC_OPTION},
|
||||
{"type", required_argument, NULL, 't'},
|
||||
{"exclude-type", required_argument, NULL, 'x'},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
@@ -218,31 +232,6 @@ df_readable (int negative, uintmax_t n, char *buf,
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the ceiling of N * 100 / D. Avoid the ceil function, so that
|
||||
we needn't link the math library. */
|
||||
static double
|
||||
ceil_percent (uintmax_t n, uintmax_t d)
|
||||
{
|
||||
if (n <= (uintmax_t) -1 / 100)
|
||||
{
|
||||
uintmax_t n100 = n * 100;
|
||||
return n100 / d + (n100 % d != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Avoid integer overflow. We should use multiple precision
|
||||
arithmetic here, but we'll be lazy and resort to floating
|
||||
point. This can yield answers that are slightly off. In
|
||||
practice it is quite rare to overflow uintmax_t, so this is
|
||||
good enough for now. */
|
||||
double pct = n * 100.0 / d;
|
||||
double ipct = (int) pct;
|
||||
if (ipct - 1 < pct && pct <= ipct + 1)
|
||||
pct = ipct + (ipct < pct);
|
||||
return pct;
|
||||
}
|
||||
}
|
||||
|
||||
/* Display a space listing for the disk device with absolute path DISK.
|
||||
If MOUNT_POINT is non-NULL, it is the path of the root of the
|
||||
filesystem on DISK.
|
||||
@@ -268,7 +257,7 @@ show_dev (const char *disk, const char *mount_point, const char *fstype,
|
||||
uintmax_t available_to_root;
|
||||
uintmax_t used;
|
||||
int negate_used;
|
||||
uintmax_t nonroot_total;
|
||||
double pct = -1;
|
||||
|
||||
if (me_remote && show_local_fs)
|
||||
return;
|
||||
@@ -364,15 +353,36 @@ show_dev (const char *disk, const char *mount_point, const char *fstype,
|
||||
width, df_readable (negate_available, available,
|
||||
buf[2], input_units, output_units));
|
||||
|
||||
if (used == -1 || available == -1
|
||||
|| ! (nonroot_total = ((negate_used ? - used : used)
|
||||
+ (negate_available ? - available : available))))
|
||||
printf ("%*s", use_width, "- ");
|
||||
if (used != -1 && available != -1)
|
||||
{
|
||||
/* The following floating-point calculations can suffer from
|
||||
minor rounding errors, but making them precise requires
|
||||
multiple precision arithmetic, and it's not worth the
|
||||
aggravation. */
|
||||
|
||||
double u = used;
|
||||
double a = available;
|
||||
double nonroot_total = ((negate_used ? - u : u)
|
||||
+ (negate_available ? - a : a));
|
||||
if (nonroot_total)
|
||||
{
|
||||
pct = u * 100 / nonroot_total;
|
||||
|
||||
if (posix_format)
|
||||
{
|
||||
/* Like `pct = ceil (pct);', but avoid ceil so that
|
||||
the math library needn't be linked. */
|
||||
double ipct = (long) pct;
|
||||
if (ipct - 1 < pct && pct <= ipct + 1)
|
||||
pct = ipct + (ipct < pct);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (0 <= pct)
|
||||
printf ("%*.0f%%", use_width - 1, pct);
|
||||
else
|
||||
printf ("%*.0f%%", use_width - 1,
|
||||
(posix_format
|
||||
? ceil_percent (used, nonroot_total)
|
||||
: used * 100.0 / nonroot_total));
|
||||
printf ("%*s", use_width, "- ");
|
||||
|
||||
if (mount_point)
|
||||
{
|
||||
@@ -489,6 +499,7 @@ show_point (const char *point, const struct stat *statp)
|
||||
struct stat disk_stats;
|
||||
struct mount_entry *me;
|
||||
struct mount_entry *matching_dummy = NULL;
|
||||
char *needs_freeing = NULL;
|
||||
|
||||
/* If POINT is an absolute path name, see if we can find the
|
||||
mount point without performing any extra stat calls at all. */
|
||||
@@ -498,13 +509,104 @@ show_point (const char *point, const struct stat *statp)
|
||||
{
|
||||
if (STREQ (me->me_mountdir, point))
|
||||
{
|
||||
show_dev (me->me_devname, me->me_mountdir, me->me_type,
|
||||
me->me_dummy, me->me_remote);
|
||||
return;
|
||||
/* Prefer non-dummy entries. */
|
||||
if (! me->me_dummy)
|
||||
goto show_me;
|
||||
matching_dummy = me;
|
||||
}
|
||||
}
|
||||
|
||||
if (matching_dummy)
|
||||
goto show_matching_dummy;
|
||||
}
|
||||
|
||||
#if HAVE_REALPATH || HAVE_RESOLVEPATH
|
||||
/* Calculate the real absolute path for POINT, and use that to find
|
||||
the mount point. This avoids statting unavailable mount points,
|
||||
which can hang df. */
|
||||
{
|
||||
char const *abspoint = point;
|
||||
char *resolved;
|
||||
ssize_t resolved_len;
|
||||
struct mount_entry *best_match = NULL;
|
||||
|
||||
# if HAVE_RESOLVEPATH
|
||||
/* All known hosts with resolvepath (e.g. Solaris 7) don't turn
|
||||
relative names into absolute ones, so prepend the working
|
||||
directory if the path is not absolute. */
|
||||
|
||||
if (*point != '/')
|
||||
{
|
||||
static char const *wd;
|
||||
|
||||
if (! wd)
|
||||
{
|
||||
struct stat pwd_stats;
|
||||
struct stat dot_stats;
|
||||
|
||||
/* Use PWD if it is correct; this is usually cheaper than
|
||||
xgetcwd. */
|
||||
wd = getenv ("PWD");
|
||||
if (! (wd
|
||||
&& stat (wd, &pwd_stats) == 0
|
||||
&& stat (".", &dot_stats) == 0
|
||||
&& SAME_INODE (pwd_stats, dot_stats)))
|
||||
wd = xgetcwd ();
|
||||
}
|
||||
|
||||
if (wd)
|
||||
{
|
||||
needs_freeing = path_concat (wd, point, NULL);
|
||||
if (needs_freeing)
|
||||
abspoint = needs_freeing;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
# if HAVE_RESOLVEPATH
|
||||
{
|
||||
size_t resolved_size = strlen (abspoint);
|
||||
do
|
||||
{
|
||||
resolved_size = 2 * resolved_size + 1;
|
||||
resolved = alloca (resolved_size);
|
||||
resolved_len = resolvepath (abspoint, resolved, resolved_size);
|
||||
}
|
||||
while (resolved_len == resolved_size);
|
||||
}
|
||||
# else
|
||||
resolved = alloca (PATH_MAX + 1);
|
||||
resolved = realpath (abspoint, resolved);
|
||||
resolved_len = resolved ? strlen (resolved) : -1;
|
||||
# endif
|
||||
|
||||
if (1 <= resolved_len && resolved[0] == '/')
|
||||
{
|
||||
size_t best_match_len = 0;
|
||||
|
||||
for (me = mount_list; me; me = me->me_next)
|
||||
if (! me->me_dummy)
|
||||
{
|
||||
size_t len = strlen (me->me_mountdir);
|
||||
if (best_match_len < len && len <= resolved_len
|
||||
&& (len == 1 /* root file system */
|
||||
|| ((len == resolved_len || resolved[len] == '/')
|
||||
&& strncmp (me->me_mountdir, resolved, len) == 0)))
|
||||
{
|
||||
best_match = me;
|
||||
best_match_len = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (best_match)
|
||||
{
|
||||
me = best_match;
|
||||
goto show_me;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (me = mount_list; me; me = me->me_next)
|
||||
{
|
||||
if (me->me_dev == (dev_t) -1)
|
||||
@@ -523,29 +625,22 @@ show_point (const char *point, const struct stat *statp)
|
||||
if (statp->st_dev == me->me_dev)
|
||||
{
|
||||
/* Skip bogus mtab entries. */
|
||||
if (stat (me->me_mountdir, &disk_stats) != 0 ||
|
||||
disk_stats.st_dev != me->me_dev)
|
||||
continue;
|
||||
|
||||
/* Prefer non-dummy entries. */
|
||||
if (me->me_dummy)
|
||||
if (stat (me->me_mountdir, &disk_stats) != 0
|
||||
|| disk_stats.st_dev != me->me_dev)
|
||||
{
|
||||
matching_dummy = me;
|
||||
me->me_dev = (dev_t) -2;
|
||||
continue;
|
||||
}
|
||||
|
||||
show_dev (me->me_devname, me->me_mountdir, me->me_type,
|
||||
me->me_dummy, me->me_remote);
|
||||
return;
|
||||
/* Prefer non-dummy entries. */
|
||||
if (! me->me_dummy)
|
||||
goto show_me;
|
||||
matching_dummy = me;
|
||||
}
|
||||
}
|
||||
|
||||
if (matching_dummy)
|
||||
{
|
||||
show_dev (matching_dummy->me_devname, matching_dummy->me_mountdir,
|
||||
matching_dummy->me_type, 1, matching_dummy->me_remote);
|
||||
return;
|
||||
}
|
||||
goto show_matching_dummy;
|
||||
|
||||
/* We couldn't find the mount entry corresponding to POINT. Go ahead and
|
||||
print as much info as we can; methods that require the device to be
|
||||
@@ -561,6 +656,17 @@ show_point (const char *point, const struct stat *statp)
|
||||
else
|
||||
error (0, errno, "%s", point);
|
||||
}
|
||||
|
||||
goto free_then_return;
|
||||
|
||||
show_matching_dummy:
|
||||
me = matching_dummy;
|
||||
show_me:
|
||||
show_dev (me->me_devname, me->me_mountdir, me->me_type, me->me_dummy,
|
||||
me->me_remote);
|
||||
free_then_return:
|
||||
if (needs_freeing)
|
||||
free (needs_freeing);
|
||||
}
|
||||
|
||||
/* Determine what kind of node PATH is and show the disk usage
|
||||
@@ -708,14 +814,14 @@ main (int argc, char **argv)
|
||||
case 'P':
|
||||
posix_format = 1;
|
||||
break;
|
||||
case CHAR_MAX + 1:
|
||||
case SYNC_OPTION:
|
||||
require_sync = 1;
|
||||
break;
|
||||
case CHAR_MAX + 2:
|
||||
case NO_SYNC_OPTION:
|
||||
require_sync = 0;
|
||||
break;
|
||||
|
||||
case CHAR_MAX + 3:
|
||||
case BLOCK_SIZE_OPTION:
|
||||
human_block_size (optarg, 1, &output_block_size);
|
||||
break;
|
||||
|
||||
|
||||
21
src/du.c
21
src/du.c
@@ -161,20 +161,29 @@ static struct exclude *exclude;
|
||||
/* Grand total size of all args, in units of ST_NBLOCKSIZE-byte blocks. */
|
||||
static uintmax_t tot_size = 0;
|
||||
|
||||
/* For long options that have no equivalent short option, use a
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
{
|
||||
EXCLUDE_OPTION = CHAR_MAX + 1,
|
||||
BLOCK_SIZE_OPTION,
|
||||
MAX_DEPTH_OPTION
|
||||
};
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"all", no_argument, NULL, 'a'},
|
||||
{"block-size", required_argument, 0, CHAR_MAX + 2},
|
||||
{"block-size", required_argument, 0, BLOCK_SIZE_OPTION},
|
||||
{"bytes", no_argument, NULL, 'b'},
|
||||
{"count-links", no_argument, NULL, 'l'},
|
||||
{"dereference", no_argument, NULL, 'L'},
|
||||
{"dereference-args", no_argument, NULL, 'D'},
|
||||
{"exclude", required_argument, 0, CHAR_MAX + 1},
|
||||
{"exclude", required_argument, 0, EXCLUDE_OPTION},
|
||||
{"exclude-from", required_argument, 0, 'X'},
|
||||
{"human-readable", no_argument, NULL, 'h'},
|
||||
{"si", no_argument, 0, 'H'},
|
||||
{"kilobytes", no_argument, NULL, 'k'},
|
||||
{"max-depth", required_argument, NULL, CHAR_MAX + 3},
|
||||
{"max-depth", required_argument, NULL, MAX_DEPTH_OPTION},
|
||||
{"megabytes", no_argument, NULL, 'm'},
|
||||
{"one-file-system", no_argument, NULL, 'x'},
|
||||
{"separate-dirs", no_argument, NULL, 'S'},
|
||||
@@ -695,7 +704,7 @@ main (int argc, char **argv)
|
||||
output_block_size = 1024;
|
||||
break;
|
||||
|
||||
case CHAR_MAX + 3: /* --max-depth=N */
|
||||
case MAX_DEPTH_OPTION: /* --max-depth=N */
|
||||
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long < 0 || tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid maximum depth `%s'"), optarg);
|
||||
@@ -737,11 +746,11 @@ main (int argc, char **argv)
|
||||
error (1, errno, "%s", optarg);
|
||||
break;
|
||||
|
||||
case CHAR_MAX + 1:
|
||||
case EXCLUDE_OPTION:
|
||||
add_exclude (exclude, optarg);
|
||||
break;
|
||||
|
||||
case CHAR_MAX + 2:
|
||||
case BLOCK_SIZE_OPTION:
|
||||
human_block_size (optarg, 1, &output_block_size);
|
||||
break;
|
||||
|
||||
|
||||
6
src/ln.c
6
src/ln.c
@@ -324,8 +324,9 @@ usage (int status)
|
||||
printf (_("\
|
||||
Usage: %s [OPTION]... TARGET [LINK_NAME]\n\
|
||||
or: %s [OPTION]... TARGET... DIRECTORY\n\
|
||||
or: %s [OPTION]... --target-directory=DIRECTORY TARGET...\n\
|
||||
"),
|
||||
program_name, program_name);
|
||||
program_name, program_name, program_name);
|
||||
printf (_("\
|
||||
Create a link to the specified TARGET with optional LINK_NAME. If there is\n\
|
||||
more than one TARGET, the last argument must be a directory; create links\n\
|
||||
@@ -340,7 +341,8 @@ with --symbolic. When creating hard links, each TARGET must exist.\n\
|
||||
-i, --interactive prompt whether to remove destinations\n\
|
||||
-s, --symbolic make symbolic links instead of hard links\n\
|
||||
-S, --suffix=SUFFIX override the usual backup suffix\n\
|
||||
--target-directory=DIR move all SOURCE arguments into directory DIR\n\
|
||||
--target-directory=DIRECTORY specify the DIRECTORY in which to create\n\
|
||||
the links\n\
|
||||
-v, --verbose print name of each file before linking\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
|
||||
66
src/ls.c
66
src/ls.c
@@ -143,6 +143,15 @@
|
||||
# define S_ISDOOR(Mode) 0
|
||||
#endif
|
||||
|
||||
/* Arrange to make lstat calls go through the wrapper function
|
||||
on systems with an lstat function that does not dereference symlinks
|
||||
that are specified with a trailing slash. */
|
||||
#if ! LSTAT_FOLLOWS_SLASHED_SYMLINK
|
||||
int rpl_lstat PARAMS((const char *, struct stat *));
|
||||
# undef lstat
|
||||
# define lstat(Name, Stat_buf) rpl_lstat(Name, Stat_buf)
|
||||
#endif
|
||||
|
||||
enum filetype
|
||||
{
|
||||
symbolic_link,
|
||||
@@ -202,7 +211,6 @@ time_t time ();
|
||||
|
||||
char *getgroup ();
|
||||
char *getuser ();
|
||||
void strip_trailing_slashes ();
|
||||
|
||||
static size_t quote_name PARAMS ((FILE *out, const char *name,
|
||||
struct quoting_options const *options));
|
||||
@@ -478,6 +486,11 @@ static struct color_ext_type *color_ext_list = NULL;
|
||||
/* Buffer for color sequences */
|
||||
static char *color_buf;
|
||||
|
||||
/* Nonzero means to check for orphaned symbolic link, for displaying
|
||||
colors. */
|
||||
|
||||
static int check_symlink_color;
|
||||
|
||||
/* Nonzero means mention the inode number of each file. -i */
|
||||
|
||||
static int print_inode;
|
||||
@@ -763,6 +776,11 @@ main (int argc, char **argv)
|
||||
{
|
||||
parse_ls_color ();
|
||||
prep_non_filename_text ();
|
||||
/* Avoid following symbolic links when possible. */
|
||||
if (color_indicator[C_ORPHAN].string != NULL
|
||||
|| (color_indicator[C_MISSING].string != NULL
|
||||
&& format == long_format))
|
||||
check_symlink_color = 1;
|
||||
}
|
||||
|
||||
format_needs_stat = sort_type == sort_time || sort_type == sort_size
|
||||
@@ -786,7 +804,6 @@ main (int argc, char **argv)
|
||||
dir_defaulted = 0;
|
||||
for (; i < argc; i++)
|
||||
{
|
||||
strip_trailing_slashes (argv[i]);
|
||||
gobble_file (argv[i], 1, "");
|
||||
}
|
||||
|
||||
@@ -858,6 +875,9 @@ decode_switches (int argc, char **argv)
|
||||
int i;
|
||||
long int tmp_long;
|
||||
|
||||
/* Record whether there is an option specifying sort type. */
|
||||
int sort_type_specified = 0;
|
||||
|
||||
qmark_funny_chars = 0;
|
||||
|
||||
/* initialize all switches to default settings */
|
||||
@@ -980,7 +1000,6 @@ decode_switches (int argc, char **argv)
|
||||
|
||||
case 'c':
|
||||
time_type = time_ctime;
|
||||
sort_type = sort_time;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
@@ -992,6 +1011,7 @@ decode_switches (int argc, char **argv)
|
||||
all_files = 1;
|
||||
really_all_files = 1;
|
||||
sort_type = sort_none;
|
||||
sort_type_specified = 1;
|
||||
/* disable -l */
|
||||
if (format == long_format)
|
||||
format = (isatty (STDOUT_FILENO) ? many_per_line : one_per_line);
|
||||
@@ -1054,15 +1074,16 @@ decode_switches (int argc, char **argv)
|
||||
|
||||
case 't':
|
||||
sort_type = sort_time;
|
||||
sort_type_specified = 1;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
sort_type = sort_time;
|
||||
time_type = time_atime;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
sort_type = sort_version;
|
||||
sort_type_specified = 1;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
@@ -1125,6 +1146,7 @@ decode_switches (int argc, char **argv)
|
||||
|
||||
case 'S':
|
||||
sort_type = sort_size;
|
||||
sort_type_specified = 1;
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
@@ -1137,10 +1159,12 @@ decode_switches (int argc, char **argv)
|
||||
|
||||
case 'U':
|
||||
sort_type = sort_none;
|
||||
sort_type_specified = 1;
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
sort_type = sort_extension;
|
||||
sort_type_specified = 1;
|
||||
break;
|
||||
|
||||
case '1':
|
||||
@@ -1149,6 +1173,7 @@ decode_switches (int argc, char **argv)
|
||||
|
||||
case 10: /* --sort */
|
||||
sort_type = XARGMATCH ("--sort", optarg, sort_args, sort_types);
|
||||
sort_type_specified = 1;
|
||||
break;
|
||||
|
||||
case 11: /* --time */
|
||||
@@ -1220,6 +1245,20 @@ decode_switches (int argc, char **argv)
|
||||
dirname_quoting_options = clone_quoting_options (NULL);
|
||||
set_char_quoting (dirname_quoting_options, ':', 1);
|
||||
|
||||
/* If -c or -u is specified and not -l (or any other option that implies -l),
|
||||
and no sort-type was specified, then sort by the ctime (-c) or atime (-u).
|
||||
The behavior of ls when using either -c or -u but with neither -l nor -t
|
||||
appears to be unspecified by POSIX. So, with GNU ls, `-u' alone means
|
||||
sort by atime (this is the one that's not specified by the POSIX spec),
|
||||
-lu means show atime and sort by name, -lut means show atime and sort
|
||||
by atime. */
|
||||
|
||||
if ((time_type == time_ctime || time_type == time_atime)
|
||||
&& !sort_type_specified && format != long_format)
|
||||
{
|
||||
sort_type = sort_time;
|
||||
}
|
||||
|
||||
return optind;
|
||||
}
|
||||
|
||||
@@ -1764,7 +1803,7 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
}
|
||||
|
||||
if (S_ISLNK (files[files_index].stat.st_mode)
|
||||
&& (explicit_arg || format == long_format || print_with_color))
|
||||
&& (explicit_arg || format == long_format || check_symlink_color))
|
||||
{
|
||||
char *linkpath;
|
||||
struct stat linkstats;
|
||||
@@ -1777,7 +1816,7 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
if (linkpath
|
||||
&& ((explicit_arg && format != long_format)
|
||||
|| indicator_style != none
|
||||
|| print_with_color)
|
||||
|| check_symlink_color)
|
||||
&& stat (linkpath, &linkstats) == 0)
|
||||
{
|
||||
files[files_index].linkok = 1;
|
||||
@@ -2874,7 +2913,10 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
|
||||
-b, --escape print octal escapes for nongraphic characters\n\
|
||||
--block-size=SIZE use SIZE-byte blocks\n\
|
||||
-B, --ignore-backups do not list implied entries ending with ~\n\
|
||||
-c sort by change time; with -l: show ctime\n\
|
||||
-c with -lt: sort by, and show, ctime (time of last\n\
|
||||
modification of file status information)\n\
|
||||
with -l: show ctime and sort by name\n\
|
||||
otherwise: sort by ctime\n\
|
||||
-C list entries by columns\n\
|
||||
--color[=WHEN] control whether color is used to distinguish file\n\
|
||||
types. WHEN may be `never', `always', or `auto'\n\
|
||||
@@ -2905,10 +2947,8 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
|
||||
-o use long listing format without group info\n\
|
||||
-p, --file-type append indicator (one of /=@|) to entries\n\
|
||||
-q, --hide-control-chars print ? instead of non graphic characters\n\
|
||||
(This is the default unless the output is a\n\
|
||||
terminal and the program is `ls'; otherwise,\n\
|
||||
the default is --show-control-chars)\n\
|
||||
--show-control-chars show non graphic characters as-is (default)\n\
|
||||
--show-control-chars show non graphic characters as-is (default\n\
|
||||
unless program is `ls' and output is a terminal)\n\
|
||||
-Q, --quote-name enclose entry names in double quotes\n\
|
||||
--quoting-style=WORD use quoting style WORD for entry names:\n\
|
||||
literal, locale, shell, shell-always, c, escape\n\
|
||||
@@ -2926,7 +2966,9 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
|
||||
specified time as sort key if --sort=time\n\
|
||||
-t sort by modification time\n\
|
||||
-T, --tabsize=COLS assume tab stops at each COLS instead of 8\n\
|
||||
-u sort by last access time; with -l: show atime\n\
|
||||
-u with -lt: sort by, and show, access time\n\
|
||||
with -l: show access time and sort by name\n\
|
||||
otherwise: sort by access time\n\
|
||||
-U do not sort; list entries in directory order\n\
|
||||
-v sort by version\n\
|
||||
-w, --width=COLS assume screen width instead of current value\n\
|
||||
|
||||
28
src/mv.c
28
src/mv.c
@@ -1,5 +1,5 @@
|
||||
/* mv -- move or rename files
|
||||
Copyright (C) 86, 89, 90, 91, 1995-1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 86, 89, 90, 91, 1995-2000 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -70,7 +70,8 @@
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
{
|
||||
TARGET_DIRECTORY_OPTION = CHAR_MAX + 1
|
||||
TARGET_DIRECTORY_OPTION = CHAR_MAX + 1,
|
||||
STRIP_TRAILING_SLASHES_OPTION
|
||||
};
|
||||
|
||||
int euidaccess ();
|
||||
@@ -82,11 +83,14 @@ int yesno ();
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
static int remove_trailing_slashes;
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"backup", optional_argument, NULL, 'b'},
|
||||
{"force", no_argument, NULL, 'f'},
|
||||
{"interactive", no_argument, NULL, 'i'},
|
||||
{"strip-trailing-slash", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION},
|
||||
{"suffix", required_argument, NULL, 'S'},
|
||||
{"target-directory", required_argument, NULL, TARGET_DIRECTORY_OPTION},
|
||||
{"update", no_argument, NULL, 'u'},
|
||||
@@ -288,6 +292,16 @@ movefile (char *source, char *dest, int dest_is_dir,
|
||||
int dest_had_trailing_slash = strip_trailing_slashes_2 (dest);
|
||||
int fail;
|
||||
|
||||
/* This code was introduced to handle the ambiguity in the semantics
|
||||
of mv that is induced by the varying semantics of the rename function.
|
||||
Some systems (e.g., Linux) have a rename function that honors a
|
||||
trailing slash, while others (like Solaris 5,6,7) have a rename
|
||||
function that ignores a trailing slash. I believe the Linux
|
||||
rename semantics are POSIX and susv2 compliant. */
|
||||
|
||||
if (remove_trailing_slashes)
|
||||
strip_trailing_slashes_2 (source);
|
||||
|
||||
/* In addition to when DEST is a directory, if DEST has a trailing
|
||||
slash and neither SOURCE nor DEST is a directory, presume the target
|
||||
is DEST/`basename source`. This converts `mv x y/' to `mv x y/x'.
|
||||
@@ -333,16 +347,19 @@ usage (int status)
|
||||
printf (_("\
|
||||
Usage: %s [OPTION]... SOURCE DEST\n\
|
||||
or: %s [OPTION]... SOURCE... DIRECTORY\n\
|
||||
or: %s [OPTION]... --target-directory=DIRECTORY SOURCE...\n\
|
||||
"),
|
||||
program_name, program_name);
|
||||
program_name, program_name, program_name);
|
||||
printf (_("\
|
||||
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n\
|
||||
\n\
|
||||
-b, --backup[=CONTROL] make backup before removal\n\
|
||||
-f, --force remove existing destinations, never prompt\n\
|
||||
-i, --interactive prompt before overwrite\n\
|
||||
--strip-trailing-slashes remove any trailing slashes from each SOURCE\n\
|
||||
argument\n\
|
||||
-S, --suffix=SUFFIX override the usual backup suffix\n\
|
||||
--target-directory=DIR move all SOURCE arguments into directory DIR\n\
|
||||
--target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY\n\
|
||||
-u, --update move only older or brand new non-directories\n\
|
||||
-v, --verbose explain what is being done\n\
|
||||
--help display this help and exit\n\
|
||||
@@ -420,6 +437,9 @@ main (int argc, char **argv)
|
||||
x.interactive = 1;
|
||||
x.force = 0;
|
||||
break;
|
||||
case STRIP_TRAILING_SLASHES_OPTION:
|
||||
remove_trailing_slashes = 1;
|
||||
break;
|
||||
case TARGET_DIRECTORY_OPTION:
|
||||
target_directory = optarg;
|
||||
break;
|
||||
|
||||
16
src/rmdir.c
16
src/rmdir.c
@@ -58,11 +58,19 @@ static int ignore_fail_on_non_empty;
|
||||
/* If nonzero, output a diagnostic for every directory processed. */
|
||||
static int verbose;
|
||||
|
||||
/* For long options that have no equivalent short option, use a
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
{
|
||||
IGNORE_FAIL_ON_NON_EMPTY_OPTION = CHAR_MAX + 1
|
||||
};
|
||||
|
||||
static struct option const longopts[] =
|
||||
{
|
||||
/* Don't name this `--force' because it's not close enough in meaning
|
||||
to e.g. rm's -f option. */
|
||||
{"ignore-fail-on-non-empty", no_argument, NULL, CHAR_MAX + 1},
|
||||
{"ignore-fail-on-non-empty", no_argument, NULL,
|
||||
IGNORE_FAIL_ON_NON_EMPTY_OPTION},
|
||||
|
||||
{"path", no_argument, NULL, 'p'},
|
||||
{"parents", no_argument, NULL, 'p'},
|
||||
@@ -105,7 +113,7 @@ remove_parents (char *path)
|
||||
|
||||
/* Give a diagnostic for each attempted removal if --verbose. */
|
||||
if (verbose)
|
||||
error (0, errno, _("removing directory, %s"), path);
|
||||
error (0, 0, _("removing directory, %s"), path);
|
||||
|
||||
fail = rmdir (path);
|
||||
|
||||
@@ -177,7 +185,7 @@ main (int argc, char **argv)
|
||||
case 'p':
|
||||
empty_paths = 1;
|
||||
break;
|
||||
case CHAR_MAX + 1:
|
||||
case IGNORE_FAIL_ON_NON_EMPTY_OPTION:
|
||||
ignore_fail_on_non_empty = 1;
|
||||
break;
|
||||
case 14:
|
||||
@@ -207,7 +215,7 @@ main (int argc, char **argv)
|
||||
|
||||
/* Give a diagnostic for each attempted removal if --verbose. */
|
||||
if (verbose)
|
||||
error (0, errno, _("removing directory, %s"), dir);
|
||||
error (0, 0, _("removing directory, %s"), dir);
|
||||
|
||||
fail = rmdir (dir);
|
||||
|
||||
|
||||
38
src/shred.c
38
src/shred.c
@@ -1589,22 +1589,34 @@ wipename (char *oldname, char const *qoldname, struct Options const *flags)
|
||||
do
|
||||
{
|
||||
struct stat st;
|
||||
if (lstat (newname, &st) < 0 && rename (oldname, newname) == 0)
|
||||
if (lstat (newname, &st) < 0)
|
||||
{
|
||||
if (dir_fd < 0
|
||||
|| (fdatasync (dir_fd) < 0 && fsync (dir_fd) < 0))
|
||||
sync (); /* Force directory out */
|
||||
if (flags->verbose)
|
||||
if (rename (oldname, newname) == 0)
|
||||
{
|
||||
/*
|
||||
* People seem to understand this better than talking
|
||||
* about renaming oldname. newname doesn't need
|
||||
* quoting because we picked it.
|
||||
*/
|
||||
error (0, 0, _("%s: renamed to `%s'"), qoldname, newname);
|
||||
if (dir_fd < 0
|
||||
|| (fdatasync (dir_fd) < 0 && fsync (dir_fd) < 0))
|
||||
sync (); /* Force directory out */
|
||||
if (flags->verbose)
|
||||
{
|
||||
/*
|
||||
* People seem to understand this better than talking
|
||||
* about renaming oldname. newname doesn't need
|
||||
* quoting because we picked it.
|
||||
*/
|
||||
error (0, 0, _("%s: renamed to `%s'"), qoldname, newname);
|
||||
}
|
||||
memcpy (oldname + (base - newname), base, len + 1);
|
||||
break;
|
||||
}
|
||||
memcpy (oldname + (base - newname), base, len + 1);
|
||||
break;
|
||||
else
|
||||
{
|
||||
/* The rename failed: give up on this length. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* newname exists, so increment BASE so we use another */
|
||||
}
|
||||
}
|
||||
while (!incname (base, len));
|
||||
|
||||
205
src/sleep.c
205
src/sleep.c
@@ -17,19 +17,29 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#define USE_CLOCK_GETTIME (defined CLOCK_REALTIME && HAVE_CLOCK_GETTIME)
|
||||
#if ! USE_CLOCK_GETTIME
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifndef TIME_T_MAX
|
||||
# define TIME_T_MAX TYPE_MAXIMUM (time_t)
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "long-options.h"
|
||||
#include "xstrtod.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "sleep"
|
||||
|
||||
#define AUTHORS "FIXME: unknown"
|
||||
|
||||
static long argdecode PARAMS ((const char *s));
|
||||
#define AUTHORS "Jim Meyering"
|
||||
|
||||
/* The name by which this program was run. */
|
||||
char *program_name;
|
||||
@@ -48,7 +58,7 @@ usage (int status)
|
||||
else
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s NUMBER[SUFFIX]\n\
|
||||
Usage: %s NUMBER[SUFFIX]...\n\
|
||||
or: %s OPTION\n\
|
||||
Pause for NUMBER seconds.\n\
|
||||
SUFFIX may be s for seconds (the default), m for minutes,\n\
|
||||
@@ -63,12 +73,108 @@ h for hours or d for days.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
/* FIXME: describe */
|
||||
|
||||
static int
|
||||
apply_suffix (double *s, char suffix_char)
|
||||
{
|
||||
unsigned int multiplier;
|
||||
|
||||
assert (*s <= TIME_T_MAX);
|
||||
|
||||
switch (suffix_char)
|
||||
{
|
||||
case 0:
|
||||
case 's':
|
||||
multiplier = 1;
|
||||
break;
|
||||
case 'm':
|
||||
multiplier = 60;
|
||||
break;
|
||||
case 'h':
|
||||
multiplier = 60 * 60;
|
||||
break;
|
||||
case 'd':
|
||||
multiplier = 60 * 60 * 24;
|
||||
break;
|
||||
default:
|
||||
multiplier = 0;
|
||||
}
|
||||
|
||||
if (multiplier == 0)
|
||||
return 1;
|
||||
|
||||
*s *= multiplier;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Subtract the `struct timespec' values X and Y,
|
||||
storing the difference in DIFF.
|
||||
Return 1 if the difference is positive, otherwise 0.
|
||||
Derived from code in the GNU libc manual. */
|
||||
|
||||
static int
|
||||
timespec_subtract (struct timespec *diff,
|
||||
const struct timespec *x, struct timespec *y)
|
||||
{
|
||||
/* Perform the carry for the later subtraction by updating Y. */
|
||||
if (x->tv_nsec < y->tv_nsec)
|
||||
{
|
||||
int nsec = (y->tv_nsec - x->tv_nsec) / 1000000000 + 1;
|
||||
y->tv_nsec -= 1000000000 * nsec;
|
||||
y->tv_sec += nsec;
|
||||
}
|
||||
|
||||
if (1000000000 < x->tv_nsec - y->tv_nsec)
|
||||
{
|
||||
int nsec = (y->tv_nsec - x->tv_nsec) / 1000000000;
|
||||
y->tv_nsec += 1000000000 * nsec;
|
||||
y->tv_sec -= nsec;
|
||||
}
|
||||
|
||||
/* Compute the time remaining to wait.
|
||||
`tv_nsec' is certainly positive. */
|
||||
diff->tv_sec = x->tv_sec - y->tv_sec;
|
||||
diff->tv_nsec = x->tv_nsec - y->tv_nsec;
|
||||
|
||||
/* Return 1 if result is positive. */
|
||||
return y->tv_sec < x->tv_sec;
|
||||
}
|
||||
|
||||
static void
|
||||
clock_get_realtime (struct timespec *ts)
|
||||
{
|
||||
int fail;
|
||||
#if USE_CLOCK_GETTIME
|
||||
fail = clock_gettime (CLOCK_REALTIME, &ts);
|
||||
#else
|
||||
struct timeval tv;
|
||||
fail = gettimeofday (&tv, NULL);
|
||||
if (!fail)
|
||||
{
|
||||
ts->tv_sec = tv.tv_sec;
|
||||
ts->tv_nsec = 1000 * tv.tv_usec;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fail)
|
||||
error (1, errno, _("cannot read realtime clock"));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
unsigned seconds = 0;
|
||||
double seconds = 0.0;
|
||||
int c;
|
||||
int fail = 0;
|
||||
struct timespec ts_start;
|
||||
struct timespec ts_stop;
|
||||
struct timespec ts_sleep;
|
||||
|
||||
/* Record start time. */
|
||||
clock_get_realtime (&ts_start);
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
@@ -96,43 +202,60 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
seconds += argdecode (argv[i]);
|
||||
for (i = optind; i < argc; i++)
|
||||
{
|
||||
double s;
|
||||
const char *p;
|
||||
if (xstrtod (argv[i], &p, &s)
|
||||
/* No negative intervals. */
|
||||
|| s < 0
|
||||
/* S must fit in a time_t. */
|
||||
|| TIME_T_MAX < s
|
||||
/* No extra chars after the number and an optional s,m,h,d char. */
|
||||
|| (*p && *(p+1))
|
||||
/* Check any suffix char and update S based on the suffix. */
|
||||
|| apply_suffix (&s, *p)
|
||||
/* Make sure the sum fits in a time_t. */
|
||||
|| TIME_T_MAX < (seconds += s)
|
||||
)
|
||||
{
|
||||
error (0, 0, _("invalid time interval `%s'"), argv[i]);
|
||||
fail = 1;
|
||||
}
|
||||
}
|
||||
|
||||
sleep (seconds);
|
||||
if (fail)
|
||||
usage (1);
|
||||
|
||||
/* Add this here so we end up rounding to the nearest nanosecond.
|
||||
This ensures that that tv_nsec will be no larger than 999,999,999. */
|
||||
seconds += .0000000005;
|
||||
|
||||
/* Separate whole seconds from nanoseconds. */
|
||||
ts_sleep.tv_sec = seconds;
|
||||
ts_sleep.tv_nsec = (seconds - ts_sleep.tv_sec) * 1000000000;
|
||||
|
||||
ts_stop.tv_sec = ts_start.tv_sec + ts_sleep.tv_sec;
|
||||
ts_stop.tv_nsec = ts_start.tv_nsec + ts_sleep.tv_nsec;
|
||||
if (1000000000 <= ts_stop.tv_nsec)
|
||||
{
|
||||
++ts_stop.tv_sec;
|
||||
ts_stop.tv_nsec -= 1000000000;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
struct timespec remaining;
|
||||
struct timespec ts_now;
|
||||
int any_remaining;
|
||||
int suspended = nanosleep (&ts_sleep, &remaining);
|
||||
if (!suspended)
|
||||
break;
|
||||
clock_get_realtime (&ts_now);
|
||||
any_remaining = timespec_subtract (&ts_sleep, &ts_stop, &ts_now);
|
||||
if (! any_remaining)
|
||||
break;
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static long
|
||||
argdecode (const char *s)
|
||||
{
|
||||
long value;
|
||||
register const char *p = s;
|
||||
register char c;
|
||||
|
||||
value = 0;
|
||||
while ((c = *p++) >= '0' && c <= '9')
|
||||
value = value * 10 + c - '0';
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 's':
|
||||
break;
|
||||
case 'm':
|
||||
value *= 60;
|
||||
break;
|
||||
case 'h':
|
||||
value *= 60 * 60;
|
||||
break;
|
||||
case 'd':
|
||||
value *= 60 * 60 * 24;
|
||||
break;
|
||||
default:
|
||||
p--;
|
||||
}
|
||||
|
||||
if (*p)
|
||||
error (1, 0, _("invalid time interval `%s'"), s);
|
||||
return value;
|
||||
}
|
||||
|
||||
130
src/sys2.h
130
src/sys2.h
@@ -3,6 +3,136 @@
|
||||
more time, I'll merge the remaining things in system.h and everything
|
||||
in this file will go back there. */
|
||||
|
||||
#if STAT_MACROS_BROKEN
|
||||
# undef S_ISBLK
|
||||
# undef S_ISCHR
|
||||
# undef S_ISDIR
|
||||
# undef S_ISDOOR
|
||||
# undef S_ISFIFO
|
||||
# undef S_ISLNK
|
||||
# undef S_ISMPB
|
||||
# undef S_ISMPC
|
||||
# undef S_ISNWK
|
||||
# undef S_ISREG
|
||||
# undef S_ISSOCK
|
||||
#endif /* STAT_MACROS_BROKEN. */
|
||||
|
||||
#ifndef S_IFMT
|
||||
# define S_IFMT 0170000
|
||||
#endif
|
||||
#if !defined(S_ISBLK) && defined(S_IFBLK)
|
||||
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
#endif
|
||||
#if !defined(S_ISCHR) && defined(S_IFCHR)
|
||||
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
||||
#endif
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
#if !defined(S_ISREG) && defined(S_IFREG)
|
||||
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
#if !defined(S_ISFIFO) && defined(S_IFIFO)
|
||||
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
||||
#endif
|
||||
#if !defined(S_ISLNK) && defined(S_IFLNK)
|
||||
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
|
||||
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
||||
#endif
|
||||
#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
|
||||
# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
|
||||
# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
|
||||
#endif
|
||||
#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
|
||||
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
|
||||
#endif
|
||||
#if !defined(S_ISDOOR) && defined(S_IFDOOR) /* Solaris 2.5 and up */
|
||||
# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
|
||||
#endif
|
||||
|
||||
#if !S_ISUID
|
||||
# define S_ISUID 04000
|
||||
#endif
|
||||
#if !S_ISGID
|
||||
# define S_ISGID 02000
|
||||
#endif
|
||||
|
||||
/* S_ISVTX is a common extension to POSIX.1. */
|
||||
#ifndef S_ISVTX
|
||||
# define S_ISVTX 01000
|
||||
#endif
|
||||
|
||||
#if !S_IRUSR && S_IREAD
|
||||
# define S_IRUSR S_IREAD
|
||||
#endif
|
||||
#if !S_IRUSR
|
||||
# define S_IRUSR 00400
|
||||
#endif
|
||||
#if !S_IRGRP
|
||||
# define S_IRGRP (S_IRUSR >> 3)
|
||||
#endif
|
||||
#if !S_IROTH
|
||||
# define S_IROTH (S_IRUSR >> 6)
|
||||
#endif
|
||||
|
||||
#if !S_IWUSR && S_IWRITE
|
||||
# define S_IWUSR S_IWRITE
|
||||
#endif
|
||||
#if !S_IWUSR
|
||||
# define S_IWUSR 00200
|
||||
#endif
|
||||
#if !S_IWGRP
|
||||
# define S_IWGRP (S_IWUSR >> 3)
|
||||
#endif
|
||||
#if !S_IWOTH
|
||||
# define S_IWOTH (S_IWUSR >> 6)
|
||||
#endif
|
||||
|
||||
#if !S_IXUSR && S_IEXEC
|
||||
# define S_IXUSR S_IEXEC
|
||||
#endif
|
||||
#if !S_IXUSR
|
||||
# define S_IXUSR 00100
|
||||
#endif
|
||||
#if !S_IXGRP
|
||||
# define S_IXGRP (S_IXUSR >> 3)
|
||||
#endif
|
||||
#if !S_IXOTH
|
||||
# define S_IXOTH (S_IXUSR >> 6)
|
||||
#endif
|
||||
|
||||
#if !S_IRWXU
|
||||
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
|
||||
#endif
|
||||
#if !S_IRWXG
|
||||
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
|
||||
#endif
|
||||
#if !S_IRWXO
|
||||
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
|
||||
#endif
|
||||
|
||||
/* S_IXUGO is a common extension to POSIX.1. */
|
||||
#if !S_IXUGO
|
||||
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
|
||||
#endif
|
||||
|
||||
/* All the mode bits that can be affected by chmod. */
|
||||
#define CHMOD_MODE_BITS \
|
||||
(S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
|
||||
|
||||
#if ST_MTIM_NSEC
|
||||
# define ST_TIME_CMP_NS(a, b, ns) ((a).ns < (b).ns ? -1 : (a).ns > (b).ns)
|
||||
#else
|
||||
# define ST_TIME_CMP_NS(a, b, ns) 0
|
||||
#endif
|
||||
#define ST_TIME_CMP(a, b, s, ns) \
|
||||
((a).s < (b).s ? -1 : (a).s > (b).s ? 1 : ST_TIME_CMP_NS(a, b, ns))
|
||||
#define ATIME_CMP(a, b) ST_TIME_CMP (a, b, st_atime, st_atim.ST_MTIM_NSEC)
|
||||
#define CTIME_CMP(a, b) ST_TIME_CMP (a, b, st_ctime, st_ctim.ST_MTIM_NSEC)
|
||||
#define MTIME_CMP(a, b) ST_TIME_CMP (a, b, st_mtime, st_mtim.ST_MTIM_NSEC)
|
||||
|
||||
#ifndef RETSIGTYPE
|
||||
# define RETSIGTYPE void
|
||||
#endif
|
||||
|
||||
121
src/system.h
121
src/system.h
@@ -19,127 +19,6 @@
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if STAT_MACROS_BROKEN
|
||||
# undef S_ISBLK
|
||||
# undef S_ISCHR
|
||||
# undef S_ISDIR
|
||||
# undef S_ISDOOR
|
||||
# undef S_ISFIFO
|
||||
# undef S_ISLNK
|
||||
# undef S_ISMPB
|
||||
# undef S_ISMPC
|
||||
# undef S_ISNWK
|
||||
# undef S_ISREG
|
||||
# undef S_ISSOCK
|
||||
#endif /* STAT_MACROS_BROKEN. */
|
||||
|
||||
#ifndef S_IFMT
|
||||
# define S_IFMT 0170000
|
||||
#endif
|
||||
#if !defined(S_ISBLK) && defined(S_IFBLK)
|
||||
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
#endif
|
||||
#if !defined(S_ISCHR) && defined(S_IFCHR)
|
||||
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
||||
#endif
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
#if !defined(S_ISREG) && defined(S_IFREG)
|
||||
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
#if !defined(S_ISFIFO) && defined(S_IFIFO)
|
||||
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
||||
#endif
|
||||
#if !defined(S_ISLNK) && defined(S_IFLNK)
|
||||
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
|
||||
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
||||
#endif
|
||||
#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
|
||||
# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
|
||||
# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
|
||||
#endif
|
||||
#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
|
||||
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
|
||||
#endif
|
||||
#if !defined(S_ISDOOR) && defined(S_IFDOOR) /* Solaris 2.5 and up */
|
||||
# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
|
||||
#endif
|
||||
|
||||
#if !S_ISUID
|
||||
# define S_ISUID 04000
|
||||
#endif
|
||||
#if !S_ISGID
|
||||
# define S_ISGID 02000
|
||||
#endif
|
||||
|
||||
/* S_ISVTX is a common extension to POSIX.1. */
|
||||
#ifndef S_ISVTX
|
||||
# define S_ISVTX 01000
|
||||
#endif
|
||||
|
||||
#if !S_IWUSR
|
||||
# if S_IWRITE
|
||||
# define S_IWUSR S_IWRITE
|
||||
# else
|
||||
# define S_IWUSR 00200
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef S_IWUSR
|
||||
# ifdef S_IWRITE
|
||||
# define S_IWUSR S_IWRITE
|
||||
# else
|
||||
# define S_IWUSR 00200
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef S_IEXEC
|
||||
# define S_IEXEC S_IXUSR
|
||||
#endif
|
||||
|
||||
#ifndef S_IXUSR
|
||||
# define S_IXUSR S_IEXEC
|
||||
#endif
|
||||
#ifndef S_IXGRP
|
||||
# define S_IXGRP (S_IEXEC >> 3)
|
||||
#endif
|
||||
#ifndef S_IXOTH
|
||||
# define S_IXOTH (S_IEXEC >> 6)
|
||||
#endif
|
||||
|
||||
#ifndef S_IRWXU
|
||||
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
|
||||
#endif
|
||||
#ifndef S_IRWXG
|
||||
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
|
||||
#endif
|
||||
#ifndef S_IRWXO
|
||||
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
|
||||
#endif
|
||||
|
||||
/* S_IXUGO is a common extension to POSIX.1. */
|
||||
#ifndef S_IXUGO
|
||||
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
|
||||
#endif
|
||||
|
||||
/* All the mode bits that can be affected by chmod. */
|
||||
#define CHMOD_MODE_BITS \
|
||||
(S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
|
||||
|
||||
#if ST_MTIM_NSEC
|
||||
# define ST_TIME_CMP_NS(a, b, ns) ((a).ns < (b).ns ? -1 : (a).ns > (b).ns)
|
||||
#else
|
||||
# define ST_TIME_CMP_NS(a, b, ns) 0
|
||||
#endif
|
||||
#define ST_TIME_CMP(a, b, s, ns) \
|
||||
((a).s < (b).s ? -1 : (a).s > (b).s ? 1 : ST_TIME_CMP_NS(a, b, ns))
|
||||
#define ATIME_CMP(a, b) ST_TIME_CMP (a, b, st_atime, st_atim.ST_MTIM_NSEC)
|
||||
#define CTIME_CMP(a, b) ST_TIME_CMP (a, b, st_ctime, st_ctim.ST_MTIM_NSEC)
|
||||
#define MTIME_CMP(a, b) ST_TIME_CMP (a, b, st_mtime, st_mtim.ST_MTIM_NSEC)
|
||||
|
||||
#if !defined(HAVE_MKFIFO)
|
||||
# define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
|
||||
#endif
|
||||
|
||||
@@ -1526,6 +1526,10 @@ main (int argc, char **argv)
|
||||
|
||||
if (forever)
|
||||
{
|
||||
/* This fflush appears to be required only on Solaris2.7. */
|
||||
if (fflush (stdout) < 0)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
SETVBUF (stdout, NULL, _IONBF, 0);
|
||||
tail_forever (F, n_files);
|
||||
}
|
||||
|
||||
18
src/touch.c
18
src/touch.c
@@ -78,9 +78,16 @@ static char *ref_file;
|
||||
/* Info about the reference file. */
|
||||
static struct stat ref_stats;
|
||||
|
||||
/* For long options that have no equivalent short option, use a
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
{
|
||||
TIME_OPTION = CHAR_MAX + 1
|
||||
};
|
||||
|
||||
static struct option const longopts[] =
|
||||
{
|
||||
{"time", required_argument, 0, CHAR_MAX + 1},
|
||||
{"time", required_argument, 0, TIME_OPTION},
|
||||
{"no-create", no_argument, 0, 'c'},
|
||||
{"date", required_argument, 0, 'd'},
|
||||
{"file", required_argument, 0, 'r'}, /* FIXME: phase out --file */
|
||||
@@ -111,12 +118,15 @@ touch (const char *file)
|
||||
int status;
|
||||
struct stat sbuf;
|
||||
int fd = -1;
|
||||
int open_errno = 0;
|
||||
|
||||
if (! no_create)
|
||||
{
|
||||
/* Try to open FILE, creating it if necessary. */
|
||||
fd = open (file, O_WRONLY | O_CREAT,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
if (fd == -1)
|
||||
open_errno = errno;
|
||||
}
|
||||
|
||||
if (! amtime_now)
|
||||
@@ -127,7 +137,7 @@ touch (const char *file)
|
||||
or FILE is inaccessible or a directory, so we have to use stat. */
|
||||
if (fd != -1 ? fstat (fd, &sbuf) : stat (file, &sbuf))
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
error (0, open_errno ? open_errno : errno, "%s", file);
|
||||
close (fd);
|
||||
return 1;
|
||||
}
|
||||
@@ -172,7 +182,7 @@ touch (const char *file)
|
||||
|
||||
if (status)
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
error (0, open_errno ? open_errno : errno, "%s", file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -273,7 +283,7 @@ main (int argc, char **argv)
|
||||
date_set++;
|
||||
break;
|
||||
|
||||
case CHAR_MAX + 1: /* --time */
|
||||
case TIME_OPTION: /* --time */
|
||||
change_times |= XARGMATCH ("--time", optarg,
|
||||
time_args, time_masks);
|
||||
break;
|
||||
|
||||
11
src/who.c
11
src/who.c
@@ -175,7 +175,7 @@ print_entry (const STRUCT_UTMP *utmp_ent)
|
||||
printf (" . ");
|
||||
}
|
||||
#if HAVE_UT_HOST
|
||||
if (utmp_ent->ut_host[0] && do_lookup)
|
||||
if (utmp_ent->ut_host[0])
|
||||
{
|
||||
char ut_host[sizeof (utmp_ent->ut_host) + 1];
|
||||
char *host = 0, *display = 0;
|
||||
@@ -189,9 +189,12 @@ print_entry (const STRUCT_UTMP *utmp_ent)
|
||||
if (display)
|
||||
*display++ = '\0';
|
||||
|
||||
if (*ut_host)
|
||||
/* See if we can canonicalize it. */
|
||||
host = canon_host (ut_host);
|
||||
if (*ut_host && do_lookup)
|
||||
{
|
||||
/* See if we can canonicalize it. */
|
||||
host = canon_host (ut_host);
|
||||
}
|
||||
|
||||
if (! host)
|
||||
host = ut_host;
|
||||
|
||||
|
||||
@@ -59,14 +59,17 @@ PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AMDEP = @AMDEP@
|
||||
AMTAR = @AMTAR@
|
||||
AMTARFLAGS = @AMTARFLAGS@
|
||||
AWK = @AWK@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
GENCAT = @GENCAT@
|
||||
GETCONF = @GETCONF@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
@@ -145,22 +148,16 @@ TAGS:
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/basename/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
cp -pR $$d/$$file $(distdir); \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
@@ -248,6 +245,7 @@ distclean-generic:
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
-rm -f Makefile.in
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
@@ -145,7 +145,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -148,7 +148,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -15,7 +15,11 @@ pwd=`pwd`
|
||||
dir=cpmvbak-$$
|
||||
actual=$dir/actual
|
||||
expected=$dir/expected
|
||||
trap "cd $pwd; rm -rf $dir" 0 1 2 3 15
|
||||
|
||||
# Be careful to close $actual before removing the containing directory.
|
||||
# Use `1>&2' rather than `1<&-' since the latter appears not to work
|
||||
# with /bin/sh from powerpc-ibm-aix4.2.0.0.
|
||||
trap "cd $pwd; exec 1>&2; rm -rf $dir" 0 1 2 3 15
|
||||
|
||||
mkdir $dir
|
||||
unset VERSION_CONTROL SIMPLE_BACKUP_SUFFIX
|
||||
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -172,7 +173,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -9,7 +9,7 @@ W92-3.X millen-1.X rel-0.X rel-1a.X rel-1b.X rel-2a.X rel-2b.X rel-2c.X \
|
||||
rel-2d.X rel-2e.X rel-2f.X rel-2g.X rel-3a.X next-s.X next-m.X next-h.X \
|
||||
next-d.X next-w.X next-mo.X next-y.X utc-0.X utc-0a.X utc-1.I utc-1.X \
|
||||
utc-1a.I utc-1a.X date2sec-0.X date2sec-0a.X date2sec-1.X sec2date-0.X \
|
||||
this-m.X this-h.X this-w.X this-mo.X this-y.X risks-1.X
|
||||
this-m.X this-h.X this-w.X this-mo.X this-y.X risks-1.X regress-1.X
|
||||
run_gen = 1.O 1.E 2.O 2.E 3.O 3.E 4.O 4.E 5.O 5.E 6.O 6.E 7.O 7.E 8.O 8.E 9.O \
|
||||
9.E leap-1.O leap-1.E U95-1.O U95-1.E U95-2.O U95-2.E U95-3.O U95-3.E U92-1.O \
|
||||
U92-1.E U92-2.O U92-2.E U92-3.O U92-3.E V92-1.O V92-1.E V92-2.O V92-2.E \
|
||||
@@ -22,7 +22,7 @@ next-w.E next-mo.O next-mo.E next-y.O next-y.E utc-0.O utc-0.E utc-0a.O \
|
||||
utc-0a.E utc-1.O utc-1.E utc-1a.O utc-1a.E date2sec-0.O date2sec-0.E \
|
||||
date2sec-0a.O date2sec-0a.E date2sec-1.O date2sec-1.E sec2date-0.O \
|
||||
sec2date-0.E this-m.O this-m.E this-h.O this-h.E this-w.O this-w.E this-mo.O \
|
||||
this-mo.E this-y.O this-y.E risks-1.O risks-1.E
|
||||
this-mo.E this-y.O this-y.E risks-1.O risks-1.E regress-1.O regress-1.E
|
||||
##test-files-end
|
||||
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
|
||||
@@ -59,14 +59,17 @@ PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AMDEP = @AMDEP@
|
||||
AMTAR = @AMTAR@
|
||||
AMTARFLAGS = @AMTARFLAGS@
|
||||
AWK = @AWK@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
GENCAT = @GENCAT@
|
||||
GETCONF = @GETCONF@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
@@ -115,7 +118,7 @@ W92-3.X millen-1.X rel-0.X rel-1a.X rel-1b.X rel-2a.X rel-2b.X rel-2c.X \
|
||||
rel-2d.X rel-2e.X rel-2f.X rel-2g.X rel-3a.X next-s.X next-m.X next-h.X \
|
||||
next-d.X next-w.X next-mo.X next-y.X utc-0.X utc-0a.X utc-1.I utc-1.X \
|
||||
utc-1a.I utc-1a.X date2sec-0.X date2sec-0a.X date2sec-1.X sec2date-0.X \
|
||||
this-m.X this-h.X this-w.X this-mo.X this-y.X risks-1.X
|
||||
this-m.X this-h.X this-w.X this-mo.X this-y.X risks-1.X regress-1.X
|
||||
|
||||
run_gen = 1.O 1.E 2.O 2.E 3.O 3.E 4.O 4.E 5.O 5.E 6.O 6.E 7.O 7.E 8.O 8.E 9.O \
|
||||
9.E leap-1.O leap-1.E U95-1.O U95-1.E U95-2.O U95-2.E U95-3.O U95-3.E U92-1.O \
|
||||
@@ -129,7 +132,7 @@ next-w.E next-mo.O next-mo.E next-y.O next-y.E utc-0.O utc-0.E utc-0a.O \
|
||||
utc-0a.E utc-1.O utc-1.E utc-1a.O utc-1a.E date2sec-0.O date2sec-0.E \
|
||||
date2sec-0a.O date2sec-0a.E date2sec-1.O date2sec-1.E sec2date-0.O \
|
||||
sec2date-0.E this-m.O this-m.E this-h.O this-h.E this-w.O this-w.E this-mo.O \
|
||||
this-mo.E this-y.O this-y.E risks-1.O risks-1.E
|
||||
this-mo.E this-y.O this-y.E risks-1.O risks-1.E regress-1.O regress-1.E
|
||||
|
||||
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
@@ -173,22 +176,16 @@ TAGS:
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/date/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
cp -pR $$d/$$file $(distdir); \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
@@ -277,6 +274,7 @@ distclean-generic:
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
-rm -f Makefile.in
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
|
||||
@@ -113,6 +113,9 @@ sub test_vector
|
||||
|
||||
['risks-1', "-d 'Nov 10 1996' $fmt", {}, "1996-11-10 00:00:00", 0],
|
||||
|
||||
['regress-1', "-u -d '1996-11-10 0:00:00 +0' $fmt", {},
|
||||
"1996-11-10 00:00:00", 0],
|
||||
|
||||
# FIXME: add a lot more...
|
||||
);
|
||||
|
||||
@@ -127,6 +130,10 @@ sub test_vector
|
||||
|
||||
$Test::env{'utc-0'} = ['TZ=UTC+4'];
|
||||
|
||||
# This one would pass if TZ (with any, or even no, value) were in
|
||||
# the environment.
|
||||
$Test::env{'regress-1'} = ['LANG=C'];
|
||||
|
||||
$Test::env{'utc-1'} = ['TZ=UTC+1'];
|
||||
$Test::input_via{'utc-1'} = {REDIR => 0};
|
||||
$Test::input_via{'utc-1a'} = {REDIR => 0};
|
||||
|
||||
@@ -953,8 +953,25 @@ else
|
||||
esac
|
||||
fi
|
||||
test -s risks-1.E || rm -f risks-1.E
|
||||
LANG=C $xx -u -d '1996-11-10 0:00:00 +0' '+%Y-%m-%d %T' > regress-1.O 2> regress-1.E
|
||||
code=$?
|
||||
if test $code != 0 ; then
|
||||
$echo "Test regress-1(LANG=C) failed: ../../src/date return code $code differs from expected value 0" 1>&2
|
||||
errors=`expr $errors + 1`
|
||||
else
|
||||
cmp regress-1.O $srcdir/regress-1.X > /dev/null 2>&1
|
||||
case $? in
|
||||
0) if test "$VERBOSE" ; then $echo "passed regress-1(LANG=C)"; fi ;;
|
||||
1) $echo "Test regress-1(LANG=C) failed: files regress-1.O and $srcdir/regress-1.X differ" 1>&2;
|
||||
errors=`expr $errors + 1` ;;
|
||||
2) $echo "Test regress-1(LANG=C) may have failed." 1>&2;
|
||||
$echo The command "cmp regress-1.O $srcdir/regress-1.X" failed. 1>&2 ;
|
||||
errors=`expr $errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s regress-1.E || rm -f regress-1.E
|
||||
if test $errors = 0 ; then
|
||||
$echo Passed all 55 tests. 1>&2
|
||||
$echo Passed all 56 tests. 1>&2
|
||||
else
|
||||
$echo Failed $errors tests. 1>&2
|
||||
fi
|
||||
|
||||
@@ -149,7 +149,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -149,7 +149,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -59,14 +59,17 @@ PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AMDEP = @AMDEP@
|
||||
AMTAR = @AMTAR@
|
||||
AMTARFLAGS = @AMTARFLAGS@
|
||||
AWK = @AWK@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
GENCAT = @GENCAT@
|
||||
GETCONF = @GETCONF@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
@@ -145,22 +148,16 @@ TAGS:
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/factor/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
cp -pR $$d/$$file $(distdir); \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
@@ -248,6 +245,7 @@ distclean-generic:
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
-rm -f Makefile.in
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -167,7 +168,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -148,7 +148,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -172,7 +173,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -145,7 +145,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -149,7 +149,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.2 gnits
|
||||
|
||||
TESTS = rt-1 time-1
|
||||
TESTS = rt-1 time-1 symlink-slash
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
top_srcdir=$(top_srcdir) \
|
||||
|
||||
@@ -103,7 +103,7 @@ l = @l@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.2 gnits
|
||||
|
||||
TESTS = rt-1 time-1
|
||||
TESTS = rt-1 time-1 symlink-slash
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = \
|
||||
top_srcdir=$(top_srcdir) \
|
||||
@@ -148,7 +148,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
35
tests/ls/symlink-slash
Executable file
35
tests/ls/symlink-slash
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# Do dereference a symlink arg if its name is written with a trailing slash.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
ls --version
|
||||
fi
|
||||
|
||||
tmp=t-ls.$$
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
|
||||
mkdir dir || framework_failure=1
|
||||
ln -s dir symlink || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LANGUAGE=C; export LANGUAGE
|
||||
LANG=C; export LANG
|
||||
|
||||
fail=0
|
||||
set `ls -l symlink/`
|
||||
|
||||
# Prior to fileutils-4.0k, the following would have output `... symlink -> dir'.
|
||||
test "$*" = 'total 0' && : || fail=1
|
||||
|
||||
cd ..
|
||||
rm -rf $tmp
|
||||
|
||||
exit $fail
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Test some of ls's sorting options.
|
||||
|
||||
test=time-1
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
ls --version
|
||||
@@ -10,9 +8,9 @@ fi
|
||||
|
||||
tmp=t-ls.$$
|
||||
|
||||
test_failure=0
|
||||
mkdir $tmp || test_failure=1
|
||||
cd $tmp || test_failure=1
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
cd $tmp || framework_failure=1
|
||||
|
||||
t1='1998-01-15 21:00'
|
||||
t2='1998-01-15 22:00'
|
||||
@@ -22,15 +20,15 @@ u1='1998-01-14 11:00'
|
||||
u2='1998-01-14 12:00'
|
||||
u3='1998-01-14 13:00'
|
||||
|
||||
touch -m -d "$t3" a || test_failure=1
|
||||
touch -m -d "$t2" b || test_failure=1
|
||||
touch -m -d "$t1" c || test_failure=1
|
||||
touch -m -d "$t3" a || framework_failure=1
|
||||
touch -m -d "$t2" b || framework_failure=1
|
||||
touch -m -d "$t1" c || framework_failure=1
|
||||
|
||||
touch -a -d "$u3" c || test_failure=1
|
||||
touch -a -d "$u2" b || test_failure=1
|
||||
touch -a -d "$u3" c || framework_failure=1
|
||||
touch -a -d "$u2" b || framework_failure=1
|
||||
# Make sure A has ctime at least 1 second more recent than C's.
|
||||
sleep 2
|
||||
touch -a -d "$u1" a || test_failure=1
|
||||
touch -a -d "$u1" a || framework_failure=1
|
||||
|
||||
fail=0
|
||||
|
||||
@@ -43,21 +41,51 @@ test "$*" = 'a c' || fail=1
|
||||
sleep 2
|
||||
|
||||
# Create a link, updating c's ctime.
|
||||
ln c d || test_failure=1
|
||||
ln c d || framework_failure=1
|
||||
|
||||
if test $test_failure = 1; then
|
||||
# Before we go any further, verify that touch's -m option works.
|
||||
set -- `ls --full -l a`
|
||||
case "$*" in
|
||||
*'Jan 15 23:00:00 1998 a') ;;
|
||||
*)
|
||||
# This might be what's making HPUX 11 systems fail this test.
|
||||
cat >&2 << \EOF
|
||||
A basic test of touch -a has just failed, so the subsequent
|
||||
tests in this file will not be run.
|
||||
EOF
|
||||
framework_failure=1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Now test touch's -a option.
|
||||
set -- `ls --full -lu a`
|
||||
case "$*" in
|
||||
*'Jan 14 11:00:00 1998 a') ;;
|
||||
*)
|
||||
# This might be what's making HPUX 11 systems fail this test.
|
||||
cat >&2 << \EOF
|
||||
A basic test of touch -m has just failed, so the subsequent
|
||||
tests in this file will not be run.
|
||||
EOF
|
||||
framework_failure=1
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set `ls -u a b c`
|
||||
set `ls -ut a b c`
|
||||
test "$*" = 'c b a' && : || fail=1
|
||||
test $fail = 1 && ls -l --full-time --time=access a b c
|
||||
|
||||
set `ls -t a b c`
|
||||
test "$*" = 'a b c' && : || fail=1
|
||||
test $fail = 1 && ls -l --full-time a b c
|
||||
|
||||
# Now, C should have ctime more recent than A.
|
||||
set `ls -c a c`
|
||||
set `ls -ct a c`
|
||||
if test "$*" = 'c a'; then
|
||||
: ok
|
||||
else
|
||||
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -148,7 +149,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -143,7 +143,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AUTOMAKE_OPTIONS = 1.3 gnits
|
||||
|
||||
TESTS = mv-special-1 into-self into-self-2 into-self-3 backup-is-src \
|
||||
i-1 hard-link-1 force
|
||||
i-1 hard-link-1 force partition-perm to-symlink
|
||||
|
||||
EXTRA_DIST = $(TESTS) setup
|
||||
TESTS_ENVIRONMENT = \
|
||||
|
||||
@@ -104,7 +104,7 @@ l = @l@
|
||||
AUTOMAKE_OPTIONS = 1.3 gnits
|
||||
|
||||
TESTS = mv-special-1 into-self into-self-2 into-self-3 backup-is-src \
|
||||
i-1 hard-link-1 force
|
||||
i-1 hard-link-1 force partition-perm to-symlink
|
||||
|
||||
|
||||
EXTRA_DIST = $(TESTS) setup
|
||||
@@ -158,7 +158,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#!/bin/sh
|
||||
# Force mv to use the copying code.
|
||||
|
||||
: ${MV=mv}
|
||||
: ${RM=rm}
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$MV --version
|
||||
mv --version
|
||||
fi
|
||||
|
||||
. $srcdir/setup
|
||||
@@ -19,7 +16,7 @@ a="$other_partition_tmpdir/a"
|
||||
a2="$other_partition_tmpdir/a~"
|
||||
|
||||
framework_failure=0
|
||||
$RM -f $a $a2 || framework_failure=1
|
||||
rm -f $a $a2 || framework_failure=1
|
||||
echo a > $a || framework_failure=1
|
||||
echo a2 > $a2 || framework_failure=1
|
||||
|
||||
@@ -37,10 +34,10 @@ LANG=C
|
||||
export LANG
|
||||
|
||||
# This mv command should exit nonzero.
|
||||
$MV --b=simple $a2 $a > out 2>&1 && fail=1
|
||||
mv --b=simple $a2 $a > out 2>&1 && fail=1
|
||||
|
||||
sed \
|
||||
-e "s,$MV:,XXX:," \
|
||||
-e "s,mv:,XXX:," \
|
||||
-e "s,$a,YYY," \
|
||||
-e "s,$a2,ZZZ," \
|
||||
out > out2
|
||||
@@ -51,6 +48,6 @@ EOF
|
||||
|
||||
cmp out2 exp || fail=1
|
||||
|
||||
$RM -fr out out2 exp $a $a2 $other_partition_tmpdir
|
||||
rm -fr out out2 exp $a $a2 $other_partition_tmpdir
|
||||
|
||||
exit $fail
|
||||
|
||||
@@ -2,15 +2,9 @@
|
||||
# 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
|
||||
mv --version
|
||||
fi
|
||||
|
||||
. $srcdir/setup
|
||||
@@ -22,9 +16,9 @@ fi
|
||||
dir=hlink
|
||||
|
||||
framework_failure=0
|
||||
$MKDIR $dir || framework_failure=1
|
||||
mkdir $dir || framework_failure=1
|
||||
> $dir/a || framework_failure=1
|
||||
$LN $dir/a $dir/b || framework_failure=1
|
||||
ln $dir/a $dir/b || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
@@ -39,16 +33,16 @@ export LC_ALL
|
||||
LANG=C
|
||||
export LANG
|
||||
|
||||
$MV $dir $other_partition_tmpdir || fail=1
|
||||
mv $dir $other_partition_tmpdir || fail=1
|
||||
|
||||
# Display inode numbers, one per line.
|
||||
$LS -1i $other_partition_tmpdir/$dir > out || fail=1
|
||||
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
|
||||
rm -fr out $dir $other_partition_tmpdir
|
||||
|
||||
exit $fail
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Demonstrate how mv fails when it tries to move a directory into itself.
|
||||
|
||||
: ${MV=mv}
|
||||
: ${MKDIR=mkdir}
|
||||
: ${RM=rm}
|
||||
: ${TOUCH=touch}
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$MV --version
|
||||
mv --version
|
||||
fi
|
||||
|
||||
dir=into-self-dir
|
||||
@@ -16,9 +11,9 @@ file=into-self-file
|
||||
|
||||
test_failure=0
|
||||
|
||||
$RM -rf $dir $file || test_failure=1
|
||||
$MKDIR -p $dir/a/b || test_failure=1
|
||||
$TOUCH $file || test_failure=1
|
||||
rm -rf $dir $file || test_failure=1
|
||||
mkdir -p $dir/a/b || test_failure=1
|
||||
touch $file || test_failure=1
|
||||
|
||||
if test $test_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
@@ -36,10 +31,10 @@ LANG=C
|
||||
export LANG
|
||||
|
||||
# This mv command should fail.
|
||||
$MV $dir $file $dir > out 2>&1 && fail=1
|
||||
mv $dir $file $dir > out 2>&1 && fail=1
|
||||
|
||||
sed \
|
||||
-e "s,$MV:,XXX:," \
|
||||
-e "s,mv:,XXX:," \
|
||||
-e "s,$dir,SRC," \
|
||||
-e "s,$dir/$dir,DEST," \
|
||||
out > out2
|
||||
@@ -57,6 +52,6 @@ test -d $dir || fail=1
|
||||
test -d $dir/$dir && fail=1
|
||||
# Make sure the file has been moved to the right place.
|
||||
test -f $dir/$file || fail=1
|
||||
$RM -rf $dir $file out out2 exp
|
||||
rm -rf $dir $file out out2 exp
|
||||
|
||||
exit $fail
|
||||
|
||||
@@ -17,6 +17,11 @@ fi
|
||||
file="$other_partition_tmpdir/file"
|
||||
symlink=symlink
|
||||
|
||||
fail=0
|
||||
|
||||
trap 'rm -fr out out2 exp $file $symlink $other_partition_tmpdir; exit $fail' \
|
||||
0 1 2 3 15
|
||||
|
||||
framework_failure=0
|
||||
rm -f $file $symlink || framework_failure=1
|
||||
echo whatever > $file || framework_failure=1
|
||||
@@ -35,11 +40,19 @@ export LC_ALL
|
||||
LANG=C
|
||||
export LANG
|
||||
|
||||
unset VERSION_CONTROL
|
||||
|
||||
if test "${VERSION_CONTROL+set}" = set; then
|
||||
echo '$0: the VERSION_CONTROL envvar is set --' \
|
||||
' unset it and rerun this test' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This mv command should exit nonzero.
|
||||
mv $symlink $file > out 2>&1 && fail=1
|
||||
|
||||
# And so should this one.
|
||||
mv $file $symlink >> out 2>&1 && fail=1
|
||||
# This should succeed.
|
||||
mv $file $symlink || fail=1
|
||||
|
||||
sed \
|
||||
-e "s,mv:,XXX:," \
|
||||
@@ -49,12 +62,10 @@ sed \
|
||||
|
||||
cat > exp <<\EOF
|
||||
XXX: `ZZZ' and `YYY' are the same file
|
||||
XXX: `YYY' and `ZZZ' are the same file
|
||||
EOF
|
||||
#'
|
||||
|
||||
cmp out2 exp || fail=1
|
||||
|
||||
rm -fr out out2 exp $file $symlink $other_partition_tmpdir
|
||||
test $fail = 1 && diff out2 exp 2> /dev/null
|
||||
|
||||
exit $fail
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$MV --version
|
||||
mv --version
|
||||
fi
|
||||
|
||||
dir1=is3-dir1
|
||||
dir2=is3-dir2
|
||||
|
||||
framework_failure=0
|
||||
$RM -rf $dir1 $dir2 || framework_failure=1
|
||||
rm -rf $dir1 $dir2 || framework_failure=1
|
||||
mkdir $dir1 $dir2 || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
@@ -30,10 +30,10 @@ LANG=C
|
||||
export LANG
|
||||
|
||||
# This mv command should exit nonzero.
|
||||
$MV $dir1 $dir2 $dir2 > out 2>&1 && fail=1
|
||||
mv $dir1 $dir2 $dir2 > out 2>&1 && fail=1
|
||||
|
||||
sed \
|
||||
-e "s,$MV:,XXX:,g" \
|
||||
-e "s,mv:,XXX:,g" \
|
||||
-e "s,$dir2,ZZZ,g" \
|
||||
out > out2
|
||||
|
||||
@@ -43,6 +43,6 @@ EOF
|
||||
|
||||
cmp out2 exp || fail=1
|
||||
|
||||
$RM -fr out out2 exp $dir1 $dir2
|
||||
rm -fr out out2 exp $dir1 $dir2
|
||||
|
||||
exit $fail
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
#! /bin/sh
|
||||
|
||||
: ${LS=ls}
|
||||
: ${MV=mv}
|
||||
: ${MKDIR=mkdir}
|
||||
: ${MKNOD=mknod}
|
||||
: ${RM=rm}
|
||||
: ${TOUCH=touch}
|
||||
|
||||
. $srcdir/setup
|
||||
|
||||
if test -z "$other_partition_tmpdir"; then
|
||||
@@ -18,10 +11,10 @@ dir=.mv-dir
|
||||
|
||||
framework_failure=0
|
||||
|
||||
$RM -f $null || framework_failure=1
|
||||
$MKNOD $null p || framework_failure=1
|
||||
$MKDIR -p $dir/a/b/c $dir/d/e/f || framework_failure=1
|
||||
$TOUCH $dir/a/b/c/file1 $dir/d/e/f/file2 || framework_failure=1
|
||||
rm -f $null || framework_failure=1
|
||||
mknod $null p || framework_failure=1
|
||||
mkdir -p $dir/a/b/c $dir/d/e/f || framework_failure=1
|
||||
touch $dir/a/b/c/file1 $dir/d/e/f/file2 || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
@@ -37,13 +30,13 @@ LANG=C
|
||||
export LANG
|
||||
|
||||
fail=0
|
||||
$MV --verbose $null $dir $other_partition_tmpdir > out || fail=1
|
||||
mv --verbose $null $dir $other_partition_tmpdir > out || fail=1
|
||||
# Make sure the files are gone.
|
||||
test -f $null && fail=1
|
||||
test -d $dir && fail=1
|
||||
# Make sure they were moved.
|
||||
# Since `test -e' is not portable, use `ls'.
|
||||
$LS $other_partition_tmpdir/$null > /dev/null || fail=1
|
||||
ls $other_partition_tmpdir/$null > /dev/null || fail=1
|
||||
test -d $other_partition_tmpdir/$dir/a/b/c || fail=1
|
||||
|
||||
sed "s,$other_partition_tmpdir,XXX," out > out2
|
||||
@@ -81,8 +74,8 @@ EOF
|
||||
cmp out2 exp || fail=1
|
||||
|
||||
# cd $other_partition_tmpdir
|
||||
# $LS -l -A -R $other_partition_tmpdir
|
||||
# ls -l -A -R $other_partition_tmpdir
|
||||
|
||||
$RM -rf $null $dir $other_partition_tmpdir out out2 exp
|
||||
rm -rf $null $dir $other_partition_tmpdir out out2 exp
|
||||
|
||||
exit $fail
|
||||
|
||||
52
tests/mv/partition-perm
Executable file
52
tests/mv/partition-perm
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# Make sure permissions are preserved when moving from one partition to another.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
mv --version
|
||||
fi
|
||||
|
||||
. $srcdir/setup
|
||||
|
||||
if test -z "$other_partition_tmpdir"; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
LANGUAGE=C; export LANGUAGE
|
||||
LANG=C; export LANG
|
||||
|
||||
pwd=`pwd`
|
||||
dir=p-perm-$$
|
||||
trap "cd $pwd; rm -rf $dir $other_partition_tmpdir" 0 1 2 3 15
|
||||
|
||||
mkdir $dir
|
||||
unset VERSION_CONTROL SIMPLE_BACKUP_SUFFIX
|
||||
|
||||
if test "${VERSION_CONTROL+set}" = set; then
|
||||
echo '$0: the VERSION_CONTROL envvar is set --' \
|
||||
' unset it and rerun this test' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test "${SIMPLE_BACKUP_SUFFIX+set}" = set; then
|
||||
echo '$0: the SIMPLE_BACKUP_SUFFIX envvar is set --' \
|
||||
' unset it and rerun this test' >&2
|
||||
>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $dir
|
||||
: > file
|
||||
chmod a=rwx file
|
||||
|
||||
umask 777
|
||||
mv file $other_partition_tmpdir
|
||||
|
||||
fail=0
|
||||
test -f file && fail=1
|
||||
test -f $other_partition_tmpdir/file || fail=1
|
||||
|
||||
# This would have failed with the mv from fileutils-4.0i.
|
||||
test -r $other_partition_tmpdir/file || fail=1
|
||||
|
||||
exit $fail
|
||||
@@ -4,9 +4,6 @@
|
||||
# of the current directory. If one is found, create a temporary directory
|
||||
# inside it.
|
||||
|
||||
: ${DF=df}
|
||||
: ${MKDIR=mkdir}
|
||||
|
||||
: ${CANDIDATE_TMP_DIRS=not_set}
|
||||
|
||||
# Work around a bug in the way Ultrix4.3a's /bin/sh handles multi-word
|
||||
@@ -18,15 +15,15 @@ other_partition_tmpdir=
|
||||
|
||||
# WARNING: using sed like this to extract the mount point will fail
|
||||
# if the mount point name contains `% '.
|
||||
dot_mount_point=`$DF --no-sync -P . | sed -n '2s/.*% *//p'`
|
||||
dot_mount_point=`df --no-sync -P . | sed -n '2s/.*% *//p'`
|
||||
for d in $CANDIDATE_TMP_DIRS; do
|
||||
d_mount_point=`$DF --no-sync -P $d | sed -n '2s/.*% *//p'`
|
||||
d_mount_point=`df --no-sync -P $d | sed -n '2s/.*% *//p'`
|
||||
|
||||
# Same partition? Skip it.
|
||||
test x$d_mount_point = x$dot_mount_point && continue
|
||||
|
||||
# See if we can create a directory in it.
|
||||
if $MKDIR "$d/df-$$" > /dev/null 2>&1; then
|
||||
if mkdir "$d/df-$$" > /dev/null 2>&1; then
|
||||
other_partition_tmpdir="$d/df-$$"
|
||||
break
|
||||
fi
|
||||
|
||||
50
tests/mv/to-symlink
Executable file
50
tests/mv/to-symlink
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
# Make sure that the copying code used in an inter-partition
|
||||
# move unlinks a destination symlink before opening it.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
mv --version
|
||||
fi
|
||||
|
||||
. $srcdir/setup
|
||||
|
||||
if test -z "$other_partition_tmpdir"; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
rem_file="$other_partition_tmpdir/file"
|
||||
rem_symlink="$other_partition_tmpdir/symlink"
|
||||
file=to-sym-$$
|
||||
|
||||
fail=0
|
||||
|
||||
trap 'rm -fr $file $other_partition_tmpdir; exit $fail' 0 1 2 3 15
|
||||
|
||||
framework_failure=0
|
||||
rm -f $file || framework_failure=1
|
||||
echo local > $file || framework_failure=1
|
||||
echo remote > $rem_file || framework_failure=1
|
||||
ln -s $rem_file $rem_symlink || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unset VERSION_CONTROL
|
||||
|
||||
if test "${VERSION_CONTROL+set}" = set; then
|
||||
echo '$0: the VERSION_CONTROL envvar is set --' \
|
||||
' unset it and rerun this test' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This mv command should succeed, unlinking the symlink
|
||||
# before copying.
|
||||
mv $file $rem_symlink || fail=1
|
||||
|
||||
# Make sure $rem_file is unmodified.
|
||||
test `cat $rem_file` = remote || fail=1
|
||||
|
||||
exit $fail
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -222,7 +223,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -151,7 +151,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -149,7 +149,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -59,14 +59,17 @@ PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AMDEP = @AMDEP@
|
||||
AMTAR = @AMTAR@
|
||||
AMTARFLAGS = @AMTARFLAGS@
|
||||
AWK = @AWK@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
GENCAT = @GENCAT@
|
||||
GETCONF = @GETCONF@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
@@ -145,22 +148,16 @@ TAGS:
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/seq/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
cp -pR $$d/$$file $(distdir); \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
@@ -248,6 +245,7 @@ distclean-generic:
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
-rm -f Makefile.in
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
1
tests/shred/.cvsignore
Normal file
1
tests/shred/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
Makefile
|
||||
11
tests/shred/Makefile.am
Normal file
11
tests/shred/Makefile.am
Normal file
@@ -0,0 +1,11 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
|
||||
EXTRA_DIST = $(TESTS)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
top_srcdir=$(top_srcdir) \
|
||||
srcdir=$(srcdir) \
|
||||
PERL="@PERL@" \
|
||||
PATH=../../src:$$PATH
|
||||
|
||||
TESTS = remove
|
||||
267
tests/shred/Makefile.in
Normal file
267
tests/shred/Makefile.in
Normal file
@@ -0,0 +1,267 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_FLAG =
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AMDEP = @AMDEP@
|
||||
AMTAR = @AMTAR@
|
||||
AWK = @AWK@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
DF_PROG = @DF_PROG@
|
||||
GENCAT = @GENCAT@
|
||||
GETCONF = @GETCONF@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GNU_PACKAGE = @GNU_PACKAGE@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PERL = @PERL@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
EXTRA_DIST = $(TESTS)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
top_srcdir=$(top_srcdir) \
|
||||
srcdir=$(srcdir) \
|
||||
PERL="@PERL@" \
|
||||
PATH=../../src:$$PATH
|
||||
|
||||
|
||||
TESTS = remove
|
||||
subdir = tests/shred
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/shred/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pR $$d/$$file $(distdir); \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
for tst in $(TESTS); do \
|
||||
if test -f ./$$tst; then dir=./; \
|
||||
elif test -f $$tst; then dir=; \
|
||||
else dir="$(srcdir)/"; fi; \
|
||||
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
|
||||
all=`expr $$all + 1`; \
|
||||
case " $(XFAIL_TESTS) " in \
|
||||
*" $$tst "*) \
|
||||
xpass=`expr $$xpass + 1`; \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "XPASS: $$tst"; \
|
||||
;; \
|
||||
*) \
|
||||
echo "PASS: $$tst"; \
|
||||
;; \
|
||||
esac; \
|
||||
elif test $$? -ne 77; then \
|
||||
all=`expr $$all + 1`; \
|
||||
case " $(XFAIL_TESTS) " in \
|
||||
*" $$tst "*) \
|
||||
xfail=`expr $$xfail + 1`; \
|
||||
echo "XFAIL: $$tst"; \
|
||||
;; \
|
||||
*) \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "FAIL: $$tst"; \
|
||||
;; \
|
||||
esac; \
|
||||
fi; \
|
||||
done; \
|
||||
if test "$$failed" -eq 0; then \
|
||||
if test "$$xfail" -eq 0; then \
|
||||
banner="All $$all tests passed"; \
|
||||
else \
|
||||
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
|
||||
fi; \
|
||||
else \
|
||||
if test "$$xpass" -eq 0; then \
|
||||
banner="$$failed of $$all tests failed"; \
|
||||
else \
|
||||
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"; \
|
||||
test "$$failed" -eq 0
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am:
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
-rm -f Makefile.in
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-generic clean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: tags distdir check-TESTS info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-am install-data install-am install uninstall-am uninstall \
|
||||
all-redirect all-am all install-strip installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
41
tests/shred/remove
Executable file
41
tests/shred/remove
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# Exercise a bug that was fixed in shred-4.0l
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
shred --version
|
||||
fi
|
||||
|
||||
tmp=t-shred.$$
|
||||
|
||||
# The length of the basename is what matters.
|
||||
# In this case, shred would try to rename the file 256^10 times
|
||||
# before terminating.
|
||||
file=$tmp/0123456789
|
||||
|
||||
framework_failure=0
|
||||
mkdir $tmp || framework_failure=1
|
||||
touch $file || framework_failure=1
|
||||
chmod u-w $tmp || framework_failure=1
|
||||
|
||||
if test $framework_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
touch $tmp/file >/dev/null 2>&1 && {
|
||||
echo 'This test case can not be run as root'
|
||||
exit 77
|
||||
}
|
||||
|
||||
fail=0
|
||||
|
||||
# This would take so long that it appears to infloop
|
||||
# when using version from fileutils-4.0k.
|
||||
# When the command completes, expect it to fail.
|
||||
shred -u $file > /dev/null 2>&1 && fail=1
|
||||
|
||||
chmod u+w $tmp
|
||||
rm -rf $tmp
|
||||
|
||||
exit $fail
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -192,7 +193,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -59,14 +59,17 @@ PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AMDEP = @AMDEP@
|
||||
AMTAR = @AMTAR@
|
||||
AMTARFLAGS = @AMTARFLAGS@
|
||||
AWK = @AWK@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
GENCAT = @GENCAT@
|
||||
GETCONF = @GETCONF@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
@@ -139,22 +142,16 @@ TAGS:
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/stty/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
cp -pR $$d/$$file $(distdir); \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
@@ -242,6 +239,7 @@ distclean-generic:
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
-rm -f Makefile.in
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -170,7 +171,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -9,4 +9,4 @@ TESTS_ENVIRONMENT = \
|
||||
PATH=`pwd`/../../src:$$PATH \
|
||||
PROG=tail
|
||||
|
||||
TESTS = assert
|
||||
TESTS = assert fflush
|
||||
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -110,7 +111,7 @@ TESTS_ENVIRONMENT = \
|
||||
PROG=tail
|
||||
|
||||
|
||||
TESTS = assert
|
||||
TESTS = assert fflush
|
||||
subdir = tests/tail-2
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../config.h
|
||||
@@ -148,7 +149,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
38
tests/tail-2/fflush
Executable file
38
tests/tail-2/fflush
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
# This test would fail on solaris2.7 with tail from pre-1.22k textutils.
|
||||
# The problem was that using the solaris2.7 setvbuf function to turn off
|
||||
# buffering doesn't flush stdout.
|
||||
|
||||
# FIXME: actually, I couldn't find a way to write the test (without resorting
|
||||
# to use of expect) so that it would provoke the failure on solaris2.7.
|
||||
# To exercise the bug, cat's stdout seems to have to be directed
|
||||
# to a terminal.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
tail --version
|
||||
fi
|
||||
|
||||
tmp=tail-flush.$$
|
||||
pwd=`pwd`
|
||||
trap "cd $pwd; rm -rf $tmp" 0 1 2 3 15
|
||||
|
||||
test_failure=0
|
||||
mkdir $tmp || test_failure=1
|
||||
cd $tmp || test_failure=1
|
||||
|
||||
if test $test_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo fubar > in
|
||||
tail -f in | cat > out &
|
||||
pid=$!
|
||||
sleep 1
|
||||
kill $pid
|
||||
|
||||
fail=0
|
||||
test "`cat out`" = fubar || fail=1
|
||||
|
||||
exit $fail
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -172,7 +173,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -59,14 +59,17 @@ PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AMDEP = @AMDEP@
|
||||
AMTAR = @AMTAR@
|
||||
AMTARFLAGS = @AMTARFLAGS@
|
||||
AWK = @AWK@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEPDIR = @DEPDIR@
|
||||
GENCAT = @GENCAT@
|
||||
GETCONF = @GETCONF@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
@@ -190,22 +193,16 @@ TAGS:
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/test/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
cp -pR $$d/$$file $(distdir); \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
@@ -294,6 +291,7 @@ distclean-generic:
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
-rm -f Makefile.in
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
|
||||
@@ -145,7 +145,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -174,7 +175,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -148,7 +149,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -168,7 +169,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
install_sh = @install_sh@
|
||||
l = @l@
|
||||
|
||||
|
||||
@@ -162,7 +163,6 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
|
||||
Reference in New Issue
Block a user