Compare commits

...

115 Commits

Author SHA1 Message Date
Jim Meyering
05d9a7233b *** empty log message *** 1998-01-04 23:28:28 +00:00
Jim Meyering
f664e44a2f *** empty log message *** 1998-01-04 23:27:12 +00:00
Jim Meyering
5705eaaee2 . 1998-01-04 22:54:19 +00:00
Jim Meyering
0e69432852 . 1998-01-04 22:46:40 +00:00
Jim Meyering
2d69426882 copyright 1998-01-04 22:46:23 +00:00
Jim Meyering
5d4f8ebdfd (main, usage): Check for write error to stdout before exiting.
Include "closeout.h".
1998-01-04 22:45:28 +00:00
Jim Meyering
b246280c27 (parse_long_options): Check for write error to stdout before exiting. 1998-01-04 22:43:44 +00:00
Jim Meyering
60e021ee4e (libfu_a_SOURCES): Add closeout.c.
(noinst_HEADERS): Add closeout.h.
1998-01-04 22:42:38 +00:00
Jim Meyering
63c0f480ad Use a single enumerated type, Verbosity, instead of
the two booleans, verbose and changes_only.  This fixes a bug whereby
--change had the same effect as --verbose.
Plus Paul's close_stdout changes.
1998-01-04 22:41:02 +00:00
Jim Meyering
e375f4e9c8 Use a single enumerated type, Verbosity, instead of
the two booleans, verbose and changes_only.  This fixes a bug whereby
--change had the same effect as --verbose.
1998-01-04 22:40:27 +00:00
Jim Meyering
109b9c5f94 . 1998-01-04 21:48:30 +00:00
Jim Meyering
126c1a40e5 . 1998-01-04 21:47:31 +00:00
Jim Meyering
2440fd8bac . 1998-01-03 22:53:52 +00:00
Jim Meyering
98b9c4bed7 . 1998-01-03 22:16:23 +00:00
Jim Meyering
40f708f534 . 1998-01-03 22:14:58 +00:00
Jim Meyering
ebc5dc0b0c *** empty log message *** 1998-01-03 22:13:53 +00:00
Jim Meyering
e0ed4e6a77 *** empty log message *** 1998-01-03 18:10:47 +00:00
Jim Meyering
c24393e0fd *** empty log message *** 1998-01-03 18:09:23 +00:00
Jim Meyering
e15db4ca81 *** empty log message *** 1998-01-03 16:47:35 +00:00
Jim Meyering
1059e96721 (show_dev): Treat `fsu.fsu_bavail == (unsigned long) -1'
just like `fsu.fsu_blocks == 0' as an indicator that usage information
is invalid.  This happens with Solaris-5.5.1 CD-ROM partitions.
1998-01-03 16:47:21 +00:00
Jim Meyering
234ea05171 *** empty log message *** 1998-01-03 14:40:33 +00:00
Jim Meyering
0fa007e352 *** empty log message *** 1998-01-03 12:03:01 +00:00
Jim Meyering
9e6b379dbf *** empty log message *** 1998-01-03 11:58:49 +00:00
Jim Meyering
d46bab3a59 Guard PARAMS-enabling definition with
`defined PROTOTYPES || (defined __STDC__ && __STDC__)' to be consistent.
1998-01-03 11:56:58 +00:00
Jim Meyering
541699c01c Guard PARAMS-enabling definition with
`defined PROTOTYPES || (defined __STDC__ && __STDC__)' to avoid
problems with Irix4's cc.  From Kaveh Ghazi.
1998-01-03 11:56:09 +00:00
Jim Meyering
23a8ea7992 *** empty log message *** 1998-01-02 23:18:08 +00:00
Jim Meyering
6b4321fd1b *** empty log message *** 1998-01-02 23:16:53 +00:00
Jim Meyering
2fb86e2eb8 (get_ids): When otherwise unspecified, set uid and gid to -1. 1998-01-02 23:16:38 +00:00
Jim Meyering
53bc7b04cb (make_path): Try to change ownership only if we've just created the
directory.  Fix latent bug (s/&&/||/ in two places -- also, note that
it could not be exercised via install or mkdir) whereby chown would
not be invoked when only one of owner/group is not -1.
1998-01-02 23:15:39 +00:00
Jim Meyering
43c2a5f62b *** empty log message *** 1998-01-01 21:33:29 +00:00
Jim Meyering
b3d19ee824 (remove_cwd_entries): Initialize the entry-name obstack
only once and never free it.
1998-01-01 21:32:46 +00:00
Jim Meyering
2c2fa642c4 (show_dev): Move check for 0-block device (and return if
not e.g., -a) back up to precede first print stmt.
1998-01-01 21:30:00 +00:00
Jim Meyering
cb5e8a14c2 *** empty log message *** 1998-01-01 19:45:43 +00:00
Jim Meyering
48221eb8bd *** empty log message *** 1998-01-01 19:44:02 +00:00
Jim Meyering
3e6934d53e *** empty log message *** 1998-01-01 19:41:47 +00:00
Jim Meyering
741e2bd94b *** empty log message *** 1998-01-01 19:36:19 +00:00
Jim Meyering
0327bae400 *** empty log message *** 1997-12-31 21:36:14 +00:00
Jim Meyering
e3d35f6789 (show_dev): Print inode counts human readably. 1997-12-31 21:34:07 +00:00
Jim Meyering
b76a453304 (decode_switches): -h and -H override output units.
(print_dir, gobble_file, print_long_format,
print_file_name_and_frills): Print disk allocations human readably.
1997-12-31 21:33:51 +00:00
Jim Meyering
069e564d89 . 1997-12-31 14:28:44 +00:00
Jim Meyering
cadfe29978 *** empty log message *** 1997-12-31 14:04:54 +00:00
Jim Meyering
da111683d5 (show_dev): Move computation of
blocks_used etc. and blocks_percent_used,
inodes_used etc. and inodes_percent_used into respective branches
of the `if (inode_format)' statement where they're actually used.
1997-12-31 14:04:20 +00:00
Jim Meyering
57da248b85 *** empty log message *** 1997-12-31 11:01:48 +00:00
Jim Meyering
b66148ba39 Define and use PARAMS, not __EXCLUDE_P. 1997-12-31 11:01:35 +00:00
Jim Meyering
86d2f9eaa8 Use PARAMS, not __EXCLUDE_P. 1997-12-31 11:01:18 +00:00
Jim Meyering
25e06fece0 (usage): s/TAB/ /g 1997-12-29 22:09:28 +00:00
Jim Meyering
d1de57abbc *** empty log message *** 1997-12-29 21:29:51 +00:00
Jim Meyering
5cc8090de2 (remove_cwd_entries): Plug a gross leak -- don't call
obstack_init inside the loop.
1997-12-29 21:04:26 +00:00
Jim Meyering
e2ed51f99e *** empty log message *** 1997-12-29 12:06:02 +00:00
Jim Meyering
134ed86e33 (usage): Replace TABs with spaces in --help message. 1997-12-29 12:05:36 +00:00
Jim Meyering
f7d4fc0e38 (invalid_arg): Use a single fprintf and whole
format statements to ease translation.
Convert from K&R to ANSI function dcls.
1997-12-29 12:02:43 +00:00
Jim Meyering
3531b69552 . 1997-12-28 21:49:54 +00:00
Jim Meyering
ce9923ab87 Use ANSI syntax, not K&R. 1997-12-28 10:41:01 +00:00
Jim Meyering
6d02c37081 *** empty log message *** 1997-12-28 10:38:30 +00:00
Jim Meyering
b2e7f8b0af (make_path) [!__STDC__]: Remove K&R-style definition. 1997-12-28 10:38:15 +00:00
Jim Meyering
08c3f260a1 define PARAMS 1997-12-28 09:48:26 +00:00
Jim Meyering
cde7e42dde Add PARAMS. 1997-12-28 08:04:08 +00:00
Jim Meyering
4656a7e55b Remove incorrect declaration of group_member.
Include group-member.h instead.
Based on suggestion from Ulrich Drepper.
1997-12-28 08:03:54 +00:00
Jim Meyering
3513f31730 *** empty log message *** 1997-12-27 23:55:40 +00:00
Jim Meyering
1bcedd2345 *** empty log message *** 1997-12-27 23:55:18 +00:00
Jim Meyering
456d579624 . 1997-12-25 23:06:12 +00:00
Jim Meyering
c02b9b75c6 new version from kb 1997-12-25 18:00:21 +00:00
Jim Meyering
012a6455ea . 1997-12-25 17:51:15 +00:00
Jim Meyering
bb48c492c6 (_GNU_SOURCE): Define only if not already defined. 1997-12-25 17:44:08 +00:00
Jim Meyering
1a952f8145 . 1997-12-25 17:43:21 +00:00
Jim Meyering
2bb1686d0c . 1997-12-25 17:05:45 +00:00
Jim Meyering
1f1ea6519b (get_ids): Don't cast GID_T_MAX to long, it might overflow. 1997-12-25 17:05:23 +00:00
Jim Meyering
f10648f6c7 (skip): Compare lseek return value with -1 to allow it
to be negative as signed value.
1997-12-25 17:04:15 +00:00
Jim Meyering
d9f1fd86d9 Declare stpcpy only if not defined as macro. 1997-12-25 17:02:25 +00:00
Jim Meyering
ea0f644cdd (S_ISLNK): Define this instead of S_ISDIR. 1997-12-25 17:01:35 +00:00
Jim Meyering
4f71c21910 Declare stpcpy only if not defined as macro. 1997-12-25 17:01:13 +00:00
Jim Meyering
9897ca0150 Declare stpcpy only if not defined as macro. 1997-12-25 16:49:08 +00:00
Jim Meyering
1a8e1f7bfd Include <string.h> if available. 1997-12-25 16:48:51 +00:00
Jim Meyering
c9f538deb9 (copy_internal): Use S_ISLNK only if defined. 1997-12-25 16:48:29 +00:00
Jim Meyering
88df9ef6f6 . 1997-12-24 13:16:54 +00:00
Jim Meyering
46e9b477a9 *** empty log message *** 1997-12-21 22:48:24 +00:00
Jim Meyering
82e77237a6 . 1997-12-21 22:48:08 +00:00
Jim Meyering
f54368ec1b s/__P/PARAMS/ 1997-12-21 22:39:53 +00:00
Jim Meyering
44dddb31c0 *** empty log message *** 1997-12-21 22:32:44 +00:00
Jim Meyering
2e308957d4 s/__P/PARAMS/ 1997-12-21 22:30:30 +00:00
Jim Meyering
2391251527 Don't include limits.h. 1997-12-21 22:22:04 +00:00
Jim Meyering
3858d01133 Don't include limits.h. 1997-12-21 22:21:26 +00:00
Jim Meyering
62fed0f3a2 Don't include limits.h or sys/param.h. 1997-12-21 22:21:10 +00:00
Jim Meyering
37998fc5bd Don't include limits.h.
These are all done in system.h now.
1997-12-21 22:20:17 +00:00
Jim Meyering
6123a88852 Don't include limits.h.
(UINT_MAX): Don't define.
(INT_MAX): Don't define.
These are all done in system.h now.
1997-12-21 22:20:01 +00:00
Jim Meyering
3d0e13a00d . 1997-12-21 12:29:32 +00:00
Jim Meyering
2f606bcf56 *** empty log message *** 1997-12-21 12:18:05 +00:00
Jim Meyering
1ed365fb82 Use PARAMS, not __P. 1997-12-21 12:17:26 +00:00
Jim Meyering
2b2fb0cf91 *** empty log message *** 1997-12-21 12:11:32 +00:00
Jim Meyering
76d9ec0ad0 increment serial number 1997-12-21 12:11:17 +00:00
Jim Meyering
32068e5812 increment serial number 1997-12-21 12:10:55 +00:00
Jim Meyering
90d217b19a increment serial number 1997-12-21 12:10:26 +00:00
Jim Meyering
726c48d02f Fix reversed types on -1 args to chown.
From Kaveh Ghazi.
1997-12-21 12:10:07 +00:00
Jim Meyering
1af374e6a4 . 1997-12-21 12:06:03 +00:00
Jim Meyering
9ef99e168b *** empty log message *** 1997-12-21 12:05:56 +00:00
Jim Meyering
bdcaa361bc Include exclude.h.
(exclude): New static var.
(long_options, usage, main): Add --exclude and --exclude-from or -X.
(count_entry): Skip excluded entries.
1997-12-21 12:05:42 +00:00
Jim Meyering
a1003f154f remove FIXME-describe comments 1997-12-21 11:57:17 +00:00
Jim Meyering
3ba71d6de1 add FIXME-describe comments 1997-12-21 11:56:34 +00:00
Jim Meyering
ac5fc8ea73 Include exclude.h.
(exclude): New static var.
(long_options, usage, main): Add --exclude and --exclude-from or -X.
(count_entry): Skip excluded entries.
1997-12-21 11:47:27 +00:00
Jim Meyering
a3e0b4392c (libfu_a_SOURCES): Add exclude.c.
(noinst_HEADERS): Add exclude.h.
1997-12-21 11:46:49 +00:00
Jim Meyering
cbd71d8eea . 1997-12-21 11:43:34 +00:00
Jim Meyering
a2c7ebd49c . 1997-12-21 11:24:53 +00:00
Jim Meyering
727298f3f5 Use PARAMS, not __P. 1997-12-21 11:22:51 +00:00
Jim Meyering
27d24b46ad (rpl_chown): Rename from chown.
Undefine chown just after including config.h.
Include sys/stat.h.
Use correct ordering of uid and gid parameters both in function
definition and in call to chown.
With patches from Kaveh Ghazi.
1997-12-21 11:17:20 +00:00
Jim Meyering
a2f0f9ac89 s/__P/PARAMS/g 1997-12-16 15:44:00 +00:00
Jim Meyering
ece81e9e4a *** empty log message *** 1997-12-16 15:43:01 +00:00
Jim Meyering
70618de21b s/__P/PARAMS/g. 1997-12-16 15:42:48 +00:00
Jim Meyering
589a3c2872 *** empty log message *** 1997-12-16 15:33:33 +00:00
Jim Meyering
03f9f3dbec s/__P/PARAMS/g 1997-12-16 15:32:32 +00:00
Jim Meyering
fc22546441 . 1997-12-16 15:16:20 +00:00
Jim Meyering
08b3d2975e *** empty log message *** 1997-12-16 15:13:06 +00:00
Jim Meyering
5d764734f7 tweak indentation 1997-12-16 15:11:23 +00:00
Jim Meyering
36665a7464 (struct bin_str): Make len int, not unsigned, to avoid
bogus comparison < 0.
(quote_filename): Add forward decl.
(decode_switches): -b, -e, -N, -Q are now mutually exclusive.
(print_dir): Quote directory name as per quoting options.
(print_long_format): Don't count color changes as part of file name.
(quote_filename): Revamp interface: now accepts stream to output to
and filename, and returns length of quoted filename.
This removes duplicated code and should make errors less likely.
Also, no longer mallocs storage.  All callers changed.
Don't quote ' ' if -Q.
(OUTCHAR): New macro.
(SAVECHAR, SAVE_2_CHARS): Remove.
(print_name_with_quoting): New stack arg.  All callers changed.
(print_color_indicator): Cast ext len to size_t to avoid warning
with GCC 2.8.
(length_of_file_name_and_frills): Rewrite to use quote_filename.
This fixes bug when computing file name length with -e.
1997-12-14  Paul Eggert  <eggert@twinsun.com>
Add shell style quoting, and make it the default.
* NEWS, doc/fileutils.texi: Describe -e, which is now the default.
Describe change to --dired output.
* src/ls.c (quote_shell): New var.
(long_options, decode_switches, usage): New option -e or --quote-shell.
(dired_dump_obstack): New arg STYLE.
(main): Pass quoting style to dired_dump_obstack.
(decode_switches): -N now clears quote_as_string.
(quote_filename): Add shell style quoting.
1997-12-16 15:09:19 +00:00
Jim Meyering
1ca40285b2 (deep): Remove `find > k' debugging remnant. 1997-12-15 11:35:22 +00:00
Jim Meyering
ce939d6f44 Make sure we get diagnostics in English. 1997-12-14 21:51:44 +00:00
90 changed files with 1605 additions and 793 deletions

2
THANKS
View File

@@ -28,7 +28,7 @@ Noel Cragg: noel@red-bean.com
Peter Eriksson: peter@ifm.liu.se
Paul Eggert: eggert@twinsun.com
Ross Ridge: rridge@calum.csclub.uwaterloo.ca
Santiago Vila Doncel: sanvila@ctv.es
Santiago Vila Doncel: sanvila@unex.es
Stuart Kemp: skemp@peter.bmc.com
Thomas Bushnell, n/BSG: thomas@gnu.ai.mit.edu
Torbjorn Lindgren: tl@funcom.no

View File

@@ -1,5 +1,5 @@
%% TeX macros to handle Texinfo files.
%% $Id: texinfo.tex,v 1.15 1997/07/14 18:15:50 meyering Exp $
%% $Id: texinfo.tex,v 1.16 1997/12/25 18:00:21 meyering Exp $
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
% 94, 95, 96, 97 Free Software Foundation, Inc.
@@ -36,7 +36,7 @@
% This automatically updates the version number based on RCS.
\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
\deftexinfoversion$Revision: 1.15 $
\deftexinfoversion$Revision: 1.16 $
\message{Loading texinfo package [Version \texinfoversion]:}
% If in a .fmt file, print the version number
@@ -441,14 +441,11 @@
% @. is an end-of-sentence period.
\def\.{.\spacefactor=3000 }
% @enddots{} is an end-of-sentence ellipsis.
\gdef\enddots{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$\spacefactor=3000}
% @! is an end-of-sentence bang.
\gdef\!{!\spacefactor=3000 }
\def\!{!\spacefactor=3000 }
% @? is an end-of-sentence query.
\gdef\?{?\spacefactor=3000 }
\def\?{?\spacefactor=3000 }
% @w prevents a word break. Without the \leavevmode, @w at the
% beginning of a paragraph, when TeX is still in vertical mode, would
@@ -573,9 +570,27 @@ where each line of input produces a line of output.}
\let\br = \par
% @dots{} output some dots
% @dots{} output an ellipsis using the current font.
% We do .5em per period so that it has the same spacing in a typewriter
% font as three actual period characters.
%
\def\dots{\hbox to 1.5em{%
\hskip 0pt plus 0.25fil minus 0.25fil
.\hss.\hss.%
\hskip 0pt plus 0.5fil minus 0.5fil
}}
% @enddots{} is an end-of-sentence ellipsis.
%
\def\enddots{%
\hbox to 2em{%
\hskip 0pt plus 0.25fil minus 0.25fil
.\hss.\hss.\hss.%
\hskip 0pt plus 0.5fil minus 0.5fil
}%
\spacefactor=3000
}
\def\dots{$\ldots$}
% @page forces the start of a new page
@@ -1236,7 +1251,7 @@ where each line of input produces a line of output.}
\let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
\let\tenttsl=\titlettsl
\resetmathfonts \setleading{25pt}}
\def\titlefont#1{{\titlefonts #1}}
\def\titlefont#1{{\titlefonts\rm #1}}
\def\chapfonts{%
\let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
\let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
@@ -1402,14 +1417,12 @@ where each line of input produces a line of output.}
\else{\tclose{\kbdfont\look}}\fi
\else{\tclose{\kbdfont\look}}\fi}
% @url, @email. Quotes do not seem necessary.
\let\url=\code % perhaps include a hypertex \special eventually
% rms does not like the angle brackets --karl, 17may97.
%\def\email#1{$\langle${\tt #1}$\rangle$}
\let\email=\code
% @url. Quotes do not seem necessary, so use \code.
\let\url=\code
% @uref (abbreviation for `urlref') takes an optional second argument
% specifying the text to display. First (mandatory) arg is the url.
% Perhaps eventually put in a hypertex \special here.
%
\def\uref#1{\urefxxx #1,,\finish}
\def\urefxxx#1,#2,#3\finish{%
@@ -1421,6 +1434,11 @@ where each line of input produces a line of output.}
\fi
}
% rms does not like the angle brackets --karl, 17may97.
% So now @email is just like @uref.
%\def\email#1{$\langle${\tt #1}$\rangle$}
\let\email=\uref
% Check if we are currently using a typewriter font. Since all the
% Computer Modern typewriter fonts have zero interword stretch (and
% shrink), and it is reasonable to expect all typewriter fonts to have
@@ -4614,7 +4632,7 @@ width0pt\relax} \fi
% Check for and read epsf.tex up front. If we read it only at @image
% time, we might be inside a group, and then its definitions would get
% undone and the next image would fail.
\openin 1 = xepsf.tex
\openin 1 = epsf.tex
\ifeof 1 \else
\closein 1
\def\epsfannounce{\toks0 = }% do not bother showing banner

View File

@@ -10,7 +10,8 @@ EXTRA_DIST = chown.c getgroups.c getline.c lstat.c malloc.c mktime.c \
INCLUDES = -I.. -I$(srcdir) -I../intl
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
addext.c argmatch.c backupfile.c basename.c dirname.c filemode.c \
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 \
@@ -19,7 +20,8 @@ xmalloc.c xstrdup.c xstrtol.c xstrtoul.c yesno.c
libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
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

View File

@@ -98,7 +98,8 @@ EXTRA_DIST = chown.c getgroups.c getline.c lstat.c malloc.c mktime.c \
INCLUDES = -I.. -I$(srcdir) -I../intl
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
addext.c argmatch.c backupfile.c basename.c dirname.c filemode.c \
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 \
@@ -107,7 +108,8 @@ xmalloc.c xstrdup.c xstrtol.c xstrtoul.c yesno.c
libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
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
@@ -125,11 +127,12 @@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
ANSI2KNR = ../src/ansi2knr
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 dirname$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
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
AR = ar
YLWRAP = $(srcdir)/ylwrap
CFLAGS = @CFLAGS@
@@ -151,22 +154,23 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP = --best
DEP_FILES = .deps/addext.P .deps/alloca.P .deps/argmatch.P \
.deps/backupfile.P .deps/basename.P .deps/chown.P .deps/dirname.P \
.deps/error.P .deps/euidaccess.P .deps/fileblocks.P .deps/filemode.P \
.deps/fnmatch.P .deps/fsusage.P .deps/ftruncate.P .deps/full-write.P \
.deps/getdate.P .deps/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/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
SOURCES = $(libfu_a_SOURCES)
OBJECTS = $(libfu_a_OBJECTS)
@@ -232,24 +236,50 @@ libfu.a: $(libfu_a_OBJECTS) $(libfu_a_DEPENDENCIES)
$(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS)
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)
$(ANSI2KNR) `if test -f $(srcdir)/alloca.c; then echo $(srcdir)/alloca.c; else echo alloca.c; fi` alloca_.c
argmatch_.c: argmatch.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/argmatch.c; then echo $(srcdir)/argmatch.c; else echo argmatch.c; fi` argmatch_.c
backupfile_.c: backupfile.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/backupfile.c; then echo $(srcdir)/backupfile.c; else echo backupfile.c; fi` backupfile_.c
basename_.c: basename.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/basename.c; then echo $(srcdir)/basename.c; else echo basename.c; fi` basename_.c
chown_.c: chown.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/chown.c; then echo $(srcdir)/chown.c; else echo chown.c; fi` chown_.c
closeout_.c: closeout.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/closeout.c; then echo $(srcdir)/closeout.c; else echo closeout.c; fi` closeout_.c
dirname_.c: dirname.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/dirname.c; then echo $(srcdir)/dirname.c; else echo dirname.c; fi` dirname_.c
error_.c: error.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/error.c; then echo $(srcdir)/error.c; else echo error.c; fi` error_.c
euidaccess_.c: euidaccess.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/euidaccess.c; then echo $(srcdir)/euidaccess.c; else echo euidaccess.c; fi` euidaccess_.c
exclude_.c: exclude.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/exclude.c; then echo $(srcdir)/exclude.c; else echo exclude.c; fi` exclude_.c
fileblocks_.c: fileblocks.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/fileblocks.c; then echo $(srcdir)/fileblocks.c; else echo fileblocks.c; fi` fileblocks_.c
filemode_.c: filemode.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/filemode.c; then echo $(srcdir)/filemode.c; else echo filemode.c; fi` filemode_.c
fnmatch_.c: fnmatch.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/fnmatch.c; then echo $(srcdir)/fnmatch.c; else echo fnmatch.c; fi` fnmatch_.c
fsusage_.c: fsusage.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/fsusage.c; then echo $(srcdir)/fsusage.c; else echo fsusage.c; fi` fsusage_.c
ftruncate_.c: ftruncate.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/ftruncate.c; then echo $(srcdir)/ftruncate.c; else echo ftruncate.c; fi` ftruncate_.c
full-write_.c: full-write.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/full-write.c; then echo $(srcdir)/full-write.c; else echo full-write.c; fi` full-write_.c
getdate_.c: getdate.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/getdate.c; then echo $(srcdir)/getdate.c; else echo getdate.c; fi` getdate_.c
getgroups_.c: getgroups.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/getgroups.c; then echo $(srcdir)/getgroups.c; else echo getgroups.c; fi` getgroups_.c
getline_.c: getline.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/getline.c; then echo $(srcdir)/getline.c; else echo getline.c; fi` getline_.c
getopt_.c: getopt.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` getopt_.c
getopt1_.c: getopt1.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` getopt1_.c
group-member_.c: group-member.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/group-member.c; then echo $(srcdir)/group-member.c; else echo group-member.c; fi` group-member_.c
hash_.c: hash.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/hash.c; then echo $(srcdir)/hash.c; else echo hash.c; fi` hash_.c
human_.c: human.c $(ANSI2KNR)
@@ -260,22 +290,72 @@ isdir_.c: isdir.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/isdir.c; then echo $(srcdir)/isdir.c; else echo isdir.c; fi` isdir_.c
long-options_.c: long-options.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/long-options.c; then echo $(srcdir)/long-options.c; else echo long-options.c; fi` long-options_.c
lstat_.c: lstat.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/lstat.c; then echo $(srcdir)/lstat.c; else echo lstat.c; fi` lstat_.c
makepath_.c: makepath.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/makepath.c; then echo $(srcdir)/makepath.c; else echo makepath.c; fi` makepath_.c
malloc_.c: malloc.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/malloc.c; then echo $(srcdir)/malloc.c; else echo malloc.c; fi` malloc_.c
memcmp_.c: memcmp.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/memcmp.c; then echo $(srcdir)/memcmp.c; else echo memcmp.c; fi` memcmp_.c
memcpy_.c: memcpy.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/memcpy.c; then echo $(srcdir)/memcpy.c; else echo memcpy.c; fi` memcpy_.c
memset_.c: memset.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/memset.c; then echo $(srcdir)/memset.c; else echo memset.c; fi` memset_.c
mkdir_.c: mkdir.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/mkdir.c; then echo $(srcdir)/mkdir.c; else echo mkdir.c; fi` mkdir_.c
mktime_.c: mktime.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/mktime.c; then echo $(srcdir)/mktime.c; else echo mktime.c; fi` mktime_.c
modechange_.c: modechange.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/modechange.c; then echo $(srcdir)/modechange.c; else echo modechange.c; fi` modechange_.c
mountlist_.c: mountlist.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/mountlist.c; then echo $(srcdir)/mountlist.c; else echo mountlist.c; fi` mountlist_.c
obstack_.c: obstack.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/obstack.c; then echo $(srcdir)/obstack.c; else echo obstack.c; fi` obstack_.c
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
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)
$(ANSI2KNR) `if test -f $(srcdir)/regex.c; then echo $(srcdir)/regex.c; else echo regex.c; fi` regex_.c
rename_.c: rename.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/rename.c; then echo $(srcdir)/rename.c; else echo rename.c; fi` rename_.c
rmdir_.c: rmdir.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/rmdir.c; then echo $(srcdir)/rmdir.c; else echo rmdir.c; fi` rmdir_.c
rpmatch_.c: rpmatch.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/rpmatch.c; then echo $(srcdir)/rpmatch.c; else echo rpmatch.c; fi` rpmatch_.c
rx_.c: rx.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/rx.c; then echo $(srcdir)/rx.c; else echo rx.c; fi` rx_.c
safe-read_.c: safe-read.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/safe-read.c; then echo $(srcdir)/safe-read.c; else echo safe-read.c; fi` safe-read_.c
save-cwd_.c: save-cwd.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/save-cwd.c; then echo $(srcdir)/save-cwd.c; else echo save-cwd.c; fi` save-cwd_.c
savedir_.c: savedir.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/savedir.c; then echo $(srcdir)/savedir.c; else echo savedir.c; fi` savedir_.c
stat_.c: stat.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/stat.c; then echo $(srcdir)/stat.c; else echo stat.c; fi` stat_.c
stpcpy_.c: stpcpy.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/stpcpy.c; then echo $(srcdir)/stpcpy.c; else echo stpcpy.c; fi` stpcpy_.c
strcasecmp_.c: strcasecmp.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strcasecmp.c; then echo $(srcdir)/strcasecmp.c; else echo strcasecmp.c; fi` strcasecmp_.c
strdup_.c: strdup.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strdup.c; then echo $(srcdir)/strdup.c; else echo strdup.c; fi` strdup_.c
strftime_.c: strftime.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strftime.c; then echo $(srcdir)/strftime.c; else echo strftime.c; fi` strftime_.c
stripslash_.c: stripslash.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/stripslash.c; then echo $(srcdir)/stripslash.c; else echo stripslash.c; fi` stripslash_.c
strndup_.c: strndup.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strndup.c; then echo $(srcdir)/strndup.c; else echo strndup.c; fi` strndup_.c
strstr_.c: strstr.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strstr.c; then echo $(srcdir)/strstr.c; else echo strstr.c; fi` strstr_.c
strtol_.c: strtol.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strtol.c; then echo $(srcdir)/strtol.c; else echo strtol.c; fi` strtol_.c
strtoul_.c: strtoul.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strtoul.c; then echo $(srcdir)/strtoul.c; else echo strtoul.c; fi` strtoul_.c
strverscmp_.c: strverscmp.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strverscmp.c; then echo $(srcdir)/strverscmp.c; else echo strverscmp.c; fi` strverscmp_.c
userspec_.c: userspec.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/userspec.c; then echo $(srcdir)/userspec.c; else echo userspec.c; fi` userspec_.c
xgetcwd_.c: xgetcwd.c $(ANSI2KNR)
@@ -290,11 +370,17 @@ xstrtoul_.c: xstrtoul.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/xstrtoul.c; then echo $(srcdir)/xstrtoul.c; else echo xstrtoul.c; fi` xstrtoul_.c
yesno_.c: yesno.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/yesno.c; then echo $(srcdir)/yesno.c; else echo yesno.c; fi` yesno_.c
addext_.o argmatch_.o backupfile_.o basename_.o dirname_.o filemode_.o \
full-write_.o getdate_.o getopt_.o getopt1_.o hash_.o human_.o \
idcache_.o isdir_.o long-options_.o makepath_.o modechange_.o \
path-concat_.o posixtm_.o safe-read_.o save-cwd_.o savedir_.o \
stripslash_.o userspec_.o xgetcwd_.o xmalloc_.o xstrdup_.o xstrtol_.o \
addext_.o alloca_.o argmatch_.o backupfile_.o basename_.o chown_.o \
closeout_.o dirname_.o error_.o euidaccess_.o exclude_.o fileblocks_.o \
filemode_.o fnmatch_.o fsusage_.o ftruncate_.o full-write_.o getdate_.o \
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)
tags: TAGS

View File

@@ -39,9 +39,7 @@
or -2 if it is ambiguous (is a prefix of more than one element). */
int
argmatch (arg, optlist)
const char *arg;
const char *const *optlist;
argmatch (const char *arg, const char *const *optlist)
{
int i; /* Temporary index in OPTLIST. */
size_t arglen; /* Length of ARG. */
@@ -78,15 +76,10 @@ argmatch (arg, optlist)
PROBLEM is the return value from argmatch. */
void
invalid_arg (kind, value, problem)
const char *kind;
const char *value;
int problem;
invalid_arg (const char *kind, const char *value, int problem)
{
fprintf (stderr, "%s: ", program_name);
if (problem == -1)
fprintf (stderr, "invalid");
else /* Assume -2. */
fprintf (stderr, "ambiguous");
fprintf (stderr, " %s `%s'\n", kind, value);
const char *fmt = (problem == -1
? "%s: invalid %s `%s'\n"
: "%s: ambiguous %s `%s'\n");
fprintf (stderr, fmt, program_name, kind, value);
}

View File

@@ -19,7 +19,14 @@
/* written by Jim Meyering */
#include <config.h>
/* Disable the definition of chown to rpl_chown (from config.h) in this
file. Otherwise, we'd get conflicting prototypes for rpl_chown on
most systems. */
#undef chown
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@@ -27,10 +34,10 @@
/* FIXME: describe. */
int
chown (file, gid, uid)
rpl_chown (file, uid, gid)
const char *file;
gid_t git;
uid_t uit;
uid_t uid;
gid_t gid;
{
if (gid == (gid_t) -1 || uid == (uid_t) -1)
{
@@ -47,7 +54,5 @@ chown (file, gid, uid)
uid = file_stats.st_uid;
}
#undef chown
return chown (file, gid, uid);
return chown (file, uid, gid);
}

60
lib/closeout.c Normal file
View File

@@ -0,0 +1,60 @@
/* closeout.c - close standard 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. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#if ENABLE_NLS
# include <libintl.h>
# define _(Text) gettext (Text)
#else
# define _(Text) Text
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifndef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#include <stdio.h>
#include "closeout.h"
#include "error.h"
/* Close standard output, exiting with status STATUS on failure. */
void
close_stdout_status (int status)
{
if (ferror (stdout))
error (status, 0, _("write error"));
if (fclose (stdout) != 0)
error (status, errno, _("write error"));
}
/* Close standard output, exiting with status EXIT_FAILURE on failure. */
void
close_stdout (void)
{
close_stdout_status (EXIT_FAILURE);
}

10
lib/closeout.h Normal file
View File

@@ -0,0 +1,10 @@
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
void close_stdout PARAMS ((void));
void close_stdout_status PARAMS ((int status));

127
lib/exclude.c Normal file
View File

@@ -0,0 +1,127 @@
/* exclude.c -- exclude file names
Copyright 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation,
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 <errno.h>
#ifndef errno
extern int errno;
#endif
#include <exclude.h>
#include <fnmatch.h>
#include <stdio.h>
#include <sys/types.h>
void *xmalloc PARAMS ((size_t));
void *xrealloc PARAMS ((void *, size_t));
/* Keep track of excluded file name patterns. */
struct exclude
{
char const **exclude;
int exclude_alloc;
int exclude_count;
};
struct exclude *
new_exclude (void)
{
struct exclude *ex = (struct exclude *) xmalloc (sizeof (struct exclude));
ex->exclude_count = 0;
ex->exclude_alloc = 64;
ex->exclude = (char const **) xmalloc (ex->exclude_alloc * sizeof (char *));
return ex;
}
int
excluded_filename (struct exclude const *ex, char const *f)
{
char const * const *exclude = ex->exclude;
int exclude_count = ex->exclude_count;
int i;
for (i = 0; i < exclude_count; i++)
if (fnmatch (exclude[i], f, 0) == 0)
return 1;
return 0;
}
void
add_exclude (struct exclude *ex, char const *pattern)
{
if (ex->exclude_alloc <= ex->exclude_count)
ex->exclude = (char const **) xrealloc (ex->exclude,
((ex->exclude_alloc *= 2)
* sizeof (char *)));
ex->exclude[ex->exclude_count++] = pattern;
}
int
add_exclude_file (struct exclude *ex, char const *filename, char line_end)
{
int use_stdin = filename[0] == '-' && !filename[1];
FILE *in;
char *buf;
char *p;
char const *pattern;
char const *lim;
size_t buf_alloc = 1024;
size_t buf_count = 0;
int c;
int e = 0;
if (use_stdin)
in = stdin;
else if (! (in = fopen (filename, "r")))
return -1;
buf = xmalloc (buf_alloc);
while ((c = getc (in)) != EOF)
{
buf[buf_count++] = c;
if (buf_count == buf_alloc)
buf = xrealloc (buf, buf_alloc *= 2);
}
buf = xrealloc (buf, buf_count + 1);
if (ferror (in))
e = errno;
if (!use_stdin && fclose (in) != 0)
e = errno;
for (pattern = p = buf, lim = buf + buf_count; p <= lim; p++)
if (p < lim ? *p == line_end : buf < p && p[-1])
{
*p = '\0';
add_exclude (ex, pattern);
pattern = p + 1;
}
errno = e;
return e ? -1 : 0;
}

34
lib/exclude.h Normal file
View File

@@ -0,0 +1,34 @@
/* exclude.h -- declarations for excluding file names
Copyright 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Paul Eggert <eggert@twinsun.com> */
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
struct exclude;
struct exclude *new_exclude PARAMS ((void));
void add_exclude PARAMS ((struct exclude *, char const *));
int add_exclude_file PARAMS ((struct exclude *, char const *, char));
int excluded_filename PARAMS ((struct exclude const *, char const *));

View File

@@ -1,5 +1,5 @@
/* fsusage.h -- declarations for filesystem space usage info
Copyright (C) 1991, 1992 Free Software Foundation, Inc.
Copyright (C) 1991, 1992, 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
@@ -16,6 +16,10 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Space usage statistics for a filesystem. Blocks are 512-byte. */
#if !defined FSUSAGE_H_
# define FSUSAGE_H_
struct fs_usage
{
int fsu_blocksize; /* Size of a block. */
@@ -26,13 +30,15 @@ struct fs_usage
uintmax_t fsu_ffree; /* Free file nodes. */
};
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
#define __P(args) args
#else
#define __P(args) ()
#endif /* GCC. */
#endif /* Not __P. */
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
int get_fs_usage __P ((const char *path, const char *disk,
struct fs_usage *fsp));
int get_fs_usage PARAMS ((const char *path, const char *disk,
struct fs_usage *fsp));
#endif

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
/* Copyright (C) 1995, 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
@@ -18,13 +18,13 @@
# include <config.h>
#endif
# ifndef PARAMS
# if defined (__GNUC__) || __STDC__
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
#endif
#if defined (vms)
# include <types.h>

View File

@@ -1,6 +1,6 @@
/* getline.c -- Replacement for GNU C library function getline
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
Copyright (C) 1993, 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
@@ -24,7 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* The `getdelim' function is only declared if the following symbol
is defined. */
#define _GNU_SOURCE 1
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
#include <stdio.h>
#include <sys/types.h>

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
/* Copyright (C) 1995, 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
@@ -20,10 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# include <stdio.h>
# ifndef PARAMS
# if defined (__GNUC__) || __STDC__
# define PARAMS(args) args
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(args) ()
# define PARAMS(Args) ()
# endif
# endif

View File

@@ -1,5 +1,5 @@
/* group-member.c -- determine whether group id is in calling user's group list
Copyright (C) 1994 Free Software Foundation, Inc.
Copyright (C) 1994, 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
@@ -44,15 +44,14 @@ struct group_info
#ifdef HAVE_GETGROUPS
static void
free_group_info (g)
struct group_info *g;
free_group_info (struct group_info *g)
{
free (g->group);
free (g);
}
static struct group_info *
get_group_info ()
get_group_info (void)
{
int n_groups;
int n_group_slots;
@@ -96,8 +95,7 @@ get_group_info ()
either of the current or effective group IDs. */
int
group_member (gid)
gid_t gid;
group_member (gid_t gid)
{
#ifndef HAVE_GETGROUPS
return ((gid == getgid ()) || (gid == getegid ()));

View File

@@ -1,7 +1,15 @@
#ifndef GROUP_MEMBER_H_
# define GROUP_MEMBER_H_ 1
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
int
group_member ();
group_member PARAMS ((gid_t));
#endif /* GROUP_MEMBER_H_ */

View File

@@ -5,14 +5,6 @@
# include <config.h>
# endif
# ifndef PARAMS
# if defined (__GNUC__) || __STDC__
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
# endif
# include <stdio.h>
# include <assert.h>
@@ -28,6 +20,14 @@ void free ();
char *malloc ();
# endif
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
# define USE_OBSTACK
# ifdef USE_OBSTACK
# include "obstack.h"

View File

@@ -7,14 +7,14 @@
# define LONGEST_HUMAN_READABLE ((sizeof (uintmax_t) + sizeof (int)) \
* CHAR_BIT / 3)
# ifndef __P
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
# define __P(args) args
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define __P(args) ()
# endif /* GCC. */
# endif /* Not __P. */
# define PARAMS(Args) ()
# endif
# endif
char *human_readable __P ((uintmax_t, char *, int, int, int));
char *human_readable PARAMS ((uintmax_t, char *, int, int, int));
#endif /* HUMAN_H_ */

View File

@@ -1,5 +1,5 @@
/* Utility to accept --help and --version options as unobtrusively as possible.
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
Copyright (C) 1993, 1994, 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
@@ -18,11 +18,12 @@
/* Written by Jim Meyering. */
#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif
#include <stdio.h>
#include <getopt.h>
#include "closeout.h"
#include "long-options.h"
static struct option const long_options[] =
@@ -62,6 +63,8 @@ parse_long_options (argc, argv, command_name, package, version, usage)
case 'v':
printf ("%s (%s) %s\n", command_name, package, version);
close_stdout (); /* FIXME: output failure exit status
should be settable via an arg. */
exit (0);
default:

View File

@@ -1,5 +1,5 @@
/* long-options.h -- declaration for --help- and --version-handling function.
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
Copyright (C) 1993, 1994, 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
@@ -17,11 +17,12 @@
/* Written by Jim Meyering. */
#undef PARAMS
#if defined (__STDC__) && __STDC__
# define PARAMS(Args) Args
#else
# define PARAMS(Args) ()
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
void

View File

@@ -71,6 +71,16 @@ extern int errno;
# endif
#endif
#ifndef S_IWUSR
# define S_IWUSR 0200
#endif
#ifndef S_IXUSR
# define S_IXUSR 0100
#endif
#define WX_USR (S_IWUSR | S_IXUSR)
#ifdef __MSDOS__
typedef int uid_t;
typedef int gid_t;
@@ -123,7 +133,6 @@ void strip_trailing_slashes ();
Return 0 if ARGPATH exists as a directory with the proper
ownership and permissions when done, otherwise 1. */
#if __STDC__
int
make_path (const char *argpath,
int mode,
@@ -132,18 +141,6 @@ make_path (const char *argpath,
gid_t group,
int preserve_existing,
const char *verbose_fmt_string)
#else
int
make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
verbose_fmt_string)
const char *argpath;
int mode;
int parent_mode;
uid_t owner;
gid_t group;
int preserve_existing;
const char *verbose_fmt_string;
#endif
{
struct stat stats;
int retval = 0;
@@ -175,8 +172,8 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
/* If leading directories shouldn't be writable or executable,
or should have set[ug]id or sticky bits set and we are setting
their owners, we need to fix their permissions after making them. */
if (((parent_mode & 0300) != 0300)
|| (owner != (uid_t) -1 && group != (gid_t) -1
if (((parent_mode & WX_USR) != WX_USR)
|| ((owner != (uid_t) -1 || group != (gid_t) -1)
&& (parent_mode & 07000) != 0))
{
tmp_mode = 0700;
@@ -245,7 +242,8 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
if (newly_created_dir && verbose_fmt_string != NULL)
fprintf (stderr, verbose_fmt_string, dirpath);
if (owner != (uid_t) -1 && group != (gid_t) -1
if (newly_created_dir
&& (owner != (uid_t) -1 || group != (gid_t) -1)
&& chown (basename_dir, owner, group)
#if defined(AFS) && defined (EPERM)
&& errno != EPERM
@@ -361,7 +359,7 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
On System V, users can give away files with chown and then not
be able to chmod them. So don't give files away. */
if (owner != (uid_t) -1 && group != (gid_t) -1
if ((owner != (uid_t) -1 || group != (gid_t) -1)
&& chown (dirpath, owner, group)
#ifdef AFS
&& errno != EPERM

View File

@@ -1,15 +1,16 @@
# undef __P
#if __STDC__
# define __P(Args) Args
#else
# define __P(Args) ()
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
int
make_path __P ((const char *_argpath,
int _mode,
int _parent_mode,
uid_t _owner,
gid_t _group,
int _preserve_existing,
const char *_verbose_fmt_string));
make_path PARAMS ((const char *_argpath,
int _mode,
int _parent_mode,
uid_t _owner,
gid_t _group,
int _preserve_existing,
const char *_verbose_fmt_string));

View File

@@ -17,14 +17,17 @@
/* Masks for the `flags' field in a `struct mode_change'. */
#if ! defined MODECHANGE_H_
# define MODECHANGE_H_
/* Affect the execute bits only if at least one execute bit is set already,
or if the file is a directory. */
#define MODE_X_IF_ANY_X 01
# define MODE_X_IF_ANY_X 01
/* If set, copy some existing permissions for u, g, or o onto the other two.
Which of u, g, or o is copied is determined by which bits are set in the
`value' field. */
#define MODE_COPY_EXISTING 02
# define MODE_COPY_EXISTING 02
struct mode_change
{
@@ -36,25 +39,27 @@ struct mode_change
};
/* Masks for mode_compile argument. */
#define MODE_MASK_EQUALS 1
#define MODE_MASK_PLUS 2
#define MODE_MASK_MINUS 4
#define MODE_MASK_ALL (MODE_MASK_EQUALS | MODE_MASK_PLUS | MODE_MASK_MINUS)
# define MODE_MASK_EQUALS 1
# define MODE_MASK_PLUS 2
# define MODE_MASK_MINUS 4
# define MODE_MASK_ALL (MODE_MASK_EQUALS | MODE_MASK_PLUS | MODE_MASK_MINUS)
/* Error return values for mode_compile. */
#define MODE_INVALID (struct mode_change *) 0
#define MODE_MEMORY_EXHAUSTED (struct mode_change *) 1
#define MODE_BAD_REFERENCE (struct mode_change *) 2
# define MODE_INVALID (struct mode_change *) 0
# define MODE_MEMORY_EXHAUSTED (struct mode_change *) 1
# define MODE_BAD_REFERENCE (struct mode_change *) 2
#ifndef __P
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
# define __P(Args) Args
# else
# define __P(Args) ()
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
#endif
struct mode_change *mode_compile __P ((const char *, unsigned));
struct mode_change *mode_create_from_ref __P ((const char *));
unsigned short mode_adjust __P ((unsigned, const struct mode_change *));
void mode_free __P ((struct mode_change *));
struct mode_change *mode_compile PARAMS ((const char *, unsigned));
struct mode_change *mode_create_from_ref PARAMS ((const char *));
unsigned short mode_adjust PARAMS ((unsigned, const struct mode_change *));
void mode_free PARAMS ((struct mode_change *));
#endif

View File

@@ -34,7 +34,9 @@ void free ();
# include <strings.h>
#endif
#ifndef strstr
char *strstr ();
#endif
char *xmalloc ();
char *xrealloc ();
char *xstrdup ();

View File

@@ -26,6 +26,9 @@
#endif
#include <stdio.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#include <sys/types.h>
char *malloc ();

View File

@@ -1,9 +1,15 @@
#if __STDC__
# undef __P
# define __P(args) args
#else
# define __P(args) ()
#endif
#if ! defined PATH_CONCAT_H_
# define PATH_CONCAT_H_
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
char *
path_concat __P ((const char *dir, const char *base, char **base_in_result));
path_concat PARAMS ((const char *dir, const char *base, char **base_in_result));
#endif

View File

@@ -45,7 +45,7 @@ extern int errno;
#include "save-cwd.h"
#include "error.h"
char *xgetcwd __P((void));
char *xgetcwd PARAMS ((void));
/* Record the location of the current working directory in CWD so that
the program may change to other directories and later use restore_cwd

View File

@@ -7,17 +7,17 @@ struct saved_cwd
char *name;
};
# ifndef __P
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
# define __P(args) args
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define __P(args) ()
# endif /* GCC. */
# endif /* Not __P. */
# define PARAMS(Args) ()
# endif
# endif
int save_cwd __P((struct saved_cwd *cwd));
int restore_cwd __P((const struct saved_cwd *cwd, const char *dest,
const char *from));
void free_cwd __P((struct saved_cwd *cwd));
int save_cwd PARAMS ((struct saved_cwd *cwd));
int restore_cwd PARAMS ((const struct saved_cwd *cwd, const char *dest,
const char *from));
void free_cwd PARAMS ((struct saved_cwd *cwd));
#endif /* SAVE_CWD_H */

View File

@@ -62,7 +62,9 @@ char *realloc ();
# define NULL 0
#endif
#ifndef stpcpy
char *stpcpy ();
#endif
#include "savedir.h"

View File

@@ -1,9 +1,15 @@
#undef __P
#if defined (__STDC__) && __STDC__
# define __P(x) x
#else
# define __P(x) ()
#endif
#if !defined SAVEDIR_H_
# define SAVEDIR_H_
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
char *
savedir __P((const char *dir, unsigned int name_size));
savedir PARAMS ((const char *dir, unsigned int name_size));
#endif

View File

@@ -8,10 +8,10 @@
# endif
# ifndef PARAMS
# if defined (__GNUC__) || __STDC__
# define PARAMS(args) args
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(args) ()
# define PARAMS(Args) ()
# endif
# endif

View File

@@ -1,8 +1,9 @@
#undef PARAMS
#if defined (__STDC__) && __STDC__
# define PARAMS(Args) Args
#else
# define PARAMS(Args) ()
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
/* Exit value when the requested amount of memory is not available.

View File

@@ -13,26 +13,27 @@
# define __ZLONG_MAX LONG_MAX
# endif
# undef PARAMS
# if defined (__STDC__) && __STDC__
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
#ifndef _STRTOL_ERROR
# ifndef _STRTOL_ERROR
enum strtol_error
{
LONGINT_OK, LONGINT_INVALID, LONGINT_INVALID_SUFFIX_CHAR, LONGINT_OVERFLOW
};
typedef enum strtol_error strtol_error;
#endif
# endif
strtol_error
__xstrtol PARAMS ((const char *s, char **ptr, int base,
__unsigned long int *val, const char *valid_suffixes));
#undef _STRTOL_ERROR
# undef _STRTOL_ERROR
# define _STRTOL_ERROR(Exit_code, Str, Argument_type_string, Err) \
do \
{ \

View File

@@ -1,3 +1,8 @@
1997-12-21 Jim Meyering <meyering@na-net.ornl.gov>
* chown.m4: Fix reversed types on -1 args to chown.
From Kaveh Ghazi.
1997-12-14 Jim Meyering <meyering@na-net.ornl.gov>
* check-decl.m4: s/DECLARATION_/DECL_/g.

View File

@@ -65,22 +65,17 @@ CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
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@
PACKAGE = @PACKAGE@
@@ -89,8 +84,6 @@ 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@

View File

@@ -1,4 +1,4 @@
#serial 1
#serial 2
dnl This is just a wrapper function to encapsulate this kludge.
dnl Putting it in a separate file like this helps share it between

View File

@@ -1,7 +1,7 @@
#serial 1
#serial 2
dnl From Jim Meyering.
dnl Determine whether chown accepts arguments of -1 for gid and uid.
dnl Determine whether chown accepts arguments of -1 for uid and gid.
dnl If it doesn't, arrange to use the replacement function.
dnl
dnl If you use this macro in a package, you should
@@ -28,7 +28,7 @@ AC_DEFUN(jm_FUNC_CHOWN,
char *f = "conftestchown";
if (creat (f, 0600) < 0)
exit (1);
exit (chown (f, (gid_t) -1, (uid_t) -1) == -1 ? 1 : 0);
exit (chown (f, (uid_t) -1, (gid_t) -1) == -1 ? 1 : 0);
}
],
jm_cv_func_working_chown=yes,

View File

@@ -1,4 +1,4 @@
#serial 1
#serial 2
AC_DEFUN(jm_CHECK_DECLARATION,
[

View File

@@ -1,10 +1,252 @@
1998-01-04 Jim Meyering <meyering@na-net.ornl.gov>
* Version 3.16j.
* lib/Makefile.in: Regenerated with patched automake-1.2d.
See README-alpha.
* src/chgrp.c: Use a single enumerated type, Verbosity, instead of
the two booleans, verbose and changes_only. This fixes a bug whereby
--change had the same effect as --verbose.
* src/chmod.c: Likewise.
* src/chown.c: Likewise.
Reported by Paul Eggert.
1998-01-04 Paul Eggert <eggert@twinsun.com>
Check for write errors more carefully.
* lib/Makefile.am (libfu_a_SOURCES): Add closeout.c.
(noinst_HEADERS): Add closeout.h.
* lib/closeout.c, lib/closeout.h: New files.
* lib/long-options.c (parse_long_options),
src/chgrp.c, src/chmod.c, src/chown.c, src/cp.c, src/dd.c,
src/df.c, src/dircolors.c, src/du.c, src/install.c, src/ln.c,
src/ls.c, src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c,
src/mvdir.c, src/rm.c, src/rmdir.c, src/sync.c, src/touch.c
(main, usage): Check for write error to stdout before exiting.
Include "closeout.h".
1998-01-03 Jim Meyering <meyering@na-net.ornl.gov>
* src/df.c (show_dev): Treat `fsu.fsu_bavail == (unsigned long) -1'
just like `fsu.fsu_blocks == 0' as an indicator that usage information
is invalid. This happens with Solaris-5.5.1 CD-ROM mount points.
* lib/save-cwd.h: Guard PARAMS-enabling definition with
`defined PROTOTYPES || (defined __STDC__ && __STDC__)' to avoid
problems with Irix4's cc. From Kaveh Ghazi.
* lib/getdate.h: Likewise, but just to be consistent.
* configure.in: Convert the .o suffix on files in LIBOBJS to $U.o so
those files will be built via the ANSI2KNR-filtering rules if necessary.
Reported by Kaveh Ghazi.
1998-01-02 Jim Meyering <meyering@na-net.ornl.gov>
* Version 3.16i.
Fix problem with `install -d'. Reported by Marty Leisner.
* src/install.c (get_ids): When otherwise unspecified,
set uid and gid to -1.
* lib/makepath.c (make_path): Try to change ownership only if we've
just created the directory. Fix latent bug (s/&&/||/ in two places --
also, note that it could not be exercised via install or mkdir)
whereby chown would not be invoked when only one of owner/group is
not -1.
1998-01-01 Jim Meyering <meyering@na-net.ornl.gov>
* src/rm.c (remove_cwd_entries): Initialize the entry-name obstack
only once and never free it.
1997-12-31 Paul Eggert <eggert@twinsun.com>
If the -h or -H options are given, print inode counts and
disk allocations using a human readable format.
* src/df.c (show_dev): Print inode counts human readably.
* src/ls.c (decode_switches): -h and -H override output units.
(print_dir, gobble_file, print_long_format,
print_file_name_and_frills): Print disk allocations human readably.
* doc/fileutils.texi: Document the above changes.
1997-12-31 Jim Meyering <meyering@na-net.ornl.gov>
* src/df.c (show_dev): Move declarations and computation of
blocks_used etc. and blocks_percent_used and
inodes_used etc. and inodes_percent_used into respective branches
of the `if (inode_format)' statement where they're actually used.
* lib/exclude.h: Define and use PARAMS, not __EXCLUDE_P.
* lib/exclude.c: Use PARAMS, not __EXCLUDE_P.
1997-12-29 Jim Meyering <meyering@na-net.ornl.gov>
* src/rm.c (remove_cwd_entries): Plug a gross leak -- don't call
obstack_init inside the loop.
* src/du.c (usage): Replace TABs with spaces in --help message.
From Santiago Vila.
* lib/argmatch.c (invalid_arg): Use a single fprintf and whole
format statements to ease translation.
From Santiago Vila.
Convert from K&R to ANSI function dcls.
1997-12-28 Jim Meyering <meyering@na-net.ornl.gov>
* lib/group-member.c: Use ANSI syntax, not K&R.
* lib/makepath.c (make_path) [!__STDC__]: Remove K&R-style definition.
* lib/group-member.h: Add PARAMS.
* src/chgrp.c: Remove incorrect declaration of group_member.
Include group-member.h instead.
Based on suggestion from Ulrich Drepper.
1997-12-27 Jim Meyering <meyering@na-net.ornl.gov>
* Version 3.16h.
1997-12-25 Jim Meyering <meyering@na-net.ornl.gov>
* lib/getline.c: (_GNU_SOURCE): Define only if not already defined.
* configure.in: Remove AC_DEFINE of _GNU_SOURCE.
* acconfig.h (_GNU_SOURCE): Define if not already defined.
Put this code in @TOP@ section.
(_GNU_SOURCE): Remove #undef.
1997-12-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* configure.in: Move jm_CHECK_DECLS down so that it follows the
checks for the headers it requires.
* doc/fileutils.texi (mknod invocation): Fix description of file
type mnemonics.
* src/sys2.h: Declare stpcpy only if not defined as macro.
* src/du.c (S_ISLNK): Define this instead of S_ISDIR.
* src/dd.c (skip): Compare lseek return value with -1 to allow it
to be negative as signed value.
* lib/savedir.c: Declare stpcpy only if not defined as macro.
* lib/mountlist.c: Likewise.
* lib/path-concat.c: Include <string.h> if available.
* src/copy.c (copy_internal): Use S_ISLNK only if defined.
* src/install.c (get_ids): Don't cast GID_T_MAX to long, it might
overflow.
1997-12-22 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in: AC_DEFINE _GNU_SOURCE.
* acconfig.h: Add _GNU_SOURCE.
1997-12-21 Jim Meyering <meyering@na-net.ornl.gov>
* src/copy.h: Use PARAMS, not __P.
* src/cp-hash.h: Likewise.
* lib/chown.c (rpl_chown): Rename from chown.
Undefine chown just after including config.h.
Include sys/stat.h.
Use correct ordering of uid and gid parameters both in function
definition and in call to chown.
With patches from Kaveh Ghazi.
* sys/fsusage.h: Use PARAMS, not __P.
* sys/getline.h: Likewise.
* sys/hash.h: Likewise.
* sys/human.h: Likewise.
* sys/long-options.h: Likewise.
* sys/makepath.h: Likewise.
* sys/modechange.h: Likewise.
* sys/path-concat.h: Likewise.
* sys/save-cwd.c: Likewise.
* sys/save-cwd.h: Likewise.
* sys/savedir.h: Likewise.
* sys/strverscmp.h: Likewise.
* sys/xalloc.h: Likewise.
* sys/xstrtol.h: Likewise.
1997-12-16 Paul Eggert <eggert@twinsun.com>
Add --exclude and --exclude-from or -X options to du.
* lib/exclude.h, lib/exclude.c: New files.
* lib/Makefile.am (libfu_a_SOURCES): Add exclude.c.
(noinst_HEADERS): Add exclude.h.
* du.c: Include exclude.h.
(exclude): New static var.
(long_options, usage, main): Add --exclude and --exclude-from or -X.
(count_entry): Skip excluded entries.
1997-12-16 Jim Meyering <meyering@na-net.ornl.gov>
* src/sys2.h: s/__P/PARAMS/g.
* src/chgrp.c: Likewise.
* src/chmod.c: Likewise.
* src/chown.c: Likewise.
* src/copy.c: Likewise.
* src/du.c: Likewise.
* src/dd.c: Likewise.
* src/install.c: Likewise.
* src/ls.c: Likewise.
1997-12-15 Paul Eggert <eggert@twinsun.com>
* ls.c (struct bin_str): Make len int, not unsigned, to avoid
bogus comparison < 0.
(quote_filename): Add forward decl.
(decode_switches): -b, -e, -N, -Q are now mutually exclusive.
(print_dir): Quote directory name as per quoting options.
(print_long_format): Don't count color changes as part of file name.
(quote_filename): Revamp interface: now accepts stream to output to
and filename, and returns length of quoted filename.
This removes duplicated code and should make errors less likely.
Also, no longer mallocs storage. All callers changed.
Don't quote ' ' if -Q.
(OUTCHAR): New macro.
(SAVECHAR, SAVE_2_CHARS): Remove.
(print_name_with_quoting): New stack arg. All callers changed.
(print_color_indicator): Cast ext len to size_t to avoid warning
with GCC 2.8.
(length_of_file_name_and_frills): Rewrite to use quote_filename.
This fixes bug when computing file name length with -e.
1997-12-15 Jim Meyering <meyering@na-net.ornl.gov>
* tests/rm/deep-1 (deep): Remove `find > k' debugging remnant.
1997-12-14 Paul Eggert <eggert@twinsun.com>
Add shell style quoting, and make it the default.
* NEWS, doc/fileutils.texi: Describe -e, which is now the default.
Describe change to --dired output.
* src/ls.c (quote_shell): New var.
(long_options, decode_switches, usage): New option -e or --quote-shell.
(dired_dump_obstack): New arg STYLE.
(main): Pass quoting style to dired_dump_obstack.
(decode_switches): -N now clears quote_as_string.
(quote_filename): Add shell style quoting.
1997-12-14 Jim Meyering <meyering@na-net.ornl.gov>
* tests/ln/sf-1: Make sure we get diagnostics in English.
* Version 3.16g.
* src/system.h: Remove lseek and memchr dcls.
* src/sys2.h: Put them here instead.
* Version 3.16g.
* src/rm.c (ASSIGN_STRDUPA): Cast alloca return value to char*.
* lib/hash.h: s/HAVE_DECLARATION_/HAVE_DECL_/.
@@ -929,8 +1171,8 @@ Fri Jan 31 21:13:04 1997 Jim Meyering <meyering@na-net.ornl.gov>
1997-01-27 Paul Eggert <eggert@twinsun.com>
* src/ls.c (print_long_format): Fix off-by-one problem in size
being passed to strftime.
* src/ls.c (print_long_format): Fix off-by-one problem in size
being passed to strftime.
Sun Jan 26 20:17:50 1997 Jim Meyering <meyering@na-net.ornl.gov>

View File

@@ -1,5 +1,9 @@
Changes in release 3.17:
[3.16g]
[3.16j]
* du accepts new options, --exclude=PAT and --exclude-from=FILE (-X FILE)
* ls now quotes file names for the shell by default, if they contain
characters that need quoting. Use -N to get the old default behavior.
The new behavior is also enabled by the new option -e or --quote-shell.
* ln --backup is now consistent with cp and mv in that --force is no longer
required when the destination is an existing non-directory.
* install accepts new option, --verbose (-v)
@@ -22,7 +26,8 @@ Changes in release 3.17:
* du accepts new option --max-depth=N
* rmdir accepts new options: --ignore-fail-on-non-empty and --verbose
* on most hosts df, du, and ls now overflow at 2**64 bytes, not 2**31 bytes
* all programs now work on large files on LFS hosts like Solaris 2.6
* all programs now work on large files on LFS systems like Solaris 2.6 and
Linux with the pre-2.1 development version of GNU libc.
* df now works with OpenBSD 2.1 beta
* cp -d FILE SYMLINK-TO-FILE doesn't erase FILE. Now it gives an error.

View File

@@ -1,3 +1,50 @@
1998-01-03 Jim Meyering <meyering@na-net.ornl.gov>
* lib/Makefile.am (AUTOMAKE_OPTIONS): Define to ../src/ansi2knr.
* configure.in: Convert the .o suffix on files in LIBOBJS to $U.o so
those files will be built via the ANSI2KNR-filtering rules if necessary.
1997-12-25 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in: Remove AC_DEFINE of _GNU_SOURCE.
* acconfig.h (_GNU_SOURCE): Define if not already defined.
Put this code in @TOP@ section.
(_GNU_SOURCE): Remove #undef.
1997-12-22 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in: AC_DEFINE _GNU_SOURCE.
* acconfig.h: Add _GNU_SOURCE.
1997-12-21 Jim Meyering <meyering@na-net.ornl.gov>
* src/date.c: s/__P/PARAMS/
* src/env.c: Likewise.
* src/expr.c: Likewise.
* src/id.c: Likewise.
* src/nice.c: Likewise.
* src/pathchk.c: Likewise.
* src/seq.c: Likewise.
* src/sleep.c: Likewise.
* src/stty.c: Likewise.
* src/tee.c: Likewise.
* src/test.c: Likewise.
* src/tty.c: Likewise.
* src/uname.c: Likewise.
* src/system.h: Merge in several things from fileutils' version of
this file.
* src/factor.c: Don't include limits.h.
(UINT_MAX): Don't define.
(INT_MAX): Don't define.
These are all done in system.h now.
* src/hostname.c: Don't include limits.h.
* src/id.c: Don't include limits.h or sys/param.h.
* src/pathchk.c: Don't include limits.h.
* src/su.c: Likewise.
1997-12-10 Jim Meyering <meyering@na-net.ornl.gov>
* src/su.c (main): Make sure pw->pw_shell is non-NULL before trying

View File

@@ -1,3 +1,45 @@
1998-01-03 Jim Meyering <meyering@na-net.ornl.gov>
* lib/Makefile.am (AUTOMAKE_OPTIONS): Define to ../src/ansi2knr.
* configure.in: Convert the .o suffix on files in LIBOBJS to $U.o so
those files will be built via the ANSI2KNR-filtering rules if necessary.
1997-12-25 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in: Remove AC_DEFINE of _GNU_SOURCE.
* acconfig.h (_GNU_SOURCE): Define if not already defined.
Put this code in @TOP@ section.
(_GNU_SOURCE): Remove #undef.
1997-12-22 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in: AC_DEFINE _GNU_SOURCE.
* acconfig.h: Add _GNU_SOURCE.
1997-12-21 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (AC_CHECK_HEADERS): Add stdlib.h.
* src/system.h: Merge in things from fileutils' version of this file.
* src/csplit.c: s/__P/PARAMS/.
* src/fmt.c: s/__P/PARAMS/.
* src/od.c: s/__P/PARAMS/.
* src/pr.c: s/__P/PARAMS/.
1997-12-14 Jim Meyering <meyering@na-net.ornl.gov>
* src/sys2.h: s/HAVE_DECLARATION_/HAVE_DECL_/g.
1997-12-13 Jim Meyering <meyering@na-net.ornl.gov>
* src/fmt.c (main): Add some braces.
Check return code from fclose of each input file.
Close stdout and check for errors.
* src/csplit.c (close_output_file): Check ferror before calling fclose.
(main): Close stdout and check for errors.
1997-11-15 Jim Meyering <meyering@na-net.ornl.gov>
* acconfig.h: Add mktime.

View File

@@ -1,5 +1,5 @@
/* chgrp -- change group ownership of files
Copyright (C) 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 89, 90, 91, 95, 96, 97, 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
@@ -25,8 +25,10 @@
#include "system.h"
#include "xstrtoul.h"
#include "closeout.h"
#include "error.h"
#include "savedir.h"
#include "group-member.h"
/* MAXUID may come from limits.h *or* sys/params.h (via system.h) above. */
#ifndef MAXUID
@@ -54,10 +56,20 @@ enum Change_status
CH_NO_CHANGE_REQUESTED
};
char *group_member ();
enum Verbosity
{
/* Print a message for each file that is processed. */
V_high,
static int change_dir_group __P ((const char *dir, int group,
const struct stat *statp));
/* Print a message for each file whose attributes we change. */
V_changes_only,
/* Do not be verbose. This is the default. */
V_off
};
static int change_dir_group PARAMS ((const char *dir, int group,
const struct stat *statp));
/* The name the program was run with. */
char *program_name;
@@ -72,11 +84,8 @@ static int recurse;
/* If nonzero, force silence (no error messages). */
static int force_silent;
/* If nonzero, describe the files we process. */
static int verbose;
/* If nonzero, describe only owners or groups that change. */
static int changes_only;
/* Level of verbosity. */
static enum Verbosity verbosity = V_off;
/* The name of the group to which ownership of the files is being given. */
static const char *groupname;
@@ -189,7 +198,7 @@ change_file_group (const char *file, int group)
else
fail = chown (file, (uid_t) -1, group);
if (verbose || (changes_only && !fail))
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
describe_change (file, (fail ? CH_FAILED : CH_SUCCEEDED));
if (fail)
@@ -216,7 +225,7 @@ change_file_group (const char *file, int group)
}
}
}
else if (verbose && changes_only == 0)
else if (verbosity == V_high)
{
describe_change (file, CH_NO_CHANGE_REQUESTED);
}
@@ -306,6 +315,7 @@ Change the group membership of each FILE to GROUP.\n\
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -322,7 +332,7 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
recurse = force_silent = verbose = changes_only = 0;
recurse = force_silent = 0;
while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, NULL)) != -1)
{
@@ -337,8 +347,7 @@ main (int argc, char **argv)
recurse = 1;
break;
case 'c':
verbose = 1;
changes_only = 1;
verbosity = V_changes_only;
break;
case 'f':
force_silent = 1;
@@ -347,7 +356,7 @@ main (int argc, char **argv)
change_symlinks = 1;
break;
case 'v':
verbose = 1;
verbosity = V_high;
break;
default:
usage (1);
@@ -357,6 +366,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("chgrp (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}
@@ -390,5 +400,7 @@ main (int argc, char **argv)
for (; optind < argc; ++optind)
errors |= change_file_group (argv[optind], group);
if (verbosity != V_off)
close_stdout ();
exit (errors);
}

View File

@@ -1,5 +1,5 @@
/* chmod -- change permission modes of files
Copyright (C) 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 89, 90, 91, 95, 96, 97, 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,6 +24,7 @@
#include "modechange.h"
#include "system.h"
#include "closeout.h"
#include "error.h"
#include "savedir.h"
@@ -34,12 +35,24 @@ enum Change_status
CH_NO_CHANGE_REQUESTED
};
enum Verbosity
{
/* Print a message for each file that is processed. */
V_high,
/* Print a message for each file whose attributes we change. */
V_changes_only,
/* Do not be verbose. This is the default. */
V_off
};
void mode_string ();
void strip_trailing_slashes ();
static int change_dir_mode __P ((const char *dir,
const struct mode_change *changes,
const struct stat *statp));
static int change_dir_mode PARAMS ((const char *dir,
const struct mode_change *changes,
const struct stat *statp));
/* The name the program was run with. */
char *program_name;
@@ -50,16 +63,13 @@ static int recurse;
/* If nonzero, force silence (no error messages). */
static int force_silent;
/* If nonzero, describe the modes we set. */
static int verbose;
/* Level of verbosity. */
static enum Verbosity verbosity = V_off;
/* The argument to the --reference option. Use the owner and group IDs
of this file. This file must exist. */
static char *reference_file;
/* If nonzero, describe only modes that change. */
static int changes_only;
/* If nonzero, display usage information and exit. */
static int show_help;
@@ -148,7 +158,7 @@ change_file_mode (const char *file, const struct mode_change *changes,
{
int fail = chmod (file, (int) newmode);
if (verbose || (changes_only && !fail))
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
describe_change (file, newmode, (fail ? CH_FAILED : CH_SUCCEEDED));
if (fail)
@@ -158,7 +168,7 @@ change_file_mode (const char *file, const struct mode_change *changes,
errors = 1;
}
}
else if (verbose && changes_only == 0)
else if (verbosity == V_high)
describe_change (file, newmode, CH_NO_CHANGE_REQUESTED);
if (recurse && S_ISDIR (file_stats.st_mode))
@@ -247,6 +257,7 @@ Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n\
one or more of the letters rwxXstugo.\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -268,7 +279,7 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
recurse = force_silent = verbose = changes_only = 0;
recurse = force_silent = 0;
while (1)
{
@@ -307,13 +318,13 @@ main (int argc, char **argv)
recurse = 1;
break;
case 'c':
changes_only = 1;
verbosity = V_changes_only;
break;
case 'f':
force_silent = 1;
break;
case 'v':
verbose = 1;
verbosity = V_high;
break;
default:
usage (1);
@@ -323,6 +334,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("chmod (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}
@@ -354,5 +366,7 @@ main (int argc, char **argv)
errors |= change_file_mode (argv[optind], changes, 1);
}
if (verbosity != V_off)
close_stdout ();
exit (errors);
}

View File

@@ -1,5 +1,5 @@
/* chown -- change user and group ownership of files
Copyright (C) 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 89, 90, 91, 95, 96, 97, 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
@@ -36,6 +36,7 @@
#include <getopt.h>
#include "system.h"
#include "closeout.h"
#include "error.h"
#include "savedir.h"
@@ -65,8 +66,20 @@ enum Change_status
CH_NO_CHANGE_REQUESTED
};
static int change_dir_owner __P ((const char *dir, uid_t user, gid_t group,
struct stat *statp));
enum Verbosity
{
/* Print a message for each file that is processed. */
V_high,
/* Print a message for each file whose attributes we change. */
V_changes_only,
/* Do not be verbose. This is the default. */
V_off
};
static int change_dir_owner PARAMS ((const char *dir, uid_t user, gid_t group,
struct stat *statp));
/* The name the program was run with. */
char *program_name;
@@ -81,11 +94,8 @@ static int recurse;
/* If nonzero, force silence (no error messages). */
static int force_silent;
/* If nonzero, describe the files we process. */
static int verbose;
/* If nonzero, describe only owners or groups that change. */
static int changes_only;
/* Level of verbosity. */
static enum Verbosity verbosity = V_off;
/* The name of the user to which ownership of the files is being given. */
static char *username;
@@ -175,7 +185,7 @@ change_file_owner (const char *file, uid_t user, gid_t group)
else
fail = chown (file, newuser, newgroup);
if (verbose || (changes_only && !fail))
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
describe_change (file, (fail ? CH_FAILED : CH_SUCCEEDED));
if (fail)
@@ -185,7 +195,7 @@ change_file_owner (const char *file, uid_t user, gid_t group)
errors = 1;
}
}
else if (verbose && changes_only == 0)
else if (verbosity == V_high)
{
describe_change (file, CH_NO_CHANGE_REQUESTED);
}
@@ -280,6 +290,7 @@ Owner is unchanged if missing. Group is unchanged if missing, but changed\n\
to login group if implied by a period. A colon may replace the period.\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -298,7 +309,7 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
recurse = force_silent = verbose = changes_only = 0;
recurse = force_silent = 0;
while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, NULL)) != -1)
{
@@ -313,8 +324,7 @@ main (int argc, char **argv)
recurse = 1;
break;
case 'c':
verbose = 1;
changes_only = 1;
verbosity = V_changes_only;
break;
case 'f':
force_silent = 1;
@@ -323,7 +333,7 @@ main (int argc, char **argv)
change_symlinks = 1;
break;
case 'v':
verbose = 1;
verbosity = V_high;
break;
default:
usage (1);
@@ -333,6 +343,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("chown (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}
@@ -379,5 +390,7 @@ main (int argc, char **argv)
errors |= change_file_owner (argv[optind], user, group);
}
if (verbosity != V_off)
close_stdout ();
exit (errors);
}

View File

@@ -39,10 +39,10 @@ int full_write ();
int euidaccess ();
int yesno ();
static int copy_internal __P ((const char *src_path, const char *dst_path,
int new_dst, dev_t device,
struct dir_list *ancestors,
const struct cp_options *x));
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));
/* The invocation name of this program. */
extern char *program_name;
@@ -366,6 +366,7 @@ copy_internal (const char *src_path, const char *dst_path,
same = (src_sb.st_ino == dst_sb.st_ino
&& src_sb.st_dev == dst_sb.st_dev);
#ifdef S_ISLNK
/* If we're preserving symlinks (--no-dereference) and the
destination file is a symlink, use stat (not xstat) to
see if it points back to the source. */
@@ -377,6 +378,7 @@ copy_internal (const char *src_path, const char *dst_path,
src_sb.st_dev == dst2_sb.st_dev))
same = 1;
}
#endif
if (same)
{

View File

@@ -86,7 +86,7 @@ struct cp_options
};
int
copy __P ((const char *src_path, const char *dst_path,
int nonexistent_dst, const struct cp_options *options));
copy PARAMS ((const char *src_path, const char *dst_path,
int nonexistent_dst, const struct cp_options *options));
#endif

View File

@@ -1,5 +1,5 @@
/* cp-hash.c -- file copying (hash search routines)
Copyright (C) 89, 90, 91, 95, 1996, 1997 Free Software Foundation.
Copyright (C) 89, 90, 91, 95, 96, 97, 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

View File

@@ -2,8 +2,8 @@
character identifies the inode as being new. */
extern char new_file;
void hash_init __P ((unsigned int modulus, unsigned int entry_tab_size));
void forget_all __P ((void));
char *hash_insert __P ((ino_t ino, dev_t dev, const char *node));
char *remember_copied __P ((const char *node, ino_t ino, dev_t dev));
int remember_created __P ((const char *path));
void hash_init PARAMS ((unsigned int modulus, unsigned int entry_tab_size));
void forget_all PARAMS ((void));
char *hash_insert PARAMS ((ino_t ino, dev_t dev, const char *node));
char *remember_copied PARAMS ((const char *node, ino_t ino, dev_t dev));
int remember_created PARAMS ((const char *path));

View File

@@ -1,5 +1,5 @@
/* cp.c -- file copying (main routines)
Copyright (C) 89, 90, 91, 95, 1996, 1997 Free Software Foundation.
Copyright (C) 89, 90, 91, 95, 96, 97, 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
@@ -33,6 +33,7 @@
#include "backupfile.h"
#include "argmatch.h"
#include "path-concat.h"
#include "closeout.h"
#include "cp-hash.h"
#include "copy.h"
#include "error.h"
@@ -176,6 +177,7 @@ options are given and SOURCE and DEST are the same name for an existing,\n\
regular file.\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -728,6 +730,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("cp (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}
@@ -760,5 +763,7 @@ main (int argc, char **argv)
exit_status |= do_copy (argc, argv, &x);
if (x.verbose)
close_stdout ();
exit (exit_status);
}

View File

@@ -137,11 +137,11 @@ struct buffer_record
int safe_read ();
static void close_output_file __P ((void));
static void create_output_file __P ((void));
static void delete_all_files __P ((void));
static void save_line_to_file __P ((const struct cstring *line));
static void usage __P ((int status));
static void close_output_file PARAMS ((void));
static void create_output_file PARAMS ((void));
static void delete_all_files PARAMS ((void));
static void save_line_to_file PARAMS ((const struct cstring *line));
static void usage PARAMS ((int status));
/* The name this program was run with. */
char *program_name;

View File

@@ -39,8 +39,8 @@ int stime ();
char *xstrdup ();
time_t posixtime ();
static void show_date __P ((const char *format, time_t when));
static void usage __P ((int status));
static void show_date PARAMS ((const char *format, time_t when));
static void usage PARAMS ((int status));
/* The name this program was run with, for error messages. */
char *program_name;

View File

@@ -1,5 +1,5 @@
/* dd -- convert a file while copying it.
Copyright (C) 85, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 85, 90, 91, 95, 96, 97, 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
@@ -31,6 +31,7 @@
#include "human.h"
#include "system.h"
#include "closeout.h"
#include "error.h"
#ifndef SIGINFO
@@ -64,22 +65,22 @@
int safe_read ();
int full_write ();
static RETSIGTYPE interrupt_handler __P ((int));
static int bit_count __P ((register unsigned int i));
static uintmax_t parse_integer __P ((char *str, int *));
static void apply_translations __P ((void));
static void copy __P ((void));
static void copy_simple __P ((unsigned char *buf, int nread));
static void copy_with_block __P ((unsigned char *buf, int nread));
static void copy_with_unblock __P ((unsigned char *buf, int nread));
static void parse_conversion __P ((char *str));
static void translate_charset __P ((const unsigned char *new_trans));
static void quit __P ((int code));
static void scanargs __P ((int argc, char **argv));
static void skip __P ((int fdesc, char *file, uintmax_t records,
static RETSIGTYPE interrupt_handler PARAMS ((int));
static int bit_count PARAMS ((register unsigned int i));
static uintmax_t parse_integer PARAMS ((char *str, int *));
static void apply_translations PARAMS ((void));
static void copy PARAMS ((void));
static void copy_simple PARAMS ((unsigned char *buf, int nread));
static void copy_with_block PARAMS ((unsigned char *buf, int nread));
static void copy_with_unblock PARAMS ((unsigned char *buf, int nread));
static void parse_conversion PARAMS ((char *str));
static void translate_charset PARAMS ((const unsigned char *new_trans));
static void quit PARAMS ((int code));
static void scanargs PARAMS ((int argc, char **argv));
static void skip PARAMS ((int fdesc, char *file, uintmax_t records,
size_t blocksize, unsigned char *buf));
static void usage __P ((int status));
static void write_output __P ((void));
static void usage PARAMS ((int status));
static void write_output PARAMS ((void));
/* The name this program was run with. */
char *program_name;
@@ -351,6 +352,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("dd (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}
@@ -431,7 +433,7 @@ skip (int fdesc, char *file, uintmax_t records, size_t blocksize,
operation, fall back on using read. */
o = records * blocksize;
if (o / blocksize != records
|| lseek (fdesc, o, SEEK_SET) < 0)
|| lseek (fdesc, o, SEEK_SET) == -1)
{
while (records-- > 0)
{
@@ -1137,6 +1139,7 @@ by w for x2, by b for x512, by k for x1024. Each KEYWORD may be:\n\
sync pad every input block with NULs to ibs-size\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}

View File

@@ -1,5 +1,5 @@
/* df - summarize free disk space
Copyright (C) 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 91, 95, 96, 97, 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
@@ -32,6 +32,7 @@
#include "fsusage.h"
#include "system.h"
#include "save-cwd.h"
#include "closeout.h"
#include "error.h"
#include "human.h"
@@ -195,10 +196,6 @@ static void
show_dev (const char *disk, const char *mount_point, const char *fstype)
{
struct fs_usage fsu;
uintmax_t blocks_used;
double blocks_percent_used;
uintmax_t inodes_used;
double inodes_percent_used;
const char *stat_file;
if (!selected_fstype (fstype) || excluded_fstype (fstype))
@@ -217,28 +214,8 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
return;
}
if (fsu.fsu_blocks == 0)
{
if (!show_all_fs && !show_listed_fs)
return;
blocks_used = fsu.fsu_bavail = blocks_percent_used = 0;
}
else
{
blocks_used = fsu.fsu_blocks - fsu.fsu_bfree;
blocks_percent_used =
blocks_used * 100.0 / (blocks_used + fsu.fsu_bavail);
}
if (fsu.fsu_files == 0)
{
inodes_used = fsu.fsu_ffree = inodes_percent_used = 0;
}
else
{
inodes_used = fsu.fsu_files - fsu.fsu_ffree;
inodes_percent_used = inodes_used * 100.0 / fsu.fsu_files;
}
if (fsu.fsu_blocks == 0 && !show_all_fs && !show_listed_fs)
return;
if (! disk)
disk = "-"; /* unknown */
@@ -255,16 +232,47 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
if (inode_format)
{
char buf[3][LONGEST_HUMAN_READABLE + 1];
double inodes_percent_used;
uintmax_t inodes_used;
if (fsu.fsu_files == 0)
{
inodes_used = 0;
fsu.fsu_ffree = 0;
inodes_percent_used = 0;
}
else
{
inodes_used = fsu.fsu_files - fsu.fsu_ffree;
inodes_percent_used = inodes_used * 100.0 / fsu.fsu_files;
}
printf (" %7s %7s %7s %5.0f%%",
human_readable (fsu.fsu_files, buf[0], 1, 1, 0),
human_readable (inodes_used, buf[1], 1, 1, 0),
human_readable (fsu.fsu_ffree, buf[2], 1, 1, 0),
human_readable (fsu.fsu_files, buf[0], 1, 1, human_readable_base),
human_readable (inodes_used, buf[1], 1, 1, human_readable_base),
human_readable (fsu.fsu_ffree, buf[2], 1, 1, human_readable_base),
inodes_percent_used);
}
else
{
int w = human_readable_base ? 5 : 7;
char buf[3][LONGEST_HUMAN_READABLE + 1];
double blocks_percent_used;
uintmax_t blocks_used;
if (fsu.fsu_blocks == 0 || fsu.fsu_bavail == (unsigned long) -1)
{
blocks_used = 0;
fsu.fsu_bavail = 0;
blocks_percent_used = 0;
}
else
{
blocks_used = fsu.fsu_blocks - fsu.fsu_bfree;
blocks_percent_used =
blocks_used * 100.0 / (blocks_used + fsu.fsu_bavail);
}
printf (" %*s %*s %*s %5.0f%% ",
w, human_readable (fsu.fsu_blocks, buf[0], fsu.fsu_blocksize,
output_units, human_readable_base),
@@ -511,6 +519,7 @@ or all filesystems by default.\n\
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -618,6 +627,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("df (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}
@@ -709,6 +719,7 @@ with the portable output format"));
show_entry (argv[i], &stats[i - optind]);
}
close_stdout ();
exit (exit_status);
}

View File

@@ -1,6 +1,6 @@
/* dircolors - output commands to set the LS_COLOR environment variable
Copyright (C) 1994, 1995, 1997 H. Peter Anvin
Copyright (C) 96, 1997 Free Software Foundation, Inc.
Copyright (C) 96, 97, 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
@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include "getline.h"
#include "long-options.h"
#include "closeout.h"
#include "error.h"
#include "obstack.h"
#include "dircolors.h"
@@ -114,6 +115,7 @@ file types and extensions. Otherwise, a precompiled database is used.\n\
For details on the format of these files, run `dircolors --print-database'.\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
@@ -516,8 +518,7 @@ dircolors' internal database"));
}
}
if (fclose (stdout) == EOF)
error (EXIT_FAILURE, errno, _("write error"));
close_stdout ();
if (have_read_stdin && fclose (stdin) == EOF)
error (EXIT_FAILURE, errno, _("standard input"));

View File

@@ -1,5 +1,5 @@
/* du -- summarize disk usage
Copyright (C) 88, 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 88, 89, 90, 91, 95, 96, 97, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,6 +34,8 @@
the sizes of subdirectories.
-D Dereference only symbolic links given on the command line.
-L Dereference all symbolic links.
--exclude=PAT Exclude files that match PAT.
-X FILE Exclude files that match patterns taken from FILE.
By tege@sics.se, Torbjorn Granlund,
and djm@ai.mit.edu, David MacKenzie.
@@ -49,8 +51,10 @@
#include <sys/types.h>
#include <assert.h>
#include "exclude.h"
#include "system.h"
#include "save-cwd.h"
#include "closeout.h"
#include "error.h"
#include "human.h"
#include "xstrtol.h"
@@ -100,18 +104,18 @@ typedef struct String String;
int stat ();
int lstat ();
static int hash_insert __P ((ino_t ino, dev_t dev));
static int hash_insert2 __P ((struct htab *_htab, ino_t ino, dev_t dev));
static uintmax_t count_entry __P ((const char *ent, int top, dev_t last_dev,
int depth));
static void du_files __P ((char **files));
static void hash_init __P ((unsigned int modulus,
unsigned int entry_tab_size));
static void hash_reset __P ((void));
static void str_concatc __P ((String *s1, char *cstr));
static void str_copyc __P ((String *s1, char *cstr));
static void str_init __P ((String **s1, unsigned int size));
static void str_trunc __P ((String *s1, unsigned int length));
static int hash_insert PARAMS ((ino_t ino, dev_t dev));
static int hash_insert2 PARAMS ((struct htab *_htab, ino_t ino, dev_t dev));
static uintmax_t count_entry PARAMS ((const char *ent, int top, dev_t last_dev,
int depth));
static void du_files PARAMS ((char **files));
static void hash_init PARAMS ((unsigned int modulus,
unsigned int entry_tab_size));
static void hash_reset PARAMS ((void));
static void str_concatc PARAMS ((String *s1, char *cstr));
static void str_copyc PARAMS ((String *s1, char *cstr));
static void str_init PARAMS ((String **s1, unsigned int size));
static void str_trunc PARAMS ((String *s1, unsigned int length));
/* Name under which this program was invoked. */
char *program_name;
@@ -167,6 +171,9 @@ static int show_help;
/* If nonzero, print the version on standard output and exit. */
static int show_version;
/* File name patterns to exclude. */
static struct exclude *exclude;
/* Grand total size of all args, in units of ST_NBLOCKSIZE-byte blocks. */
static uintmax_t tot_size = 0;
@@ -177,6 +184,8 @@ static struct option const long_options[] =
{"count-links", no_argument, &opt_count_all, 1},
{"dereference", no_argument, NULL, 'L'},
{"dereference-args", no_argument, &opt_dereference_arguments, 1},
{"exclude", required_argument, 0, 128},
{"exclude-from", required_argument, 0, 'X'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, 0, 'H'},
{"kilobytes", no_argument, NULL, 'k'},
@@ -220,14 +229,17 @@ Summarize disk usage of each FILE, recursively for directories.\n\
-S, --separate-dirs do not include size of subdirectories\n\
-s, --summarize display only a total for each argument\n\
-x, --one-file-system skip directories on different filesystems\n\
-X FILE, --exclude-from=FILE Exclude files that match any pattern in FILE.\n\
--exclude=PAT Exclude files that match PAT.\n\
--max-depth=N print the total for a directory (or file, with --all)\n\
only if it is N or fewer levels below the command\n\
line argument; --max-depth=0 is the same as\n\
only if it is N or fewer levels below the command\n\
line argument; --max-depth=0 is the same as\n\
--summarize\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -251,6 +263,7 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
exclude = new_exclude ();
xstat = lstat;
if (getenv ("POSIXLY_CORRECT"))
@@ -269,7 +282,7 @@ main (int argc, char **argv)
else
output_units = 1024;
while ((c = getopt_long (argc, argv, "abchHklmsxDLS", long_options, NULL))
while ((c = getopt_long (argc, argv, "abchHklmsxDLSX:", long_options, NULL))
!= -1)
{
long int tmp_long;
@@ -344,6 +357,15 @@ main (int argc, char **argv)
opt_separate_dirs = 1;
break;
case 'X':
if (add_exclude_file (exclude, optarg, '\n') != 0)
error (1, errno, "%s", optarg);
break;
case 128:
add_exclude (exclude, optarg);
break;
default:
usage (1, (char *) 0);
}
@@ -352,6 +374,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("du (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}
@@ -385,6 +408,7 @@ main (int argc, char **argv)
du_files (optind == argc ? cwd_only : argv + optind);
close_stdout ();
exit (exit_status);
}
@@ -510,8 +534,8 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
if (opt_one_file_system && !top && last_dev != dir_dev)
return 0; /* Don't enter a new file system. */
#ifndef S_ISDIR
# define S_ISDIR(s) 0
#ifndef S_ISLNK
# define S_ISLNK(s) 0
#endif
/* If we're dereferencing symlinks and we're about to chdir through
a symlink, remember the current directory so we can return to it
@@ -519,9 +543,8 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
through_symlink = (xstat == stat
&& lstat (ent, &e_buf) == 0
&& S_ISLNK (e_buf.st_mode));
if (through_symlink)
if (save_cwd (&cwd))
exit (1);
if (through_symlink && save_cwd (&cwd))
exit (1);
if (chdir (ent) < 0)
{
@@ -558,16 +581,16 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
str_concatc (path, "/");
pathlen = path->length;
namep = name_space;
while (*namep != 0)
for (namep = name_space; *namep; namep += strlen (namep) + 1)
{
str_concatc (path, namep);
size += count_entry (namep, 0, dir_dev, depth + 1);
str_trunc (path, pathlen);
namep += strlen (namep) + 1;
if (!excluded_filename (exclude, namep))
{
str_concatc (path, namep);
size += count_entry (namep, 0, dir_dev, depth + 1);
str_trunc (path, pathlen);
}
}
free (name_space);
if (through_symlink)
{
@@ -575,8 +598,10 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
free_cwd (&cwd);
}
else if (chdir ("..") < 0)
error (1, errno,
_("cannot change to `..' from directory %s"), path->text);
{
error (1, errno,
_("cannot change to `..' from directory %s"), path->text);
}
str_trunc (path, pathlen - 1); /* Remove the "/" we added. */
if (depth <= max_depth || top)
@@ -669,7 +694,7 @@ hash_insert (ino_t ino, dev_t dev)
htab_r->entry_tab = (struct entry *)
xrealloc ((char *) htab_r->entry_tab,
sizeof (struct entry) * entry_tab_size);
sizeof (struct entry) * entry_tab_size);
/* Increase the size of htab again. */
@@ -757,7 +782,7 @@ str_init (String **s1, unsigned int size)
}
static void
ensure_space (String * s, unsigned int size)
ensure_space (String *s, unsigned int size)
{
if (s->alloc < size)
{

View File

@@ -88,7 +88,7 @@
int putenv ();
static void usage __P ((int status));
static void usage PARAMS ((int status));
extern char **environ;

View File

@@ -31,9 +31,9 @@
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
#include <regex.h>
#include "system.h"
#include <regex.h>
#include "long-options.h"
#include "error.h"
@@ -72,18 +72,18 @@ char *program_name;
char *xstrdup ();
static VALUE *docolon __P ((VALUE *sv, VALUE *pv));
static VALUE *eval __P ((void));
static VALUE *int_value __P ((int i));
static VALUE *str_value __P ((char *s));
static int isstring __P ((VALUE *v));
static int nextarg __P ((char *str));
static int nomoreargs __P ((void));
static int null __P ((VALUE *v));
static int toarith __P ((VALUE *v));
static void freev __P ((VALUE *v));
static void printv __P ((VALUE *v));
static void tostring __P ((VALUE *v));
static VALUE *docolon PARAMS ((VALUE *sv, VALUE *pv));
static VALUE *eval PARAMS ((void));
static VALUE *int_value PARAMS ((int i));
static VALUE *str_value PARAMS ((char *s));
static int isstring PARAMS ((VALUE *v));
static int nextarg PARAMS ((char *str));
static int nomoreargs PARAMS ((void));
static int null PARAMS ((VALUE *v));
static int toarith PARAMS ((VALUE *v));
static void freev PARAMS ((VALUE *v));
static void printv PARAMS ((VALUE *v));
static void tostring PARAMS ((VALUE *v));
#ifdef EVAL_TRACE
static void trace ();

View File

@@ -25,18 +25,6 @@
#include <assert.h>
#define NDEBUG 1
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif /* HAVE_LIMITS_H */
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "system.h"
#include "long-options.h"
#include "error.h"

View File

@@ -155,23 +155,23 @@ struct Word
/* Forward declarations. */
static void set_prefix __P ((char *p));
static void fmt __P ((FILE *f));
static bool get_paragraph __P ((FILE *f));
static int get_line __P ((FILE *f, int c));
static int get_prefix __P ((FILE *f));
static int get_space __P ((FILE *f, int c));
static int copy_rest __P ((FILE *f, int c));
static bool same_para __P ((int c));
static void flush_paragraph __P ((void));
static void fmt_paragraph __P ((void));
static void check_punctuation __P ((WORD *w));
static COST base_cost __P ((WORD *this));
static COST line_cost __P ((WORD *next, int len));
static void put_paragraph __P ((WORD *finish));
static void put_line __P ((WORD *w, int indent));
static void put_word __P ((WORD *w));
static void put_space __P ((int space));
static void set_prefix PARAMS ((char *p));
static void fmt PARAMS ((FILE *f));
static bool get_paragraph PARAMS ((FILE *f));
static int get_line PARAMS ((FILE *f, int c));
static int get_prefix PARAMS ((FILE *f));
static int get_space PARAMS ((FILE *f, int c));
static int copy_rest PARAMS ((FILE *f, int c));
static bool same_para PARAMS ((int c));
static void flush_paragraph PARAMS ((void));
static void fmt_paragraph PARAMS ((void));
static void check_punctuation PARAMS ((WORD *w));
static COST base_cost PARAMS ((WORD *this));
static COST line_cost PARAMS ((WORD *next, int len));
static void put_paragraph PARAMS ((WORD *finish));
static void put_line PARAMS ((WORD *w, int indent));
static void put_word PARAMS ((WORD *w));
static void put_space PARAMS ((int space));
/* The name this program was run with. */
const char *program_name;

View File

@@ -27,7 +27,6 @@
#if !defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO) && \
defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)
# include <limits.h>
# include <sys/systeminfo.h>
int

View File

@@ -29,26 +29,22 @@
#include "system.h"
#include "error.h"
#ifdef _POSIX_VERSION
# include <limits.h>
#else /* not _POSIX_VERSION */
#ifndef _POSIX_VERSION
struct passwd *getpwuid ();
struct group *getgrgid ();
uid_t getuid ();
gid_t getgid ();
uid_t geteuid ();
gid_t getegid ();
# include <sys/param.h>
#endif /* not _POSIX_VERSION */
int getugroups ();
static void print_user __P ((int uid));
static void print_group __P ((int gid));
static void print_group_list __P ((char *username));
static void print_full_info __P ((char *username));
static void usage __P ((int status));
static void print_user PARAMS ((int uid));
static void print_group PARAMS ((int gid));
static void print_group_list PARAMS ((const char *username));
static void print_full_info PARAMS ((const char *username));
static void usage PARAMS ((int status));
/* The name this program was run with. */
char *program_name;
@@ -256,7 +252,7 @@ xgetgroups (const char *username, int *n_groups, GETGROUPS_T **groups)
/* Print all of the distinct groups the user is in. */
static void
print_group_list (char *username)
print_group_list (const char *username)
{
print_group (rgid);
if (egid != rgid)
@@ -291,7 +287,7 @@ print_group_list (char *username)
/* Print all of the info about the user's user and group IDs. */
static void
print_full_info (char *username)
print_full_info (const char *username)
{
struct passwd *pwd;
struct group *grp;

View File

@@ -1,5 +1,5 @@
/* install - copy files and set attributes
Copyright (C) 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 89, 90, 91, 95, 96, 97, 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
@@ -70,6 +70,7 @@
#include "backupfile.h"
#include "modechange.h"
#include "makepath.h"
#include "closeout.h"
#include "error.h"
#include "xstrtol.h"
@@ -117,14 +118,15 @@ int full_write ();
int isdir ();
enum backup_type get_version ();
static int change_timestamps __P ((const char *from, const char *to));
static int change_attributes __P ((const char *path, int no_need_to_chown));
static int copy_file __P ((const char *from, const char *to, int *to_created));
static int install_file_in_dir __P ((const char *from, const char *to_dir));
static int install_file_in_file __P ((const char *from, const char *to));
static void get_ids __P ((void));
static void strip __P ((const char *path));
static void usage __P ((int status));
static int change_timestamps PARAMS ((const char *from, const char *to));
static int change_attributes PARAMS ((const char *path, int no_need_to_chown));
static int copy_file PARAMS ((const char *from, const char *to,
int *to_created));
static int install_file_in_dir PARAMS ((const char *from, const char *to_dir));
static int install_file_in_file PARAMS ((const char *from, const char *to));
static void get_ids PARAMS ((void));
static void strip PARAMS ((const char *path));
static void usage PARAMS ((int status));
/* The name this program was run with, for error messages. */
char *program_name;
@@ -256,6 +258,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("install (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}
@@ -317,6 +320,8 @@ main (int argc, char **argv)
}
}
if (verbose)
close_stdout ();
exit (errors);
}
@@ -606,7 +611,7 @@ get_ids (void)
endpwent ();
}
else
owner_id = getuid ();
owner_id = (uid_t) -1;
if (group_name)
{
@@ -615,7 +620,7 @@ get_ids (void)
{
long int tmp_long;
if (xstrtol (group_name, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > (long) GID_T_MAX)
|| tmp_long < 0 || tmp_long > GID_T_MAX)
error (1, 0, _("invalid group `%s'"), group_name);
group_id = (gid_t) tmp_long;
}
@@ -624,7 +629,7 @@ get_ids (void)
endgrent ();
}
else
group_id = getgid ();
group_id = (gid_t) -1;
}
static void
@@ -671,6 +676,7 @@ version control may be set with VERSION_CONTROL, values are:\n\
never, simple always make simple backups\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}

View File

@@ -1,5 +1,5 @@
/* `ln' program to create links between files.
Copyright (C) 86, 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 86, 89, 90, 91, 95, 96, 97, 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
@@ -28,6 +28,7 @@
#include "system.h"
#include "backupfile.h"
#include "closeout.h"
#include "error.h"
int link (); /* Some systems don't declare this anywhere. */
@@ -353,6 +354,7 @@ version control may be set with VERSION_CONTROL, values are:\n\
never, simple always make simple backups\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -429,6 +431,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("ln (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}
@@ -499,5 +502,7 @@ main (int argc, char **argv)
errors += do_link (argv[optind], to);
}
if (verbose)
close_stdout ();
exit (errors != 0);
}

484
src/ls.c
View File

@@ -1,5 +1,5 @@
/* `dir', `vdir' and `ls' directory listing programs for GNU.
Copyright (C) 85, 88, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 85, 88, 90, 91, 95, 96, 97, 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
@@ -65,6 +65,7 @@
#include "obstack.h"
#include "ls.h"
#include "closeout.h"
#include "error.h"
#include "human.h"
#include "argmatch.h"
@@ -122,7 +123,7 @@ struct fileinfo
struct bin_str
{
unsigned int len; /* Number of bytes */
int len; /* Number of bytes */
char *string; /* Pointer to the same */
};
@@ -138,66 +139,69 @@ void strip_trailing_slashes ();
char *xstrdup ();
void invalid_arg ();
static char *make_link_path __P ((const char *path, const char *linkname));
static int compare_atime __P ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_atime __P ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_ctime __P ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_ctime __P ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_mtime __P ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_mtime __P ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_size __P ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_size __P ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_name __P ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_name __P ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_extension __P ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_extension __P ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_version __P ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_version __P ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int decode_switches __P ((int argc, char **argv));
static int file_interesting __P ((const struct dirent *next));
static uintmax_t gobble_file __P ((const char *name, int explicit_arg,
const char *dirname));
static int is_not_dot_or_dotdot __P ((const char *name));
static void print_color_indicator __P ((const char *name, unsigned int mode,
int linkok));
static void put_indicator __P ((const struct bin_str *ind));
static int length_of_file_name_and_frills __P ((const struct fileinfo *f));
static void add_ignore_pattern __P ((const char *pattern));
static void attach __P ((char *dest, const char *dirname, const char *name));
static void clear_files __P ((void));
static void extract_dirs_from_files __P ((const char *dirname, int recursive));
static void get_link_name __P ((const char *filename, struct fileinfo *f));
static void indent __P ((int from, int to));
static void init_col_info __P ((void));
static void print_current_files __P ((void));
static void print_dir __P ((const char *name, const char *realname));
static void print_file_name_and_frills __P ((const struct fileinfo *f));
static void print_horizontal __P ((void));
static void print_long_format __P ((const struct fileinfo *f));
static void print_many_per_line __P ((void));
static void print_name_with_quoting __P ((const char *p, unsigned int mode,
int linkok));
static void prep_non_filename_text __P ((void));
static void print_type_indicator __P ((unsigned int mode));
static void print_with_commas __P ((void));
static void queue_directory __P ((const char *name, const char *realname));
static void sort_files __P ((void));
static void parse_ls_color __P ((void));
static void usage __P ((int status));
static size_t quote_filename PARAMS ((FILE *out, const char *filename));
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));
static int rev_cmp_atime PARAMS ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_ctime PARAMS ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_ctime PARAMS ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_mtime PARAMS ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_mtime PARAMS ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_size PARAMS ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_size PARAMS ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_name PARAMS ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_name PARAMS ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_extension PARAMS ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_extension PARAMS ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int compare_version PARAMS ((const struct fileinfo *file1,
const struct fileinfo *file2));
static int rev_cmp_version PARAMS ((const struct fileinfo *file2,
const struct fileinfo *file1));
static int decode_switches PARAMS ((int argc, char **argv));
static int file_interesting PARAMS ((const struct dirent *next));
static uintmax_t gobble_file PARAMS ((const char *name, int explicit_arg,
const char *dirname));
static int is_not_dot_or_dotdot PARAMS ((const char *name));
static void print_color_indicator PARAMS ((const char *name, unsigned int mode,
int linkok));
static void put_indicator PARAMS ((const struct bin_str *ind));
static int length_of_file_name_and_frills PARAMS ((const struct fileinfo *f));
static void add_ignore_pattern PARAMS ((const char *pattern));
static void attach PARAMS ((char *dest, const char *dirname, const char *name));
static void clear_files PARAMS ((void));
static void extract_dirs_from_files PARAMS ((const char *dirname,
int recursive));
static void get_link_name PARAMS ((const char *filename, struct fileinfo *f));
static void indent PARAMS ((int from, int to));
static void init_col_info PARAMS ((void));
static void print_current_files PARAMS ((void));
static void print_dir PARAMS ((const char *name, const char *realname));
static void print_file_name_and_frills PARAMS ((const struct fileinfo *f));
static void print_horizontal PARAMS ((void));
static void print_long_format PARAMS ((const struct fileinfo *f));
static void print_many_per_line PARAMS ((void));
static void print_name_with_quoting PARAMS ((const char *p, unsigned int mode,
int linkok,
struct obstack *stack));
static void prep_non_filename_text PARAMS ((void));
static void print_type_indicator PARAMS ((unsigned int mode));
static void print_with_commas PARAMS ((void));
static void queue_directory PARAMS ((const char *name, const char *realname));
static void sort_files PARAMS ((void));
static void parse_ls_color PARAMS ((void));
static void usage PARAMS ((int status));
/* The name the program was run with, stripped of any leading path. */
char *program_name;
@@ -459,6 +463,10 @@ static int qmark_funny_chars;
static int quote_as_string;
/* Nonzero means use shell style quoting; it is also unambiguous. -e */
static int quote_shell;
/* The number of chars per hardware tab stop. Setting this to zero
inhibits the use of TAB characters for separating columns. -T */
static int tabsize;
@@ -517,6 +525,7 @@ static struct option const long_options[] =
{"dereference", no_argument, 0, 'L'},
{"literal", no_argument, 0, 'N'},
{"quote-name", no_argument, 0, 'Q'},
{"quote-shell", no_argument, 0, 'e'},
{"recursive", no_argument, 0, 'R'},
{"format", required_argument, 0, 12},
{"sort", required_argument, 0, 10},
@@ -642,11 +651,11 @@ static int max_idx;
#define MIN_COLUMN_WIDTH 3
/* Write to standard output the string PREFIX followed by a space-separated
list of the integers stored in OS all on one line. */
/* Write to standard output the strings PREFIX and STYLE, followed by
a space-separated list of the integers stored in OS all on one line. */
static void
dired_dump_obstack (const char *prefix, struct obstack *os)
dired_dump_obstack (const char *prefix, const char *style, struct obstack *os)
{
int n_pos;
@@ -658,6 +667,7 @@ dired_dump_obstack (const char *prefix, 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);
@@ -689,6 +699,7 @@ main (int argc, char **argv)
(ls_mode == LS_LS ? "ls"
: (ls_mode == LS_MULTI_COL ? "dir" : "vdir")),
GNU_PACKAGE, VERSION);
close_stdout ();
exit (EXIT_SUCCESS);
}
@@ -764,14 +775,15 @@ 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//", &dired_obstack);
dired_dump_obstack ("//SUBDIRED//", &subdired_obstack);
dired_dump_obstack ("//DIRED//", quoting_style, &dired_obstack);
dired_dump_obstack ("//SUBDIRED//", quoting_style, &subdired_obstack);
}
if (fclose (stdout) == EOF)
error (EXIT_FAILURE, errno, _("write error"));
/* Restore default color before exiting */
if (print_with_color)
{
@@ -779,6 +791,7 @@ main (int argc, char **argv)
put_indicator (&color_indicator[C_RIGHT]);
}
close_stdout ();
exit (exit_status);
}
@@ -846,6 +859,7 @@ decode_switches (int argc, char **argv)
really_all_files = 0;
ignore_patterns = 0;
quote_as_string = 0;
quote_shell = 1;
if ((p = getenv ("BLOCKSIZE"))
&& strncmp (p, "HUMAN", sizeof ("HUMAN") - 1) == 0)
@@ -897,7 +911,7 @@ decode_switches (int argc, char **argv)
}
while ((c = getopt_long (argc, argv,
"abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UX1",
"abcdefghiklmnopqrstuvw:xABCDFGHI:LNQRST:UX1",
long_options, NULL)) != -1)
{
switch (c)
@@ -912,6 +926,8 @@ decode_switches (int argc, char **argv)
case 'b':
quote_funny_chars = 1;
quote_as_string = 0;
quote_shell = 0;
qmark_funny_chars = 0;
break;
@@ -924,6 +940,13 @@ 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;
@@ -979,7 +1002,9 @@ decode_switches (int argc, char **argv)
case 'q':
qmark_funny_chars = 1;
quote_as_string = 0;
quote_funny_chars = 0;
quote_shell = 0;
break;
case 'r':
@@ -1048,13 +1073,16 @@ decode_switches (int argc, char **argv)
break;
case 'N':
quote_as_string = 0;
quote_funny_chars = 0;
quote_shell = 0;
qmark_funny_chars = 0;
break;
case 'Q':
quote_as_string = 1;
quote_funny_chars = 1;
quote_shell = 0;
qmark_funny_chars = 0;
break;
@@ -1151,6 +1179,9 @@ decode_switches (int argc, char **argv)
}
}
if (human_readable_base)
output_units = 1;
return optind;
}
@@ -1550,12 +1581,9 @@ print_dir (const char *name, const char *realname)
if (print_dir_name)
{
const char *dir;
DIRED_INDENT ();
dir = (realname ? realname : name);
PUSH_CURRENT_DIRED_POS (&subdired_obstack);
FPUTS (dir, stdout, strlen (dir));
dired_pos += quote_filename (stdout, realname ? realname : name);
PUSH_CURRENT_DIRED_POS (&subdired_obstack);
FPUTS_LITERAL (":\n", stdout);
}
@@ -1569,7 +1597,8 @@ print_dir (const char *name, const char *realname)
p = _("total");
FPUTS (p, stdout, strlen (p));
PUTCHAR (' ');
p = human_readable (total_blocks, buf, ST_NBLOCKSIZE, output_units, 0);
p = human_readable (total_blocks, buf, ST_NBLOCKSIZE, output_units,
human_readable_base);
FPUTS (p, stdout, strlen (p));
PUTCHAR ('\n');
}
@@ -1757,7 +1786,7 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
{
char buf[LONGEST_HUMAN_READABLE + 1];
int len = strlen (human_readable (blocks, buf, ST_NBLOCKSIZE,
output_units, 0));
output_units, human_readable_base));
if (block_size_size < len)
block_size_size = len < 7 ? len : 7;
}
@@ -2180,7 +2209,8 @@ print_long_format (const struct fileinfo *f)
char hbuf[LONGEST_HUMAN_READABLE + 1];
sprintf (p, "%*s ", block_size_size,
human_readable ((uintmax_t) ST_NBLOCKS (f->stat), hbuf,
ST_NBLOCKSIZE, output_units, 0));
ST_NBLOCKSIZE, output_units,
human_readable_base));
p += strlen (p);
}
@@ -2260,16 +2290,16 @@ print_long_format (const struct fileinfo *f)
DIRED_INDENT ();
FPUTS (buf, stdout, p - buf);
PUSH_CURRENT_DIRED_POS (&dired_obstack);
print_name_with_quoting (f->name, f->stat.st_mode, f->linkok);
PUSH_CURRENT_DIRED_POS (&dired_obstack);
print_name_with_quoting (f->name, f->stat.st_mode, f->linkok,
&dired_obstack);
if (f->filetype == symbolic_link)
{
if (f->linkname)
{
FPUTS_LITERAL (" -> ", stdout);
print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1);
print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1,
NULL);
if (indicator_style != none)
print_type_indicator (f->linkmode);
}
@@ -2278,164 +2308,151 @@ print_long_format (const struct fileinfo *f)
print_type_indicator (f->stat.st_mode);
}
/* Set QUOTED_LENGTH to strlen(P) and return NULL if P == quoted(P).
Otherwise, return xmalloc'd storage containing the quoted version
of P and set QUOTED_LENGTH to the length of the quoted P. */
/* If OUT is not null, output a quoted representation of the file name P.
Return the number of characters in P's quoted representation. */
static char *
quote_filename (register const char *p, size_t *quoted_length)
static size_t
quote_filename (register FILE *out, register const char *p)
{
register unsigned char c;
const char *p0 = p;
char *quoted, *q;
int found_quotable;
register size_t len;
#define OUTCHAR(c) do { len++; if (out) putc (c, out); } while (0)
if (!quote_as_string && !quote_funny_chars && !qmark_funny_chars)
if (quote_shell)
{
*quoted_length = strlen (p);
return NULL;
}
const char *p0 = p;
found_quotable = 0;
for (c = *p; c; c = *++p)
{
if (quote_funny_chars)
switch (*p)
{
switch (c)
{
case '\\':
case '\n':
case '\b':
case '\r':
case '\t':
case '\f':
case ' ':
found_quotable = 1;
break;
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;
}
default:
if (!ISGRAPH (c))
found_quotable = 1;
break;
}
}
else
/* Shell quoting is needed. */
p = p0;
len = 0;
OUTCHAR ('\'');
while ((c = *p++))
{
if (!ISPRINT (c) && qmark_funny_chars)
found_quotable = 1;
}
if (found_quotable)
break;
}
OUTCHAR (c);
if (!found_quotable && !quote_as_string)
{
*quoted_length = p - p0;
return NULL;
}
p = p0;
quoted = xmalloc (4 * strlen (p)
/* Add two (one for beginning and one for ending quote)
if --quote-name (-Q) was specified. */
+ (quote_as_string ? 2 : 0)
+ 1);
q = quoted;
#define SAVECHAR(c) *q++ = (c)
#define SAVE_2_CHARS(c12) \
do { *q++ = ((c12)[0]); \
*q++ = ((c12)[1]); } while (0)
if (quote_as_string)
SAVECHAR ('"');
while ((c = *p++))
{
if (quote_funny_chars)
{
switch (c)
if (c == '\'')
{
case '\\':
SAVE_2_CHARS ("\\\\");
break;
OUTCHAR ('\\');
OUTCHAR ('\'');
OUTCHAR ('\'');
}
}
case '\n':
SAVE_2_CHARS ("\\n");
break;
OUTCHAR ('\'');
}
else
{
len = 0;
case '\b':
SAVE_2_CHARS ("\\b");
break;
if (quote_as_string)
OUTCHAR ('"');
case '\r':
SAVE_2_CHARS ("\\r");
break;
case '\t':
SAVE_2_CHARS ("\\t");
break;
case '\f':
SAVE_2_CHARS ("\\f");
break;
case ' ':
SAVE_2_CHARS ("\\ ");
break;
case '"':
if (quote_as_string)
SAVECHAR ('\\');
SAVECHAR ('"');
break;
default:
if (ISGRAPH (c))
SAVECHAR (c);
else
while ((c = *p++))
{
if (quote_funny_chars)
{
switch (c)
{
char buf[5];
sprintf (buf, "\\%03o", (unsigned int) c);
q = stpcpy (q, buf);
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);
}
else
{
if (ISPRINT (c))
SAVECHAR (c);
else if (!qmark_funny_chars)
SAVECHAR (c);
else
SAVECHAR ('?');
}
if (quote_as_string)
OUTCHAR ('"');
}
if (quote_as_string)
SAVECHAR ('"');
*quoted_length = q - quoted;
SAVECHAR ('\0');
return quoted;
return len;
}
static void
print_name_with_quoting (const char *p, unsigned int mode, int linkok)
print_name_with_quoting (const char *p, unsigned int mode, int linkok,
struct obstack *stack)
{
char *quoted;
size_t quoted_length;
if (print_with_color)
print_color_indicator (p, mode, linkok);
quoted = quote_filename (p, &quoted_length);
FPUTS (quoted != NULL ? quoted : p, stdout, quoted_length);
if (quoted)
free (quoted);
if (stack)
PUSH_CURRENT_DIRED_POS (stack);
dired_pos += quote_filename (stdout, p);
if (stack)
PUSH_CURRENT_DIRED_POS (stack);
if (print_with_color)
prep_non_filename_text ();
@@ -2470,9 +2487,9 @@ print_file_name_and_frills (const struct fileinfo *f)
if (print_block_size)
printf ("%*s ", block_size_size,
human_readable ((uintmax_t) ST_NBLOCKS (f->stat), buf,
ST_NBLOCKSIZE, output_units, 0));
ST_NBLOCKSIZE, output_units, human_readable_base));
print_name_with_quoting (f->name, f->stat.st_mode, f->linkok);
print_name_with_quoting (f->name, f->stat.st_mode, f->linkok, NULL);
if (indicator_style != none)
print_type_indicator (f->stat.st_mode);
@@ -2562,7 +2579,7 @@ print_color_indicator (const char *name, unsigned int mode, int linkok)
name += len; /* Pointer to final \0. */
for (ext = col_ext_list; ext != NULL; ext = ext->next)
{
if (ext->ext.len <= len
if ((size_t) ext->ext.len <= len
&& strncmp (name - ext->ext.len, ext->ext.string,
ext->ext.len) == 0)
break;
@@ -2591,8 +2608,6 @@ put_indicator (const struct bin_str *ind)
static int
length_of_file_name_and_frills (const struct fileinfo *f)
{
register char *p = f->name;
register unsigned char c;
register int len = 0;
if (print_inode)
@@ -2601,42 +2616,7 @@ length_of_file_name_and_frills (const struct fileinfo *f)
if (print_block_size)
len += 1 + block_size_size;
if (quote_as_string)
len += 2;
while ((c = *p++))
{
if (quote_funny_chars)
{
switch (c)
{
case '\\':
case '\n':
case '\b':
case '\r':
case '\t':
case '\f':
case ' ':
len += 2;
break;
case '"':
if (quote_as_string)
len += 2;
else
len += 1;
break;
default:
if (ISPRINT (c))
len += 1;
else
len += 4;
}
}
else
len += 1;
}
len += quote_filename (0, f->name);
if (indicator_style != none)
{
@@ -2955,6 +2935,7 @@ 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\
--format=WORD across -x, commas -m, horizontal -x, long -l,\n\
@@ -3009,6 +2990,7 @@ optional WHEN argument is equivalent to using --color=always. With\n\
to a terminal (tty).\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}

View File

@@ -1,5 +1,5 @@
/* mkdir -- make directories
Copyright (C) 90, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 90, 95, 96, 97, 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
@@ -25,6 +25,7 @@
#include "system.h"
#include "modechange.h"
#include "makepath.h"
#include "closeout.h"
#include "error.h"
/* The name this program was run with. */
@@ -68,6 +69,7 @@ Create the DIRECTORY(ies), if they do not already exist.\n\
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -112,6 +114,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("mkdir (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}

View File

@@ -1,5 +1,5 @@
/* mkfifo -- make fifo's (named pipes)
Copyright (C) 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 90, 91, 95, 96, 97, 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
@@ -29,6 +29,7 @@
#include "system.h"
#include "modechange.h"
#include "closeout.h"
#include "error.h"
/* The name this program was run with. */
@@ -66,6 +67,7 @@ Create named pipes (FIFOs) with the given NAMEs.\n\
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -107,6 +109,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("mkfifo (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}

View File

@@ -1,5 +1,5 @@
/* mknod -- make special files
Copyright (C) 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 90, 91, 95, 96, 97, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@
#include "system.h"
#include "modechange.h"
#include "closeout.h"
#include "error.h"
#include "xstrtol.h"
@@ -77,6 +78,7 @@ MAJOR MINOR are forbidden for TYPE p, mandatory otherwise. TYPE may be:\n\
p create a FIFO\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -116,6 +118,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("mknod (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}

View File

@@ -1,5 +1,5 @@
/* mv -- move or rename files
Copyright (C) 86, 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 86, 89, 90, 91, 95, 96, 97, 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
@@ -49,6 +49,7 @@
#include "system.h"
#include "path-concat.h"
#include "backupfile.h"
#include "closeout.h"
#include "error.h"
#ifdef HAVE_LCHOWN
@@ -454,6 +455,7 @@ version control may be set with VERSION_CONTROL, values are:\n\
never, simple always make simple backups\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -517,6 +519,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("mv (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}
@@ -545,5 +548,7 @@ main (int argc, char **argv)
for (; optind < argc - 1; ++optind)
errors |= movefile (argv[optind], argv[argc - 1], dest_is_dir);
if (verbose)
close_stdout ();
exit (errors);
}

View File

@@ -40,8 +40,8 @@
# define GET_PRIORITY() getpriority (PRIO_PROCESS, 0)
#endif
static int isinteger __P ((char *s));
static void usage __P ((int status));
static int isinteger PARAMS ((char *s));
static void usage PARAMS ((int status));
/* The name this program was run with. */
char *program_name;

View File

@@ -225,7 +225,7 @@ static long int pseudo_offset;
/* Function to format an address and optionally an additional parenthesized
pseudo-address; it returns the formatted string. */
static const char *(*format_address) __P ((long unsigned int));
static const char *(*format_address) PARAMS ((long unsigned int));
/* The number of input bytes to skip before formatting and writing. */
static off_t n_bytes_to_skip = 0;

View File

@@ -47,7 +47,6 @@
#include "error.h"
#ifdef _POSIX_VERSION
# include <limits.h>
# ifndef PATH_MAX
# define PATH_MAX_FOR(p) pathconf ((p), _PC_PATH_MAX)
# endif /* not PATH_MAX */
@@ -92,8 +91,8 @@
char *xstrdup ();
static int validate_path __P ((char *path, int portability));
static void usage __P ((int status));
static int validate_path PARAMS ((char *path, int portability));
static void usage PARAMS ((int status));
/* The name this program was run with. */
char *program_name;

View File

@@ -271,33 +271,33 @@ typedef struct COLUMN COLUMN;
#define NULLCOL (COLUMN *)0
static int char_to_clump __P ((int c));
static int read_line __P ((COLUMN *p));
static int print_page __P ((void));
static int print_stored __P ((COLUMN *p));
static int open_file __P ((char *name, COLUMN *p));
static int skip_to_page __P ((int page));
static void print_header __P ((void));
static void pad_across_to __P ((int position));
static void add_line_number __P ((COLUMN *p));
static void getoptarg __P ((char *arg, char switch_char, char *character,
int *number));
static void usage __P ((int status));
static void print_files __P ((int number_of_files, char **av));
static void init_parameters __P ((int number_of_files));
static void init_header __P ((char *filename, int desc));
static void init_store_cols __P ((void));
static void store_columns __P ((void));
static void balance __P ((int total_stored));
static void store_char __P ((int c));
static void pad_down __P ((int lines));
static void read_rest_of_line __P ((COLUMN *p));
static void skip_read __P ((COLUMN *p, int column_number));
static void print_char __P ((int c));
static void cleanup __P ((void));
static void first_last_page __P ((char *pages));
static void print_sep_string __P ((void));
static void separator_string __P ((const char *optarg_S));
static int char_to_clump PARAMS ((int c));
static int read_line PARAMS ((COLUMN *p));
static int print_page PARAMS ((void));
static int print_stored PARAMS ((COLUMN *p));
static int open_file PARAMS ((char *name, COLUMN *p));
static int skip_to_page PARAMS ((int page));
static void print_header PARAMS ((void));
static void pad_across_to PARAMS ((int position));
static void add_line_number PARAMS ((COLUMN *p));
static void getoptarg PARAMS ((char *arg, char switch_char, char *character,
int *number));
static void usage PARAMS ((int status));
static void print_files PARAMS ((int number_of_files, char **av));
static void init_parameters PARAMS ((int number_of_files));
static void init_header PARAMS ((char *filename, int desc));
static void init_store_cols PARAMS ((void));
static void store_columns PARAMS ((void));
static void balance PARAMS ((int total_stored));
static void store_char PARAMS ((int c));
static void pad_down PARAMS ((int lines));
static void read_rest_of_line PARAMS ((COLUMN *p));
static void skip_read PARAMS ((COLUMN *p, int column_number));
static void print_char PARAMS ((int c));
static void cleanup PARAMS ((void));
static void first_last_page PARAMS ((char *pages));
static void print_sep_string PARAMS ((void));
static void separator_string PARAMS ((const char *optarg_S));
/* The name under which this program was invoked. */
char *program_name;

View File

@@ -1,5 +1,5 @@
/* `rm' file deletion utility for GNU.
Copyright (C) 88, 90, 91, 94, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 88, 90, 91, 94, 95, 96, 97, 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
@@ -51,6 +51,7 @@
#include "save-cwd.h"
#include "system.h"
#include "closeout.h"
#include "error.h"
#include "obstack.h"
#include "hash.h"
@@ -307,6 +308,7 @@ Remove (unlink) the FILE(s).\n\
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -529,10 +531,17 @@ remove_cwd_entries (void)
struct HT *ht = NULL;
/* FIXME: describe */
struct obstack entry_name_pool;
static struct obstack entry_name_pool;
static int first_call = 1;
enum RM_status status = RM_OK;
if (first_call)
{
first_call = 0;
obstack_init (&entry_name_pool);
}
if (dirp)
{
if (CLOSEDIR (dirp))
@@ -567,8 +576,6 @@ remove_cwd_entries (void)
enum RM_status tmp_status;
struct dirent *dp;
obstack_init (&entry_name_pool);
/* FILE should be skipped if it is `.' or `..', or if it is in
the table, HT, of entries we've already processed. */
#define SKIPPABLE(Ht, File) (DOT_OR_DOTDOT(File) \
@@ -593,8 +600,7 @@ remove_cwd_entries (void)
dp = readdir (dirp);
/* FIXME: add autoconf test to detect this. */
#ifndef HAVE_WORKING_READDIR
#if ! HAVE_WORKING_READDIR
if (dp == NULL)
{
/* Since we have probably modified the directory since it
@@ -675,7 +681,8 @@ remove_cwd_entries (void)
hash_free (ht);
}
obstack_free (&entry_name_pool, NULL);
if (obstack_object_size (&entry_name_pool) > 0)
obstack_free (&entry_name_pool, obstack_base (&entry_name_pool));
return status;
}
@@ -987,6 +994,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("rm (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}
@@ -1035,5 +1043,7 @@ main (int argc, char **argv)
hash_free (active_dir_map);
#endif
if (verbose)
close_stdout ();
exit (fail);
}

View File

@@ -1,5 +1,5 @@
/* rmdir -- remove directories
Copyright (C) 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 90, 91, 95, 96, 97, 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
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include "system.h"
#include "closeout.h"
#include "error.h"
void strip_trailing_slashes ();
@@ -126,6 +127,7 @@ Remove the DIRECTORY(ies), if they are empty.\n\
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -166,6 +168,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("rmdir (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}

View File

@@ -27,10 +27,10 @@
#include "error.h"
#include "xstrtod.h"
static double scan_double_arg __P ((const char *arg));
static int check_format __P ((const char *format_string));
static char *get_width_format __P ((void));
static int print_numbers __P ((const char *format_str));
static double scan_double_arg PARAMS ((const char *arg));
static int check_format PARAMS ((const char *format_string));
static char *get_width_format PARAMS ((void));
static int print_numbers PARAMS ((const char *format_str));
/* If nonzero print all number with equal width. */
static int equal_width;

View File

@@ -23,7 +23,7 @@
#include "system.h"
#include "error.h"
static long argdecode __P ((const char *s));
static long argdecode PARAMS ((const char *s));
/* The name by which this program was run. */
char *program_name;

View File

@@ -110,7 +110,7 @@ PREFIX is `x'. With no INPUT, or when INPUT is -, read standard input.\n\
-l, --lines=NUMBER put NUMBER lines per output file\n\
-NUMBER same as -l NUMBER\n\
--verbose print a diagnostic to standard error just\n\
before each output file is opened\n\
before each output file is opened\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\

View File

@@ -393,29 +393,29 @@ static struct control_info control_info[] =
{NULL, 0, 0}
};
static const char *visible __P ((unsigned int ch));
static unsigned long baud_to_value __P ((speed_t speed));
static int recover_mode __P ((char *arg, struct termios *mode));
static int screen_columns __P ((void));
static int set_mode __P ((struct mode_info *info, int reversed,
struct termios *mode));
static long integer_arg __P ((const char *s));
static speed_t string_to_baud __P ((const char *arg));
static tcflag_t *mode_type_flag __P ((enum mode_type type,
static const char *visible PARAMS ((unsigned int ch));
static unsigned long baud_to_value PARAMS ((speed_t speed));
static int recover_mode PARAMS ((char *arg, struct termios *mode));
static int screen_columns PARAMS ((void));
static int set_mode PARAMS ((struct mode_info *info, int reversed,
struct termios *mode));
static long integer_arg PARAMS ((const char *s));
static speed_t string_to_baud PARAMS ((const char *arg));
static tcflag_t *mode_type_flag PARAMS ((enum mode_type type,
struct termios *mode));
static void display_all PARAMS ((struct termios *mode));
static void display_changed PARAMS ((struct termios *mode));
static void display_recoverable PARAMS ((struct termios *mode));
static void display_settings PARAMS ((enum output_type output_type,
struct termios *mode));
static void display_all __P ((struct termios *mode));
static void display_changed __P ((struct termios *mode));
static void display_recoverable __P ((struct termios *mode));
static void display_settings __P ((enum output_type output_type,
struct termios *mode));
static void display_speed __P ((struct termios *mode, int fancy));
static void display_window_size __P ((int fancy));
static void sane_mode __P ((struct termios *mode));
static void set_control_char __P ((struct control_info *info, const char *arg,
struct termios *mode));
static void set_speed __P ((enum speed_setting type, const char *arg,
static void display_speed PARAMS ((struct termios *mode, int fancy));
static void display_window_size PARAMS ((int fancy));
static void sane_mode PARAMS ((struct termios *mode));
static void set_control_char PARAMS ((struct control_info *info, const char *arg,
struct termios *mode));
static void set_speed PARAMS ((enum speed_setting type, const char *arg,
struct termios *mode));
static void set_window_size __P ((int rows, int cols));
static void set_window_size PARAMS ((int rows, int cols));
/* The width of the screen, for output wrapping. */
static int max_col;

View File

@@ -93,9 +93,7 @@
# undef SYSLOG_NON_ROOT
#endif
#ifdef _POSIX_VERSION
# include <limits.h>
#else /* not _POSIX_VERSION */
#ifndef _POSIX_VERSION
struct passwd *getpwuid ();
struct group *getgrgid ();
uid_t getuid ();

View File

@@ -1,5 +1,5 @@
/* sync - update the super block
Copyright (C) 94, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 94, 95, 96, 97, 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
@@ -23,6 +23,7 @@
#include "system.h"
#include "long-options.h"
#include "closeout.h"
#include "error.h"
/* The name this program was run with. */
@@ -44,6 +45,7 @@ Force changed blocks to disk, update the super block.\n\
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}

View File

@@ -85,11 +85,11 @@ char *alloca ();
host does not conform to Posix. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#ifndef __P
#ifndef PARAMS
# if PROTOTYPES
# define __P(Args) Args
# define PARAMS(Args) Args
# else
# define __P(Args) ()
# define PARAMS(Args) ()
# endif
#endif
@@ -133,7 +133,9 @@ char *realloc ();
#endif
#ifndef HAVE_DECL_STPCPY
# ifndef stpcpy
char *stpcpy ();
# endif
#endif
#ifndef HAVE_DECL_STRSTR

View File

@@ -1,5 +1,5 @@
/* system-dependent definitions for fileutils, textutils, and sh-utils packages.
Copyright (C) 89, 91, 92, 93, 94, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 89, 91, 92, 93, 94, 96, 97, 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

View File

@@ -28,7 +28,7 @@
int full_write ();
static int tee __P ((int nfiles, const char **files));
static int tee PARAMS ((int nfiles, const char **files));
/* If nonzero, append to output files rather than truncating them. */
static int append;

View File

@@ -106,18 +106,18 @@ static int pos; /* The offset of the current argument in ARGV. */
static int argc; /* The number of arguments present in ARGV. */
static char **argv; /* The argument list. */
static int unop __P ((int op));
static int binop __P ((char *s));
static int unary_operator __P ((void));
static int binary_operator __P ((void));
static int two_arguments __P ((void));
static int three_arguments __P ((void));
static int posixtest __P ((void));
static int unop PARAMS ((int op));
static int binop PARAMS ((char *s));
static int unary_operator PARAMS ((void));
static int binary_operator PARAMS ((void));
static int two_arguments PARAMS ((void));
static int three_arguments PARAMS ((void));
static int posixtest PARAMS ((void));
static int expr __P ((void));
static int term __P ((void));
static int and __P ((void));
static int or __P ((void));
static int expr PARAMS ((void));
static int term PARAMS ((void));
static int and PARAMS ((void));
static int or PARAMS ((void));
#if __GNUC__ >= 2 && defined (__GNUC_MINOR__) \
&& __GNUC_MINOR__ >= 5 && !defined (__STRICT_ANSI__)
@@ -126,8 +126,8 @@ static int or __P ((void));
# define NO_RETURN_ATTRIBUTE /* empty */
#endif
static void test_syntax_error __P ((char *format, char *arg)) NO_RETURN_ATTRIBUTE;
static void beyond __P ((void)) NO_RETURN_ATTRIBUTE;
static void test_syntax_error PARAMS ((char *format, char *arg)) NO_RETURN_ATTRIBUTE;
static void beyond PARAMS ((void)) NO_RETURN_ATTRIBUTE;
static void
test_syntax_error (char *format, char *arg)

View File

@@ -1,5 +1,5 @@
/* touch -- change modification and access times of files
Copyright (C) 87, 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 87, 89, 90, 91, 95, 96, 97, 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
@@ -38,6 +38,7 @@
#include <sys/types.h>
#include "system.h"
#include "closeout.h"
#include "error.h"
#include "argmatch.h"
@@ -260,6 +261,7 @@ Update the access and modification times of each FILE to the current time.\n\
STAMP may be used without -t if none of -drt, nor --, are used.\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
}
exit (status);
}
@@ -340,6 +342,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("touch (%s) %s\n", GNU_PACKAGE, VERSION);
close_stdout ();
exit (0);
}

View File

@@ -30,7 +30,7 @@
#include "system.h"
#include "error.h"
static void usage __P ((int status));
static void usage PARAMS ((int status));
/* The name under which this program was run. */
char *program_name;

View File

@@ -41,8 +41,8 @@
#include "system.h"
#include "error.h"
static void print_element __P ((unsigned int mask, char *element));
static void usage __P ((int status));
static void print_element PARAMS ((unsigned int mask, char *element));
static void usage PARAMS ((int status));
/* Values that are bitwise or'd into `toprint'. */
/* Operating system name. */

View File

@@ -28,6 +28,14 @@ if test $test_failure = 1; then
exit 1
fi
# Make sure we get English translations.
LANGUAGE=C
export LANGUAGE
LC_ALL=C
export LC_ALL
LANG=C
export LANG
$LN -sf a b > err 2>&1 && fail=1
case `cat err` in
*'are the same file') ;;

View File

@@ -40,8 +40,6 @@ echo "creating a hierarchy 400 deep in $tmp..." |tr -d '\012'
$MKDIR -p $deep || fail=1
echo done
find $tmp > k
# Make sure the deep dir was created.
test -d $deep || fail=1