mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
166 Commits
FILEUTILS-
...
FILEUTILS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ecb6ace02 | ||
|
|
6d42c7e9d7 | ||
|
|
6684ffa826 | ||
|
|
bfbc3ce20c | ||
|
|
0f5f23cb9e | ||
|
|
93494dde07 | ||
|
|
be3b9520ad | ||
|
|
c2c6f081c5 | ||
|
|
36b10d9f21 | ||
|
|
72c0980585 | ||
|
|
58647fd63d | ||
|
|
6eb5e899e1 | ||
|
|
a01c762a81 | ||
|
|
c29025e6ed | ||
|
|
b3582e7533 | ||
|
|
12f49aa1ae | ||
|
|
f31f7e1c75 | ||
|
|
d34d42ca05 | ||
|
|
6974d67aa2 | ||
|
|
85d9447441 | ||
|
|
45c381f4ba | ||
|
|
184c0062a4 | ||
|
|
7024c7d55c | ||
|
|
d84a21ea2d | ||
|
|
2f6fa9d160 | ||
|
|
4ac374c8e5 | ||
|
|
17070ae7bf | ||
|
|
a1cc8f5961 | ||
|
|
27caa20d7b | ||
|
|
757555a4dc | ||
|
|
ada5e63612 | ||
|
|
a8d20df6b2 | ||
|
|
4a28ea9bd6 | ||
|
|
e4a1ead494 | ||
|
|
ad1a2f76ce | ||
|
|
a7a6111f81 | ||
|
|
7c579a0231 | ||
|
|
6630a24b7a | ||
|
|
6429ffabbb | ||
|
|
e558629ce1 | ||
|
|
fefa8511b8 | ||
|
|
347db9ce77 | ||
|
|
92da57a7be | ||
|
|
4078ae8de8 | ||
|
|
3086193091 | ||
|
|
823425b310 | ||
|
|
e03fc9bc82 | ||
|
|
64379c5cd8 | ||
|
|
d4825df6cf | ||
|
|
cb3b5ed486 | ||
|
|
7ee8ed7e37 | ||
|
|
a991132f3e | ||
|
|
7f0867df00 | ||
|
|
6354d07ea0 | ||
|
|
3216105fbb | ||
|
|
8d5c4784b8 | ||
|
|
ec47f73107 | ||
|
|
94cd0c09f6 | ||
|
|
db3440d444 | ||
|
|
e8bec0725e | ||
|
|
8598c54bb1 | ||
|
|
e457645eac | ||
|
|
a14303dbc9 | ||
|
|
84ad5c47c8 | ||
|
|
998b3a148c | ||
|
|
71ee764f1e | ||
|
|
07a6f7a9e2 | ||
|
|
0f5ca22215 | ||
|
|
fc50286759 | ||
|
|
0a1fd1d2ad | ||
|
|
7a04e95c62 | ||
|
|
938e7fe7ef | ||
|
|
d8ab75cedc | ||
|
|
650b182278 | ||
|
|
f31f7889fb | ||
|
|
b1f2e5a7fd | ||
|
|
34141257cf | ||
|
|
c96ef37ba9 | ||
|
|
ccc65c4a81 | ||
|
|
be5250f0ec | ||
|
|
d1c1677873 | ||
|
|
6eae430477 | ||
|
|
82d361dc53 | ||
|
|
6e05a13259 | ||
|
|
a1413ad1cd | ||
|
|
c9dd33ec3f | ||
|
|
b9a394eec5 | ||
|
|
f315b52ca9 | ||
|
|
26c02dd946 | ||
|
|
a03a97d7d8 | ||
|
|
ead1152ef8 | ||
|
|
2326be84d5 | ||
|
|
7980fa3b78 | ||
|
|
70a8ff09ed | ||
|
|
38a63c863e | ||
|
|
a4fb33a110 | ||
|
|
bd9a38183c | ||
|
|
45d85e3ba2 | ||
|
|
afa328c54e | ||
|
|
c66e967d70 | ||
|
|
ccaf565665 | ||
|
|
b1a82ad6f2 | ||
|
|
c9a2ec01e5 | ||
|
|
f7acc2f589 | ||
|
|
5bf77e1015 | ||
|
|
3aa15eac61 | ||
|
|
5799c6474d | ||
|
|
f8998dae41 | ||
|
|
a7ba2688ca | ||
|
|
6810b30f39 | ||
|
|
f8d66bde6a | ||
|
|
4675b67c10 | ||
|
|
ae3c7c2fb1 | ||
|
|
a3ff199f12 | ||
|
|
61ef81a837 | ||
|
|
dcb8db3c82 | ||
|
|
92b49f0da1 | ||
|
|
f322649c58 | ||
|
|
f49fee3e5f | ||
|
|
6dbc8ff80b | ||
|
|
65978b6328 | ||
|
|
5f8949c46c | ||
|
|
b302e2becc | ||
|
|
5921d6bc50 | ||
|
|
ec76108bb7 | ||
|
|
519365bb08 | ||
|
|
c1fc9dbe64 | ||
|
|
06b4686f8a | ||
|
|
5a244d2598 | ||
|
|
497a1e0c04 | ||
|
|
32ee7fb170 | ||
|
|
db7449461c | ||
|
|
9ed89c9d9c | ||
|
|
6110857115 | ||
|
|
36afcc383a | ||
|
|
9e7ca26738 | ||
|
|
de38f9c61f | ||
|
|
aa14b2d994 | ||
|
|
a6a3dee962 | ||
|
|
0324f8d422 | ||
|
|
5a9c4223f6 | ||
|
|
eeeb6c7b23 | ||
|
|
206e3f08de | ||
|
|
61a80b3a12 | ||
|
|
4da3feb0e9 | ||
|
|
a3d39ceb13 | ||
|
|
b252cc8d6d | ||
|
|
afac7f3a78 | ||
|
|
fae6846955 | ||
|
|
f79e8bdcaf | ||
|
|
ebfdc834f2 | ||
|
|
6e5ac55673 | ||
|
|
43d2406f55 | ||
|
|
29772527c8 | ||
|
|
4e72061130 | ||
|
|
470cfd9491 | ||
|
|
ff9a9a2bdf | ||
|
|
a3db75c4b3 | ||
|
|
46fb234f5f | ||
|
|
1e985af9d7 | ||
|
|
8ef38f80ec | ||
|
|
047f0c2125 | ||
|
|
a10c7fcd7c | ||
|
|
54a0879129 | ||
|
|
494d8173bd | ||
|
|
e8b739e317 |
7
GNUmakefile
Normal file
7
GNUmakefile
Normal file
@@ -0,0 +1,7 @@
|
||||
# Having a separate GNUmakefile lets me `include' the dynamically
|
||||
# generated rules created via Makefile.maint as well as Makefile.maint itself.
|
||||
# This makefile is used only if you run GNU Make.
|
||||
# It is necessary if you modify files in the m4/ directory or
|
||||
# want to build targets usually of interest only to the maintainer.
|
||||
include Makefile
|
||||
include $(srcdir)/Makefile.maint
|
||||
@@ -22,6 +22,7 @@ cvs-dist: maintainer-check
|
||||
echo "VERSION not new; not tagging" 1>&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
cvs update po; \
|
||||
cvs tag -c $$tag
|
||||
$(MAKE) dist
|
||||
|
||||
@@ -54,7 +55,7 @@ aclocal-files: configure.in m4/Makefile.am
|
||||
echo >> $@-tmp
|
||||
mv $@-tmp $@
|
||||
|
||||
include aclocal-files
|
||||
-include aclocal-files
|
||||
|
||||
# Override default rule to use --acdir option
|
||||
$(srcdir)/aclocal.m4: configure.in $(acfiles)
|
||||
|
||||
4
THANKS
4
THANKS
@@ -6,9 +6,12 @@ Andreas Schwab: schwab@issan.informatik.uni-dortmund.de
|
||||
Arne Henrik Juul: arnej@imf.unit.no
|
||||
Bauke Jan Douma: bjdouma@xs4all.nl
|
||||
Bengt Martensson: bengt@mathematik.uni-Bremen.de
|
||||
Bjorn Helgaas: helgaas@rsn.hp.com
|
||||
Charles Karney: karney@pppl.gov
|
||||
Eirik Fuller: eirik@netcom.com
|
||||
Eli Zaretskii: eliz@is.elta.co.il
|
||||
Emile LeBlanc: leblanc@math.toronto.edu
|
||||
François Pinard: pinard@iro.umontreal.ca
|
||||
Galen Hazelwood: galenh@micron.net
|
||||
Greg McGary: gkm@eng.ascend.com
|
||||
Hugh Daniel: hugh@xanadu.com
|
||||
@@ -17,6 +20,7 @@ James Antill: jmanti%essex.ac.uk@seralph21.essex.ac.uk
|
||||
Jesse Thilo: jgt2@eecs.lehigh.edu
|
||||
Joakim Rosqvist: dvljrt@cs.umu.se
|
||||
John Gatewood Ham: zappaman@alphabox.compsci.buu.ac.th
|
||||
Kjetil Torgrim Homme: kjetilho@ifi.uio.no
|
||||
Marcus Daniels: marcus@sysc.pdx.edu
|
||||
Mark A. Thomas: thommark@access.digex.net
|
||||
Mark Harris: mark@monitor.designacc.com
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
MVDIR_PROG = @MVDIR_PROG@
|
||||
@@ -115,8 +114,8 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .dvi .info .ps .texi .texinfo
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
.SUFFIXES: .dvi .info .ps .texi .texinfo .txi
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits doc/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
@@ -124,7 +123,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
version.texi: @MAINT@stamp-vti
|
||||
version.texi: stamp-vti
|
||||
cp $(srcdir)/stamp-vti $(srcdir)/version.texi
|
||||
|
||||
stamp-vti: fileutils.texi $(top_srcdir)/configure.in
|
||||
@@ -145,7 +144,7 @@ clean-vti:
|
||||
distclean-vti:
|
||||
|
||||
maintainer-clean-vti:
|
||||
-@MAINT@rm -f stamp-vti version.texi
|
||||
-rm -f stamp-vti version.texi
|
||||
|
||||
fileutils.info: fileutils.texi version.texi
|
||||
fileutils.dvi: fileutils.texi version.texi
|
||||
@@ -180,6 +179,20 @@ DVIPS = dvips
|
||||
.texinfo.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.txi.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
.dvi.ps:
|
||||
$(DVIPS) $< -o $@
|
||||
|
||||
@@ -212,7 +225,7 @@ uninstall-info:
|
||||
test -z "$ii" \
|
||||
|| install-info --info-dir=$(infodir) --remove $$file; \
|
||||
done
|
||||
$(NORMAL_UNINSTALL)
|
||||
@$(NORMAL_UNINSTALL)
|
||||
for file in $(INFO_DEPS); do \
|
||||
(cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
done
|
||||
|
||||
@@ -14,7 +14,7 @@ addext.c argmatch.c backupfile.c basename.c \
|
||||
closeout.c dirname.c exclude.c filemode.c \
|
||||
full-write.c human.c idcache.c \
|
||||
isdir.c long-options.c makepath.c modechange.c hash.c path-concat.c \
|
||||
safe-read.c save-cwd.c savedir.c stripslash.c userspec.c xgetcwd.c \
|
||||
quotearg.c safe-read.c save-cwd.c savedir.c stripslash.c userspec.c xgetcwd.c \
|
||||
xmalloc.c xstrdup.c xstrtol.c xstrtoul.c yesno.c
|
||||
|
||||
libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||
@@ -24,6 +24,6 @@ noinst_HEADERS = argmatch.h backupfile.h closeout.h \
|
||||
error.h exclude.h fnmatch.h fsusage.h \
|
||||
getdate.h getline.h getopt.h group-member.h human.h long-options.h \
|
||||
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
|
||||
save-cwd.h savedir.h strverscmp.h xalloc.h xstrtol.h xstrtoul.h
|
||||
quotearg.h save-cwd.h savedir.h strverscmp.h xalloc.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
@@ -102,7 +101,7 @@ addext.c argmatch.c backupfile.c basename.c \
|
||||
closeout.c dirname.c exclude.c filemode.c \
|
||||
full-write.c human.c idcache.c \
|
||||
isdir.c long-options.c makepath.c modechange.c hash.c path-concat.c \
|
||||
safe-read.c save-cwd.c savedir.c stripslash.c userspec.c xgetcwd.c \
|
||||
quotearg.c safe-read.c save-cwd.c savedir.c stripslash.c userspec.c xgetcwd.c \
|
||||
xmalloc.c xstrdup.c xstrtol.c xstrtoul.c yesno.c
|
||||
|
||||
libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||
@@ -112,7 +111,7 @@ noinst_HEADERS = argmatch.h backupfile.h closeout.h \
|
||||
error.h exclude.h fnmatch.h fsusage.h \
|
||||
getdate.h getline.h getopt.h group-member.h human.h long-options.h \
|
||||
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
|
||||
save-cwd.h savedir.h strverscmp.h xalloc.h xstrtol.h xstrtoul.h
|
||||
quotearg.h save-cwd.h savedir.h strverscmp.h xalloc.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
@@ -130,9 +129,9 @@ libfu_a_OBJECTS = getdate$U.o posixtm$U.o getopt$U.o getopt1$U.o \
|
||||
addext$U.o argmatch$U.o backupfile$U.o basename$U.o closeout$U.o \
|
||||
dirname$U.o exclude$U.o filemode$U.o full-write$U.o human$U.o \
|
||||
idcache$U.o isdir$U.o long-options$U.o makepath$U.o modechange$U.o \
|
||||
hash$U.o path-concat$U.o safe-read$U.o save-cwd$U.o savedir$U.o \
|
||||
stripslash$U.o userspec$U.o xgetcwd$U.o xmalloc$U.o xstrdup$U.o \
|
||||
xstrtol$U.o xstrtoul$U.o yesno$U.o
|
||||
hash$U.o path-concat$U.o quotearg$U.o safe-read$U.o save-cwd$U.o \
|
||||
savedir$U.o stripslash$U.o userspec$U.o xgetcwd$U.o xmalloc$U.o \
|
||||
xstrdup$U.o xstrtol$U.o xstrtoul$U.o yesno$U.o
|
||||
AR = ar
|
||||
YLWRAP = $(srcdir)/ylwrap
|
||||
CFLAGS = @CFLAGS@
|
||||
@@ -157,28 +156,28 @@ DEP_FILES = .deps/addext.P .deps/alloca.P .deps/argmatch.P \
|
||||
.deps/backupfile.P .deps/basename.P .deps/chown.P .deps/closeout.P \
|
||||
.deps/dirname.P .deps/error.P .deps/euidaccess.P .deps/exclude.P \
|
||||
.deps/fileblocks.P .deps/filemode.P .deps/fnmatch.P .deps/fsusage.P \
|
||||
.deps/ftruncate.P .deps/full-write.P .deps/getdate.P .deps/getgroups.P \
|
||||
.deps/getline.P .deps/getopt.P .deps/getopt1.P .deps/group-member.P \
|
||||
.deps/hash.P .deps/human.P .deps/idcache.P .deps/isdir.P \
|
||||
.deps/long-options.P .deps/lstat.P .deps/makepath.P .deps/malloc.P \
|
||||
.deps/memcmp.P .deps/memcpy.P .deps/memset.P .deps/mkdir.P \
|
||||
.deps/mktime.P .deps/modechange.P .deps/mountlist.P .deps/obstack.P \
|
||||
.deps/path-concat.P .deps/posixtm.P .deps/realloc.P .deps/regex.P \
|
||||
.deps/rename.P .deps/rmdir.P .deps/rpmatch.P .deps/rx.P \
|
||||
.deps/safe-read.P .deps/save-cwd.P .deps/savedir.P .deps/stat.P \
|
||||
.deps/stpcpy.P .deps/strcasecmp.P .deps/strdup.P .deps/strftime.P \
|
||||
.deps/stripslash.P .deps/strndup.P .deps/strstr.P .deps/strtol.P \
|
||||
.deps/strtoul.P .deps/strverscmp.P .deps/userspec.P .deps/xgetcwd.P \
|
||||
.deps/xmalloc.P .deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P \
|
||||
.deps/yesno.P
|
||||
.deps/ftruncate.P .deps/full-write.P .deps/getdate .deps/getdate.P \
|
||||
.deps/getgroups.P .deps/getline.P .deps/getopt.P .deps/getopt1.P \
|
||||
.deps/group-member.P .deps/hash.P .deps/human.P .deps/idcache.P \
|
||||
.deps/isdir.P .deps/long-options.P .deps/lstat.P .deps/makepath.P \
|
||||
.deps/malloc.P .deps/memcmp.P .deps/memcpy.P .deps/memset.P \
|
||||
.deps/mkdir.P .deps/mktime.P .deps/modechange.P .deps/mountlist.P \
|
||||
.deps/obstack.P .deps/path-concat.P .deps/posixtm .deps/posixtm.P \
|
||||
.deps/quotearg.P .deps/realloc.P .deps/regex.P .deps/rename.P \
|
||||
.deps/rmdir.P .deps/rpmatch.P .deps/rx.P .deps/safe-read.P \
|
||||
.deps/save-cwd.P .deps/savedir.P .deps/stat.P .deps/stpcpy.P \
|
||||
.deps/strcasecmp.P .deps/strdup.P .deps/strftime.P .deps/stripslash.P \
|
||||
.deps/strndup.P .deps/strstr.P .deps/strtol.P .deps/strtoul.P \
|
||||
.deps/strverscmp.P .deps/userspec.P .deps/xgetcwd.P .deps/xmalloc.P \
|
||||
.deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
|
||||
SOURCES = $(libfu_a_SOURCES)
|
||||
OBJECTS = $(libfu_a_OBJECTS)
|
||||
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .h .o .s .y
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
.SUFFIXES: .S .c .o .s .y
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits lib/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
@@ -195,9 +194,6 @@ distclean-noinstLIBRARIES:
|
||||
|
||||
maintainer-clean-noinstLIBRARIES:
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
@@ -205,7 +201,7 @@ maintainer-clean-noinstLIBRARIES:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
@@ -232,8 +228,9 @@ libfu.a: $(libfu_a_OBJECTS) $(libfu_a_DEPENDENCIES)
|
||||
$(RANLIB) libfu.a
|
||||
.y.c:
|
||||
$(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS)
|
||||
.y.h:
|
||||
$(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS)
|
||||
posixtm.h: posixtm.c
|
||||
getdate.h: getdate.c
|
||||
|
||||
addext_.c: addext.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/addext.c; then echo $(srcdir)/addext.c; else echo addext.c; fi` addext_.c
|
||||
alloca_.c: alloca.c $(ANSI2KNR)
|
||||
@@ -316,6 +313,8 @@ path-concat_.c: path-concat.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/path-concat.c; then echo $(srcdir)/path-concat.c; else echo path-concat.c; fi` path-concat_.c
|
||||
posixtm_.c: posixtm.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/posixtm.c; then echo $(srcdir)/posixtm.c; else echo posixtm.c; fi` posixtm_.c
|
||||
quotearg_.c: quotearg.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/quotearg.c; then echo $(srcdir)/quotearg.c; else echo quotearg.c; fi` quotearg_.c
|
||||
realloc_.c: realloc.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` realloc_.c
|
||||
regex_.c: regex.c $(ANSI2KNR)
|
||||
@@ -377,11 +376,11 @@ getgroups_.o getline_.o getopt_.o getopt1_.o group-member_.o hash_.o \
|
||||
human_.o idcache_.o isdir_.o long-options_.o lstat_.o makepath_.o \
|
||||
malloc_.o memcmp_.o memcpy_.o memset_.o mkdir_.o mktime_.o \
|
||||
modechange_.o mountlist_.o obstack_.o path-concat_.o posixtm_.o \
|
||||
realloc_.o regex_.o rename_.o rmdir_.o rpmatch_.o rx_.o safe-read_.o \
|
||||
save-cwd_.o savedir_.o stat_.o stpcpy_.o strcasecmp_.o strdup_.o \
|
||||
strftime_.o stripslash_.o strndup_.o strstr_.o strtol_.o strtoul_.o \
|
||||
strverscmp_.o userspec_.o xgetcwd_.o xmalloc_.o xstrdup_.o xstrtol_.o \
|
||||
xstrtoul_.o yesno_.o : $(ANSI2KNR)
|
||||
quotearg_.o realloc_.o regex_.o rename_.o rmdir_.o rpmatch_.o rx_.o \
|
||||
safe-read_.o save-cwd_.o savedir_.o stat_.o stpcpy_.o strcasecmp_.o \
|
||||
strdup_.o strftime_.o stripslash_.o strndup_.o strstr_.o strtol_.o \
|
||||
strtoul_.o strverscmp_.o userspec_.o xgetcwd_.o xmalloc_.o xstrdup_.o \
|
||||
xstrtol_.o xstrtoul_.o yesno_.o : $(ANSI2KNR)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
@@ -392,8 +391,12 @@ ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) $(LISP) -o $$here/TAGS)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
@@ -421,12 +424,7 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
|
||||
MKDEP = $(CC) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
-include .deps/.P
|
||||
.deps/.P: $(BUILT_SOURCES)
|
||||
echo > $@
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
@@ -439,13 +437,16 @@ distclean-depend:
|
||||
maintainer-clean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
.deps/%.P: %.c
|
||||
@echo "Computing dependencies for $<..."
|
||||
@o='o'; \
|
||||
test -n "$o" && o='$$o'; \
|
||||
$(MKDEP) $< >$@.tmp \
|
||||
&& sed "s,^\(.*\)\.o:,\1.$$o \1.l$$o $@:," < $@.tmp > $@ \
|
||||
&& rm -f $@.tmp
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
|
||||
< .deps/$(*F).p > .deps/$(*F).P
|
||||
@-rm -f .deps/$(*F).p
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
|
||||
@@ -1,15 +1,30 @@
|
||||
/* basename.c -- return the last element in a path */
|
||||
/* basename.c -- return the last element in a path
|
||||
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
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. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef FILESYSTEM_PREFIX_LEN
|
||||
# define FILESYSTEM_PREFIX_LEN(f) 0
|
||||
# define FILESYSTEM_PREFIX_LEN(Filename) 0
|
||||
#endif
|
||||
|
||||
#ifndef ISSLASH
|
||||
# define ISSLASH(c) ((c) == '/')
|
||||
# define ISSLASH(C) ((C) == '/')
|
||||
#endif
|
||||
|
||||
/* In general, we can't use the builtin `basename' function if available,
|
||||
@@ -17,8 +32,7 @@
|
||||
In some environments the builtin `basename' modifies its argument. */
|
||||
|
||||
char *
|
||||
base_name (name)
|
||||
char const *name;
|
||||
base_name (char const *name)
|
||||
{
|
||||
char const *base = name += FILESYSTEM_PREFIX_LEN (name);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#ifndef EXIT_FAILURE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* dirname.c -- return all but the last element in a path
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,22 +15,22 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
char *malloc ();
|
||||
#endif
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
#include <string.h>
|
||||
#if defined STDC_HEADERS || defined HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#ifndef strrchr
|
||||
#define strrchr rindex
|
||||
#endif
|
||||
# include <strings.h>
|
||||
# ifndef strrchr
|
||||
# define strrchr rindex
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Return the leading directories part of PATH,
|
||||
|
||||
78
lib/error.c
78
lib/error.c
@@ -1,10 +1,14 @@
|
||||
/* error.c -- error handler for noninteractive utilities
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
/* Error handler for noninteractive utilities
|
||||
Copyright (C) 1990,91,92,93,94,95,96,97 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
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
|
||||
@@ -12,13 +16,14 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -43,12 +48,11 @@
|
||||
void exit ();
|
||||
#endif
|
||||
|
||||
#ifndef _
|
||||
# define _(String) String
|
||||
#endif
|
||||
#include "error.h"
|
||||
|
||||
/* Get prototypes for the functions defined here. */
|
||||
#include <error.h>
|
||||
#ifndef _
|
||||
#define _(String) String
|
||||
#endif
|
||||
|
||||
/* If NULL, error will flush stdout, then print on stderr the program
|
||||
name, a colon and a space. Otherwise, error will call this
|
||||
@@ -65,15 +69,21 @@ unsigned int error_message_count;
|
||||
#ifdef _LIBC
|
||||
/* In the GNU C library, there is a predefined variable for this. */
|
||||
|
||||
# define program_name program_invocation_name
|
||||
# include <errno.h>
|
||||
#define program_name program_invocation_name
|
||||
#include <errno.h>
|
||||
|
||||
#else /* not _LIBC */
|
||||
/* In GNU libc we want do not want to use the common name `error' directly.
|
||||
Instead make it a weak alias. */
|
||||
#define error __error
|
||||
#define error_at_line __error_at_line
|
||||
|
||||
#else
|
||||
|
||||
/* The calling program should define program_name and set it to the
|
||||
name of the executing program. */
|
||||
extern char *program_name;
|
||||
|
||||
#ifndef HAVE_STRERROR_R
|
||||
# if HAVE_STRERROR
|
||||
# ifndef strerror /* On some systems, strerror is a macro */
|
||||
char *strerror ();
|
||||
@@ -87,13 +97,13 @@ private_strerror (errnum)
|
||||
extern int sys_nerr;
|
||||
|
||||
if (errnum > 0 && errnum <= sys_nerr)
|
||||
return sys_errlist[errnum];
|
||||
return _(sys_errlist[errnum]);
|
||||
return _("Unknown system error");
|
||||
}
|
||||
# define strerror private_strerror
|
||||
# endif /* HAVE_STRERROR */
|
||||
|
||||
#endif /* not _LIBC */
|
||||
#endif /* HAVE_STRERROR_R */
|
||||
#endif /* _LIBC */
|
||||
|
||||
/* Print the program name and error message MESSAGE, which is a printf-style
|
||||
format string with optional args.
|
||||
@@ -138,7 +148,14 @@ error (status, errnum, message, va_alist)
|
||||
|
||||
++error_message_count;
|
||||
if (errnum)
|
||||
fprintf (stderr, ": %s", strerror (errnum));
|
||||
{
|
||||
#if defined HAVE_STRERROR_R || defined _LIBC
|
||||
char errbuf[1024];
|
||||
fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
|
||||
#else
|
||||
fprintf (stderr, ": %s", strerror (errnum));
|
||||
#endif
|
||||
}
|
||||
putc ('\n', stderr);
|
||||
fflush (stderr);
|
||||
if (status)
|
||||
@@ -206,9 +223,24 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
||||
|
||||
++error_message_count;
|
||||
if (errnum)
|
||||
fprintf (stderr, ": %s", strerror (errnum));
|
||||
{
|
||||
#if defined HAVE_STRERROR_R || defined _LIBC
|
||||
char errbuf[1024];
|
||||
fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
|
||||
#else
|
||||
fprintf (stderr, ": %s", strerror (errnum));
|
||||
#endif
|
||||
}
|
||||
putc ('\n', stderr);
|
||||
fflush (stderr);
|
||||
if (status)
|
||||
exit (status);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Make the weak alias. */
|
||||
#undef error
|
||||
#undef error_at_line
|
||||
weak_alias (__error, error)
|
||||
weak_alias (__error_at_line, error_at_line)
|
||||
#endif
|
||||
|
||||
57
lib/error.h
57
lib/error.h
@@ -1,10 +1,14 @@
|
||||
/* error.h -- declaration for error-reporting function
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
/* Declaration for error-reporting function
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
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
|
||||
@@ -12,26 +16,31 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifndef ERROR_H_
|
||||
# define ERROR_H_
|
||||
#ifndef _ERROR_H
|
||||
#define _ERROR_H 1
|
||||
|
||||
# ifndef __attribute__
|
||||
#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
/* The __-protected variants of `format' and `printf' attributes
|
||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||
# define __format__ format
|
||||
# define __printf__ printf
|
||||
# endif
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||
# define __format__ format
|
||||
# define __printf__ printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if defined (__STDC__) && __STDC__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
|
||||
/* Print a message with `fprintf (stderr, FORMAT, ...)';
|
||||
if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
|
||||
@@ -49,11 +58,11 @@ extern void error_at_line (int status, int errnum, const char *fname,
|
||||
function without parameters instead. */
|
||||
extern void (*error_print_progname) (void);
|
||||
|
||||
# else
|
||||
#else
|
||||
void error ();
|
||||
void error_at_line ();
|
||||
extern void (*error_print_progname) ();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* This variable is incremented each time `error' is called. */
|
||||
extern unsigned int error_message_count;
|
||||
@@ -62,4 +71,8 @@ extern unsigned int error_message_count;
|
||||
variable controls whether this mode is selected or not. */
|
||||
extern int error_one_per_line;
|
||||
|
||||
#endif /* not ERROR_H_ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* error.h */
|
||||
|
||||
@@ -21,7 +21,7 @@ Suite 330, Boston, MA 02111-1307, USA. */
|
||||
/* Written by David MacKenzie and Torbjorn Granlund.
|
||||
Adapted for GNU C library by Roland McGrath. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
@@ -111,7 +111,7 @@ static gid_t egid;
|
||||
/* Nonzero if UID, GID, EUID, and EGID have valid values. */
|
||||
static int have_ids = 0;
|
||||
|
||||
# ifdef HAVE_GETGROUPS
|
||||
# if HAVE_GETGROUPS
|
||||
int group_member ();
|
||||
# else
|
||||
# define group_member(gid) 0
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
/* Written by Brian L. Matthews, blm@6sceng.UUCP. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
@@ -34,6 +34,11 @@
|
||||
# endif
|
||||
|
||||
# ifndef NINDIR
|
||||
|
||||
# if defined (__DJGPP__)
|
||||
typedef long daddr_t; /* for disk address */
|
||||
# endif
|
||||
|
||||
/* Some SysV's, like Irix, seem to lack this. Hope it's correct. */
|
||||
/* Number of inode pointers per indirect block. */
|
||||
# define NINDIR (BSIZE / sizeof (daddr_t))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* filemode.c -- make a string describing file modes
|
||||
Copyright (C) 1985, 1990, 1993 Free Software Foundation, Inc.
|
||||
Copyright (C) 1985, 1990, 1993, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,8 +15,8 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -47,45 +47,45 @@
|
||||
#endif
|
||||
|
||||
#ifdef STAT_MACROS_BROKEN
|
||||
#undef S_ISBLK
|
||||
#undef S_ISCHR
|
||||
#undef S_ISDIR
|
||||
#undef S_ISFIFO
|
||||
#undef S_ISLNK
|
||||
#undef S_ISMPB
|
||||
#undef S_ISMPC
|
||||
#undef S_ISNWK
|
||||
#undef S_ISREG
|
||||
#undef S_ISSOCK
|
||||
# undef S_ISBLK
|
||||
# undef S_ISCHR
|
||||
# undef S_ISDIR
|
||||
# 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. */
|
||||
|
||||
#if !defined(S_ISBLK) && defined(S_IFBLK)
|
||||
#define S_ISBLK(m) (((m) & S_IFMT) == 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)
|
||||
# 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)
|
||||
# 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)
|
||||
# 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)
|
||||
# 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)
|
||||
# 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)
|
||||
# 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)
|
||||
# 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)
|
||||
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
|
||||
#endif
|
||||
|
||||
void mode_string ();
|
||||
|
||||
@@ -1,37 +1,52 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C
|
||||
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
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 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. */
|
||||
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. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Enable GNU extensions in fnmatch.h. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <fnmatch.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined (STDC_HEADERS) || !defined (isascii)
|
||||
# define ISASCII(c) 1
|
||||
#else
|
||||
# define ISASCII(c) isascii(c)
|
||||
#endif
|
||||
|
||||
#define ISUPPER(c) (ISASCII (c) && isupper (c))
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined _LIBC || !defined __GNU_LIBRARY__
|
||||
|
||||
|
||||
# if defined STDC_HEADERS || !defined isascii
|
||||
# define ISASCII(c) 1
|
||||
# else
|
||||
# define ISASCII(c) isascii(c)
|
||||
# endif
|
||||
|
||||
# define ISUPPER(c) (ISASCII (c) && isupper (c))
|
||||
|
||||
|
||||
# ifndef errno
|
||||
extern int errno;
|
||||
@@ -49,7 +64,7 @@ fnmatch (pattern, string, flags)
|
||||
register char c;
|
||||
|
||||
/* Note that this evaluates C many times. */
|
||||
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
|
||||
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
|
||||
|
||||
while ((c = *p++) != '\0')
|
||||
{
|
||||
@@ -71,6 +86,9 @@ fnmatch (pattern, string, flags)
|
||||
if (!(flags & FNM_NOESCAPE))
|
||||
{
|
||||
c = *p++;
|
||||
if (c == '\0')
|
||||
/* Trailing \ loses. */
|
||||
return FNM_NOMATCH;
|
||||
c = FOLD (c);
|
||||
}
|
||||
if (FOLD (*n) != c)
|
||||
@@ -82,10 +100,24 @@ fnmatch (pattern, string, flags)
|
||||
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
|
||||
if (((flags & FNM_FILE_NAME) && *n == '/') ||
|
||||
(c == '?' && *n == '\0'))
|
||||
return FNM_NOMATCH;
|
||||
for (c = *p++; c == '?' || c == '*'; c = *p++)
|
||||
{
|
||||
if ((flags & FNM_FILE_NAME) && *n == '/')
|
||||
/* A slash does not match a wildcard under FNM_FILE_NAME. */
|
||||
return FNM_NOMATCH;
|
||||
else if (c == '?')
|
||||
{
|
||||
/* A ? needs to match one character. */
|
||||
if (*n == '\0')
|
||||
/* There isn't another character; no match. */
|
||||
return FNM_NOMATCH;
|
||||
else
|
||||
/* One character of the string is consumed in matching
|
||||
this ? wildcard, so *??? won't match if there are
|
||||
less than three characters. */
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == '\0')
|
||||
return 0;
|
||||
@@ -122,7 +154,11 @@ fnmatch (pattern, string, flags)
|
||||
register char cstart = c, cend = c;
|
||||
|
||||
if (!(flags & FNM_NOESCAPE) && c == '\\')
|
||||
cstart = cend = *p++;
|
||||
{
|
||||
if (*p == '\0')
|
||||
return FNM_NOMATCH;
|
||||
cstart = cend = *p++;
|
||||
}
|
||||
|
||||
cstart = cend = FOLD (cstart);
|
||||
|
||||
@@ -169,8 +205,12 @@ fnmatch (pattern, string, flags)
|
||||
|
||||
c = *p++;
|
||||
if (!(flags & FNM_NOESCAPE) && c == '\\')
|
||||
/* XXX 1003.2d11 is unclear if this is right. */
|
||||
++p;
|
||||
{
|
||||
if (*p == '\0')
|
||||
return FNM_NOMATCH;
|
||||
/* XXX 1003.2d11 is unclear if this is right. */
|
||||
++p;
|
||||
}
|
||||
}
|
||||
if (not)
|
||||
return FNM_NOMATCH;
|
||||
@@ -196,3 +236,5 @@ fnmatch (pattern, string, flags)
|
||||
|
||||
# undef FOLD
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* ftruncate emulations that work on some System V's.
|
||||
This file is in the public domain. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -19,15 +19,15 @@ ftruncate (fd, length)
|
||||
}
|
||||
|
||||
#else /* not F_CHSIZE */
|
||||
#ifdef F_FREESP
|
||||
# ifdef F_FREESP
|
||||
|
||||
/* By William Kucharski <kucharsk@netcom.com>. */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
# include <sys/stat.h>
|
||||
# include <errno.h>
|
||||
# if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
|
||||
int
|
||||
ftruncate (fd, length)
|
||||
@@ -71,8 +71,8 @@ ftruncate (fd, length)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* not F_CHSIZE nor F_FREESP */
|
||||
#ifdef HAVE_CHSIZE
|
||||
# else /* not F_CHSIZE nor F_FREESP */
|
||||
# if HAVE_CHSIZE
|
||||
|
||||
int
|
||||
ftruncate (fd, length)
|
||||
@@ -82,12 +82,12 @@ ftruncate (fd, length)
|
||||
return chsize (fd, length);
|
||||
}
|
||||
|
||||
#else /* not F_CHSIZE nor F_FREESP nor HAVE_CHSIZE */
|
||||
# else /* not F_CHSIZE nor F_FREESP nor HAVE_CHSIZE */
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
# include <errno.h>
|
||||
# ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
int
|
||||
ftruncate (fd, length)
|
||||
@@ -98,6 +98,6 @@ ftruncate (fd, length)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* not HAVE_CHSIZE */
|
||||
#endif /* not F_FREESP */
|
||||
# endif /* not HAVE_CHSIZE */
|
||||
# endif /* not F_FREESP */
|
||||
#endif /* not F_CHSIZE */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* full-write.c -- an interface to write that retries after interrupts
|
||||
Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -37,10 +37,7 @@ extern int errno;
|
||||
Return LEN upon success, write's (negative) error code otherwise. */
|
||||
|
||||
int
|
||||
full_write (desc, ptr, len)
|
||||
int desc;
|
||||
char *ptr;
|
||||
size_t len;
|
||||
full_write (int desc, const char *ptr, size_t len)
|
||||
{
|
||||
int total_written;
|
||||
|
||||
|
||||
@@ -14,28 +14,28 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(args) args
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (vms)
|
||||
#ifdef vms
|
||||
# include <types.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# ifdef TIME_WITH_SYS_TIME
|
||||
# if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
# else
|
||||
# ifdef HAVE_SYS_TIME_H
|
||||
# if HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* getugroups.c -- return a list of the groups a user is in
|
||||
Copyright (C) 1990, 1991 Free Software Foundation.
|
||||
Copyright (C) 1990, 1991, 1998 Free Software Foundation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -45,10 +45,7 @@ struct group *getgrent ();
|
||||
the current process. */
|
||||
|
||||
int
|
||||
getugroups (maxcount, grouplist, username)
|
||||
int maxcount;
|
||||
GETGROUPS_T *grouplist;
|
||||
char *username;
|
||||
getugroups (int maxcount, GETGROUPS_T *grouplist, char *username)
|
||||
{
|
||||
struct group *grp;
|
||||
register char **cp;
|
||||
@@ -59,16 +56,27 @@ getugroups (maxcount, grouplist, username)
|
||||
for (cp = grp->gr_mem; *cp; ++cp)
|
||||
if (!strcmp (username, *cp))
|
||||
{
|
||||
if (maxcount != 0)
|
||||
int n;
|
||||
|
||||
/* See if this group number is already on the list. */
|
||||
for (n = 0; n < count; ++n)
|
||||
if (grouplist[n] == grp->gr_gid)
|
||||
break;
|
||||
|
||||
/* If it's a new group number, then try to add it to the list. */
|
||||
if (n == count)
|
||||
{
|
||||
if (count >= maxcount)
|
||||
if (maxcount != 0)
|
||||
{
|
||||
endgrent ();
|
||||
return count;
|
||||
if (count >= maxcount)
|
||||
{
|
||||
endgrent ();
|
||||
return count;
|
||||
}
|
||||
grouplist[count] = grp->gr_gid;
|
||||
}
|
||||
grouplist[count] = grp->gr_gid;
|
||||
count++;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
endgrent ();
|
||||
return count;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* group-member.c -- determine whether group id is in calling user's group list
|
||||
Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,7 +15,7 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,7 @@ struct group_info
|
||||
GETGROUPS_T *group;
|
||||
};
|
||||
|
||||
#ifdef HAVE_GETGROUPS
|
||||
#if HAVE_GETGROUPS
|
||||
|
||||
static void
|
||||
free_group_info (struct group_info *g)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* idcache.c -- map user and group IDs, cached for speed
|
||||
Copyright (C) 1985, 1988, 1989, 1990, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1985, 1988, 1989, 1990, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
#if STDC_HEADERS || HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
@@ -44,6 +44,10 @@ struct group *getgrnam ();
|
||||
char *xmalloc ();
|
||||
char *xstrdup ();
|
||||
|
||||
#ifdef __DJGPP__
|
||||
static char digits[] = "0123456789";
|
||||
#endif
|
||||
|
||||
struct userid
|
||||
{
|
||||
union
|
||||
@@ -55,23 +59,15 @@ struct userid
|
||||
struct userid *next;
|
||||
};
|
||||
|
||||
/* The members of this list have already been looked up.
|
||||
If a name is NULL, the corresponding id is not in the password file. */
|
||||
static struct userid *user_alist;
|
||||
|
||||
#ifdef NOT_USED
|
||||
/* The members of this list are names not in the local passwd file;
|
||||
their names are always not NULL, and their ids are irrelevant. */
|
||||
/* The members of this list have names not in the local passwd file. */
|
||||
static struct userid *nouser_alist;
|
||||
#endif /* NOT_USED */
|
||||
|
||||
/* Translate UID to a login name, with cache.
|
||||
If UID cannot be resolved, return NULL.
|
||||
Cache lookup failures, too. */
|
||||
/* Translate UID to a login name, with cache, or NULL if unresolved. */
|
||||
|
||||
char *
|
||||
getuser (uid)
|
||||
uid_t uid;
|
||||
getuser (uid_t uid)
|
||||
{
|
||||
register struct userid *tail;
|
||||
struct passwd *pwent;
|
||||
@@ -83,31 +79,28 @@ getuser (uid)
|
||||
pwent = getpwuid (uid);
|
||||
tail = (struct userid *) xmalloc (sizeof (struct userid));
|
||||
tail->id.u = uid;
|
||||
tail->name = (pwent ? xstrdup (pwent->pw_name) : NULL);
|
||||
tail->name = pwent ? xstrdup (pwent->pw_name) : NULL;
|
||||
|
||||
/* Add to the head of the list, so most recently added is first. */
|
||||
/* Add to the head of the list, so most recently used is first. */
|
||||
tail->next = user_alist;
|
||||
user_alist = tail;
|
||||
return tail->name;
|
||||
}
|
||||
|
||||
#ifdef NOT_USED
|
||||
|
||||
/* Translate USER to a UID, with cache.
|
||||
Return NULL if there is no such user.
|
||||
(We also cache which user names have no passwd entry,
|
||||
so we don't keep looking them up.) */
|
||||
|
||||
uid_t *
|
||||
getuidbyname (user)
|
||||
const char *user;
|
||||
getuidbyname (const char *user)
|
||||
{
|
||||
register struct userid *tail;
|
||||
struct passwd *pwent;
|
||||
|
||||
for (tail = user_alist; tail; tail = tail->next)
|
||||
/* Avoid a function call for the most common case. */
|
||||
if (tail->name && *tail->name == *user && !strcmp (tail->name, user))
|
||||
if (*tail->name == *user && !strcmp (tail->name, user))
|
||||
return &tail->id.u;
|
||||
|
||||
for (tail = nouser_alist; tail; tail = tail->next)
|
||||
@@ -116,11 +109,20 @@ getuidbyname (user)
|
||||
return 0;
|
||||
|
||||
pwent = getpwnam (user);
|
||||
#ifdef __DJGPP__
|
||||
/* We need to pretend to be the user USER, to make
|
||||
pwd functions know about an arbitrary user name. */
|
||||
if (!pwent && strspn (user, digits) < strlen (user))
|
||||
{
|
||||
setenv ("USER", user, 1);
|
||||
pwent = getpwnam (user); /* now it will succeed */
|
||||
}
|
||||
#endif
|
||||
|
||||
tail = (struct userid *) xmalloc (sizeof (struct userid));
|
||||
tail->name = xstrdup (user);
|
||||
|
||||
/* Add to the head of the list, so most recently added is first. */
|
||||
/* Add to the head of the list, so most recently used is first. */
|
||||
if (pwent)
|
||||
{
|
||||
tail->id.u = pwent->pw_uid;
|
||||
@@ -134,20 +136,14 @@ getuidbyname (user)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* NOT_USED */
|
||||
|
||||
/* Use the same struct as for userids. */
|
||||
static struct userid *group_alist;
|
||||
#ifdef NOT_USED
|
||||
static struct userid *nogroup_alist;
|
||||
#endif
|
||||
|
||||
/* Translate GID to a group name, with cache.
|
||||
Return NULL if the group has no name. */
|
||||
/* Translate GID to a group name, with cache, or NULL if unresolved. */
|
||||
|
||||
char *
|
||||
getgroup (gid)
|
||||
gid_t gid;
|
||||
getgroup (gid_t gid)
|
||||
{
|
||||
register struct userid *tail;
|
||||
struct group *grent;
|
||||
@@ -159,7 +155,7 @@ getgroup (gid)
|
||||
grent = getgrgid (gid);
|
||||
tail = (struct userid *) xmalloc (sizeof (struct userid));
|
||||
tail->id.g = gid;
|
||||
tail->name = (grent ? xstrdup (grent->gr_name) : NULL);
|
||||
tail->name = grent ? xstrdup (grent->gr_name) : NULL;
|
||||
|
||||
/* Add to the head of the list, so most recently used is first. */
|
||||
tail->next = group_alist;
|
||||
@@ -167,23 +163,20 @@ getgroup (gid)
|
||||
return tail->name;
|
||||
}
|
||||
|
||||
#ifdef NOT_USED
|
||||
|
||||
/* Translate GROUP to a GID, with cache.
|
||||
Return NULL if there is no such group.
|
||||
(We also cache which group names have no group entry,
|
||||
so we don't keep looking them up.) */
|
||||
|
||||
gid_t *
|
||||
getgidbyname (group)
|
||||
const char *group;
|
||||
getgidbyname (const char *group)
|
||||
{
|
||||
register struct userid *tail;
|
||||
struct group *grent;
|
||||
|
||||
for (tail = group_alist; tail; tail = tail->next)
|
||||
/* Avoid a function call for the most common case. */
|
||||
if (tail->name && *tail->name == *group && !strcmp (tail->name, group))
|
||||
if (*tail->name == *group && !strcmp (tail->name, group))
|
||||
return &tail->id.g;
|
||||
|
||||
for (tail = nogroup_alist; tail; tail = tail->next)
|
||||
@@ -192,6 +185,15 @@ getgidbyname (group)
|
||||
return 0;
|
||||
|
||||
grent = getgrnam (group);
|
||||
#ifdef __DJGPP__
|
||||
/* We need to pretend to belong to group GROUP, to make
|
||||
grp functions know about any arbitrary group name. */
|
||||
if (!grent && strspn (group, digits) < strlen (group))
|
||||
{
|
||||
setenv ("GROUP", group, 1);
|
||||
grent = getgrnam (group); /* now it will succeed */
|
||||
}
|
||||
#endif
|
||||
|
||||
tail = (struct userid *) xmalloc (sizeof (struct userid));
|
||||
tail->name = xstrdup (group);
|
||||
@@ -209,5 +211,3 @@ getgidbyname (group)
|
||||
nogroup_alist = tail;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* NOT_USED */
|
||||
|
||||
10
lib/isdir.c
10
lib/isdir.c
@@ -1,5 +1,5 @@
|
||||
/* isdir.c -- determine whether a directory exists
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,19 +15,19 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef STAT_MACROS_BROKEN
|
||||
#undef S_ISDIR
|
||||
# undef S_ISDIR
|
||||
#endif /* STAT_MACROS_BROKEN. */
|
||||
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
/* If PATH is an existing directory or symbolic link to a directory,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -217,6 +217,14 @@ make_path (const char *argpath,
|
||||
if (!do_chdir)
|
||||
basename_dir = dirpath;
|
||||
|
||||
/* The mkdir and stat calls below appear to be reversed.
|
||||
They are not. It is important to call mkdir first and then to
|
||||
call stat (to distinguish the three cases) only if mkdir fails.
|
||||
The alternative to this approach is to `stat' each directory,
|
||||
then to call mkdir if it doesn't exist. But if some other process
|
||||
were to create the directory between the stat & mkdir, the mkdir
|
||||
would fail with EEXIST. */
|
||||
|
||||
*slash = '\0';
|
||||
if (mkdir (basename_dir, tmp_mode))
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* mktime: convert a `struct tm' to a time_t value
|
||||
Copyright (C) 1993-1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Paul Eggert (eggert@twinsun.com).
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* mountlist.c -- return a list of mounted filesystems
|
||||
Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,7 +15,7 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
@@ -42,7 +42,7 @@ char *xrealloc ();
|
||||
char *xstrdup ();
|
||||
void error ();
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#if HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
@@ -101,7 +101,7 @@ void error ();
|
||||
# define MOUNTED_GETMNTTBL
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MNTENT_H
|
||||
#if HAVE_SYS_MNTENT_H
|
||||
/* This is to get MNTOPT_IGNORE on e.g. SVR4. */
|
||||
# include <sys/mntent.h>
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* path-concat.c -- concatenate two arbitrary pathnames
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1994, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C
|
||||
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
@@ -28,6 +28,8 @@
|
||||
systems like Irix 5.3. */
|
||||
#undef putenv
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (__GNU_LIBRARY__) || defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
@@ -51,6 +53,10 @@
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
|
||||
int
|
||||
|
||||
346
lib/quotearg.c
Normal file
346
lib/quotearg.c
Normal file
@@ -0,0 +1,346 @@
|
||||
/* quotearg.c - quote arguments for output
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Paul Eggert <eggert@twinsun.com> */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <quotearg.h>
|
||||
#include <xalloc.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
|
||||
# define ISASCII(c) 1
|
||||
#else
|
||||
# define ISASCII(c) isascii (c)
|
||||
#endif
|
||||
#ifdef isgraph
|
||||
# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
|
||||
#else
|
||||
# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
#ifndef UCHAR_MAX
|
||||
# define UCHAR_MAX ((unsigned char) -1)
|
||||
#endif
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#define INT_BITS (sizeof (int) * CHAR_BIT)
|
||||
|
||||
struct quoting_options
|
||||
{
|
||||
/* Basic quoting style. */
|
||||
enum quoting_style style;
|
||||
|
||||
/* Quote the chararacters indicated by this bit vector even if the
|
||||
quoting style would not normally require them to be quoted. */
|
||||
int quote_these_too[((UCHAR_MAX + 1) / INT_BITS
|
||||
+ ((UCHAR_MAX + 1) % INT_BITS != 0))];
|
||||
};
|
||||
|
||||
/* Names of quoting styles. */
|
||||
char const *const quoting_style_args[] =
|
||||
{
|
||||
"literal", "shell", "shell-always", "c", "escape", 0
|
||||
};
|
||||
|
||||
/* Allocate a new set of quoting options, with contents initially identical
|
||||
to O if O is not null, or to a default value if O is null.
|
||||
It is the caller's responsibility to free the result. */
|
||||
struct quoting_options *
|
||||
clone_quoting_options (struct quoting_options *o)
|
||||
{
|
||||
struct quoting_options *p
|
||||
= (struct quoting_options *) xmalloc (sizeof (struct quoting_options));
|
||||
if (o)
|
||||
*p = *o;
|
||||
else
|
||||
memset (p, 0, sizeof *p);
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Get the value of O's quoting style. */
|
||||
enum quoting_style
|
||||
get_quoting_style (struct quoting_options *o)
|
||||
{
|
||||
return o->style;
|
||||
}
|
||||
|
||||
/* In O, set the value of the quoting style to S. */
|
||||
void
|
||||
set_quoting_style (struct quoting_options *o, enum quoting_style s)
|
||||
{
|
||||
o->style = s;
|
||||
}
|
||||
|
||||
/* In O, set the value of the quoting options for character C to I.
|
||||
Return the old value. Currently, the only values defined for I are
|
||||
0 (the default) and 1 (which means to quote the character even if
|
||||
it would not otherwise be quoted). */
|
||||
int
|
||||
set_char_quoting (struct quoting_options *o, char c, int i)
|
||||
{
|
||||
unsigned char uc = c;
|
||||
int *p = o->quote_these_too + uc / INT_BITS;
|
||||
int shift = uc % INT_BITS;
|
||||
int r = (*p >> shift) & 1;
|
||||
*p ^= ((i & 1) ^ r) << shift;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Place into buffer BUF (of size BUFSIZE) a quoted version of
|
||||
argument ARG (of size ARGSIZE), using O to control quoting.
|
||||
Terminate the output with a null character, and return the written
|
||||
size of the output, not counting the terminating null.
|
||||
If BUFSIZE is too small to store the output string, return the
|
||||
value that would have been returned had BUFSIZE been large enough.
|
||||
If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */
|
||||
size_t
|
||||
quotearg_buffer (char *buf, size_t bufsize,
|
||||
char const *arg, size_t argsize,
|
||||
struct quoting_options const *o)
|
||||
{
|
||||
unsigned char c;
|
||||
size_t i;
|
||||
size_t len;
|
||||
int quote_mark;
|
||||
enum quoting_style quoting_style = o->style;
|
||||
#define STORE(c) do { if (len < bufsize) buf[len] = (c); len++; } while (0)
|
||||
|
||||
switch (quoting_style)
|
||||
{
|
||||
case shell_quoting_style:
|
||||
if (! (argsize == -1 ? arg[0] == '\0' : argsize == 0))
|
||||
{
|
||||
switch (arg[0])
|
||||
{
|
||||
case '#': case '~':
|
||||
break;
|
||||
|
||||
default:
|
||||
len = 0;
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
if (argsize == -1 ? arg[i] == '\0' : i == argsize)
|
||||
goto done;
|
||||
|
||||
c = arg[i];
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\t': case '\n': case ' ':
|
||||
case '!': /* special in csh */
|
||||
case '"': case '$': case '&': case '\'':
|
||||
case '(': case ')': case '*': case ';':
|
||||
case '<': case '>': case '?': case '[': case '\\':
|
||||
case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */
|
||||
case '`': case '|':
|
||||
goto needs_quoting;
|
||||
}
|
||||
|
||||
if (o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))
|
||||
goto needs_quoting;
|
||||
|
||||
STORE (c);
|
||||
}
|
||||
|
||||
needs_quoting:;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Fall through. */
|
||||
|
||||
case shell_always_quoting_style:
|
||||
quote_mark = '\'';
|
||||
break;
|
||||
|
||||
case c_quoting_style:
|
||||
quote_mark = '"';
|
||||
break;
|
||||
|
||||
default:
|
||||
quote_mark = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
len = 0;
|
||||
|
||||
if (quote_mark)
|
||||
STORE (quote_mark);
|
||||
|
||||
for (i = 0; ! (argsize == -1 ? arg[i] == '\0' : i == argsize); i++)
|
||||
{
|
||||
c = arg[i];
|
||||
|
||||
switch (quoting_style)
|
||||
{
|
||||
case literal_quoting_style:
|
||||
break;
|
||||
|
||||
case shell_quoting_style:
|
||||
case shell_always_quoting_style:
|
||||
if (c == '\'')
|
||||
{
|
||||
STORE ('\'');
|
||||
STORE ('\\');
|
||||
STORE ('\'');
|
||||
}
|
||||
break;
|
||||
|
||||
case c_quoting_style:
|
||||
case escape_quoting_style:
|
||||
switch (c)
|
||||
{
|
||||
case '?': /* Do not generate trigraphs. */
|
||||
case '\\': goto store_escape;
|
||||
/* Not all C compilers know what \a means. */
|
||||
case 7 : c = 'a'; goto store_escape;
|
||||
case '\b': c = 'b'; goto store_escape;
|
||||
case '\f': c = 'f'; goto store_escape;
|
||||
case '\n': c = 'n'; goto store_escape;
|
||||
case '\r': c = 'r'; goto store_escape;
|
||||
case '\t': c = 't'; goto store_escape;
|
||||
case '\v': c = 'v'; goto store_escape;
|
||||
|
||||
case ' ':
|
||||
if (quoting_style == escape_quoting_style)
|
||||
goto store_escape;
|
||||
break;
|
||||
|
||||
case '"':
|
||||
if (quoting_style == c_quoting_style)
|
||||
goto store_escape;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!ISGRAPH (c))
|
||||
{
|
||||
STORE ('\\');
|
||||
STORE ('0' + (c >> 6));
|
||||
STORE ('0' + ((c >> 3) & 3));
|
||||
c = '0' + (c & 3);
|
||||
goto store_c;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (! (o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))))
|
||||
goto store_c;
|
||||
|
||||
store_escape:
|
||||
STORE ('\\');
|
||||
}
|
||||
|
||||
store_c:
|
||||
STORE (c);
|
||||
}
|
||||
|
||||
if (quote_mark)
|
||||
STORE (quote_mark);
|
||||
|
||||
done:
|
||||
if (len < bufsize)
|
||||
buf[len] = '\0';
|
||||
return len;
|
||||
}
|
||||
|
||||
/* Use storage slot N to return a quoted version of the string ARG.
|
||||
OPTIONS specifies the quoting options.
|
||||
The returned value points to static storage that can be
|
||||
reused by the next call to this function with the same value of N.
|
||||
N must be nonnegative. */
|
||||
static char *
|
||||
quotearg_n_options (int n, char const *arg, struct quoting_options *options)
|
||||
{
|
||||
static unsigned nslots;
|
||||
static struct slotvec
|
||||
{
|
||||
size_t size;
|
||||
char *val;
|
||||
} *slotvec;
|
||||
|
||||
if (nslots <= n)
|
||||
{
|
||||
int n1 = n + 1;
|
||||
size_t s = n1 * sizeof (struct slotvec);
|
||||
if (! (0 < n1 && n1 == s / sizeof (struct slotvec)))
|
||||
abort ();
|
||||
slotvec = (struct slotvec *) xrealloc (slotvec, s);
|
||||
memset (slotvec + nslots, 0, (n1 - nslots) * sizeof (struct slotvec));
|
||||
nslots = n;
|
||||
}
|
||||
|
||||
{
|
||||
size_t size = slotvec[n].size;
|
||||
char *val = slotvec[n].val;
|
||||
size_t qsize = quotearg_buffer (val, size, arg, (size_t) -1, options);
|
||||
|
||||
if (size <= qsize)
|
||||
{
|
||||
slotvec[n].size = size = qsize + 1;
|
||||
slotvec[n].val = val = xrealloc (val, size);
|
||||
quotearg_buffer (val, size, arg, (size_t) -1, options);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
struct quoting_options quotearg_quoting_options;
|
||||
|
||||
char *
|
||||
quotearg_n (int n, char const *arg)
|
||||
{
|
||||
return quotearg_n_options (n, arg, "earg_quoting_options);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg (char const *arg)
|
||||
{
|
||||
return quotearg_n (0, arg);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_char (char const *arg, char ch)
|
||||
{
|
||||
struct quoting_options options;
|
||||
options = quotearg_quoting_options;
|
||||
set_char_quoting (&options, ch, 1);
|
||||
return quotearg_n_options (0, arg, &options);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_colon (char const *arg)
|
||||
{
|
||||
return quotearg_char (arg, ':');
|
||||
}
|
||||
97
lib/quotearg.h
Normal file
97
lib/quotearg.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/* quotearg.h - quote arguments for output
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Paul Eggert <eggert@twinsun.com> */
|
||||
|
||||
/* Basic quoting styles. */
|
||||
enum quoting_style
|
||||
{
|
||||
literal_quoting_style, /* --quoting-style=literal */
|
||||
shell_quoting_style, /* --quoting-style=shell */
|
||||
shell_always_quoting_style, /* --quoting-style=shell-always */
|
||||
c_quoting_style, /* --quoting-style=c */
|
||||
escape_quoting_style /* --quoting-style=escape */
|
||||
};
|
||||
|
||||
/* For now, --quoting-style=literal is the default, but
|
||||
this is planned to change to --quoting-style=shell in the future. */
|
||||
#ifndef DEFAULT_QUOTING_STYLE
|
||||
# define DEFAULT_QUOTING_STYLE literal_quoting_style
|
||||
#endif
|
||||
|
||||
/* Names of quoting styles. */
|
||||
extern char const *const quoting_style_args[];
|
||||
|
||||
struct quoting_options;
|
||||
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Allocate a new set of quoting options, with contents initially identical
|
||||
to O if O is not null, or to a default value if O is null.
|
||||
It is the caller's responsibility to free the result. */
|
||||
struct quoting_options *clone_quoting_options
|
||||
PARAMS ((struct quoting_options *o));
|
||||
|
||||
/* Get the value of O's quoting style. */
|
||||
enum quoting_style get_quoting_style PARAMS ((struct quoting_options *o));
|
||||
|
||||
/* In O, set the value of the quoting style to S. */
|
||||
void set_quoting_style PARAMS ((struct quoting_options *o,
|
||||
enum quoting_style s));
|
||||
|
||||
/* In O, set the value of the quoting options for character C to I.
|
||||
Return the old value. Currently, the only values defined for I are
|
||||
0 (the default) and 1 (which means to quote the character even if
|
||||
it would not otherwise be quoted). */
|
||||
int set_char_quoting PARAMS ((struct quoting_options *o, char c, int i));
|
||||
|
||||
/* Place into buffer BUF (of size BUFSIZE) a quoted version of
|
||||
argument ARG (of size ARGSIZE), using O to control quoting.
|
||||
Terminate the output with a null character, and return the written
|
||||
size of the output, not counting the terminating null.
|
||||
If BUFSIZE is too small to store the output string, return the
|
||||
value that would have been returned had BUFSIZE been large enough.
|
||||
If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */
|
||||
size_t quotearg_buffer PARAMS ((char *buf, size_t bufsize,
|
||||
char const *arg, size_t argsize,
|
||||
struct quoting_options const *o));
|
||||
|
||||
/* The quoting options used by the convenience functions listed below. */
|
||||
|
||||
extern struct quoting_options quotearg_quoting_options;
|
||||
|
||||
/* Use storage slot N to return a quoted version of the string ARG.
|
||||
The variable quotearg_quoting_options specifies the quoting options.
|
||||
The returned value points to static storage that can be
|
||||
reused by the next call to this function with the same value of N.
|
||||
N must be nonnegative. */
|
||||
char *quotearg_n PARAMS ((int n, char const *arg));
|
||||
|
||||
/* Equivalent to quotearg_n (ARG, 0). */
|
||||
char *quotearg PARAMS ((char const *arg));
|
||||
|
||||
/* Like quotearg (ARG), except also quote any instances of CH. */
|
||||
char *quotearg_char PARAMS ((char const *arg, char ch));
|
||||
|
||||
/* Equivalent to quotearg_char (ARG, ':'). */
|
||||
char *quotearg_colon PARAMS ((char const *arg));
|
||||
@@ -1,5 +1,5 @@
|
||||
/* save-cwd.c -- Save and restore current working directory.
|
||||
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
/* Written by Jim Meyering <meyering@na-net.ornl.gov>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#if HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#else
|
||||
# include <sys/file.h>
|
||||
@@ -67,7 +67,7 @@ save_cwd (cwd)
|
||||
|
||||
if (have_working_fchdir)
|
||||
{
|
||||
#ifdef HAVE_FCHDIR
|
||||
#if HAVE_FCHDIR
|
||||
cwd->desc = open (".", O_RDONLY);
|
||||
if (cwd->desc < 0)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* savedir.c -- save the list of files in a directory in a string
|
||||
Copyright (C) 1990, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -17,13 +17,13 @@
|
||||
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
10
lib/strdup.c
10
lib/strdup.c
@@ -1,5 +1,5 @@
|
||||
/* strdup.c -- return a newly allocated copy of a string
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,13 +15,13 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
char *malloc ();
|
||||
char *strcpy ();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* userspec.c -- Parse a user and group string.
|
||||
Copyright (C) 1989, 1990, 1991, 1992, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989, 1990, 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -24,7 +24,7 @@
|
||||
#ifdef __GNUC__
|
||||
# define alloca __builtin_alloca
|
||||
#else
|
||||
# ifdef HAVE_ALLOCA_H
|
||||
# if HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
@@ -153,6 +153,15 @@ parse_user_spec (spec_arg, uid, gid, username_arg, groupname_arg)
|
||||
if (u == NULL && g == NULL)
|
||||
return "can not omit both user and group";
|
||||
|
||||
#ifdef __DJGPP__
|
||||
/* Pretend that we are the user U whose group is G. This makes
|
||||
pwd and grp functions ``know'' about the UID and GID of these. */
|
||||
if (u && !is_number (u))
|
||||
setenv ("USER", u, 1);
|
||||
if (g && !is_number (g))
|
||||
setenv ("GROUP", g, 1);
|
||||
#endif
|
||||
|
||||
if (u != NULL)
|
||||
{
|
||||
pwd = getpwnam (u);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xstrdup.c -- copy a string with out of memory checking
|
||||
Copyright (C) 1990, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1996, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -19,24 +19,28 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS || HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
char *xmalloc (size_t);
|
||||
char *xstrdup (char *string);
|
||||
#else
|
||||
char *xmalloc ();
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
||||
char *xmalloc PARAMS ((size_t n));
|
||||
|
||||
/* Return a newly allocated copy of STRING. */
|
||||
|
||||
char *
|
||||
xstrdup (string)
|
||||
char *string;
|
||||
xstrdup (const char *string)
|
||||
{
|
||||
return strcpy (xmalloc (strlen (string) + 1), string);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* A more useful interface to strtol.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -46,12 +46,24 @@ extern int errno;
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
/* The extra casts work around common compiler bugs. */
|
||||
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
|
||||
It is necessary at least when t == time_t. */
|
||||
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
|
||||
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
|
||||
#define TYPE_MAXIMUM(t) (~ (t) 0 - TYPE_MINIMUM (t))
|
||||
|
||||
#ifndef ULONG_MAX
|
||||
# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
|
||||
# define ULONG_MAX TYPE_MAXIMUM (unsigned long int)
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MAX
|
||||
# define LONG_MAX ((long int) (ULONG_MAX >> 1))
|
||||
# define LONG_MAX TYPE_MAXIMUM (long int)
|
||||
#endif
|
||||
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* yesno.c -- read a yes/no response from stdin
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,12 +15,12 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
18
m4/ChangeLog
18
m4/ChangeLog
@@ -1,3 +1,21 @@
|
||||
1998-03-15 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* prereq.m4: New file.
|
||||
* error.m4: New file.
|
||||
* Makefile.am (EXTRA_DIST): Add error.m4 and prereq.m4.
|
||||
|
||||
1998-02-07 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* getline.m4: Don't set am_cv_func_working_getline before the
|
||||
cache-check for the same variable -- that defeated the purpose of
|
||||
the test; the test program was never run. This was a problem only
|
||||
on systems with losing getline functions -- HP-UX 10.20 is one.
|
||||
Reported by Bjorn Helgaas.
|
||||
|
||||
1998-02-06 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add perl.m4.
|
||||
|
||||
1998-01-10 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add const.m4.
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
|
||||
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
|
||||
EXTRA_DIST = README \
|
||||
check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 getgroups.m4 \
|
||||
getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 putenv.m4 readdir.m4 \
|
||||
realloc.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
|
||||
check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 \
|
||||
getgroups.m4 getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 perl.m4 prereq.m4 putenv.m4 \
|
||||
readdir.m4 realloc.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
|
||||
mktime.m4
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -64,36 +64,26 @@ CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DF_PROG = @DF_PROG@
|
||||
GENCAT = @GENCAT@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GNU_PACKAGE = @GNU_PACKAGE@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIB_CRYPT = @LIB_CRYPT@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN = @MAN@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
NEED_SETGID = @NEED_SETGID@
|
||||
OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@
|
||||
OPTIONAL_BIN_ZCRIPTS = @OPTIONAL_BIN_ZCRIPTS@
|
||||
MVDIR_PROG = @MVDIR_PROG@
|
||||
PACKAGE = @PACKAGE@
|
||||
PERL = @PERL@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
POW_LIBM = @POW_LIBM@
|
||||
RANLIB = @RANLIB@
|
||||
SEQ_LIBM = @SEQ_LIBM@
|
||||
SQRT_LIBM = @SQRT_LIBM@
|
||||
U = @U@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
@@ -102,10 +92,10 @@ YACC = @YACC@
|
||||
l = @l@
|
||||
|
||||
EXTRA_DIST = README \
|
||||
check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 getgroups.m4 \
|
||||
getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 putenv.m4 readdir.m4 \
|
||||
realloc.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
|
||||
check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 \
|
||||
getgroups.m4 getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 perl.m4 prereq.m4 putenv.m4 \
|
||||
readdir.m4 realloc.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
|
||||
mktime.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
@@ -120,7 +110,7 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits m4/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
|
||||
11
m4/error.m4
Normal file
11
m4/error.m4
Normal file
@@ -0,0 +1,11 @@
|
||||
#serial 1
|
||||
|
||||
dnl FIXME: put these prerequisite-only *.m4 files in a separate
|
||||
dnl directory -- otherwise, they'll conflict with existing files.
|
||||
|
||||
dnl These are the prerequisite macros for GNU's error.c file.
|
||||
AC_DEFUN(jm_PREREQ_ERROR,
|
||||
[
|
||||
AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
|
||||
AC_HEADER_STDC
|
||||
])
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 2
|
||||
#serial 3
|
||||
|
||||
dnl See if there's a working, system-supplied version of the getline function.
|
||||
dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
|
||||
@@ -7,7 +7,6 @@ dnl to do with the function we need.
|
||||
AC_DEFUN(AM_FUNC_GETLINE,
|
||||
[dnl
|
||||
am_getline_needs_run_time_check=no
|
||||
am_cv_func_working_getline=yes
|
||||
AC_CHECK_FUNC(getline,
|
||||
dnl Found it in some library. Verify that it works.
|
||||
am_getline_needs_run_time_check=yes,
|
||||
|
||||
39
m4/perl.m4
Normal file
39
m4/perl.m4
Normal file
@@ -0,0 +1,39 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl Find a new-enough version of Perl.
|
||||
dnl
|
||||
|
||||
AC_DEFUN(jm_PERL,
|
||||
[
|
||||
dnl FIXME: don't hard-code 5.003
|
||||
dnl FIXME: should we cache the result?
|
||||
AC_MSG_CHECKING([for perl5.003 or newer])
|
||||
if test "${PERL+set}" = set; then
|
||||
# `PERL' is set in the user's environment.
|
||||
candidate_perl_names="$PERL"
|
||||
perl_specified=yes
|
||||
else
|
||||
candidate_perl_names='perl perl5'
|
||||
perl_specified=no
|
||||
fi
|
||||
|
||||
found=no
|
||||
AC_SUBST(PERL)
|
||||
PERL="$missing_dir/missing 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
|
||||
PERL=$perl
|
||||
found=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
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.] )
|
||||
])
|
||||
9
m4/prereq.m4
Normal file
9
m4/prereq.m4
Normal file
@@ -0,0 +1,9 @@
|
||||
#serial 1
|
||||
|
||||
dnl These are the prerequisite macros for files in the lib/
|
||||
dnl directories of the fileutils, sh-utils, and textutils packages.
|
||||
|
||||
AC_DEFUN(jm_PREREQ,
|
||||
[
|
||||
jm_PREREQ_ERROR
|
||||
])
|
||||
File diff suppressed because it is too large
Load Diff
6160
old/fileutils/ChangeLog-1997
Normal file
6160
old/fileutils/ChangeLog-1997
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,37 @@
|
||||
Changes in release 3.17:
|
||||
[3.16n]
|
||||
* `mv dir dir' once again does *not* remove dir/
|
||||
* ls accepts new options:
|
||||
--indicator-style=none (no indicators, the default)
|
||||
--indicator-style=classify (all indicators)
|
||||
(equivalent to -F or --classify)
|
||||
--indicator-style=file-type (file type indicators)
|
||||
(equivalent to -p or --file-type)
|
||||
|
||||
--quoting-style=literal (do not quote output)
|
||||
--quoting-style=shell (minimally quote output for the shell)
|
||||
--quoting-style=shell-always (always quote output with '' for the shell)
|
||||
--quoting-style=c (quote output as for a C-language string)
|
||||
(equivalent to -Q or --quote-name)
|
||||
--quoting-style=escape (like c but omit enclosing "")
|
||||
(equivalent to -b or --escape)
|
||||
|
||||
--show-control-chars is the opposite of --hide-control-chars
|
||||
This option can be useful if output is to a terminal,
|
||||
to override the default beahvior of hiding control characters.
|
||||
|
||||
* The QUOTING_STYLE environment variable can now be used to specify the
|
||||
default value for ls's --quoting-style option. If not specified,
|
||||
the default quoting style is 'literal', but this default may change to
|
||||
'shell' in a future version of this package.
|
||||
* ls's quoting style now affects operands in diagnostics, too.
|
||||
* ls's --dired option now outputs the quoting style
|
||||
using the format of the new --quoting-style option.
|
||||
* ls's -e or --quote-shell option (introduced in 3.16j) has been removed;
|
||||
use --quoting-style=shell to get its functionality.
|
||||
[3.16m]
|
||||
* mv can move (and doesn't read) special files
|
||||
* remove maintainer mode
|
||||
[3.16l]
|
||||
* mv can finally move non-regular files between partitions
|
||||
[3.16k]
|
||||
|
||||
@@ -1,3 +1,65 @@
|
||||
1998-03-13 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* lib/getugroups.c (getugroups): Don't add a group number if it
|
||||
would be a duplicate. From Ulrich Drepper.
|
||||
|
||||
1998-02-22 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* tests/Makefile.am (EXTRA_DIST): Add mk-script.
|
||||
* tests/Makefile.am.in (EXTRA_DIST): Remove mk-script.pl.
|
||||
(mk_script): Set to ../mk-script.
|
||||
(x-tests): Use `$(PERL) -w -- $(mk_script)', not ./mk-script.
|
||||
Remove @MAINT@ cruft.
|
||||
(Makefile.am): Likewise.
|
||||
Remove @MAINT@ cruft. Now `missing' will explain the failure
|
||||
when people don't have Perl yet modify a file whose rebuilding
|
||||
would lead to the use of Perl.
|
||||
|
||||
* src/Makefile.am (pinky_LDADD): Explicitly add @GETHOSTBYNAME_LIB@.
|
||||
(who_LDADD): Likewise.
|
||||
(pinky_DEPENDENCIES): Set to $(LDADD)
|
||||
(who_DEPENDENCIES): Likewise.
|
||||
|
||||
1998-02-20 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* lib/getdate.h: Removed. Could cause confusion with an
|
||||
automake-generated `.y.h' rule.
|
||||
* lib/get-date.h: Renamed from getdate.h.
|
||||
* lib/getdate.y: s/getdate.h/get-date.h/
|
||||
* lib/Makefile.am (noinst_HEADERS): s/getdate.h/get-date.h/
|
||||
* src/date.c: s/getdate.h/get-date.h/
|
||||
|
||||
1998-02-16 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* configure.in (jm_FUNC_LSTAT): Use it.
|
||||
(jm_FUNC_STAT): Use it.
|
||||
* acconfig.h: Add lstat.
|
||||
* lib/Makefile.am (EXTRA_DIST): Add lstat.c and stat.c.
|
||||
|
||||
1998-02-06 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* tests/nice: Fail immediately if this test is run with `nice'
|
||||
level different from zero. Reported by Philippe De Muyter.
|
||||
|
||||
1998-02-03 Philippe De Muyter <phdm@macqel.be>
|
||||
|
||||
* src/id.c (xgetgroups): Guard function defn with #if HAVE_GETGROUPS.
|
||||
|
||||
* lib/putenv.c (sys/types.h): Include to get size_t on some systems.
|
||||
(NULL): Define if needed.
|
||||
|
||||
1998-01-31 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* configure.in (AC_LFS): Use it.
|
||||
|
||||
1998-01-25 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Makefile.maint: New file.
|
||||
* Makefile.am: Move rules common to textutils, fileutils, sh-utils
|
||||
into Makefile.maint.
|
||||
Include Makefile.maint.
|
||||
(EXTRA_DIST): Add Makefile.maint.
|
||||
|
||||
1998-01-03 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/Makefile.am (AUTOMAKE_OPTIONS): Define to ../src/ansi2knr.
|
||||
|
||||
@@ -1,7 +1,54 @@
|
||||
1998-01-25 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
1998-03-03 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/sort.c (xtmpfopen): Open temporary file exclusively, to
|
||||
foil a common denial-of-service attack.
|
||||
* src/tac.c (save_stdin): Likewise.
|
||||
|
||||
1998-02-16 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* configure.in (jm_FUNC_LSTAT): Use it.
|
||||
(jm_FUNC_STAT): Use it.
|
||||
* lib/Makefile.am (EXTRA_DIST): Add lstat.c and stat.c.
|
||||
|
||||
1998-02-06 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* Version 1.22e.
|
||||
|
||||
* configure.in: Don't use AM_MAINTAINER_MODE or
|
||||
AC_PATH_PROG(PERL, perl).
|
||||
(jm_PERL): Use this.
|
||||
|
||||
1998-02-04 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* tests/Makefile.am.in (EXTRA_DIST): Remove mk-script.pl.
|
||||
(mk_script): Set to ../mk-script.
|
||||
(x-tests): Use `$(PERL) -w -- $(mk_script)', not ./mk-script.
|
||||
Remove @MAINT@ cruft.
|
||||
(Makefile.am): Likewise.
|
||||
Remove @MAINT@ cruft. Now `missing' will explain the failure
|
||||
when people don't have Perl yet modify a file whose rebuilding
|
||||
would lead to the use of Perl.
|
||||
|
||||
* tests/Makefile.am (EXTRA_DIST): Add mk-script.
|
||||
* tests/*/mk-script.pl: Remove files.
|
||||
|
||||
* GNUmakefile: New file.
|
||||
* Makefile.am (EXTRA_DIST): Add GNUmakefile.
|
||||
Don't include Makefile.maint from here. It's included from GNUmakefile.
|
||||
|
||||
1998-01-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* configure.in (AC_LFS): Put before anything that can affect or use
|
||||
CPPFLAGS, LDFLAGS, or LIBS.
|
||||
|
||||
1998-01-25 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Makefile.maint: New file.
|
||||
* Makefile.am: Move rules common to textutils, fileutils, sh-utils
|
||||
into Makefile.maint.
|
||||
Include Makefile.maint.
|
||||
(EXTRA_DIST): Add Makefile.maint.
|
||||
|
||||
* src/cat.c (cat): Convert comma-expressions to pairs of
|
||||
semicolon-terminated stmts.
|
||||
Add braces around compound if/else stmts.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Changes in release 1.23
|
||||
[1.22e]
|
||||
* remove maintainer mode
|
||||
[1.22d]
|
||||
* wc accepts new option: --max-line-length (-L)
|
||||
* sort can sort according to your locale if your C library supports that
|
||||
|
||||
@@ -39,11 +39,11 @@
|
||||
struct group *getgrnam ();
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ENDGRENT
|
||||
#if ! HAVE_ENDGRENT
|
||||
# define endgrent() ((void) 0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LCHOWN
|
||||
#if HAVE_LCHOWN
|
||||
# define LCHOWN(FILE, OWNER, GROUP) lchown (FILE, OWNER, GROUP)
|
||||
#else
|
||||
# define LCHOWN(FILE, OWNER, GROUP) 1
|
||||
@@ -379,7 +379,7 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
#ifndef HAVE_LCHOWN
|
||||
#if ! HAVE_LCHOWN
|
||||
if (change_symlinks)
|
||||
{
|
||||
error (1, 0, _("--no-dereference (-h) is not supported on this system"));
|
||||
|
||||
@@ -46,11 +46,11 @@ struct group *getgrnam ();
|
||||
struct group *getgrgid ();
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ENDPWENT
|
||||
#if ! HAVE_ENDPWENT
|
||||
# define endpwent() ((void) 0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LCHOWN
|
||||
#if HAVE_LCHOWN
|
||||
# define LCHOWN(FILE, OWNER, GROUP) lchown (FILE, OWNER, GROUP)
|
||||
#else
|
||||
# define LCHOWN(FILE, OWNER, GROUP) 1
|
||||
@@ -356,7 +356,7 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
#ifndef HAVE_LCHOWN
|
||||
#if ! HAVE_LCHOWN
|
||||
if (change_symlinks)
|
||||
{
|
||||
error (1, 0, _("--no-dereference (-h) is not supported on this system"));
|
||||
|
||||
45
src/copy.c
45
src/copy.c
@@ -43,7 +43,8 @@ int yesno ();
|
||||
static int copy_internal PARAMS ((const char *src_path, const char *dst_path,
|
||||
int new_dst, dev_t device,
|
||||
struct dir_list *ancestors,
|
||||
const struct cp_options *x));
|
||||
const struct cp_options *x,
|
||||
int *copy_into_self));
|
||||
|
||||
/* The invocation name of this program. */
|
||||
extern char *program_name;
|
||||
@@ -64,17 +65,17 @@ is_ancestor (const struct stat *sb, const struct dir_list *ancestors)
|
||||
copy the contents to DST_PATH_IN. NEW_DST is nonzero if
|
||||
DST_PATH_IN is a directory that was created previously in the
|
||||
recursion. SRC_SB and ANCESTORS describe SRC_PATH_IN.
|
||||
Set *COPY_INTO_SELF to nonzero if SRC_PATH_IN is a parent of
|
||||
(or the same as) DST_PATH_IN; otherwise, set it to zero.
|
||||
Return 0 if successful, -1 if an error occurs. */
|
||||
|
||||
static int
|
||||
copy_dir (const char *src_path_in, const char *dst_path_in, int new_dst,
|
||||
const struct stat *src_sb, struct dir_list *ancestors,
|
||||
const struct cp_options *x)
|
||||
const struct cp_options *x, int *copy_into_self)
|
||||
{
|
||||
char *name_space;
|
||||
char *namep;
|
||||
char *src_path;
|
||||
char *dst_path;
|
||||
int ret = 0;
|
||||
|
||||
errno = 0;
|
||||
@@ -93,13 +94,16 @@ copy_dir (const char *src_path_in, const char *dst_path_in, int new_dst,
|
||||
namep = name_space;
|
||||
while (*namep != '\0')
|
||||
{
|
||||
src_path = path_concat (src_path_in, namep, NULL);
|
||||
dst_path = path_concat (dst_path_in, namep, NULL);
|
||||
int local_copy_into_self;
|
||||
char *src_path = path_concat (src_path_in, namep, NULL);
|
||||
char *dst_path = path_concat (dst_path_in, namep, NULL);
|
||||
|
||||
if (dst_path == NULL || src_path == NULL)
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
|
||||
ret |= copy_internal (src_path, dst_path, new_dst, src_sb->st_dev,
|
||||
ancestors, x);
|
||||
ancestors, x, &local_copy_into_self);
|
||||
*copy_into_self |= local_copy_into_self;
|
||||
|
||||
/* Free the memory for `src_path'. The memory for `dst_path'
|
||||
cannot be deallocated, since it is used to create multiple
|
||||
@@ -166,7 +170,7 @@ copy_reg (const char *src_path, const char *dst_path,
|
||||
|
||||
buf_size = ST_BLKSIZE (sb);
|
||||
|
||||
#ifdef HAVE_ST_BLOCKS
|
||||
#if HAVE_ST_BLOCKS
|
||||
if (sparse_mode == SPARSE_AUTO && S_ISREG (sb.st_mode))
|
||||
{
|
||||
/* Use a heuristic to determine whether SRC_PATH contains any
|
||||
@@ -263,7 +267,7 @@ copy_reg (const char *src_path, const char *dst_path,
|
||||
|
||||
if (last_write_made_hole)
|
||||
{
|
||||
#ifdef HAVE_FTRUNCATE
|
||||
#if HAVE_FTRUNCATE
|
||||
/* Write a null character and truncate it again. */
|
||||
if (full_write (dest_desc, "", 1) < 0
|
||||
|| ftruncate (dest_desc, n_read_total) < 0)
|
||||
@@ -301,12 +305,14 @@ ret2:
|
||||
number of the parent directory, or 0 if the parent of this file is
|
||||
not known. ANCESTORS points to a linked, null terminated list of
|
||||
devices and inodes of parent directories of SRC_PATH.
|
||||
Set *COPY_INTO_SELF to nonzero if SRC_PATH is a parent of (or the
|
||||
same as) DST_PATH; otherwise, set it to zero.
|
||||
Return 0 if successful, 1 if an error occurs. */
|
||||
|
||||
static int
|
||||
copy_internal (const char *src_path, const char *dst_path,
|
||||
int new_dst, dev_t device, struct dir_list *ancestors,
|
||||
const struct cp_options *x)
|
||||
const struct cp_options *x, int *copy_into_self)
|
||||
{
|
||||
struct stat src_sb;
|
||||
struct stat dst_sb;
|
||||
@@ -316,6 +322,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
char *dst_backup = NULL;
|
||||
int fix_mode = 0;
|
||||
|
||||
*copy_into_self = 0;
|
||||
if ((*(x->xstat)) (src_path, &src_sb))
|
||||
{
|
||||
error (0, errno, "%s", src_path);
|
||||
@@ -335,7 +342,10 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
/* Did we just create this file? */
|
||||
|
||||
if (earlier_file == &new_file)
|
||||
return 0;
|
||||
{
|
||||
*copy_into_self = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
src_mode = src_sb.st_mode;
|
||||
src_type = src_sb.st_mode;
|
||||
@@ -552,7 +562,8 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
|
||||
/* Copy the contents of the directory. */
|
||||
|
||||
if (copy_dir (src_path, dst_path, new_dst, &src_sb, dir, x))
|
||||
if (copy_dir (src_path, dst_path, new_dst, &src_sb, dir, x,
|
||||
copy_into_self))
|
||||
return 1;
|
||||
}
|
||||
#ifdef S_ISLNK
|
||||
@@ -648,7 +659,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
{
|
||||
/* Preserve the owner and group of the just-`copied'
|
||||
symbolic link, if possible. */
|
||||
# ifdef HAVE_LCHOWN
|
||||
# if HAVE_LCHOWN
|
||||
if (DO_CHOWN (lchown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, _("preserving ownership for %s"), dst_path);
|
||||
@@ -771,12 +782,16 @@ valid_options (const struct cp_options *co)
|
||||
is known not to exist (e.g., because its parent directory was just
|
||||
created); NONEXISTENT_DST should be zero if DST_PATH might already
|
||||
exist. OPTIONS is ... FIXME-describe
|
||||
Set *COPY_INTO_SELF to nonzero if SRC_PATH is a parent of (or the
|
||||
same as) DST_PATH; otherwise, set it to zero.
|
||||
Return 0 if successful, 1 if an error occurs. */
|
||||
|
||||
int
|
||||
copy (const char *src_path, const char *dst_path,
|
||||
int nonexistent_dst, const struct cp_options *options)
|
||||
int nonexistent_dst, const struct cp_options *options,
|
||||
int *copy_into_self)
|
||||
{
|
||||
assert (valid_options (options));
|
||||
return copy_internal (src_path, dst_path, nonexistent_dst, 0, NULL, options);
|
||||
return copy_internal (src_path, dst_path, nonexistent_dst, 0, NULL,
|
||||
options, copy_into_self);
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ struct cp_options
|
||||
|
||||
int
|
||||
copy PARAMS ((const char *src_path, const char *dst_path,
|
||||
int nonexistent_dst, const struct cp_options *options));
|
||||
int nonexistent_dst, const struct cp_options *options,
|
||||
int *copy_into_self));
|
||||
|
||||
#endif
|
||||
|
||||
6
src/cp.c
6
src/cp.c
@@ -485,7 +485,8 @@ do_copy (int argc, char **argv, const struct cp_options *x)
|
||||
}
|
||||
else
|
||||
{
|
||||
ret |= copy (arg, dst_path, new_dst, x);
|
||||
int unused;
|
||||
ret |= copy (arg, dst_path, new_dst, x, &unused);
|
||||
forget_all ();
|
||||
|
||||
if (flag_path)
|
||||
@@ -506,6 +507,7 @@ do_copy (int argc, char **argv, const struct cp_options *x)
|
||||
{
|
||||
char *new_dest;
|
||||
char *source;
|
||||
int unused;
|
||||
struct stat source_stats;
|
||||
|
||||
if (flag_path)
|
||||
@@ -572,7 +574,7 @@ do_copy (int argc, char **argv, const struct cp_options *x)
|
||||
new_dest = dest;
|
||||
}
|
||||
|
||||
return copy (source, new_dest, new_dst, x);
|
||||
return copy (source, new_dest, new_dst, x, &unused);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
70
src/dcgen
Executable file
70
src/dcgen
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/perl -w
|
||||
# -*- perl -*-
|
||||
|
||||
eval 'exec /p/bin/perl -S $0 ${1+"$@"}'
|
||||
if 0;
|
||||
|
||||
# dcgen -- generate C declarations of arrays of lines and line lengths
|
||||
# Copyright (C) 1996, 1998 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# written by Jim Meyering
|
||||
|
||||
# If you uncomment the following lines, you should also do
|
||||
# s/chop/chomp and s/local/my/.
|
||||
#require 5.002;
|
||||
#use strict;
|
||||
|
||||
# Convert an arbitrary file to dcl of two arrays.
|
||||
# One of lines, the other of lengths.
|
||||
|
||||
local $prefix = 'G_';
|
||||
|
||||
local @line;
|
||||
while (<>)
|
||||
{
|
||||
chop;
|
||||
push (@line, $_);
|
||||
}
|
||||
|
||||
local $n = @line;
|
||||
print "#define ${prefix}N_LINES $n\n\n";
|
||||
|
||||
local $indent = ' ';
|
||||
print "const size_t ${prefix}line_length[${prefix}N_LINES] =\n{\n$indent";
|
||||
local $ind = $indent;
|
||||
local $i;
|
||||
for ($i = 0; $i < @line; $i++)
|
||||
{
|
||||
local $comma = ($i < @line - 1 ? ',' : '');
|
||||
$ind = '' if $i == @line - 1;
|
||||
local $sep = ($i && $i % 18 == 0 || $i == @line - 1 ? "\n$ind" : ' ');
|
||||
print length ($line[$i]), $comma, $sep;
|
||||
}
|
||||
print "};\n\n";
|
||||
|
||||
print "const char *const ${prefix}line[${prefix}N_LINES] =\n{\n";
|
||||
while (1)
|
||||
{
|
||||
$_ = shift (@line);
|
||||
local $comma = (@line ? ',' : '');
|
||||
print "$indent\"$_\"$comma\n";
|
||||
last if !@line;
|
||||
}
|
||||
print "};\n";
|
||||
|
||||
exit (0);
|
||||
2
src/dd.c
2
src/dd.c
@@ -1106,7 +1106,7 @@ main (int argc, char **argv)
|
||||
output_fd = open (output_file, omode, 0666);
|
||||
if (output_fd < 0)
|
||||
error (1, errno, "%s", output_file);
|
||||
#ifdef HAVE_FTRUNCATE
|
||||
#if HAVE_FTRUNCATE
|
||||
if (seek_record != 0 && !(conversions_mask & C_NOTRUNC))
|
||||
{
|
||||
off_t o = seek_record * output_blocksize;
|
||||
|
||||
2
src/df.c
2
src/df.c
@@ -141,7 +141,7 @@ print_header (void)
|
||||
printf (" ");
|
||||
|
||||
if (inode_format)
|
||||
printf (" Inodes IUsed IFree %%IUsed");
|
||||
printf (" Inodes IUsed IFree %%IUsed ");
|
||||
else
|
||||
if (output_units == 1024 * 1024)
|
||||
printf (" MB-blocks Used Available Capacity");
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
10
src/id.c
10
src/id.c
@@ -1,5 +1,5 @@
|
||||
/* id -- print real and effective UIDs and GIDs
|
||||
Copyright (C) 1989-1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989-1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -215,6 +215,8 @@ print_group (int gid)
|
||||
printf ("%s", grp->gr_name);
|
||||
}
|
||||
|
||||
#if HAVE_GETGROUPS
|
||||
|
||||
static int
|
||||
xgetgroups (const char *username, int *n_groups, GETGROUPS_T **groups)
|
||||
{
|
||||
@@ -249,6 +251,8 @@ xgetgroups (const char *username, int *n_groups, GETGROUPS_T **groups)
|
||||
return fail;
|
||||
}
|
||||
|
||||
#endif /* HAVE_GETGROUPS */
|
||||
|
||||
/* Print all of the distinct groups the user is in. */
|
||||
|
||||
static void
|
||||
@@ -281,7 +285,7 @@ print_group_list (const char *username)
|
||||
}
|
||||
free (groups);
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GETGROUPS */
|
||||
}
|
||||
|
||||
/* Print all of the info about the user's user and group IDs. */
|
||||
@@ -353,7 +357,7 @@ print_full_info (const char *username)
|
||||
}
|
||||
free (groups);
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GETGROUPS */
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -95,11 +95,11 @@ uid_t getuid ();
|
||||
gid_t getgid ();
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ENDGRENT
|
||||
#if ! HAVE_ENDGRENT
|
||||
# define endgrent() ((void) 0)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ENDPWENT
|
||||
#if ! HAVE_ENDPWENT
|
||||
# define endpwent() ((void) 0)
|
||||
#endif
|
||||
|
||||
@@ -705,8 +705,8 @@ In the third format, create all components of the given DIRECTORY(ies).\n\
|
||||
-c (ignored)\n\
|
||||
-d, --directory treat all arguments as directory names; create all\n\
|
||||
components of the specified directories\n\
|
||||
-D create all leading components of DEST except the last,\n\
|
||||
then copy SOURCE to DEST; useful in the 1st format\n\
|
||||
-D create all leading components of DEST except the last,\n\
|
||||
then copy SOURCE to DEST; useful in the 1st format\n\
|
||||
-g, --group=GROUP set group ownership, instead of process' current group\n\
|
||||
-m, --mode=MODE set permission mode (as in chmod), instead of rwxr-xr-x\n\
|
||||
-o, --owner=OWNER set ownership (super-user only)\n\
|
||||
|
||||
34
src/ln.c
34
src/ln.c
@@ -326,26 +326,28 @@ usage (int status)
|
||||
else
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s [OPTION]... SOURCE [DEST]\n\
|
||||
or: %s [OPTION]... SOURCE... DIRECTORY\n\
|
||||
Usage: %s [OPTION]... TARGET [LINK_NAME]\n\
|
||||
or: %s [OPTION]... TARGET... DIRECTORY\n\
|
||||
"),
|
||||
program_name, program_name);
|
||||
printf (_("\
|
||||
Link SOURCE to DEST (. by default), or multiple SOURCE(s) to DIRECTORY.\n\
|
||||
Makes hard links by default, symbolic links with -s.\n\
|
||||
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\
|
||||
in DIRECTORY to each TARGET. Create hard links by default, symbolic links\n\
|
||||
with --symbolic. When creating hard links, each TARGET must exist.\n\
|
||||
\n\
|
||||
-b, --backup make backups for removed files\n\
|
||||
-d, -F, --directory hard link directories (super-user only)\n\
|
||||
-f, --force remove existing destinations\n\
|
||||
-n, --no-dereference treat destination that is a symlink to a\n\
|
||||
directory as if it were a normal file\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\
|
||||
-v, --verbose print name of each file before linking\n\
|
||||
-V, --version-control=WORD override the usual version control\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
-b, --backup make a backup of each existing destination file\n\
|
||||
-d, -F, --directory hard link directories (super-user only)\n\
|
||||
-f, --force remove existing destination files\n\
|
||||
-n, --no-dereference treat destination that is a symlink to a\n\
|
||||
directory as if it were a normal file\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\
|
||||
-v, --verbose print name of each file before linking\n\
|
||||
-V, --version-control=WORD override the usual version control\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
"));
|
||||
printf (_("\
|
||||
|
||||
317
src/ls.c
317
src/ls.c
@@ -47,7 +47,7 @@
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
#if HAVE_TERMIOS_H
|
||||
# include <termios.h>
|
||||
#endif
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
#include "argmatch.h"
|
||||
#include "xstrtol.h"
|
||||
#include "strverscmp.h"
|
||||
#include "quotearg.h"
|
||||
|
||||
#define obstack_chunk_alloc malloc
|
||||
#define obstack_chunk_free free
|
||||
@@ -139,7 +140,8 @@ void strip_trailing_slashes ();
|
||||
char *xstrdup ();
|
||||
void invalid_arg ();
|
||||
|
||||
static size_t quote_filename PARAMS ((FILE *out, const char *filename));
|
||||
static size_t quote_name PARAMS ((FILE *out, const char *name,
|
||||
struct quoting_options const *options));
|
||||
static char *make_link_path PARAMS ((const char *path, const char *linkname));
|
||||
static int compare_atime PARAMS ((const struct fileinfo *file1,
|
||||
const struct fileinfo *file2));
|
||||
@@ -331,20 +333,26 @@ static int output_units;
|
||||
static int dired;
|
||||
|
||||
/* `none' means don't mention the type of files.
|
||||
`all' means mention the types of all files.
|
||||
`not_programs' means do so except for executables.
|
||||
`classify' means mention file types and mark executables.
|
||||
`file_type' means mention only file types.
|
||||
|
||||
Controlled by -F and -p. */
|
||||
Controlled by -F, -p, and --indicator-style. */
|
||||
|
||||
enum indicator_style
|
||||
{
|
||||
none, /* default */
|
||||
all, /* -F */
|
||||
not_programs /* -p */
|
||||
none, /* --indicator-style=none */
|
||||
classify, /* -F, --indicator-style=classify */
|
||||
file_type /* -p, --indicator-style=file-type */
|
||||
};
|
||||
|
||||
static enum indicator_style indicator_style;
|
||||
|
||||
/* Names of indicator styles. */
|
||||
static char const *const indicator_style_args[] =
|
||||
{
|
||||
"none", "classify", "file-type", 0
|
||||
};
|
||||
|
||||
/* Nonzero means use colors to mark types. Also define the different
|
||||
colors as well as the stuff for the LS_COLORS environment variable.
|
||||
The LS_COLORS variable is now in a termcap-like format. */
|
||||
@@ -446,26 +454,14 @@ struct ignore_pattern
|
||||
|
||||
static struct ignore_pattern *ignore_patterns;
|
||||
|
||||
/* Nonzero means quote nongraphic chars in file names. -b */
|
||||
|
||||
static int quote_funny_chars;
|
||||
|
||||
/* Nonzero means output nongraphic chars in file names as `?'. -q */
|
||||
|
||||
static int qmark_funny_chars;
|
||||
|
||||
/* Nonzero means output each file name using C syntax for a string.
|
||||
Always accompanied by `quote_funny_chars'.
|
||||
This mode, together with -x or -C or -m,
|
||||
and without such frills as -F or -s,
|
||||
is guaranteed to make it possible for a program receiving
|
||||
the output to tell exactly what file names are present. -Q */
|
||||
/* Quoting options for file and dir name output. */
|
||||
|
||||
static int quote_as_string;
|
||||
|
||||
/* Nonzero means use shell style quoting; it is also unambiguous. -e */
|
||||
|
||||
static int quote_shell;
|
||||
static struct quoting_options *filename_quoting_options;
|
||||
static struct quoting_options *dirname_quoting_options;
|
||||
|
||||
/* The number of chars per hardware tab stop. Setting this to zero
|
||||
inhibits the use of TAB characters for separating columns. -T */
|
||||
@@ -522,12 +518,14 @@ static struct option const long_options[] =
|
||||
{"file-type", no_argument, 0, 'F'},
|
||||
{"si", no_argument, 0, 'H'},
|
||||
{"ignore", required_argument, 0, 'I'},
|
||||
{"indicator-style", required_argument, 0, 14},
|
||||
{"dereference", no_argument, 0, 'L'},
|
||||
{"literal", no_argument, 0, 'N'},
|
||||
{"quote-name", no_argument, 0, 'Q'},
|
||||
{"quote-shell", no_argument, 0, 'e'},
|
||||
{"quoting-style", required_argument, 0, 15},
|
||||
{"recursive", no_argument, 0, 'R'},
|
||||
{"format", required_argument, 0, 12},
|
||||
{"show-control-chars", no_argument, 0, 16},
|
||||
{"sort", required_argument, 0, 10},
|
||||
{"tabsize", required_argument, 0, 'T'},
|
||||
{"time", required_argument, 0, 11},
|
||||
@@ -651,11 +649,11 @@ static int max_idx;
|
||||
#define MIN_COLUMN_WIDTH 3
|
||||
|
||||
|
||||
/* Write to standard output the strings PREFIX and STYLE, followed by
|
||||
/* Write to standard output PREFIX, followed by the quoting style and
|
||||
a space-separated list of the integers stored in OS all on one line. */
|
||||
|
||||
static void
|
||||
dired_dump_obstack (const char *prefix, const char *style, struct obstack *os)
|
||||
dired_dump_obstack (const char *prefix, struct obstack *os)
|
||||
{
|
||||
int n_pos;
|
||||
|
||||
@@ -667,7 +665,6 @@ dired_dump_obstack (const char *prefix, const char *style, struct obstack *os)
|
||||
|
||||
pos = (size_t *) obstack_finish (os);
|
||||
fputs (prefix, stdout);
|
||||
fputs (style, stdout);
|
||||
for (i = 0; i < n_pos; i++)
|
||||
printf (" %d", (int) pos[i]);
|
||||
fputs ("\n", stdout);
|
||||
@@ -775,13 +772,11 @@ main (int argc, char **argv)
|
||||
|
||||
if (dired && format == long_format)
|
||||
{
|
||||
const char *quoting_style = (quote_shell ? " -e"
|
||||
: quote_as_string ? " -Q"
|
||||
: quote_funny_chars ? " -b"
|
||||
: " -N");
|
||||
/* No need to free these since we're about to exit. */
|
||||
dired_dump_obstack ("//DIRED//", quoting_style, &dired_obstack);
|
||||
dired_dump_obstack ("//SUBDIRED//", quoting_style, &subdired_obstack);
|
||||
dired_dump_obstack ("//DIRED//", &dired_obstack);
|
||||
dired_dump_obstack ("//SUBDIRED//", &subdired_obstack);
|
||||
printf ("//DIRED-OPTIONS// --quoting-style=%s\n",
|
||||
quoting_style_args[get_quoting_style (filename_quoting_options)]);
|
||||
}
|
||||
|
||||
/* Restore default color before exiting */
|
||||
@@ -801,13 +796,12 @@ main (int argc, char **argv)
|
||||
static int
|
||||
decode_switches (int argc, char **argv)
|
||||
{
|
||||
register char *p;
|
||||
register char const *p;
|
||||
int c;
|
||||
int i;
|
||||
long int tmp_long;
|
||||
|
||||
qmark_funny_chars = 0;
|
||||
quote_funny_chars = 0;
|
||||
|
||||
/* initialize all switches to default settings */
|
||||
|
||||
@@ -816,13 +810,13 @@ decode_switches (int argc, char **argv)
|
||||
case LS_MULTI_COL:
|
||||
/* This is for the `dir' program. */
|
||||
format = many_per_line;
|
||||
quote_funny_chars = 1;
|
||||
set_quoting_style ("earg_quoting_options, escape_quoting_style);
|
||||
break;
|
||||
|
||||
case LS_LONG_FORMAT:
|
||||
/* This is for the `vdir' program. */
|
||||
format = long_format;
|
||||
quote_funny_chars = 1;
|
||||
set_quoting_style ("earg_quoting_options, escape_quoting_style);
|
||||
break;
|
||||
|
||||
case LS_LS:
|
||||
@@ -858,8 +852,10 @@ decode_switches (int argc, char **argv)
|
||||
all_files = 0;
|
||||
really_all_files = 0;
|
||||
ignore_patterns = 0;
|
||||
quote_as_string = 0;
|
||||
quote_shell = 1;
|
||||
|
||||
if ((p = getenv ("QUOTING_STYLE"))
|
||||
&& 0 <= (i = argmatch (p, quoting_style_args)))
|
||||
set_quoting_style ("earg_quoting_options, (enum quoting_style) i);
|
||||
|
||||
if ((p = getenv ("BLOCKSIZE"))
|
||||
&& strncmp (p, "HUMAN", sizeof ("HUMAN") - 1) == 0)
|
||||
@@ -879,7 +875,7 @@ decode_switches (int argc, char **argv)
|
||||
{
|
||||
error (0, 0,
|
||||
_("ignoring invalid width in environment variable COLUMNS: %s"),
|
||||
p);
|
||||
quotearg (p));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -906,7 +902,7 @@ decode_switches (int argc, char **argv)
|
||||
{
|
||||
error (0, 0,
|
||||
_("ignoring invalid tab size in environment variable TABSIZE: %s"),
|
||||
p);
|
||||
quotearg (p));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -925,10 +921,7 @@ decode_switches (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
quote_funny_chars = 1;
|
||||
quote_as_string = 0;
|
||||
quote_shell = 0;
|
||||
qmark_funny_chars = 0;
|
||||
set_quoting_style ("earg_quoting_options, escape_quoting_style);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
@@ -940,13 +933,6 @@ decode_switches (int argc, char **argv)
|
||||
immediate_dirs = 1;
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
quote_shell = 1;
|
||||
quote_as_string = 0;
|
||||
quote_funny_chars = 0;
|
||||
qmark_funny_chars = 0;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
/* Same as enabling -a -U and disabling -l -s. */
|
||||
all_files = 1;
|
||||
@@ -997,14 +983,11 @@ decode_switches (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
indicator_style = not_programs;
|
||||
indicator_style = file_type;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
qmark_funny_chars = 1;
|
||||
quote_as_string = 0;
|
||||
quote_funny_chars = 0;
|
||||
quote_shell = 0;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
@@ -1031,7 +1014,8 @@ decode_switches (int argc, char **argv)
|
||||
case 'w':
|
||||
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long <= 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("invalid line width: %s"), optarg);
|
||||
error (EXIT_FAILURE, 0, _("invalid line width: %s"),
|
||||
quotearg (optarg));
|
||||
line_length = (int) tmp_long;
|
||||
break;
|
||||
|
||||
@@ -1058,7 +1042,7 @@ decode_switches (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
indicator_style = all;
|
||||
indicator_style = classify;
|
||||
break;
|
||||
|
||||
case 'G': /* inhibit display of group info */
|
||||
@@ -1074,17 +1058,11 @@ decode_switches (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
quote_as_string = 0;
|
||||
quote_funny_chars = 0;
|
||||
quote_shell = 0;
|
||||
qmark_funny_chars = 0;
|
||||
set_quoting_style ("earg_quoting_options, literal_quoting_style);
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
quote_as_string = 1;
|
||||
quote_funny_chars = 1;
|
||||
quote_shell = 0;
|
||||
qmark_funny_chars = 0;
|
||||
set_quoting_style ("earg_quoting_options, c_quoting_style);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
@@ -1098,7 +1076,8 @@ decode_switches (int argc, char **argv)
|
||||
case 'T':
|
||||
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long < 0 || tmp_long > INT_MAX)
|
||||
error (EXIT_FAILURE, 0, _("invalid tab size: %s"), optarg);
|
||||
error (EXIT_FAILURE, 0, _("invalid tab size: %s"),
|
||||
quotearg (optarg));
|
||||
tabsize = (int) tmp_long;
|
||||
break;
|
||||
|
||||
@@ -1175,6 +1154,31 @@ decode_switches (int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
|
||||
case 14: /* --indicator-style */
|
||||
i = argmatch (optarg, indicator_style_args);
|
||||
if (i < 0)
|
||||
{
|
||||
invalid_arg (_("indicator style"), optarg, i);
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
indicator_style = (enum indicator_style) i;
|
||||
break;
|
||||
|
||||
case 15: /* --quoting-style */
|
||||
i = argmatch (optarg, quoting_style_args);
|
||||
if (i < 0)
|
||||
{
|
||||
invalid_arg (_("quoting style"), optarg, i);
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
set_quoting_style ("earg_quoting_options,
|
||||
(enum quoting_style) i);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
qmark_funny_chars = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
@@ -1183,6 +1187,14 @@ decode_switches (int argc, char **argv)
|
||||
if (human_readable_base)
|
||||
output_units = 1;
|
||||
|
||||
filename_quoting_options = clone_quoting_options ("earg_quoting_options);
|
||||
if (indicator_style != none)
|
||||
for (p = "*=@|" + (int) indicator_style - 1; *p; p++)
|
||||
set_char_quoting (filename_quoting_options, *p, 1);
|
||||
|
||||
dirname_quoting_options = clone_quoting_options ("earg_quoting_options);
|
||||
set_char_quoting (dirname_quoting_options, ':', 1);
|
||||
|
||||
return optind;
|
||||
}
|
||||
|
||||
@@ -1480,7 +1492,7 @@ parse_ls_color (void)
|
||||
}
|
||||
}
|
||||
if (state == -1)
|
||||
error (0, 0, _("unrecognized prefix: %s"), label);
|
||||
error (0, 0, _("unrecognized prefix: %s"), quotearg (label));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1550,7 +1562,7 @@ print_dir (const char *name, const char *realname)
|
||||
reading = opendir (name);
|
||||
if (!reading)
|
||||
{
|
||||
error (0, errno, "%s", name);
|
||||
error (0, errno, "%s", quotearg_colon (name));
|
||||
exit_status = 1;
|
||||
return;
|
||||
}
|
||||
@@ -1566,7 +1578,7 @@ print_dir (const char *name, const char *realname)
|
||||
|
||||
if (CLOSEDIR (reading))
|
||||
{
|
||||
error (0, errno, "%s", name);
|
||||
error (0, errno, "%s", quotearg_colon (name));
|
||||
exit_status = 1;
|
||||
/* Don't return; print whatever we got. */
|
||||
}
|
||||
@@ -1584,7 +1596,8 @@ print_dir (const char *name, const char *realname)
|
||||
{
|
||||
DIRED_INDENT ();
|
||||
PUSH_CURRENT_DIRED_POS (&subdired_obstack);
|
||||
dired_pos += quote_filename (stdout, realname ? realname : name);
|
||||
dired_pos += quote_name (stdout, realname ? realname : name,
|
||||
dirname_quoting_options);
|
||||
PUSH_CURRENT_DIRED_POS (&subdired_obstack);
|
||||
FPUTS_LITERAL (":\n", stdout);
|
||||
}
|
||||
@@ -1716,7 +1729,7 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
|
||||
if (val < 0)
|
||||
{
|
||||
error (0, errno, "%s", path);
|
||||
error (0, errno, "%s", quotearg_colon (path));
|
||||
exit_status = 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -1821,7 +1834,7 @@ get_link_name (const char *filename, struct fileinfo *f)
|
||||
linksize = readlink (filename, linkbuf, PATH_MAX + 1);
|
||||
if (linksize < 0)
|
||||
{
|
||||
error (0, errno, "%s", filename);
|
||||
error (0, errno, "%s", quotearg_colon (filename));
|
||||
exit_status = 1;
|
||||
}
|
||||
else
|
||||
@@ -2154,7 +2167,7 @@ print_long_format (const struct fileinfo *f)
|
||||
const char *fmt;
|
||||
char *user_name;
|
||||
|
||||
#ifdef HAVE_ST_DM_MODE
|
||||
#if HAVE_ST_DM_MODE
|
||||
mode_string (f->stat.st_dm_mode, modebuf);
|
||||
#else
|
||||
mode_string (f->stat.st_mode, modebuf);
|
||||
@@ -2312,134 +2325,34 @@ print_long_format (const struct fileinfo *f)
|
||||
print_type_indicator (f->stat.st_mode);
|
||||
}
|
||||
|
||||
/* If OUT is not null, output a quoted representation of the file name P.
|
||||
/* Output to OUT a quoted representation of the file name P,
|
||||
using OPTIONS to control quoting.
|
||||
Return the number of characters in P's quoted representation. */
|
||||
|
||||
static size_t
|
||||
quote_filename (register FILE *out, register const char *p)
|
||||
quote_name (FILE *out, const char *p, struct quoting_options const *options)
|
||||
{
|
||||
register unsigned char c;
|
||||
register size_t len;
|
||||
#define OUTCHAR(c) do { len++; if (out) putc (c, out); } while (0)
|
||||
char smallbuf[BUFSIZ];
|
||||
size_t len = quotearg_buffer (smallbuf, sizeof smallbuf, p, -1, options);
|
||||
char *buf;
|
||||
|
||||
if (quote_shell)
|
||||
{
|
||||
const char *p0 = p;
|
||||
|
||||
switch (*p)
|
||||
{
|
||||
case '\0': case '#': case '~':
|
||||
break;
|
||||
|
||||
default:
|
||||
for (;; p++)
|
||||
{
|
||||
switch (*p)
|
||||
{
|
||||
default:
|
||||
continue;
|
||||
|
||||
case '\t': case '\n': case ' ':
|
||||
case '!': /* special in csh */
|
||||
case '"': case '$': case '&': case '\'':
|
||||
case '(': case ')': case '*': case ';':
|
||||
case '<': case '>': case '?': case '[': case '\\':
|
||||
case '^': /* synonym for | in old /bin/sh, e.g. SunOS 4.1.4 */
|
||||
case '`': case '|':
|
||||
break;
|
||||
|
||||
case '\0':
|
||||
switch (p[-1])
|
||||
{
|
||||
case '=': case '@':
|
||||
/* These require quoting if at the end of the file name,
|
||||
to avoid ambiguity with the output of -F or -p. */
|
||||
break;
|
||||
|
||||
default:
|
||||
len = p - p0;
|
||||
if (out)
|
||||
fwrite (p0, 1, len, out);
|
||||
return len;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Shell quoting is needed. */
|
||||
|
||||
p = p0;
|
||||
len = 0;
|
||||
OUTCHAR ('\'');
|
||||
|
||||
while ((c = *p++))
|
||||
{
|
||||
OUTCHAR (c);
|
||||
|
||||
if (c == '\'')
|
||||
{
|
||||
OUTCHAR ('\\');
|
||||
OUTCHAR ('\'');
|
||||
OUTCHAR ('\'');
|
||||
}
|
||||
}
|
||||
|
||||
OUTCHAR ('\'');
|
||||
}
|
||||
if (len < sizeof smallbuf)
|
||||
buf = smallbuf;
|
||||
else
|
||||
{
|
||||
len = 0;
|
||||
|
||||
if (quote_as_string)
|
||||
OUTCHAR ('"');
|
||||
|
||||
while ((c = *p++))
|
||||
{
|
||||
if (quote_funny_chars)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '\\': OUTCHAR ('\\'); break;
|
||||
case '\n': OUTCHAR ('\\'); c = 'n'; break;
|
||||
case '\b': OUTCHAR ('\\'); c = 'b'; break;
|
||||
case '\r': OUTCHAR ('\\'); c = 'r'; break;
|
||||
case '\t': OUTCHAR ('\\'); c = 't'; break;
|
||||
case '\f': OUTCHAR ('\\'); c = 'f'; break;
|
||||
|
||||
case ' ':
|
||||
if (!quote_as_string)
|
||||
OUTCHAR ('\\');
|
||||
break;
|
||||
|
||||
case '"':
|
||||
if (quote_as_string)
|
||||
OUTCHAR ('\\');
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!ISGRAPH (c))
|
||||
{
|
||||
OUTCHAR ('\\');
|
||||
OUTCHAR ('0' + (c >> 6));
|
||||
OUTCHAR ('0' + ((c >> 3) & 3));
|
||||
c = '0' + (c & 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (qmark_funny_chars && !ISPRINT (c))
|
||||
c = '?';
|
||||
|
||||
OUTCHAR (c);
|
||||
}
|
||||
|
||||
if (quote_as_string)
|
||||
OUTCHAR ('"');
|
||||
buf = (char *) alloca (len + 1);
|
||||
quotearg_buffer (buf, len + 1, p, -1, options);
|
||||
}
|
||||
|
||||
if (qmark_funny_chars)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < len; i++)
|
||||
if (! ISPRINT ((unsigned char) buf[i]))
|
||||
buf[i] = '?';
|
||||
}
|
||||
|
||||
fwrite (buf, 1, len, out);
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -2453,7 +2366,7 @@ print_name_with_quoting (const char *p, unsigned int mode, int linkok,
|
||||
if (stack)
|
||||
PUSH_CURRENT_DIRED_POS (stack);
|
||||
|
||||
dired_pos += quote_filename (stdout, p);
|
||||
dired_pos += quote_name (stdout, p, filename_quoting_options);
|
||||
|
||||
if (stack)
|
||||
PUSH_CURRENT_DIRED_POS (stack);
|
||||
@@ -2520,7 +2433,7 @@ print_type_indicator (unsigned int mode)
|
||||
PUTCHAR ('=');
|
||||
#endif
|
||||
|
||||
if (S_ISREG (mode) && indicator_style == all
|
||||
if (S_ISREG (mode) && indicator_style == classify
|
||||
&& (mode & S_IXUGO))
|
||||
PUTCHAR ('*');
|
||||
}
|
||||
@@ -2620,7 +2533,7 @@ length_of_file_name_and_frills (const struct fileinfo *f)
|
||||
if (print_block_size)
|
||||
len += 1 + block_size_size;
|
||||
|
||||
len += quote_filename (0, f->name);
|
||||
len += quotearg_buffer (0, 0, f->name, -1, filename_quoting_options);
|
||||
|
||||
if (indicator_style != none)
|
||||
{
|
||||
@@ -2628,7 +2541,7 @@ length_of_file_name_and_frills (const struct fileinfo *f)
|
||||
|
||||
if (S_ISREG (filetype))
|
||||
{
|
||||
if (indicator_style == all
|
||||
if (indicator_style == classify
|
||||
&& (f->stat.st_mode & S_IXUGO))
|
||||
len += 1;
|
||||
}
|
||||
@@ -2939,9 +2852,8 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
|
||||
types. WHEN may be `never', `always', or `auto'\n\
|
||||
-d, --directory list directory entries instead of contents\n\
|
||||
-D, --dired generate output designed for Emacs' dired mode\n\
|
||||
-e, --quote-shell quote entry names for shell (default)\n\
|
||||
-f do not sort, enable -aU, disable -lst\n\
|
||||
-F, --classify append a character for typing each entry\n\
|
||||
-F, --classify append indicator (one of */=@|) to entries\n\
|
||||
--format=WORD across -x, commas -m, horizontal -x, long -l,\n\
|
||||
single-column -1, verbose -l, vertical -C\n\
|
||||
--full-time list both full date and full time\n"));
|
||||
@@ -2951,6 +2863,8 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
|
||||
-G, --no-group inhibit display of group information\n\
|
||||
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\n\
|
||||
-H, --si likewise, but use powers of 1000 not 1024\n\
|
||||
--indicator-style=WORD append indicator with style WORD to entry names:\n\
|
||||
none (default), classify (-F), file-type (-p)\n\
|
||||
-i, --inode print index number of each file\n\
|
||||
-I, --ignore=PATTERN do not list implied entries matching shell PATTERN\n\
|
||||
-k, --kilobytes use 1024 blocks, not 512 despite POSIXLY_CORRECT\n\
|
||||
@@ -2961,9 +2875,12 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
|
||||
-N, --literal print raw entry names (don't treat e.g. control\n\
|
||||
characters specially)\n\
|
||||
-o use long listing format without group info\n\
|
||||
-p append a character for typing each entry\n\
|
||||
-p, --file-type append indicator (one of /=@|) to entries\n\
|
||||
-q, --hide-control-chars print ? instead of non graphic characters\n\
|
||||
--show-control-chars show non graphic characters as-is (default)\n\
|
||||
-Q, --quote-name enclose entry names in double quotes\n\
|
||||
--quoting-style=WORD use quoting style WORD for entry names:\n\
|
||||
literal, shell, shell-always, c, escape\n\
|
||||
-r, --reverse reverse order while sorting\n\
|
||||
-R, --recursive list subdirectories recursively\n\
|
||||
-s, --size print size of each file, in blocks\n"));
|
||||
|
||||
12
src/mv.c
12
src/mv.c
@@ -60,7 +60,7 @@
|
||||
#include "remove.h"
|
||||
#include "error.h"
|
||||
|
||||
#ifdef HAVE_LCHOWN
|
||||
#if HAVE_LCHOWN
|
||||
# define chown(PATH, OWNER, GROUP) lchown(PATH, OWNER, GROUP)
|
||||
#endif
|
||||
|
||||
@@ -126,7 +126,7 @@ rm_option_init (struct rm_options *x)
|
||||
static void
|
||||
cp_option_init (struct cp_options *x)
|
||||
{
|
||||
x->copy_as_regular = 1; /* FIXME: maybe make this an option */
|
||||
x->copy_as_regular = 0; /* FIXME: maybe make this an option */
|
||||
x->dereference = 0;
|
||||
x->force = 0;
|
||||
x->hard_link = 0;
|
||||
@@ -272,6 +272,7 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
|
||||
and set errno to EXDEV. */
|
||||
|
||||
static int first = 1;
|
||||
int copy_into_self;
|
||||
|
||||
if (first)
|
||||
{
|
||||
@@ -281,13 +282,18 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
|
||||
hash_init (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE);
|
||||
}
|
||||
|
||||
fail = copy (source, dest, nonexistent_dst, x);
|
||||
fail = copy (source, dest, nonexistent_dst, x, ©_into_self);
|
||||
if (fail)
|
||||
{
|
||||
/* Restore original destination file DEST if made a backup. */
|
||||
if (dest_backup && rename (dest_backup, dest))
|
||||
error (0, errno, _("cannot un-backup `%s'"), dest);
|
||||
}
|
||||
else if (copy_into_self)
|
||||
{
|
||||
/* Do *not* remove SOURCE if it is the same as or a parent of DEST.
|
||||
Otherwise, mv would be removing the original *and* the copy. */
|
||||
}
|
||||
else
|
||||
{
|
||||
struct rm_options rm_options;
|
||||
|
||||
@@ -518,11 +518,11 @@ remove_cwd_entries (const struct rm_options *x)
|
||||
ht = hash_initialize (HT_INITIAL_CAPACITY, NULL,
|
||||
hash_pjw, hash_compare_strings);
|
||||
if (ht == NULL)
|
||||
error (1, 0, _("Memory exhausted"));
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
}
|
||||
HASH_INSERT_NEW_ITEM (ht, entry_name, &fail);
|
||||
if (fail)
|
||||
error (1, 0, _("Memory exhausted"));
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -644,7 +644,7 @@ remove_dir (struct File_spec *fs, int need_save_cwd, const struct rm_options *x)
|
||||
}
|
||||
|
||||
if (x->verbose)
|
||||
printf (_("removing any entries of directory %s\n"),
|
||||
printf (_("removing all entries of directory %s\n"),
|
||||
full_filename (dir_name));
|
||||
|
||||
/* Save cwd if needed. */
|
||||
@@ -762,7 +762,7 @@ rm (struct File_spec *fs, int user_specified_name, const struct rm_options *x)
|
||||
current_depth ()),
|
||||
&fail);
|
||||
if (fail)
|
||||
error (1, 0, _("Memory exhausted"));
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
|
||||
if (old_ent)
|
||||
{
|
||||
|
||||
18
src/rmdir.c
18
src/rmdir.c
@@ -86,11 +86,12 @@ remove_parents (char *path)
|
||||
while (slash > path && *slash == '/')
|
||||
--slash;
|
||||
slash[1] = 0;
|
||||
fail = rmdir (path);
|
||||
|
||||
/* Give a diagnostic for each successful removal if --verbose. */
|
||||
if (verbose && !fail)
|
||||
error (0, errno, _("removed directory, %s"), path);
|
||||
/* Give a diagnostic for each attempted removal if --verbose. */
|
||||
if (verbose)
|
||||
error (0, errno, _("removing directory, %s"), path);
|
||||
|
||||
fail = rmdir (path);
|
||||
|
||||
if (fail)
|
||||
{
|
||||
@@ -189,11 +190,12 @@ main (int argc, char **argv)
|
||||
/* Stripping slashes is harmless for rmdir;
|
||||
if the arg is not a directory, it will fail with ENOTDIR. */
|
||||
strip_trailing_slashes (dir);
|
||||
fail = rmdir (dir);
|
||||
|
||||
/* Give a diagnostic for each successful removal if --verbose. */
|
||||
if (verbose && !fail)
|
||||
error (0, errno, _("removed directory, %s"), dir);
|
||||
/* Give a diagnostic for each attempted removal if --verbose. */
|
||||
if (verbose)
|
||||
error (0, errno, _("removing directory, %s"), dir);
|
||||
|
||||
fail = rmdir (dir);
|
||||
|
||||
if (fail)
|
||||
{
|
||||
|
||||
@@ -346,7 +346,7 @@ xtmpfopen (const char *file)
|
||||
FILE *fp;
|
||||
int fd;
|
||||
|
||||
fd = open (file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||
fd = open (file, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600);
|
||||
if (fd < 0 || (fp = fdopen (fd, "w")) == NULL)
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
|
||||
@@ -418,7 +418,7 @@ save_stdin (FILE **g_tmp, char **g_tempfile)
|
||||
sprintf (template, "%s/tacXXXXXX", tempdir);
|
||||
tempfile = mktemp (template);
|
||||
|
||||
fd = creat (tempfile, 0600);
|
||||
fd = open (tempfile, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600);
|
||||
if (fd == -1 || (tmp = fdopen (fd, "rw")) == NULL)
|
||||
error (EXIT_FAILURE, errno, "%s", tempfile);
|
||||
tmp = fdopen (fd, "rw");
|
||||
|
||||
@@ -41,18 +41,18 @@
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "argmatch.h"
|
||||
#include "getdate.h"
|
||||
|
||||
#ifndef STDC_HEADERS
|
||||
time_t time ();
|
||||
#endif
|
||||
|
||||
time_t get_date ();
|
||||
time_t posixtime ();
|
||||
int safe_read ();
|
||||
int full_write ();
|
||||
void invalid_arg ();
|
||||
|
||||
#ifndef HAVE_UTIME_NULL
|
||||
#if ! HAVE_UTIME_NULL
|
||||
static int utime_now ();
|
||||
#endif
|
||||
|
||||
@@ -171,7 +171,7 @@ touch (char *file)
|
||||
|
||||
if (amtime_now)
|
||||
{
|
||||
#ifndef HAVE_UTIME_NULL
|
||||
#if ! HAVE_UTIME_NULL
|
||||
status = utime_now (file, sbuf.st_size);
|
||||
#else
|
||||
/* Pass NULL to utime so it will not fail if we just have
|
||||
@@ -209,7 +209,7 @@ touch (char *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef HAVE_UTIME_NULL
|
||||
#if ! HAVE_UTIME_NULL
|
||||
/* Emulate utime (file, NULL) for systems (like 4.3BSD) that do not
|
||||
interpret it to set the access and modification times of FILE to
|
||||
the current time. FILESIZE is the correct size of FILE, used to
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
AUTOMAKE_OPTIONS = 1.1 gnits
|
||||
|
||||
TESTS = backup-1 no-deref-link1 no-deref-link2 no-deref-link3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
@@ -106,7 +105,7 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/cp/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
|
||||
##test-files-begin
|
||||
x = cut
|
||||
@@ -17,7 +17,7 @@ empty-fl.E missing-fl.O missing-fl.E empty-bl.O empty-bl.E missing-bl.O \
|
||||
missing-bl.E empty-f1.O empty-f1.E empty-f2.O empty-f2.E
|
||||
##test-files-end
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -25,29 +25,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
SUFFIXES = .pl
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -70,7 +70,6 @@ INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
@@ -100,7 +99,7 @@ s.E t.O t.E u.O u.E v.O v.E w.O w.E x.O x.E y.O y.E z.O z.E empty-fl.O \
|
||||
empty-fl.E missing-fl.O missing-fl.E empty-bl.O empty-bl.E missing-bl.O \
|
||||
missing-bl.E empty-f1.O empty-f1.E empty-f2.O empty-f2.E
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -108,7 +107,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
SUFFIXES = .pl
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
@@ -127,8 +126,7 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .pl
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/cut/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
@@ -233,28 +231,19 @@ install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
|
||||
##test-files-begin
|
||||
x = date
|
||||
@@ -23,7 +23,7 @@ date2sec-0a.O date2sec-0a.E date2sec-1.O date2sec-1.E sec2date-0.O \
|
||||
sec2date-0.E
|
||||
##test-files-end
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -31,29 +31,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
SUFFIXES = .pl
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -61,6 +61,7 @@ CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
GENCAT = @GENCAT@
|
||||
GETHOSTBYNAME_LIB = @GETHOSTBYNAME_LIB@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
@@ -117,7 +118,7 @@ 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
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -125,7 +126,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
SUFFIXES = .pl
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
@@ -144,7 +145,6 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .pl
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/date/Makefile
|
||||
|
||||
@@ -250,28 +250,19 @@ install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
|
||||
##test-files-begin
|
||||
x = factor
|
||||
@@ -11,7 +11,7 @@ m.E n.O n.E o.O o.E p.O p.E q.O q.E s.O s.E t.O t.E u.O u.E v.O v.E w.O w.E \
|
||||
x.O x.E y.O y.E
|
||||
##test-files-end
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -19,29 +19,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
SUFFIXES = .pl
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -61,6 +61,7 @@ CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
GENCAT = @GENCAT@
|
||||
GETHOSTBYNAME_LIB = @GETHOSTBYNAME_LIB@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
@@ -105,7 +106,7 @@ d.O d.E e.O e.E f.O f.E g.O g.E h.O h.E i.O i.E j.O j.E k.O k.E l.O l.E m.O \
|
||||
m.E n.O n.E o.O o.E p.O p.E q.O q.E s.O s.E t.O t.E u.O u.E v.O v.E w.O w.E \
|
||||
x.O x.E y.O y.E
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -113,7 +114,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
SUFFIXES = .pl
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
@@ -132,7 +133,6 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .pl
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/factor/Makefile
|
||||
|
||||
@@ -238,28 +238,19 @@ install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
|
||||
##test-files-begin
|
||||
x = head
|
||||
@@ -16,7 +16,7 @@ posix-1.O posix-1.E posix-2.O posix-2.E posix-3.O posix-3.E posix-4.O \
|
||||
posix-4.E posix-5.O posix-5.E
|
||||
##test-files-end
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -24,29 +24,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
SUFFIXES = .pl
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -70,7 +70,6 @@ INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
@@ -99,7 +98,7 @@ obs-4.O obs-4.E obs-5.O obs-5.E fail-1.O fail-1.E posix-0.O posix-0.E \
|
||||
posix-1.O posix-1.E posix-2.O posix-2.E posix-3.O posix-3.E posix-4.O \
|
||||
posix-4.E posix-5.O posix-5.E
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -107,7 +106,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
SUFFIXES = .pl
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
@@ -126,8 +125,7 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .pl
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/head/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
@@ -232,28 +230,19 @@ install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
||||
@@ -1,339 +0,0 @@
|
||||
#! @PERL@ -w
|
||||
# -*- perl -*-
|
||||
# @configure_input@
|
||||
|
||||
my $In = '.I';
|
||||
my $Out = '.O';
|
||||
my $Exp = '.X';
|
||||
my $Err = '.E';
|
||||
|
||||
require 5.002;
|
||||
use strict;
|
||||
use POSIX qw (assert);
|
||||
|
||||
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
|
||||
use Test;
|
||||
|
||||
my $srcdir = '@srcdir@';
|
||||
|
||||
sub validate
|
||||
{
|
||||
my %seen;
|
||||
my $test_vector;
|
||||
foreach $test_vector (Test::test_vector ())
|
||||
{
|
||||
my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
|
||||
@$test_vector;
|
||||
die "$0: wrong number of elements in test $test_name\n"
|
||||
if (!defined $e_ret_code || defined $rest);
|
||||
assert (!ref $test_name);
|
||||
assert (!ref $flags);
|
||||
assert (!ref $e_ret_code);
|
||||
|
||||
die "$0: duplicate test name \`$test_name'\n"
|
||||
if (defined $seen{$test_name});
|
||||
$seen{$test_name} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Given a spec for the input file(s) or expected output file of a single
|
||||
# test, create a file for any string. A file is created for each literal
|
||||
# string -- not for named files. Whether a perl `string' is treated as
|
||||
# a string to be put in a file for a test or the name of an existing file
|
||||
# depends on how many references have to be traversed to get from
|
||||
# the top level variable to the actual string literal.
|
||||
# If $SPEC is a literal Perl string (not a reference), then treat $SPEC
|
||||
# as the contents of a file.
|
||||
# If $SPEC is a hash reference, then there are no inputs.
|
||||
# If $SPEC is an array reference, consider each element of the array.
|
||||
# If the element is a string reference, treat the string as the name of
|
||||
# an existing file. Otherwise, the element must be a string and is treated
|
||||
# just like a scalar $SPEC. When a file is created, its name is derived
|
||||
# from the name TEST_NAME of the corresponding test and the TYPE of file.
|
||||
# E.g., the inputs for test `3a' would be named t3a.in1 and t3a.in2, and
|
||||
# the expected output for test `7c' would be named t7c.exp.
|
||||
#
|
||||
# Also, return two lists of file names:
|
||||
# - maintainer-generated files -- names of files created by this function
|
||||
# - files named explicitly in Test.pm
|
||||
|
||||
sub spec_to_list ($$$)
|
||||
{
|
||||
my ($spec, $test_name, $type) = @_;
|
||||
|
||||
assert ($type eq $In || $type eq $Exp);
|
||||
|
||||
my @explicit_file;
|
||||
my @maint_gen_file;
|
||||
my @content_string;
|
||||
|
||||
# If SPEC is a hash reference, return empty lists.
|
||||
if (ref $spec eq 'HASH')
|
||||
{
|
||||
assert ($type eq $In);
|
||||
return {
|
||||
EXPLICIT => \@explicit_file,
|
||||
MAINT_GEN => \@maint_gen_file
|
||||
};
|
||||
}
|
||||
|
||||
if (ref $spec)
|
||||
{
|
||||
assert (ref $spec eq 'ARRAY' || ref $spec eq 'HASH');
|
||||
my $file_spec;
|
||||
foreach $file_spec (@$spec)
|
||||
{
|
||||
# A file spec may be a string or a reference.
|
||||
# If it's a string, that string is to be the contents of a
|
||||
# generated (by this script) file with name derived from the
|
||||
# name of this test.
|
||||
# If it's a reference, then it must be the name of an existing
|
||||
# file.
|
||||
if (ref $file_spec)
|
||||
{
|
||||
my $r = ref $file_spec;
|
||||
die "bad test: $test_name is $r\n"
|
||||
if ref $file_spec ne 'SCALAR';
|
||||
my $existing_file = $$file_spec;
|
||||
# FIXME: make sure $existing_file exists somewhere.
|
||||
push (@explicit_file, $existing_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
push (@content_string, $file_spec);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
push (@content_string, $spec);
|
||||
}
|
||||
|
||||
my $i = 1;
|
||||
my $file_contents;
|
||||
foreach $file_contents (@content_string)
|
||||
{
|
||||
my $suffix = (@content_string > 1 ? $i : '');
|
||||
my $maint_gen_file = "$test_name$type$suffix";
|
||||
push (@maint_gen_file, $maint_gen_file);
|
||||
open (F, ">$srcdir/$maint_gen_file") || die "$0: $maint_gen_file: $!\n";
|
||||
print F $file_contents;
|
||||
close (F) || die "$0: $maint_gen_file: $!\n";
|
||||
++$i;
|
||||
}
|
||||
|
||||
my $n_fail = 0;
|
||||
foreach $i (@explicit_file, @maint_gen_file)
|
||||
{
|
||||
my $max_len = 14;
|
||||
if (length ($i) > $max_len)
|
||||
{
|
||||
warn "$0: $i: generated test file name would be longer than"
|
||||
. " $max_len characters\n";
|
||||
++$n_fail;
|
||||
}
|
||||
}
|
||||
exit (1) if $n_fail;
|
||||
|
||||
my %h = (
|
||||
EXPLICIT => \@explicit_file,
|
||||
MAINT_GEN => \@maint_gen_file
|
||||
);
|
||||
|
||||
return \%h;
|
||||
}
|
||||
|
||||
sub wrap
|
||||
{
|
||||
my ($preferred_line_len, @tok) = @_;
|
||||
assert ($preferred_line_len > 0);
|
||||
my @lines;
|
||||
my $line = '';
|
||||
my $word;
|
||||
foreach $word (@tok)
|
||||
{
|
||||
if ($line && length ($line) + 1 + length ($word) > $preferred_line_len)
|
||||
{
|
||||
push (@lines, $line);
|
||||
$line = $word;
|
||||
next;
|
||||
}
|
||||
my $sp = ($line ? ' ' : '');
|
||||
$line .= "$sp$word";
|
||||
}
|
||||
push (@lines, $line);
|
||||
return @lines;
|
||||
}
|
||||
|
||||
# ~~~~~~~ main ~~~~~~~~
|
||||
{
|
||||
$| = 1;
|
||||
|
||||
die "Usage: $0: program-name\n" if @ARGV != 1;
|
||||
|
||||
my $xx = $ARGV[0];
|
||||
|
||||
if ($xx eq '--list')
|
||||
{
|
||||
validate ();
|
||||
# Output three lists of files:
|
||||
# EXPLICIT -- file names specified in Test.pm
|
||||
# MAINT_GEN -- maintainer-generated files
|
||||
# RUN_GEN -- files created when running the tests
|
||||
my $test_vector;
|
||||
my @exp;
|
||||
my @maint;
|
||||
my @run;
|
||||
foreach $test_vector (Test::test_vector ())
|
||||
{
|
||||
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
|
||||
= @$test_vector;
|
||||
|
||||
push (@run, ("$test_name$Out", "$test_name$Err"));
|
||||
|
||||
my $in = spec_to_list ($in_spec, $test_name, $In);
|
||||
push (@exp, @{$in->{EXPLICIT}});
|
||||
push (@maint, @{$in->{MAINT_GEN}});
|
||||
|
||||
my $e = spec_to_list ($exp_spec, $test_name, $Exp);
|
||||
push (@exp, @{$e->{EXPLICIT}});
|
||||
push (@maint, @{$e->{MAINT_GEN}});
|
||||
}
|
||||
|
||||
# The list of explicitly mentioned files may contain duplicates.
|
||||
# Eliminated any duplicates.
|
||||
my %e = map {$_ => 1} @exp;
|
||||
@exp = sort keys %e;
|
||||
|
||||
my $len = 77;
|
||||
print join (" \\\n", wrap ($len, 'explicit =', @exp)), "\n";
|
||||
print join (" \\\n", wrap ($len, 'maint_gen =', @maint)), "\n";
|
||||
print join (" \\\n", wrap ($len, 'run_gen =', @run)), "\n";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
print <<EOF1;
|
||||
#! /bin/sh
|
||||
# This script was generated automatically by build-script.
|
||||
case \$# in
|
||||
0\) xx='$xx';;
|
||||
*\) xx="\$1";;
|
||||
esac
|
||||
test "\$VERBOSE" && echo=echo || echo=:
|
||||
\$echo testing program: \$xx
|
||||
errors=0
|
||||
test "\$srcdir" || srcdir=.
|
||||
test "\$VERBOSE" && \$xx --version 2> /dev/null
|
||||
|
||||
# Make sure we get English translations.
|
||||
LANGUAGE=C
|
||||
export LANGUAGE
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LANG=C
|
||||
export LANG
|
||||
|
||||
EOF1
|
||||
|
||||
validate ();
|
||||
|
||||
my $n_tests = 0;
|
||||
my $test_vector;
|
||||
foreach $test_vector (Test::test_vector ())
|
||||
{
|
||||
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
|
||||
= @$test_vector;
|
||||
|
||||
my $in = spec_to_list ($in_spec, $test_name, $In);
|
||||
|
||||
my @srcdir_rel_in_file;
|
||||
my $f;
|
||||
foreach $f (@{$in->{EXPLICIT}}, @{$in->{MAINT_GEN}})
|
||||
{
|
||||
push (@srcdir_rel_in_file, "\$srcdir/$f");
|
||||
}
|
||||
|
||||
my $exp = spec_to_list ($exp_spec, $test_name, $Exp);
|
||||
my @all = (@{$exp->{EXPLICIT}}, @{$exp->{MAINT_GEN}});
|
||||
assert (@all == 1);
|
||||
my $exp_name = "\$srcdir/$all[0]";
|
||||
my $out = "$test_name$Out";
|
||||
my $err_output = "$test_name$Err";
|
||||
|
||||
my %valid_via = map {$_ => 1} qw (REDIR FILE PIPE);
|
||||
my %via_msg_string = (REDIR => '<', FILE => 'F', PIPE => '|');
|
||||
|
||||
# Inhibit warnings about `used only once'.
|
||||
die if 0 && $Test::input_via{$test_name} && $Test::input_via_default;
|
||||
die if 0 && $Test::env{$test_name} && $Test::env_default;
|
||||
|
||||
my $vias = $Test::input_via{$test_name} || $Test::input_via_default
|
||||
|| {FILE => 0};
|
||||
|
||||
my $n_vias = keys %$vias;
|
||||
my ($via, $val);
|
||||
while (($via, $val) = each %$vias)
|
||||
{
|
||||
my $cmd;
|
||||
my $via_msg = ($n_vias == 1 ? '' : $via_msg_string{$via});
|
||||
my $file_args = join (' ', @srcdir_rel_in_file);
|
||||
|
||||
if ($via eq 'FILE')
|
||||
{
|
||||
$cmd = "\$xx $flags $file_args > $out 2> $err_output";
|
||||
}
|
||||
elsif ($via eq 'PIPE')
|
||||
{
|
||||
$via_msg = "|$val" if $val;
|
||||
$val ||= 'cat';
|
||||
$cmd = "$val $file_args | \$xx $flags > $out 2> $err_output";
|
||||
}
|
||||
else
|
||||
{
|
||||
assert (@srcdir_rel_in_file == 1);
|
||||
$cmd = "\$xx $flags < $file_args > $out 2> $err_output";
|
||||
}
|
||||
|
||||
my $env = $Test::env{$test_name} || $Test::env_default || [''];
|
||||
my $e;
|
||||
foreach $e (@$env)
|
||||
{
|
||||
my $sep = ($via_msg && $e ? ':' : '');
|
||||
my $msg = "$e$sep$via_msg";
|
||||
$msg = "($msg)" if $msg;
|
||||
my $t_name = "$test_name$msg";
|
||||
my $e_cmd = ($e ? "$e " : '');
|
||||
++$n_tests;
|
||||
print <<EOF;
|
||||
$e_cmd$cmd
|
||||
code=\$?
|
||||
if test \$code != $e_ret_code ; then
|
||||
\$echo "Test $t_name failed: $xx return code \$code differs from expected value $e_ret_code" 1>&2
|
||||
errors=`expr \$errors + 1`
|
||||
else
|
||||
cmp $out $exp_name > /dev/null 2>&1
|
||||
case \$? in
|
||||
0) if test "\$VERBOSE" ; then \$echo "passed $t_name"; fi ;;
|
||||
1) \$echo "Test $t_name failed: files $out and $exp_name differ" 1>&2;
|
||||
errors=`expr \$errors + 1` ;;
|
||||
2) \$echo "Test $t_name may have failed." 1>&2;
|
||||
\$echo The command \"cmp $out $exp_name\" failed. 1>&2 ;
|
||||
errors=`expr \$errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s $err_output || rm -f $err_output
|
||||
EOF
|
||||
}
|
||||
}
|
||||
}
|
||||
print <<EOF3 ;
|
||||
if test \$errors = 0 ; then
|
||||
\$echo Passed all $n_tests tests. 1>&2
|
||||
else
|
||||
\$echo Failed \$errors tests. 1>&2
|
||||
fi
|
||||
test \$errors = 0 || errors=1
|
||||
exit \$errors
|
||||
EOF3
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
|
||||
##test-files-begin
|
||||
x = join
|
||||
@@ -19,7 +19,7 @@ run_gen = 1a.O 1a.E 1b.O 1b.E 1c.O 1c.E 1d.O 1d.E 1e.O 1e.E 1f.O 1f.E 2a.O \
|
||||
6b.O 6b.E 6c.O 6c.E 7a.O 7a.E 8a.O 8a.E 8b.O 8b.E 9a.O 9a.E
|
||||
##test-files-end
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -27,29 +27,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
SUFFIXES = .pl
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -70,7 +70,6 @@ INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
@@ -102,7 +101,7 @@ run_gen = 1a.O 1a.E 1b.O 1b.E 1c.O 1c.E 1d.O 1d.E 1e.O 1e.E 1f.O 1f.E 2a.O \
|
||||
5g.E 5h.O 5h.E 5i.O 5i.E 5j.O 5j.E 5k.O 5k.E 5l.O 5l.E 5m.O 5m.E 6a.O 6a.E \
|
||||
6b.O 6b.E 6c.O 6c.E 7a.O 7a.E 8a.O 8a.E 8b.O 8b.E 9a.O 9a.E
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -110,7 +109,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
SUFFIXES = .pl
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
@@ -129,8 +128,7 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .pl
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/join/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
@@ -235,28 +233,19 @@ install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
||||
@@ -1,339 +0,0 @@
|
||||
#! @PERL@ -w
|
||||
# -*- perl -*-
|
||||
# @configure_input@
|
||||
|
||||
my $In = '.I';
|
||||
my $Out = '.O';
|
||||
my $Exp = '.X';
|
||||
my $Err = '.E';
|
||||
|
||||
require 5.002;
|
||||
use strict;
|
||||
use POSIX qw (assert);
|
||||
|
||||
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
|
||||
use Test;
|
||||
|
||||
my $srcdir = '@srcdir@';
|
||||
|
||||
sub validate
|
||||
{
|
||||
my %seen;
|
||||
my $test_vector;
|
||||
foreach $test_vector (Test::test_vector ())
|
||||
{
|
||||
my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
|
||||
@$test_vector;
|
||||
die "$0: wrong number of elements in test $test_name\n"
|
||||
if (!defined $e_ret_code || defined $rest);
|
||||
assert (!ref $test_name);
|
||||
assert (!ref $flags);
|
||||
assert (!ref $e_ret_code);
|
||||
|
||||
die "$0: duplicate test name \`$test_name'\n"
|
||||
if (defined $seen{$test_name});
|
||||
$seen{$test_name} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Given a spec for the input file(s) or expected output file of a single
|
||||
# test, create a file for any string. A file is created for each literal
|
||||
# string -- not for named files. Whether a perl `string' is treated as
|
||||
# a string to be put in a file for a test or the name of an existing file
|
||||
# depends on how many references have to be traversed to get from
|
||||
# the top level variable to the actual string literal.
|
||||
# If $SPEC is a literal Perl string (not a reference), then treat $SPEC
|
||||
# as the contents of a file.
|
||||
# If $SPEC is a hash reference, then there are no inputs.
|
||||
# If $SPEC is an array reference, consider each element of the array.
|
||||
# If the element is a string reference, treat the string as the name of
|
||||
# an existing file. Otherwise, the element must be a string and is treated
|
||||
# just like a scalar $SPEC. When a file is created, its name is derived
|
||||
# from the name TEST_NAME of the corresponding test and the TYPE of file.
|
||||
# E.g., the inputs for test `3a' would be named t3a.in1 and t3a.in2, and
|
||||
# the expected output for test `7c' would be named t7c.exp.
|
||||
#
|
||||
# Also, return two lists of file names:
|
||||
# - maintainer-generated files -- names of files created by this function
|
||||
# - files named explicitly in Test.pm
|
||||
|
||||
sub spec_to_list ($$$)
|
||||
{
|
||||
my ($spec, $test_name, $type) = @_;
|
||||
|
||||
assert ($type eq $In || $type eq $Exp);
|
||||
|
||||
my @explicit_file;
|
||||
my @maint_gen_file;
|
||||
my @content_string;
|
||||
|
||||
# If SPEC is a hash reference, return empty lists.
|
||||
if (ref $spec eq 'HASH')
|
||||
{
|
||||
assert ($type eq $In);
|
||||
return {
|
||||
EXPLICIT => \@explicit_file,
|
||||
MAINT_GEN => \@maint_gen_file
|
||||
};
|
||||
}
|
||||
|
||||
if (ref $spec)
|
||||
{
|
||||
assert (ref $spec eq 'ARRAY' || ref $spec eq 'HASH');
|
||||
my $file_spec;
|
||||
foreach $file_spec (@$spec)
|
||||
{
|
||||
# A file spec may be a string or a reference.
|
||||
# If it's a string, that string is to be the contents of a
|
||||
# generated (by this script) file with name derived from the
|
||||
# name of this test.
|
||||
# If it's a reference, then it must be the name of an existing
|
||||
# file.
|
||||
if (ref $file_spec)
|
||||
{
|
||||
my $r = ref $file_spec;
|
||||
die "bad test: $test_name is $r\n"
|
||||
if ref $file_spec ne 'SCALAR';
|
||||
my $existing_file = $$file_spec;
|
||||
# FIXME: make sure $existing_file exists somewhere.
|
||||
push (@explicit_file, $existing_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
push (@content_string, $file_spec);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
push (@content_string, $spec);
|
||||
}
|
||||
|
||||
my $i = 1;
|
||||
my $file_contents;
|
||||
foreach $file_contents (@content_string)
|
||||
{
|
||||
my $suffix = (@content_string > 1 ? $i : '');
|
||||
my $maint_gen_file = "$test_name$type$suffix";
|
||||
push (@maint_gen_file, $maint_gen_file);
|
||||
open (F, ">$srcdir/$maint_gen_file") || die "$0: $maint_gen_file: $!\n";
|
||||
print F $file_contents;
|
||||
close (F) || die "$0: $maint_gen_file: $!\n";
|
||||
++$i;
|
||||
}
|
||||
|
||||
my $n_fail = 0;
|
||||
foreach $i (@explicit_file, @maint_gen_file)
|
||||
{
|
||||
my $max_len = 14;
|
||||
if (length ($i) > $max_len)
|
||||
{
|
||||
warn "$0: $i: generated test file name would be longer than"
|
||||
. " $max_len characters\n";
|
||||
++$n_fail;
|
||||
}
|
||||
}
|
||||
exit (1) if $n_fail;
|
||||
|
||||
my %h = (
|
||||
EXPLICIT => \@explicit_file,
|
||||
MAINT_GEN => \@maint_gen_file
|
||||
);
|
||||
|
||||
return \%h;
|
||||
}
|
||||
|
||||
sub wrap
|
||||
{
|
||||
my ($preferred_line_len, @tok) = @_;
|
||||
assert ($preferred_line_len > 0);
|
||||
my @lines;
|
||||
my $line = '';
|
||||
my $word;
|
||||
foreach $word (@tok)
|
||||
{
|
||||
if ($line && length ($line) + 1 + length ($word) > $preferred_line_len)
|
||||
{
|
||||
push (@lines, $line);
|
||||
$line = $word;
|
||||
next;
|
||||
}
|
||||
my $sp = ($line ? ' ' : '');
|
||||
$line .= "$sp$word";
|
||||
}
|
||||
push (@lines, $line);
|
||||
return @lines;
|
||||
}
|
||||
|
||||
# ~~~~~~~ main ~~~~~~~~
|
||||
{
|
||||
$| = 1;
|
||||
|
||||
die "Usage: $0: program-name\n" if @ARGV != 1;
|
||||
|
||||
my $xx = $ARGV[0];
|
||||
|
||||
if ($xx eq '--list')
|
||||
{
|
||||
validate ();
|
||||
# Output three lists of files:
|
||||
# EXPLICIT -- file names specified in Test.pm
|
||||
# MAINT_GEN -- maintainer-generated files
|
||||
# RUN_GEN -- files created when running the tests
|
||||
my $test_vector;
|
||||
my @exp;
|
||||
my @maint;
|
||||
my @run;
|
||||
foreach $test_vector (Test::test_vector ())
|
||||
{
|
||||
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
|
||||
= @$test_vector;
|
||||
|
||||
push (@run, ("$test_name$Out", "$test_name$Err"));
|
||||
|
||||
my $in = spec_to_list ($in_spec, $test_name, $In);
|
||||
push (@exp, @{$in->{EXPLICIT}});
|
||||
push (@maint, @{$in->{MAINT_GEN}});
|
||||
|
||||
my $e = spec_to_list ($exp_spec, $test_name, $Exp);
|
||||
push (@exp, @{$e->{EXPLICIT}});
|
||||
push (@maint, @{$e->{MAINT_GEN}});
|
||||
}
|
||||
|
||||
# The list of explicitly mentioned files may contain duplicates.
|
||||
# Eliminated any duplicates.
|
||||
my %e = map {$_ => 1} @exp;
|
||||
@exp = sort keys %e;
|
||||
|
||||
my $len = 77;
|
||||
print join (" \\\n", wrap ($len, 'explicit =', @exp)), "\n";
|
||||
print join (" \\\n", wrap ($len, 'maint_gen =', @maint)), "\n";
|
||||
print join (" \\\n", wrap ($len, 'run_gen =', @run)), "\n";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
print <<EOF1;
|
||||
#! /bin/sh
|
||||
# This script was generated automatically by build-script.
|
||||
case \$# in
|
||||
0\) xx='$xx';;
|
||||
*\) xx="\$1";;
|
||||
esac
|
||||
test "\$VERBOSE" && echo=echo || echo=:
|
||||
\$echo testing program: \$xx
|
||||
errors=0
|
||||
test "\$srcdir" || srcdir=.
|
||||
test "\$VERBOSE" && \$xx --version 2> /dev/null
|
||||
|
||||
# Make sure we get English translations.
|
||||
LANGUAGE=C
|
||||
export LANGUAGE
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LANG=C
|
||||
export LANG
|
||||
|
||||
EOF1
|
||||
|
||||
validate ();
|
||||
|
||||
my $n_tests = 0;
|
||||
my $test_vector;
|
||||
foreach $test_vector (Test::test_vector ())
|
||||
{
|
||||
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
|
||||
= @$test_vector;
|
||||
|
||||
my $in = spec_to_list ($in_spec, $test_name, $In);
|
||||
|
||||
my @srcdir_rel_in_file;
|
||||
my $f;
|
||||
foreach $f (@{$in->{EXPLICIT}}, @{$in->{MAINT_GEN}})
|
||||
{
|
||||
push (@srcdir_rel_in_file, "\$srcdir/$f");
|
||||
}
|
||||
|
||||
my $exp = spec_to_list ($exp_spec, $test_name, $Exp);
|
||||
my @all = (@{$exp->{EXPLICIT}}, @{$exp->{MAINT_GEN}});
|
||||
assert (@all == 1);
|
||||
my $exp_name = "\$srcdir/$all[0]";
|
||||
my $out = "$test_name$Out";
|
||||
my $err_output = "$test_name$Err";
|
||||
|
||||
my %valid_via = map {$_ => 1} qw (REDIR FILE PIPE);
|
||||
my %via_msg_string = (REDIR => '<', FILE => 'F', PIPE => '|');
|
||||
|
||||
# Inhibit warnings about `used only once'.
|
||||
die if 0 && $Test::input_via{$test_name} && $Test::input_via_default;
|
||||
die if 0 && $Test::env{$test_name} && $Test::env_default;
|
||||
|
||||
my $vias = $Test::input_via{$test_name} || $Test::input_via_default
|
||||
|| {FILE => 0};
|
||||
|
||||
my $n_vias = keys %$vias;
|
||||
my ($via, $val);
|
||||
while (($via, $val) = each %$vias)
|
||||
{
|
||||
my $cmd;
|
||||
my $via_msg = ($n_vias == 1 ? '' : $via_msg_string{$via});
|
||||
my $file_args = join (' ', @srcdir_rel_in_file);
|
||||
|
||||
if ($via eq 'FILE')
|
||||
{
|
||||
$cmd = "\$xx $flags $file_args > $out 2> $err_output";
|
||||
}
|
||||
elsif ($via eq 'PIPE')
|
||||
{
|
||||
$via_msg = "|$val" if $val;
|
||||
$val ||= 'cat';
|
||||
$cmd = "$val $file_args | \$xx $flags > $out 2> $err_output";
|
||||
}
|
||||
else
|
||||
{
|
||||
assert (@srcdir_rel_in_file == 1);
|
||||
$cmd = "\$xx $flags < $file_args > $out 2> $err_output";
|
||||
}
|
||||
|
||||
my $env = $Test::env{$test_name} || $Test::env_default || [''];
|
||||
my $e;
|
||||
foreach $e (@$env)
|
||||
{
|
||||
my $sep = ($via_msg && $e ? ':' : '');
|
||||
my $msg = "$e$sep$via_msg";
|
||||
$msg = "($msg)" if $msg;
|
||||
my $t_name = "$test_name$msg";
|
||||
my $e_cmd = ($e ? "$e " : '');
|
||||
++$n_tests;
|
||||
print <<EOF;
|
||||
$e_cmd$cmd
|
||||
code=\$?
|
||||
if test \$code != $e_ret_code ; then
|
||||
\$echo "Test $t_name failed: $xx return code \$code differs from expected value $e_ret_code" 1>&2
|
||||
errors=`expr \$errors + 1`
|
||||
else
|
||||
cmp $out $exp_name > /dev/null 2>&1
|
||||
case \$? in
|
||||
0) if test "\$VERBOSE" ; then \$echo "passed $t_name"; fi ;;
|
||||
1) \$echo "Test $t_name failed: files $out and $exp_name differ" 1>&2;
|
||||
errors=`expr \$errors + 1` ;;
|
||||
2) \$echo "Test $t_name may have failed." 1>&2;
|
||||
\$echo The command \"cmp $out $exp_name\" failed. 1>&2 ;
|
||||
errors=`expr \$errors + 1` ;;
|
||||
esac
|
||||
fi
|
||||
test -s $err_output || rm -f $err_output
|
||||
EOF
|
||||
}
|
||||
}
|
||||
}
|
||||
print <<EOF3 ;
|
||||
if test \$errors = 0 ; then
|
||||
\$echo Passed all $n_tests tests. 1>&2
|
||||
else
|
||||
\$echo Failed \$errors tests. 1>&2
|
||||
fi
|
||||
test \$errors = 0 || errors=1
|
||||
exit \$errors
|
||||
EOF3
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
AUTOMAKE_OPTIONS = 1.2 gnits
|
||||
|
||||
TESTS = sf-1
|
||||
TESTS = sf-1 misc
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = LN=../../src/ln
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
@@ -90,7 +89,7 @@ l = @l@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.2 gnits
|
||||
|
||||
TESTS = sf-1
|
||||
TESTS = sf-1 misc
|
||||
EXTRA_DIST = $(TESTS)
|
||||
TESTS_ENVIRONMENT = LN=../../src/ln
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
@@ -106,7 +105,7 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/ln/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
|
||||
89
tests/ln/misc
Executable file
89
tests/ln/misc
Executable file
@@ -0,0 +1,89 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH=../../../src:$PATH
|
||||
tmp=t2-ln.$$
|
||||
|
||||
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
|
||||
|
||||
|
||||
t=tln-symlink
|
||||
d=tln-subdir
|
||||
ld=tln-symlink-to-subdir
|
||||
f=tln-file
|
||||
fail=0
|
||||
|
||||
# Create a simple symlink with both source and destination files
|
||||
# in current directory.
|
||||
touch $f || test_failure=1
|
||||
rm -f $t || test_failure=1
|
||||
ln -s $f $t || fail=1
|
||||
test -f $t || fail=1
|
||||
rm $t $f
|
||||
|
||||
# Create a symlink with source file and explicit destination directory/file.
|
||||
touch $f || test_failure=1
|
||||
rm -rf $d || test_failure=1
|
||||
mkdir $d || test_failure=1
|
||||
ln -s ../$f $d/$t || fail=1
|
||||
test -f $d/$t || fail=1
|
||||
rm -rf $d $f
|
||||
|
||||
# Create a symlink with source file and destination directory.
|
||||
touch $f || test_failure=1
|
||||
rm -rf $d || test_failure=1
|
||||
mkdir $d || test_failure=1
|
||||
ln -s ../$f $d || fail=1
|
||||
test -f $d/$f || fail=1
|
||||
rm -rf $d $f
|
||||
|
||||
# Make sure we get a failure with existing dest without -f option
|
||||
touch $t || test_failure=1
|
||||
# FIXME: don't ignore the error message but rather test
|
||||
# it to make sure it's the right one.
|
||||
ln -s $t $t 2> /dev/null && fail=1
|
||||
rm $t
|
||||
|
||||
# Make sure -sf fails when src and dest are the same
|
||||
touch $t && test_failure=1
|
||||
ln -sf $t $t 2> /dev/null && fail=1
|
||||
rm $t
|
||||
|
||||
# Create a symlink with source file and no explicit directory
|
||||
rm -rf $d || test_failure=1
|
||||
mkdir $d || test_failure=1
|
||||
touch $d/$f || test_failure=1
|
||||
ln -s $d/$f || fail=1
|
||||
test -f $f || fail=1
|
||||
rm -rf $d $f
|
||||
|
||||
# Create a symlink with source file and destination symlink-to-directory.
|
||||
rm -rf $d $f $ld || test_failure=1
|
||||
touch $f || test_failure=1
|
||||
mkdir $d || test_failure=1
|
||||
ln -s $d $ld
|
||||
ln -s ../$f $ld || fail=1
|
||||
test -f $d/$f || fail=1
|
||||
rm -rf $d $f $ld
|
||||
|
||||
# Create a symlink with source file and destination symlink-to-directory.
|
||||
# BUT use the new --no-dereference option.
|
||||
rm -rf $d $f $ld || test_failure=1
|
||||
touch $f || test_failure=1
|
||||
mkdir $d || test_failure=1
|
||||
ln -s $d $ld
|
||||
af=`pwd`/$f
|
||||
ln --no-dereference -fs $af $ld || fail=1
|
||||
test -f $ld || fail=1
|
||||
rm -rf $d $f $ld
|
||||
|
||||
cd ..
|
||||
rm -rf $tmp
|
||||
|
||||
exit $fail
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
@@ -106,7 +105,7 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/ls/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
|
||||
##test-files-begin
|
||||
x = md5sum
|
||||
@@ -7,7 +7,7 @@ maint_gen = 1.I 1.X 2.I 2.X 3.I 3.X 4.I 4.X 5.I 5.X 6.I 6.X 7.I 7.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
|
||||
##test-files-end
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -15,29 +15,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
SUFFIXES = .pl
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -70,7 +70,6 @@ INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
@@ -90,7 +89,7 @@ explicit =
|
||||
maint_gen = 1.I 1.X 2.I 2.X 3.I 3.X 4.I 4.X 5.I 5.X 6.I 6.X 7.I 7.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
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -98,7 +97,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
SUFFIXES = .pl
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
@@ -117,8 +116,7 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .pl
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/md5sum/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
@@ -223,28 +221,19 @@ install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
||||
7
tests/cut/mk-script.pl → tests/mk-script
Normal file → Executable file
7
tests/cut/mk-script.pl → tests/mk-script
Normal file → Executable file
@@ -1,6 +1,5 @@
|
||||
#! @PERL@ -w
|
||||
#! /usr/bin/perl -w
|
||||
# -*- perl -*-
|
||||
# @configure_input@
|
||||
|
||||
my $In = '.I';
|
||||
my $Out = '.O';
|
||||
@@ -11,10 +10,10 @@ require 5.002;
|
||||
use strict;
|
||||
use POSIX qw (assert);
|
||||
|
||||
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
|
||||
BEGIN { push @INC, '.' if '.' ne '.'; }
|
||||
use Test;
|
||||
|
||||
my $srcdir = '@srcdir@';
|
||||
my $srcdir = '.';
|
||||
|
||||
sub validate
|
||||
{
|
||||
@@ -1,3 +1,4 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
AUTOMAKE_OPTIONS = 1.1 gnits
|
||||
|
||||
TESTS = p-1 p-2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2d from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
@@ -106,7 +105,7 @@ GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/mkdir/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
|
||||
1
tests/mv/.cvsignore
Normal file
1
tests/mv/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
Makefile
|
||||
13
tests/mv/Makefile.am
Normal file
13
tests/mv/Makefile.am
Normal file
@@ -0,0 +1,13 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
AUTOMAKE_OPTIONS = 1.2 gnits
|
||||
|
||||
TESTS = mv-special-1 into-self
|
||||
EXTRA_DIST = $(TESTS) setup
|
||||
TESTS_ENVIRONMENT = \
|
||||
DF=../../src/df \
|
||||
LS=../../src/ls \
|
||||
MKDIR=../../src/mkdir \
|
||||
MKNOD=../../src/mknod \
|
||||
MV=../../src/mv \
|
||||
RM=../../src/rm \
|
||||
TOUCH=../../src/touch
|
||||
223
tests/mv/Makefile.in
Normal file
223
tests/mv/Makefile.in
Normal file
@@ -0,0 +1,223 @@
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DF_PROG = @DF_PROG@
|
||||
GENCAT = @GENCAT@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
MVDIR_PROG = @MVDIR_PROG@
|
||||
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@
|
||||
l = @l@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.2 gnits
|
||||
|
||||
TESTS = mv-special-1 into-self
|
||||
EXTRA_DIST = $(TESTS) setup
|
||||
TESTS_ENVIRONMENT = \
|
||||
DF=../../src/df \
|
||||
LS=../../src/ls \
|
||||
MKDIR=../../src/mkdir \
|
||||
MKNOD=../../src/mknod \
|
||||
MV=../../src/mv \
|
||||
RM=../../src/rm \
|
||||
TOUCH=../../src/touch
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = README Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/mv/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = tests/mv
|
||||
|
||||
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/mv/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
for tst in $(TESTS); do \
|
||||
if test -f $$tst; then dir=.; \
|
||||
else dir="$(srcdir)"; fi; \
|
||||
if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
|
||||
all=`expr $$all + 1`; \
|
||||
echo "PASS: $$tst"; \
|
||||
elif test $$? -ne 77; then \
|
||||
all=`expr $$all + 1`; \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "FAIL: $$tst"; \
|
||||
fi; \
|
||||
done; \
|
||||
if test "$$failed" -eq 0; then \
|
||||
banner="All $$all tests passed"; \
|
||||
else \
|
||||
banner="$$failed of $$all tests failed"; \
|
||||
fi; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"; \
|
||||
test "$$failed" -eq 0
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE) check-TESTS
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall:
|
||||
|
||||
all: Makefile
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-generic clean
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default tags distdir check-TESTS info dvi installcheck \
|
||||
install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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:
|
||||
31
tests/mv/into-self
Executable file
31
tests/mv/into-self
Executable file
@@ -0,0 +1,31 @@
|
||||
#! /bin/sh
|
||||
|
||||
: ${MV=mv}
|
||||
: ${MKDIR=mkdir}
|
||||
: ${RM=rm}
|
||||
: ${TOUCH=touch}
|
||||
|
||||
dir=into-self-dir
|
||||
file=into-self-file
|
||||
|
||||
test_failure=0
|
||||
|
||||
$RM -f $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'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail=0
|
||||
$MV $dir $file $dir || fail=1
|
||||
# Make sure the file is gone.
|
||||
test -f $file && fail=1
|
||||
# Make sure the directory is *not* gone.
|
||||
test -d $dir/$dir/a/b || fail=1
|
||||
# Make sure the file has been moved to the right place.
|
||||
test -f $dir/$file || fail=1
|
||||
|
||||
exit $fail
|
||||
42
tests/mv/mv-special-1
Executable file
42
tests/mv/mv-special-1
Executable file
@@ -0,0 +1,42 @@
|
||||
#! /bin/sh
|
||||
|
||||
: ${LS=ls}
|
||||
: ${MV=mv}
|
||||
: ${MKDIR=mkdir}
|
||||
: ${MKNOD=mknod}
|
||||
: ${RM=rm}
|
||||
: ${TOUCH=touch}
|
||||
|
||||
. $srcdir/setup
|
||||
|
||||
if test -z $other_partition_tmpdir; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
null=.mv-null
|
||||
dir=.mv-dir
|
||||
|
||||
test_failure=0
|
||||
|
||||
$RM -f $null || test_failure=1
|
||||
$MKNOD $null p || test_failure=1
|
||||
$MKDIR -p $dir/a/b/c $dir/d/e/f || test_failure=1
|
||||
$TOUCH $dir/a/b/c/file1 $dir/d/e/f/file2 || test_failure=1
|
||||
|
||||
if test $test_failure = 1; then
|
||||
echo 'failure in testing framework'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail=0
|
||||
$MV $null $dir $other_partition_tmpdir || fail=1
|
||||
# Make sure the files are gone.
|
||||
test -f $null && fail=1
|
||||
test -d $dir && fail=1
|
||||
|
||||
# cd $other_partition_tmpdir
|
||||
# $LS -l -A -R $other_partition_tmpdir
|
||||
|
||||
$RM -rf $null $dir $other_partition_tmpdir
|
||||
|
||||
exit $fail
|
||||
43
tests/mv/setup
Executable file
43
tests/mv/setup
Executable file
@@ -0,0 +1,43 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Use df to find a writable directory on a file system different from that
|
||||
# of the current directory. If one is found, create a temporary directory
|
||||
# inside it.
|
||||
|
||||
: ${DF=df}
|
||||
: ${MKDIR=mkdir}
|
||||
|
||||
# Try these
|
||||
: ${CANDIDATE_TMP_DIRS="$TMPDIR /tmp /var/tmp /usr/tmp $HOME"}
|
||||
|
||||
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'`
|
||||
for d in $CANDIDATE_TMP_DIRS; do
|
||||
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
|
||||
other_partition_tmpdir="$d/df-$$"
|
||||
break
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if test -z $other_partition_tmpdir; then
|
||||
cat <<EOF 1>&2
|
||||
This test requires a writable directory on a different disk partition,
|
||||
and I couldn\'t find one. I tried these defaults:
|
||||
$CANDIDATE_TMP_DIRS
|
||||
Set your environment variable CANDIDATE_TMP_DIRS to make this test use
|
||||
use a different list.
|
||||
EOF
|
||||
fi
|
||||
|
||||
test "$VERBOSE" = yes && set -x
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
|
||||
##test-files-begin
|
||||
x = pr
|
||||
@@ -59,7 +59,7 @@ run_gen = 1a.O 1a.E 1b.O 1b.E 1c.O 1c.E 1d.O 1d.E 1e.O 1e.E 1f.O 1f.E 1g.O \
|
||||
margin-0.O margin-0.E
|
||||
##test-files-end
|
||||
|
||||
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
|
||||
noinst_SCRIPTS = $x-tests
|
||||
|
||||
PERL = @PERL@
|
||||
@@ -67,29 +67,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
|
||||
|
||||
TESTS = $x-tests
|
||||
|
||||
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
|
||||
./mk-script ../../src/$x > $@.n
|
||||
mk_script = $(srcdir)/../mk-script
|
||||
$(srcdir)/$x-tests: $(mk_script) Test.pm
|
||||
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
|
||||
mv $@.n $@
|
||||
chmod 755 $@
|
||||
|
||||
mk-script: ../../config.status
|
||||
|
||||
SUFFIXES = .pl
|
||||
|
||||
.pl:
|
||||
rm -f $@ $@.tmp
|
||||
$(editpl) $< > $@.tmp
|
||||
chmod +x-w $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
|
||||
CLEANFILES = $(run_gen)
|
||||
|
||||
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
|
||||
@MAINT@ rm -f $@ $@t
|
||||
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
@MAINT@ echo "x = $$tool" >> $@t
|
||||
@MAINT@ ./mk-script --list >> $@t
|
||||
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
@MAINT@ mv $@t $@
|
||||
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##test-files-begin/p' $< > $@t
|
||||
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
|
||||
echo "x = $$tool" >> $@t
|
||||
$(PERL) -w -- $(mk_script) --list >> $@t
|
||||
sed -n '/^##test-files-end/,$$p' $< >> $@t
|
||||
mv $@t $@
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user