This commit was generated by cvs2svn to compensate for changes in r131447,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
a6d7df1ec2
@ -1,8 +1,8 @@
|
||||
Notes on the Free Translation Project
|
||||
*************************************
|
||||
|
||||
Free software is going international! The Free Translation Project
|
||||
is a way to get maintainers of free software, translators, and users all
|
||||
Free software is going international! The Free Translation Project is
|
||||
a way to get maintainers of free software, translators, and users all
|
||||
together, so that will gradually become able to speak many languages.
|
||||
A few packages already provide translations for their messages.
|
||||
|
||||
@ -25,7 +25,7 @@ related to internationalization, you should tell about the version of
|
||||
Quick configuration advice
|
||||
==========================
|
||||
|
||||
If you want to exploit the full power of internationalization, you
|
||||
If you want to exploit the full power of internationalization, you
|
||||
should configure it using
|
||||
|
||||
./configure --with-included-gettext
|
||||
@ -48,10 +48,10 @@ included `libintl'.
|
||||
INSTALL Matters
|
||||
===============
|
||||
|
||||
Some packages are "localizable" when properly installed; the
|
||||
programs they contain can be made to speak your own native language.
|
||||
Most such packages use GNU `gettext'. Other packages have their own
|
||||
ways to internationalization, predating GNU `gettext'.
|
||||
Some packages are "localizable" when properly installed; the programs
|
||||
they contain can be made to speak your own native language. Most such
|
||||
packages use GNU `gettext'. Other packages have their own ways to
|
||||
internationalization, predating GNU `gettext'.
|
||||
|
||||
By default, this package will be installed to allow translation of
|
||||
messages. It will automatically detect whether the system already
|
||||
@ -98,7 +98,7 @@ codes, stating which languages are allowed.
|
||||
Using This Package
|
||||
==================
|
||||
|
||||
As a user, if your language has been installed for this package, you
|
||||
As a user, if your language has been installed for this package, you
|
||||
only have to set the `LANG' environment variable to the appropriate
|
||||
`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
|
||||
and `CC' is an ISO 3166 two-letter country code. For example, let's
|
||||
@ -140,7 +140,7 @@ to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
|
||||
Translating Teams
|
||||
=================
|
||||
|
||||
For the Free Translation Project to be a success, we need interested
|
||||
For the Free Translation Project to be a success, we need interested
|
||||
people who like their own language and write it well, and who are also
|
||||
able to synergize with other translators speaking the same language.
|
||||
Each translation team has its own mailing list. The up-to-date list of
|
||||
@ -170,230 +170,515 @@ programming skill, here.
|
||||
Available Packages
|
||||
==================
|
||||
|
||||
Languages are not equally supported in all packages. The following
|
||||
matrix shows the current state of internationalization, as of July
|
||||
2002. The matrix shows, in regard of each package, for which languages
|
||||
Languages are not equally supported in all packages. The following
|
||||
matrix shows the current state of internationalization, as of December
|
||||
2003. The matrix shows, in regard of each package, for which languages
|
||||
PO files have been submitted to translation coordination, with a
|
||||
translation percentage of at least 50%.
|
||||
|
||||
Ready PO files be bg ca cs da de el en eo es et fi fr
|
||||
+----------------------------------------+
|
||||
a2ps | [] [] [] [] |
|
||||
bash | [] [] [] [] |
|
||||
bfd | [] [] |
|
||||
binutils | [] [] |
|
||||
bison | [] [] [] [] |
|
||||
clisp | [] [] [] [] |
|
||||
clisp | |
|
||||
clisplow | |
|
||||
cpio | [] [] [] [] |
|
||||
darkstat | () |
|
||||
diffutils | [] [] [] [] [] [] |
|
||||
enscript | [] [] |
|
||||
error | [] [] [] |
|
||||
fetchmail | [] () [] [] [] () |
|
||||
fileutils | [] [] [] [] [] |
|
||||
findutils | [] [] [] [] [] [] |
|
||||
flex | [] [] [] [] [] |
|
||||
gas | [] [] |
|
||||
gawk | [] [] [] |
|
||||
gcal | [] [] |
|
||||
gcc | [] [] |
|
||||
gettext | [] [] [] [] [] |
|
||||
gnupg | [] [] [] [] [] [] [] |
|
||||
gprof | [] [] |
|
||||
gpsdrive | () () () () () |
|
||||
grep | [] [] [] [] [] [] [] |
|
||||
gretl | [] |
|
||||
gthumb | () () () |
|
||||
hello | [] [] [] [] [] [] [] [] [] |
|
||||
id-utils | [] [] [] |
|
||||
indent | [] [] [] [] [] |
|
||||
jpilot | () [] [] [] |
|
||||
jwhois | [] [] |
|
||||
kbd | [] [] [] |
|
||||
ld | [] [] |
|
||||
libc | [] [] [] [] [] [] [] |
|
||||
libiconv | [] [] [] [] |
|
||||
lifelines | () () |
|
||||
lilypond | [] [] [] |
|
||||
lingoteach | [] [] |
|
||||
lingoteach_lessons| () () |
|
||||
lynx | [] [] [] [] [] |
|
||||
m4 | [] [] [] [] [] |
|
||||
make | [] [] [] [] |
|
||||
man-db | [] () () [] () () |
|
||||
mysecretdiary | [] [] [] |
|
||||
nano | [] () [] [] [] [] |
|
||||
nano_1_0 | [] () [] [] [] [] |
|
||||
opcodes | [] [] [] |
|
||||
parted | [] [] [] [] [] |
|
||||
ptx | [] [] [] [] [] [] [] |
|
||||
python | |
|
||||
recode | [] [] [] [] [] [] |
|
||||
sed | [] [] [] [] [] [] [] [] [] |
|
||||
sh-utils | [] [] [] [] |
|
||||
sharutils | [] [] [] [] [] [] |
|
||||
sketch | () [] () |
|
||||
soundtracker | [] [] [] |
|
||||
sp | [] |
|
||||
tar | [] [] [] [] [] [] |
|
||||
texinfo | [] [] [] [] [] |
|
||||
textutils | [] [] [] [] [] |
|
||||
util-linux | [] [] [] [] [] [] |
|
||||
vorbis-tools | [] |
|
||||
wastesedge | |
|
||||
wdiff | [] [] [] [] [] [] |
|
||||
wget | [] [] [] [] [] [] [] [] [] [] |
|
||||
+----------------------------------------+
|
||||
be bg ca cs da de el en eo es et fi fr
|
||||
0 2 19 10 30 44 9 1 12 45 16 3 53
|
||||
Ready PO files am az be bg ca cs da de el en en_GB eo es
|
||||
+-------------------------------------------+
|
||||
a2ps | [] [] [] [] |
|
||||
aegis | () |
|
||||
ant-phone | () |
|
||||
anubis | |
|
||||
ap-utils | |
|
||||
bash | [] [] [] [] |
|
||||
batchelor | |
|
||||
bfd | [] [] |
|
||||
binutils | [] [] |
|
||||
bison | [] [] [] |
|
||||
bluez-pin | [] [] |
|
||||
clisp | |
|
||||
clisp | [] [] [] |
|
||||
coreutils | [] [] [] [] |
|
||||
cpio | [] [] [] |
|
||||
darkstat | [] () [] |
|
||||
diffutils | [] [] [] [] [] [] [] |
|
||||
e2fsprogs | [] [] |
|
||||
enscript | [] [] [] [] |
|
||||
error | [] [] [] [] [] |
|
||||
fetchmail | [] () [] [] [] [] |
|
||||
fileutils | [] [] [] |
|
||||
findutils | [] [] [] [] [] [] [] |
|
||||
flex | [] [] [] [] |
|
||||
fslint | |
|
||||
gas | [] |
|
||||
gawk | [] [] [] [] |
|
||||
gbiff | [] |
|
||||
gcal | [] |
|
||||
gcc | [] [] |
|
||||
gettext | [] [] [] [] [] |
|
||||
gettext-examples | [] [] [] |
|
||||
gettext-runtime | [] [] [] [] [] |
|
||||
gettext-tools | [] [] [] |
|
||||
gimp-print | [] [] [] [] [] |
|
||||
gliv | |
|
||||
glunarclock | [] [] |
|
||||
gnubiff | [] |
|
||||
gnucash | [] () [] [] |
|
||||
gnucash-glossary | [] () [] |
|
||||
gnupg | [] () [] [] [] [] |
|
||||
gpe-aerial | [] |
|
||||
gpe-beam | [] [] |
|
||||
gpe-calendar | [] [] |
|
||||
gpe-clock | [] [] |
|
||||
gpe-conf | [] [] |
|
||||
gpe-contacts | [] [] |
|
||||
gpe-edit | [] |
|
||||
gpe-go | [] |
|
||||
gpe-login | [] [] |
|
||||
gpe-ownerinfo | [] [] |
|
||||
gpe-sketchbook | [] [] |
|
||||
gpe-su | [] [] |
|
||||
gpe-taskmanager | [] [] |
|
||||
gpe-timesheet | [] |
|
||||
gpe-today | [] [] |
|
||||
gpe-todo | [] [] |
|
||||
gphoto2 | [] [] [] [] |
|
||||
gprof | [] [] [] |
|
||||
gpsdrive | () () () |
|
||||
gramadoir | [] |
|
||||
grep | [] [] [] [] [] [] |
|
||||
gretl | [] |
|
||||
gtick | () |
|
||||
hello | [] [] [] [] [] [] |
|
||||
id-utils | [] [] |
|
||||
indent | [] [] [] [] |
|
||||
jpilot | [] [] [] |
|
||||
jtag | |
|
||||
jwhois | [] |
|
||||
kbd | [] [] [] [] [] |
|
||||
latrine | () |
|
||||
ld | [] [] |
|
||||
libc | [] [] [] [] [] [] |
|
||||
libgpewidget | [] [] |
|
||||
libiconv | [] [] [] [] [] |
|
||||
lifelines | [] () |
|
||||
lilypond | [] |
|
||||
lingoteach | |
|
||||
lingoteach_lessons | () () |
|
||||
lynx | [] [] [] [] |
|
||||
m4 | [] [] [] [] |
|
||||
mailutils | [] [] |
|
||||
make | [] [] [] |
|
||||
man-db | [] () [] [] () |
|
||||
minicom | [] [] [] |
|
||||
mysecretdiary | [] [] [] |
|
||||
nano | [] () [] [] [] |
|
||||
nano_1_0 | [] () [] [] [] |
|
||||
opcodes | [] |
|
||||
parted | [] [] [] [] [] |
|
||||
ptx | [] [] [] [] [] |
|
||||
python | |
|
||||
radius | [] |
|
||||
recode | [] [] [] [] [] [] [] |
|
||||
rpm | [] [] |
|
||||
screem | |
|
||||
scrollkeeper | [] [] [] [] [] [] |
|
||||
sed | [] [] [] [] [] |
|
||||
sh-utils | [] [] [] |
|
||||
shared-mime-info | |
|
||||
sharutils | [] [] [] [] [] [] |
|
||||
silky | () |
|
||||
skencil | [] () [] |
|
||||
sketch | [] () [] |
|
||||
soundtracker | [] [] [] |
|
||||
sp | [] |
|
||||
tar | [] [] [] [] |
|
||||
texinfo | [] [] [] |
|
||||
textutils | [] [] [] [] |
|
||||
tin | () () |
|
||||
tuxpaint | [] [] [] [] [] [] [] |
|
||||
util-linux | [] [] [] [] [] |
|
||||
vorbis-tools | [] [] [] [] |
|
||||
wastesedge | () |
|
||||
wdiff | [] [] [] [] |
|
||||
wget | [] [] [] [] [] [] |
|
||||
xchat | [] [] [] [] |
|
||||
xfree86_xkb_xml | [] |
|
||||
xpad | [] |
|
||||
+-------------------------------------------+
|
||||
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
|
||||
|
||||
gl he hr hu id it ja ko lv nb nl nn
|
||||
+-------------------------------------+
|
||||
a2ps | () () [] |
|
||||
bash | [] |
|
||||
bfd | [] |
|
||||
binutils | [] |
|
||||
bison | [] [] [] [] |
|
||||
clisp | [] |
|
||||
clisp | |
|
||||
clisplow | |
|
||||
cpio | [] [] [] [] |
|
||||
darkstat | () |
|
||||
diffutils | [] [] [] [] [] |
|
||||
enscript | [] [] |
|
||||
error | [] |
|
||||
fetchmail | [] |
|
||||
fileutils | [] [] [] |
|
||||
findutils | [] [] [] [] [] [] [] [] |
|
||||
flex | [] |
|
||||
gas | |
|
||||
gawk | [] |
|
||||
gcal | |
|
||||
gcc | [] |
|
||||
gettext | [] [] |
|
||||
gnupg | [] [] [] [] |
|
||||
gprof | |
|
||||
gpsdrive | [] () () |
|
||||
grep | [] [] [] [] [] [] [] |
|
||||
gretl | |
|
||||
gthumb | () () |
|
||||
hello | [] [] [] [] [] [] [] [] [] [] [] [] |
|
||||
id-utils | [] [] |
|
||||
indent | [] [] [] [] |
|
||||
jpilot | () () |
|
||||
jwhois | [] [] |
|
||||
kbd | |
|
||||
ld | |
|
||||
libc | [] [] [] [] |
|
||||
libiconv | [] [] [] |
|
||||
lifelines | |
|
||||
lilypond | [] [] |
|
||||
lingoteach | [] |
|
||||
lingoteach_lessons| |
|
||||
lynx | [] [] [] [] |
|
||||
m4 | [] [] [] [] |
|
||||
make | [] [] [] [] [] [] |
|
||||
man-db | () () |
|
||||
mysecretdiary | [] |
|
||||
nano | [] [] [] [] [] [] |
|
||||
nano_1_0 | [] [] [] [] [] |
|
||||
opcodes | [] [] |
|
||||
parted | [] [] [] |
|
||||
ptx | [] [] [] [] [] |
|
||||
python | |
|
||||
recode | [] [] [] |
|
||||
sed | [] [] [] [] [] [] [] [] |
|
||||
sh-utils | [] [] [] |
|
||||
sharutils | [] [] [] |
|
||||
sketch | () |
|
||||
soundtracker | [] [] |
|
||||
sp | |
|
||||
tar | [] [] [] [] [] |
|
||||
texinfo | [] [] [] |
|
||||
textutils | [] [] [] |
|
||||
util-linux | () [] |
|
||||
vorbis-tools | |
|
||||
wastesedge | |
|
||||
wdiff | [] [] [] |
|
||||
wget | [] [] [] [] [] [] |
|
||||
+-------------------------------------+
|
||||
gl he hr hu id it ja ko lv nb nl nn
|
||||
23 9 12 18 14 13 26 9 1 8 19 4
|
||||
et fa fi fr ga gl he hr hu id is it ja
|
||||
+----------------------------------------+
|
||||
a2ps | [] [] [] () |
|
||||
aegis | |
|
||||
ant-phone | |
|
||||
anubis | [] |
|
||||
ap-utils | [] |
|
||||
bash | [] [] |
|
||||
batchelor | [] |
|
||||
bfd | [] |
|
||||
binutils | [] [] |
|
||||
bison | [] [] [] [] |
|
||||
bluez-pin | [] [] [] [] [] |
|
||||
clisp | |
|
||||
clisp | [] |
|
||||
coreutils | [] [] [] [] [] [] |
|
||||
cpio | [] [] [] |
|
||||
darkstat | () [] [] [] |
|
||||
diffutils | [] [] [] [] [] [] [] |
|
||||
e2fsprogs | |
|
||||
enscript | [] [] |
|
||||
error | [] [] [] [] |
|
||||
fetchmail | [] |
|
||||
fileutils | [] [] [] [] [] [] |
|
||||
findutils | [] [] [] [] [] [] [] [] [] [] |
|
||||
flex | [] [] |
|
||||
fslint | |
|
||||
gas | [] |
|
||||
gawk | [] [] [] |
|
||||
gbiff | |
|
||||
gcal | [] |
|
||||
gcc | [] |
|
||||
gettext | [] [] |
|
||||
gettext-examples | [] [] |
|
||||
gettext-runtime | [] [] [] [] |
|
||||
gettext-tools | [] [] |
|
||||
gimp-print | [] [] |
|
||||
gliv | () |
|
||||
glunarclock | [] [] [] [] |
|
||||
gnubiff | |
|
||||
gnucash | () [] |
|
||||
gnucash-glossary | [] |
|
||||
gnupg | [] [] [] [] [] [] [] |
|
||||
gpe-aerial | [] |
|
||||
gpe-beam | [] |
|
||||
gpe-calendar | [] [] [] |
|
||||
gpe-clock | [] |
|
||||
gpe-conf | [] |
|
||||
gpe-contacts | [] [] |
|
||||
gpe-edit | [] [] |
|
||||
gpe-go | [] |
|
||||
gpe-login | [] [] |
|
||||
gpe-ownerinfo | [] [] [] |
|
||||
gpe-sketchbook | [] |
|
||||
gpe-su | [] |
|
||||
gpe-taskmanager | [] |
|
||||
gpe-timesheet | [] [] [] |
|
||||
gpe-today | [] [] |
|
||||
gpe-todo | [] [] |
|
||||
gphoto2 | [] [] [] |
|
||||
gprof | [] [] |
|
||||
gpsdrive | () [] () () |
|
||||
gramadoir | [] |
|
||||
grep | [] [] [] [] [] [] [] [] [] [] [] |
|
||||
gretl | [] |
|
||||
gtick | [] [] |
|
||||
hello | [] [] [] [] [] [] [] [] [] [] [] [] |
|
||||
id-utils | [] [] [] [] |
|
||||
indent | [] [] [] [] [] [] [] [] [] |
|
||||
jpilot | [] () |
|
||||
jtag | |
|
||||
jwhois | [] [] [] [] |
|
||||
kbd | [] |
|
||||
latrine | |
|
||||
ld | [] |
|
||||
libc | [] [] [] [] [] |
|
||||
libgpewidget | [] [] [] [] |
|
||||
libiconv | [] [] [] [] [] [] [] [] [] |
|
||||
lifelines | () |
|
||||
lilypond | [] |
|
||||
lingoteach | [] [] |
|
||||
lingoteach_lessons | |
|
||||
lynx | [] [] [] [] |
|
||||
m4 | [] [] [] [] |
|
||||
mailutils | |
|
||||
make | [] [] [] [] [] |
|
||||
man-db | () () |
|
||||
minicom | [] [] [] [] |
|
||||
mysecretdiary | [] [] |
|
||||
nano | [] [] [] [] |
|
||||
nano_1_0 | [] [] [] [] |
|
||||
opcodes | [] |
|
||||
parted | [] [] [] |
|
||||
ptx | [] [] [] [] [] [] [] |
|
||||
python | |
|
||||
radius | [] |
|
||||
recode | [] [] [] [] [] [] |
|
||||
rpm | |
|
||||
screem | |
|
||||
scrollkeeper | [] |
|
||||
sed | [] [] [] [] [] [] [] [] [] |
|
||||
sh-utils | [] [] [] [] [] [] [] |
|
||||
shared-mime-info | [] |
|
||||
sharutils | [] [] [] [] [] |
|
||||
silky | [] () |
|
||||
skencil | [] |
|
||||
sketch | [] |
|
||||
soundtracker | [] [] [] [] |
|
||||
sp | [] () |
|
||||
tar | [] [] [] [] [] [] [] [] [] |
|
||||
texinfo | [] [] [] [] |
|
||||
textutils | [] [] [] [] [] |
|
||||
tin | [] () |
|
||||
tuxpaint | [] [] [] [] [] [] [] [] |
|
||||
util-linux | [] [] [] [] () [] |
|
||||
vorbis-tools | [] |
|
||||
wastesedge | () |
|
||||
wdiff | [] [] [] [] [] [] |
|
||||
wget | [] [] [] [] [] [] [] |
|
||||
xchat | [] [] [] |
|
||||
xfree86_xkb_xml | |
|
||||
xpad | [] |
|
||||
+----------------------------------------+
|
||||
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
|
||||
|
||||
no pl pt pt_BR ru sk sl sv tr uk zh_TW
|
||||
+----------------------------------------+
|
||||
a2ps | () () () [] [] [] [] [] | 10
|
||||
bash | [] | 6
|
||||
bfd | [] [] | 5
|
||||
binutils | [] [] | 5
|
||||
bison | [] [] [] | 11
|
||||
clisp | | 5
|
||||
clisp | | 0
|
||||
clisplow | | 0
|
||||
cpio | [] [] [] [] | 12
|
||||
darkstat | [] () | 1
|
||||
diffutils | [] [] [] [] [] [] | 17
|
||||
enscript | [] [] [] [] | 8
|
||||
error | [] [] [] | 7
|
||||
fetchmail | () () [] | 6
|
||||
fileutils | [] [] [] [] [] | 13
|
||||
findutils | [] [] [] [] [] [] [] | 21
|
||||
flex | [] [] [] | 9
|
||||
gas | [] | 3
|
||||
gawk | [] [] | 6
|
||||
gcal | [] [] | 4
|
||||
gcc | [] | 4
|
||||
gettext | [] [] [] [] [] [] | 13
|
||||
gnupg | [] [] [] | 14
|
||||
gprof | [] [] | 4
|
||||
gpsdrive | [] [] () | 3
|
||||
grep | [] [] [] [] | 18
|
||||
gretl | | 1
|
||||
gthumb | () () [] | 1
|
||||
hello | [] [] [] [] [] [] [] | 28
|
||||
id-utils | [] [] [] [] | 9
|
||||
indent | [] [] [] [] [] | 14
|
||||
jpilot | () () [] | 4
|
||||
jwhois | [] () () [] [] | 7
|
||||
kbd | [] [] | 5
|
||||
ld | [] [] | 4
|
||||
libc | [] [] [] [] [] [] | 17
|
||||
libiconv | [] [] [] [] | 11
|
||||
lifelines | [] | 1
|
||||
lilypond | [] | 6
|
||||
lingoteach | [] [] | 5
|
||||
lingoteach_lessons| | 0
|
||||
lynx | [] [] [] [] | 13
|
||||
m4 | [] [] [] | 12
|
||||
make | [] [] [] [] | 14
|
||||
man-db | | 3
|
||||
mysecretdiary | [] [] [] | 7
|
||||
nano | [] [] [] [] | 15
|
||||
nano_1_0 | [] [] [] [] | 14
|
||||
opcodes | [] [] | 7
|
||||
parted | [] [] [] | 11
|
||||
ptx | [] [] [] [] [] [] [] | 19
|
||||
python | | 0
|
||||
recode | [] [] [] [] [] [] | 15
|
||||
sed | [] [] [] [] [] [] | 23
|
||||
sh-utils | [] | 8
|
||||
sharutils | [] [] [] [] | 13
|
||||
sketch | [] () [] | 4
|
||||
soundtracker | [] | 6
|
||||
sp | | 1
|
||||
tar | [] [] [] [] [] [] [] | 18
|
||||
texinfo | [] [] | 10
|
||||
textutils | [] [] [] [] [] | 13
|
||||
util-linux | [] [] [] | 10
|
||||
vorbis-tools | [] | 2
|
||||
wastesedge | | 0
|
||||
wdiff | [] [] [] [] [] | 14
|
||||
wget | [] [] [] [] [] [] [] [] | 24
|
||||
+----------------------------------------+
|
||||
36 teams no pl pt pt_BR ru sk sl sv tr uk zh_TW
|
||||
67 domains 4 15 2 24 26 12 10 47 42 4 8 594
|
||||
ko lg lt lv ms nb nl nn no pl pt pt_BR ro
|
||||
+-------------------------------------------+
|
||||
a2ps | () [] [] () () [] [] |
|
||||
aegis | () () |
|
||||
ant-phone | [] [] |
|
||||
anubis | [] [] [] [] [] |
|
||||
ap-utils | [] () [] |
|
||||
bash | [] [] |
|
||||
batchelor | [] |
|
||||
bfd | [] |
|
||||
binutils | |
|
||||
bison | [] [] [] [] |
|
||||
bluez-pin | [] [] [] |
|
||||
clisp | |
|
||||
clisp | [] |
|
||||
coreutils | [] |
|
||||
cpio | [] [] [] [] [] |
|
||||
darkstat | [] [] [] [] |
|
||||
diffutils | [] [] [] [] |
|
||||
e2fsprogs | [] |
|
||||
enscript | [] [] [] |
|
||||
error | [] [] [] |
|
||||
fetchmail | [] [] () |
|
||||
fileutils | [] [] |
|
||||
findutils | [] [] [] [] [] |
|
||||
flex | [] [] [] [] |
|
||||
fslint | [] [] |
|
||||
gas | |
|
||||
gawk | [] [] [] |
|
||||
gbiff | [] [] |
|
||||
gcal | |
|
||||
gcc | |
|
||||
gettext | [] [] [] |
|
||||
gettext-examples | [] [] |
|
||||
gettext-runtime | [] [] [] |
|
||||
gettext-tools | [] [] [] |
|
||||
gimp-print | [] |
|
||||
gliv | [] [] [] |
|
||||
glunarclock | [] [] [] |
|
||||
gnubiff | |
|
||||
gnucash | [] [] () |
|
||||
gnucash-glossary | [] [] |
|
||||
gnupg | [] |
|
||||
gpe-aerial | [] [] [] |
|
||||
gpe-beam | [] [] [] |
|
||||
gpe-calendar | [] [] [] |
|
||||
gpe-clock | [] [] [] |
|
||||
gpe-conf | [] [] [] |
|
||||
gpe-contacts | [] [] [] |
|
||||
gpe-edit | [] [] [] |
|
||||
gpe-go | [] [] |
|
||||
gpe-login | [] [] [] |
|
||||
gpe-ownerinfo | [] [] [] |
|
||||
gpe-sketchbook | [] [] [] |
|
||||
gpe-su | [] [] [] |
|
||||
gpe-taskmanager | [] [] [] |
|
||||
gpe-timesheet | [] [] [] |
|
||||
gpe-today | [] [] [] |
|
||||
gpe-todo | [] [] [] |
|
||||
gphoto2 | [] |
|
||||
gprof | [] [] |
|
||||
gpsdrive | () () () [] |
|
||||
gramadoir | [] |
|
||||
grep | [] [] [] [] |
|
||||
gretl | |
|
||||
gtick | [] [] |
|
||||
hello | [] [] [] [] [] [] [] [] [] [] |
|
||||
id-utils | [] [] [] |
|
||||
indent | [] [] [] |
|
||||
jpilot | () () |
|
||||
jtag | |
|
||||
jwhois | [] [] [] [] |
|
||||
kbd | [] [] [] |
|
||||
latrine | [] |
|
||||
ld | |
|
||||
libc | [] [] [] [] [] |
|
||||
libgpewidget | [] [] [] |
|
||||
libiconv | [] [] [] [] |
|
||||
lifelines | |
|
||||
lilypond | |
|
||||
lingoteach | |
|
||||
lingoteach_lessons | |
|
||||
lynx | [] [] |
|
||||
m4 | [] [] [] [] |
|
||||
mailutils | [] [] |
|
||||
make | [] [] [] [] |
|
||||
man-db | [] |
|
||||
minicom | [] [] [] |
|
||||
mysecretdiary | [] [] [] |
|
||||
nano | [] [] [] [] |
|
||||
nano_1_0 | [] [] [] [] [] |
|
||||
opcodes | [] [] |
|
||||
parted | [] [] [] [] |
|
||||
ptx | [] [] [] [] [] [] [] |
|
||||
python | |
|
||||
radius | [] |
|
||||
recode | [] [] [] |
|
||||
rpm | [] [] |
|
||||
screem | |
|
||||
scrollkeeper | [] [] [] [] |
|
||||
sed | [] [] [] |
|
||||
sh-utils | [] |
|
||||
shared-mime-info | [] |
|
||||
sharutils | [] |
|
||||
silky | |
|
||||
skencil | [] [] |
|
||||
sketch | [] [] |
|
||||
soundtracker | |
|
||||
sp | |
|
||||
tar | [] [] [] [] [] [] |
|
||||
texinfo | [] [] [] |
|
||||
textutils | [] [] |
|
||||
tin | |
|
||||
tuxpaint | [] [] [] [] [] [] [] [] [] |
|
||||
util-linux | [] [] |
|
||||
vorbis-tools | [] [] |
|
||||
wastesedge | |
|
||||
wdiff | [] [] [] [] |
|
||||
wget | [] [] |
|
||||
xchat | [] [] |
|
||||
xfree86_xkb_xml | [] |
|
||||
xpad | [] [] |
|
||||
+-------------------------------------------+
|
||||
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
|
||||
aegis | () | 0
|
||||
ant-phone | | 2
|
||||
anubis | [] [] [] | 9
|
||||
ap-utils | () | 3
|
||||
bash | [] | 9
|
||||
batchelor | | 2
|
||||
bfd | [] [] | 6
|
||||
binutils | [] [] [] | 7
|
||||
bison | [] [] [] | 14
|
||||
bluez-pin | [] [] [] | 13
|
||||
clisp | | 0
|
||||
clisp | | 5
|
||||
coreutils | [] [] [] [] [] | 16
|
||||
cpio | [] [] [] | 14
|
||||
darkstat | [] [] [] () () | 12
|
||||
diffutils | [] [] [] [] | 22
|
||||
e2fsprogs | [] [] | 5
|
||||
enscript | [] [] [] | 12
|
||||
error | [] [] [] | 15
|
||||
fetchmail | [] [] [] | 11
|
||||
fileutils | [] [] [] [] [] [] | 17
|
||||
findutils | [] [] [] [] [] [] [] | 29
|
||||
flex | [] [] [] | 13
|
||||
fslint | | 2
|
||||
gas | [] | 3
|
||||
gawk | [] [] | 12
|
||||
gbiff | | 3
|
||||
gcal | [] [] | 4
|
||||
gcc | [] | 4
|
||||
gettext | [] [] [] [] [] [] | 16
|
||||
gettext-examples | [] [] [] [] | 11
|
||||
gettext-runtime | [] [] [] [] [] [] [] [] [] | 21
|
||||
gettext-tools | [] [] [] [] [] [] | 14
|
||||
gimp-print | [] [] | 10
|
||||
gliv | | 3
|
||||
glunarclock | [] [] [] [] | 13
|
||||
gnubiff | | 1
|
||||
gnucash | [] [] [] | 9
|
||||
gnucash-glossary | [] [] [] | 8
|
||||
gnupg | [] [] [] [] | 17
|
||||
gpe-aerial | [] [] | 7
|
||||
gpe-beam | [] [] | 8
|
||||
gpe-calendar | [] [] [] [] [] | 13
|
||||
gpe-clock | [] [] [] [] | 10
|
||||
gpe-conf | [] [] [] | 9
|
||||
gpe-contacts | [] [] [] [] | 11
|
||||
gpe-edit | [] [] [] [] [] [] | 12
|
||||
gpe-go | [] | 5
|
||||
gpe-login | [] [] [] [] [] [] | 13
|
||||
gpe-ownerinfo | [] [] [] [] [] | 13
|
||||
gpe-sketchbook | [] [] [] | 9
|
||||
gpe-su | [] [] [] [] | 10
|
||||
gpe-taskmanager | [] [] [] [] | 10
|
||||
gpe-timesheet | [] [] [] [] [] | 12
|
||||
gpe-today | [] [] [] [] [] [] | 13
|
||||
gpe-todo | [] [] [] [] [] | 12
|
||||
gphoto2 | [] [] [] | 11
|
||||
gprof | [] [] | 9
|
||||
gpsdrive | [] [] | 4
|
||||
gramadoir | | 3
|
||||
grep | [] [] [] [] [] | 26
|
||||
gretl | | 2
|
||||
gtick | [] | 5
|
||||
hello | [] [] [] [] [] | 33
|
||||
id-utils | [] [] [] | 12
|
||||
indent | [] [] [] [] [] | 21
|
||||
jpilot | [] [] [] [] [] | 9
|
||||
jtag | [] | 1
|
||||
jwhois | () () [] [] | 11
|
||||
kbd | [] [] | 11
|
||||
latrine | | 1
|
||||
ld | [] [] | 5
|
||||
libc | [] [] [] [] | 20
|
||||
libgpewidget | [] [] [] [] | 13
|
||||
libiconv | [] [] [] [] [] [] [] [] [] | 27
|
||||
lifelines | [] | 2
|
||||
lilypond | [] | 3
|
||||
lingoteach | | 2
|
||||
lingoteach_lessons | () | 0
|
||||
lynx | [] [] [] [] | 14
|
||||
m4 | [] [] [] | 15
|
||||
mailutils | [] | 5
|
||||
make | [] [] [] [] | 16
|
||||
man-db | [] | 5
|
||||
minicom | [] | 11
|
||||
mysecretdiary | [] [] | 10
|
||||
nano | [] [] [] [] [] | 17
|
||||
nano_1_0 | [] [] [] [] | 17
|
||||
opcodes | [] [] | 6
|
||||
parted | [] [] [] | 15
|
||||
ptx | [] [] [] | 22
|
||||
python | | 0
|
||||
radius | [] | 4
|
||||
recode | [] [] [] [] | 20
|
||||
rpm | [] [] [] | 7
|
||||
screem | [] [] | 2
|
||||
scrollkeeper | [] [] [] [] | 15
|
||||
sed | [] [] [] [] [] [] | 23
|
||||
sh-utils | [] [] [] | 14
|
||||
shared-mime-info | [] [] | 4
|
||||
sharutils | [] [] [] [] [] | 17
|
||||
silky | () | 2
|
||||
skencil | [] | 6
|
||||
sketch | [] | 6
|
||||
soundtracker | [] [] | 9
|
||||
sp | [] | 3
|
||||
tar | [] [] [] [] [] | 24
|
||||
texinfo | [] [] [] [] | 14
|
||||
textutils | [] [] [] [] [] | 16
|
||||
tin | | 1
|
||||
tuxpaint | [] [] [] [] [] | 29
|
||||
util-linux | [] [] [] | 15
|
||||
vorbis-tools | [] | 8
|
||||
wastesedge | | 0
|
||||
wdiff | [] [] [] [] | 18
|
||||
wget | [] [] [] [] [] [] [] [] | 23
|
||||
xchat | [] [] [] [] [] | 14
|
||||
xfree86_xkb_xml | [] [] [] [] [] [] | 8
|
||||
xpad | | 4
|
||||
+-------------------------------------------+
|
||||
51 teams ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW
|
||||
120 domains 59 42 16 25 81 0 56 12 1 10 21 22 1260
|
||||
|
||||
Some counters in the preceding matrix are higher than the number of
|
||||
visible blocks let us expect. This is because a few extra PO files are
|
||||
@ -406,15 +691,15 @@ distributed as such by its maintainer. There might be an observable
|
||||
lag between the mere existence a PO file and its wide availability in a
|
||||
distribution.
|
||||
|
||||
If July 2002 seems to be old, you may fetch a more recent copy of
|
||||
this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date
|
||||
matrix with full percentage details can be found at
|
||||
If December 2003 seems to be old, you may fetch a more recent copy
|
||||
of this `ABOUT-NLS' file on most GNU archive sites. The most
|
||||
up-to-date matrix with full percentage details can be found at
|
||||
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
|
||||
|
||||
Using `gettext' in new packages
|
||||
===============================
|
||||
|
||||
If you are writing a freely available program and want to
|
||||
If you are writing a freely available program and want to
|
||||
internationalize it you are welcome to use GNU `gettext' in your
|
||||
package. Of course you have to respect the GNU Library General Public
|
||||
License which covers the use of the GNU `gettext' library. This means
|
||||
@ -423,7 +708,7 @@ library, whereas only free software can use `libintl' as a static
|
||||
library or use modified versions of `libintl'.
|
||||
|
||||
Once the sources are changed appropriately and the setup can handle
|
||||
to use of `gettext' the only thing missing are the translations. The
|
||||
the use of `gettext' the only thing missing are the translations. The
|
||||
Free Translation Project is also available for packages which are not
|
||||
developed inside the GNU project. Therefore the information given above
|
||||
applies also for every other Free Software Project. Contact
|
||||
|
@ -1,10 +1,86 @@
|
||||
Authors of parts of GNU textutils.
|
||||
Here are the names of the programs in this package,
|
||||
each followed by the name(s) of its author(s).
|
||||
|
||||
The following contributions warranted legal paper exchanges with the
|
||||
Free Software Foundation. Also see files ChangeLog and THANKS.
|
||||
|
||||
GPTX François Pinard CANADA, 1949
|
||||
Assigns the program.
|
||||
|
||||
GPTX Odyssee Recherches Appliquees
|
||||
Disclaims work by François Pinard
|
||||
basename: FIXME unknown
|
||||
cat: Torbjorn Granlund and Richard M. Stallman
|
||||
chgrp: David MacKenzie
|
||||
chmod: David MacKenzie
|
||||
chown: David MacKenzie
|
||||
chroot: Roland McGrath
|
||||
cksum: Q. Frank Xia
|
||||
comm: Richard Stallman and David MacKenzie
|
||||
cp: Torbjorn Granlund, David MacKenzie, and Jim Meyering
|
||||
csplit: Stuart Kemp and David MacKenzie
|
||||
cut: David Ihnat, David MacKenzie, and Jim Meyering
|
||||
date: David MacKenzie
|
||||
dd: Paul Rubin, David MacKenzie, and Stuart Kemp
|
||||
df: Torbjorn Granlund, David MacKenzie, Larry McVoy, and Paul Eggert
|
||||
dircolors: H. Peter Anvin
|
||||
dirname: David MacKenzie and Jim Meyering
|
||||
du: Torbjorn Granlund, David MacKenzie, Larry McVoy, and Paul Eggert
|
||||
echo: FIXME unknown
|
||||
env: Richard Mlynarik and David MacKenzie
|
||||
expand: David MacKenzie
|
||||
expr: Mike Parker
|
||||
factor: Paul Rubin
|
||||
false: no one
|
||||
fmt: Ross Paterson
|
||||
fold: David MacKenzie
|
||||
head: David MacKenzie
|
||||
hostid: Jim Meyering
|
||||
hostname: Jim Meyering
|
||||
id: Arnold Robbins and David MacKenzie
|
||||
install: David MacKenzie
|
||||
join: Mike Haertel
|
||||
kill: Paul Eggert
|
||||
link: Michael Stone
|
||||
ln: Mike Parker and David MacKenzie
|
||||
logname: FIXME: unknown
|
||||
ls: Richard Stallman and David MacKenzie
|
||||
md5sum: Ulrich Drepper and Scott Miller
|
||||
mkdir: David MacKenzie
|
||||
mkfifo: David MacKenzie
|
||||
mknod: David MacKenzie
|
||||
mv: Mike Parker, David MacKenzie, and Jim Meyering
|
||||
nice: David MacKenzie
|
||||
nl: Scott Bartram and David MacKenzie
|
||||
od: Jim Meyering
|
||||
paste: David M. Ihnat and David MacKenzie
|
||||
pathchk: David MacKenzie and Jim Meyering
|
||||
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
|
||||
pwd: Jim Meyering
|
||||
rm: Paul Rubin, David MacKenzie, Richard Stallman, and Jim Meyering
|
||||
rmdir: David MacKenzie
|
||||
seq: Ulrich Drepper
|
||||
shred: Colin Plumb
|
||||
sleep: Jim Meyering and Paul Eggert
|
||||
sort: Mike Haertel and Paul Eggert
|
||||
split: Torbjorn Granlund and Richard M. Stallman
|
||||
stat: Michael Meskes
|
||||
stty: David MacKenzie
|
||||
su: David MacKenzie
|
||||
sum: Kayvan Aghaiepour and David MacKenzie
|
||||
sync: Jim Meyering
|
||||
tac: Jay Lepreau and David MacKenzie
|
||||
tail: Paul Rubin, David MacKenzie, Ian Lance Taylor, and Jim Meyering
|
||||
tee: Mike Parker, Richard M. Stallman, and David MacKenzie
|
||||
test: FIXME: ksb and mjb
|
||||
touch: Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, and Randy Smith
|
||||
tr: Jim Meyering
|
||||
true: no one
|
||||
tsort: Mark Kettenis
|
||||
tty: David MacKenzie
|
||||
uname: David MacKenzie
|
||||
unexpand: David MacKenzie
|
||||
uniq: Richard Stallman and David MacKenzie
|
||||
unlink: Michael Stone
|
||||
uptime: Joseph Arceneaux, David MacKenzie, and Kaveh Ghazi
|
||||
users: Joseph Arceneaux and David MacKenzie
|
||||
wc: Paul Rubin and David MacKenzie
|
||||
who: Joseph Arceneaux, David MacKenzie, and Michael Stone
|
||||
whoami: Richard Mlynarik
|
||||
yes: David MacKenzie
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
Copyright 1994, 1995, 1996, 1999, 2000, 2001 Free Software Foundation,
|
||||
Inc.
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
@ -71,8 +71,9 @@ Compilers and Options
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for variables by setting
|
||||
them in the environment. You can do that on the command line like this:
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||
|
||||
@ -137,9 +138,10 @@ Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the host type, give it the
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
@ -151,20 +153,16 @@ where SYSTEM can have one of these forms:
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the host
|
||||
platform (i.e., that on which the generated programs will eventually be
|
||||
run) with `--host=TYPE'. In this case, you should also specify the
|
||||
build platform with `--build=TYPE', because, in this case, it may not
|
||||
be possible to guess the build platform (it sometimes involves
|
||||
compiling and running simple test programs, and this can't be done if
|
||||
the compiler is a cross compiler).
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,41 +1,147 @@
|
||||
These are the GNU text file (actually, file contents) processing
|
||||
utilities. Most of these programs have significant advantages over
|
||||
their Unix counterparts, such as greater speed, additional options,
|
||||
and fewer arbitrary limits.
|
||||
These are the GNU core utilities. This package is the union of
|
||||
the GNU fileutils, sh-utils, and textutils packages.
|
||||
|
||||
The programs that can be built with this package are: cat, cksum, comm,
|
||||
csplit, cut, expand, fmt, fold, head, join, md5sum, nl, od, paste, pr, ptx
|
||||
sha1sum, sort, split, sum, tac, tail, tr, tsort, unexpand, uniq, and wc.
|
||||
Most of these programs have significant advantages over their Unix
|
||||
counterparts, such as greater speed, additional options, and fewer
|
||||
arbitrary limits.
|
||||
|
||||
The programs that can be built with this package are:
|
||||
|
||||
[ basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd
|
||||
df dir dircolors dirname du echo env expand expr factor false fmt fold
|
||||
ginstall groups head hostid hostname id join kill link ln logname ls
|
||||
md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr
|
||||
printenv printf ptx pwd readlink rm rmdir seq sha1sum shred sleep sort
|
||||
split stat stty su sum sync tac tail tee test touch tr true tsort tty
|
||||
uname unexpand uniq unlink uptime users vdir wc who whoami yes
|
||||
|
||||
See the file NEWS for a list of major changes in the current release.
|
||||
|
||||
See the file INSTALL for compilation and installation instructions.
|
||||
|
||||
I M P O R T A N T:
|
||||
These programs are intended to conform to POSIX (with BSD and other
|
||||
extensions), like the rest of the GNU system. By default they conform
|
||||
to older POSIX (1003.2-1992), and therefore support obsolete usages
|
||||
like "head -10" and "chown owner.group file". This default is
|
||||
overridden at build-time by the value of <unistd.h>'s _POSIX2_VERSION
|
||||
macro, and this in turn can be overridden at runtime as described in
|
||||
the documentation under "Standards conformance".
|
||||
|
||||
Some Cray C compilers lack support for a 32-bit arithmetic type.
|
||||
Since gettext requires such a type, you should use the --disable-nls
|
||||
option when invoking configure on such systems.
|
||||
The ls, dir, and vdir commands are all separate executables instead of
|
||||
one program that checks argv[0] because people often rename these
|
||||
programs to things like gls, gnuls, l, etc. Renaming a program
|
||||
file shouldn't affect how it operates, so that people can get the
|
||||
behavior they want with whatever name they want.
|
||||
|
||||
The textutils are intended to be POSIX.2 compliant (with BSD and other
|
||||
extensions), like the rest of the GNU system. They are almost there,
|
||||
but a few incompatibilities remain.
|
||||
Special thanks to Paul Eggert, Brian Matthews, Bruce Evans, Karl Berry,
|
||||
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.
|
||||
|
||||
Note that the man pages are now automatically generated from templates
|
||||
and from the --help usage message. Patches to the template files (man/*.x)
|
||||
are welcome. However, the authoritative documentation is in texinfo form
|
||||
in the doc directory.
|
||||
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,
|
||||
Joel N. Weber, Mark D. Roth, Matt Schalit, Nelson H. F. Beebe,
|
||||
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
|
||||
that distribution and found and reported bugs.
|
||||
|
||||
Note that each man page is now automatically generated from a template
|
||||
and from the corresponding --help usage message. Patches to the template
|
||||
files (man/*.x) are welcome. However, the authoritative documentation
|
||||
is in texinfo form in the doc directory.
|
||||
|
||||
If you run the tests on a SunOS4.1.4 system, expect the ctime-part of
|
||||
the ls `time-1' test to fail. I believe that is due to a bug in the
|
||||
way Sun implemented link(2) and chmod(2).
|
||||
|
||||
***************************************
|
||||
Last-minute notes, before coreutils-5.0
|
||||
---------------------------------------
|
||||
|
||||
A known problem exists when compiling on HPUX on both hppa and ia64
|
||||
in 64-bit mode (i.e. +DD64) on all known HPUX 11.x versions. This
|
||||
is not due to a bug in the package but instead due to a bug in the
|
||||
system header file which breaks things in 64-bit mode. The default
|
||||
compilation mode is 32-bit and the software compiles fine using the
|
||||
default mode. To build this software in 64-bit mode you will need
|
||||
to fix the system /usr/include/inttypes.h header file. After
|
||||
correcting that file the software also compiles fine in 64-bit mode.
|
||||
Here is one possible patch to correct the problem.
|
||||
|
||||
--- /usr/include/inttypes.h.orig Thu May 30 01:00:00 1996
|
||||
+++ /usr/include/inttypes.h Sun Mar 23 00:20:36 2003
|
||||
@@ -489 +489 @@
|
||||
-#ifndef __STDC_32_MODE__
|
||||
+#ifndef __LP64__
|
||||
|
||||
If you run the tests as root, note that a few of them create files
|
||||
and/or run programs as a non-root user, `nobody' by default.
|
||||
If you want to use some other non-root username, specify it via
|
||||
the NON_ROOT_USERNAME environment variable. Depending on the
|
||||
permissions with which the working directories have been created,
|
||||
using `nobody' may fail, because that user won't have the required
|
||||
read and write access to the build and test directories.
|
||||
I find that it is best to unpack and build as a non-privileged
|
||||
user, and then to run the following command as that user in order
|
||||
to run the privilege-requiring tests:
|
||||
|
||||
sudo env NON_ROOT_USERNAME=$USER make check
|
||||
|
||||
If you can run the tests as root, please do so and report any
|
||||
problems. We get much less test coverage in that mode, and it's
|
||||
arguably more important that these tools work well when run by
|
||||
root than when run by less privileged users.
|
||||
|
||||
***************************************
|
||||
|
||||
There are pretty many tests, but nowhere near as many as we need.
|
||||
Additions and corrections are very welcome.
|
||||
|
||||
If you see a problem that you've already reported, feel free to re-report
|
||||
it -- it won't bother me to get a reminder. Besides, the more messages I
|
||||
get regarding a particular problem the sooner it'll be fixed -- usually.
|
||||
If you sent a complete patch and, after a couple weeks you haven't
|
||||
received any acknowledgement, please ping us. A complete patch includes
|
||||
a well-written ChangeLog entry, unified (diff -u format) diffs relative
|
||||
to the most recent test release (or, better, relative to the latest
|
||||
sources in the CVS repository), an explanation for why the patch is
|
||||
necessary or useful, and if at all possible, enough information to
|
||||
reproduce whatever problem prompted it. Plus, you'll earn lots of
|
||||
karma if you include a test case to exercise any bug(s) you fix.
|
||||
Instructions for checking out the latest source via CVS are here:
|
||||
|
||||
http://savannah.gnu.org/cvs/?group=coreutils
|
||||
|
||||
|
||||
If your patch adds a new feature, please try to get some sort of consensus
|
||||
that it is a worthwhile change. One way to do that is to send mail to
|
||||
bug-coreutils@gnu.org including as much description and justification
|
||||
as you can. Based on the feedback that generates, you may be able to
|
||||
convince us that it's worth adding.
|
||||
|
||||
|
||||
WARNING: If you modify files like configure.in, m4/*.m4, aclocal.m4,
|
||||
or any Makefile.am, then don't be surprised if what gets regenerated no
|
||||
longer works. To make things work, you'll have to be using appropriate
|
||||
versions of automake and autoconf. As for what versions are `appropriate',
|
||||
use the versions of
|
||||
|
||||
* autoconf specified via AC_PREREQ in m4/jm-macros.m4
|
||||
* automake specified via AM_INIT_AUTOMAKE in configure.ac
|
||||
|
||||
Usually it's fine to use versions that are newer than those specified.
|
||||
|
||||
These programs all recognize the `--version' option. When reporting
|
||||
bugs, please include in the subject line both the package name/version
|
||||
and the name of the program for which you found a problem.
|
||||
|
||||
For general documentation on the coding and usage standards
|
||||
this distribution follows, see the GNU standards document
|
||||
http://www.gnu.org/prep/standards.html, and the documentation
|
||||
for automake and autoconf:
|
||||
http://www.gnu.org/software/autoconf/autoconf.html,
|
||||
http://www.gnu.org/software/automake/automake.html.
|
||||
this distribution follows, see the GNU Coding Standards,
|
||||
http://www.gnu.org/prep/standards_toc.html.
|
||||
|
||||
Mail suggestions and bug reports for these programs to
|
||||
bug-textutils@gnu.org.
|
||||
the address on the last line of --help output.
|
||||
|
@ -1,11 +1,12 @@
|
||||
These people have contributed to the GNU fileutils, textutils,
|
||||
and/or sh-utils packages. Some have reported problems, others have
|
||||
contributed improvements to the documentation, actual code, and even
|
||||
These people have contributed to the GNU coreutils (formerly, the fileutils,
|
||||
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.
|
||||
Some old names and addresses are still in the ChangeLog.
|
||||
|
||||
??? kytek@cybercomm.net
|
||||
A Costa agcosta@gis.net
|
||||
Achim Blumensath blume@corona.oche.de
|
||||
Adam Klein aklein@debian.org
|
||||
Akim Demaille demaille@inf.enst.fr
|
||||
@ -18,6 +19,7 @@ aldomel aldomel@ix.netcom.com
|
||||
Alen Muzinic zveki@fly.cc.fer.hr
|
||||
Alexandre Duret-Lutz duret_g@epita.fr
|
||||
Alexey Solovyov alekso@math.uu.se
|
||||
Alexey Vyskubov alexey@pippuri.mawhrin.net
|
||||
Alfred M. Szmidt ams@kemisten.nu
|
||||
Andi Kleen freitag@alancoxonachip.com
|
||||
Andre Novaes Cunha Andre.Cunha@br.global-one.net
|
||||
@ -26,25 +28,37 @@ Andreas Jaeger jaeger@gnu.org
|
||||
Andreas Luik luik@isa.de
|
||||
Andreas Schwab schwab@suse.de
|
||||
Andreas Stolcke stolcke@ICSI.Berkeley.EDU
|
||||
Andrei Gaponenko andr@triumf.ca
|
||||
Andres Soolo andres@soolo.matti.ee
|
||||
Andrew Burgess aab@cichlid.com
|
||||
Andrew Dalke dalke@bioreason.com
|
||||
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
|
||||
Antonio Rendas ajrendas@yahoo.com
|
||||
Ariel Faigon ariel@cthulhu.engr.sgi.com
|
||||
Arne H. Juul arnej@solan.unit.no
|
||||
Arne Henrik Juul arnej@imf.unit.no
|
||||
Arnold Robbins arnold@skeeve.com
|
||||
Arthur Pool pool@commerce.uq.edu.au
|
||||
Arun Sharma arun.sharma@intel.com
|
||||
Arvind Autar Autar022@planet.nl
|
||||
Augey Mikus mikus@dqc.org
|
||||
Austin Donnelly Austin.Donnelly@cl.cam.ac.uk
|
||||
Axel Kittenberger Anshil@gmx.net
|
||||
Bauke Jan Douma bjdouma@xs4all.nl
|
||||
Ben Elliston bje@air.net.au
|
||||
Ben Harris bjh21@netbsd.org
|
||||
Bengt Martensson bengt@mathematik.uni-Bremen.de
|
||||
Bernard Giroud bernard.giroud@creditlyonnais.ch
|
||||
Bernd Leibing bernd.leibing@rz.uni-ulm.de
|
||||
Bernd Melchers melchers@cis.fu-berlin.de
|
||||
Bernhard Baehr bernhard.baehr@gmx.de
|
||||
Bernhard Gabler bernhard@uni-koblenz.de
|
||||
Bernhard Rosenkraenzer bero@redhat.de
|
||||
Bert Deknuydt Bert.Deknuydt@esat.kuleuven.ac.be
|
||||
Bill Peters peters@gaffel.as.arizona.edu
|
||||
Bjorn Helgaas helgaas@rsn.hp.com
|
||||
Bob McCracken kerouac@ravenet.com
|
||||
@ -53,6 +67,8 @@ Branden Robinson branden@necrotic.deadbeast.net
|
||||
Brendan O'Dea bod@compusol.com.au
|
||||
Brian Kimball bfk@footbag.org
|
||||
Brian Youmans 3diff@gnu.org
|
||||
Bruce Korb bkorb@veritas.com
|
||||
Bruce Robertson brucer@theodolite.dyndns.org
|
||||
Bruno Haible haible@clisp.cons.org
|
||||
Carl Johnson carlj@cjlinux.home.org
|
||||
Carl Lowenstein cdl@mpl.UCSD.EDU
|
||||
@ -62,6 +78,7 @@ Charles Randall crandall@matchlogic.com
|
||||
Chip Salzenberg chip@valinux.com
|
||||
Chris Faylor cgf@cygnus.com
|
||||
Chris J. Bednar cjb@AdvancedDataSolutions.com
|
||||
Chris Lesniewski ctl@mit.edu
|
||||
Chris Sylvain csylvain@umm.edu
|
||||
Chris Yeo cyeo@biking.org
|
||||
Christi Alice Scarborough christi@chiark.greenend.org.uk
|
||||
@ -71,29 +88,41 @@ Christian Rose menthos@menthos.com
|
||||
Christian von Roques roques@pond.sub.org
|
||||
Chuck Hedrick hedrick@klinzhai.rutgers.edu
|
||||
Clark Morgan cmorgan@aracnet.com
|
||||
Clement Wang clem.wang@overture.com
|
||||
Colin Plumb colin@nyx.net
|
||||
Colin Watson cjw44@riva.ucam.org
|
||||
Collin Rogowski collin@rogowski.de
|
||||
Cray-Cyber Project http://www.cray-cyber.org
|
||||
Dale Scheetz dwarf@polaris.net
|
||||
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
|
||||
Danny Levinson danny.levinson@overture.com
|
||||
Darren Salt ds@youmustbejoking.demon.co.uk
|
||||
Dave Beckett dajobe@dajobe.org
|
||||
David Dyck dcd@tc.fluke.COM
|
||||
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
|
||||
Deepak Goel deego@gnufans.org
|
||||
Dennis Henriksen opus@flamingo.osrl.dk
|
||||
Dennis Smit ds@nerds-incorporated.org
|
||||
Derek Clegg dclegg@next.com
|
||||
Dick Streefland dick_streefland@tasking.com
|
||||
Dirk Lattermann dlatt@t-online.de
|
||||
Dirk-Jan Faber djfaber@snow.nl
|
||||
Dan Jacobson http://www.geocities.com/jidani
|
||||
Dmitry Rutsky rutsky@school.ioffe.rssi.ru
|
||||
Dmitry V. Levin ldv@altlinux.org
|
||||
Don Parsons dparsons@synapse.kent.edu
|
||||
Donni Erpel donald@appc11.gsi.de
|
||||
Doug Coleman coleman@iarc1.ece.utexas.edu
|
||||
Doug McLaren dougmc@comco.com
|
||||
Dragos Harabor dharabor@us.oracle.com
|
||||
Ed Avis epa98@doc.ic.ac.uk
|
||||
Duncan Roe duncanr@optimation.com.au
|
||||
Ed Avis ed@membled.com
|
||||
Edzer Pebesma Edzer.Pebesma@rivm.nl
|
||||
Eirik Fuller eirik@hackrat.com
|
||||
Eivind eivindt@multinet.no
|
||||
@ -106,34 +135,41 @@ Eric S. Raymond esr@snark.thyrsus.com
|
||||
Erik Bennett bennett@cvo.oneworld.com
|
||||
Erik Corry erik@kroete2.freinet.de
|
||||
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
|
||||
Frank Adler fadler@allesklar.de
|
||||
Frank T Lofaro ftlofaro@snooks.Egr.UNLV.EDU
|
||||
François Pinard pinard@iro.umontreal.ca
|
||||
Fred Fish fnf@ninemoons.com
|
||||
Frederik Eaton frederik@caltech.edu
|
||||
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
|
||||
Galen Hazelwood galenh@micron.net
|
||||
Gary Anderson ganderson@clark.net
|
||||
Gary V. Vaughan gary@gnu.org
|
||||
Gaute Hvoslef Kvalnes gaute@verdsveven.com
|
||||
Gaël Quéri gqueri@mail.dotcom.fr
|
||||
Geoff Collyer geoff at collyer.net
|
||||
Geoff Kuenning geoff@cs.hmc.edu
|
||||
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
|
||||
GOTO Masanori gotom@debian.or.jp
|
||||
Greg Louis glouis@dynamicro.on.ca
|
||||
Greg McGary gkm@gnu.org
|
||||
Greg Schafer gschafer@zip.com.au
|
||||
Greg Troxel gdt@bbn.com
|
||||
Greg Wooledge gawooledge@sherwin.com
|
||||
Gregory Leblanc gleblanc@cu-portland.edu
|
||||
Göran Uddeborg goeran@uddeborg.pp.se
|
||||
H. J. Lu hjl@valinux.com
|
||||
Hans Ginzel hans@matfyz.cz
|
||||
Hans Lermen lermen@fgan.de
|
||||
Hans Verkuil hans@wyst.hobby.nl
|
||||
Harry Liu rliu@lek.ugcs.caltech.edu
|
||||
Harti Brandt brandt@fokus.fraunhofer.de
|
||||
Herbert Xu herbert@gondor.apana.org.au
|
||||
Holger Berger hberger@ess.nec.de
|
||||
Hon-Yin Kok hkok@yoda.unl.edu
|
||||
@ -143,6 +179,8 @@ Ian Jackson ijackson@chiark.greenend.org.uk
|
||||
Ian Lance Taylor ian@cygnus.com
|
||||
Ian Turner vectro@pipeline.com
|
||||
Iida Yosiaki iida@gnu.org
|
||||
Ingo Saitz ingo@debian.org
|
||||
Ivo Timmermans ivo@debian.org
|
||||
James james@albion.glarp.com
|
||||
James Antill jmanti%essex.ac.uk@seralph21.essex.ac.uk
|
||||
James Sneeringer jvs@ocslink.com
|
||||
@ -153,17 +191,20 @@ Jan Fedak J.Fedak@sh.cvut.cz
|
||||
Jan Nieuwenhuizen janneke@gnu.org
|
||||
Janos Farkas chexum@shadow.banki.hu
|
||||
Jarkko Hietaniemi jhi@epsilon.hut.fi
|
||||
Jean Charles Delepine delepine@u-picardie.fr
|
||||
Jeff Moore jbm@mordor.com
|
||||
Jeff Sheinberg jeffsh@erols.com
|
||||
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
|
||||
Jesse Thilo jgt2@eecs.lehigh.edu
|
||||
Jie Xu xuj@iag.net
|
||||
Jim Blandy jimb@cyclic.com
|
||||
Jim Dennis jimd@starshine.org
|
||||
Joakim Rosqvist dvljrt@cs.umu.se
|
||||
Jochen Hein jochen@jochen.org
|
||||
Joe Orton joe@orton.demon.co.uk
|
||||
Joe Orton joe@manyfish.co.uk
|
||||
Johan Danielsson joda@pdc.kth.se
|
||||
John Bley jbb6@acpub.duke.edu
|
||||
John David Anglin dave.anglin@nrc.ca
|
||||
@ -181,27 +222,32 @@ 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
|
||||
Jurriaan thunder7@xs4all.nl
|
||||
jvogel jvogel@linkny.com
|
||||
Kai-Uwe Rommel rommel@informatik.tu-muenchen.de
|
||||
Kai Henningsen kai@debian.org
|
||||
Kalle Olavi Niemitalo tosi@stekt.oulu.fi
|
||||
Kai-Uwe Rommel rommel@informatik.tu-muenchen.de
|
||||
Kalle Olavi Niemitalo kon@iki.fi
|
||||
Kamal Paul Nigam Kamal_Paul_Nigam@gs35.sp.cs.cmu.edu
|
||||
Karl Eichwalder keichwa@gmx.net
|
||||
Karl Heuer kwzh@gnu.org
|
||||
Karl-Michael Schneider schneide@phil.uni-passau.de
|
||||
Karsten Thygesen karthy@kom.auc.dk
|
||||
Kaveh R. Ghazi ghazi@caip.rutgers.edu
|
||||
Keith M. Briggs keith.briggs@bt.com
|
||||
Keith Owens kaos@audio.apana.org.au
|
||||
Keith Thompson kst@sdsc.edu
|
||||
Keith Thompson kst@cts.com
|
||||
Ken Pizzini kenp@halcyon.com
|
||||
Kristin E Thomas kristint@us.ibm.com
|
||||
Kjetil Torgrim Homme kjetilho@ifi.uio.no
|
||||
Kristoffer Rose kris@diku.dk
|
||||
??? kytek@cybercomm.net
|
||||
Larry McVoy lm@sgi.com
|
||||
Lars Hecking lhecking@nmrc.ucc.ie
|
||||
Leah Q eequor@earthlink.net
|
||||
Lehti Rami rammer@cs.tut.fi
|
||||
Leonard N. Zubkoff lnz@dandelion.com
|
||||
Leonardo Milano lmilano@udel.edu
|
||||
Lorne Baker lbaker@nitro.avint.net
|
||||
Luke Hassell lukehassell@yahoo.com
|
||||
M. P. Suzuki mpsuzuki@hiroshima-u.ac.jp
|
||||
Maciej Kwapulinski pikpok@univ.gda.pl
|
||||
Manas Garg manas@cygsoft.com
|
||||
@ -212,15 +258,18 @@ Marco Franzen Marco.Franzen@Thyron.com
|
||||
Marcus Brinkmann http://www.marcus-brinkmann.de
|
||||
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 Harris mark@monitor.designacc.com
|
||||
Mark Hewitt mhewitt@armature.com
|
||||
Mark Hounschell markh@compro.net
|
||||
Mark Hubbart discord@mac.com
|
||||
Mark Kettenis kettenis@phys.uva.nl
|
||||
Mark Nudelman marknu@flash.net
|
||||
Mark W. Eichin eichin@cygnus.com
|
||||
Markus Demleitner msdemlei@auriga.ari.uni-heidelberg.de
|
||||
Martin martin@dresden.nacamar.de
|
||||
Martin Buck martin.buck@ascom.ch
|
||||
Martin Gallant martyg@goodbit.net
|
||||
Martin Hippe martin.hippe@schlund.de
|
||||
Martin Michlmayr tbm@cyrius.com
|
||||
@ -232,50 +281,70 @@ Mate Wierdl mw@moni.msci.memphis.edu
|
||||
Matej Vela mvela@public.srce.hr
|
||||
Matt Perry matt@primefactor.com
|
||||
Matt Schalit mschalit@pacbell.net
|
||||
Matt Swift swift@alum.mit.edu
|
||||
Matthew Arnison maffew@cat.org.au
|
||||
Matthew Braun matthew@ans.net
|
||||
Matthew Clarke Matthew_Clarke@mindlink.bc.ca
|
||||
Matthew S. Levine mslevine@theory.lcs.mit.edu
|
||||
Matthew Smith matts@bluesguitar.org
|
||||
Matthew Swift swift@alum.mit.edu
|
||||
Mattias Wadenstein maswan@acc.umu.se
|
||||
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@roka.net
|
||||
Michael Bacarella mbac@netgraft.com>
|
||||
Michael Deutschmann michael@talamasca.ocis.net
|
||||
Michael Elizabeth Chastain mec.gnu@mindspring.com
|
||||
Michael Gaughen mgaughen@polyserve.com
|
||||
Michael Hasselberg mikelh@zonta.ping.de
|
||||
Michael Hohn hohn@math.utah.edu
|
||||
Michael J. Croghan mcroghan@usatoday.com
|
||||
Michael McFarland sidlon@yahoo.com
|
||||
Michael Piefel piefel@informatik.hu-berlin.de
|
||||
Michael Steffens michael.steffens@s.netic.de
|
||||
Michael Stone mstone@debian.org
|
||||
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 Svec msvec@suse.cz
|
||||
Michel Robitaille robitail@IRO.UMontreal.CA
|
||||
Michiel Bacchiani bacchian@raven.bu.edu
|
||||
Mike Castle dalgoda@ix.netcom.com
|
||||
Mike Coleman mkc@mathdogs.com
|
||||
Mike Jetzer mjetzer@mke.catalystwms.com
|
||||
Mikko Tuumanen m@sorvankyla.yok.utu.fi
|
||||
Miles Bader miles@gnu.ai.mit.edu
|
||||
Minh Tran-Le tranle@intellicorp.com
|
||||
Morten Welinder terra@diku.dk
|
||||
Neal H Walfield neal@cs.uml.edu
|
||||
Neil Brown neilb@cse.unsw.edu.au
|
||||
Nelson H. F. Beebe beebe@math.utah.edu
|
||||
Nick Estes debian@nickstoys.com
|
||||
Nick Lawes nlawes@silverplatter.com
|
||||
Niklas Edmundsson nikke@acc.umu.se
|
||||
Nikola Milutinovic Nikola.Milutinovic@ev.co.yu
|
||||
Noah Friedman friedman@splode.com
|
||||
Noel Cragg noel@red-bean.com
|
||||
Olatunji Oluwabukunmi Ruwase tjruwase@stanford.edu
|
||||
Olav Morkrid olav@funcom.com
|
||||
Ole Laursen olau@hardworking.dk
|
||||
Oskar Liljeblad osk@hem.passagen.se
|
||||
Oliver Kiddle okiddle@yahoo.co.uk
|
||||
Ørn E. Hansen oehansen@daimi.aau.dk
|
||||
Oskar Liljeblad osk@hem.passagen.se
|
||||
Patrick Mauritz oxygene@studentenbude.ath.cx
|
||||
Paul Eggert eggert@twinsun.com
|
||||
Paul Jarc prj@po.cwru.edu
|
||||
Paul Nevai nevai@ops.mps.ohio-state.edu
|
||||
Paul Sauer paul@alexa.com
|
||||
Paul Slootman paul@debian.org
|
||||
Paul Worrall paul@basilisk.uklinux.net
|
||||
Pawel Prokop pablo@wizard.ae.krakow.pl
|
||||
Per Cederqvist ceder@lysator.liu.se
|
||||
Per Kristian Hove perhov@math.ntnu.no
|
||||
Peter Eriksson peter@ifm.liu.se
|
||||
Peter Horst peter@ointment.org
|
||||
Peter Moulder reiter@netspace.net.au
|
||||
Peter Samuelson psamuels@sampo.creighton.edu
|
||||
Peter Seebach seebs@taniemarie.solon.com
|
||||
@ -284,6 +353,7 @@ Phelippe Neveu pneveu@pcigeomatics.com
|
||||
Phil Richards phil.richards@vf.vodafone.co.uk
|
||||
Philippe De Muyter phdm@macqel.be
|
||||
Philippe Schnoebelen Philippe.Schnoebelen@imag.fr
|
||||
Phillip Jones mouse@datastacks.com
|
||||
Piergiorgio Sartor sartor@sony.de
|
||||
Piotr Kwapulinski kwap@univ.gda.pl
|
||||
Prashant TR tr@eth.net
|
||||
@ -291,43 +361,63 @@ 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
|
||||
Reuben Thomas rrt@sc3d.org
|
||||
Richard A Downing richard.downing@bcs.org.uk
|
||||
Richard Braakman dark@xs4all.nl
|
||||
Richard Dawe richdawe@bigfoot.com
|
||||
Richard Dawe rich@phekda.freeserve.co.uk
|
||||
Richard J. Rauenzahn rrauenza@hairball.cup.hp.com
|
||||
Richard Neill rn214@hermes.cam.ac.uk
|
||||
Richard Sharman rsharman@magmacom.com
|
||||
Rick Sladkey jrs@world.std.com
|
||||
Rik Faith faith@cs.unc.edu
|
||||
Risto Kankkunen kankkune@lingsoft.fi
|
||||
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
|
||||
Ronald F. Guilmette rfg@netcom.com
|
||||
Ross Alexander r.alexander@auckland.ac.nz
|
||||
Ross Paterson rap@doc.ic.ac.uk
|
||||
Ross Ridge rridge@calum.csclub.uwaterloo.ca
|
||||
Sami Farin sfarin@ratol.fi
|
||||
Samuel Tardieu sam@rfc1149.net
|
||||
Samuli Karkkainen Samuli.Karkkainen@hut.fi
|
||||
Sander van Malssen svm@kozmix.ow.nl
|
||||
Santiago Vila Doncel sanvila@unex.es
|
||||
Savochkin Andrey Vladimirovich saw@msu.ru
|
||||
Scott Lurndal slurn@griffin.engr.sgi.com
|
||||
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
|
||||
Stephen Depooter sbdep@myrealbox.com
|
||||
Stephen Eglen eglen@pcg.wustl.edu
|
||||
Stephen Gildea gildea@stop.mail-abuse.org
|
||||
Stephen Smoogen ??????????
|
||||
Stephen Smoogen smooge@mindspring.com
|
||||
Steve McConnel steve@acadcomp.sil.org
|
||||
Steven G. Johnson stevenj@alum.mit.edu
|
||||
Steven Mocking ufo@quicknet.nl
|
||||
Steven P Watson steven@magelico.net
|
||||
Stuart Kemp skemp@peter.bmc.com
|
||||
Szakacsits Szabolcs szaka@sienet.hu
|
||||
Tadayoshi Funaba tadf@kt.rim.or.jp
|
||||
TAKAI Kousuke takai@vlsi.kuee.kyoto-u.ac.jp
|
||||
Theodore Ts'o tytso@rsts-11.mit.edu
|
||||
Thomas Bushnell thomas@gnu.ai.mit.edu
|
||||
Thomas Goerlich thomas@schnappmatik.de
|
||||
Thomas Luzat thomas@luzat.com
|
||||
Thomas Quinot thomas@Cuivre.FR.EU.ORG
|
||||
Tim J. Robbins tjr@FreeBSD.org
|
||||
Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu
|
||||
Tim Smithers mouse@dmouse.com.au
|
||||
Tim Waugh twaugh@redhat
|
||||
Todd A. Jacobs tjacobs@codegnome.org
|
||||
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
|
||||
Tony Kocurko akocurko@mun.ca
|
||||
Tony Leneis tony@plaza.ds.adp.com
|
||||
@ -341,6 +431,8 @@ Uwe H. Steinfeld usteinfeld@gmx.net
|
||||
Vesselin Atanasov vesselin@bgnet.bg
|
||||
Vin Shelton acs@alumni.princeton.edu
|
||||
Volker Borchert bt@teknon.de
|
||||
Volker Paul vpaul@dohle.com
|
||||
Wartan Hachaturow wart@tepkom.ru
|
||||
Wayne Stewart wstewa@atl.com
|
||||
Wenjun Zheng zwj@yahoo.com
|
||||
Werner Almesberger Werner.Almesberger@epfl.ch
|
||||
@ -349,7 +441,9 @@ Will Edgington wedgingt@acm.org
|
||||
William Bader william@nscs.fast.net
|
||||
William Dowling will@franklin.com
|
||||
William Lewis wiml@omnigroup.com
|
||||
wiregauze wiregauze@yahoo.com
|
||||
Wojciech Purczynski cliph@isec.pl
|
||||
Wolfram Kleff kleff@cs.uni-bonn.de
|
||||
Won-kyu Park wkpark@chem.skku.ac.kr
|
||||
Yann Dirson dirson@debian.org
|
||||
Zvi Har'El rl@math.technion.ac.il
|
||||
|
36
contrib/gnu-sort/THANKS-to-translators
Normal file
36
contrib/gnu-sort/THANKS-to-translators
Normal file
@ -0,0 +1,36 @@
|
||||
The following teams have translated the many diagnostics of this
|
||||
package into many different languages. Thank you!
|
||||
|
||||
---
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-af.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-be.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-ca.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-cs.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-da.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-de.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-el.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-es.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-et.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-fi.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-fr.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-ga.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-gl.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-hu.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-it.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-ja.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-ko.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-lg.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-ms.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-nb.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-nl.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-no.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-pl.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-pt.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-pt_BR.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-ru.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-sk.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-sl.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-sv.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-tr.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-zh_CN.html
|
||||
http://www.iro.umontreal.ca/contrib/po/HTML/team-zh_TW.html
|
@ -1,93 +1,169 @@
|
||||
Tasks for GNU textutils (listed in no particular order):
|
||||
restore djgpp, eventually
|
||||
merge TODO lists
|
||||
add unit tests for lib/*.c
|
||||
|
||||
write texinfo documentation for sha1sum
|
||||
strip: add an option to specify the program used to strip binaries.
|
||||
suggestion from Karl Berry
|
||||
|
||||
Something that I would really appreciate is if someone would run the
|
||||
Open Group's VSC-lite test suite against the fileutils and textutils
|
||||
and report the failures.
|
||||
doc/coreutils.texi:
|
||||
Address this comment: FIXME: mv's behavior in this case is system-dependent
|
||||
Better still: fix the code so it's *not* system-dependent.
|
||||
|
||||
http://www.opengroup.org/testing/downloads/vsclite.html
|
||||
implement --target-directory=DIR for install (per texinfo documentation)
|
||||
|
||||
I've been meaning to do it myself for months, but haven't found the time.
|
||||
There's a bit of set-up required, some of which requires root access, e.g.,
|
||||
to create a few test user accounts and some test groups.
|
||||
------------------
|
||||
ls: add --format=FORMAT option that controls how each line is printed.
|
||||
|
||||
uniq: remove support for obsolescent +N syntax
|
||||
cp --no-preserve=X should not attempt to preserve attribute X
|
||||
reported by Andreas Schwab
|
||||
|
||||
add tests for od
|
||||
add some endian-aware tests for od
|
||||
copy.c: Address the FIXME-maybe comment in copy_internal.
|
||||
And once that's done, add an exclusion so that `cp --link'
|
||||
no longer incurs the overhead of saving src. dev/ino and dest. filename
|
||||
in the hash table.
|
||||
|
||||
tac: Set DONT_UNLINK_WHILE_OPEN when necessary.
|
||||
See if we can be consistent about where --verbose sends its output:
|
||||
These all send --verbose output to stdout:
|
||||
head, tail, rm, cp, mv, ln, chmod, chown, chgrp, install, ln
|
||||
These send it to stderr:
|
||||
shred mkdir split
|
||||
readlink is different
|
||||
|
||||
tail: add an option so that using -f on N files doesn't monopolize
|
||||
N file descriptors
|
||||
Write an autoconf test to work around build failure in HPUX's 64-bit mode.
|
||||
See notes in README -- and remove them once there's a work-around.
|
||||
|
||||
tac: add options to help handle boundary cases
|
||||
E.g., options to distinguish DELIM_STRING is
|
||||
- starter (see existing --before option)
|
||||
- terminator (this is what most people expect wrt NEWLINE
|
||||
- separator (this would make `echo -n a:b:c|tac -s:' print `c:b:a')
|
||||
Integrate use of sendfile, suggested here:
|
||||
http://mail.gnu.org/archive/html/bug-fileutils/2003-03/msg00030.html
|
||||
I don't plan to do that, since a few tests demonstrate no significant benefit.
|
||||
|
||||
tail: support -r option by librarifying tac and using that
|
||||
Should printf '\0123' print "\n3"?
|
||||
per report from TAKAI Kousuke on Mar 27
|
||||
http://mail.gnu.org/archive/html/bug-coreutils/2003-03/index.html
|
||||
|
||||
cut: maybe add an option to say `fields are separated by whitespace'.
|
||||
Of course, that isn't really necessary because you can preprocess
|
||||
cut's input with tr to get the same effect:
|
||||
printf: consider adapting builtins/printf.def from bash
|
||||
|
||||
echo 'a b c' |tr -s '[:blank:]' | cut -d ' ' -f 2
|
||||
df: add `--total' option, suggested here http://bugs.debian.org/186007
|
||||
|
||||
------------
|
||||
seq: give better diagnostics for invalid formats:
|
||||
e.g. no or too many % directives
|
||||
seq: consider allowing format string to contain no %-directives
|
||||
|
||||
From: kwzh@gnu.ai.mit.edu (Karl Heuer)
|
||||
Subject: [textutils-1.22] [sort] feature requests
|
||||
To: textutils-bugs@gnu.ai.mit.edu
|
||||
Date: Thu, 5 Jun 97 13:06:51 -0400
|
||||
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
|
||||
|
||||
[...]
|
||||
Another feature that I would sometimes find useful: change -c so that
|
||||
it will report up to N instances of disorder before bailing out, where
|
||||
N defaults to 1 but can be set to infinity or to some finite value by
|
||||
another option. (An "instance of disorder" is two adjacent lines that
|
||||
are malsorted; this does not imply that swapping them or removing one
|
||||
or both would cause the list to be sorted. (1 3 5 7 9 0 2 4 6 8) has
|
||||
just one instance of disorder.)
|
||||
m4: rename all macros that start with AC_ to start with another prefix
|
||||
|
||||
------------
|
||||
resolve RH report on cp -a forwarded by Tim Waugh
|
||||
|
||||
Date: Fri, 1 May 1998 20:27:39 -0700 (PDT)
|
||||
From: Paul Rubin <phr@netcom.com>
|
||||
To: gnu@gnu.org
|
||||
Subject: small project suggestion
|
||||
Martin Michlmayr's patch to provide ls with `--sort directory' option
|
||||
|
||||
Someone should rewrite the "sum" utility to give a choice of
|
||||
different checksum algorithms (it's poorly organized for that now).
|
||||
An experienced programmer could probably do it in a day or so,
|
||||
or it might be a good, self-contained project for someone who is
|
||||
just getting started.
|
||||
tail: don't use xlseek; it *exits*.
|
||||
Instead, maybe use a macro and return nonzero.
|
||||
|
||||
Algorithms that it should include are:
|
||||
-- the POSIX algorithm
|
||||
-- the BSD algorithm
|
||||
-- CRC32 algorithm (used by pkzip)
|
||||
-- CRC16 (used in TCP/IP)
|
||||
-- possibly other CRC's (like the different CCITT polynomials)
|
||||
-- SHA-1 and MD5 cryptographic hashes (replacing "md5sum").
|
||||
and possibly:
|
||||
-- DSA digital signature based on secret key generated from
|
||||
a passphrase (prompt the user, or read an environment variable).
|
||||
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
|
||||
|
||||
tr: support nontrivial equivalence classes, e.g. [=e=] with LC_COLLATE=fr_FR
|
||||
|
||||
fix tail -f to work with named pipes; reported by Ian D. Allen
|
||||
$ mkfifo j; tail -f j & sleep 1; echo x > j
|
||||
./tail: j: file truncated
|
||||
./tail: j: cannot seek to offset 0: Illegal seek
|
||||
|
||||
lib/strftime.c: Since %N is the only format that we need but that
|
||||
glibc's strftime doesn't support, consider using a wrapper that
|
||||
would expand /%(-_)?\d*N/ to the desired string and then pass the
|
||||
resulting string to glibc's strftime.
|
||||
|
||||
sort: Compress temporary files when doing large external sort/merges.
|
||||
This improves performance when you can compress/uncompress faster than
|
||||
you can read/write, which is common in these days of fast CPUs.
|
||||
suggestion from Charles Randall on 2001-08-10
|
||||
|
||||
sort: Add an ordering option -R that causes 'sort' to sort according
|
||||
to a random permutation of the correct sort order. Also, add an
|
||||
option --random-seed=SEED that causes 'sort' to use an arbitrary
|
||||
string SEED to select which permutations to use, in a deterministic
|
||||
manner: that is, if you sort a permutation of the same input file
|
||||
with the same --random-seed=SEED option twice, you'll get the same
|
||||
output. The default SEED is chosen at random, and contains enough
|
||||
information to ensure that the output permutation is random.
|
||||
suggestion from Feth AREZKI, Stephan Kasal, and Paul Eggert on 2003-07-17
|
||||
|
||||
unexpand: [http://www.opengroup.org/onlinepubs/007908799/xcu/unexpand.html]
|
||||
printf 'x\t \t y\n'|unexpand -t 8,9 should print its input, unmodified.
|
||||
printf 'x\t \t y\n'|unexpand -t 5,8 should print "x\ty\n"
|
||||
|
||||
Let GNU su use the `wheel' group if appropriate.
|
||||
(there are a couple patches, already)
|
||||
|
||||
sort: Investigate better sorting algorithms; see Knuth vol. 3.
|
||||
|
||||
We tried list merge sort, but it was about 50% slower than the
|
||||
recursive algorithm currently used by sortlines, and it used more
|
||||
comparisons. We're not sure why this was, as the theory suggests it
|
||||
should do fewer comparisons, so perhaps this should be revisited.
|
||||
List merge sort was implemented in the style of Knuth algorithm
|
||||
5.2.4L, with the optimization suggested by exercise 5.2.4-22. The
|
||||
test case was 140,213,394 bytes, 426,4424 lines, text taken from the
|
||||
GCC 3.3 distribution, sort.c compiled with GCC 2.95.4 and running on
|
||||
Debian 3.0r1 GNU/Linux, 2.4GHz Pentium 4, single pass with no
|
||||
temporary files and plenty of RAM.
|
||||
|
||||
Since comparisons seem to be the bottleneck, perhaps the best
|
||||
algorithm to try next should be merge insertion. See Knuth section
|
||||
5.3.1, who credits Lester Ford, Jr. and Selmer Johnson, American
|
||||
Mathematical Monthly 66 (1959), 387-389.
|
||||
|
||||
cp --recursive: perform dir traversals in source and dest hierarchy rather
|
||||
than forming full file names. The latter (current) approach fails
|
||||
unnecessarily when the names become very long.
|
||||
|
||||
tail --p is now ambiguous
|
||||
|
||||
Remove suspicious uses of alloca (ones that may allocate more than
|
||||
about 4k)
|
||||
|
||||
Adapt these contribution guidelines for coreutils:
|
||||
http://sources.redhat.com/automake/contribute.html
|
||||
|
||||
|
||||
---------------------
|
||||
Changes expected to go in, post-5.2.1:
|
||||
======================================
|
||||
|
||||
comm: add an option-enable check for sortedness of input files
|
||||
du and wc: add an option, --from0-file, to make them read NUL-delimited
|
||||
file name arguments from a file.
|
||||
[I now have a patch adding --from0-file for du]
|
||||
|
||||
---------------------
|
||||
dd patch from Olivier Delhomme
|
||||
|
||||
uniq: add a more flexible key selection mechanism
|
||||
Apply Andreas Gruenbacher's ACL and xattr changes
|
||||
|
||||
---------------------
|
||||
Apply Bruno Haible's hostname changes
|
||||
|
||||
Charles Randall <crandall@matchlogic.com>
|
||||
is working on making sort more suitable and efficient for very
|
||||
large sets of input data.
|
||||
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
|
||||
specified, consider whether to let the latter select whether to
|
||||
dereference command line symlinks to directories. Since -l has
|
||||
an implicit --NO-dereference-command-line-symlink-to-dir meaning.
|
||||
Pointed out by Karl Berry.
|
||||
|
||||
A more efficient version of factor, and possibly one that
|
||||
accepts inputs of size 2^64 and larger.
|
||||
|
||||
Re-add a separate test for du's stack space usage (like the one removed
|
||||
from tests/rm/deep-1).
|
||||
|
||||
Pending copyright papers:
|
||||
------------------------
|
||||
ls --color: Ed Avis' patch to suppress escape sequences for
|
||||
non-highlighted files
|
||||
|
30
contrib/gnu-sort/lib/__fpending.c
Normal file
30
contrib/gnu-sort/lib/__fpending.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* __fpending.c -- return the number of pending output bytes on a stream
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "__fpending.h"
|
||||
|
||||
size_t
|
||||
__fpending (FILE *fp)
|
||||
{
|
||||
return PENDING_OUTPUT_N_BYTES;
|
||||
}
|
17
contrib/gnu-sort/lib/__fpending.h
Normal file
17
contrib/gnu-sort/lib/__fpending.h
Normal file
@ -0,0 +1,17 @@
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if HAVE_STDIO_EXT_H
|
||||
# include <stdio_ext.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL___FPENDING
|
||||
"this configure-time declaration test was not run"
|
||||
#endif
|
||||
#if !HAVE_DECL___FPENDING
|
||||
size_t __fpending (FILE *);
|
||||
#endif
|
@ -1,5 +1,7 @@
|
||||
/* argmatch.c -- find a match for a string in an array
|
||||
Copyright (C) 1990, 1998, 1999, 2001 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1990, 1998, 1999, 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
|
||||
@ -18,25 +20,22 @@
|
||||
/* Written by David MacKenzie <djm@ai.mit.edu>
|
||||
Modified by Akim Demaille <demaille@inf.enst.fr> */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Specification. */
|
||||
#include "argmatch.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef STDC_HEADERS
|
||||
# include <string.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
#include "error.h"
|
||||
#include "exit.h"
|
||||
#include "quotearg.h"
|
||||
#include "quote.h"
|
||||
#include "unlocked-io.h"
|
||||
@ -48,17 +47,10 @@
|
||||
# define ARGMATCH_QUOTING_STYLE locale_quoting_style
|
||||
#endif
|
||||
|
||||
/* The following test is to work around the gross typo in
|
||||
systems like Sony NEWS-OS Release 4.0C, whereby EXIT_FAILURE
|
||||
is defined to 0, not 1. */
|
||||
#if !EXIT_FAILURE
|
||||
# undef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
/* Non failing version of argmatch call this function after failing. */
|
||||
#ifndef ARGMATCH_DIE
|
||||
# define ARGMATCH_DIE exit (EXIT_FAILURE)
|
||||
# include "exitfail.h"
|
||||
# define ARGMATCH_DIE exit (exit_failure)
|
||||
#endif
|
||||
|
||||
#ifdef ARGMATCH_DIE_DECL
|
||||
@ -80,7 +72,6 @@ argmatch_exit_fn argmatch_die = __argmatch_die;
|
||||
null-terminated array ARGLIST, return the index in ARGLIST
|
||||
of the matched element, else -1 if it does not match any element
|
||||
or -2 if it is ambiguous (is a prefix of more than one element).
|
||||
If SENSITIVE, comparison is case sensitive.
|
||||
|
||||
If VALLIST is none null, use it to resolve ambiguities limited to
|
||||
synonyms, i.e., for
|
||||
@ -88,10 +79,9 @@ argmatch_exit_fn argmatch_die = __argmatch_die;
|
||||
"no", "nope" -> 1
|
||||
"y" is a valid argument, for `0', and "n" for `1'. */
|
||||
|
||||
static int
|
||||
__argmatch_internal (const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize,
|
||||
int case_sensitive)
|
||||
int
|
||||
argmatch (const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize)
|
||||
{
|
||||
int i; /* Temporary index in ARGLIST. */
|
||||
size_t arglen; /* Length of ARG. */
|
||||
@ -103,9 +93,7 @@ __argmatch_internal (const char *arg, const char *const *arglist,
|
||||
/* Test all elements for either exact match or abbreviated matches. */
|
||||
for (i = 0; arglist[i]; i++)
|
||||
{
|
||||
if (case_sensitive
|
||||
? !strncmp (arglist[i], arg, arglen)
|
||||
: !strncasecmp (arglist[i], arg, arglen))
|
||||
if (!strncmp (arglist[i], arg, arglen))
|
||||
{
|
||||
if (strlen (arglist[i]) == arglen)
|
||||
/* Exact match found. */
|
||||
@ -133,22 +121,6 @@ __argmatch_internal (const char *arg, const char *const *arglist,
|
||||
return matchind;
|
||||
}
|
||||
|
||||
/* argmatch - case sensitive version */
|
||||
int
|
||||
argmatch (const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize)
|
||||
{
|
||||
return __argmatch_internal (arg, arglist, vallist, valsize, 1);
|
||||
}
|
||||
|
||||
/* argcasematch - case insensitive version */
|
||||
int
|
||||
argcasematch (const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize)
|
||||
{
|
||||
return __argmatch_internal (arg, arglist, vallist, valsize, 0);
|
||||
}
|
||||
|
||||
/* Error reporting for argmatch.
|
||||
CONTEXT is a description of the type of entity that was being matched.
|
||||
VALUE is the invalid value that was given.
|
||||
@ -203,12 +175,9 @@ int
|
||||
__xargmatch_internal (const char *context,
|
||||
const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize,
|
||||
int case_sensitive,
|
||||
argmatch_exit_fn exit_fn)
|
||||
{
|
||||
int res = __argmatch_internal (arg, arglist,
|
||||
vallist, valsize,
|
||||
case_sensitive);
|
||||
int res = argmatch (arg, arglist, vallist, valsize);
|
||||
if (res >= 0)
|
||||
/* Success. */
|
||||
return res;
|
||||
@ -241,7 +210,6 @@ argmatch_to_argument (const char *value,
|
||||
* Based on "getversion.c" by David MacKenzie <djm@gnu.ai.mit.edu>
|
||||
*/
|
||||
char *program_name;
|
||||
extern const char *getenv ();
|
||||
|
||||
/* When to make backup files. */
|
||||
enum backup_type
|
||||
@ -294,12 +262,12 @@ main (int argc, const char *const *argv)
|
||||
}
|
||||
|
||||
if ((cp = getenv ("VERSION_CONTROL")))
|
||||
backup_type = XARGCASEMATCH ("$VERSION_CONTROL", cp,
|
||||
backup_args, backup_vals);
|
||||
backup_type = XARGMATCH ("$VERSION_CONTROL", cp,
|
||||
backup_args, backup_vals);
|
||||
|
||||
if (argc == 2)
|
||||
backup_type = XARGCASEMATCH (program_name, argv[1],
|
||||
backup_args, backup_vals);
|
||||
backup_type = XARGMATCH (program_name, argv[1],
|
||||
backup_args, backup_vals);
|
||||
|
||||
printf ("The version control is `%s'\n",
|
||||
ARGMATCH_TO_ARGUMENT (backup_type, backup_args, backup_vals));
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* argmatch.h -- definitions and prototypes for argmatch.c
|
||||
Copyright (C) 1990, 1998, 1999, 2001 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1990, 1998, 1999, 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
|
||||
@ -21,109 +23,89 @@
|
||||
#ifndef ARGMATCH_H_
|
||||
# define ARGMATCH_H_ 1
|
||||
|
||||
# if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# endif
|
||||
# include <stddef.h>
|
||||
|
||||
# include <sys/types.h>
|
||||
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
|
||||
|
||||
# ifndef PARAMS
|
||||
# if PROTOTYPES || (defined (__STDC__) && __STDC__)
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
# endif /* GCC. */
|
||||
# endif /* Not PARAMS. */
|
||||
# define ARGMATCH_CONSTRAINT(Arglist, Vallist) \
|
||||
(ARRAY_CARDINALITY (Arglist) == ARRAY_CARDINALITY (Vallist) + 1)
|
||||
|
||||
/* Assert there are as many real arguments as there are values
|
||||
(argument list ends with a NULL guard). There is no execution
|
||||
cost, since it will be statically evalauted to `assert (0)' or
|
||||
`assert (1)'. Unfortunately there is no -Wassert-0. */
|
||||
(argument list ends with a NULL guard). ARGMATCH_VERIFY is
|
||||
preferred, since it is guaranteed to be checked at compile-time.
|
||||
ARGMATCH_ASSERT is for backward compatibility only. */
|
||||
|
||||
# undef ARRAY_CARDINALITY
|
||||
# define ARRAY_CARDINALITY(Array) (sizeof ((Array)) / sizeof (*(Array)))
|
||||
# define ARGMATCH_VERIFY(Arglist, Vallist) \
|
||||
struct argmatch_verify \
|
||||
{ \
|
||||
char argmatch_verify[ARGMATCH_CONSTRAINT(Arglist, Vallist) ? 1 : -1]; \
|
||||
}
|
||||
|
||||
# define ARGMATCH_ASSERT(Arglist, Vallist) \
|
||||
assert (ARRAY_CARDINALITY ((Arglist)) == ARRAY_CARDINALITY ((Vallist)) + 1)
|
||||
# define ARGMATCH_ASSERT(Arglist, Vallist) \
|
||||
assert (ARGMATCH_CONSTRAINT (Arglist, Vallist))
|
||||
|
||||
/* Return the index of the element of ARGLIST (NULL terminated) that
|
||||
matches with ARG. If VALLIST is not NULL, then use it to resolve
|
||||
false ambiguities (i.e., different matches of ARG but corresponding
|
||||
to the same values in VALLIST). */
|
||||
|
||||
int argmatch
|
||||
PARAMS ((const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize));
|
||||
int argcasematch
|
||||
PARAMS ((const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize));
|
||||
int argmatch (char const *arg, char const *const *arglist,
|
||||
char const *vallist, size_t valsize);
|
||||
|
||||
# define ARGMATCH(Arg, Arglist, Vallist) \
|
||||
argmatch ((Arg), (Arglist), (const char *) (Vallist), sizeof (*(Vallist)))
|
||||
|
||||
# define ARGCASEMATCH(Arg, Arglist, Vallist) \
|
||||
argcasematch ((Arg), (Arglist), (const char *) (Vallist), sizeof (*(Vallist)))
|
||||
argmatch (Arg, Arglist, (char const *) (Vallist), sizeof *(Vallist))
|
||||
|
||||
/* xargmatch calls this function when it fails. This function should not
|
||||
return. By default, this is a function that calls ARGMATCH_DIE which
|
||||
in turn defaults to `exit (EXIT_FAILURE)'. */
|
||||
typedef void (*argmatch_exit_fn) PARAMS ((void));
|
||||
in turn defaults to `exit (exit_failure)'. */
|
||||
typedef void (*argmatch_exit_fn) (void);
|
||||
extern argmatch_exit_fn argmatch_die;
|
||||
|
||||
/* Report on stderr why argmatch failed. Report correct values. */
|
||||
|
||||
void argmatch_invalid
|
||||
PARAMS ((const char *context, const char *value, int problem));
|
||||
void argmatch_invalid (char const *context, char const *value, int problem);
|
||||
|
||||
/* Left for compatibility with the old name invalid_arg */
|
||||
|
||||
# define invalid_arg(Context, Value, Problem) \
|
||||
argmatch_invalid ((Context), (Value), (Problem))
|
||||
argmatch_invalid (Context, Value, Problem)
|
||||
|
||||
|
||||
|
||||
/* Report on stderr the list of possible arguments. */
|
||||
|
||||
void argmatch_valid
|
||||
PARAMS ((const char *const *arglist,
|
||||
const char *vallist, size_t valsize));
|
||||
void argmatch_valid (char const *const *arglist,
|
||||
char const *vallist, size_t valsize);
|
||||
|
||||
# define ARGMATCH_VALID(Arglist, Vallist) \
|
||||
argmatch_valid (Arglist, (const char *) Vallist, sizeof (*(Vallist)))
|
||||
argmatch_valid (Arglist, (char const *) (Vallist), sizeof *(Vallist))
|
||||
|
||||
|
||||
|
||||
/* Same as argmatch, but upon failure, reports a explanation on the
|
||||
failure, and exits using the function EXIT_FN. */
|
||||
|
||||
int __xargmatch_internal
|
||||
PARAMS ((const char *context,
|
||||
const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize,
|
||||
int case_sensitive, argmatch_exit_fn 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);
|
||||
|
||||
/* Programmer friendly interface to __xargmatch_internal. */
|
||||
|
||||
# define XARGMATCH(Context, Arg, Arglist, Vallist) \
|
||||
(Vallist [__xargmatch_internal ((Context), (Arg), (Arglist), \
|
||||
(const char *) (Vallist), \
|
||||
sizeof (*(Vallist)), \
|
||||
1, argmatch_die)])
|
||||
|
||||
# define XARGCASEMATCH(Context, Arg, Arglist, Vallist) \
|
||||
(Vallist [__xargmatch_internal ((Context), (Arg), (Arglist), \
|
||||
(const char *) (Vallist), \
|
||||
sizeof (*(Vallist)), \
|
||||
0, argmatch_die)])
|
||||
# define XARGMATCH(Context, Arg, Arglist, Vallist) \
|
||||
((Vallist) [__xargmatch_internal (Context, Arg, Arglist, \
|
||||
(char const *) (Vallist), \
|
||||
sizeof *(Vallist), \
|
||||
argmatch_die)])
|
||||
|
||||
/* Convert a value into a corresponding argument. */
|
||||
|
||||
const char *argmatch_to_argument
|
||||
PARAMS ((char const *value, const char *const *arglist,
|
||||
const char *vallist, size_t valsize));
|
||||
char const *argmatch_to_argument (char const *value,
|
||||
char const *const *arglist,
|
||||
char const *vallist, size_t valsize);
|
||||
|
||||
# define ARGMATCH_TO_ARGUMENT(Value, Arglist, Vallist) \
|
||||
argmatch_to_argument ((Value), (Arglist), \
|
||||
(const char *) (Vallist), sizeof (*(Vallist)))
|
||||
argmatch_to_argument (Value, Arglist, \
|
||||
(char const *) (Vallist), sizeof *(Vallist))
|
||||
|
||||
#endif /* ARGMATCH_H_ */
|
||||
|
95
contrib/gnu-sort/lib/closeout.c
Normal file
95
contrib/gnu-sort/lib/closeout.c
Normal file
@ -0,0 +1,95 @@
|
||||
/* closeout.c - close standard output
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002 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
|
||||
|
||||
#include "closeout.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
#include "error.h"
|
||||
#include "exitfail.h"
|
||||
#include "quotearg.h"
|
||||
#include "unlocked-io.h"
|
||||
#include "__fpending.h"
|
||||
|
||||
static const char *file_name;
|
||||
|
||||
/* Set the file name to be reported in the event an error is detected
|
||||
by close_stdout. */
|
||||
void
|
||||
close_stdout_set_file_name (const char *file)
|
||||
{
|
||||
file_name = file;
|
||||
}
|
||||
|
||||
/* Close standard output, exiting with status 'exit_failure' on failure.
|
||||
If a program writes *anything* to stdout, that program should `fflush'
|
||||
stdout and make sure that it succeeds before exiting. Otherwise,
|
||||
suppose that you go to the extreme of checking the return status
|
||||
of every function that does an explicit write to stdout. The last
|
||||
printf can succeed in writing to the internal stream buffer, and yet
|
||||
the fclose(stdout) could still fail (due e.g., to a disk full error)
|
||||
when it tries to write out that buffered data. Thus, you would be
|
||||
left with an incomplete output file and the offending program would
|
||||
exit successfully.
|
||||
|
||||
FIXME: note the fflush suggested above is implicit in the fclose
|
||||
we actually do below. Consider doing only the fflush and/or using
|
||||
setvbuf to inhibit buffering.
|
||||
|
||||
Besides, it's wasteful to check the return value from every call
|
||||
that writes to stdout -- just let the internal stream state record
|
||||
the failure. That's what the ferror test is checking below.
|
||||
|
||||
It's important to detect such failures and exit nonzero because many
|
||||
tools (most notably `make' and other build-management systems) depend
|
||||
on being able to detect failure in other tools via their exit status. */
|
||||
|
||||
void
|
||||
close_stdout (void)
|
||||
{
|
||||
int e = ferror (stdout) ? 0 : -1;
|
||||
|
||||
/* If the stream's error bit is clear and there is nothing to flush,
|
||||
then return right away. */
|
||||
if (e && __fpending (stdout) == 0)
|
||||
return;
|
||||
|
||||
if (fclose (stdout) != 0)
|
||||
e = errno;
|
||||
|
||||
if (0 <= e)
|
||||
{
|
||||
char const *write_error = _("write error");
|
||||
if (file_name)
|
||||
error (exit_failure, e, "%s: %s", quotearg_colon (file_name),
|
||||
write_error);
|
||||
else
|
||||
error (exit_failure, e, "%s", write_error);
|
||||
}
|
||||
}
|
@ -1,17 +1,25 @@
|
||||
/* Close standard output.
|
||||
|
||||
Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef CLOSEOUT_H
|
||||
# define CLOSEOUT_H 1
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
|
||||
void close_stdout_set_status PARAMS ((int status));
|
||||
void close_stdout_set_file_name PARAMS ((const char *file));
|
||||
void close_stdout PARAMS ((void));
|
||||
void close_stdout_status PARAMS ((int status));
|
||||
void close_stdout_set_file_name (const char *file);
|
||||
void close_stdout (void);
|
||||
|
||||
#endif
|
||||
|
@ -1,22 +1,20 @@
|
||||
/* Error handler for noninteractive utilities
|
||||
Copyright (C) 1990-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
Copyright (C) 1990-1998, 2000-2002, 2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
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
|
||||
Lesser General Public License for more details.
|
||||
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 Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
@ -24,38 +22,28 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "error.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#if HAVE_LIBINTL_H
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "gettext.h"
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <wchar.h>
|
||||
# define mbsrtowcs __mbsrtowcs
|
||||
#endif
|
||||
|
||||
#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
|
||||
# if __STDC__
|
||||
# include <stdarg.h>
|
||||
# define VA_START(args, lastarg) va_start(args, lastarg)
|
||||
# else
|
||||
# include <varargs.h>
|
||||
# define VA_START(args, lastarg) va_start(args)
|
||||
# endif
|
||||
#else
|
||||
# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
|
||||
# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
|
||||
#if !_LIBC
|
||||
# include "unlocked-io.h"
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS || _LIBC
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#else
|
||||
void exit ();
|
||||
#endif
|
||||
|
||||
#include "error.h"
|
||||
#include "unlocked-io.h"
|
||||
|
||||
#ifndef _
|
||||
# define _(String) String
|
||||
#endif
|
||||
@ -63,11 +51,7 @@ void exit ();
|
||||
/* If NULL, error will flush stdout, then print on stderr the program
|
||||
name, a colon and a space. Otherwise, error will call this
|
||||
function without parameters instead. */
|
||||
void (*error_print_progname) (
|
||||
#if __STDC__ - 0
|
||||
void
|
||||
#endif
|
||||
);
|
||||
void (*error_print_progname) (void);
|
||||
|
||||
/* This variable is incremented each time `error' is called. */
|
||||
unsigned int error_message_count;
|
||||
@ -77,6 +61,7 @@ unsigned int error_message_count;
|
||||
|
||||
# define program_name program_invocation_name
|
||||
# include <errno.h>
|
||||
# include <libio/libioP.h>
|
||||
|
||||
/* In GNU libc we want do not want to use the common name `error' directly.
|
||||
Instead make it a weak alias. */
|
||||
@ -89,10 +74,12 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
|
||||
# define error __error
|
||||
# define error_at_line __error_at_line
|
||||
|
||||
# ifdef USE_IN_LIBIO
|
||||
# include <libio/iolibio.h>
|
||||
# define fflush(s) _IO_fflush (s)
|
||||
# endif
|
||||
# include <libio/iolibio.h>
|
||||
# define fflush(s) INTUSE(_IO_fflush) (s)
|
||||
# undef putc
|
||||
# define putc(c, fp) INTUSE(_IO_putc) (c, fp)
|
||||
|
||||
# include <bits/libc-lock.h>
|
||||
|
||||
#else /* not _LIBC */
|
||||
|
||||
@ -103,34 +90,17 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
|
||||
char *strerror_r ();
|
||||
# endif
|
||||
|
||||
# ifndef SIZE_MAX
|
||||
# define SIZE_MAX ((size_t) -1)
|
||||
# endif
|
||||
|
||||
/* The calling program should define program_name and set it to the
|
||||
name of the executing program. */
|
||||
extern char *program_name;
|
||||
|
||||
# if HAVE_STRERROR_R || defined strerror_r
|
||||
# define __strerror_r strerror_r
|
||||
# else
|
||||
# if HAVE_STRERROR
|
||||
# ifndef HAVE_DECL_STRERROR
|
||||
"this configure-time declaration test was not run"
|
||||
# endif
|
||||
# if !HAVE_DECL_STRERROR
|
||||
char *strerror ();
|
||||
# endif
|
||||
# else
|
||||
static char *
|
||||
private_strerror (int errnum)
|
||||
{
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
|
||||
if (errnum > 0 && errnum <= sys_nerr)
|
||||
return _(sys_errlist[errnum]);
|
||||
return _("Unknown system error");
|
||||
}
|
||||
# define strerror private_strerror
|
||||
# endif /* HAVE_STRERROR */
|
||||
# endif /* HAVE_STRERROR_R || defined strerror_r */
|
||||
# endif
|
||||
#endif /* not _LIBC */
|
||||
|
||||
static void
|
||||
@ -157,7 +127,7 @@ print_errno_message (int errnum)
|
||||
s = _("Unknown system error");
|
||||
#endif
|
||||
|
||||
#if _LIBC && USE_IN_LIBIO
|
||||
#if _LIBC
|
||||
if (_IO_fwide (stderr, 0) > 0)
|
||||
{
|
||||
__fwprintf (stderr, L": %s", s);
|
||||
@ -168,108 +138,81 @@ print_errno_message (int errnum)
|
||||
fprintf (stderr, ": %s", s);
|
||||
}
|
||||
|
||||
#ifdef VA_START
|
||||
static void
|
||||
error_tail (int status, int errnum, const char *message, va_list args)
|
||||
{
|
||||
# if HAVE_VPRINTF || _LIBC
|
||||
# if _LIBC && USE_IN_LIBIO
|
||||
#if _LIBC
|
||||
if (_IO_fwide (stderr, 0) > 0)
|
||||
{
|
||||
# define ALLOCA_LIMIT 2000
|
||||
# define ALLOCA_LIMIT 2000
|
||||
size_t len = strlen (message) + 1;
|
||||
wchar_t *wmessage = NULL;
|
||||
mbstate_t st;
|
||||
size_t res;
|
||||
const char *tmp;
|
||||
const wchar_t *wmessage = L"out of memory";
|
||||
wchar_t *wbuf = (len < ALLOCA_LIMIT
|
||||
? alloca (len * sizeof *wbuf)
|
||||
: len <= SIZE_MAX / sizeof *wbuf
|
||||
? malloc (len * sizeof *wbuf)
|
||||
: NULL);
|
||||
|
||||
do
|
||||
if (wbuf)
|
||||
{
|
||||
if (len < ALLOCA_LIMIT)
|
||||
wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
|
||||
else
|
||||
{
|
||||
if (wmessage != NULL && len / 2 < ALLOCA_LIMIT)
|
||||
wmessage = NULL;
|
||||
|
||||
wmessage = (wchar_t *) realloc (wmessage,
|
||||
len * sizeof (wchar_t));
|
||||
|
||||
if (wmessage == NULL)
|
||||
{
|
||||
fputws_unlocked (L"out of memory\n", stderr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
size_t res;
|
||||
mbstate_t st;
|
||||
const char *tmp = message;
|
||||
memset (&st, '\0', sizeof (st));
|
||||
tmp =message;
|
||||
res = mbsrtowcs (wbuf, &tmp, len, &st);
|
||||
wmessage = res == (size_t) -1 ? L"???" : wbuf;
|
||||
}
|
||||
while ((res = mbsrtowcs (wmessage, &tmp, len, &st)) == len);
|
||||
|
||||
if (res == (size_t) -1)
|
||||
/* The string cannot be converted. */
|
||||
wmessage = (wchar_t *) L"???";
|
||||
|
||||
__vfwprintf (stderr, wmessage, args);
|
||||
if (! (len < ALLOCA_LIMIT))
|
||||
free (wbuf);
|
||||
}
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
vfprintf (stderr, message, args);
|
||||
# else
|
||||
_doprnt (message, args, stderr);
|
||||
# endif
|
||||
va_end (args);
|
||||
|
||||
++error_message_count;
|
||||
if (errnum)
|
||||
print_errno_message (errnum);
|
||||
# if _LIBC && USE_IN_LIBIO
|
||||
#if _LIBC
|
||||
if (_IO_fwide (stderr, 0) > 0)
|
||||
putwc (L'\n', stderr);
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
putc ('\n', stderr);
|
||||
fflush (stderr);
|
||||
if (status)
|
||||
exit (status);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Print the program name and error message MESSAGE, which is a printf-style
|
||||
format string with optional args.
|
||||
If ERRNUM is nonzero, print its corresponding system error message.
|
||||
Exit with status STATUS if it is nonzero. */
|
||||
/* VARARGS */
|
||||
void
|
||||
#if defined VA_START && __STDC__
|
||||
error (int status, int errnum, const char *message, ...)
|
||||
#else
|
||||
error (status, errnum, message, va_alist)
|
||||
int status;
|
||||
int errnum;
|
||||
char *message;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
#ifdef VA_START
|
||||
va_list args;
|
||||
|
||||
#if defined _LIBC && defined __libc_ptf_call
|
||||
/* We do not want this call to be cut short by a thread
|
||||
cancellation. Therefore disable cancellation for now. */
|
||||
int state = PTHREAD_CANCEL_ENABLE;
|
||||
__libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
|
||||
0);
|
||||
#endif
|
||||
|
||||
fflush (stdout);
|
||||
#ifdef _LIBC
|
||||
# ifdef USE_IN_LIBIO
|
||||
_IO_flockfile (stderr);
|
||||
# else
|
||||
__flockfile (stderr);
|
||||
# endif
|
||||
#endif
|
||||
if (error_print_progname)
|
||||
(*error_print_progname) ();
|
||||
else
|
||||
{
|
||||
#if _LIBC && USE_IN_LIBIO
|
||||
#if _LIBC
|
||||
if (_IO_fwide (stderr, 0) > 0)
|
||||
__fwprintf (stderr, L"%s: ", program_name);
|
||||
else
|
||||
@ -277,26 +220,13 @@ error (status, errnum, message, va_alist)
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
}
|
||||
|
||||
#ifdef VA_START
|
||||
VA_START (args, message);
|
||||
va_start (args, message);
|
||||
error_tail (status, errnum, message, args);
|
||||
#else
|
||||
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
|
||||
++error_message_count;
|
||||
if (errnum)
|
||||
print_errno_message (errnum);
|
||||
putc ('\n', stderr);
|
||||
fflush (stderr);
|
||||
if (status)
|
||||
exit (status);
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# ifdef USE_IN_LIBIO
|
||||
_IO_funlockfile (stderr);
|
||||
# else
|
||||
__funlockfile (stderr);
|
||||
# ifdef __libc_ptf_call
|
||||
__libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
@ -306,22 +236,10 @@ error (status, errnum, message, va_alist)
|
||||
int error_one_per_line;
|
||||
|
||||
void
|
||||
#if defined VA_START && __STDC__
|
||||
error_at_line (int status, int errnum, const char *file_name,
|
||||
unsigned int line_number, const char *message, ...)
|
||||
#else
|
||||
error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
||||
int status;
|
||||
int errnum;
|
||||
const char *file_name;
|
||||
unsigned int line_number;
|
||||
char *message;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
#ifdef VA_START
|
||||
va_list args;
|
||||
#endif
|
||||
|
||||
if (error_one_per_line)
|
||||
{
|
||||
@ -338,19 +256,23 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
||||
old_line_number = line_number;
|
||||
}
|
||||
|
||||
#if defined _LIBC && defined __libc_ptf_call
|
||||
/* We do not want this call to be cut short by a thread
|
||||
cancellation. Therefore disable cancellation for now. */
|
||||
int state = PTHREAD_CANCEL_ENABLE;
|
||||
__libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
|
||||
0);
|
||||
#endif
|
||||
|
||||
fflush (stdout);
|
||||
#ifdef _LIBC
|
||||
# ifdef USE_IN_LIBIO
|
||||
_IO_flockfile (stderr);
|
||||
# else
|
||||
__flockfile (stderr);
|
||||
# endif
|
||||
#endif
|
||||
if (error_print_progname)
|
||||
(*error_print_progname) ();
|
||||
else
|
||||
{
|
||||
#if _LIBC && USE_IN_LIBIO
|
||||
#if _LIBC
|
||||
if (_IO_fwide (stderr, 0) > 0)
|
||||
__fwprintf (stderr, L"%s: ", program_name);
|
||||
else
|
||||
@ -360,7 +282,7 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
||||
|
||||
if (file_name != NULL)
|
||||
{
|
||||
#if _LIBC && USE_IN_LIBIO
|
||||
#if _LIBC
|
||||
if (_IO_fwide (stderr, 0) > 0)
|
||||
__fwprintf (stderr, L"%s:%d: ", file_name, line_number);
|
||||
else
|
||||
@ -368,26 +290,13 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
||||
fprintf (stderr, "%s:%d: ", file_name, line_number);
|
||||
}
|
||||
|
||||
#ifdef VA_START
|
||||
VA_START (args, message);
|
||||
va_start (args, message);
|
||||
error_tail (status, errnum, message, args);
|
||||
#else
|
||||
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
|
||||
++error_message_count;
|
||||
if (errnum)
|
||||
print_errno_message (errnum);
|
||||
putc ('\n', stderr);
|
||||
fflush (stderr);
|
||||
if (status)
|
||||
exit (status);
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# ifdef USE_IN_LIBIO
|
||||
_IO_funlockfile (stderr);
|
||||
# else
|
||||
__funlockfile (stderr);
|
||||
# ifdef __libc_ptf_call
|
||||
__libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
@ -1,24 +1,20 @@
|
||||
/* Declaration for error-reporting function
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _ERROR_H
|
||||
#define _ERROR_H 1
|
||||
@ -40,17 +36,15 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
|
||||
/* Print a message with `fprintf (stderr, FORMAT, ...)';
|
||||
if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
|
||||
If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
|
||||
|
||||
extern void error (int status, int errnum, const char *format, ...)
|
||||
extern void error (int __status, int __errnum, const char *__format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
|
||||
extern void error_at_line (int status, int errnum, const char *fname,
|
||||
unsigned int lineno, const char *format, ...)
|
||||
extern void error_at_line (int __status, int __errnum, const char *__fname,
|
||||
unsigned int __lineno, const char *__format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 5, 6)));
|
||||
|
||||
/* If NULL, error will flush stdout, then print on stderr the program
|
||||
@ -58,12 +52,6 @@ extern void error_at_line (int status, int errnum, const char *fname,
|
||||
function without parameters instead. */
|
||||
extern void (*error_print_progname) (void);
|
||||
|
||||
#else
|
||||
void error ();
|
||||
void error_at_line ();
|
||||
extern void (*error_print_progname) ();
|
||||
#endif
|
||||
|
||||
/* This variable is incremented each time `error' is called. */
|
||||
extern unsigned int error_message_count;
|
||||
|
||||
|
32
contrib/gnu-sort/lib/exit.h
Normal file
32
contrib/gnu-sort/lib/exit.h
Normal file
@ -0,0 +1,32 @@
|
||||
/* exit() function.
|
||||
Copyright (C) 1995, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _EXIT_H
|
||||
#define _EXIT_H
|
||||
|
||||
/* Get exit() declaration. */
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Some systems do not define EXIT_*, even with STDC_HEADERS. */
|
||||
#ifndef EXIT_SUCCESS
|
||||
# define EXIT_SUCCESS 0
|
||||
#endif
|
||||
#ifndef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
#endif /* _EXIT_H */
|
27
contrib/gnu-sort/lib/exitfail.c
Normal file
27
contrib/gnu-sort/lib/exitfail.c
Normal file
@ -0,0 +1,27 @@
|
||||
/* Failure exit status
|
||||
|
||||
Copyright (C) 2002, 2003 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. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "exitfail.h"
|
||||
#include "exit.h"
|
||||
|
||||
int volatile exit_failure = EXIT_FAILURE;
|
20
contrib/gnu-sort/lib/exitfail.h
Normal file
20
contrib/gnu-sort/lib/exitfail.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* Failure exit status
|
||||
|
||||
Copyright (C) 2002 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. */
|
||||
|
||||
extern int volatile exit_failure;
|
@ -1,31 +1,30 @@
|
||||
/* Convenience header for conditional use of GNU <libintl.h>.
|
||||
Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published
|
||||
by the Free Software Foundation; either version 2, or (at your option)
|
||||
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
|
||||
Library General Public License for more details.
|
||||
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 Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _LIBGETTEXT_H
|
||||
# define _LIBGETTEXT_H 1
|
||||
#define _LIBGETTEXT_H 1
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
# if ENABLE_NLS
|
||||
#if ENABLE_NLS
|
||||
|
||||
/* Get declarations of GNU message catalog functions. */
|
||||
# include <libintl.h>
|
||||
# include <libintl.h>
|
||||
|
||||
# else
|
||||
#else
|
||||
|
||||
/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
|
||||
chokes if dcgettext is defined as a macro. So include it now, to make
|
||||
@ -33,29 +32,29 @@
|
||||
as well because people using "gettext.h" will not include <libintl.h>,
|
||||
and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
|
||||
is OK. */
|
||||
# if defined(__sun)
|
||||
# include <locale.h>
|
||||
# endif
|
||||
#if defined(__sun)
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
/* Disabled NLS.
|
||||
The casts to 'const char *' serve the purpose of producing warnings
|
||||
for invalid uses of the value returned from these functions.
|
||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||
contain "#define const". */
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
|
||||
# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
|
||||
# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
|
||||
# define textdomain(Domainname) ((const char *) (Domainname))
|
||||
# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
|
||||
# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
|
||||
# define textdomain(Domainname) ((const char *) (Domainname))
|
||||
# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
|
||||
# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* A pseudo function call that serves as a marker for the automated
|
||||
extraction of messages, but does not call gettext(). The run-time
|
||||
@ -64,6 +63,6 @@
|
||||
and other string expressions won't work.
|
||||
The macro's expansion is not parenthesized, so that it is suitable as
|
||||
initializer for static 'char[]' or 'const char[]' variables. */
|
||||
# define gettext_noop(String) String
|
||||
#define gettext_noop(String) String
|
||||
|
||||
#endif /* _LIBGETTEXT_H */
|
||||
|
@ -1,18 +1,24 @@
|
||||
/* Determine whether a locale is hard.
|
||||
|
||||
Copyright (C) 1999, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef HARD_LOCALE_H_
|
||||
# define HARD_LOCALE_H_ 1
|
||||
|
||||
# if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# endif
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
|
||||
int hard_locale PARAMS ((int));
|
||||
int hard_locale (int);
|
||||
|
||||
#endif /* HARD_LOCALE_H_ */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* human.c -- print human readable file size
|
||||
|
||||
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 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,55 +17,40 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Originally contributed by lm@sgi.com;
|
||||
--si, output block size selection, and large file support
|
||||
added by eggert@twinsun.com. */
|
||||
/* Written by Paul Eggert and Larry McVoy. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "human.h"
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
# define SIZE_MAX ((size_t) -1)
|
||||
#endif
|
||||
#ifndef UINTMAX_MAX
|
||||
# define UINTMAX_MAX ((uintmax_t) -1)
|
||||
#endif
|
||||
|
||||
#if HAVE_LOCALE_H && HAVE_LOCALECONV
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_GETENV
|
||||
"this configure-time declaration test was not run"
|
||||
#endif
|
||||
#if !HAVE_DECL_GETENV
|
||||
char *getenv ();
|
||||
#endif
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
#include <argmatch.h>
|
||||
#include <error.h>
|
||||
#include <xstrtol.h>
|
||||
|
||||
#include "human.h"
|
||||
/* The maximum length of a suffix like "KiB". */
|
||||
#define HUMAN_READABLE_SUFFIX_LENGTH_MAX 3
|
||||
|
||||
static const char suffixes[] =
|
||||
static const char power_letter[] =
|
||||
{
|
||||
0, /* not used */
|
||||
'K', /* kibi ('k' for kilo is a special case) */
|
||||
@ -78,33 +63,18 @@ static const char suffixes[] =
|
||||
'Y' /* yotta or 2**80 */
|
||||
};
|
||||
|
||||
/* Generate into P[-1] (and possibly P[-2]) the proper suffix for
|
||||
POWER and BASE. Return the address of the generated suffix. */
|
||||
static char *
|
||||
generate_suffix_backwards (char *p, int power, int base)
|
||||
{
|
||||
char letter = suffixes[power];
|
||||
|
||||
if (base == 1000)
|
||||
{
|
||||
*--p = 'B';
|
||||
if (power == 1)
|
||||
letter = 'k';
|
||||
}
|
||||
|
||||
*--p = letter;
|
||||
return p;
|
||||
}
|
||||
|
||||
/* If INEXACT_STYLE is not human_round_to_even, and if easily
|
||||
/* If INEXACT_STYLE is not human_round_to_nearest, and if easily
|
||||
possible, adjust VALUE according to the style. */
|
||||
static double
|
||||
adjust_value (enum human_inexact_style inexact_style, double value)
|
||||
|
||||
static long double
|
||||
adjust_value (int inexact_style, long double value)
|
||||
{
|
||||
/* Do not use the floor or ceil functions, as that would mean
|
||||
linking with the standard math library, which is a porting pain.
|
||||
So leave the value alone if it is too large to easily round. */
|
||||
if (inexact_style != human_round_to_even && value < (uintmax_t) -1)
|
||||
/* Do not use the floorl or ceill functions, as that would mean
|
||||
checking for their presence and possibly linking with the
|
||||
standard math library, which is a porting pain. So leave the
|
||||
value alone if it is too large to easily round. */
|
||||
if (inexact_style != human_round_to_nearest && value < UINTMAX_MAX)
|
||||
{
|
||||
uintmax_t u = value;
|
||||
value = u + (inexact_style == human_ceiling && u != value);
|
||||
@ -113,199 +83,321 @@ adjust_value (enum human_inexact_style inexact_style, double value)
|
||||
return value;
|
||||
}
|
||||
|
||||
/* Like human_readable_inexact, except always round to even. */
|
||||
char *
|
||||
human_readable (uintmax_t n, char *buf,
|
||||
int from_block_size, int output_block_size)
|
||||
/* Group the digits of NUMBER according to the grouping rules of the
|
||||
current locale. NUMBER contains NUMBERLEN digits. Modify the
|
||||
bytes pointed to by NUMBER in place, subtracting 1 from NUMBER for
|
||||
each byte inserted. Return the starting address of the modified
|
||||
number.
|
||||
|
||||
To group the digits, use GROUPING and THOUSANDS_SEP as in `struct
|
||||
lconv' from <locale.h>. */
|
||||
|
||||
static char *
|
||||
group_number (char *number, size_t numberlen,
|
||||
char const *grouping, char const *thousands_sep)
|
||||
{
|
||||
return human_readable_inexact (n, buf, from_block_size, output_block_size,
|
||||
human_round_to_even);
|
||||
register char *d;
|
||||
size_t grouplen = SIZE_MAX;
|
||||
size_t thousands_seplen = strlen (thousands_sep);
|
||||
size_t i = numberlen;
|
||||
|
||||
/* The maximum possible value for NUMBERLEN is the number of digits
|
||||
in the square of the largest uintmax_t, so double the size of
|
||||
uintmax_t before converting to a bound. 302 / 1000 is ceil
|
||||
(log10 (2.0)). Add 1 for integer division truncation. */
|
||||
char buf[2 * sizeof (uintmax_t) * CHAR_BIT * 302 / 1000 + 1];
|
||||
|
||||
memcpy (buf, number, numberlen);
|
||||
d = number + numberlen;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
unsigned char g = *grouping;
|
||||
|
||||
if (g)
|
||||
{
|
||||
grouplen = g < CHAR_MAX ? g : i;
|
||||
grouping++;
|
||||
}
|
||||
|
||||
if (i < grouplen)
|
||||
grouplen = i;
|
||||
|
||||
d -= grouplen;
|
||||
i -= grouplen;
|
||||
memcpy (d, buf + i, grouplen);
|
||||
if (i == 0)
|
||||
return d;
|
||||
|
||||
d -= thousands_seplen;
|
||||
memcpy (d, thousands_sep, thousands_seplen);
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert N to a human readable format in BUF.
|
||||
/* Convert N to a human readable format in BUF, using the options OPTS.
|
||||
|
||||
N is expressed in units of FROM_BLOCK_SIZE. FROM_BLOCK_SIZE must
|
||||
be nonnegative.
|
||||
|
||||
OUTPUT_BLOCK_SIZE must be nonzero. If it is positive, use units of
|
||||
OUTPUT_BLOCK_SIZE in the output number.
|
||||
Use units of TO_BLOCK_SIZE in the output number. TO_BLOCK_SIZE
|
||||
must be positive.
|
||||
|
||||
Use INEXACT_STYLE to determine whether to take the ceiling or floor
|
||||
of any result that cannot be expressed exactly.
|
||||
Use (OPTS & (human_round_to_nearest | human_floor | human_ceiling))
|
||||
to determine whether to take the ceiling or floor of any result
|
||||
that cannot be expressed exactly.
|
||||
|
||||
If OUTPUT_BLOCK_SIZE is negative, use a format like "127K" if
|
||||
possible, using powers of -OUTPUT_BLOCK_SIZE; otherwise, use
|
||||
ordinary decimal format. Normally -OUTPUT_BLOCK_SIZE is either
|
||||
1000 or 1024; it must be at least 2. Most people visually process
|
||||
strings of 3-4 digits effectively, but longer strings of digits are
|
||||
more prone to misinterpretation. Hence, converting to an
|
||||
abbreviated form usually improves readability. Use a suffix
|
||||
indicating which power is being used. For example, assuming
|
||||
-OUTPUT_BLOCK_SIZE is 1024, 8500 would be converted to 8.3K,
|
||||
133456345 to 127M, 56990456345 to 53G, and so on. Numbers smaller
|
||||
than -OUTPUT_BLOCK_SIZE aren't modified. If -OUTPUT_BLOCK_SIZE is
|
||||
1024, append a "B" after any size letter. */
|
||||
If (OPTS & human_group_digits), group the thousands digits
|
||||
according to the locale, e.g., `1,000,000' in an American English
|
||||
locale.
|
||||
|
||||
If (OPTS & human_autoscale), deduce the output block size
|
||||
automatically; TO_BLOCK_SIZE must be 1 but it has no effect on the
|
||||
output. Use powers of 1024 if (OPTS & human_base_1024), and powers
|
||||
of 1000 otherwise. For example, assuming powers of 1024, 8500
|
||||
would be converted to 8.3, 133456345 to 127, 56990456345 to 53, and
|
||||
so on. Numbers smaller than the power aren't modified.
|
||||
human_autoscale is normally used together with human_SI.
|
||||
|
||||
If (OPTS & human_SI), append an SI prefix indicating which power is
|
||||
being used. If in addition (OPTS & human_B), append "B" (if base
|
||||
1000) or "iB" (if base 1024) to the SI prefix. When ((OPTS &
|
||||
human_SI) && ! (OPTS & human_autoscale)), TO_BLOCK_SIZE must be a
|
||||
power of 1024 or of 1000, depending on (OPTS &
|
||||
human_base_1024). */
|
||||
|
||||
char *
|
||||
human_readable_inexact (uintmax_t n, char *buf,
|
||||
int from_block_size, int output_block_size,
|
||||
enum human_inexact_style inexact_style)
|
||||
human_readable (uintmax_t n, char *buf, int opts,
|
||||
uintmax_t from_block_size, uintmax_t to_block_size)
|
||||
{
|
||||
int inexact_style =
|
||||
opts & (human_round_to_nearest | human_floor | human_ceiling);
|
||||
unsigned int base = opts & human_base_1024 ? 1024 : 1000;
|
||||
uintmax_t amt;
|
||||
int base;
|
||||
int to_block_size;
|
||||
int tenths = 0;
|
||||
int power;
|
||||
int tenths;
|
||||
int exponent = -1;
|
||||
int exponent_max = sizeof power_letter - 1;
|
||||
char *p;
|
||||
char *psuffix;
|
||||
char const *integerlim;
|
||||
|
||||
/* 0 means adjusted N == AMT.TENTHS;
|
||||
1 means AMT.TENTHS < adjusted N < AMT.TENTHS + 0.05;
|
||||
2 means adjusted N == AMT.TENTHS + 0.05;
|
||||
3 means AMT.TENTHS + 0.05 < adjusted N < AMT.TENTHS + 0.1. */
|
||||
int rounding = 0;
|
||||
int rounding;
|
||||
|
||||
if (output_block_size < 0)
|
||||
char const *decimal_point = ".";
|
||||
size_t decimal_pointlen = 1;
|
||||
char const *grouping = "";
|
||||
char const *thousands_sep = "";
|
||||
#if HAVE_LOCALE_H && HAVE_LOCALECONV
|
||||
struct lconv const *l = localeconv ();
|
||||
size_t pointlen = strlen (l->decimal_point);
|
||||
if (0 < pointlen && pointlen <= MB_LEN_MAX)
|
||||
{
|
||||
base = -output_block_size;
|
||||
to_block_size = 1;
|
||||
decimal_point = l->decimal_point;
|
||||
decimal_pointlen = pointlen;
|
||||
}
|
||||
else
|
||||
{
|
||||
base = 0;
|
||||
to_block_size = output_block_size;
|
||||
}
|
||||
|
||||
p = buf + LONGEST_HUMAN_READABLE;
|
||||
*p = '\0';
|
||||
|
||||
#ifdef lint
|
||||
/* Suppress `used before initialized' warning. */
|
||||
power = 0;
|
||||
grouping = l->grouping;
|
||||
if (strlen (l->thousands_sep) <= MB_LEN_MAX)
|
||||
thousands_sep = l->thousands_sep;
|
||||
#endif
|
||||
|
||||
/* Adjust AMT out of FROM_BLOCK_SIZE units and into TO_BLOCK_SIZE units. */
|
||||
psuffix = buf + LONGEST_HUMAN_READABLE - HUMAN_READABLE_SUFFIX_LENGTH_MAX;
|
||||
p = psuffix;
|
||||
|
||||
/* Adjust AMT out of FROM_BLOCK_SIZE units and into TO_BLOCK_SIZE
|
||||
units. If this can be done exactly with integer arithmetic, do
|
||||
not use floating point operations. */
|
||||
if (to_block_size <= from_block_size)
|
||||
{
|
||||
if (from_block_size % to_block_size == 0)
|
||||
{
|
||||
uintmax_t multiplier = from_block_size / to_block_size;
|
||||
amt = n * multiplier;
|
||||
if (amt / multiplier == n)
|
||||
{
|
||||
tenths = 0;
|
||||
rounding = 0;
|
||||
goto use_integer_arithmetic;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (from_block_size != 0 && to_block_size % from_block_size == 0)
|
||||
{
|
||||
uintmax_t divisor = to_block_size / from_block_size;
|
||||
uintmax_t r10 = (n % divisor) * 10;
|
||||
uintmax_t r2 = (r10 % divisor) * 2;
|
||||
amt = n / divisor;
|
||||
tenths = r10 / divisor;
|
||||
rounding = r2 < divisor ? 0 < r2 : 2 + (divisor < r2);
|
||||
goto use_integer_arithmetic;
|
||||
}
|
||||
|
||||
{
|
||||
int multiplier;
|
||||
int divisor;
|
||||
int r2;
|
||||
int r10;
|
||||
if (to_block_size <= from_block_size
|
||||
? (from_block_size % to_block_size != 0
|
||||
|| (multiplier = from_block_size / to_block_size,
|
||||
(amt = n * multiplier) / multiplier != n))
|
||||
: (from_block_size == 0
|
||||
|| to_block_size % from_block_size != 0
|
||||
|| (divisor = to_block_size / from_block_size,
|
||||
r10 = (n % divisor) * 10,
|
||||
r2 = (r10 % divisor) * 2,
|
||||
amt = n / divisor,
|
||||
tenths = r10 / divisor,
|
||||
rounding = r2 < divisor ? 0 < r2 : 2 + (divisor < r2),
|
||||
0)))
|
||||
/* Either the result cannot be computed easily using uintmax_t,
|
||||
or from_block_size is zero. Fall back on floating point.
|
||||
FIXME: This can yield answers that are slightly off. */
|
||||
|
||||
long double dto_block_size = to_block_size;
|
||||
long double damt = n * (from_block_size / dto_block_size);
|
||||
size_t buflen;
|
||||
size_t nonintegerlen;
|
||||
|
||||
if (! (opts & human_autoscale))
|
||||
{
|
||||
/* Either the result cannot be computed easily using uintmax_t,
|
||||
or from_block_size is zero. Fall back on floating point.
|
||||
FIXME: This can yield answers that are slightly off. */
|
||||
sprintf (buf, "%.0Lf", adjust_value (inexact_style, damt));
|
||||
buflen = strlen (buf);
|
||||
nonintegerlen = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
long double e = 1;
|
||||
exponent = 0;
|
||||
|
||||
double damt = n * (from_block_size / (double) to_block_size);
|
||||
|
||||
if (! base)
|
||||
sprintf (buf, "%.0f", adjust_value (inexact_style, damt));
|
||||
else
|
||||
do
|
||||
{
|
||||
char suffix[3];
|
||||
char const *psuffix;
|
||||
double e = 1;
|
||||
power = 0;
|
||||
e *= base;
|
||||
exponent++;
|
||||
}
|
||||
while (e * base <= damt && exponent < exponent_max);
|
||||
|
||||
damt /= e;
|
||||
|
||||
sprintf (buf, "%.1Lf", adjust_value (inexact_style, damt));
|
||||
buflen = strlen (buf);
|
||||
nonintegerlen = decimal_pointlen + 1;
|
||||
|
||||
if (1 + nonintegerlen + ! (opts & human_base_1024) < buflen
|
||||
|| ((opts & human_suppress_point_zero)
|
||||
&& buf[buflen - 1] == '0'))
|
||||
{
|
||||
sprintf (buf, "%.0Lf",
|
||||
adjust_value (inexact_style, damt * 10) / 10);
|
||||
buflen = strlen (buf);
|
||||
nonintegerlen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
p = psuffix - buflen;
|
||||
memmove (p, buf, buflen);
|
||||
integerlim = p + buflen - nonintegerlen;
|
||||
}
|
||||
goto do_grouping;
|
||||
|
||||
use_integer_arithmetic:
|
||||
{
|
||||
/* The computation can be done exactly, with integer arithmetic.
|
||||
|
||||
Use power of BASE notation if requested and if adjusted AMT is
|
||||
large enough. */
|
||||
|
||||
if (opts & human_autoscale)
|
||||
{
|
||||
exponent = 0;
|
||||
|
||||
if (base <= amt)
|
||||
{
|
||||
do
|
||||
{
|
||||
e *= base;
|
||||
power++;
|
||||
unsigned r10 = (amt % base) * 10 + tenths;
|
||||
unsigned r2 = (r10 % base) * 2 + (rounding >> 1);
|
||||
amt /= base;
|
||||
tenths = r10 / base;
|
||||
rounding = (r2 < base
|
||||
? (r2 + rounding) != 0
|
||||
: 2 + (base < r2 + rounding));
|
||||
exponent++;
|
||||
}
|
||||
while (e * base <= damt && power < sizeof suffixes - 1);
|
||||
while (base <= amt && exponent < exponent_max);
|
||||
|
||||
damt /= e;
|
||||
if (amt < 10)
|
||||
{
|
||||
if (inexact_style == human_round_to_nearest
|
||||
? 2 < rounding + (tenths & 1)
|
||||
: inexact_style == human_ceiling && 0 < rounding)
|
||||
{
|
||||
tenths++;
|
||||
rounding = 0;
|
||||
|
||||
suffix[2] = '\0';
|
||||
psuffix = generate_suffix_backwards (suffix + 2, power, base);
|
||||
sprintf (buf, "%.1f%s",
|
||||
adjust_value (inexact_style, damt), psuffix);
|
||||
if (4 + (base == 1000) < strlen (buf))
|
||||
sprintf (buf, "%.0f%s",
|
||||
adjust_value (inexact_style, damt * 10) / 10, psuffix);
|
||||
if (tenths == 10)
|
||||
{
|
||||
amt++;
|
||||
tenths = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (amt < 10
|
||||
&& (tenths || ! (opts & human_suppress_point_zero)))
|
||||
{
|
||||
*--p = '0' + tenths;
|
||||
p -= decimal_pointlen;
|
||||
memcpy (p, decimal_point, decimal_pointlen);
|
||||
tenths = rounding = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
if (inexact_style == human_round_to_nearest
|
||||
? 5 < tenths + (0 < rounding + (amt & 1))
|
||||
: inexact_style == human_ceiling && 0 < tenths + rounding)
|
||||
{
|
||||
amt++;
|
||||
|
||||
if ((opts & human_autoscale)
|
||||
&& amt == base && exponent < exponent_max)
|
||||
{
|
||||
exponent++;
|
||||
if (! (opts & human_suppress_point_zero))
|
||||
{
|
||||
*--p = '0';
|
||||
p -= decimal_pointlen;
|
||||
memcpy (p, decimal_point, decimal_pointlen);
|
||||
}
|
||||
amt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
integerlim = p;
|
||||
|
||||
do
|
||||
{
|
||||
int digit = amt % 10;
|
||||
*--p = digit + '0';
|
||||
}
|
||||
while ((amt /= 10) != 0);
|
||||
}
|
||||
|
||||
/* Use power of BASE notation if adjusted AMT is large enough. */
|
||||
do_grouping:
|
||||
if (opts & human_group_digits)
|
||||
p = group_number (p, integerlim - p, grouping, thousands_sep);
|
||||
|
||||
if (base && base <= amt)
|
||||
if (opts & human_SI)
|
||||
{
|
||||
power = 0;
|
||||
|
||||
do
|
||||
if (exponent < 0)
|
||||
{
|
||||
int r10 = (amt % base) * 10 + tenths;
|
||||
int r2 = (r10 % base) * 2 + (rounding >> 1);
|
||||
amt /= base;
|
||||
tenths = r10 / base;
|
||||
rounding = (r2 < base
|
||||
? 0 < r2 + rounding
|
||||
: 2 + (base < r2 + rounding));
|
||||
power++;
|
||||
uintmax_t power;
|
||||
exponent = 0;
|
||||
for (power = 1; power < to_block_size; power *= base)
|
||||
if (++exponent == exponent_max)
|
||||
break;
|
||||
}
|
||||
while (base <= amt && power < sizeof suffixes - 1);
|
||||
|
||||
p = generate_suffix_backwards (p, power, base);
|
||||
if (exponent)
|
||||
*psuffix++ = (! (opts & human_base_1024) && exponent == 1
|
||||
? 'k'
|
||||
: power_letter[exponent]);
|
||||
|
||||
if (amt < 10)
|
||||
if (opts & human_B)
|
||||
{
|
||||
if (2 * (1 - (int) inexact_style)
|
||||
< rounding + (tenths & (inexact_style == human_round_to_even)))
|
||||
{
|
||||
tenths++;
|
||||
rounding = 0;
|
||||
|
||||
if (tenths == 10)
|
||||
{
|
||||
amt++;
|
||||
tenths = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (amt < 10)
|
||||
{
|
||||
*--p = '0' + tenths;
|
||||
*--p = '.';
|
||||
tenths = rounding = 0;
|
||||
}
|
||||
if ((opts & human_base_1024) && exponent)
|
||||
*psuffix++ = 'i';
|
||||
*psuffix++ = 'B';
|
||||
}
|
||||
}
|
||||
|
||||
if (inexact_style == human_ceiling
|
||||
? 0 < tenths + rounding
|
||||
: inexact_style == human_round_to_even
|
||||
? 5 < tenths + (2 < rounding + (amt & 1))
|
||||
: /* inexact_style == human_floor */ 0)
|
||||
{
|
||||
amt++;
|
||||
|
||||
if (amt == base && power < sizeof suffixes - 1)
|
||||
{
|
||||
*p = suffixes[power + 1];
|
||||
*--p = '0';
|
||||
*--p = '.';
|
||||
amt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
do
|
||||
*--p = '0' + (int) (amt % 10);
|
||||
while ((amt /= 10) != 0);
|
||||
*psuffix = '\0';
|
||||
|
||||
return p;
|
||||
}
|
||||
@ -318,44 +410,68 @@ human_readable_inexact (uintmax_t n, char *buf,
|
||||
#endif
|
||||
|
||||
static char const *const block_size_args[] = { "human-readable", "si", 0 };
|
||||
static int const block_size_types[] = { -1024, -1000 };
|
||||
static int const block_size_opts[] =
|
||||
{
|
||||
human_autoscale + human_SI + human_base_1024,
|
||||
human_autoscale + human_SI
|
||||
};
|
||||
|
||||
static int
|
||||
static uintmax_t
|
||||
default_block_size (void)
|
||||
{
|
||||
return getenv ("POSIXLY_CORRECT") ? 512 : DEFAULT_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
static strtol_error
|
||||
humblock (char const *spec, int *block_size)
|
||||
humblock (char const *spec, uintmax_t *block_size, int *options)
|
||||
{
|
||||
int i;
|
||||
int opts = 0;
|
||||
|
||||
if (! spec && ! (spec = getenv ("BLOCK_SIZE")))
|
||||
*block_size = default_block_size ();
|
||||
else if (0 <= (i = ARGMATCH (spec, block_size_args, block_size_types)))
|
||||
*block_size = block_size_types[i];
|
||||
else
|
||||
{
|
||||
char *ptr;
|
||||
unsigned long val;
|
||||
strtol_error e = xstrtoul (spec, &ptr, 0, &val, "eEgGkKmMpPtTyYzZ0");
|
||||
if (e != LONGINT_OK)
|
||||
return e;
|
||||
if (*ptr)
|
||||
return LONGINT_INVALID_SUFFIX_CHAR;
|
||||
if ((int) val < 0 || val != (int) val)
|
||||
return LONGINT_OVERFLOW;
|
||||
*block_size = (int) val;
|
||||
if (*spec == '\'')
|
||||
{
|
||||
opts |= human_group_digits;
|
||||
spec++;
|
||||
}
|
||||
|
||||
if (0 <= (i = ARGMATCH (spec, block_size_args, block_size_opts)))
|
||||
{
|
||||
opts |= block_size_opts[i];
|
||||
*block_size = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *ptr;
|
||||
strtol_error e = xstrtoumax (spec, &ptr, 0, block_size,
|
||||
"eEgGkKmMpPtTyYzZ0");
|
||||
if (e != LONGINT_OK)
|
||||
return e;
|
||||
for (; ! ('0' <= *spec && *spec <= '9'); spec++)
|
||||
if (spec == ptr)
|
||||
{
|
||||
opts |= human_SI;
|
||||
if (ptr[-1] == 'B')
|
||||
opts |= human_B;
|
||||
if (ptr[-1] != 'B' || ptr[-2] == 'i')
|
||||
opts |= human_base_1024;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*options = opts;
|
||||
return LONGINT_OK;
|
||||
}
|
||||
|
||||
void
|
||||
human_block_size (char const *spec, int report_errors, int *block_size)
|
||||
int
|
||||
human_options (char const *spec, bool report_errors, uintmax_t *block_size)
|
||||
{
|
||||
strtol_error e = humblock (spec, block_size);
|
||||
int opts;
|
||||
strtol_error e = humblock (spec, block_size, &opts);
|
||||
if (*block_size == 0)
|
||||
{
|
||||
*block_size = default_block_size ();
|
||||
@ -363,4 +479,5 @@ human_block_size (char const *spec, int report_errors, int *block_size)
|
||||
}
|
||||
if (e != LONGINT_OK && report_errors)
|
||||
STRTOL_FATAL_ERROR (spec, _("block size"), e);
|
||||
return opts;
|
||||
}
|
||||
|
@ -1,3 +1,24 @@
|
||||
/* human.h -- print human readable file size
|
||||
|
||||
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 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 Larry McVoy. */
|
||||
|
||||
#ifndef HUMAN_H_
|
||||
# define HUMAN_H_ 1
|
||||
|
||||
@ -5,35 +26,64 @@
|
||||
# include <config.h>
|
||||
# endif
|
||||
|
||||
# include <limits.h>
|
||||
# include <stdbool.h>
|
||||
|
||||
# if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
# endif
|
||||
|
||||
/* A conservative bound on the maximum length of a human-readable string.
|
||||
The output can be the product of the largest uintmax_t and the largest int,
|
||||
so add their sizes before converting to a bound on digits. */
|
||||
# define LONGEST_HUMAN_READABLE ((sizeof (uintmax_t) + sizeof (int)) \
|
||||
* CHAR_BIT / 3)
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# else
|
||||
# if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
enum human_inexact_style
|
||||
/* A conservative bound on the maximum length of a human-readable string.
|
||||
The output can be the square of the largest uintmax_t, so double
|
||||
its size before converting to a bound.
|
||||
302 / 1000 is ceil (log10 (2.0)). Add 1 for integer division truncation.
|
||||
Also, the output can have a thousands separator between every digit,
|
||||
so multiply by MB_LEN_MAX + 1 and then subtract MB_LEN_MAX.
|
||||
Finally, append 3, the maximum length of a suffix. */
|
||||
# define LONGEST_HUMAN_READABLE \
|
||||
((2 * sizeof (uintmax_t) * CHAR_BIT * 302 / 1000 + 1) * (MB_LEN_MAX + 1) \
|
||||
- MB_LEN_MAX + 3)
|
||||
|
||||
/* Options for human_readable. */
|
||||
enum
|
||||
{
|
||||
human_floor = -1,
|
||||
human_round_to_even = 0,
|
||||
human_ceiling = 1
|
||||
/* Unless otherwise specified these options may be ORed together. */
|
||||
|
||||
/* The following three options are mutually exclusive. */
|
||||
/* Round to plus infinity (default). */
|
||||
human_ceiling = 0,
|
||||
/* Round to nearest, ties to even. */
|
||||
human_round_to_nearest = 1,
|
||||
/* Round to minus infinity. */
|
||||
human_floor = 2,
|
||||
|
||||
/* Group digits together, e.g. `1,000,000'. This uses the
|
||||
locale-defined grouping; the traditional C locale does not group,
|
||||
so this has effect only if some other locale is in use. */
|
||||
human_group_digits = 4,
|
||||
|
||||
/* When autoscaling, suppress ".0" at end. */
|
||||
human_suppress_point_zero = 8,
|
||||
|
||||
/* Scale output and use SI-style units, ignoring the output block size. */
|
||||
human_autoscale = 16,
|
||||
|
||||
/* Prefer base 1024 to base 1000. */
|
||||
human_base_1024 = 32,
|
||||
|
||||
/* Append SI prefix, e.g. "k" or "M". */
|
||||
human_SI = 64,
|
||||
|
||||
/* Append "B" (if base 1000) or "iB" (if base 1024) to SI prefix. */
|
||||
human_B = 128
|
||||
};
|
||||
|
||||
char *human_readable PARAMS ((uintmax_t, char *, int, int));
|
||||
char *human_readable_inexact PARAMS ((uintmax_t, char *, int, int,
|
||||
enum human_inexact_style));
|
||||
char *human_readable (uintmax_t, char *, int, uintmax_t, uintmax_t);
|
||||
|
||||
void human_block_size PARAMS ((char const *, int, int *));
|
||||
int human_options (char const *, bool, uintmax_t *);
|
||||
|
||||
#endif /* HUMAN_H_ */
|
||||
|
49
contrib/gnu-sort/lib/inttostr.c
Normal file
49
contrib/gnu-sort/lib/inttostr.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* inttostr.c -- convert integers to printable strings
|
||||
|
||||
Copyright (C) 2001 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 */
|
||||
|
||||
#include "inttostr.h"
|
||||
|
||||
/* Convert I to a printable string in BUF, which must be at least
|
||||
INT_BUFSIZE_BOUND (INTTYPE) bytes long. Return the address of the
|
||||
printable string, which need not start at BUF. */
|
||||
|
||||
char *
|
||||
inttostr (inttype i, char *buf)
|
||||
{
|
||||
char *p = buf + INT_STRLEN_BOUND (inttype);
|
||||
*p = 0;
|
||||
|
||||
if (i < 0)
|
||||
{
|
||||
do
|
||||
*--p = '0' - i % 10;
|
||||
while ((i /= 10) != 0);
|
||||
|
||||
*--p = '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
*--p = '0' + i % 10;
|
||||
while ((i /= 10) != 0);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
49
contrib/gnu-sort/lib/inttostr.h
Normal file
49
contrib/gnu-sort/lib/inttostr.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* inttostr.h -- convert integers to printable strings
|
||||
|
||||
Copyright (C) 2001, 2002, 2003 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 */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Upper bound on the string length of an integer converted to string.
|
||||
302 / 1000 is ceil (log10 (2.0)). Subtract 1 for the sign bit;
|
||||
add 1 for integer division truncation; add 1 more for a minus sign. */
|
||||
#define INT_STRLEN_BOUND(t) ((sizeof (t) * CHAR_BIT - 1) * 302 / 1000 + 2)
|
||||
|
||||
#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
|
||||
|
||||
char *offtostr (off_t, char *);
|
||||
char *imaxtostr (intmax_t, char *);
|
||||
char *umaxtostr (uintmax_t, char *);
|
@ -1,5 +1,7 @@
|
||||
/* Utility to accept --help and --version options as unobtrusively as possible.
|
||||
Copyright (C) 1993, 1994, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1993, 1994, 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
|
||||
@ -21,21 +23,15 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/* Specification. */
|
||||
#include "long-options.h"
|
||||
#include "version-etc.h"
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "version-etc.h"
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
@ -53,8 +49,8 @@ parse_long_options (int argc,
|
||||
const char *command_name,
|
||||
const char *package,
|
||||
const char *version,
|
||||
const char *authors,
|
||||
void (*usage_func)())
|
||||
void (*usage_func) (int),
|
||||
/* const char *author1, ...*/ ...)
|
||||
{
|
||||
int c;
|
||||
int saved_opterr;
|
||||
@ -70,11 +66,15 @@ parse_long_options (int argc,
|
||||
switch (c)
|
||||
{
|
||||
case 'h':
|
||||
(*usage_func) (0);
|
||||
(*usage_func) (EXIT_SUCCESS);
|
||||
|
||||
case 'v':
|
||||
version_etc (stdout, command_name, package, version, authors);
|
||||
exit (0);
|
||||
{
|
||||
va_list authors;
|
||||
va_start (authors, usage_func);
|
||||
version_etc_va (stdout, command_name, package, version, authors);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
default:
|
||||
/* Don't process any other long-named options. */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* long-options.h -- declaration for --help- and --version-handling function.
|
||||
Copyright (C) 1993, 1994, 1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1994, 1998, 1999, 2003 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,19 +17,10 @@
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void
|
||||
parse_long_options PARAMS ((int _argc,
|
||||
char **_argv,
|
||||
const char *_command_name,
|
||||
const char *_package,
|
||||
const char *_version,
|
||||
const char *_authors,
|
||||
void (*_usage) (int)));
|
||||
void parse_long_options (int _argc,
|
||||
char **_argv,
|
||||
const char *_command_name,
|
||||
const char *_package,
|
||||
const char *_version,
|
||||
void (*_usage) (int),
|
||||
/* const char *author1, ...*/ ...);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Locale-specific memory comparison.
|
||||
Copyright 1999, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2002, 2003 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,26 +21,27 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "memcoll.h"
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
/* Compare S1 (with length S1LEN) and S2 (with length S2LEN) according
|
||||
to the LC_COLLATE locale. S1 and S2 do not overlap, and are not
|
||||
adjacent. Temporarily modify the bytes after S1 and S2, but
|
||||
restore their original contents before returning. Set errno to an
|
||||
adjacent. Perhaps temporarily modify the bytes after S1 and S2,
|
||||
but restore their original contents before returning. Set errno to an
|
||||
error number if there is an error, and to zero otherwise. */
|
||||
int
|
||||
memcoll (char *s1, size_t s1len, char *s2, size_t s2len)
|
||||
{
|
||||
int diff;
|
||||
|
||||
#if HAVE_STRCOLL
|
||||
|
||||
char n1 = s1[s1len];
|
||||
char n2 = s2[s2len];
|
||||
|
||||
@ -75,5 +76,14 @@ memcoll (char *s1, size_t s1len, char *s2, size_t s2len)
|
||||
s1[s1len - 1] = n1;
|
||||
s2[s2len - 1] = n2;
|
||||
|
||||
#else
|
||||
|
||||
diff = memcmp (s1, s2, s1len < s2len ? s1len : s2len);
|
||||
if (! diff)
|
||||
diff = s1len < s2len ? -1 : s1len != s2len;
|
||||
errno = 0;
|
||||
|
||||
#endif
|
||||
|
||||
return diff;
|
||||
}
|
||||
|
@ -1,18 +1,28 @@
|
||||
/* Locale-specific memory comparison.
|
||||
|
||||
Copyright (C) 1999, 2003 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. */
|
||||
|
||||
/* Contributed by Paul Eggert <eggert@twinsun.com>. */
|
||||
|
||||
#ifndef MEMCOLL_H_
|
||||
# define MEMCOLL_H_ 1
|
||||
|
||||
# if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# endif
|
||||
# include <stddef.h>
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
|
||||
int memcoll PARAMS ((char *, size_t, char *, size_t));
|
||||
int memcoll (char *, size_t, char *, size_t);
|
||||
|
||||
#endif /* MEMCOLL_H_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Define PATH_MAX somehow. Requires sys/types.h.
|
||||
Copyright (C) 1992, 1999, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1999, 2001, 2003 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,7 +25,7 @@
|
||||
/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
|
||||
PATH_MAX but might cause redefinition warnings when sys/param.h is
|
||||
later included (as on MORE/BSD 4.3). */
|
||||
# if defined _POSIX_VERSION || (defined HAVE_LIMITS_H && !defined __GNUC__)
|
||||
# if defined _POSIX_VERSION || !defined __GNUC__
|
||||
# include <limits.h>
|
||||
# endif
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Calculate the size of physical memory.
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2003 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,12 +31,61 @@
|
||||
# include <sys/pstat.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_SYSMP_H
|
||||
# include <sys/sysmp.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_SYSINFO_H && HAVE_MACHINE_HAL_SYSINFO_H
|
||||
# include <sys/sysinfo.h>
|
||||
# include <machine/hal_sysinfo.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_TABLE_H
|
||||
# include <sys/table.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_SYSCTL_H
|
||||
# include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_SYSTEMCFG_H
|
||||
# include <sys/systemcfg.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
/* MEMORYSTATUSEX is missing from older windows headers, so define
|
||||
a local replacement. */
|
||||
typedef struct
|
||||
{
|
||||
DWORD dwLength;
|
||||
DWORD dwMemoryLoad;
|
||||
DWORDLONG ullTotalPhys;
|
||||
DWORDLONG ullAvailPhys;
|
||||
DWORDLONG ullTotalPageFile;
|
||||
DWORDLONG ullAvailPageFile;
|
||||
DWORDLONG ullTotalVirtual;
|
||||
DWORDLONG ullAvailVirtual;
|
||||
DWORDLONG ullAvailExtendedVirtual;
|
||||
} lMEMORYSTATUSEX;
|
||||
typedef WINBOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
|
||||
#endif
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
|
||||
|
||||
/* Return the total amount of physical memory. */
|
||||
double
|
||||
physmem_total (void)
|
||||
{
|
||||
#if defined _SC_PHYS_PAGES && defined _SC_PAGESIZE
|
||||
{
|
||||
{ /* This works on linux-gnu, solaris2 and cygwin. */
|
||||
double pages = sysconf (_SC_PHYS_PAGES);
|
||||
double pagesize = sysconf (_SC_PAGESIZE);
|
||||
if (0 <= pages && 0 <= pagesize)
|
||||
@ -45,7 +94,7 @@ physmem_total (void)
|
||||
#endif
|
||||
|
||||
#if HAVE_PSTAT_GETSTATIC
|
||||
{
|
||||
{ /* This works on hpux11. */
|
||||
struct pst_static pss;
|
||||
if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0))
|
||||
{
|
||||
@ -57,6 +106,80 @@ physmem_total (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE
|
||||
{ /* This works on irix6. */
|
||||
struct rminfo realmem;
|
||||
if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0)
|
||||
{
|
||||
double pagesize = sysconf (_SC_PAGESIZE);
|
||||
double pages = realmem.physmem;
|
||||
if (0 <= pages && 0 <= pagesize)
|
||||
return pages * pagesize;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_GETSYSINFO && defined GSI_PHYSMEM
|
||||
{ /* This works on Tru64 UNIX V4/5. */
|
||||
int physmem;
|
||||
|
||||
if (getsysinfo (GSI_PHYSMEM, (caddr_t) &physmem, sizeof (physmem),
|
||||
NULL, NULL, NULL) == 1)
|
||||
{
|
||||
double kbytes = physmem;
|
||||
|
||||
if (0 <= kbytes)
|
||||
return kbytes * 1024.0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_SYSCTL && defined HW_PHYSMEM
|
||||
{ /* This works on *bsd and darwin. */
|
||||
unsigned int physmem;
|
||||
size_t len = sizeof physmem;
|
||||
static int mib[2] = { CTL_HW, HW_PHYSMEM };
|
||||
|
||||
if (sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0
|
||||
&& len == sizeof (physmem))
|
||||
return (double) physmem;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE__SYSTEM_CONFIGURATION
|
||||
/* This works on AIX. */
|
||||
return _system_configuration.physmem;
|
||||
#endif
|
||||
|
||||
#if defined _WIN32
|
||||
{ /* this works on windows */
|
||||
PFN_MS_EX pfnex;
|
||||
HMODULE h = GetModuleHandle ("kernel32.dll");
|
||||
|
||||
if (!h)
|
||||
return 0.0;
|
||||
|
||||
/* Use GlobalMemoryStatusEx if available. */
|
||||
if ((pfnex = (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx")))
|
||||
{
|
||||
lMEMORYSTATUSEX lms_ex;
|
||||
lms_ex.dwLength = sizeof lms_ex;
|
||||
if (!pfnex (&lms_ex))
|
||||
return 0.0;
|
||||
return (double) lms_ex.ullTotalPhys;
|
||||
}
|
||||
|
||||
/* Fall back to GlobalMemoryStatus which is always available.
|
||||
but returns wrong results for physical memory > 4GB. */
|
||||
else
|
||||
{
|
||||
MEMORYSTATUS ms;
|
||||
GlobalMemoryStatus (&ms);
|
||||
return (double) ms.dwTotalPhys;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Guess 64 MB. It's probably an older host, so guess small. */
|
||||
return 64 * 1024 * 1024;
|
||||
}
|
||||
@ -66,7 +189,7 @@ double
|
||||
physmem_available (void)
|
||||
{
|
||||
#if defined _SC_AVPHYS_PAGES && defined _SC_PAGESIZE
|
||||
{
|
||||
{ /* This works on linux-gnu, solaris2 and cygwin. */
|
||||
double pages = sysconf (_SC_AVPHYS_PAGES);
|
||||
double pagesize = sysconf (_SC_PAGESIZE);
|
||||
if (0 <= pages && 0 <= pagesize)
|
||||
@ -75,7 +198,7 @@ physmem_available (void)
|
||||
#endif
|
||||
|
||||
#if HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC
|
||||
{
|
||||
{ /* This works on hpux11. */
|
||||
struct pst_static pss;
|
||||
struct pst_dynamic psd;
|
||||
if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0)
|
||||
@ -89,6 +212,96 @@ physmem_available (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE
|
||||
{ /* This works on irix6. */
|
||||
struct rminfo realmem;
|
||||
if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0)
|
||||
{
|
||||
double pagesize = sysconf (_SC_PAGESIZE);
|
||||
double pages = realmem.availrmem;
|
||||
if (0 <= pages && 0 <= pagesize)
|
||||
return pages * pagesize;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_TABLE && defined TBL_VMSTATS
|
||||
{ /* This works on Tru64 UNIX V4/5. */
|
||||
struct tbl_vmstats vmstats;
|
||||
|
||||
if (table (TBL_VMSTATS, 0, &vmstats, 1, sizeof (vmstats)) == 1)
|
||||
{
|
||||
double pages = vmstats.free_count;
|
||||
double pagesize = vmstats.pagesize;
|
||||
|
||||
if (0 <= pages && 0 <= pagesize)
|
||||
return pages * pagesize;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_SYSCTL && defined HW_USERMEM
|
||||
{ /* This works on *bsd and darwin. */
|
||||
unsigned int usermem;
|
||||
size_t len = sizeof usermem;
|
||||
static int mib[2] = { CTL_HW, HW_USERMEM };
|
||||
|
||||
if (sysctl (mib, ARRAY_SIZE (mib), &usermem, &len, NULL, 0) == 0
|
||||
&& len == sizeof (usermem))
|
||||
return (double) usermem;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined _WIN32
|
||||
{ /* this works on windows */
|
||||
PFN_MS_EX pfnex;
|
||||
HMODULE h = GetModuleHandle ("kernel32.dll");
|
||||
|
||||
if (!h)
|
||||
return 0.0;
|
||||
|
||||
/* Use GlobalMemoryStatusEx if available. */
|
||||
if ((pfnex = (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx")))
|
||||
{
|
||||
lMEMORYSTATUSEX lms_ex;
|
||||
lms_ex.dwLength = sizeof lms_ex;
|
||||
if (!pfnex (&lms_ex))
|
||||
return 0.0;
|
||||
return (double) lms_ex.ullAvailPhys;
|
||||
}
|
||||
|
||||
/* Fall back to GlobalMemoryStatus which is always available.
|
||||
but returns wrong results for physical memory > 4GB */
|
||||
else
|
||||
{
|
||||
MEMORYSTATUS ms;
|
||||
GlobalMemoryStatus (&ms);
|
||||
return (double) ms.dwAvailPhys;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Guess 25% of physical memory. */
|
||||
return physmem_total () / 4;
|
||||
}
|
||||
|
||||
|
||||
#if DEBUG
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
printf ("%12.f %12.f\n", physmem_total (), physmem_available ());
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
compile-command: "gcc -DDEBUG -DHAVE_CONFIG_H -I.. -g -O -Wall -W physmem.c"
|
||||
End:
|
||||
*/
|
||||
|
@ -1,19 +1,27 @@
|
||||
/* Calculate the size of physical memory.
|
||||
|
||||
Copyright (C) 2000, 2003 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. */
|
||||
|
||||
#ifndef PHYSMEM_H_
|
||||
# define PHYSMEM_H_ 1
|
||||
|
||||
# if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# endif
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
|
||||
double physmem_total PARAMS ((void));
|
||||
double physmem_available PARAMS ((void));
|
||||
double physmem_total (void);
|
||||
double physmem_available (void);
|
||||
|
||||
#endif /* PHYSMEM_H_ */
|
||||
|
@ -1,21 +1,20 @@
|
||||
/* Which POSIX version to conform to, for utilities.
|
||||
|
||||
Copyright (C) 2002 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 Library General Public License as published
|
||||
by the Free Software Foundation; either version 2, or (at your option)
|
||||
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
|
||||
Library General Public License for more details.
|
||||
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 Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
@ -23,12 +22,10 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include "posixver.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#if !HAVE_DECL_GETENV && !defined getenv
|
||||
char *getenv ();
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
@ -37,13 +34,17 @@ char *getenv ();
|
||||
# define _POSIX2_VERSION 0
|
||||
#endif
|
||||
|
||||
#ifndef DEFAULT_POSIX2_VERSION
|
||||
# define DEFAULT_POSIX2_VERSION _POSIX2_VERSION
|
||||
#endif
|
||||
|
||||
/* The POSIX version that utilities should conform to. The default is
|
||||
specified by the system. */
|
||||
|
||||
int
|
||||
posix2_version (void)
|
||||
{
|
||||
long int v = _POSIX2_VERSION;
|
||||
long int v = DEFAULT_POSIX2_VERSION;
|
||||
char const *s = getenv ("_POSIX2_VERSION");
|
||||
|
||||
if (s && *s)
|
||||
|
@ -1,26 +1,39 @@
|
||||
/* quote.c - quote arguments for output
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Paul Eggert <eggert@twinsun.com> */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDDEF_H
|
||||
# include <stddef.h> /* For the definition of size_t on windows w/MSVC. */
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <quotearg.h>
|
||||
#include <quote.h>
|
||||
#include "quotearg.h"
|
||||
#include "quote.h"
|
||||
|
||||
/* Return an unambiguous printable representated, allocated in slot N,
|
||||
for NAME, suitable for diagnostics. */
|
||||
/* Return an unambiguous printable representation of NAME,
|
||||
allocated in slot N, suitable for diagnostics. */
|
||||
char const *
|
||||
quote_n (int n, char const *name)
|
||||
{
|
||||
return quotearg_n_style (n, locale_quoting_style, name);
|
||||
}
|
||||
|
||||
/* Return an unambiguous printable representation of NAME, suitable
|
||||
for diagnostics. */
|
||||
/* Return an unambiguous printable representation of NAME,
|
||||
suitable for diagnostics. */
|
||||
char const *
|
||||
quote (char const *name)
|
||||
{
|
||||
|
@ -1,12 +1,22 @@
|
||||
/* prototypes for quote.c */
|
||||
/* quote.h - prototypes for quote.c
|
||||
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
char const *quote_n PARAMS ((int n, char const *name));
|
||||
char const *quote PARAMS ((char const *name));
|
||||
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. */
|
||||
|
||||
|
||||
char const *quote_n (int n, char const *name);
|
||||
char const *quote (char const *name);
|
||||
|
@ -21,52 +21,19 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDDEF_H
|
||||
# include <stddef.h> /* For the definition of size_t on windows w/MSVC. */
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <quotearg.h>
|
||||
#include <xalloc.h>
|
||||
#include "quotearg.h"
|
||||
|
||||
#include "xalloc.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(text) gettext (text)
|
||||
#else
|
||||
# define _(text) text
|
||||
#endif
|
||||
#define N_(text) text
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
#ifndef SIZE_MAX
|
||||
# define SIZE_MAX ((size_t) -1)
|
||||
#endif
|
||||
#ifndef UCHAR_MAX
|
||||
# define UCHAR_MAX ((unsigned char) -1)
|
||||
#endif
|
||||
#ifndef UINT_MAX
|
||||
# define UINT_MAX ((unsigned int) -1)
|
||||
#endif
|
||||
|
||||
#if HAVE_C_BACKSLASH_A
|
||||
# define ALERT_CHAR '\a'
|
||||
#else
|
||||
# define ALERT_CHAR '\7'
|
||||
#endif
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
#define N_(msgid) msgid
|
||||
|
||||
#if HAVE_WCHAR_H
|
||||
|
||||
@ -84,8 +51,12 @@
|
||||
# undef MB_CUR_MAX
|
||||
# define MB_CUR_MAX 1
|
||||
# define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0)
|
||||
# define iswprint(wc) isprint ((unsigned char) (wc))
|
||||
# undef HAVE_MBSINIT
|
||||
#endif
|
||||
|
||||
#if !defined mbsinit && !HAVE_MBSINIT
|
||||
# define mbsinit(ps) 1
|
||||
# define iswprint(wc) ISPRINT ((unsigned char) (wc))
|
||||
#endif
|
||||
|
||||
#ifndef iswprint
|
||||
@ -97,17 +68,11 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define INT_BITS (sizeof (int) * CHAR_BIT)
|
||||
|
||||
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
|
||||
# define IN_CTYPE_DOMAIN(c) 1
|
||||
#else
|
||||
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||
#ifndef SIZE_MAX
|
||||
# define SIZE_MAX ((size_t) -1)
|
||||
#endif
|
||||
|
||||
/* Undefine to protect against the definition in wctype.h of solaris2.6. */
|
||||
#undef ISPRINT
|
||||
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
|
||||
#define INT_BITS (sizeof (int) * CHAR_BIT)
|
||||
|
||||
struct quoting_options
|
||||
{
|
||||
@ -153,9 +118,10 @@ static struct quoting_options default_quoting_options;
|
||||
struct quoting_options *
|
||||
clone_quoting_options (struct quoting_options *o)
|
||||
{
|
||||
struct quoting_options *p
|
||||
= (struct quoting_options *) xmalloc (sizeof (struct quoting_options));
|
||||
int e = errno;
|
||||
struct quoting_options *p = xmalloc (sizeof *p);
|
||||
*p = *(o ? o : &default_quoting_options);
|
||||
errno = e;
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -287,7 +253,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; ! (argsize == (size_t) -1 ? arg[i] == '\0' : i == argsize); i++)
|
||||
for (i = 0; ! (argsize == SIZE_MAX ? arg[i] == '\0' : i == argsize); i++)
|
||||
{
|
||||
unsigned char c;
|
||||
unsigned char esc;
|
||||
@ -326,8 +292,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
|
||||
case '<': case '=': case '>':
|
||||
/* Escape the second '?' in what would otherwise be
|
||||
a trigraph. */
|
||||
i += 2;
|
||||
c = arg[i + 2];
|
||||
i += 2;
|
||||
STORE ('?');
|
||||
STORE ('\\');
|
||||
STORE ('?');
|
||||
@ -340,7 +306,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
|
||||
}
|
||||
break;
|
||||
|
||||
case ALERT_CHAR: esc = 'a'; goto c_escape;
|
||||
case '\a': esc = 'a'; goto c_escape;
|
||||
case '\b': esc = 'b'; goto c_escape;
|
||||
case '\f': esc = 'f'; goto c_escape;
|
||||
case '\n': esc = 'n'; goto c_and_shell_escape;
|
||||
@ -428,7 +394,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
|
||||
if (unibyte_locale)
|
||||
{
|
||||
m = 1;
|
||||
printable = ISPRINT (c);
|
||||
printable = isprint (c);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -437,7 +403,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
|
||||
|
||||
m = 0;
|
||||
printable = 1;
|
||||
if (argsize == (size_t) -1)
|
||||
if (argsize == SIZE_MAX)
|
||||
argsize = strlen (arg);
|
||||
|
||||
do
|
||||
@ -533,8 +499,11 @@ quotearg_buffer (char *buffer, size_t buffersize,
|
||||
struct quoting_options const *o)
|
||||
{
|
||||
struct quoting_options const *p = o ? o : &default_quoting_options;
|
||||
return quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
|
||||
p->style, p);
|
||||
int e = errno;
|
||||
size_t r = quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
|
||||
p->style, p);
|
||||
errno = e;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Use storage slot N to return a quoted version of argument ARG.
|
||||
@ -548,6 +517,8 @@ static char *
|
||||
quotearg_n_options (int n, char const *arg, size_t argsize,
|
||||
struct quoting_options const *options)
|
||||
{
|
||||
int e = errno;
|
||||
|
||||
/* Preallocate a slot 0 buffer, so that the caller can always quote
|
||||
one small component of a "memory exhausted" message in slot 0. */
|
||||
static char slot0[256];
|
||||
@ -567,18 +538,16 @@ quotearg_n_options (int n, char const *arg, size_t argsize,
|
||||
if (nslots <= n0)
|
||||
{
|
||||
unsigned int n1 = n0 + 1;
|
||||
size_t s = n1 * sizeof *slotvec;
|
||||
|
||||
if (SIZE_MAX / UINT_MAX <= sizeof *slotvec
|
||||
&& n1 != s / sizeof *slotvec)
|
||||
if (xalloc_oversized (n1, sizeof *slotvec))
|
||||
xalloc_die ();
|
||||
|
||||
if (slotvec == &slotvec0)
|
||||
{
|
||||
slotvec = (struct slotvec *) xmalloc (sizeof *slotvec);
|
||||
slotvec = xmalloc (sizeof *slotvec);
|
||||
*slotvec = slotvec0;
|
||||
}
|
||||
slotvec = (struct slotvec *) xrealloc (slotvec, s);
|
||||
slotvec = xrealloc (slotvec, n1 * sizeof *slotvec);
|
||||
memset (slotvec + nslots, 0, (n1 - nslots) * sizeof *slotvec);
|
||||
nslots = n1;
|
||||
}
|
||||
@ -591,10 +560,13 @@ quotearg_n_options (int n, char const *arg, size_t argsize,
|
||||
if (size <= qsize)
|
||||
{
|
||||
slotvec[n].size = size = qsize + 1;
|
||||
slotvec[n].val = val = xrealloc (val == slot0 ? 0 : val, size);
|
||||
if (val != slot0)
|
||||
free (val);
|
||||
slotvec[n].val = val = xmalloc (size);
|
||||
quotearg_buffer (val, size, arg, argsize, options);
|
||||
}
|
||||
|
||||
errno = e;
|
||||
return val;
|
||||
}
|
||||
}
|
||||
@ -602,7 +574,7 @@ quotearg_n_options (int n, char const *arg, size_t argsize,
|
||||
char *
|
||||
quotearg_n (int n, char const *arg)
|
||||
{
|
||||
return quotearg_n_options (n, arg, (size_t) -1, &default_quoting_options);
|
||||
return quotearg_n_options (n, arg, SIZE_MAX, &default_quoting_options);
|
||||
}
|
||||
|
||||
char *
|
||||
@ -625,7 +597,7 @@ char *
|
||||
quotearg_n_style (int n, enum quoting_style s, char const *arg)
|
||||
{
|
||||
struct quoting_options const o = quoting_options_from_style (s);
|
||||
return quotearg_n_options (n, arg, (size_t) -1, &o);
|
||||
return quotearg_n_options (n, arg, SIZE_MAX, &o);
|
||||
}
|
||||
|
||||
char *
|
||||
@ -648,7 +620,7 @@ quotearg_char (char const *arg, char ch)
|
||||
struct quoting_options options;
|
||||
options = default_quoting_options;
|
||||
set_char_quoting (&options, ch, 1);
|
||||
return quotearg_n_options (0, arg, (size_t) -1, &options);
|
||||
return quotearg_n_options (0, arg, SIZE_MAX, &options);
|
||||
}
|
||||
|
||||
char *
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* quotearg.h - quote arguments for output
|
||||
Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002 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,6 +19,11 @@
|
||||
|
||||
/* Written by Paul Eggert <eggert@twinsun.com> */
|
||||
|
||||
#ifndef QUOTEARG_H_
|
||||
# define QUOTEARG_H_ 1
|
||||
|
||||
# include <stddef.h>
|
||||
|
||||
/* Basic quoting styles. */
|
||||
enum quoting_style
|
||||
{
|
||||
@ -30,9 +37,9 @@ enum quoting_style
|
||||
};
|
||||
|
||||
/* For now, --quoting-style=literal is the default, but this may change. */
|
||||
#ifndef DEFAULT_QUOTING_STYLE
|
||||
# define DEFAULT_QUOTING_STYLE literal_quoting_style
|
||||
#endif
|
||||
# ifndef DEFAULT_QUOTING_STYLE
|
||||
# define DEFAULT_QUOTING_STYLE literal_quoting_style
|
||||
# endif
|
||||
|
||||
/* Names of quoting styles and their corresponding values. */
|
||||
extern char const *const quoting_style_args[];
|
||||
@ -40,37 +47,27 @@ extern enum quoting_style const quoting_style_vals[];
|
||||
|
||||
struct quoting_options;
|
||||
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || defined __STDC__
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The functions listed below set and use a hidden variable
|
||||
that contains the default quoting style options. */
|
||||
|
||||
/* Allocate a new set of quoting options, with contents initially identical
|
||||
to O if O is not null, or to the default if O is null.
|
||||
It is the caller's responsibility to free the result. */
|
||||
struct quoting_options *clone_quoting_options
|
||||
PARAMS ((struct quoting_options *o));
|
||||
struct quoting_options *clone_quoting_options (struct quoting_options *o);
|
||||
|
||||
/* Get the value of O's quoting style. If O is null, use the default. */
|
||||
enum quoting_style get_quoting_style PARAMS ((struct quoting_options *o));
|
||||
enum quoting_style get_quoting_style (struct quoting_options *o);
|
||||
|
||||
/* In O (or in the default if O is null),
|
||||
set the value of the quoting style to S. */
|
||||
void set_quoting_style PARAMS ((struct quoting_options *o,
|
||||
enum quoting_style s));
|
||||
void set_quoting_style (struct quoting_options *o, enum quoting_style s);
|
||||
|
||||
/* In O (or in the default if O is null),
|
||||
set the value of the quoting options for character C to I.
|
||||
Return the old value. Currently, the only values defined for I are
|
||||
0 (the default) and 1 (which means to quote the character even if
|
||||
it would not otherwise be quoted). */
|
||||
int set_char_quoting PARAMS ((struct quoting_options *o, char c, int i));
|
||||
int set_char_quoting (struct quoting_options *o, char c, int i);
|
||||
|
||||
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
|
||||
argument ARG (of size ARGSIZE), using O to control quoting.
|
||||
@ -80,35 +77,38 @@ int set_char_quoting PARAMS ((struct quoting_options *o, char c, int i));
|
||||
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. */
|
||||
size_t quotearg_buffer PARAMS ((char *buffer, size_t buffersize,
|
||||
char const *arg, size_t argsize,
|
||||
struct quoting_options const *o));
|
||||
size_t quotearg_buffer (char *buffer, size_t buffersize,
|
||||
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
|
||||
reused by the next call to this function with the same value of N.
|
||||
N must be nonnegative. */
|
||||
char *quotearg_n PARAMS ((int n, char const *arg));
|
||||
char *quotearg_n (int n, char const *arg);
|
||||
|
||||
/* Equivalent to quotearg_n (0, ARG). */
|
||||
char *quotearg PARAMS ((char const *arg));
|
||||
char *quotearg (char const *arg);
|
||||
|
||||
/* Use style S and storage slot N to return a quoted version of the string ARG.
|
||||
This is like quotearg_n (N, ARG), except that it uses S with no other
|
||||
options to specify the quoting method. */
|
||||
char *quotearg_n_style PARAMS ((int n, enum quoting_style s, char const *arg));
|
||||
char *quotearg_n_style (int n, enum quoting_style s, char const *arg);
|
||||
|
||||
/* Use style S and storage slot N to return a quoted version of the
|
||||
argument ARG of size ARGSIZE. This is like quotearg_n_style
|
||||
(N, S, ARG), except it can quote null bytes. */
|
||||
char *quotearg_n_style_mem PARAMS ((int n, enum quoting_style s,
|
||||
char const *arg, size_t argsize));
|
||||
char *quotearg_n_style_mem (int n, enum quoting_style s,
|
||||
char const *arg, size_t argsize);
|
||||
|
||||
/* Equivalent to quotearg_n_style (0, S, ARG). */
|
||||
char *quotearg_style PARAMS ((enum quoting_style s, char const *arg));
|
||||
char *quotearg_style (enum quoting_style s, char const *arg);
|
||||
|
||||
/* Like quotearg (ARG), except also quote any instances of CH. */
|
||||
char *quotearg_char PARAMS ((char const *arg, char ch));
|
||||
char *quotearg_char (char const *arg, char ch);
|
||||
|
||||
/* Equivalent to quotearg_char (ARG, ':'). */
|
||||
char *quotearg_colon PARAMS ((char const *arg));
|
||||
char *quotearg_colon (char const *arg);
|
||||
|
||||
#endif /* !QUOTEARG_H_ */
|
||||
|
@ -1,9 +1,23 @@
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
/* Invoke stdio functions, but avoid some glitches.
|
||||
|
||||
FILE *fopen_safer PARAMS ((char const *, char const *));
|
||||
Copyright (C) 2001, 2003 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. */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
FILE *fopen_safer (char const *, char const *);
|
||||
|
48
contrib/gnu-sort/lib/strnlen.c
Normal file
48
contrib/gnu-sort/lib/strnlen.c
Normal file
@ -0,0 +1,48 @@
|
||||
/* Find the length of STRING, but scan at most MAXLEN characters.
|
||||
Copyright (C) 1996, 1997, 1998, 2000-2003 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
|
||||
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
|
||||
#undef strnlen
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#undef __strnlen
|
||||
#undef strnlen
|
||||
|
||||
#ifndef _LIBC
|
||||
# define strnlen rpl_strnlen
|
||||
#endif
|
||||
|
||||
#ifndef weak_alias
|
||||
# define __strnlen strnlen
|
||||
#endif
|
||||
|
||||
/* Find the length of STRING, but scan at most MAXLEN characters.
|
||||
If no '\0' terminator is found in that many characters, return MAXLEN. */
|
||||
|
||||
size_t
|
||||
__strnlen (const char *string, size_t maxlen)
|
||||
{
|
||||
const char *end = memchr (string, '\0', maxlen);
|
||||
return end ? (size_t) (end - string) : maxlen;
|
||||
}
|
||||
#ifdef weak_alias
|
||||
weak_alias (__strnlen, strnlen)
|
||||
#endif
|
71
contrib/gnu-sort/lib/timespec.h
Normal file
71
contrib/gnu-sort/lib/timespec.h
Normal file
@ -0,0 +1,71 @@
|
||||
/* timespec -- System time interface
|
||||
|
||||
Copyright (C) 2000, 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. */
|
||||
|
||||
#if ! defined TIMESPEC_H
|
||||
# define TIMESPEC_H
|
||||
|
||||
/* You must include config.h before including this file. */
|
||||
|
||||
# include <sys/types.h>
|
||||
# if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
# else
|
||||
# if HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if ! HAVE_STRUCT_TIMESPEC
|
||||
/* Some systems don't define this struct, e.g., AIX 4.1, Ultrix 4.3. */
|
||||
struct timespec
|
||||
{
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
# endif
|
||||
|
||||
# ifdef ST_MTIM_NSEC
|
||||
# define ST_TIME_CMP_NS(a, b, ns) ((a).ns < (b).ns ? -1 : (a).ns > (b).ns)
|
||||
# else
|
||||
# define ST_TIME_CMP_NS(a, b, ns) 0
|
||||
# endif
|
||||
# define ST_TIME_CMP(a, b, s, ns) \
|
||||
((a).s < (b).s ? -1 : (a).s > (b).s ? 1 : ST_TIME_CMP_NS(a, b, ns))
|
||||
# define ATIME_CMP(a, b) ST_TIME_CMP (a, b, st_atime, st_atim.ST_MTIM_NSEC)
|
||||
# define CTIME_CMP(a, b) ST_TIME_CMP (a, b, st_ctime, st_ctim.ST_MTIM_NSEC)
|
||||
# define MTIME_CMP(a, b) ST_TIME_CMP (a, b, st_mtime, st_mtim.ST_MTIM_NSEC)
|
||||
|
||||
# ifdef ST_MTIM_NSEC
|
||||
# define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC)
|
||||
# else
|
||||
# define TIMESPEC_NS(timespec) 0
|
||||
# endif
|
||||
|
||||
# if ! HAVE_DECL_NANOSLEEP
|
||||
/* Don't specify a prototype here. Some systems (e.g., OSF) declare
|
||||
nanosleep with a conflicting one (const-less first parameter). */
|
||||
int nanosleep ();
|
||||
# endif
|
||||
|
||||
int gettime (struct timespec *);
|
||||
int settime (struct timespec const *);
|
||||
|
||||
#endif
|
3
contrib/gnu-sort/lib/umaxtostr.c
Normal file
3
contrib/gnu-sort/lib/umaxtostr.c
Normal file
@ -0,0 +1,3 @@
|
||||
#define inttostr umaxtostr
|
||||
#define inttype uintmax_t
|
||||
#include "inttostr.c"
|
@ -1,9 +1,21 @@
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
/* Invoke unistd functions, but avoid some glitches.
|
||||
|
||||
int dup_safer PARAMS ((int));
|
||||
Copyright (C) 2001, 2003 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. */
|
||||
|
||||
int dup_safer (int);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Utility to help print --version output in a consistent format.
|
||||
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-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,22 +21,134 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "unlocked-io.h"
|
||||
/* Specification. */
|
||||
#include "version-etc.h"
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "unlocked-io.h"
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
/* Default copyright goes to the FSF. */
|
||||
|
||||
char* version_etc_copyright =
|
||||
const char* version_etc_copyright =
|
||||
/* Do *not* mark this string for translation. */
|
||||
"Copyright (C) 2002 Free Software Foundation, Inc.";
|
||||
"Copyright (C) 2004 Free Software Foundation, Inc.";
|
||||
|
||||
|
||||
/* Like version_etc, below, but with the NULL-terminated author list
|
||||
provided via a variable of type va_list. */
|
||||
void
|
||||
version_etc_va (FILE *stream,
|
||||
const char *command_name, const char *package,
|
||||
const char *version, va_list authors)
|
||||
{
|
||||
unsigned int n_authors;
|
||||
|
||||
/* Count the number of authors. */
|
||||
{
|
||||
va_list tmp_authors;
|
||||
|
||||
#ifdef __va_copy
|
||||
__va_copy (tmp_authors, authors);
|
||||
#else
|
||||
tmp_authors = authors;
|
||||
#endif
|
||||
|
||||
n_authors = 0;
|
||||
while (va_arg (tmp_authors, const char *) != NULL)
|
||||
++n_authors;
|
||||
}
|
||||
|
||||
if (command_name)
|
||||
fprintf (stream, "%s (%s) %s\n", command_name, package, version);
|
||||
else
|
||||
fprintf (stream, "%s %s\n", package, version);
|
||||
|
||||
switch (n_authors)
|
||||
{
|
||||
case 0:
|
||||
/* The caller must provide at least one author name. */
|
||||
abort ();
|
||||
case 1:
|
||||
/* TRANSLATORS: %s denotes an author name. */
|
||||
vfprintf (stream, _("Written by %s.\n"), authors);
|
||||
break;
|
||||
case 2:
|
||||
/* TRANSLATORS: Each %s denotes an author name. */
|
||||
vfprintf (stream, _("Written by %s and %s.\n"), authors);
|
||||
break;
|
||||
case 3:
|
||||
/* TRANSLATORS: Each %s denotes an author name. */
|
||||
vfprintf (stream, _("Written by %s, %s, and %s.\n"), authors);
|
||||
break;
|
||||
case 4:
|
||||
/* TRANSLATORS: Each %s denotes an author name.
|
||||
You can use line breaks, estimating that each author name occupies
|
||||
ca. 16 screen columns and that a screen line has ca. 80 columns. */
|
||||
vfprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"), authors);
|
||||
break;
|
||||
case 5:
|
||||
/* TRANSLATORS: Each %s denotes an author name.
|
||||
You can use line breaks, estimating that each author name occupies
|
||||
ca. 16 screen columns and that a screen line has ca. 80 columns. */
|
||||
vfprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"), authors);
|
||||
break;
|
||||
case 6:
|
||||
/* TRANSLATORS: Each %s denotes an author name.
|
||||
You can use line breaks, estimating that each author name occupies
|
||||
ca. 16 screen columns and that a screen line has ca. 80 columns. */
|
||||
vfprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
|
||||
authors);
|
||||
break;
|
||||
case 7:
|
||||
/* TRANSLATORS: Each %s denotes an author name.
|
||||
You can use line breaks, estimating that each author name occupies
|
||||
ca. 16 screen columns and that a screen line has ca. 80 columns. */
|
||||
vfprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
|
||||
authors);
|
||||
break;
|
||||
case 8:
|
||||
/* TRANSLATORS: Each %s denotes an author name.
|
||||
You can use line breaks, estimating that each author name occupies
|
||||
ca. 16 screen columns and that a screen line has ca. 80 columns. */
|
||||
vfprintf (stream, _("\
|
||||
Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
|
||||
authors);
|
||||
break;
|
||||
case 9:
|
||||
/* TRANSLATORS: Each %s denotes an author name.
|
||||
You can use line breaks, estimating that each author name occupies
|
||||
ca. 16 screen columns and that a screen line has ca. 80 columns. */
|
||||
vfprintf (stream, _("\
|
||||
Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
|
||||
authors);
|
||||
break;
|
||||
default:
|
||||
/* 10 or more authors. Use an abbreviation, since the human reader
|
||||
will probably not want to read the entire list anyway. */
|
||||
/* TRANSLATORS: Each %s denotes an author name.
|
||||
You can use line breaks, estimating that each author name occupies
|
||||
ca. 16 screen columns and that a screen line has ca. 80 columns. */
|
||||
vfprintf (stream, _("\
|
||||
Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
|
||||
authors);
|
||||
break;
|
||||
}
|
||||
va_end (authors);
|
||||
putc ('\n', stream);
|
||||
|
||||
fputs (version_etc_copyright, stream);
|
||||
putc ('\n', stream);
|
||||
|
||||
fputs (_("\
|
||||
This is free software; see the source for copying conditions. There is NO\n\
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"),
|
||||
stream);
|
||||
}
|
||||
|
||||
|
||||
/* Display the --version information the standard way.
|
||||
@ -48,24 +160,17 @@ char* version_etc_copyright =
|
||||
|
||||
or
|
||||
|
||||
COMMAND_NAME (PACKAGE) VERSION. */
|
||||
COMMAND_NAME (PACKAGE) VERSION.
|
||||
|
||||
The author names are passed as separate arguments, with an additional
|
||||
NULL argument at the end. */
|
||||
void
|
||||
version_etc (FILE *stream,
|
||||
const char *command_name, const char *package,
|
||||
const char *version, const char *authors)
|
||||
const char *version, /* const char *author1, ...*/ ...)
|
||||
{
|
||||
if (command_name)
|
||||
fprintf (stream, "%s (%s) %s\n", command_name, package, version);
|
||||
else
|
||||
fprintf (stream, "%s %s\n", package, version);
|
||||
fprintf (stream, _("Written by %s.\n"), authors);
|
||||
putc ('\n', stream);
|
||||
va_list authors;
|
||||
|
||||
fputs (version_etc_copyright, stream);
|
||||
putc ('\n', stream);
|
||||
|
||||
fputs (_("\
|
||||
This is free software; see the source for copying conditions. There is NO\n\
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"),
|
||||
stream);
|
||||
va_start (authors, version);
|
||||
version_etc_va (stream, command_name, package, version, authors);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Utility to help print --version output in a consistent format.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2003 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,19 +20,18 @@
|
||||
#ifndef VERSION_ETC_H
|
||||
# define VERSION_ETC_H 1
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
# include <stdarg.h>
|
||||
# include <stdio.h>
|
||||
|
||||
extern char *version_etc_copyright;
|
||||
extern const char *version_etc_copyright;
|
||||
|
||||
void
|
||||
version_etc PARAMS ((FILE *stream,
|
||||
const char *command_name, const char *package,
|
||||
const char *version, const char *authors));
|
||||
extern void version_etc_va (FILE *stream,
|
||||
const char *command_name, const char *package,
|
||||
const char *version, va_list authors);
|
||||
|
||||
extern void version_etc (FILE *stream,
|
||||
const char *command_name, const char *package,
|
||||
const char *version,
|
||||
/* const char *author1, ...*/ ...);
|
||||
|
||||
#endif /* VERSION_ETC_H */
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* xalloc.h -- malloc with out-of-memory checking
|
||||
Copyright (C) 1990-1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||
1999, 2000, 2003 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 +20,7 @@
|
||||
#ifndef XALLOC_H_
|
||||
# define XALLOC_H_
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
# include <stddef.h>
|
||||
|
||||
# ifndef __attribute__
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
|
||||
@ -36,14 +32,9 @@
|
||||
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
|
||||
# endif
|
||||
|
||||
/* Exit value when the requested amount of memory is not available.
|
||||
It is initialized to EXIT_FAILURE, but the caller may set it to
|
||||
some other value. */
|
||||
extern int xalloc_exit_failure;
|
||||
|
||||
/* If this pointer is non-zero, run the specified function upon each
|
||||
allocation failure. It is initialized to zero. */
|
||||
extern void (*xalloc_fail_func) PARAMS ((void));
|
||||
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.
|
||||
@ -51,37 +42,46 @@ extern void (*xalloc_fail_func) PARAMS ((void));
|
||||
extern char const xalloc_msg_memory_exhausted[];
|
||||
|
||||
/* This function is always triggered when memory is exhausted. It is
|
||||
in charge of honoring the three previous items. This is the
|
||||
in charge of honoring the two previous items. It exits with status
|
||||
exit_failure (defined in exitfail.h). This is the
|
||||
function to call when one wants the program to die because of a
|
||||
memory allocation failure. */
|
||||
extern void xalloc_die PARAMS ((void)) ATTRIBUTE_NORETURN;
|
||||
extern void xalloc_die (void) ATTRIBUTE_NORETURN;
|
||||
|
||||
void *xmalloc PARAMS ((size_t n));
|
||||
void *xcalloc PARAMS ((size_t n, size_t s));
|
||||
void *xrealloc PARAMS ((void *p, size_t n));
|
||||
char *xstrdup PARAMS ((const char *str));
|
||||
void *xmalloc (size_t s);
|
||||
void *xnmalloc (size_t n, size_t s);
|
||||
void *xzalloc (size_t s);
|
||||
void *xcalloc (size_t n, size_t s);
|
||||
void *xrealloc (void *p, size_t s);
|
||||
void *xnrealloc (void *p, size_t n, size_t s);
|
||||
void *x2realloc (void *p, size_t *pn);
|
||||
void *x2nrealloc (void *p, size_t *pn, size_t s);
|
||||
void *xclone (void const *p, size_t s);
|
||||
char *xstrdup (const char *str);
|
||||
|
||||
# define XMALLOC(Type, N_items) ((Type *) xmalloc (sizeof (Type) * (N_items)))
|
||||
# define XCALLOC(Type, N_items) ((Type *) xcalloc (sizeof (Type), (N_items)))
|
||||
# define XREALLOC(Ptr, Type, N_items) \
|
||||
((Type *) xrealloc ((void *) (Ptr), sizeof (Type) * (N_items)))
|
||||
/* Return 1 if an array of N objects, each of size S, cannot exist due
|
||||
to size arithmetic overflow. S must be positive and N must be
|
||||
nonnegative. This is a macro, not an inline function, so that it
|
||||
works correctly even when SIZE_MAX < N.
|
||||
|
||||
/* Declare and alloc memory for VAR of type TYPE. */
|
||||
# define NEW(Type, Var) Type *(Var) = XMALLOC (Type, 1)
|
||||
|
||||
/* Free VAR only if non NULL. */
|
||||
# define XFREE(Var) \
|
||||
do { \
|
||||
if (Var) \
|
||||
free (Var); \
|
||||
} while (0)
|
||||
|
||||
/* Return a pointer to a malloc'ed copy of the array SRC of NUM elements. */
|
||||
# define CCLONE(Src, Num) \
|
||||
(memcpy (xmalloc (sizeof (*Src) * (Num)), (Src), sizeof (*Src) * (Num)))
|
||||
|
||||
/* Return a malloc'ed copy of SRC. */
|
||||
# define CLONE(Src) CCLONE (Src, 1)
|
||||
By gnulib convention, SIZE_MAX represents overflow in size
|
||||
calculations, so the conservative dividend to use here is
|
||||
SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value.
|
||||
However, malloc (SIZE_MAX) fails on all known hosts where
|
||||
sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for
|
||||
exactly-SIZE_MAX allocations on such hosts; this avoids a test and
|
||||
branch when S is known to be 1. */
|
||||
# define xalloc_oversized(n, s) \
|
||||
((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
|
||||
|
||||
/* These macros are deprecated; they will go away soon, and are retained
|
||||
temporarily only to ease conversion to the functions described above. */
|
||||
# define CCLONE(p, n) xclone (p, (n) * sizeof *(p))
|
||||
# define CLONE(p) xclone (p, sizeof *(p))
|
||||
# define NEW(type, var) type *var = xmalloc (sizeof (type))
|
||||
# define XCALLOC(type, n) xcalloc (n, sizeof (type))
|
||||
# define XMALLOC(type, n) xnmalloc (n, sizeof (type))
|
||||
# define XREALLOC(p, type, n) xnrealloc (p, n, sizeof (type))
|
||||
# define XFREE(p) free (p)
|
||||
|
||||
#endif /* !XALLOC_H_ */
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* xmalloc.c -- malloc with out of memory checking
|
||||
Copyright (C) 1990-1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003,
|
||||
1999, 2000, 2002, 2003 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,47 +21,32 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
void *calloc ();
|
||||
void *malloc ();
|
||||
void *realloc ();
|
||||
void free ();
|
||||
#endif
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# define textdomain(Domain)
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
#define N_(Text) Text
|
||||
|
||||
#include "error.h"
|
||||
#include "xalloc.h"
|
||||
|
||||
#ifndef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
#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 properly working 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 properly working realloc"
|
||||
"you must run the autoconf test for a GNU libc compatible realloc"
|
||||
#endif
|
||||
|
||||
/* Exit value when the requested amount of memory is not available.
|
||||
The caller may set it to some other value. */
|
||||
int xalloc_exit_failure = EXIT_FAILURE;
|
||||
|
||||
/* If non NULL, call this function when memory is exhausted. */
|
||||
void (*xalloc_fail_func) PARAMS ((void)) = 0;
|
||||
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. */
|
||||
@ -70,11 +57,29 @@ xalloc_die (void)
|
||||
{
|
||||
if (xalloc_fail_func)
|
||||
(*xalloc_fail_func) ();
|
||||
error (xalloc_exit_failure, 0, "%s", _(xalloc_msg_memory_exhausted));
|
||||
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 exit. */
|
||||
exit (EXIT_FAILURE);
|
||||
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. */
|
||||
|
||||
static inline void *
|
||||
xnmalloc_inline (size_t n, size_t s)
|
||||
{
|
||||
void *p;
|
||||
if (xalloc_oversized (n, s) || ! (p = malloc (n * s)))
|
||||
xalloc_die ();
|
||||
return p;
|
||||
}
|
||||
|
||||
void *
|
||||
xnmalloc (size_t n, size_t s)
|
||||
{
|
||||
return xnmalloc_inline (n, s);
|
||||
}
|
||||
|
||||
/* Allocate N bytes of memory dynamically, with error checking. */
|
||||
@ -82,35 +87,169 @@ xalloc_die (void)
|
||||
void *
|
||||
xmalloc (size_t n)
|
||||
{
|
||||
void *p;
|
||||
return xnmalloc_inline (n, 1);
|
||||
}
|
||||
|
||||
p = malloc (n);
|
||||
if (p == 0)
|
||||
/* Change the size of an allocated block of memory P to an array of N
|
||||
objects each of S bytes, with error checking. S must be nonzero. */
|
||||
|
||||
static inline void *
|
||||
xnrealloc_inline (void *p, size_t n, size_t s)
|
||||
{
|
||||
if (xalloc_oversized (n, s) || ! (p = realloc (p, n * s)))
|
||||
xalloc_die ();
|
||||
return p;
|
||||
}
|
||||
|
||||
void *
|
||||
xnrealloc (void *p, size_t n, size_t s)
|
||||
{
|
||||
return xnrealloc_inline (p, n, s);
|
||||
}
|
||||
|
||||
/* Change the size of an allocated block of memory P to N bytes,
|
||||
with error checking. */
|
||||
|
||||
void *
|
||||
xrealloc (void *p, size_t n)
|
||||
{
|
||||
p = realloc (p, n);
|
||||
if (p == 0)
|
||||
xalloc_die ();
|
||||
return p;
|
||||
return xnrealloc_inline (p, n, 1);
|
||||
}
|
||||
|
||||
/* Allocate memory for N elements of S bytes, with error checking. */
|
||||
|
||||
/* If P is null, allocate a block of at least *PN such objects;
|
||||
otherwise, reallocate P so that it contains more than *PN objects
|
||||
each of S bytes. *PN must be nonzero unless P is null, and S must
|
||||
be nonzero. Set *PN to the new number of objects, and return the
|
||||
pointer to the new block. *PN is never set to zero, and the
|
||||
returned pointer is never null.
|
||||
|
||||
Repeated reallocations are guaranteed to make progress, either by
|
||||
allocating an initial block with a nonzero size, or by allocating a
|
||||
larger block.
|
||||
|
||||
In the following implementation, nonzero sizes are doubled so that
|
||||
repeated reallocations have O(N log N) overall cost rather than
|
||||
O(N**2) cost, but the specification for this function does not
|
||||
guarantee that sizes are doubled.
|
||||
|
||||
Here is an example of use:
|
||||
|
||||
int *p = NULL;
|
||||
size_t used = 0;
|
||||
size_t allocated = 0;
|
||||
|
||||
void
|
||||
append_int (int value)
|
||||
{
|
||||
if (used == allocated)
|
||||
p = x2nrealloc (p, &allocated, sizeof *p);
|
||||
p[used++] = value;
|
||||
}
|
||||
|
||||
This causes x2nrealloc to allocate a block of some nonzero size the
|
||||
first time it is called.
|
||||
|
||||
To have finer-grained control over the initial size, set *PN to a
|
||||
nonzero value before calling this function with P == NULL. For
|
||||
example:
|
||||
|
||||
int *p = NULL;
|
||||
size_t used = 0;
|
||||
size_t allocated = 0;
|
||||
size_t allocated1 = 1000;
|
||||
|
||||
void
|
||||
append_int (int value)
|
||||
{
|
||||
if (used == allocated)
|
||||
{
|
||||
p = x2nrealloc (p, &allocated1, sizeof *p);
|
||||
allocated = allocated1;
|
||||
}
|
||||
p[used++] = value;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
static inline void *
|
||||
x2nrealloc_inline (void *p, size_t *pn, size_t s)
|
||||
{
|
||||
size_t n = *pn;
|
||||
|
||||
if (! p)
|
||||
{
|
||||
if (! n)
|
||||
{
|
||||
/* The approximate size to use for initial small allocation
|
||||
requests, when the invoking code specifies an old size of
|
||||
zero. 64 bytes is the largest "small" request for the
|
||||
GNU C library malloc. */
|
||||
enum { DEFAULT_MXFAST = 64 };
|
||||
|
||||
n = DEFAULT_MXFAST / s;
|
||||
n += !n;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SIZE_MAX / 2 / s < n)
|
||||
xalloc_die ();
|
||||
n *= 2;
|
||||
}
|
||||
|
||||
*pn = n;
|
||||
return xrealloc (p, n * s);
|
||||
}
|
||||
|
||||
void *
|
||||
x2nrealloc (void *p, size_t *pn, size_t s)
|
||||
{
|
||||
return x2nrealloc_inline (p, pn, s);
|
||||
}
|
||||
|
||||
/* If P is null, allocate a block of at least *PN bytes; otherwise,
|
||||
reallocate P so that it contains more than *PN bytes. *PN must be
|
||||
nonzero unless P is null. Set *PN to the new block's size, and
|
||||
return the pointer to the new block. *PN is never set to zero, and
|
||||
the returned pointer is never null. */
|
||||
|
||||
void *
|
||||
x2realloc (void *p, size_t *pn)
|
||||
{
|
||||
return x2nrealloc_inline (p, pn, 1);
|
||||
}
|
||||
|
||||
/* Allocate S bytes of zeroed memory dynamically, with error checking.
|
||||
There's no need for xnzalloc (N, S), since it would be equivalent
|
||||
to xcalloc (N, S). */
|
||||
|
||||
void *
|
||||
xzalloc (size_t s)
|
||||
{
|
||||
return memset (xmalloc (s), 0, s);
|
||||
}
|
||||
|
||||
/* Allocate zeroed memory for N elements of S bytes, with error
|
||||
checking. S must be nonzero. */
|
||||
|
||||
void *
|
||||
xcalloc (size_t n, size_t s)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = calloc (n, s);
|
||||
if (p == 0)
|
||||
/* Test for overflow, since some calloc implementations don't have
|
||||
proper overflow checks. */
|
||||
if (xalloc_oversized (n, s) || ! (p = calloc (n, s)))
|
||||
xalloc_die ();
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Clone an object P of size S, with error checking. There's no need
|
||||
for xnclone (P, N, S), since xclone (P, N * S) works without any
|
||||
need for an arithmetic overflow check. */
|
||||
|
||||
void *
|
||||
xclone (void const *p, size_t s)
|
||||
{
|
||||
return memcpy (xmalloc (s), p, s);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Locale-specific memory comparison.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003 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,22 +28,15 @@ extern int errno;
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
#include "error.h"
|
||||
#include "exitfail.h"
|
||||
#include "memcoll.h"
|
||||
#include "quotearg.h"
|
||||
#include "xmemcoll.h"
|
||||
|
||||
/* Exit value when xmemcoll fails.
|
||||
The caller may set it to some other value. */
|
||||
int xmemcoll_exit_failure = EXIT_FAILURE;
|
||||
|
||||
/* Compare S1 (with length S1LEN) and S2 (with length S2LEN) according
|
||||
to the LC_COLLATE locale. S1 and S2 do not overlap, and are not
|
||||
adjacent. Temporarily modify the bytes after S1 and S2, but
|
||||
@ -60,7 +53,7 @@ xmemcoll (char *s1, size_t s1len, char *s2, size_t s2len)
|
||||
{
|
||||
error (0, collation_errno, _("string comparison failed"));
|
||||
error (0, 0, _("Set LC_ALL='C' to work around the problem."));
|
||||
error (xmemcoll_exit_failure, 0,
|
||||
error (exit_failure, 0,
|
||||
_("The strings compared were %s and %s."),
|
||||
quotearg_n_style_mem (0, locale_quoting_style, s1, s1len),
|
||||
quotearg_n_style_mem (1, locale_quoting_style, s2, s2len));
|
||||
|
@ -1,2 +1,2 @@
|
||||
extern int xmemcoll_exit_failure;
|
||||
#include <stddef.h>
|
||||
int xmemcoll (char *, size_t, char *, size_t);
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* A more useful interface to strtol.
|
||||
Copyright (C) 1995, 1996, 1998-2001 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003 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,48 +27,37 @@
|
||||
# define __strtol strtol
|
||||
# define __strtol_t long int
|
||||
# define __xstrtol xstrtol
|
||||
# define STRTOL_T_MINIMUM LONG_MIN
|
||||
# define STRTOL_T_MAXIMUM LONG_MAX
|
||||
#endif
|
||||
|
||||
/* Some pre-ANSI implementations (e.g. SunOS 4)
|
||||
need stderr defined if assertion checking is enabled. */
|
||||
#include <stdio.h>
|
||||
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
# ifndef strchr
|
||||
# define strchr index
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
#include <limits.h>
|
||||
|
||||
/* The extra casts work around common compiler bugs. */
|
||||
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
|
||||
It is necessary at least when t == time_t. */
|
||||
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
|
||||
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
|
||||
#define TYPE_MAXIMUM(t) (~ (t) 0 - TYPE_MINIMUM (t))
|
||||
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
|
||||
: (t) 0))
|
||||
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
|
||||
|
||||
#ifndef STRTOL_T_MINIMUM
|
||||
# define STRTOL_T_MINIMUM TYPE_MINIMUM (__strtol_t)
|
||||
# define STRTOL_T_MAXIMUM TYPE_MAXIMUM (__strtol_t)
|
||||
#endif
|
||||
|
||||
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
|
||||
# define IN_CTYPE_DOMAIN(c) 1
|
||||
@ -78,14 +69,6 @@ extern int errno;
|
||||
|
||||
#include "xstrtol.h"
|
||||
|
||||
#if !HAVE_DECL_STRTOL && !defined strtol
|
||||
long int strtol ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STRTOUL && !defined strtoul
|
||||
unsigned long int strtoul ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STRTOIMAX && !defined strtoimax
|
||||
intmax_t strtoimax ();
|
||||
#endif
|
||||
@ -94,24 +77,30 @@ intmax_t strtoimax ();
|
||||
uintmax_t strtoumax ();
|
||||
#endif
|
||||
|
||||
static int
|
||||
static strtol_error
|
||||
bkm_scale (__strtol_t *x, int scale_factor)
|
||||
{
|
||||
__strtol_t product = *x * scale_factor;
|
||||
if (*x != product / scale_factor)
|
||||
return 1;
|
||||
*x = product;
|
||||
return 0;
|
||||
if (TYPE_SIGNED (__strtol_t) && *x < STRTOL_T_MINIMUM / scale_factor)
|
||||
{
|
||||
*x = STRTOL_T_MINIMUM;
|
||||
return LONGINT_OVERFLOW;
|
||||
}
|
||||
if (STRTOL_T_MAXIMUM / scale_factor < *x)
|
||||
{
|
||||
*x = STRTOL_T_MAXIMUM;
|
||||
return LONGINT_OVERFLOW;
|
||||
}
|
||||
*x *= scale_factor;
|
||||
return LONGINT_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
static strtol_error
|
||||
bkm_scale_by_power (__strtol_t *x, int base, int power)
|
||||
{
|
||||
strtol_error err = LONGINT_OK;
|
||||
while (power--)
|
||||
if (bkm_scale (x, base))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
err |= bkm_scale (x, base);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* FIXME: comment. */
|
||||
@ -123,6 +112,7 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
|
||||
char *t_ptr;
|
||||
char **p;
|
||||
__strtol_t tmp;
|
||||
strtol_error err = LONGINT_OK;
|
||||
|
||||
assert (0 <= strtol_base && strtol_base <= 36);
|
||||
|
||||
@ -139,8 +129,6 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
|
||||
|
||||
errno = 0;
|
||||
tmp = __strtol (s, p, strtol_base);
|
||||
if (errno != 0)
|
||||
return LONGINT_OVERFLOW;
|
||||
|
||||
if (*p == s)
|
||||
{
|
||||
@ -151,6 +139,12 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
|
||||
else
|
||||
return LONGINT_INVALID;
|
||||
}
|
||||
else if (errno != 0)
|
||||
{
|
||||
if (errno != ERANGE)
|
||||
return LONGINT_INVALID;
|
||||
err = LONGINT_OVERFLOW;
|
||||
}
|
||||
|
||||
/* Let valid_suffixes == NULL mean `allow any suffix'. */
|
||||
/* FIXME: update all callers except the ones that allow suffixes
|
||||
@ -158,19 +152,19 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
|
||||
if (!valid_suffixes)
|
||||
{
|
||||
*val = tmp;
|
||||
return LONGINT_OK;
|
||||
return err;
|
||||
}
|
||||
|
||||
if (**p != '\0')
|
||||
{
|
||||
int base = 1024;
|
||||
int suffixes = 1;
|
||||
int overflow;
|
||||
strtol_error overflow;
|
||||
|
||||
if (!strchr (valid_suffixes, **p))
|
||||
{
|
||||
*val = tmp;
|
||||
return LONGINT_INVALID_SUFFIX_CHAR;
|
||||
return err | LONGINT_INVALID_SUFFIX_CHAR;
|
||||
}
|
||||
|
||||
if (strchr (valid_suffixes, '0'))
|
||||
@ -253,18 +247,17 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
|
||||
|
||||
default:
|
||||
*val = tmp;
|
||||
return LONGINT_INVALID_SUFFIX_CHAR;
|
||||
break;
|
||||
return err | LONGINT_INVALID_SUFFIX_CHAR;
|
||||
}
|
||||
|
||||
if (overflow)
|
||||
return LONGINT_OVERFLOW;
|
||||
|
||||
(*p) += suffixes;
|
||||
err |= overflow;
|
||||
*p += suffixes;
|
||||
if (**p)
|
||||
err |= LONGINT_INVALID_SUFFIX_CHAR;
|
||||
}
|
||||
|
||||
*val = tmp;
|
||||
return LONGINT_OK;
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef TESTING_XSTRTO
|
||||
@ -275,7 +268,7 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
|
||||
char *program_name;
|
||||
|
||||
int
|
||||
main (int argc, char** argv)
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
strtol_error s_err;
|
||||
int i;
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* A more useful interface to strtol.
|
||||
Copyright 1995, 1996, 1998, 1999, 2001 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1995, 1996, 1998, 1999, 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
|
||||
@ -18,30 +20,36 @@
|
||||
#ifndef XSTRTOL_H_
|
||||
# define XSTRTOL_H_ 1
|
||||
|
||||
# if HAVE_INTTYPES_H
|
||||
# include <inttypes.h> /* for uintmax_t */
|
||||
# endif
|
||||
# include "exitfail.h"
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
/* Get uintmax_t. */
|
||||
# if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
# else
|
||||
# if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef _STRTOL_ERROR
|
||||
enum strtol_error
|
||||
{
|
||||
LONGINT_OK, LONGINT_INVALID, LONGINT_INVALID_SUFFIX_CHAR, LONGINT_OVERFLOW
|
||||
LONGINT_OK = 0,
|
||||
|
||||
/* These two values can be ORed together, to indicate that both
|
||||
errors occurred. */
|
||||
LONGINT_OVERFLOW = 1,
|
||||
LONGINT_INVALID_SUFFIX_CHAR = 2,
|
||||
|
||||
LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW = (LONGINT_INVALID_SUFFIX_CHAR
|
||||
| LONGINT_OVERFLOW),
|
||||
LONGINT_INVALID = 4
|
||||
};
|
||||
typedef enum strtol_error strtol_error;
|
||||
# endif
|
||||
|
||||
# define _DECLARE_XSTRTOL(name, type) \
|
||||
strtol_error \
|
||||
name PARAMS ((const char *s, char **ptr, int base, \
|
||||
type *val, const char *valid_suffixes));
|
||||
strtol_error name (const char *, char **, int, type *, const char *);
|
||||
_DECLARE_XSTRTOL (xstrtol, long int)
|
||||
_DECLARE_XSTRTOL (xstrtoul, unsigned long int)
|
||||
_DECLARE_XSTRTOL (xstrtoimax, intmax_t)
|
||||
@ -52,7 +60,7 @@ _DECLARE_XSTRTOL (xstrtoumax, uintmax_t)
|
||||
{ \
|
||||
switch ((Err)) \
|
||||
{ \
|
||||
case LONGINT_OK: \
|
||||
default: \
|
||||
abort (); \
|
||||
\
|
||||
case LONGINT_INVALID: \
|
||||
@ -61,6 +69,7 @@ _DECLARE_XSTRTOL (xstrtoumax, uintmax_t)
|
||||
break; \
|
||||
\
|
||||
case LONGINT_INVALID_SUFFIX_CHAR: \
|
||||
case LONGINT_INVALID_SUFFIX_CHAR | LONGINT_OVERFLOW: \
|
||||
error ((Exit_code), 0, "invalid character following %s in `%s'", \
|
||||
(Argument_type_string), (Str)); \
|
||||
break; \
|
||||
@ -74,7 +83,7 @@ _DECLARE_XSTRTOL (xstrtoumax, uintmax_t)
|
||||
while (0)
|
||||
|
||||
# define STRTOL_FATAL_ERROR(Str, Argument_type_string, Err) \
|
||||
_STRTOL_ERROR (2, Str, Argument_type_string, Err)
|
||||
_STRTOL_ERROR (exit_failure, Str, Argument_type_string, Err)
|
||||
|
||||
# define STRTOL_FAIL_WARN(Str, Argument_type_string, Err) \
|
||||
_STRTOL_ERROR (0, Str, Argument_type_string, Err)
|
||||
|
@ -1,4 +1,6 @@
|
||||
#define __strtol strtoul
|
||||
#define __strtol_t unsigned long int
|
||||
#define __xstrtol xstrtoul
|
||||
#define STRTOL_T_MINIMUM 0
|
||||
#define STRTOL_T_MAXIMUM ULONG_MAX
|
||||
#include "xstrtol.c"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* xstrtoumax.c -- A more useful interface to strtoumax.
|
||||
Copyright 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2003 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,9 +23,15 @@
|
||||
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#elif HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#define __strtol strtoumax
|
||||
#define __strtol_t uintmax_t
|
||||
#define __xstrtol xstrtoumax
|
||||
#ifdef UINTMAX_MAX
|
||||
# define STRTOL_T_MINIMUM 0
|
||||
# define STRTOL_T_MAXIMUM UINTMAX_MAX
|
||||
#endif
|
||||
#include "xstrtol.c"
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.28.
|
||||
.TH SORT "1" "July 2002" "sort (textutils) 2.1" "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33.
|
||||
.TH SORT "1" "March 2004" "sort (coreutils) 5.2.1" "User Commands"
|
||||
.SH NAME
|
||||
sort \- sort lines of text files
|
||||
.SH SYNOPSIS
|
||||
@ -57,15 +57,15 @@ stabilize sort by disabling last-resort comparison
|
||||
\fB\-S\fR, \fB\-\-buffer\-size\fR=\fISIZE\fR
|
||||
use SIZE for main memory buffer
|
||||
.HP
|
||||
\fB\-t\fR, \fB\-\-field\-separator\fR=\fISEP\fR use SEP instead of non- to whitespace transition
|
||||
\fB\-t\fR, \fB\-\-field\-separator\fR=\fISEP\fR use SEP instead of non-blank to blank transition
|
||||
.TP
|
||||
\fB\-T\fR, \fB\-\-temporary\-directory\fR=\fIDIR\fR
|
||||
use DIR for temporaries, not $TMPDIR or /tmp
|
||||
use DIR for temporaries, not $TMPDIR or /tmp;
|
||||
multiple options specify multiple directories
|
||||
.TP
|
||||
\fB\-u\fR, \fB\-\-unique\fR
|
||||
with \fB\-c\fR: check for strict ordering
|
||||
otherwise: output only the first of an equal run
|
||||
with \fB\-c\fR, check for strict ordering;
|
||||
without \fB\-c\fR, output only the first of an equal run
|
||||
.TP
|
||||
\fB\-z\fR, \fB\-\-zero\-terminated\fR
|
||||
end lines with 0 byte, not newline
|
||||
@ -93,9 +93,9 @@ native byte values.
|
||||
.SH AUTHOR
|
||||
Written by Mike Haertel and Paul Eggert.
|
||||
.SH "REPORTING BUGS"
|
||||
Report bugs to <bug-textutils@gnu.org>.
|
||||
Report bugs to <bug-coreutils@gnu.org>.
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2002 Free Software Foundation, Inc.
|
||||
Copyright \(co 2004 Free Software Foundation, Inc.
|
||||
.br
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
@ -108,6 +108,6 @@ and
|
||||
.B sort
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info sort
|
||||
.B info coreutils sort
|
||||
.PP
|
||||
should give you access to the complete manual.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/* system-dependent definitions for fileutils, textutils, and sh-utils packages.
|
||||
Copyright (C) 1989, 1991-2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989, 1991-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
|
||||
@ -15,6 +15,8 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <alloca.h>
|
||||
|
||||
/* Include sys/types.h before this file. */
|
||||
|
||||
#if 2 <= __GLIBC__ && 2 <= __GLIBC_MINOR__
|
||||
@ -52,13 +54,12 @@ you must include <sys/types.h> before including this file
|
||||
#endif
|
||||
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
/* limits.h must come before pathmax.h because limits.h on some systems
|
||||
undefs PATH_MAX, whereas pathmax.h sets PATH_MAX. */
|
||||
# include <limits.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
|
||||
#include "pathmax.h"
|
||||
#include "localedir.h"
|
||||
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
@ -108,13 +109,9 @@ struct utimbuf
|
||||
/* Don't use bcopy! Use memmove if source and destination may overlap,
|
||||
memcpy otherwise. */
|
||||
|
||||
#if HAVE_STRING_H
|
||||
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||
# include <memory.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#include <string.h>
|
||||
#if ! HAVE_DECL_MEMRCHR
|
||||
void *memrchr (const void *, int, size_t);
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
@ -122,17 +119,22 @@ struct utimbuf
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if HAVE_STDBOOL_H
|
||||
# include <stdbool.h>
|
||||
#else
|
||||
typedef enum {false = 0, true = 1} bool;
|
||||
/* 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
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
# define getopt system_getopt
|
||||
# include <stdlib.h>
|
||||
# undef getopt
|
||||
#endif
|
||||
#include <stdbool.h>
|
||||
|
||||
#define getopt system_getopt
|
||||
#include <stdlib.h>
|
||||
#undef getopt
|
||||
|
||||
/* The following test is to work around the gross typo in
|
||||
systems like Sony NEWS-OS Release 4.0C, whereby EXIT_FAILURE
|
||||
@ -146,6 +148,25 @@ typedef enum {false = 0, true = 1} bool;
|
||||
# define EXIT_SUCCESS 0
|
||||
#endif
|
||||
|
||||
/* Exit statuses for programs like 'env' that exec other programs.
|
||||
EXIT_FAILURE might not be 1, so use EXIT_FAIL in such programs. */
|
||||
enum
|
||||
{
|
||||
EXIT_FAIL = 1,
|
||||
EXIT_CANNOT_INVOKE = 126,
|
||||
EXIT_ENOENT = 127
|
||||
};
|
||||
|
||||
#include "exitfail.h"
|
||||
|
||||
/* Set exit_failure to STATUS if that's not the default already. */
|
||||
static inline void
|
||||
initialize_exit_failure (int status)
|
||||
{
|
||||
if (status != EXIT_FAILURE)
|
||||
exit_failure = status;
|
||||
}
|
||||
|
||||
#if HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#else
|
||||
@ -172,6 +193,18 @@ typedef enum {false = 0, true = 1} bool;
|
||||
# define O_TEXT _O_TEXT
|
||||
#endif
|
||||
|
||||
#if !defined O_NDELAY
|
||||
# define O_NDELAY 0
|
||||
#endif
|
||||
|
||||
#if !defined O_NONBLOCK
|
||||
# define O_NONBLOCK O_NDELAY
|
||||
#endif
|
||||
|
||||
#if !defined O_NOCTTY
|
||||
# define O_NOCTTY 0
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
/* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
|
||||
# undef O_BINARY
|
||||
@ -246,9 +279,7 @@ typedef enum {false = 0, true = 1} bool;
|
||||
# define ST_BLKSIZE(statbuf) DEV_BSIZE
|
||||
# if defined _POSIX_SOURCE || !defined BSIZE /* fileblocks.c uses BSIZE. */
|
||||
# define ST_NBLOCKS(statbuf) \
|
||||
(S_ISREG ((statbuf).st_mode) \
|
||||
|| S_ISDIR ((statbuf).st_mode) \
|
||||
? (statbuf).st_size / ST_NBLOCKSIZE + ((statbuf).st_size % ST_NBLOCKSIZE != 0) : 0)
|
||||
((statbuf).st_size / ST_NBLOCKSIZE + ((statbuf).st_size % ST_NBLOCKSIZE != 0))
|
||||
# else /* !_POSIX_SOURCE && BSIZE */
|
||||
# define ST_NBLOCKS(statbuf) \
|
||||
(S_ISREG ((statbuf).st_mode) \
|
||||
@ -256,9 +287,15 @@ typedef enum {false = 0, true = 1} bool;
|
||||
? st_blocks ((statbuf).st_size) : 0)
|
||||
# endif /* !_POSIX_SOURCE && BSIZE */
|
||||
#else /* HAVE_STRUCT_STAT_ST_BLOCKS */
|
||||
/* Some systems, like Sequents, return st_blksize of 0 on pipes. */
|
||||
# define ST_BLKSIZE(statbuf) ((statbuf).st_blksize > 0 \
|
||||
? (statbuf).st_blksize : DEV_BSIZE)
|
||||
/* Some systems, like Sequents, return st_blksize of 0 on pipes.
|
||||
Also, when running `rsh hpux11-system cat any-file', cat would
|
||||
determine that the output stream had an st_blksize of 2147421096.
|
||||
So here we arbitrarily limit the `optimal' block size to 4MB.
|
||||
If anyone knows of a system for which the legitimate value for
|
||||
st_blksize can exceed 4MB, please report it as a bug in this code. */
|
||||
# define ST_BLKSIZE(statbuf) ((0 < (statbuf).st_blksize \
|
||||
&& (statbuf).st_blksize <= (1 << 22)) /* 4MB */ \
|
||||
? (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. */
|
||||
@ -279,14 +316,635 @@ typedef enum {false = 0, true = 1} bool;
|
||||
#endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
|
||||
|
||||
#ifndef ST_NBLOCKS
|
||||
# define ST_NBLOCKS(statbuf) \
|
||||
(S_ISREG ((statbuf).st_mode) \
|
||||
|| S_ISDIR ((statbuf).st_mode) \
|
||||
? (statbuf).st_blocks : 0)
|
||||
# define ST_NBLOCKS(statbuf) ((statbuf).st_blocks)
|
||||
#endif
|
||||
|
||||
#ifndef ST_NBLOCKSIZE
|
||||
# define ST_NBLOCKSIZE 512
|
||||
#endif
|
||||
|
||||
#include "sys2.h"
|
||||
/* Redirection and wildcarding when done by the utility itself.
|
||||
Generally a noop, but used in particular for native VMS. */
|
||||
#ifndef initialize_main
|
||||
# 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 "timespec.h"
|
||||
|
||||
#ifndef RETSIGTYPE
|
||||
# define RETSIGTYPE void
|
||||
#endif
|
||||
|
||||
#ifdef __DJGPP__
|
||||
/* We need the declaration of setmode. */
|
||||
# include <io.h>
|
||||
/* We need the declaration of __djgpp_set_ctrl_c. */
|
||||
# include <sys/exceptn.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h> /* for the definition of UINTMAX_MAX */
|
||||
#endif
|
||||
|
||||
#if !defined PRIdMAX || 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
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
/* Jim Meyering writes:
|
||||
|
||||
"... Some ctype macros are valid only for character codes that
|
||||
isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
|
||||
using /bin/cc or gcc but without giving an ansi option). So, all
|
||||
ctype uses should be through macros like ISPRINT... If
|
||||
STDC_HEADERS is defined, then autoconf has verified that the ctype
|
||||
macros don't need to be guarded with references to isascii. ...
|
||||
Defining isascii to 1 should let any compiler worth its salt
|
||||
eliminate the && through constant folding."
|
||||
|
||||
Bruno Haible adds:
|
||||
|
||||
"... Furthermore, isupper(c) etc. have an undefined result if c is
|
||||
outside the range -1 <= c <= 255. One is tempted to write isupper(c)
|
||||
with c being of type `char', but this is wrong if c is an 8-bit
|
||||
character >= 128 which gets sign-extended to a negative value.
|
||||
The macro ISUPPER protects against this as well." */
|
||||
|
||||
#if STDC_HEADERS || (!defined (isascii) && !HAVE_ISASCII)
|
||||
# define IN_CTYPE_DOMAIN(c) 1
|
||||
#else
|
||||
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||
#endif
|
||||
|
||||
#ifdef isblank
|
||||
# define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (c))
|
||||
#else
|
||||
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
|
||||
#endif
|
||||
#ifdef isgraph
|
||||
# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (c))
|
||||
#else
|
||||
# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (c) && !isspace (c))
|
||||
#endif
|
||||
|
||||
/* This is defined in <sys/euc.h> on at least Solaris2.6 systems. */
|
||||
#undef ISPRINT
|
||||
|
||||
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
|
||||
#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
|
||||
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
|
||||
#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
|
||||
#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
|
||||
#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c))
|
||||
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
|
||||
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
|
||||
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
|
||||
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
||||
|
||||
#if STDC_HEADERS
|
||||
# define TOLOWER(Ch) tolower (Ch)
|
||||
# define TOUPPER(Ch) toupper (Ch)
|
||||
#else
|
||||
# define TOLOWER(Ch) (ISUPPER (Ch) ? tolower (Ch) : (Ch))
|
||||
# define TOUPPER(Ch) (ISLOWER (Ch) ? toupper (Ch) : (Ch))
|
||||
#endif
|
||||
|
||||
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
|
||||
- Its arg may be any int or unsigned int; it need not be an unsigned char.
|
||||
- It's guaranteed to evaluate its argument exactly once.
|
||||
- It's typically faster.
|
||||
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)
|
||||
|
||||
/* Take care of NLS matters. */
|
||||
|
||||
#if HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#else
|
||||
# define setlocale(Category, Locale) /* empty */
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
#if ! ENABLE_NLS
|
||||
# undef textdomain
|
||||
# define textdomain(Domainname) /* empty */
|
||||
# undef bindtextdomain
|
||||
# define bindtextdomain(Domainname, Dirname) /* empty */
|
||||
#endif
|
||||
|
||||
#define _(msgid) gettext (msgid)
|
||||
#define N_(msgid) msgid
|
||||
|
||||
#ifndef HAVE_SETLOCALE
|
||||
# define HAVE_SETLOCALE 0
|
||||
#endif
|
||||
|
||||
#define STREQ(a, b) (strcmp ((a), (b)) == 0)
|
||||
|
||||
#if !HAVE_DECL_FREE
|
||||
void free ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_MALLOC
|
||||
char *malloc ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_MEMCHR
|
||||
char *memchr ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_REALLOC
|
||||
char *realloc ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STPCPY
|
||||
# ifndef stpcpy
|
||||
char *stpcpy ();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STRNDUP
|
||||
char *strndup ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STRSTR
|
||||
char *strstr ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_GETENV
|
||||
char *getenv ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_LSEEK
|
||||
off_t lseek ();
|
||||
#endif
|
||||
|
||||
/* This is needed on some AIX systems. */
|
||||
#if !HAVE_DECL_STRTOUL
|
||||
unsigned long strtoul ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_GETLOGIN
|
||||
char *getlogin ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_TTYNAME
|
||||
char *ttyname ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_GETEUID
|
||||
uid_t geteuid ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_GETPWUID
|
||||
struct passwd *getpwuid ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_GETGRGID
|
||||
struct group *getgrgid ();
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_GETUID
|
||||
uid_t getuid ();
|
||||
#endif
|
||||
|
||||
#include "xalloc.h"
|
||||
|
||||
#if ! defined HAVE_MEMPCPY && ! defined mempcpy
|
||||
/* Be CAREFUL that there are no side effects in N. */
|
||||
# define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N)))
|
||||
#endif
|
||||
|
||||
/* Include automatically-generated macros for unlocked I/O. */
|
||||
#include "unlocked-io.h"
|
||||
|
||||
#define SAME_INODE(Stat_buf_1, Stat_buf_2) \
|
||||
((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
|
||||
&& (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
|
||||
|
||||
#define DOT_OR_DOTDOT(Basename) \
|
||||
(Basename[0] == '.' && (Basename[1] == '\0' \
|
||||
|| (Basename[1] == '.' && Basename[2] == '\0')))
|
||||
|
||||
#if SETVBUF_REVERSED
|
||||
# define SETVBUF(Stream, Buffer, Type, Size) \
|
||||
setvbuf (Stream, Type, Buffer, Size)
|
||||
#else
|
||||
# define SETVBUF(Stream, Buffer, Type, Size) \
|
||||
setvbuf (Stream, Buffer, Type, Size)
|
||||
#endif
|
||||
|
||||
/* Factor out some of the common --help and --version processing code. */
|
||||
|
||||
/* These enum values cannot possibly conflict with the option values
|
||||
ordinarily used by commands, including CHAR_MAX + 1, etc. Avoid
|
||||
CHAR_MIN - 1, as it may equal -1, the getopt end-of-options value. */
|
||||
enum
|
||||
{
|
||||
GETOPT_HELP_CHAR = (CHAR_MIN - 2),
|
||||
GETOPT_VERSION_CHAR = (CHAR_MIN - 3)
|
||||
};
|
||||
|
||||
#define GETOPT_HELP_OPTION_DECL \
|
||||
"help", no_argument, 0, GETOPT_HELP_CHAR
|
||||
#define GETOPT_VERSION_OPTION_DECL \
|
||||
"version", no_argument, 0, GETOPT_VERSION_CHAR
|
||||
|
||||
#define case_GETOPT_HELP_CHAR \
|
||||
case GETOPT_HELP_CHAR: \
|
||||
usage (EXIT_SUCCESS); \
|
||||
break;
|
||||
|
||||
#define HELP_OPTION_DESCRIPTION \
|
||||
_(" --help display this help and exit\n")
|
||||
#define VERSION_OPTION_DESCRIPTION \
|
||||
_(" --version output version information and exit\n")
|
||||
|
||||
#include "closeout.h"
|
||||
#include "version-etc.h"
|
||||
|
||||
#define case_GETOPT_VERSION_CHAR(Program_name, Authors) \
|
||||
case GETOPT_VERSION_CHAR: \
|
||||
version_etc (stdout, Program_name, PACKAGE, VERSION, Authors, \
|
||||
(char *) NULL); \
|
||||
exit (EXIT_SUCCESS); \
|
||||
break;
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
# 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.
|
||||
It is necessary at least when t == time_t. */
|
||||
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
|
||||
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
|
||||
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
|
||||
|
||||
/* Upper bound on the string length of an integer converted to string.
|
||||
302 / 1000 is ceil (log10 (2.0)). Subtract 1 for the sign bit;
|
||||
add 1 for integer division truncation; add 1 more for a minus sign. */
|
||||
#define INT_STRLEN_BOUND(t) ((sizeof (t) * CHAR_BIT - 1) * 302 / 1000 + 2)
|
||||
|
||||
#ifndef CHAR_MIN
|
||||
# define CHAR_MIN TYPE_MINIMUM (char)
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_MAX
|
||||
# define CHAR_MAX TYPE_MAXIMUM (char)
|
||||
#endif
|
||||
|
||||
#ifndef SCHAR_MIN
|
||||
# define SCHAR_MIN (-1 - SCHAR_MAX)
|
||||
#endif
|
||||
|
||||
#ifndef SCHAR_MAX
|
||||
# define SCHAR_MAX (CHAR_MAX == UCHAR_MAX ? CHAR_MAX / 2 : CHAR_MAX)
|
||||
#endif
|
||||
|
||||
#ifndef UCHAR_MAX
|
||||
# define UCHAR_MAX TYPE_MAXIMUM (unsigned char)
|
||||
#endif
|
||||
|
||||
#ifndef SHRT_MIN
|
||||
# define SHRT_MIN TYPE_MINIMUM (short int)
|
||||
#endif
|
||||
|
||||
#ifndef SHRT_MAX
|
||||
# define SHRT_MAX TYPE_MAXIMUM (short int)
|
||||
#endif
|
||||
|
||||
#ifndef INT_MAX
|
||||
# define INT_MAX TYPE_MAXIMUM (int)
|
||||
#endif
|
||||
|
||||
#ifndef INT_MIN
|
||||
# define INT_MIN TYPE_MINIMUM (int)
|
||||
#endif
|
||||
|
||||
#ifndef UINT_MAX
|
||||
# define UINT_MAX TYPE_MAXIMUM (unsigned int)
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MAX
|
||||
# define LONG_MAX TYPE_MAXIMUM (long)
|
||||
#endif
|
||||
|
||||
#ifndef ULONG_MAX
|
||||
# define ULONG_MAX TYPE_MAXIMUM (unsigned long)
|
||||
#endif
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
# define SIZE_MAX TYPE_MAXIMUM (size_t)
|
||||
#endif
|
||||
|
||||
#ifndef SSIZE_MAX
|
||||
# define SSIZE_MAX TYPE_MAXIMUM (ssize_t)
|
||||
#endif
|
||||
|
||||
#ifndef UINTMAX_MAX
|
||||
# define UINTMAX_MAX TYPE_MAXIMUM (uintmax_t)
|
||||
#endif
|
||||
|
||||
#ifndef OFF_T_MIN
|
||||
# define OFF_T_MIN TYPE_MINIMUM (off_t)
|
||||
#endif
|
||||
|
||||
#ifndef OFF_T_MAX
|
||||
# define OFF_T_MAX TYPE_MAXIMUM (off_t)
|
||||
#endif
|
||||
|
||||
#ifndef UID_T_MAX
|
||||
# define UID_T_MAX TYPE_MAXIMUM (uid_t)
|
||||
#endif
|
||||
|
||||
#ifndef GID_T_MAX
|
||||
# define GID_T_MAX TYPE_MAXIMUM (gid_t)
|
||||
#endif
|
||||
|
||||
#ifndef PID_T_MAX
|
||||
# define PID_T_MAX TYPE_MAXIMUM (pid_t)
|
||||
#endif
|
||||
|
||||
/* Use this to suppress gcc's `...may be used before initialized' warnings. */
|
||||
#ifdef lint
|
||||
# define IF_LINT(Code) Code
|
||||
#else
|
||||
# define IF_LINT(Code) /* empty */
|
||||
#endif
|
||||
|
||||
#ifndef __attribute__
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
|
||||
# define __attribute__(x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_NORETURN
|
||||
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
#endif
|
||||
|
||||
#if defined strdupa
|
||||
# define ASSIGN_STRDUPA(DEST, S) \
|
||||
do { DEST = strdupa (S); } while (0)
|
||||
#else
|
||||
# define ASSIGN_STRDUPA(DEST, S) \
|
||||
do \
|
||||
{ \
|
||||
const char *s_ = (S); \
|
||||
size_t len_ = strlen (s_) + 1; \
|
||||
char *tmp_dest_ = alloca (len_); \
|
||||
DEST = memcpy (tmp_dest_, (s_), len_); \
|
||||
} \
|
||||
while (0)
|
||||
#endif
|
||||
|
||||
#ifndef EOVERFLOW
|
||||
# define EOVERFLOW EINVAL
|
||||
#endif
|
||||
|
||||
#if ! HAVE_FSEEKO && ! defined fseeko
|
||||
# define fseeko(s, o, w) ((o) == (long) (o) \
|
||||
? fseek (s, o, w) \
|
||||
: (errno = EOVERFLOW, -1))
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user