This commit was generated by cvs2svn to compensate for changes in r133543,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
tjr 2004-08-12 05:37:46 +00:00
commit fa48dfef0c
29 changed files with 3268 additions and 445 deletions

View File

@ -301,7 +301,7 @@ translation percentage of at least 50%.
+-------------------------------------------+
am az be bg ca cs da de el en en_GB eo es
0 0 8 3 37 38 56 73 15 1 5 12 64
et fa fi fr ga gl he hr hu id is it ja
+----------------------------------------+
a2ps | [] [] [] () |
@ -427,7 +427,7 @@ translation percentage of at least 50%.
+----------------------------------------+
et fa fi fr ga gl he hr hu id is it ja
21 1 25 86 24 24 8 10 38 31 1 23 32
ko lg lt lv ms nb nl nn no pl pt pt_BR ro
+-------------------------------------------+
a2ps | () [] [] () () [] [] |
@ -553,7 +553,7 @@ translation percentage of at least 50%.
+-------------------------------------------+
ko lg lt lv ms nb nl nn no pl pt pt_BR ro
12 0 1 2 12 10 60 4 4 38 25 35 76
ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW
+-------------------------------------------+
a2ps | [] [] [] [] [] | 16
@ -714,4 +714,3 @@ developed inside the GNU project. Therefore the information given above
applies also for every other Free Software Project. Contact
`translation@iro.umontreal.ca' to make the `.pot' files available to
the translation teams.

View File

@ -51,7 +51,7 @@ pinky: Joseph Arceneaux, David MacKenzie, and Kaveh Ghazi
pr: Pete TerMaat and Roland Huebner
printenv: David MacKenzie and Richard Mlynarik
printf: David MacKenzie
ptx: François Pinard
ptx: François Pinard
pwd: Jim Meyering
rm: Paul Rubin, David MacKenzie, Richard Stallman, and Jim Meyering
rmdir: David MacKenzie

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,190 @@
GNU coreutils NEWS -*- outline -*-
* Major changes in release 5.3.0 (2004-03-17) [unstable]
** Bug fixes
rm (without -f) no longer hangs when attempting to remove a symlink
to a file on an off-line NFS-mounted partition.
cut's --output-delimiter=D option works with abutting byte ranges.
rm no longer gets a failed assertion under some unusual conditions.
Several fixes to chgrp and chown for compatibility with POSIX and BSD:
Do not affect symbolic links by default.
Now, operate on whatever a symbolic points to, instead.
To get the old behavior, use --no-dereference (-h).
--dereference now works, even when the specified owner
and/or group match those of an affected symlink.
Check for incompatible options. When -R and --dereference are
both used, then either -H or -L must also be used. When -R and -h
are both used, then -P must be in effect.
-H, -L, and -P have no effect unless -R is also specified.
If -P and -R are both specified, -h is assumed.
Do not optimize away the chown() system call when the file's owner
and group already have the desired value. This optimization was
incorrect, as it failed to update the last-changed time and reset
special permission bits, as POSIX requires.
Do not report an error if the owner or group of a
recursively-encountered symbolic link cannot be updated because
the file system does not support it.
md5sum and sha1sum now report an error when given so many input
lines that their line counter overflows, instead of silently
reporting incorrect results.
rm no longer requires read access to the current directory.
"sort -o -" now writes to a file named "-" instead of to standard
output; POSIX requires this.
tail -f no longer mishandles pipes and fifos. With no operands,
tail now ignores -f if standard input is a pipe, as POSIX requires.
For some types of errors (e.g., read-only file system, I/O error)
when first encountering a directory, `rm -r' would mistakenly fail
to remove files under that directory.
If d/x is a directory and x a file, "ln x d/" now reports an error
instead of incorrectly creating a link to d/x/x.
Fixes for "nice":
If it fails to lower the nice value due to lack of permissions,
it goes ahead and runs the command anyway, as POSIX requires.
It no longer incorrectly reports an error if the current nice
value happens to be -1.
It no longer assumes that nice values range from -20 through 19.
It now consistently adjusts out-of-range nice values to the
closest values in range; formerly it sometimes reported an error.
ptx now diagnoses invalid values for its --width=N (-w)
and --gap-size=N (-g) options.
tee now exits when it gets a SIGPIPE signal, as POSIX requires.
To get tee's old behavior, use the shell command "(trap '' PIPE; tee)".
Also, "tee -" now writes to standard output instead of to a file named "-".
ls no longer segfaults on systems for which SIZE_MAX != (size_t) -1
echo now conforms to POSIX better. It supports the \0ooo syntax for
octal escapes, and \c now terminates printing immediately. If
POSIXLY_CORRECT is set and the first argument is not "-n", echo now
outputs all option-like arguments instead of treating them as options.
printf has several changes:
It now uses 'intmax_t' (not 'long int') to format integers, so it
can now format 64-bit integers on most modern hosts.
On modern hosts it now supports the C99-inspired %a, %A, %F conversion
specs, the "'" and "0" flags, and the ll, j, t, and z length modifiers
(this is compatible with recent Bash versions).
The printf command now rejects invalid conversion specifications
like %#d, instead of relying on undefined behavior in the underlying
printf function.
who now prints user names in full instead of truncating them after 8 bytes.
** New features
For efficiency, `sort -m' no longer copies input to a temporary file
merely because the input happens to come from a pipe. As a result,
some relatively-contrived examples like `cat F | sort -m -o F - G'
are no longer safe, as `sort' might start writing F before `cat' is
done reading it. This problem cannot occur unless `-m' is used.
When outside the default POSIX locale, the 'who' and 'pinky'
commands now output time stamps like "2004-06-21 13:09" instead of
the traditional "Jun 21 13:09".
pwd now works even when run from a working directory whose name
is longer than PATH_MAX.
cp, install, ln, and mv have a new --no-target-directory (-T) option,
and -t is now a short name for their --target-directory option.
cp -pu and mv -u (when copying) now don't bother to update the
destination if the resulting time stamp would be no newer than the
preexisting time stamp. This saves work in the common case when
copying or moving multiple times to the same destination in a file
system with a coarse time stamp resolution.
dd has new conversions for the conv= option:
nocreat do not create the output file
excl fail if the output file already exists
fdatasync physically write output file data before finishing
fsync likewise, but also write metadata
dd has new iflag= and oflag= options with the following flags:
append append mode (makes sense for output file only)
direct use direct I/O for data
dsync use synchronized I/O for data
sync likewise, but also for metadata
nonblock use non-blocking I/O
nofollow do not follow symlinks
stty now provides support (iutf8) for setting UTF-8 input mode.
With stat, a specified format is no longer automatically newline terminated.
If you want a newline at the end of your output, append `\n' to the format
string.
'df', 'du', and 'ls' now take the default block size from the
BLOCKSIZE environment variable if the BLOCK_SIZE, DF_BLOCK_SIZE,
DU_BLOCK_SIZE, and LS_BLOCK_SIZE environment variables are not set.
Unlike the other variables, though, BLOCKSIZE does not affect
values like 'ls -l' sizes that are normally displayed as bytes.
This new behavior is for compatibility with BSD.
du accepts a new option --files0-from=FILE, where FILE contains a
list of NUL-terminated file names.
`date -d' and `touch -d' now accept integer counts of seconds since
1970 when prefixed by `@'. For example, `@321' represents
1970-01-01 00:05:21 UTC.
`date -d', `date -f' and `touch -d' now handle fractional time
stamps like 2004-02-27 14:19:13.489392193.
`date' has a new option --iso-8601=ns that outputs
nanosecond-resolution time stamps.
echo -e '\xHH' now outputs a byte whose hexadecimal value is HH,
for compatibility with bash.
In the following cases POSIX allows the default GNU behavior,
so when POSIXLY_CORRECT is set:
false, printf, true, unlink, and yes all support --help and --option.
ls supports TABSIZE.
pr no longer depends on LC_TIME for the date format in non-POSIX locales.
printf supports \u, \U, \x.
tail supports two or more files when using the obsolete option syntax.
The usual `--' operand is now supported by chroot, hostid, hostname,
pwd, sync, and yes.
The stat option --filesystem has been renamed to --file-system, for
consistency with POSIX "file system" and with cp and du --one-file-system.
** Removed features
tail's undocumented --max-consecutive-size-changes option has been removed.
* Major changes in release 5.2.1 (2004-03-12) [stable]
** Bug fixes

View File

@ -34,16 +34,16 @@ file shouldn't affect how it operates, so that people can get the
behavior they want with whatever name they want.
Special thanks to Paul Eggert, Brian Matthews, Bruce Evans, Karl Berry,
Kaveh Ghazi, and François Pinard for help with debugging and porting
Kaveh Ghazi, and François Pinard for help with debugging and porting
these programs. Many thanks to all of the people who have taken the
time to submit problem reports and fixes. All contributed changes are
attributed in the ChangeLog file.
And thanks to the following people who have provided accounts for
portability testing on many different types of systems: Bob Proulx,
Christian Robert, François Pinard, Greg McGary, Harlan Stenn,
Christian Robert, François Pinard, Greg McGary, Harlan Stenn,
Joel N. Weber, Mark D. Roth, Matt Schalit, Nelson H. F. Beebe,
Réjean Payette, Sam Tardieu.
Réjean Payette, Sam Tardieu.
Thanks to Michael Stone for inflicting test releases of the fileutils
on Debian's unstable distribution, and to all the kind folks who used

View File

@ -3,7 +3,8 @@ textutils, and/or sh-utils packages). Some have reported problems, others
have contributed improvements to the documentation, actual code, and even
complete programs. Those contributions are described in the ChangeLog
files. If your name has been left out, if you'd rather not be listed,
or if you'd prefer a different address be used, please let me know.
or if you'd prefer a different address be used, please send a note to
the bug-report mailing list (as seen on last line of e.g., cp --help).
??? kytek@cybercomm.net
A Costa agcosta@gis.net
@ -32,11 +33,13 @@ Andrei Gaponenko andr@triumf.ca
Andres Soolo andres@soolo.matti.ee
Andrew Burgess aab@cichlid.com
Andrew Dalke dalke@bioreason.com
Andrew Fabbro andrew@fabbro.org
Andrew Pham andpha@us.ibm.com
Andrew Tridgell tridge@samba.org
Andrey Borzenkov arvidjaar@mail.ru
Andries Brouwer Andries.Brouwer@cwi.nl
Andy Longton alongton@metamark.com
Anthony Thyssen anthony@griffith.edu.au
Antonio Rendas ajrendas@yahoo.com
Ariel Faigon ariel@cthulhu.engr.sgi.com
Arne H. Juul arnej@solan.unit.no
@ -51,6 +54,7 @@ Axel Kittenberger Anshil@gmx.net
Bauke Jan Douma bjdouma@xs4all.nl
Ben Elliston bje@air.net.au
Ben Harris bjh21@netbsd.org
Benjamin Cutler cutlerbc@simla.colostate.edu
Bengt Martensson bengt@mathematik.uni-Bremen.de
Bernard Giroud bernard.giroud@creditlyonnais.ch
Bernd Leibing bernd.leibing@rz.uni-ulm.de
@ -98,7 +102,7 @@ Dan Hagerty hag@gnu.ai.it.edu
Dan Jacobson http://www.geocities.com/jidani
Dan Pascu dan@services.iiruc.ro
Daniel Bergstrom noa@melody.se
Dániel Varga danielv@axelero.hu
Dániel Varga danielv@axelero.hu
Danny Levinson danny.levinson@overture.com
Darren Salt ds@youmustbejoking.demon.co.uk
Dave Beckett dajobe@dajobe.org
@ -107,6 +111,7 @@ David Eisner cradle@umd.edu
David Flynn dav@chess.plus.com
David Godfrey dave@delta.demon.co.uk
David Luyer david_luyer@pacific.net.au
David Malone dwmalone@cnri.dit.ie
Deepak Goel deego@gnufans.org
Dennis Henriksen opus@flamingo.osrl.dk
Dennis Smit ds@nerds-incorporated.org
@ -138,14 +143,14 @@ Felix Lee flee@teleport.com
Ferdinand fw@scenic.mine.nu
Fletcher Mattox fletcher@cs.utexas.edu
Florin Iucha fiucha@hsys.mic.ro
François Pinard pinard@iro.umontreal.ca
François Pinard pinard@iro.umontreal.ca
Frank Adler fadler@allesklar.de
Frank T Lofaro ftlofaro@snooks.Egr.UNLV.EDU
Fred Fish fnf@ninemoons.com
Frédéric L. W. Meunier 0@pervalidus.net
Frédéric L. W. Meunier 0@pervalidus.net
Frederik Eaton frederik@caltech.edu
Gabor Z. Papp gzp@gzp.org.hu
Gaël Quéri gqueri@mail.dotcom.fr
Gaël Quéri gqueri@mail.dotcom.fr
Galen Hazelwood galenh@micron.net
Gary Anderson ganderson@clark.net
Gary V. Vaughan gary@gnu.org
@ -156,7 +161,7 @@ Geoff Odhner geoff@franklin.com
Geoff Whale geoffw@cse.unsw.EDU.AU
Gerhard Poul gpoul@gnu.org
Germano Leichsenring germano@jedi.cs.kobe-u.ac.jp
Göran Uddeborg goeran@uddeborg.pp.se
Göran Uddeborg goeran@uddeborg.pp.se
GOTO Masanori gotom@debian.or.jp
Greg Louis glouis@dynamicro.on.ca
Greg McGary gkm@gnu.org
@ -164,6 +169,7 @@ Greg Schafer gschafer@zip.com.au
Greg Troxel gdt@bbn.com
Greg Wooledge gawooledge@sherwin.com
Gregory Leblanc gleblanc@cu-portland.edu
Guido Leenders guido.leenders@invantive.com
H. J. Lu hjl@valinux.com
Hans Ginzel hans@matfyz.cz
Hans Lermen lermen@fgan.de
@ -197,7 +203,8 @@ Jeff Sheinberg jeff@bsrd.net
Jens Elkner elkner@imsgroup.de
Jens Schmidt jms@jsds.hamburg.com
Jerome Abela abela@hsc.fr
Jérôme Zago bug-coreutils-ml@agt-the-walker.net
Jérôme Zago bug-coreutils-ml@agt-the-walker.net
Jesse Kornblum kornblum@usna.edu
Jesse Thilo jgt2@eecs.lehigh.edu
Jie Xu xuj@iag.net
Jim Blandy jimb@cyclic.com
@ -216,12 +223,13 @@ John Murphy jam@philabs.research.philips.com
John Roll john@panic.harvard.edu
John Salmon johns@mullet.anu.edu.au
John Summerfield summer@OS2.ami.com.au
Jon Peatfield J.S.Peatfield@damtp.cam.ac.uk
Joost van Baal joostvb@xs4all.nl
Jorge Stolfi stolfi@ic.unicamp.br
Joseph S. Myers jsm28@cam.ac.uk
Juan F. Codagnone juam@arnet.com.ar
Jungshik Shin jshin@pantheon.yale.edu
Jürgen Fluk louis@dachau.marco.de
Jürgen Fluk louis@dachau.marco.de
Jurriaan thunder7@xs4all.nl
jvogel jvogel@linkny.com
Kai Henningsen kai@debian.org
@ -253,6 +261,7 @@ Maciej Kwapulinski pikpok@univ.gda.pl
Manas Garg manas@cygsoft.com
Manfred Hollstein manfred@s-direktnet.de
Marc Boucher marc@mbsi.ca
Marc Haber mh+debian-bugs@zugschlus.de
Marc Olzheim marcolz@stack.nl
Marco Franzen Marco.Franzen@Thyron.com
Marcus Brinkmann http://www.marcus-brinkmann.de
@ -260,6 +269,7 @@ Marcus Daniels marcus@ee.pdx.edu
Mark A. Thomas thommark@access.digex.net
Mark Conty Mark_Conty@cargill.com
Mark D. Roth roth@uiuc.edu
Mark Funkenhauser mfunkenhauser@rogers.com
Mark Harris mark@monitor.designacc.com
Mark Hewitt mhewitt@armature.com
Mark Hounschell markh@compro.net
@ -292,6 +302,7 @@ Matthias Urlichs smurf@noris.de
Matti Aarnio matti.aarnio@zmailer.org
Mattias Wadenstein maswan@acc.umu.se
Meelis Roos mroos@tartu.cyber.ee
Michael michael@aplatform.com
Michael ??? michael@roka.net
Michael Bacarella mbac@netgraft.com>
Michael Deutschmann michael@talamasca.ocis.net
@ -308,6 +319,7 @@ Michael Stutz stutz@dsl.org
Michael van Elst mlelstv@dev.de.cw.net
Michael Veksler mveksler@techunix.technion.ac.il
Michail Litvak mci@owl.openwall.com
Michal Politowski mpol@charybda.icm.edu.pl
Michal Svec msvec@suse.cz
Michel Robitaille robitail@IRO.UMontreal.CA
Michiel Bacchiani bacchian@raven.bu.edu
@ -315,6 +327,7 @@ Mike Castle dalgoda@ix.netcom.com
Mike Coleman mkc@mathdogs.com
Mike Jetzer mjetzer@mke.catalystwms.com
Mikko Tuumanen m@sorvankyla.yok.utu.fi
Mikulas Patocka mikulas@artax.karlin.mff.cuni.cz
Miles Bader miles@gnu.ai.mit.edu
Minh Tran-Le tranle@intellicorp.com
Morten Welinder terra@diku.dk
@ -331,7 +344,7 @@ Olatunji Oluwabukunmi Ruwase tjruwase@stanford.edu
Olav Morkrid olav@funcom.com
Ole Laursen olau@hardworking.dk
Oliver Kiddle okiddle@yahoo.co.uk
Ørn E. Hansen oehansen@daimi.aau.dk
Ørn E. Hansen oehansen@daimi.aau.dk
Oskar Liljeblad osk@hem.passagen.se
Patrick Mauritz oxygene@studentenbude.ath.cx
Paul Eggert eggert@twinsun.com
@ -361,7 +374,7 @@ Rainer Orth ro@TechFak.Uni-Bielefeld.DE
Ralf W. Stephan stephan@tmt.de
Ralph Loader loader@maths.ox.ac.uk
Raul Miller moth@magenta.com
Raúl Núñez de Arenas Coronado raul@pleyades.net
Raúl Núñez de Arenas Coronado raul@pleyades.net
Reuben Thomas rrt@sc3d.org
Richard A Downing richard.downing@bcs.org.uk
Richard Braakman dark@xs4all.nl
@ -376,7 +389,7 @@ Robert H. de Vries robert@and.nl
Robert Millan zeratul2@wanadoo.es
Rogier Wolff R.E.Wolff@BitWizard.nl
Roland Huebner ro-huebner@gmx.de
Roland Turner raz@raz.cx
Roland Turner raz.tah.bet@raz.cx
Ronald F. Guilmette rfg@netcom.com
Ross Alexander r.alexander@auckland.ac.nz
Ross Paterson rap@doc.ic.ac.uk
@ -392,7 +405,7 @@ Shing-Shong Shei shei@cs.indiana.edu
Soeren Sonnenburg sonnenburg@informatik.hu-berlin.de
Solar Designer solar@owl.openwall.com
Stanislav Ievlev inger@altlinux.ru
Stéphane Chazelas Stephane_CHAZELAS@yahoo.fr
Stéphane Chazelas Stephane_CHAZELAS@yahoo.fr
Stephen Depooter sbdep@myrealbox.com
Stephen Eglen eglen@pcg.wustl.edu
Stephen Gildea gildea@stop.mail-abuse.org
@ -419,6 +432,7 @@ Tom Haynes thomas@netapp.com
Tom Quinn trq@dionysos.thphys.ox.ac.uk
Tommi Kyntola tkyntola@cc.hut.fi
Ton Hospel thospel@mail.dma.be
Ton Nijkes ton@murphy.nl
Tony Kocurko akocurko@mun.ca
Tony Leneis tony@plaza.ds.adp.com
Tony Robinson ajr@eng.cam.ac.uk

View File

@ -47,10 +47,6 @@ seq: give better diagnostics for invalid formats:
e.g. no or too many % directives
seq: consider allowing format string to contain no %-directives
dd: consider adding an option to suppress `bytes/block read/written'
output to stderr. Suggested here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=165045
m4: rename all macros that start with AC_ to start with another prefix
resolve RH report on cp -a forwarded by Tim Waugh
@ -62,9 +58,6 @@ tail: don't use xlseek; it *exits*.
add mktemp? Suggested by Nelson Beebe
Now that AC_FUNC_LSTAT and AC_FUNC_STAT are in autoconf,
remove m4/stat.m4 and m4/lstat.m4.
df: alignment problem of `Used' heading with e.g., -mP
reported by Karl Berry
@ -136,9 +129,8 @@ Adapt these contribution guidelines for coreutils:
Changes expected to go in, post-5.2.1:
======================================
du and wc: add an option, --from0-file, to make them read NUL-delimited
wc: add an option, --files0-from [as for du] to make it read NUL-delimited
file name arguments from a file.
[I now have a patch adding --from0-file for du]
dd patch from Olivier Delhomme
@ -146,9 +138,6 @@ Changes expected to go in, post-5.2.1:
Apply Bruno Haible's hostname changes
stat: no longer output trailing newline for user-supplied FORMATs
This will mean adding \n to default formats, internally.
test/mv/*: clean up $other_partition_tmpdir in all cases
ls: when both -l and --dereference-command-line-symlink-to-dir are
@ -163,7 +152,20 @@ Changes expected to go in, post-5.2.1:
Re-add a separate test for du's stack space usage (like the one removed
from tests/rm/deep-1).
dd: consider adding an option to suppress `bytes/block read/written'
output to stderr. Suggested here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=165045
Pending copyright papers:
------------------------
ls --color: Ed Avis' patch to suppress escape sequences for
non-highlighted files
getpwnam from Bruce Korb
pb (progress bar) from Miika Pekkarinen
Look into improving the performance of md5sum.
`openssl md5' is consistently about 30% faster than md5sum on an idle
AMD 2000-XP system with plenty of RAM and a 261 MB input file.
openssl's md5 implementation is in assembly, generated by a perl script.

View File

@ -27,6 +27,7 @@
/* Specification. */
#include "argmatch.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -79,14 +80,14 @@ argmatch_exit_fn argmatch_die = __argmatch_die;
"no", "nope" -> 1
"y" is a valid argument, for `0', and "n" for `1'. */
int
ptrdiff_t
argmatch (const char *arg, const char *const *arglist,
const char *vallist, size_t valsize)
{
int i; /* Temporary index in ARGLIST. */
size_t i; /* Temporary index in ARGLIST. */
size_t arglen; /* Length of ARG. */
int matchind = -1; /* Index of first nonexact match. */
int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */
ptrdiff_t matchind = -1; /* Index of first nonexact match. */
bool ambiguous = false; /* If true, multiple nonexact match(es). */
arglen = strlen (arg);
@ -110,7 +111,7 @@ argmatch (const char *arg, const char *const *arglist,
{
/* There is a real ambiguity, or we could not
disambiguate. */
ambiguous = 1;
ambiguous = true;
}
}
}
@ -127,7 +128,7 @@ argmatch (const char *arg, const char *const *arglist,
PROBLEM is the return value from argmatch. */
void
argmatch_invalid (const char *context, const char *value, int problem)
argmatch_invalid (const char *context, const char *value, ptrdiff_t problem)
{
char const *format = (problem == -1
? _("invalid argument %s for %s")
@ -145,7 +146,7 @@ void
argmatch_valid (const char *const *arglist,
const char *vallist, size_t valsize)
{
int i;
size_t i;
const char *last_val = NULL;
/* We try to put synonyms on the same line. The assumption is that
@ -171,13 +172,13 @@ argmatch_valid (const char *const *arglist,
"--version-control", or "$VERSION_CONTROL" etc.). Upon failure,
calls the (supposed never to return) function EXIT_FN. */
int
ptrdiff_t
__xargmatch_internal (const char *context,
const char *arg, const char *const *arglist,
const char *vallist, size_t valsize,
argmatch_exit_fn exit_fn)
{
int res = argmatch (arg, arglist, vallist, valsize);
ptrdiff_t res = argmatch (arg, arglist, vallist, valsize);
if (res >= 0)
/* Success. */
return res;
@ -197,7 +198,7 @@ argmatch_to_argument (const char *value,
const char *const *arglist,
const char *vallist, size_t valsize)
{
int i;
size_t i;
for (i = 0; arglist[i]; i++)
if (!memcmp (value, vallist + valsize * i, valsize))

View File

@ -49,8 +49,8 @@
false ambiguities (i.e., different matches of ARG but corresponding
to the same values in VALLIST). */
int argmatch (char const *arg, char const *const *arglist,
char const *vallist, size_t valsize);
ptrdiff_t argmatch (char const *arg, char const *const *arglist,
char const *vallist, size_t valsize);
# define ARGMATCH(Arg, Arglist, Vallist) \
argmatch (Arg, Arglist, (char const *) (Vallist), sizeof *(Vallist))
@ -63,7 +63,8 @@ extern argmatch_exit_fn argmatch_die;
/* Report on stderr why argmatch failed. Report correct values. */
void argmatch_invalid (char const *context, char const *value, int problem);
void argmatch_invalid (char const *context, char const *value,
ptrdiff_t problem);
/* Left for compatibility with the old name invalid_arg */
@ -85,10 +86,10 @@ void argmatch_valid (char const *const *arglist,
/* Same as argmatch, but upon failure, reports a explanation on the
failure, and exits using the function EXIT_FN. */
int __xargmatch_internal (char const *context,
char const *arg, char const *const *arglist,
char const *vallist, size_t valsize,
argmatch_exit_fn exit_fn);
ptrdiff_t __xargmatch_internal (char const *context,
char const *arg, char const *const *arglist,
char const *vallist, size_t valsize,
argmatch_exit_fn exit_fn);
/* Programmer friendly interface to __xargmatch_internal. */

View File

@ -1,5 +1,7 @@
/* closeout.c - close standard output
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 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
@ -22,11 +24,7 @@
#include "closeout.h"
#include <stdio.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#include "gettext.h"
#define _(msgid) gettext (msgid)

View File

@ -1,6 +1,6 @@
/* Close standard output.
Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -19,7 +19,15 @@
#ifndef CLOSEOUT_H
# define CLOSEOUT_H 1
# ifdef __cplusplus
extern "C" {
# endif
void close_stdout_set_file_name (const char *file);
void close_stdout (void);
# ifdef __cplusplus
}
# endif
#endif

View File

@ -1,5 +1,5 @@
/* Invoke dup, but avoid some glitches.
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001, 2004 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
@ -22,9 +22,6 @@
#endif
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#if HAVE_FCNTL_H
# include <fcntl.h>

View File

@ -1,5 +1,5 @@
/* Error handler for noninteractive utilities
Copyright (C) 1990-1998, 2000-2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1990-1998, 2000-2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
@ -106,7 +106,7 @@ extern char *program_name;
static void
print_errno_message (int errnum)
{
char const *s;
char const *s = NULL;
#if defined HAVE_STRERROR_R || _LIBC
char errbuf[1024];
@ -115,15 +115,11 @@ print_errno_message (int errnum)
# else
if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
s = errbuf;
else
s = 0;
# endif
#else
s = strerror (errnum);
#endif
#if !_LIBC
if (! s)
if (! s && ! (s = strerror (errnum)))
s = _("Unknown system error");
#endif

View File

@ -1,5 +1,5 @@
/* Invoke fopen, but avoid some glitches.
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001, 2004 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,10 +31,6 @@
#endif
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#include <stdio.h>
#include <stdio-safer.h>

View File

@ -1,6 +1,6 @@
/* Determine whether a locale is hard.
Copyright (C) 1999, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -19,6 +19,8 @@
#ifndef HARD_LOCALE_H_
# define HARD_LOCALE_H_ 1
int hard_locale (int);
# include <stdbool.h>
bool hard_locale (int);
#endif /* HARD_LOCALE_H_ */

View File

@ -1,7 +1,7 @@
/* human.c -- print human readable file size
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free
Software Foundation, Inc.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
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
@ -300,8 +300,8 @@ human_readable (uintmax_t n, char *buf, int opts,
{
do
{
unsigned r10 = (amt % base) * 10 + tenths;
unsigned r2 = (r10 % base) * 2 + (rounding >> 1);
unsigned int r10 = (amt % base) * 10 + tenths;
unsigned int r2 = (r10 % base) * 2 + (rounding >> 1);
amt /= base;
tenths = r10 / base;
rounding = (r2 < base
@ -428,7 +428,9 @@ humblock (char const *spec, uintmax_t *block_size, int *options)
int i;
int opts = 0;
if (! spec && ! (spec = getenv ("BLOCK_SIZE")))
if (! spec
&& ! (spec = getenv ("BLOCK_SIZE"))
&& ! (spec = getenv ("BLOCKSIZE")))
*block_size = default_block_size ();
else
{

View File

@ -1,7 +1,7 @@
/* human.h -- print human readable file size
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free
Software Foundation, Inc.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
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,12 +29,11 @@
# include <limits.h>
# include <stdbool.h>
# if HAVE_INTTYPES_H
# include <inttypes.h>
# else
# if HAVE_STDINT_H
# include <stdint.h>
# endif
# if HAVE_STDINT_H
# include <stdint.h>
# endif
# if HAVE_UNISTD_H
# include <unistd.h>
# endif
/* A conservative bound on the maximum length of a human-readable string.

View File

@ -1,6 +1,6 @@
/* inttostr.h -- convert integers to printable strings
Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2001, 2002, 2003, 2004 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,13 +25,11 @@
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#if HAVE_STDINT_H
# include <stdint.h>
#endif
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
#include <limits.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>

View File

@ -1,5 +1,5 @@
/* Locale-specific memory comparison.
Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2002, 2003, 2004 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,10 +24,6 @@
#include "memcoll.h"
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#include <string.h>
/* Compare S1 (with length S1LEN) and S2 (with length S2LEN) according

View File

@ -1,5 +1,7 @@
/* quotearg.c - quote arguments for output
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 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 +30,7 @@
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
@ -174,7 +177,7 @@ gettext_quote (char const *msgid, enum quoting_style s)
size of the output, not counting the terminating null.
If BUFFERSIZE is too small to store the output string, return the
value that would have been returned had BUFFERSIZE been large enough.
If ARGSIZE is -1, use the string length of the argument for ARGSIZE.
If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE.
This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG,
ARGSIZE, O), except it uses QUOTING_STYLE instead of the quoting
@ -190,8 +193,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
size_t len = 0;
char const *quote_string = 0;
size_t quote_string_len = 0;
int backslash_escapes = 0;
int unibyte_locale = MB_CUR_MAX == 1;
bool backslash_escapes = false;
bool unibyte_locale = MB_CUR_MAX == 1;
#define STORE(c) \
do \
@ -206,13 +209,13 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
{
case c_quoting_style:
STORE ('"');
backslash_escapes = 1;
backslash_escapes = true;
quote_string = "\"";
quote_string_len = 1;
break;
case escape_quoting_style:
backslash_escapes = 1;
backslash_escapes = true;
break;
case locale_quoting_style:
@ -237,7 +240,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
char const *right = gettext_quote (N_("'"), quoting_style);
for (quote_string = left; *quote_string; quote_string++)
STORE (*quote_string);
backslash_escapes = 1;
backslash_escapes = true;
quote_string = right;
quote_string_len = strlen (quote_string);
}
@ -326,6 +329,10 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
}
break;
case '{': case '}': /* sometimes special if isolated */
if (! (argsize == SIZE_MAX ? arg[1] == '\0' : argsize == 1))
break;
/* Fall through. */
case '#': case '~':
if (i != 0)
break;
@ -334,7 +341,9 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
case '!': /* special in bash */
case '"': case '$': case '&':
case '(': case ')': case '*': case ';':
case '<': case '>': case '[':
case '<':
case '=': /* sometimes special in 0th or (with "set -k") later args */
case '>': case '[':
case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */
case '`': case '|':
/* A shell special character. In theory, '$' and '`' could
@ -364,7 +373,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
case '%': case '+': case ',': case '-': case '.': case '/':
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9': case ':': case '=':
case '6': case '7': case '8': case '9': case ':':
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
@ -374,7 +383,6 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
case 'o': case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
case '{': case '}':
/* These characters don't cause problems, no matter what the
quoting style is. They cannot start multibyte sequences. */
break;
@ -389,12 +397,12 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
/* Length of multibyte sequence found so far. */
size_t m;
int printable;
bool printable;
if (unibyte_locale)
{
m = 1;
printable = isprint (c);
printable = isprint (c) != 0;
}
else
{
@ -402,7 +410,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
memset (&mbstate, 0, sizeof mbstate);
m = 0;
printable = 1;
printable = true;
if (argsize == SIZE_MAX)
argsize = strlen (arg);
@ -415,20 +423,36 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
break;
else if (bytes == (size_t) -1)
{
printable = 0;
printable = false;
break;
}
else if (bytes == (size_t) -2)
{
printable = 0;
printable = false;
while (i + m < argsize && arg[i + m])
m++;
break;
}
else
{
/* Work around a bug with older shells that "see" a '\'
that is really the 2nd byte of a multibyte character.
In practice the problem is limited to ASCII
chars >= '@' that are shell special chars. */
if ('[' == 0x5b && quoting_style == shell_quoting_style)
{
size_t j;
for (j = 1; j < bytes; j++)
switch (arg[i + m + j])
{
case '[': case '\\': case '^':
case '`': case '|':
goto use_shell_always_quoting_style;
}
}
if (! iswprint (w))
printable = 0;
printable = false;
m += bytes;
}
}
@ -472,6 +496,9 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
STORE (c);
}
if (i == 0 && quoting_style == shell_quoting_style)
goto use_shell_always_quoting_style;
if (quote_string)
for (; *quote_string; quote_string++)
STORE (*quote_string);
@ -492,7 +519,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
size of the output, not counting the terminating null.
If BUFFERSIZE is too small to store the output string, return the
value that would have been returned had BUFFERSIZE been large enough.
If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */
If ARGSIZE is SIZE_MAX, use the string length of the argument for
ARGSIZE. */
size_t
quotearg_buffer (char *buffer, size_t buffersize,
char const *arg, size_t argsize,
@ -506,8 +534,23 @@ quotearg_buffer (char *buffer, size_t buffersize,
return r;
}
/* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly
allocated storage containing the quoted string. */
char *
quotearg_alloc (char const *arg, size_t argsize,
struct quoting_options const *o)
{
int e = errno;
size_t bufsize = quotearg_buffer (0, 0, arg, argsize, o) + 1;
char *buf = xmalloc (bufsize);
quotearg_buffer (buf, bufsize, arg, argsize, o);
errno = e;
return buf;
}
/* Use storage slot N to return a quoted version of argument ARG.
ARG is of size ARGSIZE, but if that is -1, ARG is a null-terminated string.
ARG is of size ARGSIZE, but if that is SIZE_MAX, ARG is a
null-terminated string.
OPTIONS specifies the quoting options.
The returned value points to static storage that can be
reused by the next call to this function with the same value of N.

View File

@ -1,6 +1,6 @@
/* quotearg.h - quote arguments for output
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@ -27,13 +27,31 @@
/* Basic quoting styles. */
enum quoting_style
{
literal_quoting_style, /* --quoting-style=literal */
shell_quoting_style, /* --quoting-style=shell */
shell_always_quoting_style, /* --quoting-style=shell-always */
c_quoting_style, /* --quoting-style=c */
escape_quoting_style, /* --quoting-style=escape */
locale_quoting_style, /* --quoting-style=locale */
clocale_quoting_style /* --quoting-style=clocale */
/* Output names as-is (ls --quoting-style=literal). */
literal_quoting_style,
/* Quote names for the shell if they contain shell metacharacters
or would cause ambiguous output (ls --quoting-style=shell). */
shell_quoting_style,
/* Quote names for the shell, even if they would normally not
require quoting (ls --quoting-style=shell-always). */
shell_always_quoting_style,
/* Quote names as for a C language string (ls --quoting-style=c). */
c_quoting_style,
/* Like c_quoting_style except omit the surrounding double-quote
characters (ls --quoting-style=escape). */
escape_quoting_style,
/* Like clocale_quoting_style, but quote `like this' instead of
"like this" in the default C locale (ls --quoting-style=locale). */
locale_quoting_style,
/* Like c_quoting_style except use quotation marks appropriate for
the locale (ls --quoting-style=clocale). */
clocale_quoting_style
};
/* For now, --quoting-style=literal is the default, but this may change. */
@ -81,6 +99,11 @@ size_t quotearg_buffer (char *buffer, size_t buffersize,
char const *arg, size_t argsize,
struct quoting_options const *o);
/* Like quotearg_buffer, except return the result in a newly allocated
buffer. It is the caller's responsibility to free the result. */
char *quotearg_alloc (char const *arg, size_t argsize,
struct quoting_options const *o);
/* Use storage slot N to return a quoted version of the string ARG.
Use the default quoting options.
The returned value points to static storage that can be

View File

@ -0,0 +1,255 @@
/* stat-related macros
Copyright (C) 1993, 1994, 2001, 2002, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Paul Eggert and Jim Meyering. */
#ifndef STAT_MACROS_H
# define STAT_MACROS_H 1
# if ! defined S_ISREG && ! defined S_IFREG
# error "you must include <sys/stat.h> before including this file"
# endif
# ifndef S_IFMT
# define S_IFMT 0170000
# endif
# if STAT_MACROS_BROKEN
# undef S_ISBLK
# undef S_ISCHR
# undef S_ISDIR
# undef S_ISDOOR
# undef S_ISFIFO
# undef S_ISLNK
# undef S_ISNAM
# undef S_ISMPB
# undef S_ISMPC
# undef S_ISNWK
# undef S_ISREG
# undef S_ISSOCK
# endif
# ifndef S_ISBLK
# ifdef S_IFBLK
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
# else
# define S_ISBLK(m) 0
# endif
# endif
# ifndef S_ISCHR
# ifdef S_IFCHR
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
# else
# define S_ISCHR(m) 0
# endif
# endif
# ifndef S_ISDIR
# ifdef S_IFDIR
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
# else
# define S_ISDIR(m) 0
# endif
# endif
# ifndef S_ISDOOR /* Solaris 2.5 and up */
# ifdef S_IFDOOR
# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
# else
# define S_ISDOOR(m) 0
# endif
# endif
# ifndef S_ISFIFO
# ifdef S_IFIFO
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
# else
# define S_ISFIFO(m) 0
# endif
# endif
# ifndef S_ISLNK
# ifdef S_IFLNK
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
# else
# define S_ISLNK(m) 0
# endif
# endif
# ifndef S_ISMPB /* V7 */
# ifdef S_IFMPB
# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
# else
# define S_ISMPB(m) 0
# define S_ISMPC(m) 0
# endif
# endif
# ifndef S_ISNAM /* Xenix */
# ifdef S_IFNAM
# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
# else
# define S_ISNAM(m) 0
# endif
# endif
# ifndef S_ISNWK /* HP/UX */
# ifdef S_IFNWK
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
# else
# define S_ISNWK(m) 0
# endif
# endif
# ifndef S_ISREG
# ifdef S_IFREG
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
# else
# define S_ISREG(m) 0
# endif
# endif
# ifndef S_ISSOCK
# ifdef S_IFSOCK
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
# else
# define S_ISSOCK(m) 0
# endif
# endif
# ifndef S_TYPEISMQ
# define S_TYPEISMQ(p) 0
# endif
# ifndef S_TYPEISTMO
# define S_TYPEISTMO(p) 0
# endif
# ifndef S_TYPEISSEM
# ifdef S_INSEM
# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
# else
# define S_TYPEISSEM(p) 0
# endif
# endif
# ifndef S_TYPEISSHM
# ifdef S_INSHD
# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
# else
# define S_TYPEISSHM(p) 0
# endif
# endif
/* contiguous */
# ifndef S_ISCTG
# define S_ISCTG(p) 0
# endif
/* Cray DMF (data migration facility): off line, with data */
# ifndef S_ISOFD
# define S_ISOFD(p) 0
# endif
/* Cray DMF (data migration facility): off line, with no data */
# ifndef S_ISOFL
# define S_ISOFL(p) 0
# endif
/* If any of the following are undefined,
define them to their de facto standard values. */
# if !S_ISUID
# define S_ISUID 04000
# endif
# if !S_ISGID
# define S_ISGID 02000
# endif
/* S_ISVTX is a common extension to POSIX. */
# ifndef S_ISVTX
# define S_ISVTX 01000
# endif
# if !S_IRUSR && S_IREAD
# define S_IRUSR S_IREAD
# endif
# if !S_IRUSR
# define S_IRUSR 00400
# endif
# if !S_IRGRP
# define S_IRGRP (S_IRUSR >> 3)
# endif
# if !S_IROTH
# define S_IROTH (S_IRUSR >> 6)
# endif
# if !S_IWUSR && S_IWRITE
# define S_IWUSR S_IWRITE
# endif
# if !S_IWUSR
# define S_IWUSR 00200
# endif
# if !S_IWGRP
# define S_IWGRP (S_IWUSR >> 3)
# endif
# if !S_IWOTH
# define S_IWOTH (S_IWUSR >> 6)
# endif
# if !S_IXUSR && S_IEXEC
# define S_IXUSR S_IEXEC
# endif
# if !S_IXUSR
# define S_IXUSR 00100
# endif
# if !S_IXGRP
# define S_IXGRP (S_IXUSR >> 3)
# endif
# if !S_IXOTH
# define S_IXOTH (S_IXUSR >> 6)
# endif
# if !S_IRWXU
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
# endif
# if !S_IRWXG
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
# endif
# if !S_IRWXO
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
# endif
/* S_IXUGO is a common extension to POSIX. */
# if !S_IXUGO
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
# endif
# ifndef S_IRWXUGO
# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
# endif
/* All the mode bits that can be affected by chmod. */
# define CHMOD_MODE_BITS \
(S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
#endif /* STAT_MACROS_H */

View File

@ -1,7 +1,7 @@
/* xalloc.h -- malloc with out-of-memory checking
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2003 Free Software Foundation, Inc.
1999, 2000, 2003, 2004 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
@ -22,6 +22,12 @@
# include <stddef.h>
# ifdef __cplusplus
extern "C" {
# endif
# ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
# define __attribute__(x)
@ -32,18 +38,9 @@
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
# endif
/* If this pointer is non-zero, run the specified function upon each
allocation failure. It is initialized to zero. */
extern void (*xalloc_fail_func) (void);
/* If XALLOC_FAIL_FUNC is undefined or a function that returns, this
message is output. It is translated via gettext.
Its value is "memory exhausted". */
extern char const xalloc_msg_memory_exhausted[];
/* This function is always triggered when memory is exhausted. It is
in charge of honoring the two previous items. It exits with status
exit_failure (defined in exitfail.h). This is the
/* This function is always triggered when memory is exhausted.
It must be defined by the application, either explicitly
or by using gnulib's xalloc-die module. This is the
function to call when one wants the program to die because of a
memory allocation failure. */
extern void xalloc_die (void) ATTRIBUTE_NORETURN;
@ -84,4 +81,10 @@ char *xstrdup (const char *str);
# define XREALLOC(p, type, n) xnrealloc (p, n, sizeof (type))
# define XFREE(p) free (p)
# ifdef __cplusplus
}
# endif
#endif /* !XALLOC_H_ */

View File

@ -1,7 +1,7 @@
/* xmalloc.c -- malloc with out of memory checking
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003,
1999, 2000, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -26,44 +26,10 @@
#include <stdlib.h>
#include <string.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
#include "error.h"
#include "exitfail.h"
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
#ifndef HAVE_MALLOC
"you must run the autoconf test for a GNU libc compatible malloc"
#endif
#ifndef HAVE_REALLOC
"you must run the autoconf test for a GNU libc compatible realloc"
#endif
/* If non NULL, call this function when memory is exhausted. */
void (*xalloc_fail_func) (void) = 0;
/* If XALLOC_FAIL_FUNC is NULL, or does return, display this message
before exiting when memory is exhausted. Goes through gettext. */
char const xalloc_msg_memory_exhausted[] = N_("memory exhausted");
void
xalloc_die (void)
{
if (xalloc_fail_func)
(*xalloc_fail_func) ();
error (exit_failure, 0, "%s", _(xalloc_msg_memory_exhausted));
/* The `noreturn' cannot be given to error, since it may return if
its first argument is 0. To help compilers understand the
xalloc_die does terminate, call abort. */
abort ();
}
/* Allocate an array of N objects, each with S bytes of memory,
dynamically, with error checking. S must be nonzero. */
@ -71,7 +37,7 @@ static inline void *
xnmalloc_inline (size_t n, size_t s)
{
void *p;
if (xalloc_oversized (n, s) || ! (p = malloc (n * s)))
if (xalloc_oversized (n, s) || (! (p = malloc (n * s)) && n != 0))
xalloc_die ();
return p;
}
@ -96,7 +62,7 @@ xmalloc (size_t n)
static inline void *
xnrealloc_inline (void *p, size_t n, size_t s)
{
if (xalloc_oversized (n, s) || ! (p = realloc (p, n * s)))
if (xalloc_oversized (n, s) || (! (p = realloc (p, n * s)) && n != 0))
xalloc_die ();
return p;
}
@ -239,7 +205,7 @@ xcalloc (size_t n, size_t s)
void *p;
/* Test for overflow, since some calloc implementations don't have
proper overflow checks. */
if (xalloc_oversized (n, s) || ! (p = calloc (n, s)))
if (xalloc_oversized (n, s) || (! (p = calloc (n, s)) && n != 0))
xalloc_die ();
return p;
}

View File

@ -1,5 +1,5 @@
/* Locale-specific memory comparison.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004 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
@ -22,10 +22,6 @@
#endif
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#include <stdlib.h>
#include "gettext.h"

View File

@ -1,6 +1,6 @@
/* A more useful interface to strtol.
Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003 Free
Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@ -37,16 +37,11 @@
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#include <limits.h>
/* The extra casts work around common compiler bugs. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
@ -121,9 +116,10 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
if (! TYPE_SIGNED (__strtol_t))
{
const char *q = s;
while (ISSPACE ((unsigned char) *q))
++q;
if (*q == '-')
unsigned char ch = *q;
while (ISSPACE (ch))
ch = *++q;
if (ch == '-')
return LONGINT_INVALID;
}

View File

@ -22,13 +22,11 @@
# include "exitfail.h"
/* Get uintmax_t. */
# if HAVE_INTTYPES_H
# include <inttypes.h>
# else
# if HAVE_STDINT_H
# include <stdint.h>
# endif
# endif
# if HAVE_STDINT_H
# include <stdint.h>
# endif
# ifndef _STRTOL_ERROR

View File

@ -1,5 +1,5 @@
/* xstrtoumax.c -- A more useful interface to strtoumax.
Copyright (C) 1999, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -21,11 +21,7 @@
# include <config.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#elif HAVE_STDINT_H
# include <stdint.h>
#endif
#include "xstrtol.h"
#define __strtol strtoumax
#define __strtol_t uintmax_t

View File

@ -92,6 +92,10 @@ you must include <sys/types.h> before including this file
#endif
#undef HAVE_MAJOR
#if ! defined makedev && defined mkdev
# define makedev(maj, min) mkdev (maj, min)
#endif
#if HAVE_UTIME_H
# include <utime.h>
#endif
@ -115,17 +119,11 @@ void *memrchr (const void *, int, size_t);
#endif
#include <errno.h>
#ifndef errno
extern int errno;
#endif
/* Some systems don't define the following symbols. */
#ifndef ENOSYS
# define ENOSYS (-1)
#endif
#ifndef ENOTSUP
# define ENOTSUP (-1)
#endif
#ifndef EISDIR
# define EISDIR (-1)
#endif
@ -193,6 +191,14 @@ initialize_exit_failure (int status)
# define O_TEXT _O_TEXT
#endif
#if !defined O_DIRECT
# define O_DIRECT 0
#endif
#if !defined O_DSYNC
# define O_DSYNC 0
#endif
#if !defined O_NDELAY
# define O_NDELAY 0
#endif
@ -205,6 +211,18 @@ initialize_exit_failure (int status)
# define O_NOCTTY 0
#endif
#if !defined O_NOFOLLOW
# define O_NOFOLLOW 0
#endif
#if !defined O_RSYNC
# define O_RSYNC 0
#endif
#if !defined O_SYNC
# define O_SYNC 0
#endif
#ifdef __BEOS__
/* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
# undef O_BINARY
@ -231,7 +249,9 @@ initialize_exit_failure (int status)
# define SET_MODE(_f, _m) (void)0
# define SET_BINARY(f) (void)0
# define SET_BINARY2(f1,f2) (void)0
# define O_BINARY 0
# ifndef O_BINARY
# define O_BINARY 0
# endif
# define O_TEXT 0
#endif /* O_BINARY */
@ -298,7 +318,7 @@ initialize_exit_failure (int status)
? (statbuf).st_blksize : DEV_BSIZE)
# if defined hpux || defined __hpux__ || defined __hpux
/* HP-UX counts st_blocks in 1024-byte units.
This loses when mixing HP-UX and BSD filesystems with NFS. */
This loses when mixing HP-UX and BSD file systems with NFS. */
# define ST_NBLOCKSIZE 1024
# else /* !hpux */
# if defined _AIX && defined _I386
@ -329,213 +349,7 @@ initialize_exit_failure (int status)
# define initialize_main(ac, av)
#endif
#ifndef S_IFMT
# define S_IFMT 0170000
#endif
#if STAT_MACROS_BROKEN
# undef S_ISBLK
# undef S_ISCHR
# undef S_ISDIR
# undef S_ISDOOR
# undef S_ISFIFO
# undef S_ISLNK
# undef S_ISNAM
# undef S_ISMPB
# undef S_ISMPC
# undef S_ISNWK
# undef S_ISREG
# undef S_ISSOCK
#endif
#ifndef S_ISBLK
# ifdef S_IFBLK
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
# else
# define S_ISBLK(m) 0
# endif
#endif
#ifndef S_ISCHR
# ifdef S_IFCHR
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
# else
# define S_ISCHR(m) 0
# endif
#endif
#ifndef S_ISDIR
# ifdef S_IFDIR
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
# else
# define S_ISDIR(m) 0
# endif
#endif
#ifndef S_ISDOOR /* Solaris 2.5 and up */
# ifdef S_IFDOOR
# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
# else
# define S_ISDOOR(m) 0
# endif
#endif
#ifndef S_ISFIFO
# ifdef S_IFIFO
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
# else
# define S_ISFIFO(m) 0
# endif
#endif
#ifndef S_ISLNK
# ifdef S_IFLNK
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
# else
# define S_ISLNK(m) 0
# endif
#endif
#ifndef S_ISMPB /* V7 */
# ifdef S_IFMPB
# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
# else
# define S_ISMPB(m) 0
# define S_ISMPC(m) 0
# endif
#endif
#ifndef S_ISNAM /* Xenix */
# ifdef S_IFNAM
# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
# else
# define S_ISNAM(m) 0
# endif
#endif
#ifndef S_ISNWK /* HP/UX */
# ifdef S_IFNWK
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
# else
# define S_ISNWK(m) 0
# endif
#endif
#ifndef S_ISREG
# ifdef S_IFREG
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
# else
# define S_ISREG(m) 0
# endif
#endif
#ifndef S_ISSOCK
# ifdef S_IFSOCK
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
# else
# define S_ISSOCK(m) 0
# endif
#endif
#ifndef S_TYPEISSEM
# ifdef S_INSEM
# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
# else
# define S_TYPEISSEM(p) 0
# endif
#endif
#ifndef S_TYPEISSHM
# ifdef S_INSHD
# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
# else
# define S_TYPEISSHM(p) 0
# endif
#endif
#ifndef S_TYPEISMQ
# define S_TYPEISMQ(p) 0
#endif
/* If any of the following are undefined,
define them to their de facto standard values. */
#if !S_ISUID
# define S_ISUID 04000
#endif
#if !S_ISGID
# define S_ISGID 02000
#endif
/* S_ISVTX is a common extension to POSIX. */
#ifndef S_ISVTX
# define S_ISVTX 01000
#endif
#if !S_IRUSR && S_IREAD
# define S_IRUSR S_IREAD
#endif
#if !S_IRUSR
# define S_IRUSR 00400
#endif
#if !S_IRGRP
# define S_IRGRP (S_IRUSR >> 3)
#endif
#if !S_IROTH
# define S_IROTH (S_IRUSR >> 6)
#endif
#if !S_IWUSR && S_IWRITE
# define S_IWUSR S_IWRITE
#endif
#if !S_IWUSR
# define S_IWUSR 00200
#endif
#if !S_IWGRP
# define S_IWGRP (S_IWUSR >> 3)
#endif
#if !S_IWOTH
# define S_IWOTH (S_IWUSR >> 6)
#endif
#if !S_IXUSR && S_IEXEC
# define S_IXUSR S_IEXEC
#endif
#if !S_IXUSR
# define S_IXUSR 00100
#endif
#if !S_IXGRP
# define S_IXGRP (S_IXUSR >> 3)
#endif
#if !S_IXOTH
# define S_IXOTH (S_IXUSR >> 6)
#endif
#if !S_IRWXU
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
#endif
#if !S_IRWXG
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
#endif
#if !S_IRWXO
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
#endif
/* S_IXUGO is a common extension to POSIX. */
#if !S_IXUGO
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
#endif
#ifndef S_IRWXUGO
# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
#endif
/* All the mode bits that can be affected by chmod. */
#define CHMOD_MODE_BITS \
(S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
#include "stat-macros.h"
#include "timespec.h"
@ -550,29 +364,35 @@ initialize_exit_failure (int status)
# include <sys/exceptn.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#if HAVE_STDINT_H
# include <stdint.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h> /* for the definition of UINTMAX_MAX */
#if ULONG_MAX < ULLONG_MAX
# define LONGEST_MODIFIER "ll"
#else
# define LONGEST_MODIFIER "l"
#endif
#if !defined PRIdMAX || PRI_MACROS_BROKEN
#if PRI_MACROS_BROKEN
# undef PRIdMAX
# define PRIdMAX (sizeof (uintmax_t) == sizeof (long) ? "ld" : "lld")
#endif
#if !defined PRIoMAX || PRI_MACROS_BROKEN
# undef PRIoMAX
# define PRIoMAX (sizeof (uintmax_t) == sizeof (long) ? "lo" : "llo")
#endif
#if !defined PRIuMAX || PRI_MACROS_BROKEN
# undef PRIuMAX
# define PRIuMAX (sizeof (uintmax_t) == sizeof (long) ? "lu" : "llu")
#endif
#if !defined PRIxMAX || PRI_MACROS_BROKEN
# undef PRIxMAX
# define PRIxMAX (sizeof (uintmax_t) == sizeof (long) ? "lx" : "llx")
#endif
#ifndef PRIdMAX
# define PRIdMAX LONGEST_MODIFIER "d"
#endif
#ifndef PRIoMAX
# define PRIoMAX LONGEST_MODIFIER "o"
#endif
#ifndef PRIuMAX
# define PRIuMAX LONGEST_MODIFIER "u"
#endif
#ifndef PRIxMAX
# define PRIxMAX LONGEST_MODIFIER "x"
#endif
#include <ctype.h>
@ -642,7 +462,12 @@ initialize_exit_failure (int status)
POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
ISDIGIT_LOCALE unless it's important to use the locale's definition
of `digit' even when the host does not conform to POSIX. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
/* Convert a possibly-signed character to an unsigned character. This is
a bit safer than casting to unsigned char, since it catches some type
errors that the cast doesn't. */
static inline unsigned char to_uchar (char ch) { return ch; }
/* Take care of NLS matters. */
@ -754,6 +579,18 @@ uid_t getuid ();
(Basename[0] == '.' && (Basename[1] == '\0' \
|| (Basename[1] == '.' && Basename[2] == '\0')))
/* A wrapper for readdir so that callers don't see entries for `.' or `..'. */
static inline struct dirent const *
readdir_ignoring_dot_and_dotdot (DIR *dirp)
{
while (1)
{
struct dirent const *dp = readdir (dirp);
if (dp == NULL || ! DOT_OR_DOTDOT (dp->d_name))
return dp;
}
}
#if SETVBUF_REVERSED
# define SETVBUF(Stream, Buffer, Type, Size) \
setvbuf (Stream, Type, Buffer, Size)
@ -793,7 +630,7 @@ enum
#define case_GETOPT_VERSION_CHAR(Program_name, Authors) \
case GETOPT_VERSION_CHAR: \
version_etc (stdout, Program_name, PACKAGE, VERSION, Authors, \
version_etc (stdout, Program_name, GNU_PACKAGE, VERSION, Authors, \
(char *) NULL); \
exit (EXIT_SUCCESS); \
break;
@ -806,10 +643,6 @@ enum
# define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
/* The extra casts work around common compiler bugs. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
@ -859,16 +692,24 @@ enum
# define INT_MIN TYPE_MINIMUM (int)
#endif
#ifndef INTMAX_MAX
# define INTMAX_MAX TYPE_MAXIMUM (intmax_t)
#endif
#ifndef INTMAX_MIN
# define INTMAX_MIN TYPE_MINIMUM (intmax_t)
#endif
#ifndef UINT_MAX
# define UINT_MAX TYPE_MAXIMUM (unsigned int)
#endif
#ifndef LONG_MAX
# define LONG_MAX TYPE_MAXIMUM (long)
# define LONG_MAX TYPE_MAXIMUM (long int)
#endif
#ifndef ULONG_MAX
# define ULONG_MAX TYPE_MAXIMUM (unsigned long)
# define ULONG_MAX TYPE_MAXIMUM (unsigned long int)
#endif
#ifndef SIZE_MAX
@ -944,7 +785,47 @@ enum
#endif
#if ! HAVE_FSEEKO && ! defined fseeko
# define fseeko(s, o, w) ((o) == (long) (o) \
# define fseeko(s, o, w) ((o) == (long int) (o) \
? fseek (s, o, w) \
: (errno = EOVERFLOW, -1))
#endif
/* Compute the greatest common divisor of U and V using Euclid's
algorithm. U and V must be nonzero. */
static inline size_t
gcd (size_t u, size_t v)
{
do
{
size_t t = u % v;
u = v;
v = t;
}
while (v);
return u;
}
/* Compute the least common multiple of U and V. U and V must be
nonzero. There is no overflow checking, so callers should not
specify outlandish sizes. */
static inline size_t
lcm (size_t u, size_t v)
{
return u * (v / gcd (u, v));
}
/* Return PTR, aligned upward to the next multiple of ALIGNMENT.
ALIGNMENT must be nonzero. The caller must arrange for ((char *)
PTR) through ((char *) PTR + ALIGNMENT - 1) to be addressable
locations. */
static inline void *
ptr_align (void *ptr, size_t alignment)
{
char *p0 = ptr;
char *p1 = p0 + alignment - 1;
return p1 - (size_t) p1 % alignment;
}