mirror of
https://github.com/mirror/wget.git
synced 2026-08-19 17:33:28 +08:00
Compare commits
450 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f694b2ea24 | ||
|
|
d260ded060 | ||
|
|
70f7cdf1af | ||
|
|
351d328c07 | ||
|
|
3b6a3e84a0 | ||
|
|
fb23bc0611 | ||
|
|
cb358c0a84 | ||
|
|
12218d353b | ||
|
|
3832728138 | ||
|
|
38933de17c | ||
|
|
aed7d4163a | ||
|
|
42c15e47b4 | ||
|
|
c3835a425a | ||
|
|
8b2954e58a | ||
|
|
bba67890f3 | ||
|
|
0c9fb2b041 | ||
|
|
fbd9b9c16b | ||
|
|
1fd32c995c | ||
|
|
c289349684 | ||
|
|
1dec2028d0 | ||
|
|
7e85e9509e | ||
|
|
85dd2f7ce2 | ||
|
|
e1fc2057c7 | ||
|
|
eaf2fc9a4f | ||
|
|
e505664ef3 | ||
|
|
e6123ed645 | ||
|
|
5137cff125 | ||
|
|
42c78fdd71 | ||
|
|
a7df7ecc2f | ||
|
|
695f11304b | ||
|
|
a12bd59111 | ||
|
|
ffb94036f2 | ||
|
|
92035dbabd | ||
|
|
c19d76c024 | ||
|
|
a300f1e47d | ||
|
|
72b2c58983 | ||
|
|
c52bbad9e4 | ||
|
|
44ba49b31f | ||
|
|
eee1589ef3 | ||
|
|
e9cc8b2f7c | ||
|
|
b8f036d16c | ||
|
|
91f0f99e9a | ||
|
|
c78caecbb4 | ||
|
|
8760123cee | ||
|
|
c9c0e4c641 | ||
|
|
9e0d87a248 | ||
|
|
6a2d67b583 | ||
|
|
49f6d0ded8 | ||
|
|
4df7703d62 | ||
|
|
7f43748544 | ||
|
|
9d35f87218 | ||
|
|
90896e3314 | ||
|
|
5ce9389384 | ||
|
|
099d8ee3da | ||
|
|
e976d4f3dc | ||
|
|
ccd369d5f2 | ||
|
|
027d9f385d | ||
|
|
83837b0606 | ||
|
|
ae80fd2ec7 | ||
|
|
277785fa2a | ||
|
|
52dd6da6e0 | ||
|
|
550457bcad | ||
|
|
8dc52c6eaa | ||
|
|
54fd8de415 | ||
|
|
81409cb9c8 | ||
|
|
0e6f1c2dac | ||
|
|
7df4b05f0b | ||
|
|
bc2891f307 | ||
|
|
6c30653a1a | ||
|
|
edbeaa0c4e | ||
|
|
e3b3ea5120 | ||
|
|
50238e49b9 | ||
|
|
6443581d72 | ||
|
|
3be7e0a53c | ||
|
|
b56a528aea | ||
|
|
dcf667fb57 | ||
|
|
a2c0835007 | ||
|
|
3ebbd84518 | ||
|
|
b60ff61b75 | ||
|
|
2c1e0326a3 | ||
|
|
359dd16760 | ||
|
|
1e229375aa | ||
|
|
4f09a3118f | ||
|
|
b1838bdfd1 | ||
|
|
98f843f3cc | ||
|
|
9e8d899a35 | ||
|
|
5dcb116087 | ||
|
|
242ddfc74e | ||
|
|
13c6e7832a | ||
|
|
22bd8011e8 | ||
|
|
fe401688a6 | ||
|
|
6e4c3ab999 | ||
|
|
022dbcb343 | ||
|
|
7c0270cdb5 | ||
|
|
67e6027ea1 | ||
|
|
e9845d2813 | ||
|
|
959e5d1e90 | ||
|
|
74f6cb8884 | ||
|
|
e2cb2fa2e3 | ||
|
|
b718128b4f | ||
|
|
798f554773 | ||
|
|
06fc1edb54 | ||
|
|
85b98d0834 | ||
|
|
4759cf099f | ||
|
|
e1df67a4f0 | ||
|
|
3db55372c7 | ||
|
|
22f016ca3a | ||
|
|
31674653eb | ||
|
|
c32ef46f99 | ||
|
|
f9768d368d | ||
|
|
4fe805a7ec | ||
|
|
172a117647 | ||
|
|
ae0598df9b | ||
|
|
6aa2a7cc98 | ||
|
|
90e9d9e1bd | ||
|
|
93720df4c8 | ||
|
|
4661f141bb | ||
|
|
29861463de | ||
|
|
aa2f287c68 | ||
|
|
3806fd1e02 | ||
|
|
6b5c0c742d | ||
|
|
96418c6885 | ||
|
|
321b5dce85 | ||
|
|
6741bc4233 | ||
|
|
1d14c18d7f | ||
|
|
ee9d4a9057 | ||
|
|
2b1dd8d23b | ||
|
|
639a454528 | ||
|
|
9cc514d21c | ||
|
|
620ca36038 | ||
|
|
370f96d36c | ||
|
|
e93bb4fa28 | ||
|
|
8ac9c05fc0 | ||
|
|
2e86829809 | ||
|
|
d19cc259cb | ||
|
|
e24e817259 | ||
|
|
f4122c5094 | ||
|
|
0b4c04b583 | ||
|
|
e41d044e16 | ||
|
|
f5a1097871 | ||
|
|
0aa3c5d33c | ||
|
|
378c203079 | ||
|
|
c6889dab18 | ||
|
|
196f70a7df | ||
|
|
0fcd1bb235 | ||
|
|
f1d4aeaffb | ||
|
|
fd582e4543 | ||
|
|
bd4f1e6042 | ||
|
|
154d499be2 | ||
|
|
08a147c672 | ||
|
|
b30ba732ad | ||
|
|
3bb17fca04 | ||
|
|
2541e0b579 | ||
|
|
2ffc383654 | ||
|
|
6533cf2452 | ||
|
|
44ea82bc67 | ||
|
|
b3014041c5 | ||
|
|
0ccaa999a2 | ||
|
|
b9b510ca5f | ||
|
|
04f29f2f08 | ||
|
|
6a25955fe6 | ||
|
|
408126aae0 | ||
|
|
bcc2abf116 | ||
|
|
611a219fb0 | ||
|
|
c60530b369 | ||
|
|
6d67d793f5 | ||
|
|
586ade4fb1 | ||
|
|
0a8a898fbe | ||
|
|
5e1badae1e | ||
|
|
c2ee928302 | ||
|
|
0bfb1aa9be | ||
|
|
1316701791 | ||
|
|
eed850d938 | ||
|
|
5305f18c0a | ||
|
|
127036d3ec | ||
|
|
e3820953b2 | ||
|
|
a5fdba0958 | ||
|
|
8c7bd588fe | ||
|
|
e0a3162893 | ||
|
|
fce4e757a2 | ||
|
|
2223ac8ce3 | ||
|
|
356fc9fc68 | ||
|
|
91aeb7db2f | ||
|
|
df8ce3d788 | ||
|
|
bbe6b86c9e | ||
|
|
19ef7249b8 | ||
|
|
eb76fcbe2b | ||
|
|
c3a0c1a5b5 | ||
|
|
85797041a6 | ||
|
|
eb557e9e77 | ||
|
|
a25607f788 | ||
|
|
0f154e42a4 | ||
|
|
d23ce97885 | ||
|
|
66bbc5bc63 | ||
|
|
a024990e18 | ||
|
|
5bcd75d32f | ||
|
|
547bcb0d3f | ||
|
|
baed30f057 | ||
|
|
5e3c9b55f2 | ||
|
|
2158e58bc1 | ||
|
|
512bdc14cb | ||
|
|
34a6f7fc32 | ||
|
|
9fab5a9f28 | ||
|
|
c79ff7f47a | ||
|
|
1c76d3cceb | ||
|
|
75d04cadf5 | ||
|
|
186200fb6e | ||
|
|
706871e92e | ||
|
|
24a76e1a8f | ||
|
|
375d9ee3f7 | ||
|
|
3382df979c | ||
|
|
6330e4f8b8 | ||
|
|
54beb3f312 | ||
|
|
f3c2686ef7 | ||
|
|
76c651e3a1 | ||
|
|
a73e3a914e | ||
|
|
5eb9c28b31 | ||
|
|
02e316f986 | ||
|
|
13028b1bae | ||
|
|
228299b4f7 | ||
|
|
aa05df65c4 | ||
|
|
c25d0f6997 | ||
|
|
aed17cca14 | ||
|
|
ac0eac7c98 | ||
|
|
1f06428483 | ||
|
|
5db59de365 | ||
|
|
d0b360c36f | ||
|
|
1d9bb1c7b0 | ||
|
|
9b21660d70 | ||
|
|
c6cf57d215 | ||
|
|
473ec526d2 | ||
|
|
0b5b100fc9 | ||
|
|
f9d46e0f9c | ||
|
|
9bc1422456 | ||
|
|
8bdce1809d | ||
|
|
e24571d336 | ||
|
|
1e09ee5ea8 | ||
|
|
37c85ecba3 | ||
|
|
8c69d9f4a9 | ||
|
|
f90ca4e54a | ||
|
|
544f0d478a | ||
|
|
67d81d15a5 | ||
|
|
17c2503ee0 | ||
|
|
00723a80f1 | ||
|
|
d7991738d6 | ||
|
|
3fb4d068a7 | ||
|
|
cd81370afe | ||
|
|
a97b673747 | ||
|
|
4a685764a8 | ||
|
|
53427a9b76 | ||
|
|
ee6021a3b0 | ||
|
|
df99868cb1 | ||
|
|
0db305126b | ||
|
|
366dbedf1b | ||
|
|
87a176daa7 | ||
|
|
a50931df8c | ||
|
|
df0f9c0ce7 | ||
|
|
179dacd735 | ||
|
|
1eb1e76e9a | ||
|
|
8d764f3ac6 | ||
|
|
1ad97cc7ca | ||
|
|
918be06e06 | ||
|
|
f6e69baa3c | ||
|
|
295bf3b81a | ||
|
|
b1db2362e1 | ||
|
|
ce45fe71aa | ||
|
|
b0a3d43014 | ||
|
|
cbe8eb725b | ||
|
|
c09d62159b | ||
|
|
0424cb1aed | ||
|
|
96c3ec36c2 | ||
|
|
d18b9749d9 | ||
|
|
6dca252c60 | ||
|
|
4d564bd630 | ||
|
|
99e9291da3 | ||
|
|
1cba1a7659 | ||
|
|
b1acde223f | ||
|
|
ca244196f1 | ||
|
|
28db25933b | ||
|
|
1f883393c8 | ||
|
|
930075f467 | ||
|
|
cb30bc9a94 | ||
|
|
244b732e0a | ||
|
|
024683705d | ||
|
|
910ec4641e | ||
|
|
ed182a8da9 | ||
|
|
3a62674582 | ||
|
|
e219e587b3 | ||
|
|
bb6a72caea | ||
|
|
09bc5b5787 | ||
|
|
e076a6d39d | ||
|
|
2f6aa1d741 | ||
|
|
7f8d5d6f87 | ||
|
|
e52cd21256 | ||
|
|
cdfd8a8e91 | ||
|
|
8e742d05cf | ||
|
|
8c33c34bf6 | ||
|
|
9ae052b1e2 | ||
|
|
334a8e9027 | ||
|
|
20a64d03d8 | ||
|
|
8aa378bd9e | ||
|
|
f97c9ac8e7 | ||
|
|
2aa2a913c3 | ||
|
|
336f3c63d1 | ||
|
|
a2596ccf21 | ||
|
|
8c7afaf3bb | ||
|
|
b12160ea02 | ||
|
|
69fb378d59 | ||
|
|
ea96533903 | ||
|
|
8405493e1d | ||
|
|
b38c40b34e | ||
|
|
c5dc4d1664 | ||
|
|
cea1f0718d | ||
|
|
542c549985 | ||
|
|
7ae38d431e | ||
|
|
af928aaaaa | ||
|
|
62aab82ead | ||
|
|
62864cee6e | ||
|
|
b5c9573ad6 | ||
|
|
6230b73df0 | ||
|
|
6a5a964d7e | ||
|
|
6ddcb6e65e | ||
|
|
63473a2663 | ||
|
|
822a32d813 | ||
|
|
f9e0889340 | ||
|
|
934e10ea7f | ||
|
|
15737d2422 | ||
|
|
6ce3d0cf12 | ||
|
|
2107eb06ab | ||
|
|
87ad80cacc | ||
|
|
e70602b962 | ||
|
|
e6152f3265 | ||
|
|
e6b486fd93 | ||
|
|
0055a98eb1 | ||
|
|
e095cc064e | ||
|
|
75c6ca0f5d | ||
|
|
05503232c0 | ||
|
|
3e25a9817f | ||
|
|
a3eafcf137 | ||
|
|
954fead685 | ||
|
|
7171d76960 | ||
|
|
29c0b3cc07 | ||
|
|
57584fe2da | ||
|
|
29305e059f | ||
|
|
6ef8c69c9d | ||
|
|
e0c0d21d9d | ||
|
|
be9674f1eb | ||
|
|
b7f54921f6 | ||
|
|
04e4bd614d | ||
|
|
49d7bafd79 | ||
|
|
fed4e3d4c7 | ||
|
|
cf3c678c82 | ||
|
|
ec40efb27b | ||
|
|
eb483c9f25 | ||
|
|
4c73a8fc26 | ||
|
|
a6625c97c5 | ||
|
|
f9993ec155 | ||
|
|
f9c765d8e6 | ||
|
|
5af14a7589 | ||
|
|
b7814f7cf3 | ||
|
|
117c25970b | ||
|
|
aca9f566b6 | ||
|
|
e16bd20474 | ||
|
|
23ebf5c52a | ||
|
|
f1afa74955 | ||
|
|
5cc1525e65 | ||
|
|
4f16c7754c | ||
|
|
9cb140bae1 | ||
|
|
64ebab7160 | ||
|
|
bd5527dad4 | ||
|
|
e0c25f7a5f | ||
|
|
e9e09e1cc0 | ||
|
|
f747e73445 | ||
|
|
260b9593dc | ||
|
|
9e286ee357 | ||
|
|
c702d99f7b | ||
|
|
1b2092fd06 | ||
|
|
05fccaeed2 | ||
|
|
d733dbc703 | ||
|
|
83fe87d9ed | ||
|
|
af5008cdb4 | ||
|
|
8ff8a1d289 | ||
|
|
a59e12ab26 | ||
|
|
b2b76dcef4 | ||
|
|
475c452780 | ||
|
|
8f91cbd2d6 | ||
|
|
84b2d52598 | ||
|
|
58a9721edf | ||
|
|
ffbba2e6b9 | ||
|
|
baa0ec7f31 | ||
|
|
294f2e1f6b | ||
|
|
e36538b53a | ||
|
|
293008f682 | ||
|
|
b76ef3f452 | ||
|
|
5a97871f5d | ||
|
|
b2e34eb6a9 | ||
|
|
cba3187919 | ||
|
|
78a1186f2d | ||
|
|
a8d87e175e | ||
|
|
8234d9866a | ||
|
|
a8de649f28 | ||
|
|
0cf88f48e6 | ||
|
|
63f280a030 | ||
|
|
57a46fed5d | ||
|
|
9c23efbf57 | ||
|
|
282798f52e | ||
|
|
bb3f805b86 | ||
|
|
d829a89218 | ||
|
|
ee69f96a91 | ||
|
|
29e3aa3a20 | ||
|
|
bbd81b91c0 | ||
|
|
1cee086162 | ||
|
|
a801efcd96 | ||
|
|
33d8b23dfd | ||
|
|
f391a5b5b0 | ||
|
|
ec6950f1a6 | ||
|
|
f6a33f1dd0 | ||
|
|
baf9994402 | ||
|
|
068991e8a0 | ||
|
|
30b24240ae | ||
|
|
7585b7019d | ||
|
|
cd4c4b63d4 | ||
|
|
1f08245076 | ||
|
|
8798e25533 | ||
|
|
8e39fcf97b | ||
|
|
104b0b4ca8 | ||
|
|
3f01333ca6 | ||
|
|
3450481772 | ||
|
|
d5361eca21 | ||
|
|
d92049ef66 | ||
|
|
2f0223872c | ||
|
|
a454495722 | ||
|
|
c86f7c7b82 | ||
|
|
186ee6d0ff | ||
|
|
3648b91197 | ||
|
|
293795e0ef | ||
|
|
0d79e4aadc | ||
|
|
d65774ae38 | ||
|
|
b7cef9f642 | ||
|
|
c0721917c8 | ||
|
|
5c3281ad89 | ||
|
|
e83b33f844 | ||
|
|
37f915419b | ||
|
|
5511220638 | ||
|
|
663b1b3367 | ||
|
|
a40256c1a9 | ||
|
|
a5739c1991 | ||
|
|
a6cba129b1 | ||
|
|
ba2a0b871a | ||
|
|
5645d1c40c |
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "gnulib"]
|
||||
path = gnulib
|
||||
url = git://git.sv.gnu.org/gnulib.git
|
||||
85
.hgignore
85
.hgignore
@@ -1,85 +0,0 @@
|
||||
# Automatically generated by `hgimportsvn`
|
||||
syntax:glob
|
||||
.svn
|
||||
**.orig
|
||||
aclocal.m4
|
||||
configure
|
||||
config.log
|
||||
**Makefile
|
||||
**Makefile.in
|
||||
config.status
|
||||
config.status.lineno
|
||||
autom4te.cache
|
||||
tags
|
||||
TAGS
|
||||
**/tags
|
||||
**/TAGS
|
||||
lib/.deps
|
||||
lib/*.o
|
||||
lib/alloca.h
|
||||
lib/libgnu.a
|
||||
lib/unistd.h
|
||||
lib/stdbool.h
|
||||
lib/stddef.h
|
||||
lib/stdint.h
|
||||
lib/stdio.h
|
||||
lib/stdlib.h
|
||||
lib/string.h
|
||||
lib/strings.h
|
||||
lib/wchar.h
|
||||
lib/charset.alias
|
||||
lib/configmake.h
|
||||
lib/ref-add.sed
|
||||
lib/ref-del.sed
|
||||
md5/.deps
|
||||
md5/*.o
|
||||
md5/libmd5.a
|
||||
md5/stddef.h
|
||||
md5/stdint.h
|
||||
tests/WgetTest.pm
|
||||
tests/unit-tests
|
||||
tests/*.o
|
||||
src/*.o
|
||||
src/.deps
|
||||
src/stamp-h1
|
||||
src/config.h
|
||||
src/config.h.in
|
||||
src/css.c
|
||||
src/wget
|
||||
src/cscope.out
|
||||
src/libunittest.a
|
||||
src/version.c
|
||||
src/build_info.c
|
||||
doc/stamp-vti
|
||||
doc/wget.1
|
||||
doc/wget.pod
|
||||
doc/wget.info
|
||||
doc/sample.wgetrc.munged_for_texi_inclusion
|
||||
doc/wget.aux
|
||||
doc/wget.cp
|
||||
doc/wget.cps
|
||||
doc/wget.dvi
|
||||
doc/wget.fn
|
||||
doc/wget.ky
|
||||
doc/wget.log
|
||||
doc/wget.pdf
|
||||
doc/wget.pg
|
||||
doc/wget.toc
|
||||
doc/wget.tp
|
||||
doc/wget.vr
|
||||
doc/wget_a4.ps
|
||||
doc/wget_us.ps
|
||||
doc/version.texi
|
||||
po/POTFILES
|
||||
po/*.gmo
|
||||
po/remove-potcdate.sed
|
||||
po/en@boldquot.insert-header
|
||||
po/en@quot.insert-header
|
||||
po/en@boldquot.po
|
||||
po/en@quot.po
|
||||
po/en_US.po
|
||||
util/trunc
|
||||
util/trunc.o
|
||||
util/.deps
|
||||
**~
|
||||
**.*.swp
|
||||
4
AUTHORS
4
AUTHORS
@@ -41,7 +41,7 @@ Nicolas Schodet. Contributed to cookie code and documentation.
|
||||
Daniel Stenberg. NTLM authentication in http-ntlm.c and http-ntlm.h
|
||||
originally written for curl donated for use in GNU Wget.
|
||||
|
||||
Micah Cowan. Current Wget maintainer, from mid-2007.
|
||||
Micah Cowan. Maintained Wget from mid-2007 to mid-2010.
|
||||
|
||||
Ralf Wildenhues. Contributed patches to convert Wget to use Automake as
|
||||
part of its build process, and various bugfixes.
|
||||
@@ -54,3 +54,5 @@ Gnulib getpasswd-gnu module.
|
||||
Ted Mielczarek. Support for parsing links from CSS.
|
||||
|
||||
Saint Xavier. Support for IRIs (RFC 3987).
|
||||
|
||||
Giuseppe Scrivano. Added support for HTTP/1.1. Current Wget maintainer.
|
||||
|
||||
762
ChangeLog
762
ChangeLog
@@ -1,9 +1,693 @@
|
||||
2013-12-22 Giuseppe Scrivano <gscrivan@redhat.com>
|
||||
|
||||
* gnulib: add git submodule.
|
||||
|
||||
2013-09-13 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||
|
||||
* configure.ac: added a summary of build options
|
||||
fixed some indentations
|
||||
removed the unconditionally adding of libz with --with-ssl
|
||||
removed -lgcrypt and -lgpg-error for gnutls
|
||||
|
||||
2013-07-23 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||
|
||||
* configure.ac: Remove AM_CONDITIONAL HAVE_NETTLE.
|
||||
Reported by: Darshit Shah <darnir@gmail.com>.
|
||||
|
||||
2013-07-13 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||
|
||||
* configure.ac: check for libnettle when GNU TLS is used.
|
||||
|
||||
2013-05-17 Bykov Aleksey <gnfalex@rambler.ru>
|
||||
|
||||
* bootstrap: Add `mkostemp'
|
||||
|
||||
2012-10-07 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: Check for patchconf.
|
||||
|
||||
2012-09-23 Merinov Nikolay <kim.roader@gmail.com>
|
||||
|
||||
* m4/wget.m4 (WGET_FNMATCH): Add AC_LANG_SOURCE into
|
||||
AC_COMPILE_IFELSE in order to silence autoconf 2.68 warning.
|
||||
|
||||
2012-09-20 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap: Update from gnulib.
|
||||
|
||||
2012-09-02 Nguyễn Thái Ngọc Duy <pclouds@gmail.com> (tiny change)
|
||||
|
||||
* po/POTFILES.in: Add more files.
|
||||
|
||||
2012-07-08 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap: Update from gnulib.
|
||||
* bootstrap.conf (gnulib_extra_files): Remove $build_aux/missing.
|
||||
* lib/Makefile.am: Delete file.
|
||||
|
||||
2012-06-16 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Remove `closeout'.
|
||||
Reported by: Micah Cowan <micah@cowan.name>.
|
||||
|
||||
2012-05-31 Ángel González <keisial@gmail.com>
|
||||
|
||||
* convert.c: fix segfault on wrong urls (bug 36570)
|
||||
|
||||
2012-05-13 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add `git-version-gen'.
|
||||
* build-aux/bzr-version-gen: Remove file.
|
||||
* configure.ac: Invoke `build-aux/git-version-gen' to get the dist
|
||||
version.
|
||||
* Makefile.am (EXTRA_DIST): Distribute build-aux/git-version-gen instead
|
||||
of build-aux/bzr-version-gen.
|
||||
|
||||
2012-04-11 Gijs van Tulder <gvtulder@gmail.com>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Include module `regex'.
|
||||
* configure.ac: Check for PCRE library.
|
||||
|
||||
2012-03-25 Ray Satiro <raysatiro@yahoo.com>
|
||||
|
||||
* configure.ac: Fix build under mingw when OpenSSL is used.
|
||||
|
||||
2012-03-20 Ángel González <keisial@gmail.com>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add modules `ftello',
|
||||
`mkstemp' and `strtok_r'.
|
||||
|
||||
2012-02-26 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add module `closeout'.
|
||||
|
||||
2012-01-09 Gijs van Tulder <gvtulder@gmail.com>
|
||||
|
||||
* configure.ac: Always try to use libz, even without SSL.
|
||||
|
||||
2011-12-12 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add build-aux/bzr-version-gen.
|
||||
Reported by: Elan Ruusamäe <glen@pld-linux.org>.
|
||||
|
||||
2011-12-11 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* util/trunc.c (main): Call `close' on the fd and check for errors.
|
||||
Reported by: <dga@cs.cmu.edu>.
|
||||
|
||||
2011-10-23 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Include module `vsnprintf'.
|
||||
|
||||
2011-10-16 Steven Schubiger <stsc@member.fsf.org>
|
||||
|
||||
* util/paramcheck.pl: Match 1 or more times where applicable.
|
||||
(extract_entries): Return a copy instead of reference.
|
||||
|
||||
2011-09-04 Alan Hourihane <alanh@fairlite.co.uk> (tiny change)
|
||||
|
||||
* configure.ac: Check for libz when gnutls is used.
|
||||
|
||||
2011-08-26 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: Under mingw don't check for static OpenSSL
|
||||
libraries if the shared version was already found.
|
||||
Suggested by: Ray Satiro <raysatiro@yahoo.com>.
|
||||
|
||||
2011-08-25 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: Check for `utime'.
|
||||
|
||||
2011-08-11 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add `sigprocmask'.
|
||||
|
||||
* configure.ac: Do not hardcode GNU TLS and OpenSSL libraries.
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Include module iconv.
|
||||
|
||||
* configure.ac: Allow --with-libgnutls-prefix and
|
||||
--with-libssl-prefix
|
||||
Suggested by: Karl Berry <karl@freefriends.org>
|
||||
|
||||
* build-aux/bzr-version-gen (TAG): Consider only the last tag.
|
||||
|
||||
2011-08-10 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: Print usage string for --with-ssl.
|
||||
Reported by: Karl Berry <karl@freefriends.org>
|
||||
|
||||
* configure.ac: Check for `gnutls_priority_set_direct' when gnutls is
|
||||
used.
|
||||
Reported by: Karl Berry <karl@freefriends.org>
|
||||
|
||||
2011-08-09 Giuseppe Scrivano <gscrivano@southpole.se>
|
||||
|
||||
* build-aux/bzr-version-gen: Fix some portability issues.
|
||||
|
||||
2011-05-25 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add `strerror_r-posix'.
|
||||
|
||||
2011-05-19 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* COPYING: Fix the copyright years.
|
||||
Reported by: Brett Smith <brett@fsf.org>.
|
||||
|
||||
2011-04-19 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add `mkdir'.
|
||||
|
||||
2011-04-19 Ray Satiro <raysatiro@yahoo.com>
|
||||
|
||||
* configure.ac: Adjust indentation.
|
||||
|
||||
2011-04-17 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: Do not check the host_os twice and if windres is
|
||||
available.
|
||||
Reported by: Ray Satiro <raysatiro@yahoo.com>
|
||||
|
||||
2011-04-16 Ray Satiro <raysatiro@yahoo.com>
|
||||
2011-04-16 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: Detect dynamically linked OpenSSL libraries under
|
||||
mingw32.
|
||||
|
||||
2011-04-14 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap: Update from gnulib.
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add `pipe' and `sigpipe'.
|
||||
|
||||
* .cvsignore: Remove file.
|
||||
* .hgignore: Likewise.
|
||||
* .symlinks: Likewise.
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add `mbtowc and `unlocked-io'.
|
||||
|
||||
2011-04-04 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: Use AC_CHECK_LIB to look for the openssl library.
|
||||
|
||||
2011-04-03 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add `fcntl'.
|
||||
|
||||
(gnulib_modules): Add `ioctl'.
|
||||
|
||||
2011-03-26 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: Fix the gnutls detection.
|
||||
|
||||
2011-03-21 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap: Update from gnulib.
|
||||
|
||||
2011-03-19 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (buildreq): Update build prerequisites list.
|
||||
|
||||
2010-12-07 Jessica McKellar <jesstess@mit.edu> (tiny change)
|
||||
|
||||
* vms/WGET.HLP: Make help message clearer.
|
||||
|
||||
2010-10-24 Jessica McKellar <jesstess@mit.edu> (tiny change)
|
||||
|
||||
* NEWS: Mention the change to the the summary for recursive downloads.
|
||||
|
||||
2010-10-23 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: Add check for libgpg-error and libgcrypt.
|
||||
|
||||
2010-09-06 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* lib/Makefile.am: Fix typo.
|
||||
|
||||
2010-08-08 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Remove configure.bat.
|
||||
|
||||
2010-07-24 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.bat: Remove file.
|
||||
|
||||
2010-07-11 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac (AC_CHECK_SIZEOF): Quote argument.
|
||||
Reported by: Jochen Roderburg <Roderburg@Uni-Koeln.DE>.
|
||||
|
||||
2010-07-09 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (buildreq): Relax gettext version to 0.17.
|
||||
|
||||
2010-07-09 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add `vasprintf'. Remove `asprintf'.
|
||||
|
||||
2010-07-05 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add `asprintf'.
|
||||
|
||||
2010-06-22 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: By default use GNU TLS not OpenSSL.
|
||||
|
||||
2010-06-17 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* windows: Remove directory.
|
||||
* Makefile.am (SUBDIRS): Remove windows.
|
||||
* configure.ac: Don't generate windows/Makefile.
|
||||
|
||||
2010-06-15 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* m4/wget.m4 (WGET_STRUCT_SOCKADDR_STORAGE): Guard header inclusions.
|
||||
(TYPE_STRUCT_SOCKADDR_IN6): Likewise.
|
||||
(MEMBER_SIN6_SCOPE_ID): Likewise.
|
||||
(PROTO_INET6): Likewise.
|
||||
|
||||
* configure.ac: Don't check for `getaddrinfo'.
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add `getaddrinfo' module.
|
||||
|
||||
2010-06-10 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac (AM_INIT_AUTOMAKE): Remove dist-bzip2 dist-lzma from
|
||||
automake options.
|
||||
Reported by: Daniel Stenberg <daniel@haxx.se>.
|
||||
|
||||
2010-06-10 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (buildreq): Add definition.
|
||||
|
||||
2010-06-04 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* build-aux/build_info.pl: Use /usr/bin/env to find the perl
|
||||
interpreter.
|
||||
* util/paramcheck.pl: Likewise.
|
||||
* util/rmold.pl: Likewise.
|
||||
Reported by sci-fi@hush.ai.
|
||||
|
||||
2010-06-03 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add iconv-h.
|
||||
|
||||
2010-06-03 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac (W32LIBS): Remove -lwsock32.
|
||||
|
||||
2010-05-27 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add `snprintf' module.
|
||||
|
||||
* configure.ac: Remove check for the `snprintf' function.
|
||||
|
||||
2010-05-16 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* md5: Remove directory.
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add crypto/md5.
|
||||
|
||||
* configure.ac: Remove any check for md5 libraries.
|
||||
|
||||
* Makefile.am (ACLOCAL_AMFLAGS): Remove -I md5/m4.
|
||||
(SUBDIRS): Remove md5.
|
||||
|
||||
2010-05-15 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Add "getopt-gnu". Remove "getopt".
|
||||
|
||||
2010-05-14 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap (gnulib_path): Default to "gnulib" if it doesn't have a
|
||||
value. Redirect "git clone" stderr to stdout.
|
||||
|
||||
2010-05-09 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* build-aux/bzr-version-gen: New file.
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add .version.
|
||||
(BUILT_SOURCES): New defition.
|
||||
(.version): New rule.
|
||||
(dist-hook): Likewise.
|
||||
|
||||
* configure.ac (AC_INIT): Use build-aux/bzr-version-gen to generate the
|
||||
version string.
|
||||
|
||||
2010-05-08 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* Makefile.am: Update copyright years.
|
||||
|
||||
* build-aux/build_info.pl: Likewise.
|
||||
|
||||
* configure.ac: Likewise.
|
||||
|
||||
* configure.bat: Likewise.
|
||||
|
||||
* doc/Makefile.am: Likewise.
|
||||
|
||||
* doc/fdl.texi: Likewise.
|
||||
|
||||
* doc/texi2pod.pl: Likewise.
|
||||
|
||||
* doc/wget.texi: Likewise.
|
||||
|
||||
* m4/exitfail.m4: Likewise.
|
||||
|
||||
* m4/getpagesize.m4: Likewise.
|
||||
|
||||
* m4/wchar.m4: Likewise.
|
||||
|
||||
* m4/wctype.m4: Likewise.
|
||||
|
||||
* m4/wget.m4: Likewise.
|
||||
|
||||
* md5/Makefile.am: Likewise.
|
||||
|
||||
* md5/dummy.c: Likewise.
|
||||
|
||||
* md5/m4/00gnulib.m4: Likewise.
|
||||
|
||||
* md5/m4/gnulib-cache.m4: Likewise.
|
||||
|
||||
* md5/m4/gnulib-common.m4: Likewise.
|
||||
|
||||
* md5/m4/gnulib-comp.m4: Likewise.
|
||||
|
||||
* md5/m4/gnulib-tool.m4: Likewise.
|
||||
|
||||
* md5/m4/include_next.m4: Likewise.
|
||||
|
||||
* md5/m4/longlong.m4: Likewise.
|
||||
|
||||
* md5/m4/md5.m4: Likewise.
|
||||
|
||||
* md5/m4/multiarch.m4: Likewise.
|
||||
|
||||
* md5/m4/stddef_h.m4: Likewise.
|
||||
|
||||
* md5/m4/stdint.m4: Likewise.
|
||||
|
||||
* md5/m4/wchar.m4: Likewise.
|
||||
|
||||
* md5/m4/wchar_t.m4: Likewise.
|
||||
|
||||
* md5/m4/wint_t.m4: Likewise.
|
||||
|
||||
* md5/md5.h: Likewise.
|
||||
|
||||
* md5/stddef.in.h: Likewise.
|
||||
|
||||
* md5/stdint.in.h: Likewise.
|
||||
|
||||
* md5/wchar.in.h: Likewise.
|
||||
|
||||
* msdos/config.h: Likewise.
|
||||
|
||||
* msdos/msdos.c: Likewise.
|
||||
|
||||
* po/POTFILES.in: Likewise.
|
||||
|
||||
* util/Makefile.am: Likewise.
|
||||
|
||||
* util/paramcheck.pl: Likewise.
|
||||
|
||||
* util/rmold.pl: Likewise.
|
||||
|
||||
2010-05-07 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: Don't call macro WGET_SOCKLEN_T.
|
||||
(W32LIBS): Add -lws2_32.
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Remove autogen.sh.
|
||||
|
||||
* bootstrap.conf (gnulib_modules): Use new modules from gnulib: accept,
|
||||
bind, close, connect, getpeername, getsockname, listen, setsockopt.
|
||||
|
||||
* m4/wget.m4 (WGET_SOCKLEN_T): Remove macro.
|
||||
|
||||
* po/wget.pot: Remove.
|
||||
|
||||
2010-05-07 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac (ALL_LINGUAS): Remove.
|
||||
|
||||
2010-05-06 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* bootstrap: New file.
|
||||
* bootstrap.conf: New file.
|
||||
* lib/Makefile.am: include gnulib.mk.
|
||||
* autogen.sh: Removed.
|
||||
* GNUmakefile: Likewise.
|
||||
* INSTALL: Likewise.
|
||||
* build-aux/announce-gen: Likewise.
|
||||
* build-aux/compile: Likewise.
|
||||
* build-aux/config.guess: Likewise.
|
||||
* build-aux/config.rpath: Likewise.
|
||||
* build-aux/config.sub: Likewise.
|
||||
* build-aux/depcomp: Likewise.
|
||||
* build-aux/gnupload: Likewise.
|
||||
* build-aux/install-sh: Likewise.
|
||||
* build-aux/mdate-sh: Likewise.
|
||||
* build-aux/missing: Likewise.
|
||||
* build-aux/mkinstalldirs: Likewise.
|
||||
* build-aux/texinfo.tex: Likewise.
|
||||
* build-aux/update-copyright: Likewise.
|
||||
* build-aux/useless-if-before-free: Likewise.
|
||||
* build-aux/vc-list-files: Likewise.
|
||||
* build-aux/ylwrap: Likewise.
|
||||
* lib/DESCRIP_DEPS.MMS: Likewise.
|
||||
* lib/DESCRIP_MODS.MMS: Likewise.
|
||||
* lib/DESCRIP_SRC.MMS: Likewise.
|
||||
* lib/alloca.c: Likewise.
|
||||
* lib/alloca.in.h: Likewise.
|
||||
* lib/c-ctype.c: Likewise.
|
||||
* lib/c-ctype.h: Likewise.
|
||||
* lib/config.charset: Likewise.
|
||||
* lib/errno.in.h: Likewise.
|
||||
* lib/error.c: Likewise.
|
||||
* lib/error.h: Likewise.
|
||||
* lib/exitfail.c: Likewise.
|
||||
* lib/exitfail.h: Likewise.
|
||||
* lib/fseeko.c: Likewise.
|
||||
* lib/getdelim.c: Likewise.
|
||||
* lib/getline.c: Likewise.
|
||||
* lib/getopt.c: Likewise.
|
||||
* lib/getopt.in.h: Likewise.
|
||||
* lib/getopt1.c: Likewise.
|
||||
* lib/getopt_int.h: Likewise.
|
||||
* lib/getpagesize.c: Likewise.
|
||||
* lib/getpass.c: Likewise.
|
||||
* lib/getpass.h: Likewise.
|
||||
* lib/gettext.h: Likewise.
|
||||
* lib/intprops.h: Likewise.
|
||||
* lib/localcharset.c: Likewise.
|
||||
* lib/localcharset.h: Likewise.
|
||||
* lib/lseek.c: Likewise.
|
||||
* lib/mbrtowc.c: Likewise.
|
||||
* lib/mbsinit.c: Likewise.
|
||||
* lib/memchr.c: Likewise.
|
||||
* lib/memchr.valgrind: Likewise.
|
||||
* lib/quote.c: Likewise.
|
||||
* lib/quote.h: Likewise.
|
||||
* lib/quotearg.c: Likewise.
|
||||
* lib/quotearg.h: Likewise.
|
||||
* lib/realloc.c: Likewise.
|
||||
* lib/ref-add.sin: Likewise.
|
||||
* lib/ref-del.sin: Likewise.
|
||||
* lib/stdbool.in.h: Likewise.
|
||||
* lib/stddef.in.h: Likewise.
|
||||
* lib/stdint.in.h: Likewise.
|
||||
* lib/stdio-impl.h: Likewise.
|
||||
* lib/stdio-write.c: Likewise.
|
||||
* lib/stdio.in.h: Likewise.
|
||||
* lib/stdlib.in.h: Likewise.
|
||||
* lib/str-two-way.h: Likewise.
|
||||
* lib/strcasecmp.c: Likewise.
|
||||
* lib/strcasestr.c: Likewise.
|
||||
* lib/streq.h: Likewise.
|
||||
* lib/strerror.c: Likewise.
|
||||
* lib/string.in.h: Likewise.
|
||||
* lib/strings.in.h: Likewise.
|
||||
* lib/strncasecmp.c: Likewise.
|
||||
* lib/unistd.in.h: Likewise.
|
||||
* lib/verify.h: Likewise.
|
||||
* lib/wchar.in.h: Likewise.
|
||||
* lib/wctype.in.h: Likewise.
|
||||
* lib/xalloc-die.c: Likewise.
|
||||
* lib/xalloc.h: Likewise.
|
||||
* lib/xmalloc.c: Likewise.
|
||||
* m4/00gnulib.m4: Likewise.
|
||||
* m4/alloca.m4: Likewise.
|
||||
* m4/codeset.m4: Likewise.
|
||||
* m4/errno_h.m4: Likewise.
|
||||
* m4/error.m4: Likewise.
|
||||
* m4/extensions.m4: Likewise.
|
||||
* m4/fseeko.m4: Likewise.
|
||||
* m4/getdelim.m4: Likewise.
|
||||
* m4/getline.m4: Likewise.
|
||||
* m4/getopt.m4: Likewise.
|
||||
* m4/getpass.m4: Likewise.
|
||||
* m4/gettext.m4: Likewise.
|
||||
* m4/glibc21.m4: Likewise.
|
||||
* m4/gnulib-cache.m4: Likewise.
|
||||
* m4/gnulib-common.m4: Likewise.
|
||||
* m4/gnulib-comp.m4: Likewise.
|
||||
* m4/gnulib-tool.m4: Likewise.
|
||||
* m4/iconv.m4: Likewise.
|
||||
* m4/include_next.m4: Likewise.
|
||||
* m4/inline.m4: Likewise.
|
||||
* m4/lib-ld.m4: Likewise.
|
||||
* m4/lib-link.m4: Likewise.
|
||||
* m4/lib-prefix.m4: Likewise.
|
||||
* m4/localcharset.m4: Likewise.
|
||||
* m4/locale-fr.m4: Likewise.
|
||||
* m4/locale-ja.m4: Likewise.
|
||||
* m4/locale-zh.m4: Likewise.
|
||||
* m4/longlong.m4: Likewise.
|
||||
* m4/lseek.m4: Likewise.
|
||||
* m4/malloc.m4: Likewise.
|
||||
* m4/mbrtowc.m4: Likewise.
|
||||
* m4/mbsinit.m4: Likewise.
|
||||
* m4/mbstate_t.m4: Likewise.
|
||||
* m4/memchr.m4: Likewise.
|
||||
* m4/mmap-anon.m4: Likewise.
|
||||
* m4/multiarch.m4: Likewise.
|
||||
* m4/nls.m4: Likewise.
|
||||
* m4/po.m4: Likewise.
|
||||
* m4/progtest.m4: Likewise.
|
||||
* m4/quote.m4: Likewise.
|
||||
* m4/quotearg.m4: Likewise.
|
||||
* m4/realloc.m4: Likewise.
|
||||
* m4/stdbool.m4: Likewise.
|
||||
* m4/stddef_h.m4: Likewise.
|
||||
* m4/stdint.m4: Likewise.
|
||||
* m4/stdio_h.m4: Likewise.
|
||||
* m4/stdlib_h.m4: Likewise.
|
||||
* m4/strcase.m4: Likewise.
|
||||
* m4/strcasestr.m4: Likewise.
|
||||
* m4/strerror.m4: Likewise.
|
||||
* m4/string_h.m4: Likewise.
|
||||
* m4/strings_h.m4: Likewise.
|
||||
* m4/unistd_h.m4: Likewise.
|
||||
* m4/wchar_t.m4: Likewise.
|
||||
* m4/wint_t.m4: Likewise.
|
||||
* m4/xalloc.m4: Likewise.
|
||||
* maint.mk: Likewise.
|
||||
* po/Makefile.in.in: Likewise.
|
||||
* po/Makevars: Likewise.
|
||||
* po/Rules-quot: Likewise.
|
||||
* po/be.po: Likewise.
|
||||
* po/bg.po: Likewise.
|
||||
* po/boldquot.sed: Likewise.
|
||||
* po/ca.po: Likewise.
|
||||
* po/cs.po: Likewise.
|
||||
* po/da.po: Likewise.
|
||||
* po/de.po: Likewise.
|
||||
* po/el.po: Likewise.
|
||||
* po/en_GB.po: Likewise.
|
||||
* po/eo.po: Likewise.
|
||||
* po/es.po: Likewise.
|
||||
* po/et.po: Likewise.
|
||||
* po/eu.po: Likewise.
|
||||
* po/fi.po: Likewise.
|
||||
* po/fr.po: Likewise.
|
||||
* po/ga.po: Likewise.
|
||||
* po/gl.po: Likewise.
|
||||
* po/he.po: Likewise.
|
||||
* po/hr.po: Likewise.
|
||||
* po/hu.po: Likewise.
|
||||
* po/id.po: Likewise.
|
||||
* po/it.po: Likewise.
|
||||
* po/ja.po: Likewise.
|
||||
* po/lt.po: Likewise.
|
||||
* po/nb.po: Likewise.
|
||||
* po/nl.po: Likewise.
|
||||
* po/pl.po: Likewise.
|
||||
* po/pt.po: Likewise.
|
||||
* po/pt_BR.po: Likewise.
|
||||
* po/quot.sed: Likewise.
|
||||
* po/ro.po: Likewise.
|
||||
* po/ru.po: Likewise.
|
||||
* po/sk.po: Likewise.
|
||||
* po/sl.po: Likewise.
|
||||
* po/sr.po: Likewise.
|
||||
* po/sv.po: Likewise.
|
||||
* po/tr.po: Likewise.
|
||||
* po/uk.po: Likewise.
|
||||
* po/vi.po: Likewise.
|
||||
* po/zh_CN.po: Likewise.
|
||||
* po/zh_TW.po: Likewise.
|
||||
|
||||
2010-05-04 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* AUTHORS: Added myself.
|
||||
|
||||
2010-05-03 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* configure.ac: Fix a sanity check by the AC_CONFIG_SRCDIR macro.
|
||||
|
||||
2010-05-01 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* NEWS: Mention support for HTTP/1.1.
|
||||
|
||||
2009-10-09 Steven Schweda <sms@antinode.info>
|
||||
|
||||
* New VMS MMS/MMK builders, to accommodate the new source tree
|
||||
structure:
|
||||
lib/DESCRIP_DEPS.MMS Dependencies (lib)
|
||||
lib/DESCRIP_MODS.MMS Modules (lib)
|
||||
lib/DESCRIP_SRC.MMS Main (lib)
|
||||
md5/DESCRIP_DEPS.MMS Dependencies (md5)
|
||||
md5/DESCRIP_MODS.MMS Modules (md5)
|
||||
md5/DESCRIP_SRC.MMS Main (md5)
|
||||
src/DESCRIP_DEPS.MMS Dependencies (src)
|
||||
src/DESCRIP_MODS.MMS Modules (src)
|
||||
src/DESCRIP_SRC.MMS Main (src)
|
||||
vms/DESCRIP.MMS Main (global)
|
||||
vms/DESCRIP_MKDEPS.MMS Dependency generator
|
||||
vms/DESCRIP_SRC.MMS Main (main)
|
||||
vms/DESCRIP_SRC_CMN.MMS Main (common)
|
||||
vms/DESCRIP_SRC_FLAGS.MMS Compiler and linker flags
|
||||
vms/COLLECT_DEPS.COM Dependency processor
|
||||
vms/CONFIG_EXTRACT.COM Extract AC_INIT from configure.ac
|
||||
vms/WGET_MULTINET.OPT Link options for (old) MultiNet
|
||||
vms/WGET_SSL_HP.OPT Link options for HP SSL
|
||||
vms/WGET_SSL_O.OPT Link options for OpenSSL
|
||||
|
||||
* Other VMS-specific files:
|
||||
vms/alloca.h Dummy alloca.h.
|
||||
vms/config.h_vms Manually crafted config.h
|
||||
vms/stdint.h Dummy stdint.h
|
||||
vms/vms.h Declarations, prototypes for vms.c
|
||||
vms/vms_ip.h Helper for netdb.h
|
||||
vms/VMS_NOTES.TXT Instructions, notes
|
||||
vms/WGET.HLP Basic VMS HELP
|
||||
|
||||
2009-10-09 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* build_aux/build_info.pl: Reworked the input format. Eliminated
|
||||
support, and need, for arbitrary #if blocks. Introduced
|
||||
"choices", and explicitly open the .c file rather than print to
|
||||
STDOUT, so we avoid creating the file if we find problems with
|
||||
the input. Options are advertised in alphabetical order.
|
||||
|
||||
2009-09-24 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* vms/vms.c: Moved to src/src.c.
|
||||
|
||||
2009-09-22 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* configure.ac: Added "sleep" and "symlink" to AC_CHECK_FUNCS,
|
||||
removing the hard-coded definition of HAVE_SYMLINK. When running
|
||||
on MinGW, compile mswindows.c, and link against libwsock32.
|
||||
|
||||
2009-09-21 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* vms/VMS-WGET.COM: "the the" -> "the".
|
||||
|
||||
* po/POTFILES.in: Removed some files that are not using gettext.
|
||||
|
||||
|
||||
* po/*.po: Updated from translationproject.org.
|
||||
|
||||
2009-09-20 Micah Cowan <micah@cowan.name>
|
||||
@@ -63,7 +747,7 @@
|
||||
* build-aux/gnupload: Imported from gnulib.
|
||||
* lib/Makefile.am, m4/gnulib-cache.m4, m4/gnulib-comp.m4: Adjusted
|
||||
for announce-gen, update-copyright, and gnupload.
|
||||
|
||||
|
||||
2009-09-03 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* NEWS: Give credit to jff for SSL security fix, call attention to
|
||||
@@ -161,7 +845,7 @@
|
||||
|
||||
* po/Makefile.in.in (distclean): remove en_US.po, too.
|
||||
|
||||
* Makefile.am: Include md5 as a subdir unconditionally.
|
||||
* Makefile.am: Include md5 as a subdir unconditionally.
|
||||
It may result in useless compilation, and additional risk of
|
||||
breaking a build of something that isn't actually needed, but
|
||||
otherwise it's too much of a hassle to manage a failure-free
|
||||
@@ -225,14 +909,14 @@
|
||||
|
||||
* po/quot.sed, po/boldquot.sed: Automatic handling of quotearg's `
|
||||
and '.
|
||||
|
||||
|
||||
2008-05-15 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* NEWS: Entry for --ask-password.
|
||||
|
||||
2008-05-14 Joao Ferreira <joao@joaoff.com>
|
||||
|
||||
* src/main.c, src/http.c, src/ftp.c: -nc is now working in
|
||||
* src/main.c, src/http.c, src/ftp.c: -nc is now working in
|
||||
conjunction with '-O file'.
|
||||
|
||||
2008-05-12 Micah Cowan <micah@cowan.name>
|
||||
@@ -247,13 +931,13 @@
|
||||
|
||||
* lib/getdelim.c, lib/getline.c, lib/getpass.c,
|
||||
lib/getpass.h, lib/realloc.c, lib/stdio.h,
|
||||
lib/stdio.in.h, lib/stdlib.h, lib/stdlib.in.h: Imported
|
||||
lib/stdio.in.h, lib/stdlib.h, lib/stdlib.in.h: Imported
|
||||
from gnulib.
|
||||
* m4/eoverflow.m4, m4/extensions.m4, m4/getdelim.m4,
|
||||
m4/getline.m4, m4/getpass.m4, m4/malloc.m4, m4/realloc.m4,
|
||||
* m4/eoverflow.m4, m4/extensions.m4, m4/getdelim.m4,
|
||||
m4/getline.m4, m4/getpass.m4, m4/malloc.m4, m4/realloc.m4,
|
||||
m4/stdio_h.m4, m4/stdlib_h.m4: Imported from gnulib.
|
||||
* md5/stdint.h: Imported from gnulib.
|
||||
|
||||
|
||||
* GNUmakefile: Updated from gnulib.
|
||||
* lib/Makefile.am, lib/getopt.c, lib/unistd.in.h: Updated
|
||||
from gnulib.
|
||||
@@ -263,7 +947,7 @@
|
||||
md5/m4/gnulib-comp.m4, md5/m4/include_next.m4, md5/m4/md5.m4,
|
||||
md5/m4/stdint.m4, md5/md5.c, md5/md5.h, md5/stdint.in.h,
|
||||
md5/wchar.in.h: Updated from gnulib.
|
||||
|
||||
|
||||
2008-04-24 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* NEWS: Removed info about move to Automake, Gnulib. Added item
|
||||
@@ -581,7 +1265,7 @@
|
||||
|
||||
2006-07-17 Daniel Richard G. <skunk@iSKUNK.ORG>
|
||||
|
||||
* Makefile.in: Added DESTDIR='$(DESTDIR)' to MAKEDEFS.
|
||||
* Makefile.in: Added DESTDIR='$(DESTDIR)' to MAKEDEFS.
|
||||
|
||||
2006-07-14 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||
|
||||
@@ -602,13 +1286,13 @@
|
||||
2005-11-02 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||
|
||||
* Makefile.in: Improved support for unit testing.
|
||||
|
||||
|
||||
* configure.in: Ditto.
|
||||
|
||||
|
||||
2005-10-27 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||
|
||||
* Makefile.in: Added basic support for unit testing.
|
||||
|
||||
|
||||
2005-08-26 Stepan Kasal <kasal@ucw.cz>
|
||||
|
||||
* configure.in: Abort configure if --with-ssl given but SSL
|
||||
@@ -1812,7 +2496,7 @@
|
||||
|
||||
* aclocal.m4: Appended libtool 1.3.5's libtool.m4 to it.
|
||||
|
||||
* configure.in: Use AM_PROG_LIBTOOL macro (now defined in our
|
||||
* configure.in: Use AM_PROG_LIBTOOL macro (now defined in our
|
||||
aclocal.m4) to create a libtool script from ltconfig and ltmain.sh.
|
||||
If --with-ssl specified, look in /usr/local/ssl/lib by default for
|
||||
OpenSSL libs. Allow override with --with-ssl=<OpenSSL_root_dir>.
|
||||
@@ -1835,11 +2519,11 @@
|
||||
so I've put the item back, with a modified wording.
|
||||
|
||||
* config.guess: Hadn't been updated since 1996 -- didn't work for recent
|
||||
machines and OSes, such as NetWinder ARM Linux. Updated to latest
|
||||
machines and OSes, such as NetWinder ARM Linux. Updated to latest
|
||||
version (2001-03-16) from <ftp://ftp.gnu.org/pub/gnu/config/>.
|
||||
|
||||
|
||||
* config.sub: Ditto -- updated to latest version (2001-03-12).
|
||||
|
||||
|
||||
2001-03-12 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* TODO: Only normal recursion should respect -np -- page-requisite
|
||||
@@ -1889,7 +2573,7 @@
|
||||
* TODO: Remove empty directories created due to --accept/--reject.
|
||||
|
||||
* configure.in: Look for perl and pod2man and make substitutions.
|
||||
|
||||
|
||||
* Makefile.in (install): Do install.man if we have pod2man.
|
||||
|
||||
2001-02-13 Jan Prikryl <prikryl@cg.tuwien.ac.at>
|
||||
@@ -1898,7 +2582,7 @@
|
||||
|
||||
* windows/wget.dep: Ditto.
|
||||
|
||||
* windows/Makefile.watcom: Ditto.
|
||||
* windows/Makefile.watcom: Ditto.
|
||||
|
||||
2001-01-23 Herold Heiko <Heiko.Herold@previnet.it>
|
||||
|
||||
@@ -1921,13 +2605,13 @@
|
||||
* po/Makefile.in.in: `make realclean' equal to `make
|
||||
maintainer-clean'.
|
||||
|
||||
* Makefile.in (realclean-top): Remove 'configure' as well.
|
||||
* Makefile.in (realclean-top): Remove 'configure' as well.
|
||||
|
||||
2001-01-11 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* TODO: If -c used with -N, check to make sure a file hasn't
|
||||
changed on the server before "continuing" to download it.
|
||||
|
||||
|
||||
2001-01-11 Adrian Aichner <Adrian.Aichner@t-online.de>
|
||||
|
||||
* windows/Makefile.src: Updated.
|
||||
@@ -1937,7 +2621,7 @@
|
||||
2001-01-09 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* TODO: If -c is on, don't re-download a 100%-downloaded file.
|
||||
|
||||
|
||||
* TODO: The bug where you couldn't recurse into ftp directories if
|
||||
logging in put you somewhere else besides the server's "/"
|
||||
directory got fixed without the TODO entry for it being removed.
|
||||
@@ -1980,12 +2664,12 @@
|
||||
"1.6-pre" guy). In any case, the 'POT-Creation-Date's and
|
||||
'PO-Revision-Date's remain the best indicator of whether a
|
||||
translation's out of date.
|
||||
|
||||
|
||||
* ChangeLog: Since this flat file doesn't have multiple branches,
|
||||
looking at the dates would make you think that things went into
|
||||
1.6 that actually just went into the 1.7-dev branch. Added "[Not
|
||||
in 1.6 branch.]" where appropriate to clarify.
|
||||
|
||||
|
||||
2000-12-18 Csaba Raduly <csaba.raduly@sophos.com>
|
||||
|
||||
* windows/Makefile.watcom: Updated.
|
||||
@@ -2006,7 +2690,7 @@
|
||||
|
||||
* Makefile.in (SUBDIRS): Add 'windows'.
|
||||
(dist, DISTFILES): Don't distribute CVS directories.
|
||||
|
||||
|
||||
2000-12-05 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||
|
||||
* configure.in: Don't unconditionally define HAVE_SSL, even when
|
||||
@@ -2015,9 +2699,9 @@
|
||||
2000-12-03 Christian Fraenkel <christian.fraenkel@gmx.net>
|
||||
|
||||
* INSTALL: Added the --with-ssl switch.
|
||||
|
||||
|
||||
* configure.in: Ditto.
|
||||
|
||||
|
||||
* TODO: Removed the corresponding entry.
|
||||
|
||||
2000-11-23 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||
@@ -2082,7 +2766,7 @@
|
||||
* po/pl.{gmo,po}: Added Grzegorz Kowal <g_kowal@poczta.onet.pl>'s
|
||||
Polish message translation file.
|
||||
|
||||
* po/ru.{gmo,po}: Added Const Kaplinsky <const@ce.cctpu.edu.ru>'s
|
||||
* po/ru.{gmo,po}: Added Const Kaplinsky <const@ce.cctpu.edu.ru>'s
|
||||
Russian message translation file.
|
||||
|
||||
2000-10-16 Dan Harkless <wget@harkless.org>
|
||||
@@ -2106,7 +2790,7 @@
|
||||
now says to email the mailing list or bug-wget@gnu.org.
|
||||
|
||||
* MAILING-LIST: Added mention of bug-wget@gnu.org.
|
||||
|
||||
|
||||
* NEWS: Added --waitretry and --page-requisites.
|
||||
|
||||
2000-08-25 Dan Harkless <wget@harkless.org>
|
||||
@@ -2116,26 +2800,26 @@
|
||||
made AIX and FreeBSD entries more general to reflect successful
|
||||
use on those platforms by myself and others, removed the
|
||||
non-factual "this version of", and fixed some grammatical errors.
|
||||
|
||||
|
||||
2000-07-21 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* TODO: But Brian McMahon <bm@iucr.org> wants old behavior as an option.
|
||||
|
||||
|
||||
2000-07-19 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* TODO: -k should convert "hostless absolute" URLs, like "/index.html".
|
||||
|
||||
|
||||
2000-05-24 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* TODO: Timestamps sometimes not copied over on files retrieved by FTP.
|
||||
|
||||
|
||||
2000-05-22 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* AUTHORS: Added myself to this file, as Hrvoje got confirmation
|
||||
of my FSF copyright assignment.
|
||||
|
||||
* TODO: Added note that fragment identifiers don't work properly.
|
||||
|
||||
|
||||
* po/*.{gmo,po,pot}: Regenerated after modifying wget --help output.
|
||||
|
||||
2000-05-17 Dan Harkless <wget@harkless.org>
|
||||
@@ -2159,7 +2843,7 @@
|
||||
|
||||
* TODO: Removed done item: we now have an option (-G) that makes
|
||||
it easy to download a single HTML document and all its constituents.
|
||||
|
||||
|
||||
* po/*.{gmo,po,pot}: Regenerated after adding new options.
|
||||
|
||||
* po/hr.po: Hrvoje forgot '\n's on his translations of my altered
|
||||
@@ -2312,7 +2996,7 @@
|
||||
|
||||
1998-03-16 Hrvoje Niksic <hniksic@srce.hr>
|
||||
|
||||
* po/POTFILES.in: Removed extraneous newline at end of line, which
|
||||
* po/POTFILES.in: Removed extraneous newline at end of line, which
|
||||
caused an error in `Makefile' which Sun make choked on.
|
||||
|
||||
1998-03-16 Jan Prikryl <prikryl@cg.tuwien.ac.at>
|
||||
@@ -2386,7 +3070,7 @@
|
||||
* configure.in (ALL_LINGUAS): New variable. Add "de" and "hr".
|
||||
(AM_GNU_GETTEXT): Add.
|
||||
(AC_OUTPUT): Add po/Makefile.in; run the sed command.
|
||||
|
||||
|
||||
* aclocal.m4 (AM_WITH_NLS, AM_GNU_GETTEXT, AM_LC_MESSAGES,
|
||||
AM_PATH_PROG_WITH_TEST): from gettext-0.10.32.
|
||||
|
||||
|
||||
|
||||
127
GNUmakefile
127
GNUmakefile
@@ -1,127 +0,0 @@
|
||||
# Having a separate GNUmakefile lets me `include' the dynamically
|
||||
# generated rules created via cfg.mk (package-local configuration)
|
||||
# as well as maint.mk (generic maintainer rules).
|
||||
# This makefile is used only if you run GNU Make.
|
||||
# It is necessary if you want to build targets usually of interest
|
||||
# only to the maintainer.
|
||||
|
||||
# Copyright (C) 2001, 2003, 2006-2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Systems where /bin/sh is not the default shell need this. The $(shell)
|
||||
# command below won't work with e.g. stock DOS/Windows shells.
|
||||
ifeq ($(wildcard /bin/s[h]),/bin/sh)
|
||||
SHELL = /bin/sh
|
||||
else
|
||||
# will be used only with the next shell-test line, then overwritten
|
||||
# by a configured-in value
|
||||
SHELL = sh
|
||||
endif
|
||||
|
||||
# If the user runs GNU make but has not yet run ./configure,
|
||||
# give them a diagnostic.
|
||||
_have-Makefile := $(shell test -f Makefile && echo yes)
|
||||
ifeq ($(_have-Makefile),yes)
|
||||
|
||||
# Make tar archive easier to reproduce.
|
||||
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
|
||||
|
||||
# Allow the user to add to this in the Makefile.
|
||||
ALL_RECURSIVE_TARGETS =
|
||||
|
||||
include Makefile
|
||||
|
||||
# Some projects override e.g., _autoreconf here.
|
||||
-include $(srcdir)/cfg.mk
|
||||
include $(srcdir)/maint.mk
|
||||
|
||||
# Allow cfg.mk to override these.
|
||||
_build-aux ?= build-aux
|
||||
_autoreconf ?= autoreconf
|
||||
|
||||
# Ensure that $(VERSION) is up to date for dist-related targets, but not
|
||||
# for others: rerunning autoreconf and recompiling everything isn't cheap.
|
||||
_have-git-version-gen := \
|
||||
$(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
|
||||
ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
|
||||
_is-dist-target ?= $(filter-out %clean, \
|
||||
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
||||
_is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
|
||||
ifneq (,$(_is-dist-target)$(_is-install-target))
|
||||
_curr-ver := $(shell cd $(srcdir) \
|
||||
&& $(_build-aux)/git-version-gen .tarball-version)
|
||||
ifneq ($(_curr-ver),$(VERSION))
|
||||
ifeq ($(_curr-ver),UNKNOWN)
|
||||
$(info WARNING: unable to verify if $(VERSION) is the correct version)
|
||||
else
|
||||
ifneq (,$(_is-install-target))
|
||||
# GNU Coding Standards state that 'make install' should not cause
|
||||
# recompilation after 'make all'. But as long as changing the version
|
||||
# string alters config.h, the cost of having 'make all' always have an
|
||||
# up-to-date version is prohibitive. So, as a compromise, we merely
|
||||
# warn when installing a version string that is out of date; the user
|
||||
# should run 'autoreconf' (or something like 'make distcheck') to
|
||||
# fix the version, 'make all' to propagate it, then 'make install'.
|
||||
$(info WARNING: version string $(VERSION) is out of date;)
|
||||
$(info run '$(MAKE) _version' to fix it)
|
||||
else
|
||||
$(info INFO: running autoreconf for new version string: $(_curr-ver))
|
||||
_dummy := $(shell $(MAKE) $(AM_MAKEFLAGS) _version)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: _version
|
||||
_version:
|
||||
cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
|
||||
|
||||
else
|
||||
|
||||
.DEFAULT_GOAL := abort-due-to-no-makefile
|
||||
srcdir = .
|
||||
|
||||
# The package can override .DEFAULT_GOAL to run actions like autoreconf.
|
||||
-include ./cfg.mk
|
||||
include ./maint.mk
|
||||
|
||||
ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
|
||||
$(MAKECMDGOALS): abort-due-to-no-makefile
|
||||
endif
|
||||
|
||||
abort-due-to-no-makefile:
|
||||
@echo There seems to be no Makefile in this directory. 1>&2
|
||||
@echo "You must run ./configure before running \`make'." 1>&2
|
||||
@exit 1
|
||||
|
||||
endif
|
||||
|
||||
# Tell version 3.79 and up of GNU make to not build goals in this
|
||||
# directory in parallel, in case someone tries to build multiple
|
||||
# targets, and one of them can cause a recursive target to be invoked.
|
||||
|
||||
# Only set this if Automake doesn't provide it.
|
||||
AM_RECURSIVE_TARGETS ?= $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) \
|
||||
dist distcheck tags ctags
|
||||
|
||||
ALL_RECURSIVE_TARGETS += $(AM_RECURSIVE_TARGETS)
|
||||
|
||||
ifneq ($(word 2, $(MAKECMDGOALS)), )
|
||||
ifneq ($(filter $(ALL_RECURSIVE_TARGETS), $(MAKECMDGOALS)), )
|
||||
.NOTPARALLEL:
|
||||
endif
|
||||
endif
|
||||
189
INSTALL
189
INSTALL
@@ -1,189 +0,0 @@
|
||||
-*- text -*-
|
||||
GNU Wget Installation Procedure
|
||||
===============================
|
||||
|
||||
0. Introduction
|
||||
---------------
|
||||
|
||||
This document describes how to build Wget from source code on
|
||||
Unix-like systems. If you want to install a precompiled Wget, this
|
||||
document is not for you -- refer to the documentation provided by the
|
||||
distributors instead. If you already have Wget and want to learn how
|
||||
to use it, refer to Wget's Info documentation or man page which you
|
||||
should have received with your system. If you are using Windows
|
||||
(except for Cygwin), read windows/README instead. If you want to
|
||||
compile Wget from source code on a Unix-like system, read on.
|
||||
|
||||
The preferred form of building Wget is to get a release archive and
|
||||
unpack it (which you have presumably done, since you are reading
|
||||
this). If you have obtained the source code via the Mercurial
|
||||
repository, please follow the instructions in `README.checkout' before
|
||||
continuing, as the sources from the Mercurial repository do not include
|
||||
some files that are present in official distributions; these additional
|
||||
files must be generated first.
|
||||
|
||||
1. Dependencies
|
||||
---------------
|
||||
|
||||
To build Wget, your system must support a Unix-like command-line
|
||||
development environment, including the text-processing utilities (sh,
|
||||
grep, awk, sed, etc.) and a functional C compiler. On some GNU/Linux
|
||||
systems, this means that you will need to install packages such as
|
||||
`gcc', `glibc-devel' (or `libc6-dev') and `make'. Most systems come
|
||||
with these packages preinstalled, but it doesn't hurt to check. If
|
||||
you have successfully compiled other software from source, you
|
||||
probably have them all.
|
||||
|
||||
In addition to the C development environment, Wget can use a number of
|
||||
optional libraries to provide additional features, such as translated
|
||||
messages and support for "https" URLs. The "external" dependencies
|
||||
include:
|
||||
|
||||
- OpenSSL -- for "https" URLs.
|
||||
- GNU gettext -- for translated messages.
|
||||
- GNU libidn -- for IDN/IRI support.
|
||||
- GNU libiconv -- for IDN/IRI support (not needed on GNU).
|
||||
|
||||
To be usable for building Wget, the listed libraries must be installed
|
||||
with their "development" header files. On GNU/Linux systems this
|
||||
typically means installing the corredponsing "lib<name>-devel" or
|
||||
"lib<name>-dev" package along with the package with "lib<name>".
|
||||
|
||||
2. Configuration
|
||||
----------------
|
||||
|
||||
Before compiling Wget, you need to "configure" it using the
|
||||
`configure' script provided with the distribution. Configuration
|
||||
serves two distinct purposes: it enables Wget's build system to
|
||||
inspect certain features of your operating system for more robust
|
||||
compilation, and it enables you to choose which features you want the
|
||||
resulting Wget to have.
|
||||
|
||||
As is the case with most GNU software, Wget's configure script was
|
||||
generated with GNU Autoconf. If you're not familiar with
|
||||
Autoconf-generated scripts, read on.
|
||||
|
||||
The most straightforward way to configure Wget is by running the
|
||||
configure script without any arguments. After running some
|
||||
compilation-related tests, it will create the Makefiles needed to
|
||||
build Wget. However, you may wish to customize Wget's configuration
|
||||
by providing arguments to `configure'. Wget's configure script
|
||||
accepts standard Autoconf arguments, the most important ones being:
|
||||
|
||||
--help display a help message and exit
|
||||
|
||||
--prefix=PREFIX install architecture-independent files in PREFIX
|
||||
(/usr/local by default)
|
||||
--bindir=DIR user executables in DIR (PREFIX/bin)
|
||||
--infodir=DIR info documentation in DIR [PREFIX/info]
|
||||
--mandir=DIR man documentation in DIR [PREFIX/man]
|
||||
|
||||
For example, if you are not root and want to install Wget in
|
||||
subdirectories of your home directory, you can use:
|
||||
|
||||
./configure --prefix=$HOME
|
||||
|
||||
In addition to the above generic options, Wget's configuration
|
||||
supports a number of options more or less specific to Wget. Options
|
||||
beginning with "--disable", such as `--disable-opie' or
|
||||
`--disable-ntlm', allow you to turn off certain built-in functionality
|
||||
you don't need in order to reduce the size of the executable. Options
|
||||
beginning with "--with" turning off autodetection and use of external
|
||||
software Wget can link with, such as the SSL libraries. Recognized
|
||||
"--enable" and "--with" options include:
|
||||
|
||||
--without-ssl disable SSL autodetection (used for https support)
|
||||
--with-libssl-prefix=DIR search for libssl in DIR/lib
|
||||
--disable-opie disable support for opie or s/key FTP login
|
||||
--disable-digest disable support for HTTP digest authorization
|
||||
--disable-ntlm disable support for HTTP NTLM authorization
|
||||
--disable-debug disable support for debugging output
|
||||
--disable-nls do not use Native Language Support
|
||||
--disable-largefile omit support for large files
|
||||
--disable-ipv6 disable IPv6 support
|
||||
--disable-rpath do not hardcode runtime library paths
|
||||
--disable-iri disable IDN/IRIs support
|
||||
|
||||
For the full list, see the output of `./configure --help'.
|
||||
|
||||
You can inspect decisions made by configure by editing the generated
|
||||
Makefiles and the `src/config.h' include file. The defaults should
|
||||
work without intervention, but if you know what you are doing, editing
|
||||
the generated files before compilation is fine -- they will not be
|
||||
regenerated until you run configure again.
|
||||
|
||||
`configure' will try to find a compiler in your PATH, defaulting to
|
||||
`gcc', but falling back to `cc' if the former is unavailable. This is
|
||||
a reasonable default on most Unix-like systems, but sometimes you
|
||||
might want to override it. The compiler choice is overridden by
|
||||
setting the `CC' environment variable to the desired compiler file
|
||||
name. For example, to force compilation with the Unix `cc' compiler,
|
||||
invoke configure like this:
|
||||
|
||||
./configure CC=cc
|
||||
|
||||
This assumes that `cc' is in your path -- if it is not, simply use
|
||||
CC=/path/to/cc instead. Note that environment variables that affect
|
||||
configure can be set with the usual shell syntax `VAR=value ./configure'
|
||||
(assuming sh syntax), but can also be specified as arguments to
|
||||
configure, as shown above. The latter method, while being specific to
|
||||
configure, works unmodified in all shells, and in addition allows
|
||||
configure to detect when that setting has been changed across
|
||||
invocations.
|
||||
|
||||
Environment variables that affect `configure' include: CFLAGS for C
|
||||
compiler flags, CPPFLAGS for C preprocessor flags, LDFLAGS for linker
|
||||
flags, and LIBS for libraries.
|
||||
|
||||
Barring the use of --without-* flags, configure will try to autodetect
|
||||
external libraries needed by Wget, currently only the OpenSSL
|
||||
libraries. If they are installed in the system library directories or
|
||||
in the same prefix where you plan to install Wget, configure should be
|
||||
able to autodetect them. If they are installed elsewhere, use the
|
||||
`--with-libNAME' option to specify the root directory under which
|
||||
libraries reside in the `lib/' subdirectory and the corresponding
|
||||
header files reside in the `include/' subdirectory. For example, if
|
||||
the OpenSSL libraries are installed under the /usr/local/ssl prefix,
|
||||
use `--with-libssl=/usr/local/ssl'.
|
||||
|
||||
Sometimes external libraries will be installed on the system, but the
|
||||
header files will be missing. This often happens on GNU/Linux if you
|
||||
forget to install the "-devel" or "-dev" package that corresponds to
|
||||
the library and that is typically *not* installed by default. In that
|
||||
case configure will not find the library and you will not be able to
|
||||
use the features provided by the library until you install the devel
|
||||
package and rerun configure. If you believe you have the necessary
|
||||
headers, but configure still fails to detect the library, please
|
||||
report it as a bug.
|
||||
|
||||
3. Compilation
|
||||
--------------
|
||||
|
||||
To compile GNU Wget after it has been configured, simply type make.
|
||||
Wget requires a compiler and standard library compliant with the 1990
|
||||
ISO C standard, which includes the vast majority of compilation
|
||||
environments present on systems in use today.
|
||||
|
||||
After the compilation a ready-to-use `wget' executable should reside
|
||||
in the src directory. At this point there is no formal test suite for
|
||||
testing the binary, but it should be easy enough to test whether the
|
||||
basic functionality works.
|
||||
|
||||
4. Installation
|
||||
---------------
|
||||
|
||||
Use `make install' to install GNU Wget to directories specified to
|
||||
configure. To install it in a system directory (which is the
|
||||
default), you will need to be root. The standard prefix is
|
||||
"/usr/local/", which can be changed using the `--prefix' configure
|
||||
option.
|
||||
|
||||
The installation process will copy the wget binary to $PREFIX/bin,
|
||||
install the wget.info* info pages to $PREFIX/info, the generated
|
||||
manual page (where available) wget.1 to $PREFIX/man/man1, and the
|
||||
default config file to $PREFIX/etc, unless a config file already
|
||||
exists there. You can customize these directories either through the
|
||||
configuration process or making the necessary changes in the Makefile.
|
||||
|
||||
To delete the files created by Wget installation, you can use `make
|
||||
uninstall'.
|
||||
27
Makefile.am
27
Makefile.am
@@ -1,6 +1,6 @@
|
||||
# Makefile for `Wget' utility
|
||||
# Copyright (C) 1995, 1996, 1997, 2006, 2007,
|
||||
# 2008, 2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995, 1996, 1997, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -38,14 +38,27 @@ distuninstallcheck_listfiles = find . -type f | \
|
||||
grep -Ev '(/share/info/dir|/etc/wgetrc)$$'
|
||||
|
||||
# Search for macros in the m4 subdirectory:
|
||||
ACLOCAL_AMFLAGS = -I m4 -I md5/m4
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
# subdirectories in the distribution
|
||||
SUBDIRS = lib md5 src doc po tests util windows
|
||||
SUBDIRS = lib src doc po tests util
|
||||
|
||||
EXTRA_DIST = ChangeLog.README configure.bat MAILING-LIST \
|
||||
EXTRA_DIST = ChangeLog.README MAILING-LIST \
|
||||
msdos/ChangeLog msdos/config.h msdos/Makefile.DJ \
|
||||
msdos/Makefile.WC ABOUT-NLS autogen.sh \
|
||||
build-aux/build_info.pl
|
||||
msdos/Makefile.WC ABOUT-NLS \
|
||||
build-aux/build_info.pl build-aux/git-version-gen .version
|
||||
|
||||
CLEANFILES = *~ *.bak $(DISTNAME).tar.gz
|
||||
|
||||
BUILT_SOURCES = .version
|
||||
|
||||
clean-generic:
|
||||
rm -f install-info
|
||||
|
||||
.version:
|
||||
echo $(VERSION) > $@-t && mv $@-t $@
|
||||
|
||||
# Arrange so that .tarball-version appears only in the distribution
|
||||
# tarball, and never in a checked-out repository.
|
||||
dist-hook:
|
||||
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
|
||||
|
||||
140
NEWS
140
NEWS
@@ -1,11 +1,149 @@
|
||||
GNU Wget NEWS -- history of user-visible changes.
|
||||
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
See the end for copying conditions.
|
||||
|
||||
Please send GNU Wget bug reports to <bug-wget@gnu.org>.
|
||||
|
||||
* Changes in Wget 1.15
|
||||
|
||||
** Add support for --method.
|
||||
|
||||
** Add support for file names longer than MAX_FILE.
|
||||
|
||||
** Support FTP listing for the FTP Server on Windows Server 2008 R2.
|
||||
|
||||
** Fix a regression when -c and --content-disposition are used together.
|
||||
|
||||
** Support shorthand URLs in an input file.
|
||||
|
||||
** Fix -c with servers that don't specify a content-length.
|
||||
|
||||
** Add support for MD5-SESS
|
||||
|
||||
** Do not fail on non fatal GNU TLS alerts during handshake.
|
||||
|
||||
** Add support for --https-only. When used wget will follow only
|
||||
HTTPS links in recursive mode.
|
||||
|
||||
** Support Perfect-Forward Secrecy in --secure-protocol.
|
||||
|
||||
** Fix a problem with some IRI links that are not followed when contained in a
|
||||
HTML document.
|
||||
|
||||
** Support some FTP servers that return an empty list with "LIST -a".
|
||||
|
||||
** Specify Host with the HTTP CONNECT method.
|
||||
|
||||
** Use the correct HTTP method on a redirection.
|
||||
|
||||
* Changes in Wget 1.14
|
||||
|
||||
** Add support for content-on-error. It allows to store the HTTP
|
||||
payload on 4xx or 5xx errors.
|
||||
|
||||
** Add support for WARC files.
|
||||
|
||||
** Fix a memory leak problem in the GNU TLS backend.
|
||||
|
||||
** Autoreconf works again for distributed tarballs.
|
||||
|
||||
** Print some diagnostic messages to stderr not to stdout.
|
||||
|
||||
** Report stdout close errors.
|
||||
|
||||
** Accept the --report-speed option.
|
||||
|
||||
** Enable client certificates when GNU TLS is used.
|
||||
|
||||
** Add support for TLS Server Name Indication.
|
||||
|
||||
** Accept the arguments --accept-reject and --reject-regex.
|
||||
|
||||
** The GNU TLS backend honors correctly the timeout value.
|
||||
|
||||
** Add support for RFC 2617 Digest Access Authentication.
|
||||
|
||||
* Changes in Wget 1.13.4
|
||||
|
||||
** Now --version and --help work again.
|
||||
|
||||
** Fix a build error on solaris 10 sparc.
|
||||
|
||||
** Now --timestamping and --continue work well together.
|
||||
|
||||
** Return a network failure when FTP downloads fail and --timestamping
|
||||
is specified.
|
||||
|
||||
** Fix a segfault on an incomplete STYLE tag.
|
||||
|
||||
* Changes in Wget 1.13.3
|
||||
|
||||
** Support HTTP/1.1
|
||||
|
||||
** Now by default the GNU TLS library for secure connections, instead of
|
||||
OpenSSL.
|
||||
|
||||
** Fix some portability issues.
|
||||
|
||||
** Handle properly malformed status line in a HTTP response.
|
||||
|
||||
** Ignore zero length domains in $no_proxy.
|
||||
|
||||
** Set new cookies after an authorization failure.
|
||||
|
||||
** Exit with failure if -k is specified and -O is not a regular file.
|
||||
|
||||
** Cope better with unclosed html tags.
|
||||
|
||||
** Print diagnostic messages to stderr, not stdout.
|
||||
|
||||
** Do not use an additional HEAD request when --content-disposition is used,
|
||||
but use directly GET.
|
||||
|
||||
** Report the average transfer speed correctly when multiple URL's are specified
|
||||
and -c influences the transferred data amount.
|
||||
|
||||
** GNU TLS backend works again.
|
||||
|
||||
** Now --timestamping and --continue works well together.
|
||||
|
||||
** By default, on server redirects, use the original URL to get the
|
||||
local file name. Close CVE-2010-2252. This introduces a
|
||||
backward-incompatibility; any script that relies on the old
|
||||
behaviour must use --trust-server-names.
|
||||
|
||||
** Fix a problem when -k is used and some URLs are specified trough
|
||||
CSS.
|
||||
|
||||
** Convert correctly URLs that need to be encoded to local files when following
|
||||
links.
|
||||
|
||||
** Use persistent connections with proxies supporting them.
|
||||
|
||||
** Print the total download time as part of the summary for recursive downloads.
|
||||
|
||||
** Now it is possible to specify a different startup configuration file trough
|
||||
the --config option.
|
||||
|
||||
** Fix an infinite loop with the error '<filename> has sprung into existence'
|
||||
on a network error and -nc is used.
|
||||
|
||||
** Now --adjust-extension does not modify the file extension if the file ends
|
||||
in .htm.
|
||||
|
||||
** Support HTTP/1.1 307 redirects keep request method.
|
||||
|
||||
** Now --no-parent doesn't fetch undesired files if HTTP and HTTPS are used
|
||||
by the same host on different pages.
|
||||
|
||||
** Do not attempt to remove the file if it is not in the accept rules but
|
||||
it is the output destination file.
|
||||
|
||||
** Introduce `show_all_dns_entries' to print all IP addresses corresponding to
|
||||
a DNS name when it is resolved.
|
||||
|
||||
* Changes in Wget 1.12
|
||||
|
||||
** Mailing list MOVED to bug-wget@gnu.org
|
||||
|
||||
2
README
2
README
@@ -55,8 +55,6 @@ Wget's home page is at <http://www.gnu.org/software/wget/>.
|
||||
If you would like to contribute code for Wget, please read
|
||||
http://wget.addictivecode.org/PatchGuidelines.
|
||||
|
||||
MAINTAINER: Micah Cowan <micah@cowan.name>
|
||||
|
||||
Wget was originally written and mainained by Hrvoje Niksic. Please see
|
||||
the file AUTHORS for a list of major contributors, and the ChangeLogs
|
||||
for a detailed listing of all contributions.
|
||||
|
||||
@@ -66,10 +66,12 @@ Compiling From Repository Sources
|
||||
On GNU systems, the functionality provided by libiconv is already
|
||||
present in the system libraries.
|
||||
|
||||
* [34]git is used to fetch gnulib files trough the bootstrap.sh script.
|
||||
|
||||
For those who might be confused as to what to do once they check out
|
||||
the source code, considering configure and Makefile do not yet exist at
|
||||
that point, a shell script called autogen.sh has been provided. After
|
||||
calling ./autogen.sh you're ready to build GNU Wget in the normal
|
||||
that point, a shell script called bootstrap.sh has been provided. After
|
||||
calling ./bootstrap.sh you're ready to build GNU Wget in the normal
|
||||
fashion, with ./configure and make.
|
||||
|
||||
So, to sum up, after checking out the source code as described above,
|
||||
@@ -78,7 +80,7 @@ Compiling From Repository Sources
|
||||
$ cd wget # assumes you've cloned a repository to "./wget"
|
||||
2. Generate all the automatically-generated files required prior to
|
||||
configuring the package:
|
||||
$ ./autogen.sh
|
||||
$ ./bootstrap.sh
|
||||
3. Configure the package and compile it:
|
||||
$ ./configure [some_parameters]
|
||||
$ make
|
||||
@@ -86,17 +88,13 @@ Compiling From Repository Sources
|
||||
$ src/wget --version
|
||||
GNU Wget 1.12-devel (9cb2563197bc)
|
||||
|
||||
Copyright © 2008 Free Software Foundation, Inc.
|
||||
Copyright © 2008,2010 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later
|
||||
<http://www.gnu.org/licenses/gpl.html>.
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
|
||||
Currently maintained by Micah Cowan <micah@cowan.name>.
|
||||
|
||||
CompilingRepoSources (last edited 2009-09-21 18:36:34 by
|
||||
[34]MicahCowan)
|
||||
|
||||
* [35]Edit
|
||||
* [36]Comments
|
||||
@@ -130,7 +128,7 @@ References
|
||||
31. http://www.gnu.org/software/gnutls/
|
||||
32. http://www.gnu.org/software/libidn/
|
||||
33. http://www.gnu.org/software/libiconv/
|
||||
34. http://wget.addictivecode.org/MicahCowan
|
||||
34. http://git-scm.com/
|
||||
35. http://wget.addictivecode.org/CompilingRepoSources?action=edit&editor=text
|
||||
36. http://wget.addictivecode.org/CompilingRepoSources
|
||||
37. http://wget.addictivecode.org/CompilingRepoSources?action=info
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
exec autoreconf
|
||||
976
bootstrap
Executable file
976
bootstrap
Executable file
@@ -0,0 +1,976 @@
|
||||
#! /bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2012-07-19.14; # UTC
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2012 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Originally written by Paul Eggert. The canonical version of this
|
||||
# script is maintained as build-aux/bootstrap in gnulib, however, to
|
||||
# be useful to your project, you should place a copy of it under
|
||||
# version control in the top-level directory of your project. The
|
||||
# intent is that all customization can be done with a bootstrap.conf
|
||||
# file also maintained in your version control; gnulib comes with a
|
||||
# template build-aux/bootstrap.conf to get you started.
|
||||
|
||||
# Please report bugs or propose patches to bug-gnulib@gnu.org.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# Ensure file names are sorted consistently across platforms.
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
# Ensure that CDPATH is not set. Otherwise, the output from cd
|
||||
# would cause trouble in at least one use below.
|
||||
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
||||
|
||||
local_gl_dir=gl
|
||||
|
||||
me=$0
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $me [OPTION]...
|
||||
Bootstrap this package from the checked-out sources.
|
||||
|
||||
Options:
|
||||
--gnulib-srcdir=DIRNAME specify the local directory where gnulib
|
||||
sources reside. Use this if you already
|
||||
have gnulib sources on your machine, and
|
||||
do not want to waste your bandwidth downloading
|
||||
them again. Defaults to \$GNULIB_SRCDIR
|
||||
--bootstrap-sync if this bootstrap script is not identical to
|
||||
the version in the local gnulib sources,
|
||||
update this script, and then restart it with
|
||||
/bin/sh or the shell \$CONFIG_SHELL
|
||||
--no-bootstrap-sync do not check whether bootstrap is out of sync
|
||||
--copy copy files instead of creating symbolic links
|
||||
--force attempt to bootstrap even if the sources seem
|
||||
not to have been checked out
|
||||
--no-git do not use git to update gnulib. Requires that
|
||||
--gnulib-srcdir point to a correct gnulib snapshot
|
||||
--skip-po do not download po files
|
||||
|
||||
If the file $me.conf exists in the same directory as this script, its
|
||||
contents are read as shell variables to configure the bootstrap.
|
||||
|
||||
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
||||
are honored.
|
||||
|
||||
Running without arguments will suffice in most cases.
|
||||
EOF
|
||||
}
|
||||
|
||||
# warnf_ FORMAT-STRING ARG1...
|
||||
warnf_ ()
|
||||
{
|
||||
warnf_format_=$1
|
||||
shift
|
||||
nl='
|
||||
'
|
||||
case $* in
|
||||
*$nl*) me_=$(printf "$me"|tr "$nl|" '??')
|
||||
printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;;
|
||||
*) printf "$me: $warnf_format_" "$@" ;;
|
||||
esac >&2
|
||||
}
|
||||
|
||||
# warn_ WORD1...
|
||||
warn_ ()
|
||||
{
|
||||
# If IFS does not start with ' ', set it and emit the warning in a subshell.
|
||||
case $IFS in
|
||||
' '*) warnf_ '%s\n' "$*";;
|
||||
*) (IFS=' '; warn_ "$@");;
|
||||
esac
|
||||
}
|
||||
|
||||
# die WORD1...
|
||||
die() { warn_ "$@"; exit 1; }
|
||||
|
||||
# Configuration.
|
||||
|
||||
# Name of the Makefile.am
|
||||
gnulib_mk=gnulib.mk
|
||||
|
||||
# List of gnulib modules needed.
|
||||
gnulib_modules=
|
||||
|
||||
# Any gnulib files needed that are not in modules.
|
||||
gnulib_files=
|
||||
|
||||
: ${AUTOPOINT=autopoint}
|
||||
: ${AUTORECONF=autoreconf}
|
||||
|
||||
# A function to be called right after gnulib-tool is run.
|
||||
# Override it via your own definition in bootstrap.conf.
|
||||
bootstrap_post_import_hook() { :; }
|
||||
|
||||
# A function to be called after everything else in this script.
|
||||
# Override it via your own definition in bootstrap.conf.
|
||||
bootstrap_epilogue() { :; }
|
||||
|
||||
# The command to download all .po files for a specified domain into
|
||||
# a specified directory. Fill in the first %s is the domain name, and
|
||||
# the second with the destination directory. Use rsync's -L and -r
|
||||
# options because the latest/%s directory and the .po files within are
|
||||
# all symlinks.
|
||||
po_download_command_format=\
|
||||
"rsync --delete --exclude '*.s1' -Lrtvz \
|
||||
'translationproject.org::tp/latest/%s/' '%s'"
|
||||
|
||||
# Fallback for downloading .po files (if rsync fails).
|
||||
po_download_command_format2=\
|
||||
"wget --mirror -nd -q -np -A.po -P '%s' \
|
||||
http://translationproject.org/latest/%s/"
|
||||
|
||||
extract_package_name='
|
||||
/^AC_INIT(/{
|
||||
/.*,.*,.*, */{
|
||||
s///
|
||||
s/[][]//g
|
||||
s/)$//
|
||||
p
|
||||
q
|
||||
}
|
||||
s/AC_INIT(\[*//
|
||||
s/]*,.*//
|
||||
s/^GNU //
|
||||
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
s/[^A-Za-z0-9_]/-/g
|
||||
p
|
||||
}
|
||||
'
|
||||
package=$(sed -n "$extract_package_name" configure.ac) \
|
||||
|| die 'cannot find package name in configure.ac'
|
||||
gnulib_name=lib$package
|
||||
|
||||
build_aux=build-aux
|
||||
source_base=lib
|
||||
m4_base=m4
|
||||
doc_base=doc
|
||||
tests_base=tests
|
||||
gnulib_extra_files=''
|
||||
|
||||
# Additional gnulib-tool options to use. Use "\newline" to break lines.
|
||||
gnulib_tool_option_extras=
|
||||
|
||||
# Other locale categories that need message catalogs.
|
||||
EXTRA_LOCALE_CATEGORIES=
|
||||
|
||||
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
||||
XGETTEXT_OPTIONS='\\\
|
||||
--flag=_:1:pass-c-format\\\
|
||||
--flag=N_:1:pass-c-format\\\
|
||||
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\
|
||||
'
|
||||
|
||||
# Package bug report address and copyright holder for gettext files
|
||||
COPYRIGHT_HOLDER='Free Software Foundation, Inc.'
|
||||
MSGID_BUGS_ADDRESS=bug-$package@gnu.org
|
||||
|
||||
# Files we don't want to import.
|
||||
excluded_files=
|
||||
|
||||
# File that should exist in the top directory of a checked out hierarchy,
|
||||
# but not in a distribution tarball.
|
||||
checkout_only_file=README-hacking
|
||||
|
||||
# Whether to use copies instead of symlinks.
|
||||
copy=false
|
||||
|
||||
# Set this to '.cvsignore .gitignore' in bootstrap.conf if you want
|
||||
# those files to be generated in directories like lib/, m4/, and po/.
|
||||
# Or set it to 'auto' to make this script select which to use based
|
||||
# on which version control system (if any) is used in the source directory.
|
||||
vc_ignore=auto
|
||||
|
||||
# Set this to true in bootstrap.conf to enable --bootstrap-sync by
|
||||
# default.
|
||||
bootstrap_sync=false
|
||||
|
||||
# Use git to update gnulib sources
|
||||
use_git=true
|
||||
|
||||
# find_tool ENVVAR NAMES...
|
||||
# -------------------------
|
||||
# Search for a required program. Use the value of ENVVAR, if set,
|
||||
# otherwise find the first of the NAMES that can be run (i.e.,
|
||||
# supports --version). If found, set ENVVAR to the program name,
|
||||
# die otherwise.
|
||||
#
|
||||
# FIXME: code duplication, see also gnu-web-doc-update.
|
||||
find_tool ()
|
||||
{
|
||||
find_tool_envvar=$1
|
||||
shift
|
||||
find_tool_names=$@
|
||||
eval "find_tool_res=\$$find_tool_envvar"
|
||||
if test x"$find_tool_res" = x; then
|
||||
for i
|
||||
do
|
||||
if ($i --version </dev/null) >/dev/null 2>&1; then
|
||||
find_tool_res=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
find_tool_error_prefix="\$$find_tool_envvar: "
|
||||
fi
|
||||
test x"$find_tool_res" != x \
|
||||
|| die "one of these is required: $find_tool_names"
|
||||
($find_tool_res --version </dev/null) >/dev/null 2>&1 \
|
||||
|| die "${find_tool_error_prefix}cannot run $find_tool_res --version"
|
||||
eval "$find_tool_envvar=\$find_tool_res"
|
||||
eval "export $find_tool_envvar"
|
||||
}
|
||||
|
||||
# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
|
||||
find_tool SHA1SUM sha1sum gsha1sum shasum
|
||||
|
||||
# Override the default configuration, if necessary.
|
||||
# Make sure that bootstrap.conf is sourced from the current directory
|
||||
# if we were invoked as "sh bootstrap".
|
||||
case "$0" in
|
||||
*/*) test -r "$0.conf" && . "$0.conf" ;;
|
||||
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
||||
esac
|
||||
|
||||
# Extra files from gnulib, which override files from other sources.
|
||||
test -z "${gnulib_extra_files}" && \
|
||||
gnulib_extra_files="
|
||||
$build_aux/install-sh
|
||||
$build_aux/mdate-sh
|
||||
$build_aux/texinfo.tex
|
||||
$build_aux/depcomp
|
||||
$build_aux/config.guess
|
||||
$build_aux/config.sub
|
||||
doc/INSTALL
|
||||
"
|
||||
|
||||
if test "$vc_ignore" = auto; then
|
||||
vc_ignore=
|
||||
test -d .git && vc_ignore=.gitignore
|
||||
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
||||
fi
|
||||
|
||||
# Translate configuration into internal form.
|
||||
|
||||
# Parse options.
|
||||
|
||||
for option
|
||||
do
|
||||
case $option in
|
||||
--help)
|
||||
usage
|
||||
exit;;
|
||||
--gnulib-srcdir=*)
|
||||
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
|
||||
--skip-po)
|
||||
SKIP_PO=t;;
|
||||
--force)
|
||||
checkout_only_file=;;
|
||||
--copy)
|
||||
copy=true;;
|
||||
--bootstrap-sync)
|
||||
bootstrap_sync=true;;
|
||||
--no-bootstrap-sync)
|
||||
bootstrap_sync=false;;
|
||||
--no-git)
|
||||
use_git=false;;
|
||||
*)
|
||||
die "$option: unknown option";;
|
||||
esac
|
||||
done
|
||||
|
||||
$use_git || test -d "$GNULIB_SRCDIR" \
|
||||
|| die "Error: --no-git requires --gnulib-srcdir"
|
||||
|
||||
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
|
||||
die "Bootstrapping from a non-checked-out distribution is risky."
|
||||
fi
|
||||
|
||||
# Ensure that lines starting with ! sort last, per gitignore conventions
|
||||
# for whitelisting exceptions after a more generic blacklist pattern.
|
||||
sort_patterns() {
|
||||
sort -u "$@" | sed '/^!/ {
|
||||
H
|
||||
d
|
||||
}
|
||||
$ {
|
||||
P
|
||||
x
|
||||
s/^\n//
|
||||
}' | sed '/^$/d'
|
||||
}
|
||||
|
||||
# If $STR is not already on a line by itself in $FILE, insert it,
|
||||
# sorting the new contents of the file and replacing $FILE with the result.
|
||||
insert_sorted_if_absent() {
|
||||
file=$1
|
||||
str=$2
|
||||
test -f $file || touch $file
|
||||
echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|
||||
|| { echo "$str" | sort_patterns - $file > $file.bak \
|
||||
&& mv $file.bak $file; } \
|
||||
|| die "insert_sorted_if_absent $file $str: failed"
|
||||
}
|
||||
|
||||
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
||||
# insert_sorted_if_absent.
|
||||
insert_vc_ignore() {
|
||||
vc_ignore_file="$1"
|
||||
pattern="$2"
|
||||
case $vc_ignore_file in
|
||||
*.gitignore)
|
||||
# A .gitignore entry that does not start with '/' applies
|
||||
# recursively to subdirectories, so prepend '/' to every
|
||||
# .gitignore entry.
|
||||
pattern=$(echo "$pattern" | sed s,^,/,);;
|
||||
esac
|
||||
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
|
||||
}
|
||||
|
||||
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
||||
found_aux_dir=no
|
||||
grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
|
||||
>/dev/null && found_aux_dir=yes
|
||||
grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
|
||||
>/dev/null && found_aux_dir=yes
|
||||
test $found_aux_dir = yes \
|
||||
|| die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it"
|
||||
|
||||
# If $build_aux doesn't exist, create it now, otherwise some bits
|
||||
# below will malfunction. If creating it, also mark it as ignored.
|
||||
if test ! -d $build_aux; then
|
||||
mkdir $build_aux
|
||||
for dot_ig in x $vc_ignore; do
|
||||
test $dot_ig = x && continue
|
||||
insert_vc_ignore $dot_ig $build_aux
|
||||
done
|
||||
fi
|
||||
|
||||
# Note this deviates from the version comparison in automake
|
||||
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
|
||||
# but this should suffice as we won't be specifying old
|
||||
# version formats or redundant trailing .0 in bootstrap.conf.
|
||||
# If we did want full compatibility then we should probably
|
||||
# use m4_version_compare from autoconf.
|
||||
sort_ver() { # sort -V is not generally available
|
||||
ver1="$1"
|
||||
ver2="$2"
|
||||
|
||||
# split on '.' and compare each component
|
||||
i=1
|
||||
while : ; do
|
||||
p1=$(echo "$ver1" | cut -d. -f$i)
|
||||
p2=$(echo "$ver2" | cut -d. -f$i)
|
||||
if [ ! "$p1" ]; then
|
||||
echo "$1 $2"
|
||||
break
|
||||
elif [ ! "$p2" ]; then
|
||||
echo "$2 $1"
|
||||
break
|
||||
elif [ ! "$p1" = "$p2" ]; then
|
||||
if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison
|
||||
echo "$2 $1"
|
||||
elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison
|
||||
echo "$1 $2"
|
||||
else # numeric, then lexicographic comparison
|
||||
lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
|
||||
if [ "$lp" = "$p2" ]; then
|
||||
echo "$1 $2"
|
||||
else
|
||||
echo "$2 $1"
|
||||
fi
|
||||
fi
|
||||
break
|
||||
fi
|
||||
i=$(($i+1))
|
||||
done
|
||||
}
|
||||
|
||||
get_version() {
|
||||
app=$1
|
||||
|
||||
$app --version >/dev/null 2>&1 || return 1
|
||||
|
||||
$app --version 2>&1 |
|
||||
sed -n '# Move version to start of line.
|
||||
s/.*[v ]\([0-9]\)/\1/
|
||||
|
||||
# Skip lines that do not start with version.
|
||||
/^[0-9]/!d
|
||||
|
||||
# Remove characters after the version.
|
||||
s/[^.a-z0-9-].*//
|
||||
|
||||
# The first component must be digits only.
|
||||
s/^\([0-9]*\)[a-z-].*/\1/
|
||||
|
||||
#the following essentially does s/5.005/5.5/
|
||||
s/\.0*\([1-9]\)/.\1/g
|
||||
p
|
||||
q'
|
||||
}
|
||||
|
||||
check_versions() {
|
||||
ret=0
|
||||
|
||||
while read app req_ver; do
|
||||
# We only need libtoolize from the libtool package.
|
||||
if test "$app" = libtool; then
|
||||
app=libtoolize
|
||||
fi
|
||||
# Exempt git if --no-git is in effect.
|
||||
if test "$app" = git; then
|
||||
$use_git || continue
|
||||
fi
|
||||
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
|
||||
appvar=$(echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_')
|
||||
test "$appvar" = TAR && appvar=AMTAR
|
||||
case $appvar in
|
||||
GZIP) ;; # Do not use $GZIP: it contains gzip options.
|
||||
*) eval "app=\${$appvar-$app}" ;;
|
||||
esac
|
||||
|
||||
# Handle the still-experimental Automake-NG programs specially.
|
||||
# They remain named as the mainstream Automake programs ("automake",
|
||||
# and "aclocal") to avoid gratuitous incompatibilities with
|
||||
# pre-existing usages (by, say, autoreconf, or custom autogen.sh
|
||||
# scripts), but correctly identify themselves (as being part of
|
||||
# "GNU automake-ng") when asked their version.
|
||||
case $app in
|
||||
automake-ng|aclocal-ng)
|
||||
app=${app%-ng}
|
||||
($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || {
|
||||
warn_ "Error: '$app' not found or not from Automake-NG"
|
||||
ret=1
|
||||
continue
|
||||
} ;;
|
||||
esac
|
||||
if [ "$req_ver" = "-" ]; then
|
||||
# Merely require app to exist; not all prereq apps are well-behaved
|
||||
# so we have to rely on $? rather than get_version.
|
||||
$app --version >/dev/null 2>&1
|
||||
if [ 126 -le $? ]; then
|
||||
warn_ "Error: '$app' not found"
|
||||
ret=1
|
||||
fi
|
||||
else
|
||||
# Require app to produce a new enough version string.
|
||||
inst_ver=$(get_version $app)
|
||||
if [ ! "$inst_ver" ]; then
|
||||
warn_ "Error: '$app' not found"
|
||||
ret=1
|
||||
else
|
||||
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
|
||||
if [ ! "$latest_ver" = "$inst_ver" ]; then
|
||||
warnf_ '%s\n' \
|
||||
"Error: '$app' version == $inst_ver is too old" \
|
||||
" '$app' version >= $req_ver is required"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
print_versions() {
|
||||
echo "Program Min_version"
|
||||
echo "----------------------"
|
||||
printf %s "$buildreq"
|
||||
echo "----------------------"
|
||||
# can't depend on column -t
|
||||
}
|
||||
|
||||
use_libtool=0
|
||||
# We'd like to use grep -E, to see if any of LT_INIT,
|
||||
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
||||
# but that's not portable enough (e.g., for Solaris).
|
||||
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
|
||||
&& use_libtool=1
|
||||
grep '^[ ]*LT_INIT' configure.ac >/dev/null \
|
||||
&& use_libtool=1
|
||||
if test $use_libtool = 1; then
|
||||
find_tool LIBTOOLIZE glibtoolize libtoolize
|
||||
fi
|
||||
|
||||
# gnulib-tool requires at least automake and autoconf.
|
||||
# If either is not listed, add it (with minimum version) as a prerequisite.
|
||||
case $buildreq in
|
||||
*automake*) ;;
|
||||
*) buildreq="automake 1.9
|
||||
$buildreq" ;;
|
||||
esac
|
||||
case $buildreq in
|
||||
*autoconf*) ;;
|
||||
*) buildreq="autoconf 2.59
|
||||
$buildreq" ;;
|
||||
esac
|
||||
|
||||
# When we can deduce that gnulib-tool will require patch,
|
||||
# and when patch is not already listed as a prerequisite, add it, too.
|
||||
if test -d "$local_gl_dir" \
|
||||
&& ! find "$local_gl_dir" -name '*.diff' -exec false {} +; then
|
||||
case $buildreq in
|
||||
*patch*) ;;
|
||||
*) buildreq="patch -
|
||||
$buildreq" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if ! printf "$buildreq" | check_versions; then
|
||||
echo >&2
|
||||
if test -f README-prereq; then
|
||||
die "See README-prereq for how to get the prerequisite programs"
|
||||
else
|
||||
die "Please install the prerequisite programs"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$0: Bootstrapping from checked-out $package sources..."
|
||||
|
||||
# See if we can use gnulib's git-merge-changelog merge driver.
|
||||
if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
|
||||
if git config merge.merge-changelog.driver >/dev/null ; then
|
||||
:
|
||||
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
|
||||
echo "$0: initializing git-merge-changelog driver"
|
||||
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
||||
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
||||
else
|
||||
echo "$0: consider installing git-merge-changelog from gnulib"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
cleanup_gnulib() {
|
||||
status=$?
|
||||
rm -fr "$gnulib_path"
|
||||
exit $status
|
||||
}
|
||||
|
||||
git_modules_config () {
|
||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||
}
|
||||
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
|
||||
# Get gnulib files.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init || exit $?
|
||||
git submodule update || exit $?
|
||||
|
||||
elif [ ! -d "$gnulib_path" ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
shallow=
|
||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
||||
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
|
||||
cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
;;
|
||||
*)
|
||||
# Use GNULIB_SRCDIR as a reference.
|
||||
if test -d "$GNULIB_SRCDIR"/.git && \
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
if git submodule -h|grep -- --reference > /dev/null; then
|
||||
# Prefer the one-liner available in git 1.6.4 or newer.
|
||||
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
||||
"$gnulib_path" || exit $?
|
||||
else
|
||||
# This fallback allows at least git 1.5.5.
|
||||
if test -f "$gnulib_path"/gnulib-tool; then
|
||||
# Since file already exists, assume submodule init already complete.
|
||||
git submodule update || exit $?
|
||||
else
|
||||
# Older git can't clone into an empty directory.
|
||||
rmdir "$gnulib_path" 2>/dev/null
|
||||
git clone --reference "$GNULIB_SRCDIR" \
|
||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||
&& git submodule init && git submodule update \
|
||||
|| exit $?
|
||||
fi
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if $bootstrap_sync; then
|
||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||
echo "$0: updating bootstrap and restarting..."
|
||||
exec sh -c \
|
||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||
-- "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||
"$0" "$@" --no-bootstrap-sync
|
||||
}
|
||||
fi
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit $?
|
||||
|
||||
# Get translations.
|
||||
|
||||
download_po_files() {
|
||||
subdir=$1
|
||||
domain=$2
|
||||
echo "$me: getting translations into $subdir for $domain..."
|
||||
cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
|
||||
eval "$cmd" && return
|
||||
# Fallback to HTTP.
|
||||
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
|
||||
eval "$cmd"
|
||||
}
|
||||
|
||||
# Mirror .po files to $po_dir/.reference and copy only the new
|
||||
# or modified ones into $po_dir. Also update $po_dir/LINGUAS.
|
||||
# Note po files that exist locally only are left in $po_dir but will
|
||||
# not be included in LINGUAS and hence will not be distributed.
|
||||
update_po_files() {
|
||||
# Directory containing primary .po files.
|
||||
# Overwrite them only when we're sure a .po file is new.
|
||||
po_dir=$1
|
||||
domain=$2
|
||||
|
||||
# Mirror *.po files into this dir.
|
||||
# Usually contains *.s1 checksum files.
|
||||
ref_po_dir="$po_dir/.reference"
|
||||
|
||||
test -d $ref_po_dir || mkdir $ref_po_dir || return
|
||||
download_po_files $ref_po_dir $domain \
|
||||
&& ls "$ref_po_dir"/*.po 2>/dev/null |
|
||||
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
|
||||
|
||||
langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
|
||||
test "$langs" = '*' && langs=x
|
||||
for po in $langs; do
|
||||
case $po in x) continue;; esac
|
||||
new_po="$ref_po_dir/$po.po"
|
||||
cksum_file="$ref_po_dir/$po.s1"
|
||||
if ! test -f "$cksum_file" ||
|
||||
! test -f "$po_dir/$po.po" ||
|
||||
! $SHA1SUM -c --status "$cksum_file" \
|
||||
< "$new_po" > /dev/null; then
|
||||
echo "$me: updated $po_dir/$po.po..."
|
||||
cp "$new_po" "$po_dir/$po.po" \
|
||||
&& $SHA1SUM < "$new_po" > "$cksum_file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
case $SKIP_PO in
|
||||
'')
|
||||
if test -d po; then
|
||||
update_po_files po $package || exit
|
||||
fi
|
||||
|
||||
if test -d runtime-po; then
|
||||
update_po_files runtime-po $package-runtime || exit
|
||||
fi;;
|
||||
esac
|
||||
|
||||
symlink_to_dir()
|
||||
{
|
||||
src=$1/$2
|
||||
dst=${3-$2}
|
||||
|
||||
test -f "$src" && {
|
||||
|
||||
# If the destination directory doesn't exist, create it.
|
||||
# This is required at least for "lib/uniwidth/cjk.h".
|
||||
dst_dir=$(dirname "$dst")
|
||||
if ! test -d "$dst_dir"; then
|
||||
mkdir -p "$dst_dir"
|
||||
|
||||
# If we've just created a directory like lib/uniwidth,
|
||||
# tell version control system(s) it's ignorable.
|
||||
# FIXME: for now, this does only one level
|
||||
parent=$(dirname "$dst_dir")
|
||||
for dot_ig in x $vc_ignore; do
|
||||
test $dot_ig = x && continue
|
||||
ig=$parent/$dot_ig
|
||||
insert_vc_ignore $ig "${dst_dir##*/}"
|
||||
done
|
||||
fi
|
||||
|
||||
if $copy; then
|
||||
{
|
||||
test ! -h "$dst" || {
|
||||
echo "$me: rm -f $dst" &&
|
||||
rm -f "$dst"
|
||||
}
|
||||
} &&
|
||||
test -f "$dst" &&
|
||||
cmp -s "$src" "$dst" || {
|
||||
echo "$me: cp -fp $src $dst" &&
|
||||
cp -fp "$src" "$dst"
|
||||
}
|
||||
else
|
||||
# Leave any existing symlink alone, if it already points to the source,
|
||||
# so that broken build tools that care about symlink times
|
||||
# aren't confused into doing unnecessary builds. Conversely, if the
|
||||
# existing symlink's time stamp is older than the source, make it afresh,
|
||||
# so that broken tools aren't confused into skipping needed builds. See
|
||||
# <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>.
|
||||
test -h "$dst" &&
|
||||
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
|
||||
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
|
||||
test "$src_i" = "$dst_i" &&
|
||||
both_ls=$(ls -dt "$src" "$dst") &&
|
||||
test "X$both_ls" = "X$dst$nl$src" || {
|
||||
dot_dots=
|
||||
case $src in
|
||||
/*) ;;
|
||||
*)
|
||||
case /$dst/ in
|
||||
*//* | */../* | */./* | /*/*/*/*/*/)
|
||||
die "invalid symlink calculation: $src -> $dst";;
|
||||
/*/*/*/*/) dot_dots=../../../;;
|
||||
/*/*/*/) dot_dots=../../;;
|
||||
/*/*/) dot_dots=../;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
echo "$me: ln -fs $dot_dots$src $dst" &&
|
||||
ln -fs "$dot_dots$src" "$dst"
|
||||
}
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
version_controlled_file() {
|
||||
parent=$1
|
||||
file=$2
|
||||
if test -d .git; then
|
||||
git rm -n "$file" > /dev/null 2>&1
|
||||
elif test -d .svn; then
|
||||
svn log -r HEAD "$file" > /dev/null 2>&1
|
||||
elif test -d CVS; then
|
||||
grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
|
||||
grep '^/[^/]*/[0-9]' > /dev/null
|
||||
else
|
||||
warn_ "no version control for $file?"
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
# NOTE: we have to be careful to run both autopoint and libtoolize
|
||||
# before gnulib-tool, since gnulib-tool is likely to provide newer
|
||||
# versions of files "installed" by these two programs.
|
||||
# Then, *after* gnulib-tool (see below), we have to be careful to
|
||||
# run autoreconf in such a way that it does not run either of these
|
||||
# two just-pre-run programs.
|
||||
|
||||
# Import from gettext.
|
||||
with_gettext=yes
|
||||
grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
|
||||
with_gettext=no
|
||||
|
||||
if test $with_gettext = yes || test $use_libtool = 1; then
|
||||
|
||||
tempbase=.bootstrap$$
|
||||
trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15
|
||||
|
||||
> $tempbase.0 > $tempbase.1 &&
|
||||
find . ! -type d -print | sort > $tempbase.0 || exit
|
||||
|
||||
if test $with_gettext = yes; then
|
||||
# Released autopoint has the tendency to install macros that have been
|
||||
# obsoleted in current gnulib, so run this before gnulib-tool.
|
||||
echo "$0: $AUTOPOINT --force"
|
||||
$AUTOPOINT --force || exit
|
||||
fi
|
||||
|
||||
# Autoreconf runs aclocal before libtoolize, which causes spurious
|
||||
# warnings if the initial aclocal is confused by the libtoolized
|
||||
# (or worse out-of-date) macro directory.
|
||||
# libtoolize 1.9b added the --install option; but we support back
|
||||
# to libtoolize 1.5.22, where the install action was default.
|
||||
if test $use_libtool = 1; then
|
||||
install=
|
||||
case $($LIBTOOLIZE --help) in
|
||||
*--install*) install=--install ;;
|
||||
esac
|
||||
echo "running: $LIBTOOLIZE $install --copy"
|
||||
$LIBTOOLIZE $install --copy
|
||||
fi
|
||||
|
||||
find . ! -type d -print | sort >$tempbase.1
|
||||
old_IFS=$IFS
|
||||
IFS=$nl
|
||||
for file in $(comm -13 $tempbase.0 $tempbase.1); do
|
||||
IFS=$old_IFS
|
||||
parent=${file%/*}
|
||||
version_controlled_file "$parent" "$file" || {
|
||||
for dot_ig in x $vc_ignore; do
|
||||
test $dot_ig = x && continue
|
||||
ig=$parent/$dot_ig
|
||||
insert_vc_ignore "$ig" "${file##*/}"
|
||||
done
|
||||
}
|
||||
done
|
||||
IFS=$old_IFS
|
||||
|
||||
rm -f $tempbase.0 $tempbase.1
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
|
||||
# Import from gnulib.
|
||||
|
||||
gnulib_tool_options="\
|
||||
--import\
|
||||
--no-changelog\
|
||||
--aux-dir $build_aux\
|
||||
--doc-base $doc_base\
|
||||
--lib $gnulib_name\
|
||||
--m4-base $m4_base/\
|
||||
--source-base $source_base/\
|
||||
--tests-base $tests_base\
|
||||
--local-dir $local_gl_dir\
|
||||
$gnulib_tool_option_extras\
|
||||
"
|
||||
if test $use_libtool = 1; then
|
||||
case "$gnulib_tool_options " in
|
||||
*' --libtool '*) ;;
|
||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||
esac
|
||||
fi
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
|
||||
|
||||
for file in $gnulib_files; do
|
||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||
|| die "failed to symlink $file"
|
||||
done
|
||||
|
||||
bootstrap_post_import_hook \
|
||||
|| die "bootstrap_post_import_hook failed"
|
||||
|
||||
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
||||
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
|
||||
# The following requires GNU find 4.2.3 or newer. Considering the usual
|
||||
# portability constraints of this script, that may seem a very demanding
|
||||
# requirement, but it should be ok. Ignore any failure, which is fine,
|
||||
# since this is only a convenience to help developers avoid the relatively
|
||||
# unusual case in which a symlinked-to .m4 file is git-removed from gnulib
|
||||
# between successive runs of this script.
|
||||
find "$m4_base" "$source_base" \
|
||||
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
|
||||
-type l -xtype l -delete > /dev/null 2>&1
|
||||
|
||||
# Some systems (RHEL 5) are using ancient autotools, for which the
|
||||
# --no-recursive option had not been invented. Detect that lack and
|
||||
# omit the option when it's not supported. FIXME in 2017: remove this
|
||||
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
|
||||
no_recursive=
|
||||
case $($AUTORECONF --help) in
|
||||
*--no-recursive*) no_recursive=--no-recursive;;
|
||||
esac
|
||||
|
||||
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
|
||||
echo "running: AUTOPOINT=true LIBTOOLIZE=true " \
|
||||
"$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS"
|
||||
AUTOPOINT=true LIBTOOLIZE=true \
|
||||
$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \
|
||||
|| die "autoreconf failed"
|
||||
|
||||
# Get some extra files from gnulib, overriding existing files.
|
||||
for file in $gnulib_extra_files; do
|
||||
case $file in
|
||||
*/INSTALL) dst=INSTALL;;
|
||||
build-aux/*) dst=$build_aux/${file#build-aux/};;
|
||||
*) dst=$file;;
|
||||
esac
|
||||
symlink_to_dir "$GNULIB_SRCDIR" $file $dst \
|
||||
|| die "failed to symlink $file"
|
||||
done
|
||||
|
||||
if test $with_gettext = yes; then
|
||||
# Create gettext configuration.
|
||||
echo "$0: Creating po/Makevars from po/Makevars.template ..."
|
||||
rm -f po/Makevars
|
||||
sed '
|
||||
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
|
||||
/^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
|
||||
/^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
|
||||
/^XGETTEXT_OPTIONS *=/{
|
||||
s/$/ \\/
|
||||
a\
|
||||
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
|
||||
}
|
||||
' po/Makevars.template >po/Makevars \
|
||||
|| die 'cannot generate po/Makevars'
|
||||
|
||||
# If the 'gettext' module is in use, grab the latest Makefile.in.in.
|
||||
# If only the 'gettext-h' module is in use, assume autopoint already
|
||||
# put the correct version of this file into place.
|
||||
case $gnulib_modules in
|
||||
*gettext-h*) ;;
|
||||
*gettext*)
|
||||
cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \
|
||||
|| die "cannot create po/Makefile.in.in"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -d runtime-po; then
|
||||
# Similarly for runtime-po/Makevars, but not quite the same.
|
||||
rm -f runtime-po/Makevars
|
||||
sed '
|
||||
/^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
|
||||
/^subdir *=.*/s/=.*/= runtime-po/
|
||||
/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
|
||||
/^XGETTEXT_OPTIONS *=/{
|
||||
s/$/ \\/
|
||||
a\
|
||||
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
|
||||
}
|
||||
' po/Makevars.template >runtime-po/Makevars \
|
||||
|| die 'cannot generate runtime-po/Makevars'
|
||||
|
||||
# Copy identical files from po to runtime-po.
|
||||
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
|
||||
fi
|
||||
fi
|
||||
|
||||
bootstrap_epilogue
|
||||
|
||||
echo "$0: done. Now you can run './configure'."
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
105
bootstrap.conf
Normal file
105
bootstrap.conf
Normal file
@@ -0,0 +1,105 @@
|
||||
# bootstrap.conf - Bootstrap configuration.
|
||||
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation,
|
||||
# Inc.
|
||||
#
|
||||
# This file is part of GNU Wget.
|
||||
#
|
||||
# GNU Wget 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 3 of the License, or (at
|
||||
# your option) any later version.
|
||||
#
|
||||
# GNU Wgt 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, see `http://www.gnu.org/licenses/'.
|
||||
|
||||
# gnulib library name
|
||||
gnulib_name=libgnu
|
||||
gnulib_tool_option_extras=
|
||||
use_libtool=0
|
||||
checkout_only_file=
|
||||
|
||||
# gnulib modules used by this package.
|
||||
gnulib_modules="
|
||||
accept
|
||||
alloca
|
||||
announce-gen
|
||||
base32
|
||||
bind
|
||||
c-ctype
|
||||
clock-time
|
||||
close
|
||||
connect
|
||||
fcntl
|
||||
futimens
|
||||
ftello
|
||||
getaddrinfo
|
||||
getopt-gnu
|
||||
getpass-gnu
|
||||
getpeername
|
||||
getsockname
|
||||
git-version-gen
|
||||
gnupload
|
||||
ioctl
|
||||
iconv
|
||||
iconv-h
|
||||
listen
|
||||
maintainer-makefile
|
||||
mbtowc
|
||||
mkdir
|
||||
mkstemp
|
||||
mkostemp
|
||||
crypto/md5
|
||||
crypto/sha1
|
||||
pipe
|
||||
quote
|
||||
quotearg
|
||||
recv
|
||||
regex
|
||||
select
|
||||
send
|
||||
setsockopt
|
||||
sigprocmask
|
||||
sigpipe
|
||||
snprintf
|
||||
socket
|
||||
stdbool
|
||||
strcasestr
|
||||
strerror_r-posix
|
||||
strtok_r
|
||||
tmpdir
|
||||
unlocked-io
|
||||
update-copyright
|
||||
vasprintf
|
||||
vsnprintf
|
||||
write
|
||||
"
|
||||
|
||||
gnulib_extra_files="
|
||||
$build_aux/install-sh
|
||||
$build_aux/mdate-sh
|
||||
$build_aux/texinfo.tex
|
||||
$build_aux/depcomp
|
||||
$build_aux/config.guess
|
||||
$build_aux/config.sub
|
||||
$build_aux/config.rpath
|
||||
doc/INSTALL
|
||||
"
|
||||
|
||||
# Build prerequisites
|
||||
buildreq="\
|
||||
autoconf 2.62
|
||||
automake 1.11.1
|
||||
autopoint -
|
||||
gettext 0.17
|
||||
git 1.4.4
|
||||
makeinfo -
|
||||
perl 5.5
|
||||
rsync -
|
||||
tar -
|
||||
xz -
|
||||
"
|
||||
@@ -1,497 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
# Generate a release announcement message.
|
||||
|
||||
my $VERSION = '2009-09-01 06:47'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
# Copyright (C) 2002-2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Jim Meyering
|
||||
|
||||
use strict;
|
||||
|
||||
use Getopt::Long;
|
||||
use Digest::MD5;
|
||||
use Digest::SHA1;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
(my $ME = $0) =~ s|.*/||;
|
||||
|
||||
my %valid_release_types = map {$_ => 1} qw (alpha beta major);
|
||||
my @archive_suffixes = ('tar.gz', 'tar.bz2', 'tar.lzma', 'tar.xz');
|
||||
|
||||
sub usage ($)
|
||||
{
|
||||
my ($exit_code) = @_;
|
||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||
if ($exit_code != 0)
|
||||
{
|
||||
print $STREAM "Try `$ME --help' for more information.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
my @types = sort keys %valid_release_types;
|
||||
print $STREAM <<EOF;
|
||||
Usage: $ME [OPTIONS]
|
||||
Generate an announcement message.
|
||||
|
||||
OPTIONS:
|
||||
|
||||
These options must be specified:
|
||||
|
||||
--release-type=TYPE TYPE must be one of @types
|
||||
--package-name=PACKAGE_NAME
|
||||
--previous-version=VER
|
||||
--current-version=VER
|
||||
--gpg-key-id=ID The GnuPG ID of the key used to sign the tarballs
|
||||
--url-directory=URL_DIR
|
||||
|
||||
The following are optional:
|
||||
|
||||
--news=NEWS_FILE
|
||||
--bootstrap-tools=TOOL_LIST a comma-separated list of tools, e.g.,
|
||||
autoconf,automake,bison,gnulib
|
||||
--gnulib-version=VERSION report VERSION as the gnulib version, where
|
||||
VERSION is the result of running git describe
|
||||
in the gnulib source directory.
|
||||
required if gnulib is in TOOL_LIST.
|
||||
--no-print-checksums do not emit MD5 or SHA1 checksums
|
||||
--archive-suffix=SUF add SUF to the list of archive suffixes
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
EOF
|
||||
}
|
||||
exit $exit_code;
|
||||
}
|
||||
|
||||
|
||||
=item C<%size> = C<sizes (@file)>
|
||||
|
||||
Compute the sizes of the C<@file> and return them as a hash. Return
|
||||
C<undef> if one of the computation failed.
|
||||
|
||||
=cut
|
||||
|
||||
sub sizes (@)
|
||||
{
|
||||
my (@file) = @_;
|
||||
|
||||
my $fail = 0;
|
||||
my %res;
|
||||
foreach my $f (@file)
|
||||
{
|
||||
my $cmd = "du --human $f";
|
||||
my $t = `$cmd`;
|
||||
# FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
|
||||
$@
|
||||
and (warn "$ME: command failed: `$cmd'\n"), $fail = 1;
|
||||
chomp $t;
|
||||
$t =~ s/^([\d.]+[MkK]).*/${1}B/;
|
||||
$res{$f} = $t;
|
||||
}
|
||||
return $fail ? undef : %res;
|
||||
}
|
||||
|
||||
=item C<print_locations ($title, \@url, \%size, @file)
|
||||
|
||||
Print a section C<$title> dedicated to the list of <@file>, which
|
||||
sizes are stored in C<%size>, and which are available from the C<@url>.
|
||||
|
||||
=cut
|
||||
|
||||
sub print_locations ($\@\%@)
|
||||
{
|
||||
my ($title, $url, $size, @file) = @_;
|
||||
print "Here are the $title:\n";
|
||||
foreach my $url (@{$url})
|
||||
{
|
||||
for my $file (@file)
|
||||
{
|
||||
print " $url/$file";
|
||||
print " (", $$size{$file}, ")"
|
||||
if exists $$size{$file};
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
||||
=item C<print_checksums (@file)
|
||||
|
||||
Print the MD5 and SHA1 signature section for each C<@file>.
|
||||
|
||||
=cut
|
||||
|
||||
sub print_checksums (@)
|
||||
{
|
||||
my (@file) = @_;
|
||||
|
||||
print "Here are the MD5 and SHA1 checksums:\n";
|
||||
print "\n";
|
||||
|
||||
foreach my $meth (qw (md5 sha1))
|
||||
{
|
||||
foreach my $f (@file)
|
||||
{
|
||||
open IN, '<', $f
|
||||
or die "$ME: $f: cannot open for reading: $!\n";
|
||||
binmode IN;
|
||||
my $dig =
|
||||
($meth eq 'md5'
|
||||
? Digest::MD5->new->addfile(*IN)->hexdigest
|
||||
: Digest::SHA1->new->addfile(*IN)->hexdigest);
|
||||
close IN;
|
||||
print "$dig $f\n";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
||||
=item C<print_news_deltas ($news_file, $prev_version, $curr_version)
|
||||
|
||||
Print the section of the NEWS file C<$news_file> addressing changes
|
||||
between versions C<$prev_version> and C<$curr_version>.
|
||||
|
||||
=cut
|
||||
|
||||
sub print_news_deltas ($$$)
|
||||
{
|
||||
my ($news_file, $prev_version, $curr_version) = @_;
|
||||
|
||||
print "\n$news_file\n\n";
|
||||
|
||||
# Print all lines from $news_file, starting with the first one
|
||||
# that mentions $curr_version up to but not including
|
||||
# the first occurrence of $prev_version.
|
||||
my $in_items;
|
||||
|
||||
my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/;
|
||||
|
||||
open NEWS, '<', $news_file
|
||||
or die "$ME: $news_file: cannot open for reading: $!\n";
|
||||
while (defined (my $line = <NEWS>))
|
||||
{
|
||||
if ( ! $in_items)
|
||||
{
|
||||
# Match lines like these:
|
||||
# * Major changes in release 5.0.1:
|
||||
# * Noteworthy changes in release 6.6 (2006-11-22) [stable]
|
||||
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o
|
||||
or next;
|
||||
$in_items = 1;
|
||||
print $line;
|
||||
}
|
||||
else
|
||||
{
|
||||
# This regexp must not match version numbers in NEWS items.
|
||||
# For example, they might well say `introduced in 4.5.5',
|
||||
# and we don't want that to match.
|
||||
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o
|
||||
and last;
|
||||
print $line;
|
||||
}
|
||||
}
|
||||
close NEWS;
|
||||
|
||||
$in_items
|
||||
or die "$ME: $news_file: no matching lines for `$curr_version'\n";
|
||||
}
|
||||
|
||||
sub print_changelog_deltas ($$)
|
||||
{
|
||||
my ($package_name, $prev_version) = @_;
|
||||
|
||||
# Print new ChangeLog entries.
|
||||
|
||||
# First find all CVS-controlled ChangeLog files.
|
||||
use File::Find;
|
||||
my @changelog;
|
||||
find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS'
|
||||
and push @changelog, $File::Find::name}},
|
||||
'.');
|
||||
|
||||
# If there are no ChangeLog files, we're done.
|
||||
@changelog
|
||||
or return;
|
||||
my %changelog = map {$_ => 1} @changelog;
|
||||
|
||||
# Reorder the list of files so that if there are ChangeLog
|
||||
# files in the specified directories, they're listed first,
|
||||
# in this order:
|
||||
my @dir = qw ( . src lib m4 config doc );
|
||||
|
||||
# A typical @changelog array might look like this:
|
||||
# ./ChangeLog
|
||||
# ./po/ChangeLog
|
||||
# ./m4/ChangeLog
|
||||
# ./lib/ChangeLog
|
||||
# ./doc/ChangeLog
|
||||
# ./config/ChangeLog
|
||||
my @reordered;
|
||||
foreach my $d (@dir)
|
||||
{
|
||||
my $dot_slash = $d eq '.' ? $d : "./$d";
|
||||
my $target = "$dot_slash/ChangeLog";
|
||||
delete $changelog{$target}
|
||||
and push @reordered, $target;
|
||||
}
|
||||
|
||||
# Append any remaining ChangeLog files.
|
||||
push @reordered, sort keys %changelog;
|
||||
|
||||
# Remove leading `./'.
|
||||
@reordered = map { s!^\./!!; $_ } @reordered;
|
||||
|
||||
print "\nChangeLog entries:\n\n";
|
||||
# print join ("\n", @reordered), "\n";
|
||||
|
||||
$prev_version =~ s/\./_/g;
|
||||
my $prev_cvs_tag = "\U$package_name\E-$prev_version";
|
||||
|
||||
my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered";
|
||||
open DIFF, '-|', $cmd
|
||||
or die "$ME: cannot run `$cmd': $!\n";
|
||||
# Print two types of lines, making minor changes:
|
||||
# Lines starting with `+++ ', e.g.,
|
||||
# +++ ChangeLog 22 Feb 2003 16:52:51 -0000 1.247
|
||||
# and those starting with `+'.
|
||||
# Don't print the others.
|
||||
my $prev_printed_line_empty = 1;
|
||||
while (defined (my $line = <DIFF>))
|
||||
{
|
||||
if ($line =~ /^\+\+\+ /)
|
||||
{
|
||||
my $separator = "*"x70 ."\n";
|
||||
$line =~ s///;
|
||||
$line =~ s/\s.*//;
|
||||
$prev_printed_line_empty
|
||||
or print "\n";
|
||||
print $separator, $line, $separator;
|
||||
}
|
||||
elsif ($line =~ /^\+/)
|
||||
{
|
||||
$line =~ s///;
|
||||
print $line;
|
||||
$prev_printed_line_empty = ($line =~ /^$/);
|
||||
}
|
||||
}
|
||||
close DIFF;
|
||||
|
||||
# The exit code should be 1.
|
||||
# Allow in case there are no modified ChangeLog entries.
|
||||
$? == 256 || $? == 128
|
||||
or warn "$ME: warning: `cmd' had unexpected exit code or signal ($?)\n";
|
||||
}
|
||||
|
||||
sub get_tool_versions ($$)
|
||||
{
|
||||
my ($tool_list, $gnulib_version) = @_;
|
||||
@$tool_list
|
||||
or return ();
|
||||
|
||||
my $fail;
|
||||
my @tool_version_pair;
|
||||
foreach my $t (@$tool_list)
|
||||
{
|
||||
if ($t eq 'gnulib')
|
||||
{
|
||||
push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version;
|
||||
next;
|
||||
}
|
||||
# Assume that the last "word" on the first line of
|
||||
# `tool --version` output is the version string.
|
||||
my ($first_line, undef) = split ("\n", `$t --version`);
|
||||
if ($first_line =~ /.* (\d[\w.-]+)$/)
|
||||
{
|
||||
$t = ucfirst $t;
|
||||
push @tool_version_pair, "$t $1";
|
||||
}
|
||||
else
|
||||
{
|
||||
defined $first_line
|
||||
and $first_line = '';
|
||||
warn "$ME: $t: unexpected --version output\n:$first_line";
|
||||
$fail = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$fail
|
||||
and exit 1;
|
||||
|
||||
return @tool_version_pair;
|
||||
}
|
||||
|
||||
{
|
||||
# Neutralize the locale, so that, for instance, "du" does not
|
||||
# issue "1,2" instead of "1.2", what confuses our regexps.
|
||||
$ENV{LC_ALL} = "C";
|
||||
|
||||
my $release_type;
|
||||
my $package_name;
|
||||
my $prev_version;
|
||||
my $curr_version;
|
||||
my $gpg_key_id;
|
||||
my @url_dir_list;
|
||||
my @news_file;
|
||||
my $bootstrap_tools;
|
||||
my $gnulib_version;
|
||||
my $print_checksums_p = 1;
|
||||
|
||||
GetOptions
|
||||
(
|
||||
'release-type=s' => \$release_type,
|
||||
'package-name=s' => \$package_name,
|
||||
'previous-version=s' => \$prev_version,
|
||||
'current-version=s' => \$curr_version,
|
||||
'gpg-key-id=s' => \$gpg_key_id,
|
||||
'url-directory=s' => \@url_dir_list,
|
||||
'news=s' => \@news_file,
|
||||
'bootstrap-tools=s' => \$bootstrap_tools,
|
||||
'gnulib-version=s' => \$gnulib_version,
|
||||
'print-checksums!' => \$print_checksums_p,
|
||||
'archive-suffix=s' => \@archive_suffixes,
|
||||
|
||||
help => sub { usage 0 },
|
||||
version => sub { print "$ME version $VERSION\n"; exit },
|
||||
) or usage 1;
|
||||
|
||||
my $fail = 0;
|
||||
# Ensure that sure each required option is specified.
|
||||
$release_type
|
||||
or (warn "$ME: release type not specified\n"), $fail = 1;
|
||||
$package_name
|
||||
or (warn "$ME: package name not specified\n"), $fail = 1;
|
||||
$prev_version
|
||||
or (warn "$ME: previous version string not specified\n"), $fail = 1;
|
||||
$curr_version
|
||||
or (warn "$ME: current version string not specified\n"), $fail = 1;
|
||||
$gpg_key_id
|
||||
or (warn "$ME: GnuPG key ID not specified\n"), $fail = 1;
|
||||
@url_dir_list
|
||||
or (warn "$ME: URL directory name(s) not specified\n"), $fail = 1;
|
||||
|
||||
my @tool_list = split ',', $bootstrap_tools;
|
||||
|
||||
grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version
|
||||
and (warn "$ME: when specifying gnulib as a tool, you must also specify\n"
|
||||
. "--gnulib-version=V, where V is the result of running git describe\n"
|
||||
. "in the gnulib source directory.\n"), $fail = 1;
|
||||
|
||||
exists $valid_release_types{$release_type}
|
||||
or (warn "$ME: `$release_type': invalid release type\n"), $fail = 1;
|
||||
|
||||
@ARGV
|
||||
and (warn "$ME: too many arguments:\n", join ("\n", @ARGV), "\n"),
|
||||
$fail = 1;
|
||||
$fail
|
||||
and usage 1;
|
||||
|
||||
my $my_distdir = "$package_name-$curr_version";
|
||||
|
||||
my $xd = "$package_name-$prev_version-$curr_version.xdelta";
|
||||
|
||||
my @candidates = map { "$my_distdir.$_" } @archive_suffixes;
|
||||
my @tarballs = grep {-f $_} @candidates;
|
||||
|
||||
@tarballs
|
||||
or die "$ME: none of " . join(', ', @candidates) . " were found\n";
|
||||
my @sizable = @tarballs;
|
||||
-f $xd
|
||||
and push @sizable, $xd;
|
||||
my %size = sizes (@sizable);
|
||||
%size
|
||||
or exit 1;
|
||||
|
||||
# The markup is escaped as <\# so that when this script is sent by
|
||||
# mail (or part of a diff), Gnus is not triggered.
|
||||
print <<EOF;
|
||||
|
||||
Subject: $my_distdir released
|
||||
|
||||
<\#secure method=pgpmime mode=sign>
|
||||
|
||||
FIXME: put comments here
|
||||
|
||||
EOF
|
||||
|
||||
print_locations ("compressed sources", @url_dir_list, %size, @tarballs);
|
||||
-f $xd
|
||||
and print_locations ("xdelta diffs (useful? if so, "
|
||||
. "please tell bug-gnulib\@gnu.org)",
|
||||
@url_dir_list, %size, $xd);
|
||||
my @sig_files = map { "$_.sig" } @tarballs;
|
||||
print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
|
||||
@sig_files);
|
||||
|
||||
$print_checksums_p
|
||||
and print_checksums (@sizable);
|
||||
|
||||
print <<EOF;
|
||||
[*] You can use either of the above signature files to verify that
|
||||
the corresponding file (without the .sig suffix) is intact. First,
|
||||
be sure to download both the .sig file and the corresponding tarball.
|
||||
Then, run a command like this:
|
||||
|
||||
gpg --verify $tarballs[0].sig
|
||||
|
||||
If that command fails because you don't have the required public key,
|
||||
then run this command to import it:
|
||||
|
||||
gpg --keyserver keys.gnupg.net --recv-keys $gpg_key_id
|
||||
|
||||
and rerun the \`gpg --verify' command.
|
||||
EOF
|
||||
|
||||
my @tool_versions = get_tool_versions (\@tool_list, $gnulib_version);
|
||||
@tool_versions
|
||||
and print "\nThis release was bootstrapped with the following tools:",
|
||||
join ('', map {"\n $_"} @tool_versions), "\n";
|
||||
|
||||
print_news_deltas ($_, $prev_version, $curr_version)
|
||||
foreach @news_file;
|
||||
|
||||
$release_type eq 'major'
|
||||
or print_changelog_deltas ($package_name, $prev_version);
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
### Setup "GNU" style for perl-mode and cperl-mode.
|
||||
## Local Variables:
|
||||
## perl-indent-level: 2
|
||||
## perl-continued-statement-offset: 2
|
||||
## perl-continued-brace-offset: 0
|
||||
## perl-brace-offset: 0
|
||||
## perl-brace-imaginary-offset: 0
|
||||
## perl-label-offset: -2
|
||||
## cperl-indent-level: 2
|
||||
## cperl-brace-offset: 0
|
||||
## cperl-continued-brace-offset: 0
|
||||
## cperl-label-offset: -2
|
||||
## cperl-extra-newline-before-brace: t
|
||||
## cperl-merge-trailing-else: nil
|
||||
## cperl-continued-statement-offset: 2
|
||||
## eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
## time-stamp-start: "my $VERSION = '"
|
||||
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||
## time-stamp-time-zone: "UTC"
|
||||
## time-stamp-end: "'; # UTC"
|
||||
## End:
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/perl
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Generate build_info.c.
|
||||
|
||||
# Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009, 2010, 2011 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,8 +20,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use FindBin qw($Bin);
|
||||
use File::Spec ();
|
||||
use Carp qw(croak);
|
||||
|
||||
my $file = shift @ARGV;
|
||||
|
||||
@@ -32,59 +31,92 @@ my $file = shift @ARGV;
|
||||
|
||||
sub parse_config
|
||||
{
|
||||
my (%block, @defines, %feature);
|
||||
my $features = [];
|
||||
my $choice_key;
|
||||
my $choice = [];
|
||||
my $list = $features;
|
||||
|
||||
open(my $fh, '<', "$file.in") or die "Cannot open $file.in: $!";
|
||||
|
||||
while (<$fh>) {
|
||||
next if /^\s*$/;
|
||||
|
||||
if ($list eq $choice) {
|
||||
unless (s/^\s+//) {
|
||||
$list = $features;
|
||||
push @$features, [$choice_key, $choice];
|
||||
$choice = [];
|
||||
undef $choice_key;
|
||||
}
|
||||
} elsif (/^([A-Za-z0-9_-]+) \s+ choice:\s*$/x) {
|
||||
$choice_key = $1;
|
||||
$list = $choice;
|
||||
next;
|
||||
}
|
||||
|
||||
if (/^([A-Za-z0-9_-]+) \s+ (.*)$/x) {
|
||||
push @$list, [$1, $2];
|
||||
} else {
|
||||
croak "Can't parse line: $_";
|
||||
}
|
||||
}
|
||||
|
||||
if ($list eq $choice) {
|
||||
push @$features, [$choice_key, $choice];
|
||||
}
|
||||
|
||||
open(my $fh, '<', $file) or die "Cannot open $file: $!";
|
||||
my $cfg = do { local $/; <$fh> };
|
||||
close($fh);
|
||||
|
||||
while ($cfg =~ /^\ *? (\w+) (?:\s+?)? (\w+?)? \s*$/gmx) {
|
||||
$feature{$1} = $2 || '_MISSING';
|
||||
push @defines, $1;
|
||||
}
|
||||
while ($cfg =~ /^(\ *? \#\w+? \s+? (\w+) .+ \#\w+)/gmsx) {
|
||||
$block{$2} = $1;
|
||||
}
|
||||
|
||||
my %data = (
|
||||
block => \%block,
|
||||
defines => \@defines,
|
||||
feature => \%feature,
|
||||
);
|
||||
|
||||
return \%data;
|
||||
return $features;
|
||||
}
|
||||
|
||||
sub output_code
|
||||
{
|
||||
my ($block, $defines, $feature) =
|
||||
map $_[0]->{$_}, qw(block defines feature);
|
||||
my $features = shift;
|
||||
|
||||
print do { local $/; <DATA> }, "\n";
|
||||
print <<EOC;
|
||||
const char* (compiled_features[]) =
|
||||
open(my $fh, '>', "$file") or die "Cannot open $file: $!";
|
||||
|
||||
print $fh do { local $/; <DATA> }, "\n";
|
||||
print $fh <<EOC;
|
||||
const char *compiled_features[] =
|
||||
{
|
||||
|
||||
EOC
|
||||
my @output;
|
||||
foreach my $define (@$defines) {
|
||||
if (!exists $block->{$define}) {
|
||||
push @output, <<EOC;
|
||||
#ifdef $define
|
||||
"+$feature->{$define}",
|
||||
#else
|
||||
"-$feature->{$define}",
|
||||
#endif
|
||||
foreach my $feature (sort { $a->[0] cmp $b->[0] } @$features) {
|
||||
my ($name, $check) = @$feature;
|
||||
|
||||
if (ref $check eq 'ARRAY') {
|
||||
my ($ch_name, $ch_check) = @{ shift @$check };
|
||||
print $fh <<EOC;
|
||||
#if $ch_check
|
||||
"+$name/$ch_name",
|
||||
EOC
|
||||
}
|
||||
else {
|
||||
push @output, <<EOC;
|
||||
$block->{$define}
|
||||
foreach my $choice (@$check) {
|
||||
($ch_name, $ch_check) = @$choice;
|
||||
|
||||
print $fh <<EOC;
|
||||
#elif $ch_check
|
||||
"+$name/$ch_name",
|
||||
EOC
|
||||
}
|
||||
print $fh <<EOC;
|
||||
#else
|
||||
"-$name",
|
||||
#endif
|
||||
|
||||
EOC
|
||||
} else {
|
||||
print $fh <<EOC;
|
||||
#if $check
|
||||
"+$name",
|
||||
#else
|
||||
"-$name",
|
||||
#endif
|
||||
|
||||
EOC
|
||||
}
|
||||
}
|
||||
print join "\n", @output;
|
||||
print <<EOC;
|
||||
print $fh <<EOC;
|
||||
|
||||
/* sentinel value */
|
||||
NULL
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
scriptversion=2005-05-14.22
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand `-c -o'.
|
||||
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file `INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
eat=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we strip `-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
1526
build-aux/config.guess
vendored
1526
build-aux/config.guess
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,667 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||
# should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
# Known limitations:
|
||||
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
|
||||
# than 256 bytes, otherwise the compiler driver will dump core. The only
|
||||
# known workaround is to choose shorter directory names for the build
|
||||
# directory and/or the installation directory.
|
||||
|
||||
# All known linkers require a `.a' archive for static linking (except MSVC,
|
||||
# which needs '.lib').
|
||||
libext=a
|
||||
shrext=.so
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
# Code taken from libtool.m4's _LT_CC_BASENAME.
|
||||
|
||||
for cc_temp in $CC""; do
|
||||
case $cc_temp in
|
||||
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
|
||||
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
|
||||
\-*) ;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
|
||||
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
wl='-Wl,'
|
||||
else
|
||||
case "$host_os" in
|
||||
aix*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
darwin*)
|
||||
case $cc_basename in
|
||||
xlc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
mingw* | cygwin* | pw32* | os2*)
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
newsos6)
|
||||
;;
|
||||
linux* | k*bsd*-gnu)
|
||||
case $cc_basename in
|
||||
icc* | ecc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
pgcc | pgf77 | pgf90)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
ccc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
como)
|
||||
wl='-lopt='
|
||||
;;
|
||||
*)
|
||||
case `$CC -V 2>&1 | sed 5q` in
|
||||
*Sun\ C*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
rdos*)
|
||||
;;
|
||||
solaris*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sunos4*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
;;
|
||||
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
unicos*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
uts4*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$GCC" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
interix*)
|
||||
# we just hope/assume this is gcc and not c89 (= MSVC++)
|
||||
with_gnu_ld=yes
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
# Set some defaults for GNU ld with shared library support. These
|
||||
# are reset later if shared libraries are not supported. Putting them
|
||||
# here allows them to be overridden if necessary.
|
||||
# Unlike libtool, we use -rpath here, not --rpath, since the documented
|
||||
# option of GNU ld is called -rpath, not --rpath.
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
case "$host_os" in
|
||||
aix3* | aix4* | aix5*)
|
||||
# On AIX/PPC, the GNU linker is very broken
|
||||
if test "$host_cpu" != ia64; then
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
|
||||
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||
# to version 4, is to share data among multiple programs linked
|
||||
# with the same dynamic library. Since this doesn't match the
|
||||
# behavior of shared libraries on other platforms, we cannot use
|
||||
# them.
|
||||
ld_shlibs=no
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
interix[3-9]*)
|
||||
hardcode_direct=no
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
gnu* | linux* | k*bsd*-gnu)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
netbsd*)
|
||||
;;
|
||||
solaris*)
|
||||
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
|
||||
case `$LD -v 2>&1` in
|
||||
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$ld_shlibs" = no; then
|
||||
hardcode_libdir_flag_spec=
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$GCC" = yes; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
else
|
||||
aix_use_runtimelinking=no
|
||||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
if test "$GCC" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
:
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Begin _LT_AC_SYS_LIBPATH_AIX.
|
||||
echo 'int main () { return 0; }' > conftest.c
|
||||
${CC} ${LDFLAGS} conftest.c -o conftest
|
||||
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
fi
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath="/usr/lib:/lib"
|
||||
fi
|
||||
rm -f conftest.c conftest
|
||||
# End _LT_AC_SYS_LIBPATH_AIX.
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
else
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# see comment about different semantics on the GNU ld section
|
||||
ld_shlibs=no
|
||||
;;
|
||||
bsdi[45]*)
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
libext=lib
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
hardcode_direct=no
|
||||
if test "$GCC" = yes ; then
|
||||
:
|
||||
else
|
||||
case $cc_basename in
|
||||
xlc*)
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
dgux*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
freebsd1*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
freebsd2.2*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
freebsd* | dragonfly*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
hpux9*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
hpux10*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
fi
|
||||
;;
|
||||
hpux11*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
case $host_cpu in
|
||||
hppa*64*|ia64*)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
*)
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
netbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
newsos6)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
openbsd*)
|
||||
if test -f /usr/libexec/ld.so; then
|
||||
hardcode_direct=yes
|
||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
else
|
||||
case "$host_os" in
|
||||
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
osf3*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
osf4* | osf5*)
|
||||
if test "$GCC" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
# Both cc and cxx compiler support -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
solaris*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
sysv4)
|
||||
case $host_vendor in
|
||||
sni)
|
||||
hardcode_direct=yes # is this really true???
|
||||
;;
|
||||
siemens)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
motorola)
|
||||
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sysv4.3*)
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6*)
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
|
||||
hardcode_libdir_separator=':'
|
||||
;;
|
||||
uts4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
|
||||
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
|
||||
# only about the one the linker finds when passed -lNAME. This is the last
|
||||
# element of library_names_spec in libtool.m4, or possibly two of them if the
|
||||
# linker has special search rules.
|
||||
library_names_spec= # the last element of library_names_spec in libtool.m4
|
||||
libname_spec='lib$name'
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
amigaos*)
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
beos*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
bsdi[45]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.dll.a $libname.lib'
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shrext=.dylib
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
dgux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
freebsd1*)
|
||||
;;
|
||||
freebsd* | dragonfly*)
|
||||
case "$host_os" in
|
||||
freebsd[123]*)
|
||||
library_names_spec='$libname$shrext$versuffix' ;;
|
||||
*)
|
||||
library_names_spec='$libname$shrext' ;;
|
||||
esac
|
||||
;;
|
||||
gnu*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
case $host_cpu in
|
||||
ia64*)
|
||||
shrext=.so
|
||||
;;
|
||||
hppa*64*)
|
||||
shrext=.sl
|
||||
;;
|
||||
*)
|
||||
shrext=.sl
|
||||
;;
|
||||
esac
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
interix[3-9]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
case "$host_os" in
|
||||
irix5* | nonstopux*)
|
||||
libsuff= shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
|
||||
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
|
||||
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
|
||||
*) libsuff= shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
linux*oldld* | linux*aout* | linux*coff*)
|
||||
;;
|
||||
linux* | k*bsd*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
knetbsd*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
netbsd*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
newsos6)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
nto-qnx*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
openbsd*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
os2*)
|
||||
libname_spec='$name'
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
rdos*)
|
||||
;;
|
||||
solaris*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sunos4*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
sysv4 | sysv4.3*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
uts4*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
esac
|
||||
|
||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
|
||||
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
|
||||
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl="$escaped_wl"
|
||||
|
||||
# Static library suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Shared library suffix (normally "so").
|
||||
shlibext="$shlibext"
|
||||
|
||||
# Format of library name prefix.
|
||||
libname_spec="$escaped_libname_spec"
|
||||
|
||||
# Library names that the linker finds when passed -lNAME.
|
||||
library_names_spec="$escaped_library_names_spec"
|
||||
|
||||
# Flag to hardcode \$libdir into a binary during linking.
|
||||
# This must work even if \$libdir does not exist.
|
||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||
|
||||
# Whether we need a single -rpath flag with a separated argument.
|
||||
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||
|
||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_direct="$hardcode_direct"
|
||||
|
||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_minus_L="$hardcode_minus_L"
|
||||
|
||||
EOF
|
||||
1658
build-aux/config.sub
vendored
1658
build-aux/config.sub
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,584 +0,0 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2006-10-15.18
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2009 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> $depfile
|
||||
echo >> $depfile
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> $depfile
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test -f "$tmpdepfile"; then :
|
||||
else
|
||||
stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
||||
tmpdepfile="$stripped.u"
|
||||
fi
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
outname="$stripped.o"
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
"$@" || exit $?
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -1,412 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Sign files and upload them.
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Originally written by Alexandre Duret-Lutz <adl@gnu.org>.
|
||||
|
||||
set -e
|
||||
|
||||
GPG='gpg --batch --no-tty'
|
||||
conffile=.gnuploadrc
|
||||
to=
|
||||
dry_run=false
|
||||
symlink_files=
|
||||
delete_files=
|
||||
delete_symlinks=
|
||||
collect_var=
|
||||
dbg=
|
||||
|
||||
usage="Usage: $0 [OPTIONS]... [COMMAND] FILES... [[COMMAND] FILES...]
|
||||
|
||||
Sign all FILES, and upload them to selected destinations, according to
|
||||
<http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>.
|
||||
|
||||
Commands:
|
||||
--delete delete FILES from destination
|
||||
--symlink create symbolic links
|
||||
--rmsymlink remove symbolic links
|
||||
-- treat the remaining arguments as files to upload
|
||||
|
||||
Options:
|
||||
--help print this help text and exit
|
||||
--to DEST specify one destination for FILES
|
||||
(multiple --to options are allowed)
|
||||
--user NAME sign with key NAME
|
||||
--symlink-regex[=EXPR] use sed script EXPR to compute symbolic link names
|
||||
--dry-run do nothing, show what would have been done
|
||||
--version output version information and exit
|
||||
|
||||
If --symlink-regex is given without EXPR, then the link target name
|
||||
is created by replacing the version information with \`-latest', e.g.:
|
||||
|
||||
foo-1.3.4.tar.gz -> foo-latest.tar.gz
|
||||
|
||||
Recognized destinations are:
|
||||
alpha.gnu.org:DIRECTORY
|
||||
savannah.gnu.org:DIRECTORY
|
||||
savannah.nongnu.org:DIRECTORY
|
||||
ftp.gnu.org:DIRECTORY
|
||||
build directive files and upload files by FTP
|
||||
download.gnu.org.ua:{alpha|ftp}/DIRECTORY
|
||||
build directive files and upload files by SFTP
|
||||
[user@]host:DIRECTORY upload files with scp
|
||||
|
||||
Options and commands are applied in order. If the file $conffile exists
|
||||
in the current working directory, its contents are prepended to the
|
||||
actual command line options. Use this to keep your defaults. Comments
|
||||
(#) and empty lines in $conffile are allowed.
|
||||
|
||||
Examples:
|
||||
1. Upload automake-1.8.2b.tar.gz and automake-1.8.2b.tar.bz2 to two sites:
|
||||
gnupload --to sources.redhat.com:~ftp/pub/automake \\
|
||||
--to alpha.gnu.org:automake \\
|
||||
automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
|
||||
|
||||
2. Same as above, but also create symbolic links to automake-latest.tar.*:
|
||||
gnupload --to sources.redhat.com:~ftp/pub/automake \\
|
||||
--to alpha.gnu.org:automake \\
|
||||
--symlink-regex \\
|
||||
automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
|
||||
|
||||
3. Symlink automake-1.8.2b.tar.gz to automake-latest.tar.gz and
|
||||
automake-1.8.2b.tar.bz2 to automake-latest.tar.bz2 on both sites:
|
||||
|
||||
gnupload --to sources.redhat.com:~ftp/pub/automake \\
|
||||
--to alpha.gnu.org:automake \\
|
||||
--symlink automake-1.8.2b.tar.gz automake-latest.tar.gz \\
|
||||
automake-1.8.2b.tar.bz2 automake-latest.tar.bz2
|
||||
|
||||
4. Delete automake-1.8.2a.tar.gz and .bz2, remove symlink
|
||||
automake-latest.tar.gz and upload automake-1.8.2b.tar.gz:
|
||||
|
||||
gnupload --to sources.redhat.com:~ftp/pub/automake \\
|
||||
--to alpha.gnu.org:automake \\
|
||||
--delete automake-1.8.2a.tar.gz automake-1.8.2a.tar.bz2 \\
|
||||
--rmsymlink automake-latest.tar.gz \\
|
||||
-- \\
|
||||
automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
Send patches to <automake-patches@gnu.org>."
|
||||
|
||||
# Read local configuration file
|
||||
if test -r "$conffile"; then
|
||||
echo "$0: Reading configuration file $conffile"
|
||||
eval set x "`sed 's/#.*$//;/^$/d' \"$conffile\" | tr '\012\015' ' '` \"\$@\""
|
||||
shift
|
||||
fi
|
||||
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
-*)
|
||||
collect_var=
|
||||
case $1 in
|
||||
--help)
|
||||
echo "$usage"
|
||||
exit $?
|
||||
;;
|
||||
--to)
|
||||
if test -z "$2"; then
|
||||
echo "$0: Missing argument for --to" 1>&2
|
||||
exit 1
|
||||
else
|
||||
to="$to $2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--user)
|
||||
if test -z "$2"; then
|
||||
echo "$0: Missing argument for --user" 1>&2
|
||||
exit 1
|
||||
else
|
||||
GPG="$GPG --local-user $2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--delete)
|
||||
collect_var=delete_files
|
||||
;;
|
||||
--rmsymlink)
|
||||
collect_var=delete_symlinks
|
||||
;;
|
||||
--symlink-regex=*)
|
||||
symlink_expr=`expr "$1" : '[^=]*=\(.*\)'`
|
||||
;;
|
||||
--symlink-regex)
|
||||
symlink_expr='s|-[0-9][0-9\.]*\(-[0-9][0-9]*\)\{0,1\}\.|-latest.|'
|
||||
;;
|
||||
--symlink)
|
||||
collect_var=symlink_files
|
||||
;;
|
||||
--dry-run|-n)
|
||||
dry_run=:
|
||||
;;
|
||||
--version)
|
||||
echo "gnupload $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
echo "$0: Unknown option \`$1', try \`$0 --help'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
if test -z "$collect_var"; then
|
||||
break
|
||||
else
|
||||
eval "$collect_var=\"\$$collect_var $1\""
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
dprint()
|
||||
{
|
||||
echo "Running $*..."
|
||||
}
|
||||
|
||||
if $dry_run; then
|
||||
dbg=dprint
|
||||
fi
|
||||
|
||||
if test -z "$to"; then
|
||||
echo "$0: Missing destination sites" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -n "$symlink_files"; then
|
||||
x=`echo "$symlink_files" | sed 's/[^ ]//g;s/ //g'`
|
||||
if test -n "$x"; then
|
||||
echo "$0: Odd number of symlink arguments" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# = 0; then
|
||||
if test -z "${symlink_files}${delete_files}${delete_symlinks}"; then
|
||||
echo "$0: No file to upload" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Make sure all files exist. We don't want to ask
|
||||
# for the passphrase if the script will fail.
|
||||
for file
|
||||
do
|
||||
if test ! -f $file; then
|
||||
echo "$0: Cannot find \`$file'" 1>&2
|
||||
exit 1
|
||||
elif test -n "$symlink_expr"; then
|
||||
linkname=`echo $file | sed "$symlink_expr"`
|
||||
if test -z "$linkname"; then
|
||||
echo "$0: symlink expression produces empty results" >&2
|
||||
exit 1
|
||||
elif test "$linkname" = $file; then
|
||||
echo "$0: symlink expression does not alter file name" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Make sure passphrase is not exported in the environment.
|
||||
unset passphrase
|
||||
|
||||
# Reset PATH to be sure that echo is a built-in. We will later use
|
||||
# `echo $passphrase' to output the passphrase, so it is important that
|
||||
# it is a built-in (third-party programs tend to appear in `ps'
|
||||
# listings with their arguments...).
|
||||
# Remember this script runs with `set -e', so if echo is not built-in
|
||||
# it will exit now.
|
||||
PATH=/empty echo -n "Enter GPG passphrase: "
|
||||
stty -echo
|
||||
read -r passphrase
|
||||
stty echo
|
||||
echo
|
||||
|
||||
if test $# -ne 0; then
|
||||
for file
|
||||
do
|
||||
echo "Signing $file..."
|
||||
rm -f $file.sig
|
||||
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 -ba -o $file.sig $file
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# mkdirective DESTDIR BASE FILE STMT
|
||||
# Arguments: See upload, below
|
||||
mkdirective ()
|
||||
{
|
||||
stmt="$4"
|
||||
if test -n "$3"; then
|
||||
stmt="
|
||||
filename: $3$stmt"
|
||||
fi
|
||||
|
||||
cat >${2}.directive<<EOF
|
||||
version: 1.1
|
||||
directory: $1
|
||||
comment: gnupload v. $scriptversion$stmt
|
||||
EOF
|
||||
if $dry_run; then
|
||||
echo "File ${2}.directive:"
|
||||
cat ${2}.directive
|
||||
echo "File ${2}.directive:" | sed 's/./-/g'
|
||||
fi
|
||||
}
|
||||
|
||||
mksymlink ()
|
||||
{
|
||||
while test $# -ne 0
|
||||
do
|
||||
echo "symlink: $1 $2"
|
||||
shift
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
# upload DEST DESTDIR BASE FILE STMT FILES
|
||||
# Arguments:
|
||||
# DEST Destination site;
|
||||
# DESTDIR Destination directory;
|
||||
# BASE Base name for the directive file;
|
||||
# FILE Name of the file to distribute (may be empty);
|
||||
# STMT Additional statements for the directive file;
|
||||
# FILES List of files to upload.
|
||||
upload ()
|
||||
{
|
||||
dest=$1
|
||||
destdir=$2
|
||||
base=$3
|
||||
file=$4
|
||||
stmt=$5
|
||||
files=$6
|
||||
|
||||
rm -f $base.directive $base.directive.asc
|
||||
case $dest in
|
||||
alpha.gnu.org:*)
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
||||
$dbg ncftpput ftp-upload.gnu.org /incoming/alpha $files $base.directive.asc
|
||||
;;
|
||||
ftp.gnu.org:*)
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
||||
$dbg ncftpput ftp-upload.gnu.org /incoming/ftp $files $base.directive.asc
|
||||
;;
|
||||
savannah.gnu.org:*)
|
||||
if test -z "$files"; then
|
||||
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
||||
fi
|
||||
$dbg ncftpput savannah.gnu.org /incoming/savannah/$destdir $files
|
||||
;;
|
||||
savannah.nongnu.org:*)
|
||||
if test -z "$files"; then
|
||||
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
||||
fi
|
||||
$dbg ncftpput savannah.nongnu.org /incoming/savannah/$destdir $files
|
||||
;;
|
||||
download.gnu.org.ua:alpha/*|download.gnu.org.ua:ftp/*)
|
||||
destdir_p1=`echo "$destdir" | sed 's,^[^/]*/,,'`
|
||||
destdir_topdir=`echo "$destdir" | sed 's,/.*,,'`
|
||||
mkdirective "$destdir_p1" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
||||
for f in $files $base.directive.asc
|
||||
do
|
||||
echo put $f
|
||||
done | $dbg sftp -b - puszcza.gnu.org.ua:/incoming/$destdir_topdir
|
||||
;;
|
||||
/*)
|
||||
dest_host=`echo "$dest" | sed 's,:.*,,'`
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
||||
$dbg cp $files $base.directive.asc $dest_host
|
||||
;;
|
||||
*)
|
||||
if test -z "$files"; then
|
||||
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
||||
fi
|
||||
$dbg scp $files $dest
|
||||
;;
|
||||
esac
|
||||
rm -f $base.directive $base.directive.asc
|
||||
}
|
||||
|
||||
#####
|
||||
# Process any standalone directives
|
||||
stmt=
|
||||
if test -n "$symlink_files"; then
|
||||
stmt="$stmt
|
||||
`mksymlink $symlink_files`"
|
||||
fi
|
||||
|
||||
for file in $delete_files
|
||||
do
|
||||
stmt="$stmt
|
||||
archive: $file"
|
||||
done
|
||||
|
||||
for file in $delete_symlinks
|
||||
do
|
||||
stmt="$stmt
|
||||
rmsymlink: $file"
|
||||
done
|
||||
|
||||
if test -n "$stmt"; then
|
||||
for dest in $to
|
||||
do
|
||||
destdir=`echo $dest | sed 's/[^:]*://'`
|
||||
upload "$dest" "$destdir" "`hostname`-$$" "" "$stmt"
|
||||
done
|
||||
fi
|
||||
|
||||
# Process actual uploads
|
||||
for dest in $to
|
||||
do
|
||||
for file
|
||||
do
|
||||
echo "Uploading $file to $dest..."
|
||||
stmt=
|
||||
files="$file $file.sig"
|
||||
destdir=`echo $dest | sed 's/[^:]*://'`
|
||||
if test -n "$symlink_expr"; then
|
||||
linkname=`echo $file | sed "$symlink_expr"`
|
||||
stmt="$stmt
|
||||
symlink: $file $linkname
|
||||
symlink: $file.sig $linkname.sig"
|
||||
fi
|
||||
upload "$dest" "$destdir" "$file" "$file" "$stmt" "$files"
|
||||
done
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
@@ -1,519 +0,0 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2006-12-25.00
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -1,201 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Get modification time of a file or directory and pretty-print it.
|
||||
|
||||
scriptversion=2005-06-29.22
|
||||
|
||||
# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2009 Free Software
|
||||
# Foundation, Inc.
|
||||
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
|
||||
#
|
||||
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No file. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: mdate-sh [--help] [--version] FILE
|
||||
|
||||
Pretty-print the modification time of FILE.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "mdate-sh $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Prevent date giving response in another language.
|
||||
LANG=C
|
||||
export LANG
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
|
||||
# GNU ls changes its time format in response to the TIME_STYLE
|
||||
# variable. Since we cannot assume `unset' works, revert this
|
||||
# variable to its documented default.
|
||||
if test "${TIME_STYLE+set}" = set; then
|
||||
TIME_STYLE=posix-long-iso
|
||||
export TIME_STYLE
|
||||
fi
|
||||
|
||||
save_arg1=$1
|
||||
|
||||
# Find out how to get the extended ls output of a file or directory.
|
||||
if ls -L /dev/null 1>/dev/null 2>&1; then
|
||||
ls_command='ls -L -l -d'
|
||||
else
|
||||
ls_command='ls -l -d'
|
||||
fi
|
||||
|
||||
# A `ls -l' line looks as follows on OS/2.
|
||||
# drwxrwx--- 0 Aug 11 2001 foo
|
||||
# This differs from Unix, which adds ownership information.
|
||||
# drwxrwx--- 2 root root 4096 Aug 11 2001 foo
|
||||
#
|
||||
# To find the date, we split the line on spaces and iterate on words
|
||||
# until we find a month. This cannot work with files whose owner is a
|
||||
# user named `Jan', or `Feb', etc. However, it's unlikely that `/'
|
||||
# will be owned by a user whose name is a month. So we first look at
|
||||
# the extended ls output of the root directory to decide how many
|
||||
# words should be skipped to get the date.
|
||||
|
||||
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
|
||||
set x`ls -l -d /`
|
||||
|
||||
# Find which argument is the month.
|
||||
month=
|
||||
command=
|
||||
until test $month
|
||||
do
|
||||
shift
|
||||
# Add another shift to the command.
|
||||
command="$command shift;"
|
||||
case $1 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Get the extended ls output of the file or directory.
|
||||
set dummy x`eval "$ls_command \"\$save_arg1\""`
|
||||
|
||||
# Remove all preceding arguments
|
||||
eval $command
|
||||
|
||||
# Because of the dummy argument above, month is in $2.
|
||||
#
|
||||
# On a POSIX system, we should have
|
||||
#
|
||||
# $# = 5
|
||||
# $1 = file size
|
||||
# $2 = month
|
||||
# $3 = day
|
||||
# $4 = year or time
|
||||
# $5 = filename
|
||||
#
|
||||
# On Darwin 7.7.0 and 7.6.0, we have
|
||||
#
|
||||
# $# = 4
|
||||
# $1 = day
|
||||
# $2 = month
|
||||
# $3 = year or time
|
||||
# $4 = filename
|
||||
|
||||
# Get the month.
|
||||
case $2 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
|
||||
case $3 in
|
||||
???*) day=$1;;
|
||||
*) day=$3; shift;;
|
||||
esac
|
||||
|
||||
# Here we have to deal with the problem that the ls output gives either
|
||||
# the time of day or the year.
|
||||
case $3 in
|
||||
*:*) set `date`; eval year=\$$#
|
||||
case $2 in
|
||||
Jan) nummonthtod=1;;
|
||||
Feb) nummonthtod=2;;
|
||||
Mar) nummonthtod=3;;
|
||||
Apr) nummonthtod=4;;
|
||||
May) nummonthtod=5;;
|
||||
Jun) nummonthtod=6;;
|
||||
Jul) nummonthtod=7;;
|
||||
Aug) nummonthtod=8;;
|
||||
Sep) nummonthtod=9;;
|
||||
Oct) nummonthtod=10;;
|
||||
Nov) nummonthtod=11;;
|
||||
Dec) nummonthtod=12;;
|
||||
esac
|
||||
# For the first six month of the year the time notation can also
|
||||
# be used for files modified in the last year.
|
||||
if (expr $nummonth \> $nummonthtod) > /dev/null;
|
||||
then
|
||||
year=`expr $year - 1`
|
||||
fi;;
|
||||
*) year=$3;;
|
||||
esac
|
||||
|
||||
# The result.
|
||||
echo $day $month $year
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -1,367 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
|
||||
scriptversion=2006-05-10.23
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
|
||||
# 2009 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
|
||||
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case $1 in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
autom4te touch the output file, or create a stub one
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program).
|
||||
case $1 in
|
||||
lex|yacc)
|
||||
# Not GNU programs, they don't have --version.
|
||||
;;
|
||||
|
||||
tar)
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case $1 in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case $f in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f y.tab.h; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if test ! -f y.tab.c; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f lex.yy.c; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
# The file to touch is that specified with -o ...
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -z "$file"; then
|
||||
# ... or it is the one specified with @setfilename ...
|
||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '
|
||||
/^@setfilename/{
|
||||
s/.* \([^ ]*\) *$/\1/
|
||||
p
|
||||
q
|
||||
}' $infile`
|
||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
||||
fi
|
||||
# If the file does not exist, the user really needs makeinfo;
|
||||
# let's fail without touching anything.
|
||||
test -f $file || exit 1
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case $firstarg in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case $firstarg in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -1,111 +0,0 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
errstatus=0
|
||||
dirmode=""
|
||||
|
||||
usage="\
|
||||
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
|
||||
|
||||
# process command line arguments
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
-h | --help | --h*) # -h for help
|
||||
echo "$usage" 1>&2
|
||||
exit 0
|
||||
;;
|
||||
-m) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
|
||||
dirmode=$1
|
||||
shift
|
||||
;;
|
||||
--) # stop option processing
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*) # unknown option
|
||||
echo "$usage" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*) # first non-opt arg
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
for file
|
||||
do
|
||||
if test -d "$file"; then
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) exit 0 ;;
|
||||
esac
|
||||
|
||||
case $dirmode in
|
||||
'')
|
||||
if mkdir -p -- . 2>/dev/null; then
|
||||
echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
|
||||
echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case $pathcomp in
|
||||
-*) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
else
|
||||
if test ! -z "$dirmode"; then
|
||||
echo "chmod $dirmode $pathcomp"
|
||||
lasterr=""
|
||||
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -z "$lasterr"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# End:
|
||||
# mkinstalldirs ends here
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,258 +0,0 @@
|
||||
#!/usr/bin/perl -0777 -pi
|
||||
# Update an FSF copyright year list to include the current year.
|
||||
|
||||
my $VERSION = '2009-08-14.18:56'; # UTC
|
||||
|
||||
# Copyright (C) 2009 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 3, 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Jim Meyering and Joel E. Denny
|
||||
|
||||
# The arguments to this script should be names of files that contain FSF
|
||||
# copyright statements to be updated. For example, you might wish to
|
||||
# use the update-copyright target rule in maint.mk from gnulib's
|
||||
# maintainer-makefile module.
|
||||
#
|
||||
# Iff an FSF copyright statement is recognized in a file and the final
|
||||
# year is not the current year, then the statement is updated for the
|
||||
# new year and it is reformatted to:
|
||||
#
|
||||
# 1. Fit within 72 columns.
|
||||
# 2. Convert 2-digit years to 4-digit years by prepending "19".
|
||||
# 3. Expand copyright year intervals. (See "Environment variables"
|
||||
# below.)
|
||||
#
|
||||
# A warning is printed for every file for which no FSF copyright
|
||||
# statement is recognized.
|
||||
#
|
||||
# Each file's FSF copyright statement must be formated correctly in
|
||||
# order to be recognized. For example, each of these is fine:
|
||||
#
|
||||
# Copyright @copyright{} 1990-2005, 2007-2009 Free Software
|
||||
# Foundation, Inc.
|
||||
#
|
||||
# # Copyright (C) 1990-2005, 2007-2009 Free Software
|
||||
# # Foundation, Inc.
|
||||
#
|
||||
# /*
|
||||
# * Copyright © 90,2005,2007-2009
|
||||
# * Free Software Foundation, Inc.
|
||||
# */
|
||||
#
|
||||
# However, the following format is not recognized because the line
|
||||
# prefix changes after the first line:
|
||||
#
|
||||
# ## Copyright (C) 1990-2005, 2007-2009 Free Software
|
||||
# # Foundation, Inc.
|
||||
#
|
||||
# The following copyright statement is not recognized because the
|
||||
# copyright holder is not the FSF:
|
||||
#
|
||||
# Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
|
||||
#
|
||||
# However, any correctly formatted FSF copyright statement following
|
||||
# either of the previous two copyright statements would be recognized.
|
||||
#
|
||||
# The exact conditions that a file's FSF copyright statement must meet
|
||||
# to be recognized are:
|
||||
#
|
||||
# 1. It is the first FSF copyright statement that meets all of the
|
||||
# following conditions. Subsequent FSF copyright statements are
|
||||
# ignored.
|
||||
# 2. Its format is "Copyright (C)", then a list of copyright years,
|
||||
# and then the name of the copyright holder, which is "Free
|
||||
# Software Foundation, Inc.".
|
||||
# 3. The "(C)" takes one of the following forms or is omitted
|
||||
# entirely:
|
||||
#
|
||||
# A. (C)
|
||||
# B. (c)
|
||||
# C. @copyright{}
|
||||
# D. ©
|
||||
#
|
||||
# 4. The "Copyright" appears at the beginning of a line except that it
|
||||
# may be prefixed by any sequence (e.g., a comment) of no more than
|
||||
# 5 characters.
|
||||
# 5. Iff such a prefix is present, the same prefix appears at the
|
||||
# beginning of each remaining line within the FSF copyright
|
||||
# statement. There is one exception in order to support C-style
|
||||
# comments: if the first line's prefix contains nothing but
|
||||
# whitespace surrounding a "/*", then the prefix for all subsequent
|
||||
# lines is the same as the first line's prefix except with each of
|
||||
# "/" and possibly "*" replaced by a " ". The replacement of "*"
|
||||
# by " " is consistent throughout all subsequent lines.
|
||||
# 6. Blank lines, even if preceded by the prefix, do not appear
|
||||
# within the FSF copyright statement.
|
||||
# 7. Each copyright year is 2 or 4 digits, and years are separated by
|
||||
# commas or dashes. Whitespace may appear after commas.
|
||||
#
|
||||
# Environment variables:
|
||||
#
|
||||
# 1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement
|
||||
# is reformatted even if it does not need updating for the new
|
||||
# year. If unset or set to 0, only updated FSF copyright
|
||||
# statements are reformatted.
|
||||
# 2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
|
||||
# copyright years (such as 90, 1991, 1992-2007, 2008) in a
|
||||
# reformatted FSF copyright statement is collapsed to a single
|
||||
# interval (such as 1990-2008). If unset or set to 0, all existing
|
||||
# copyright year intervals in a reformatted FSF copyright statement
|
||||
# are expanded instead.
|
||||
# 3. For testing purposes, you can set the assumed current year in
|
||||
# UPDATE_COPYRIGHT_YEAR.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $copyright_re = 'Copyright';
|
||||
my $circle_c_re = '(?:\([cC]\)|@copyright{}|©)';
|
||||
my $holder = 'Free Software Foundation, Inc.';
|
||||
my $prefix_max = 5;
|
||||
my $margin = 72;
|
||||
my $tab_width = 8;
|
||||
|
||||
my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
|
||||
if (!$this_year || $this_year !~ m/^\d{4}$/)
|
||||
{
|
||||
my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
|
||||
$this_year = $year + 1900;
|
||||
}
|
||||
|
||||
# Unless the file consistently uses "\r\n" as the EOL, use "\n" instead.
|
||||
my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n";
|
||||
|
||||
my $leading;
|
||||
my $prefix;
|
||||
my $ws_re;
|
||||
my $stmt_re;
|
||||
while (/(^|\n)(.{0,$prefix_max})$copyright_re/g)
|
||||
{
|
||||
$leading = "$1$2";
|
||||
$prefix = $2;
|
||||
if ($prefix =~ /^(\s*\/)\*(\s*)$/)
|
||||
{
|
||||
$prefix =~ s,/, ,;
|
||||
my $prefix_ws = $prefix;
|
||||
$prefix_ws =~ s/\*/ /; # Only whitespace.
|
||||
if (/\G(?:[^*\n]|\*[^\/\n])*\*?\n$prefix_ws/)
|
||||
{
|
||||
$prefix = $prefix_ws;
|
||||
}
|
||||
}
|
||||
$ws_re = '[ \t\r\f]'; # \s without \n
|
||||
$ws_re =
|
||||
"(?:$ws_re*(?:$ws_re|\\n" . quotemeta($prefix) . ")$ws_re*)";
|
||||
my $holder_re = $holder;
|
||||
$holder_re =~ s/\s/$ws_re/g;
|
||||
my $stmt_remainder_re =
|
||||
"(?:$ws_re$circle_c_re)?"
|
||||
. "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|-))*"
|
||||
. "((?:\\d\\d)?\\d\\d)$ws_re$holder_re";
|
||||
if (/\G$stmt_remainder_re/)
|
||||
{
|
||||
$stmt_re =
|
||||
quotemeta($leading) . "($copyright_re$stmt_remainder_re)";
|
||||
last;
|
||||
}
|
||||
}
|
||||
if (defined $stmt_re)
|
||||
{
|
||||
/$stmt_re/ or die; # Should never die.
|
||||
my $stmt = $1;
|
||||
my $final_year_orig = $2;
|
||||
|
||||
# Handle two-digit year numbers like "98" and "99".
|
||||
my $final_year = $final_year_orig;
|
||||
$final_year <= 99
|
||||
and $final_year += 1900;
|
||||
|
||||
if ($final_year != $this_year)
|
||||
{
|
||||
# Update the year.
|
||||
$stmt =~ s/$final_year_orig/$final_year, $this_year/;
|
||||
}
|
||||
if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'})
|
||||
{
|
||||
# Normalize all whitespace including newline-prefix sequences.
|
||||
$stmt =~ s/$ws_re/ /g;
|
||||
|
||||
# Put spaces after commas.
|
||||
$stmt =~ s/, ?/, /g;
|
||||
|
||||
# Convert 2-digit to 4-digit years.
|
||||
$stmt =~ s/(\b\d\d\b)/19$1/g;
|
||||
|
||||
# Make the use of intervals consistent.
|
||||
if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS})
|
||||
{
|
||||
$stmt =~ s/(\d{4})-(\d{4})/join(', ', $1..$2)/eg;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt =~
|
||||
s/
|
||||
(\d{4})
|
||||
(?:
|
||||
(,\ |-)
|
||||
((??{
|
||||
if ($2 eq '-') { '\d{4}'; }
|
||||
elsif (!$3) { $1 + 1; }
|
||||
else { $3 + 1; }
|
||||
}))
|
||||
)+
|
||||
/$1-$3/gx;
|
||||
}
|
||||
|
||||
# Format within margin.
|
||||
my $stmt_wrapped;
|
||||
my $text_margin = $margin - length($prefix);
|
||||
if ($prefix =~ /^(\t+)/)
|
||||
{
|
||||
$text_margin -= length($1) * ($tab_width - 1);
|
||||
}
|
||||
while (length $stmt)
|
||||
{
|
||||
if (($stmt =~ s/^(.{1,$text_margin})(?: |$)//)
|
||||
|| ($stmt =~ s/^([\S]+)(?: |$)//))
|
||||
{
|
||||
my $line = $1;
|
||||
$stmt_wrapped .= $stmt_wrapped ? "$eol$prefix" : $leading;
|
||||
$stmt_wrapped .= $line;
|
||||
}
|
||||
else
|
||||
{
|
||||
# Should be unreachable, but we don't want an infinite
|
||||
# loop if it can be reached.
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
# Replace the old copyright statement.
|
||||
s/$stmt_re/$stmt_wrapped/;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "$ARGV: warning: FSF copyright statement not found\n";
|
||||
}
|
||||
|
||||
# Local variables:
|
||||
# indent-tabs-mode: nil
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "my $VERSION = '"
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "'; # UTC"
|
||||
# End:
|
||||
@@ -1,206 +0,0 @@
|
||||
#!/usr/bin/perl -T
|
||||
# Detect instances of "if (p) free (p);".
|
||||
# Likewise for "if (p != NULL) free (p);". And with braces.
|
||||
# Also detect "if (NULL != p) free (p);".
|
||||
# And with 0 in place of NULL.
|
||||
|
||||
my $VERSION = '2009-04-16 15:57'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
# Copyright (C) 2008, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Jim Meyering
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
|
||||
(my $ME = $0) =~ s|.*/||;
|
||||
|
||||
# use File::Coda; # http://meyering.net/code/Coda/
|
||||
END {
|
||||
defined fileno STDOUT or return;
|
||||
close STDOUT and return;
|
||||
warn "$ME: failed to close standard output: $!\n";
|
||||
$? ||= 1;
|
||||
}
|
||||
|
||||
sub usage ($)
|
||||
{
|
||||
my ($exit_code) = @_;
|
||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||
if ($exit_code != 0)
|
||||
{
|
||||
print $STREAM "Try `$ME --help' for more information.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $STREAM <<EOF;
|
||||
Usage: $ME [OPTIONS] FILE...
|
||||
|
||||
Detect any instance in FILE of a useless "if" test before a free call, e.g.,
|
||||
"if (p) free (p);". Any such test may be safely removed without affecting
|
||||
the semantics of the C code in FILE. Use --name=FOO --name=BAR to also
|
||||
detect free-like functions named FOO and BAR.
|
||||
|
||||
OPTIONS:
|
||||
|
||||
--list print only the name of each matching FILE (\0-terminated)
|
||||
--name=N add name N to the list of \`free\'-like functions to detect;
|
||||
may be repeated
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
Exit status:
|
||||
|
||||
0 one or more matches
|
||||
1 no match
|
||||
2 an error
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
For example, this command prints all removable "if" tests before "free"
|
||||
and "kfree" calls in the linux kernel sources:
|
||||
|
||||
git ls-files -z |xargs -0 $ME --name=kfree
|
||||
|
||||
EOF
|
||||
}
|
||||
exit $exit_code;
|
||||
}
|
||||
|
||||
sub is_NULL ($)
|
||||
{
|
||||
my ($expr) = @_;
|
||||
return ($expr eq 'NULL' || $expr eq '0');
|
||||
}
|
||||
|
||||
{
|
||||
sub EXIT_MATCH {0}
|
||||
sub EXIT_NO_MATCH {1}
|
||||
sub EXIT_ERROR {2}
|
||||
my $err = EXIT_NO_MATCH;
|
||||
|
||||
my $list;
|
||||
my @name = qw(free);
|
||||
GetOptions
|
||||
(
|
||||
help => sub { usage 0 },
|
||||
version => sub { print "$ME version $VERSION\n"; exit },
|
||||
list => \$list,
|
||||
'name=s@' => \@name,
|
||||
) or usage 1;
|
||||
|
||||
# Make sure we have the right number of non-option arguments.
|
||||
# Always tell the user why we fail.
|
||||
@ARGV < 1
|
||||
and (warn "$ME: missing FILE argument\n"), usage EXIT_ERROR;
|
||||
|
||||
my $or = join '|', @name;
|
||||
my $regexp = qr/(?:$or)/;
|
||||
|
||||
# Set the input record separator.
|
||||
# Note: this makes it impractical to print line numbers.
|
||||
$/ = '"';
|
||||
|
||||
my $found_match = 0;
|
||||
FILE:
|
||||
foreach my $file (@ARGV)
|
||||
{
|
||||
open FH, '<', $file
|
||||
or (warn "$ME: can't open `$file' for reading: $!\n"),
|
||||
$err = EXIT_ERROR, next;
|
||||
while (defined (my $line = <FH>))
|
||||
{
|
||||
while ($line =~
|
||||
/\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
|
||||
# 1 2 3
|
||||
(?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)|
|
||||
\s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
|
||||
{
|
||||
my $all = $1;
|
||||
my ($lhs, $rhs) = ($2, $3);
|
||||
my ($free_opnd, $braced_free_opnd) = ($4, $5);
|
||||
my $non_NULL;
|
||||
if (!defined $rhs) { $non_NULL = $lhs }
|
||||
elsif (is_NULL $rhs) { $non_NULL = $lhs }
|
||||
elsif (is_NULL $lhs) { $non_NULL = $rhs }
|
||||
else { next }
|
||||
|
||||
# Compare the non-NULL part of the "if" expression and the
|
||||
# free'd expression, without regard to white space.
|
||||
$non_NULL =~ tr/ \t//d;
|
||||
my $e2 = defined $free_opnd ? $free_opnd : $braced_free_opnd;
|
||||
$e2 =~ tr/ \t//d;
|
||||
if ($non_NULL eq $e2)
|
||||
{
|
||||
$found_match = 1;
|
||||
$list
|
||||
and (print "$file\0"), next FILE;
|
||||
print "$file: $all\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
continue
|
||||
{
|
||||
close FH;
|
||||
}
|
||||
|
||||
$found_match && $err == EXIT_NO_MATCH
|
||||
and $err = EXIT_MATCH;
|
||||
|
||||
exit $err;
|
||||
}
|
||||
|
||||
my $foo = <<'EOF';
|
||||
# The above is to *find* them.
|
||||
# This adjusts them, removing the unnecessary "if (p)" part.
|
||||
|
||||
# FIXME: do something like this as an option (doesn't do braces):
|
||||
free=xfree
|
||||
git grep -l -z "$free *(" \
|
||||
| xargs -0 useless-if-before-free -l --name="$free" \
|
||||
| xargs -0 perl -0x3b -pi -e \
|
||||
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\))/$2/s'
|
||||
|
||||
# Use the following to remove redundant uses of kfree inside braces.
|
||||
# Note that -0777 puts perl in slurp-whole-file mode;
|
||||
# but we have plenty of memory, these days...
|
||||
free=kfree
|
||||
git grep -l -z "$free *(" \
|
||||
| xargs -0 useless-if-before-free -l --name="$free" \
|
||||
| xargs -0 perl -0777 -pi -e \
|
||||
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s*\{\s*('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\);)\s*\}[^\n]*$/$2/gms'
|
||||
|
||||
Be careful that the result of the above transformation is valid.
|
||||
If the matched string is followed by "else", then obviously, it won't be.
|
||||
|
||||
When modifying files, refuse to process anything other than a regular file.
|
||||
EOF
|
||||
|
||||
## Local Variables:
|
||||
## indent-tabs-mode: nil
|
||||
## eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
## time-stamp-start: "my $VERSION = '"
|
||||
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||
## time-stamp-time-zone: "UTC"
|
||||
## time-stamp-end: "'; # UTC"
|
||||
## End:
|
||||
@@ -1,116 +0,0 @@
|
||||
#!/bin/sh
|
||||
# List version-controlled file names.
|
||||
|
||||
# Print a version string.
|
||||
scriptversion=2009-07-21.16; # UTC
|
||||
|
||||
# Copyright (C) 2006-2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# List the specified version-controlled files.
|
||||
# With no argument, list them all. With a single DIRECTORY argument,
|
||||
# list the version-controlled files in that directory.
|
||||
|
||||
# If there's an argument, it must be a single, "."-relative directory name.
|
||||
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
|
||||
|
||||
postprocess=
|
||||
case $1 in
|
||||
--help) cat <<EOF
|
||||
Usage: $0 [-C SRCDIR] [DIR]
|
||||
|
||||
Output a list of version-controlled files in DIR (default .), relative to
|
||||
SRCDIR (default .). SRCDIR must be the top directory of a checkout.
|
||||
|
||||
Options:
|
||||
--help print this help, then exit
|
||||
--version print version number, then exit
|
||||
-C SRCDIR change directory to SRCDIR before generating list
|
||||
|
||||
Report bugs and patches to <bug-gnulib@gnu.org>.
|
||||
EOF
|
||||
exit ;;
|
||||
|
||||
--version)
|
||||
year=`echo "$scriptversion" | sed 's/[^0-9].*//'`
|
||||
cat <<EOF
|
||||
vc-list-files $scriptversion
|
||||
Copyright (C) $year Free Software Foundation, Inc,
|
||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
EOF
|
||||
exit ;;
|
||||
|
||||
-C)
|
||||
test "$2" = . || postprocess="| sed 's|^|$2/|'"
|
||||
cd "$2" || exit 1
|
||||
shift; shift ;;
|
||||
esac
|
||||
|
||||
dir=
|
||||
case $# in
|
||||
0) ;;
|
||||
1) dir=$1 ;;
|
||||
*) echo "$0: too many arguments" 1>&2
|
||||
echo "Usage: $0 [-C srcdir] [DIR]" 1>&2; exit 1;;
|
||||
esac
|
||||
|
||||
test "x$dir" = x && dir=.
|
||||
|
||||
if test -d .git; then
|
||||
test "x$dir" = x. \
|
||||
&& dir= sed_esc= \
|
||||
|| { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
|
||||
# Ignore git symlinks - either they point into the tree, in which case
|
||||
# we don't need to visit the target twice, or they point somewhere
|
||||
# else (often into a submodule), in which case the content does not
|
||||
# belong to this package.
|
||||
eval exec git ls-tree -r 'HEAD:"$dir"' \
|
||||
\| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess
|
||||
elif test -d .hg; then
|
||||
eval exec hg locate '"$dir/*"' $postprocess
|
||||
elif test -d .bzr; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
eval exec bzr ls --versioned '"$dir"' $postprocess
|
||||
elif test -d CVS; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
if test -x build-aux/cvsu; then
|
||||
eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
|
||||
elif (cvsu --help) >/dev/null 2>&1; then
|
||||
eval cvsu --find --types=AFGM '"$dir"' $postprocess
|
||||
else
|
||||
eval awk -F/ \''{ \
|
||||
if (!$1 && $3 !~ /^-/) { \
|
||||
f=FILENAME; \
|
||||
if (f ~ /CVS\/Entries$/) \
|
||||
f = substr(f, 1, length(f)-11); \
|
||||
print f $2; \
|
||||
}}'\'' \
|
||||
`find "$dir" -name Entries -print` /dev/null' $postprocess
|
||||
fi
|
||||
else
|
||||
echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
223
build-aux/ylwrap
223
build-aux/ylwrap
@@ -1,223 +0,0 @@
|
||||
#! /bin/sh
|
||||
# ylwrap - wrapper for lex/yacc invocations.
|
||||
|
||||
scriptversion=2005-05-14.22
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
|
||||
# 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case "$1" in
|
||||
'')
|
||||
echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
--basedir)
|
||||
basedir=$2
|
||||
shift 2
|
||||
;;
|
||||
-h|--h*)
|
||||
cat <<\EOF
|
||||
Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
|
||||
|
||||
Wrapper for lex/yacc invocations, renaming files as desired.
|
||||
|
||||
INPUT is the input file
|
||||
OUTPUT is one file PROG generates
|
||||
DESIRED is the file we actually want instead of OUTPUT
|
||||
PROGRAM is program to run
|
||||
ARGS are passed to PROG
|
||||
|
||||
Any number of OUTPUT,DESIRED pairs may be used.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v|--v*)
|
||||
echo "ylwrap $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# The input.
|
||||
input="$1"
|
||||
shift
|
||||
case "$input" in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
# Absolute path; do nothing.
|
||||
;;
|
||||
*)
|
||||
# Relative path. Make it absolute.
|
||||
input="`pwd`/$input"
|
||||
;;
|
||||
esac
|
||||
|
||||
pairlist=
|
||||
while test "$#" -ne 0; do
|
||||
if test "$1" = "--"; then
|
||||
shift
|
||||
break
|
||||
fi
|
||||
pairlist="$pairlist $1"
|
||||
shift
|
||||
done
|
||||
|
||||
# The program to run.
|
||||
prog="$1"
|
||||
shift
|
||||
# Make any relative path in $prog absolute.
|
||||
case "$prog" in
|
||||
[\\/]* | ?:[\\/]*) ;;
|
||||
*[\\/]*) prog="`pwd`/$prog" ;;
|
||||
esac
|
||||
|
||||
# FIXME: add hostname here for parallel makes that run commands on
|
||||
# other machines. But that might take us over the 14-char limit.
|
||||
dirname=ylwrap$$
|
||||
trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
|
||||
mkdir $dirname || exit 1
|
||||
|
||||
cd $dirname
|
||||
|
||||
case $# in
|
||||
0) $prog "$input" ;;
|
||||
*) $prog "$@" "$input" ;;
|
||||
esac
|
||||
ret=$?
|
||||
|
||||
if test $ret -eq 0; then
|
||||
set X $pairlist
|
||||
shift
|
||||
first=yes
|
||||
# Since DOS filename conventions don't allow two dots,
|
||||
# the DOS version of Bison writes out y_tab.c instead of y.tab.c
|
||||
# and y_tab.h instead of y.tab.h. Test to see if this is the case.
|
||||
y_tab_nodot="no"
|
||||
if test -f y_tab.c || test -f y_tab.h; then
|
||||
y_tab_nodot="yes"
|
||||
fi
|
||||
|
||||
# The directory holding the input.
|
||||
input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
|
||||
# Quote $INPUT_DIR so we can use it in a regexp.
|
||||
# FIXME: really we should care about more than `.' and `\'.
|
||||
input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
|
||||
|
||||
while test "$#" -ne 0; do
|
||||
from="$1"
|
||||
# Handle y_tab.c and y_tab.h output by DOS
|
||||
if test $y_tab_nodot = "yes"; then
|
||||
if test $from = "y.tab.c"; then
|
||||
from="y_tab.c"
|
||||
else
|
||||
if test $from = "y.tab.h"; then
|
||||
from="y_tab.h"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test -f "$from"; then
|
||||
# If $2 is an absolute path name, then just use that,
|
||||
# otherwise prepend `../'.
|
||||
case "$2" in
|
||||
[\\/]* | ?:[\\/]*) target="$2";;
|
||||
*) target="../$2";;
|
||||
esac
|
||||
|
||||
# We do not want to overwrite a header file if it hasn't
|
||||
# changed. This avoid useless recompilations. However the
|
||||
# parser itself (the first file) should always be updated,
|
||||
# because it is the destination of the .y.c rule in the
|
||||
# Makefile. Divert the output of all other files to a temporary
|
||||
# file so we can compare them to existing versions.
|
||||
if test $first = no; then
|
||||
realtarget="$target"
|
||||
target="tmp-`echo $target | sed s/.*[\\/]//g`"
|
||||
fi
|
||||
# Edit out `#line' or `#' directives.
|
||||
#
|
||||
# We don't want the resulting debug information to point at
|
||||
# an absolute srcdir; it is better for it to just mention the
|
||||
# .y file with no path.
|
||||
#
|
||||
# We want to use the real output file name, not yy.lex.c for
|
||||
# instance.
|
||||
#
|
||||
# We want the include guards to be adjusted too.
|
||||
FROM=`echo "$from" | sed \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
|
||||
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
|
||||
TARGET=`echo "$2" | sed \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
|
||||
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
|
||||
|
||||
sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
|
||||
-e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
|
||||
|
||||
# Check whether header files must be updated.
|
||||
if test $first = no; then
|
||||
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
|
||||
echo "$2" is unchanged
|
||||
rm -f "$target"
|
||||
else
|
||||
echo updating "$2"
|
||||
mv -f "$target" "$realtarget"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# A missing file is only an error for the first file. This
|
||||
# is a blatant hack to let us support using "yacc -d". If -d
|
||||
# is not specified, we don't want an error when the header
|
||||
# file is "missing".
|
||||
if test $first = yes; then
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
shift
|
||||
shift
|
||||
first=no
|
||||
done
|
||||
else
|
||||
ret=$?
|
||||
fi
|
||||
|
||||
# Remove the directory.
|
||||
cd ..
|
||||
rm -rf $dirname
|
||||
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
306
configure.ac
306
configure.ac
@@ -1,6 +1,6 @@
|
||||
dnl Template file for GNU Autoconf
|
||||
dnl Copyright (C) 1995, 1996, 1997, 2001, 2007, 2008, 2009 Free Software
|
||||
dnl Foundation, Inc.
|
||||
dnl Copyright (C) 1995, 1996, 1997, 2001, 2007, 2008, 2009, 2010, 2011
|
||||
dnl Free Software Foundation, Inc.
|
||||
|
||||
dnl This program is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
@@ -31,7 +31,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_INIT([wget],
|
||||
[1.12],
|
||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
[bug-wget@gnu.org])
|
||||
AC_PREREQ(2.61)
|
||||
|
||||
@@ -43,10 +43,12 @@ AC_MSG_NOTICE([configuring for GNU Wget $PACKAGE_VERSION])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
|
||||
AC_CONFIG_SRCDIR([src/wget.h])
|
||||
|
||||
dnl
|
||||
dnl Automake setup
|
||||
dnl
|
||||
AM_INIT_AUTOMAKE(dist-bzip2 dist-lzma 1.9)
|
||||
AM_INIT_AUTOMAKE([1.9])
|
||||
|
||||
dnl
|
||||
dnl Get cannonical host
|
||||
@@ -60,7 +62,11 @@ dnl Process features.
|
||||
dnl
|
||||
|
||||
AC_ARG_WITH(ssl,
|
||||
[[ --without-ssl disable SSL autodetection]])
|
||||
[[ --without-ssl disable SSL autodetection
|
||||
--with-ssl={gnutls,openssl} specify the SSL backend. GNU TLS is the default.]])
|
||||
|
||||
AC_ARG_WITH(zlib,
|
||||
[[ --without-zlib disable zlib ]])
|
||||
|
||||
AC_ARG_ENABLE(opie,
|
||||
[ --disable-opie disable support for opie or s/key FTP login],
|
||||
@@ -84,13 +90,6 @@ ENABLE_DEBUG=$enableval, ENABLE_DEBUG=yes)
|
||||
test x"${ENABLE_DEBUG}" = xyes && AC_DEFINE([ENABLE_DEBUG], 1,
|
||||
[Define if you want the debug output support compiled in.])
|
||||
|
||||
wget_need_md5=no
|
||||
|
||||
case "${ENABLE_OPIE}${ENABLE_DIGEST}" in
|
||||
*yes*)
|
||||
wget_need_md5=yes
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl Find the compiler
|
||||
dnl
|
||||
@@ -104,7 +103,6 @@ AM_PROG_CC_C_O
|
||||
AC_AIX
|
||||
|
||||
gl_EARLY
|
||||
md5_EARLY
|
||||
|
||||
dnl
|
||||
dnl Gettext
|
||||
@@ -171,11 +169,11 @@ dnl Check sizes of integer types. These are used to find n-bit
|
||||
dnl integral types on older systems that fail to provide intN_t and
|
||||
dnl uintN_t typedefs.
|
||||
dnl
|
||||
AC_CHECK_SIZEOF(short)
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_SIZEOF(void *)
|
||||
AC_CHECK_SIZEOF([short])
|
||||
AC_CHECK_SIZEOF([int])
|
||||
AC_CHECK_SIZEOF([long])
|
||||
AC_CHECK_SIZEOF([long long])
|
||||
AC_CHECK_SIZEOF([void *])
|
||||
|
||||
dnl
|
||||
dnl Checks for non-universal or system-specific types.
|
||||
@@ -200,8 +198,9 @@ dnl Checks for library functions.
|
||||
dnl
|
||||
AC_FUNC_MMAP
|
||||
AC_FUNC_FSEEKO
|
||||
AC_CHECK_FUNCS(strptime timegm snprintf vsnprintf vasprintf drand48)
|
||||
AC_CHECK_FUNCS(strptime timegm vsnprintf vasprintf drand48 pathconf)
|
||||
AC_CHECK_FUNCS(strtoll usleep ftello sigblock sigsetjmp memrchr wcwidth mbtowc)
|
||||
AC_CHECK_FUNCS(sleep symlink utime)
|
||||
|
||||
if test x"$ENABLE_OPIE" = xyes; then
|
||||
AC_LIBOBJ([ftp-opie])
|
||||
@@ -215,142 +214,148 @@ AC_DEFINE([HAVE_STRCASECMP], 1, [Define to 1 if you have the `strcasecmp' functi
|
||||
AC_DEFINE([HAVE_STRNCASECMP], 1, [Define to 1 if you have the `strncasecmp' function.])
|
||||
AC_DEFINE([HAVE_STRDUP], 1, [Define to 1 if you have the `strdup' function.])
|
||||
AC_DEFINE([HAVE_ISATTY], 1, [Define to 1 if you have the `isatty' function.])
|
||||
AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the `symlink' function.])
|
||||
|
||||
dnl
|
||||
dnl Call Wget-specific macros defined in aclocal.
|
||||
dnl
|
||||
WGET_STRUCT_UTIMBUF
|
||||
WGET_SOCKLEN_T
|
||||
WGET_FNMATCH
|
||||
WGET_NANOSLEEP
|
||||
WGET_POSIX_CLOCK
|
||||
WGET_NSL_SOCKET
|
||||
|
||||
dnl Deal with specific hosts
|
||||
case $host_os in
|
||||
*mingw32* )
|
||||
LIBS+=' -lws2_32'
|
||||
AC_LIBOBJ([mswindows])
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
dnl
|
||||
dnl Checks for libraries.
|
||||
dnl
|
||||
|
||||
AS_IF([test x"$with_ssl" = xgnutls], [
|
||||
dnl Now actually check for -lssl
|
||||
AC_LIB_HAVE_LINKFLAGS([gnutls], [], [
|
||||
#include <gnutls/gnutls.h>
|
||||
], [gnutls_global_init()])
|
||||
if test x"$LIBGNUTLS" != x
|
||||
then
|
||||
AC_MSG_NOTICE([compiling in support for SSL via GnuTLS])
|
||||
AC_LIBOBJ([gnutls])
|
||||
else
|
||||
AC_MSG_ERROR([--with-ssl=gnutls was given, but GNUTLS is not available.])
|
||||
fi
|
||||
], [
|
||||
# --with-ssl is not gnutls: check if it's no
|
||||
AS_IF([test x"$with_ssl" != xno], [
|
||||
dnl As of this writing (OpenSSL 0.9.6), the libcrypto shared library
|
||||
dnl doesn't record its dependency on libdl, so we need to make sure
|
||||
dnl -ldl ends up in LIBS on systems that have it. Most OSes use
|
||||
dnl dlopen(), but HP-UX uses shl_load().
|
||||
AC_CHECK_LIB(dl, dlopen, [], [
|
||||
AC_CHECK_LIB(dl, shl_load)
|
||||
])
|
||||
AS_IF([test x"$with_zlib" != xno], [
|
||||
with_zlib=yes
|
||||
AC_CHECK_LIB(z, compress)
|
||||
])
|
||||
|
||||
dnl Now actually check for -lssl
|
||||
AS_IF([test x"$with_ssl" = xopenssl], [
|
||||
dnl As of this writing (OpenSSL 0.9.6), the libcrypto shared library
|
||||
dnl doesn't record its dependency on libdl, so we need to make sure
|
||||
dnl -ldl ends up in LIBS on systems that have it. Most OSes use
|
||||
dnl dlopen(), but HP-UX uses shl_load().
|
||||
AC_CHECK_LIB(dl, dlopen, [], [
|
||||
AC_CHECK_LIB(dl, shl_load)
|
||||
])
|
||||
|
||||
ssl_found=no
|
||||
case $host_os in
|
||||
*mingw32* )
|
||||
dnl prefer link to openssl dlls if possible. if not then fallback on static libs. if not then error
|
||||
|
||||
AC_CHECK_LIB(eay32, EVP_MD_CTX_init)
|
||||
if test x"$ac_cv_lib_eay32_EVP_MD_CTX_init" != xno
|
||||
then
|
||||
AC_CHECK_LIB(ssl32, SSL_connect, [
|
||||
ssl_found=yes
|
||||
AC_MSG_NOTICE([Enabling support for SSL via OpenSSL (shared)])
|
||||
AC_LIBOBJ([openssl])
|
||||
LIBS="${LIBS} -lssl32"
|
||||
AC_DEFINE([HAVE_LIBSSL32], [1], [Define to 1 if you have the `ssl32' library (-lssl32).])
|
||||
],
|
||||
AC_MSG_ERROR([openssl not found: shared lib eay32 found but ssl32 not found]))
|
||||
|
||||
else
|
||||
LIBS+=' -lgdi32'
|
||||
dnl fallback and test static libs
|
||||
fi
|
||||
dnl add zdll lib as dep for above tests?
|
||||
;;
|
||||
esac
|
||||
|
||||
AS_IF([test x$ssl_found != xyes], [
|
||||
dnl Now actually check for -lssl if it wasn't already found
|
||||
AC_LIB_HAVE_LINKFLAGS([ssl], [crypto], [
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/des.h>
|
||||
#include <openssl/md4.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/des.h>
|
||||
#include <openssl/md4.h>
|
||||
#include <openssl/md5.h>
|
||||
], [SSL_library_init ()])
|
||||
if test x"$LIBSSL" != x
|
||||
then
|
||||
ssl_found=yes
|
||||
AC_MSG_NOTICE([compiling in support for SSL via OpenSSL])
|
||||
AC_LIBOBJ([openssl])
|
||||
LIBS="$LIBSSL $LIBS"
|
||||
elif test x"$with_ssl" != x
|
||||
then
|
||||
AC_MSG_ERROR([--with-ssl was given, but SSL is not available.])
|
||||
AC_MSG_ERROR([--with-ssl=openssl was given, but SSL is not available.])
|
||||
fi
|
||||
]) # endif: --with-ssl == no?
|
||||
]) # endif: --with-ssl == gnutls?
|
||||
])
|
||||
|
||||
], [
|
||||
# --with-ssl is not openssl: check if it's no
|
||||
AS_IF([test x"$with_ssl" != xno], [
|
||||
dnl default is -lgnutls
|
||||
with_ssl=gnutls
|
||||
|
||||
dnl Now actually check for -lgnutls
|
||||
AC_LIB_HAVE_LINKFLAGS([gnutls], [], [
|
||||
#include <gnutls/gnutls.h>
|
||||
], [gnutls_global_init()])
|
||||
if test x"$LIBGNUTLS" != x
|
||||
then
|
||||
ssl_found=yes
|
||||
AC_MSG_NOTICE([compiling in support for SSL via GnuTLS])
|
||||
AC_LIBOBJ([gnutls])
|
||||
LIBS="$LIBGNUTLS $LIBS"
|
||||
else
|
||||
AC_MSG_ERROR([--with-ssl=gnutls was given, but GNUTLS is not available.])
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(gnutls_priority_set_direct)
|
||||
]) # endif: --with-ssl != no?
|
||||
]) # endif: --with-ssl == openssl?
|
||||
|
||||
dnl Enable NTLM if requested and if SSL is available.
|
||||
if test x"$LIBSSL" != x
|
||||
if test x"$LIBSSL" != x || test "$ac_cv_lib_ssl32_SSL_connect" = yes
|
||||
then
|
||||
if test x"$ENABLE_NTLM" != xno
|
||||
then
|
||||
ENABLE_NTLM=yes
|
||||
AC_DEFINE([ENABLE_NTLM], 1,
|
||||
[Define if you want the NTLM authorization support compiled in.])
|
||||
AC_LIBOBJ([http-ntlm])
|
||||
fi
|
||||
else
|
||||
dnl If SSL is unavailable and the user explicitly requested NTLM,
|
||||
dnl abort.
|
||||
if test x"$ENABLE_NTLM" = xyes
|
||||
AC_CHECK_LIB(nettle, nettle_md4_init, [HAVE_NETTLE=yes], [HAVE_NETTLE=no; AC_MSG_WARN(*** libnettle was not found. You will not be able to use NTLM)])
|
||||
|
||||
if test x"$HAVE_NETTLE" = xyes
|
||||
then
|
||||
AC_MSG_ERROR([NTLM authorization requested and OpenSSL not found; aborting])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Find an MD5 implementation. Since Wget rarely needs MD5, we try
|
||||
dnl to use an existing library implementation to save on code size.
|
||||
dnl
|
||||
|
||||
if test x"$wget_need_md5" = xyes
|
||||
then
|
||||
dnl This should be moved to an AC_DEFUN, but I'm not sure how to
|
||||
dnl manipulate MD5_OBJ from the defun.
|
||||
|
||||
AC_LIBOBJ([gen-md5])
|
||||
found_md5=no
|
||||
|
||||
dnl Check for the system MD5 library on Solaris. We don't check for
|
||||
dnl something simple like "MD5Update" because there are a number of
|
||||
dnl MD5 implementations that use that name, but have an otherwise
|
||||
dnl incompatible interface. md5_calc is, hopefully, specific to the
|
||||
dnl Solaris MD5 library.
|
||||
if test x"$found_md5" = xno; then
|
||||
AC_CHECK_LIB(md5, md5_calc, [
|
||||
dnl Some installations have bogus <md5.h> in the compiler's
|
||||
dnl include path, making the system md5 library useless.
|
||||
AC_MSG_CHECKING([for working md5.h])
|
||||
AC_COMPILE_IFELSE([#include <md5.h>
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_SOLARIS_MD5], 1, [Define when using Solaris MD5.])
|
||||
LIBS="-lmd5 $LIBS"
|
||||
found_md5=yes
|
||||
AC_MSG_NOTICE([using the Solaris MD5 implementation])
|
||||
], [AC_MSG_RESULT(no)])
|
||||
])
|
||||
fi
|
||||
|
||||
dnl Then see if we're linking OpenSSL anyway; if yes, use its md5
|
||||
dnl implementation.
|
||||
if test x"$found_md5" = xno; then
|
||||
if test x"$LIBSSL" != x; then
|
||||
AC_DEFINE([HAVE_OPENSSL_MD5], 1, [Define when using OpenSSL MD5.])
|
||||
found_md5=yes
|
||||
AC_MSG_NOTICE([using the OpenSSL MD5 implementation])
|
||||
AC_SUBST(NETTLE_LIBS, "-lnettle")
|
||||
AC_DEFINE([HAVE_NETTLE], [1], [Use libnettle])
|
||||
if test x"$ENABLE_NTLM" != xno
|
||||
then
|
||||
ENABLE_NTLM=yes
|
||||
AC_DEFINE([ENABLE_NTLM], 1,
|
||||
[Define if you want the NTLM authorization support compiled in.])
|
||||
AC_LIBOBJ([http-ntlm])
|
||||
LIBS="$NETTLE_LIBS $LIBS"
|
||||
fi
|
||||
else
|
||||
dnl If SSL is unavailable and the user explicitly requested NTLM,
|
||||
dnl abort.
|
||||
if test x"$ENABLE_NTLM" = xyes
|
||||
then
|
||||
AC_MSG_ERROR([NTLM authorization requested and SSL not enabled; aborting])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl If none of the above worked, use the one we ship with Wget.
|
||||
if test x"$found_md5" = xno; then
|
||||
AC_DEFINE([HAVE_BUILTIN_MD5], 1, [Define when using built-in MD5.])
|
||||
found_md5=yes
|
||||
AC_MSG_NOTICE([using the built-in (GNU) MD5 implementation])
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
AC_SUBST(MD5_CPPFLAGS, '-I $(top_srcdir)/md5')
|
||||
AC_SUBST(MD5_LDADD, '../md5/libmd5.a')
|
||||
AC_SUBST(MD5_SUBDIR, md5)
|
||||
md5_INIT
|
||||
fi
|
||||
AC_DEFINE([HAVE_MD5], 1, [Define if we're compiling support for MD5.])
|
||||
fi
|
||||
|
||||
dnl **********************************************************************
|
||||
@@ -359,9 +364,9 @@ dnl **********************************************************************
|
||||
|
||||
dnl
|
||||
dnl We test for IPv6 by checking, in turn, for availability of
|
||||
dnl getaddrinfo, presence of the INET6 address/protocol family, and
|
||||
dnl the existence of struct sockaddr_in6. If any of them is missing,
|
||||
dnl IPv6 is disabled, and the code reverts to old-style gethostbyname.
|
||||
dnl presence of the INET6 address/protocol family and the existence of
|
||||
dnl struct sockaddr_in6. If any of them is missing, IPv6 is disabled,
|
||||
dnl and the code reverts to old-style gethostbyname.
|
||||
dnl
|
||||
dnl If --enable-ipv6 is explicitly specified on the configure command
|
||||
dnl line, we check for IPv6 and abort if not found. If --disable-ipv6
|
||||
@@ -396,13 +401,6 @@ AC_ARG_ENABLE(ipv6,
|
||||
]
|
||||
)
|
||||
|
||||
if test "X$ipv6" = "Xyes"; then
|
||||
AC_CHECK_FUNCS(getaddrinfo, [], [
|
||||
AC_MSG_NOTICE([Disabling IPv6 support: your system does not support getaddrinfo(3)])
|
||||
ipv6=no
|
||||
])
|
||||
fi
|
||||
|
||||
if test "X$ipv6" = "Xyes"; then
|
||||
PROTO_INET6([], [
|
||||
AC_MSG_NOTICE([Disabling IPv6 support: your system does not support the PF_INET6 protocol family])
|
||||
@@ -428,17 +426,6 @@ elif test "x$force_ipv6" = "xyes"; then
|
||||
AC_MSG_ERROR([IPv6 support requested but not found; aborting])
|
||||
fi
|
||||
|
||||
|
||||
dnl
|
||||
dnl Set of available languages.
|
||||
dnl
|
||||
dnl Originally this used to be static, looking like this:
|
||||
dnl ALL_LINGUAS="cs de hr it ..."
|
||||
dnl The downside was that configure needed to be rebuilt whenever a
|
||||
dnl new language was added.
|
||||
dnl
|
||||
ALL_LINGUAS="en@quot en@boldquot en_US $(cd ${srcdir}/po && ls *.po | grep -v 'en@.*quot' | grep -v 'en_US\.po' | sed -e 's/\.po$//' | tr '\012' ' ')"
|
||||
|
||||
dnl
|
||||
dnl Find makeinfo. We used to provide support for Emacs processing
|
||||
dnl Texinfo using `emacs -batch -eval ...' where makeinfo is
|
||||
@@ -544,7 +531,31 @@ if test "X$iri" != "Xno"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check for UUID
|
||||
dnl
|
||||
|
||||
AC_CHECK_HEADER(uuid/uuid.h,
|
||||
AC_CHECK_LIB(uuid, uuid_generate,
|
||||
[LIBS="${LIBS} -luuid"
|
||||
AC_DEFINE([HAVE_LIBUUID], 1,
|
||||
[Define if libuuid is available.])
|
||||
])
|
||||
)
|
||||
|
||||
dnl
|
||||
dnl Check for PCRE
|
||||
dnl
|
||||
|
||||
AC_CHECK_HEADER(pcre.h,
|
||||
AC_CHECK_LIB(pcre, pcre_compile,
|
||||
[LIBS="${LIBS} -lpcre"
|
||||
AC_DEFINE([HAVE_LIBPCRE], 1,
|
||||
[Define if libpcre is available.])
|
||||
])
|
||||
)
|
||||
|
||||
|
||||
dnl Needed by src/Makefile.am
|
||||
AM_CONDITIONAL([IRI_IS_ENABLED], [test "X$iri" != "Xno"])
|
||||
|
||||
@@ -554,6 +565,23 @@ dnl Create output
|
||||
dnl
|
||||
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile util/Makefile
|
||||
po/Makefile.in tests/Makefile tests/WgetTest.pm
|
||||
lib/Makefile md5/Makefile windows/Makefile])
|
||||
lib/Makefile])
|
||||
AC_CONFIG_HEADERS([src/config.h])
|
||||
AC_OUTPUT
|
||||
|
||||
AC_MSG_NOTICE([Summary of build options:
|
||||
|
||||
Version: $PACKAGE_VERSION
|
||||
Host OS: $host_os
|
||||
Install prefix: $prefix
|
||||
Compiler: $CC
|
||||
CFlags: $CFLAGS $CPPFLAGS
|
||||
LDFlags: $LDFLAGS
|
||||
Libs: $LIBS
|
||||
SSL: $with_ssl
|
||||
Zlib: $with_zlib
|
||||
Digest: $ENABLE_DIGEST
|
||||
NTLM: $ENABLE_NTLM
|
||||
OPIE: $ENABLE_OPIE
|
||||
Debugging: $ENABLE_DEBUG
|
||||
])
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
@echo off
|
||||
rem Configure batch file for `Wget' utility
|
||||
rem Copyright (C) 1995, 1996, 1997, 2007, 2008, 2009 Free Software
|
||||
rem Foundation, Inc.
|
||||
|
||||
rem This program is free software; you can redistribute it and/or modify
|
||||
rem it under the terms of the GNU General Public License as published by
|
||||
rem the Free Software Foundation; either version 3 of the License, or
|
||||
rem (at your option) any later version.
|
||||
|
||||
rem This program is distributed in the hope that it will be useful,
|
||||
rem but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
rem GNU General Public License for more details.
|
||||
|
||||
rem You should have received a copy of the GNU General Public License
|
||||
rem along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
rem Additional permission under GNU GPL version 3 section 7
|
||||
|
||||
rem If you modify this program, or any covered work, by linking or
|
||||
rem combining it with the OpenSSL project's OpenSSL library (or a
|
||||
rem modified version of that library), containing parts covered by the
|
||||
rem terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
|
||||
rem grants you additional permission to convey the resulting work.
|
||||
rem Corresponding Source for a non-source form of such a combination
|
||||
rem shall include the source code for the parts of OpenSSL used as well
|
||||
rem as that of the covered work.
|
||||
|
||||
if .%1 == .--borland goto :borland
|
||||
if .%1 == .--mingw goto :mingw
|
||||
if .%1 == .--msvc goto :msvc
|
||||
goto :usage
|
||||
|
||||
:msvc
|
||||
copy windows\Makefile.top Makefile > nul
|
||||
copy windows\Makefile.src src\Makefile > nul
|
||||
copy windows\Makefile.doc doc\Makefile > nul
|
||||
|
||||
echo Type NMAKE to start compiling.
|
||||
echo If it doesn't work, try executing MSDEV\BIN\VCVARS32.BAT first,
|
||||
echo and then NMAKE.
|
||||
goto :end
|
||||
|
||||
:borland
|
||||
copy windows\Makefile.top.bor Makefile > nul
|
||||
copy windows\Makefile.src.bor src\Makefile > nul
|
||||
copy windows\Makefile.doc doc\Makefile > nul
|
||||
|
||||
echo Type MAKE to start compiling.
|
||||
goto :end
|
||||
|
||||
:mingw
|
||||
copy windows\Makefile.top.mingw Makefile > nul
|
||||
copy windows\Makefile.src.mingw src\Makefile > nul
|
||||
copy windows\Makefile.doc doc\Makefile > nul
|
||||
|
||||
echo Type mingw32-make to start compiling.
|
||||
goto :end
|
||||
|
||||
:usage
|
||||
echo "Usage: configure [--borland | --mingw | --msvc]"
|
||||
:end
|
||||
|
||||
copy windows\config.h src\config.h > nul
|
||||
copy windows\config-compiler.h src\config-compiler.h > nul
|
||||
250
doc/ChangeLog
250
doc/ChangeLog
@@ -1,3 +1,195 @@
|
||||
2013-12-29 Giuseppe Scrivano <gscrivan@redhat.com>
|
||||
|
||||
* wget.texi: Update to GFDL 1.3.
|
||||
|
||||
2013-12-22 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* sample.wgetrc: add links to the manual.
|
||||
|
||||
2013-10-06 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||
|
||||
* wget.texi: add/explain quoting of wildcard patterns
|
||||
|
||||
2013-09-04 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||
|
||||
* sample.wgetrc: added "secureprotocol" example
|
||||
* wget.texi (HTTPS (SSL/TLS) Options): Document PFS.
|
||||
|
||||
2013-08-23 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||
|
||||
* sample.wgetrc: added "httpsonly" example
|
||||
|
||||
2013-08-22 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||
|
||||
* wget.texi: added description for --https-only
|
||||
|
||||
2013-08-13 Hrvoje Niksic <hniksic@xemacs.org>
|
||||
|
||||
* wget.texi (Download Options): Fix misspelling.
|
||||
|
||||
2013-07-09 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi (Download Options): Add documentation for --backups.
|
||||
(Wgetrc Commands): Add documentation for backups.
|
||||
Reported by: Tomas Hozza <thozza@redhat.com>.
|
||||
|
||||
2013-07-11 Tomas Hozza <thozza@redhat.com>
|
||||
|
||||
* wget.texi: Document --regex-type and --preserve-permissions.
|
||||
|
||||
2013-06-17 Dave Reisner <dreisner@archlinux.org> (tiny change)
|
||||
|
||||
* texi2pod.pl: Fix formatting error that causes build to fail with
|
||||
Perl 5.18
|
||||
|
||||
2013-06-17 Darshit Shah <darnir@gmail.com>
|
||||
|
||||
* wget.texi (POST): Explain the new redirection rules.
|
||||
* wget.texi (Other HTTP Methods): Same.
|
||||
* wget.texi (body-data): Fix typo in description.
|
||||
|
||||
2013-05-10 Darshit Shah <darnir@gmail.com> (tiny change)
|
||||
|
||||
* wget.texi (No of tries): Fix typo to make it clear that --tries
|
||||
option sets number of tries not retries.
|
||||
Reported by: Hauke Hoffman <haukebjoernhoffman@googlemail.com>
|
||||
|
||||
2013-04-28 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi (Types of Files...): Document --accept-regex,
|
||||
--reject-regex.
|
||||
Reported by: Tomas Hozza <thozza@redhat.com>.
|
||||
|
||||
2013-04-14 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi (Download Options): Document "mega" dot style.
|
||||
|
||||
2013-04-05 Darshit Shah <darnir@gmail.com>
|
||||
|
||||
* doc/wget.texi: Fix ambiguous wording in --post-data section. Make it
|
||||
clear that wget does not check for the format of the post-data.
|
||||
* doc/wget.texi: Add documentation for --method, --body-data and
|
||||
--body-file.
|
||||
|
||||
2012-10-08 Stefano Lattarini <stefano.lattarini@gmail.com> (tiny change)
|
||||
|
||||
docs: fix errors and warnings with Texinfo 5
|
||||
Or rather, with the development version 4.13.90, which will
|
||||
eventually become Texinfo 5.0.
|
||||
* wget.texi: Use '@item' instead of '@itemx' in several places,
|
||||
as Texinfo 5 refuses to process an '@itemx' that is not preceded
|
||||
by an '@item'.
|
||||
|
||||
2012-08-28 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||
|
||||
* doc/wget.texi: remove -nv from --report-speed
|
||||
|
||||
2012-08-04 mancha <mancha@mac.hush.com> (tiny change)
|
||||
|
||||
* wget.texi: Export ENVIRONMENT to the man page.
|
||||
|
||||
2012-06-09 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi (Logging and Input File Options): Document "--report-speed".
|
||||
(HTTPS (SSL/TLS) Options): Document WARC.
|
||||
|
||||
* texi2pod.pl: Revert change from 2011-08-06.
|
||||
|
||||
2012-05-13 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi (Types of Files): Document --accept-regex and
|
||||
--reject-regex.
|
||||
|
||||
2011-10-02 Henrik Holst <henrik.holst@millistream.com> (tiny change)
|
||||
|
||||
* wget.texi (HTTP Options): Document option --content-on-error.
|
||||
|
||||
2011-09-27 Karl Berry <karl@freefriends.org> (tiny change)
|
||||
|
||||
* wget.texi: Make dir entry consistent with others.
|
||||
|
||||
2011-08-18 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* texi2pod.pl: Don't assume the perl executable is under /usr/bin/.
|
||||
|
||||
2011-08-06 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi (Wgetrc Commands): Document show_all_dns_entries.
|
||||
|
||||
* Makefile.am (wget.pod): Pass the VERSION value to texi2pod.
|
||||
|
||||
* texi2pod.pl: Update from GCC.
|
||||
|
||||
2011-07-28 Noèl Köthe <noel@debian.org> (tiny change)
|
||||
|
||||
* wget.texi (HTTP Options): Fix typo.
|
||||
|
||||
2011-07-26 Giuseppe Scrivano <giuseppe@southpole.se>
|
||||
|
||||
* wget.info (cookies): Remove reference to --cookies.
|
||||
Reported by: Noèl Köthe.
|
||||
|
||||
2011-07-05 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi (Recursive Retrieval Options): Make clearer that recursion,
|
||||
by default, uses 5 levels.
|
||||
Reported by: Marc Deop <damnshock@gmail.com>.
|
||||
|
||||
2011-03-21 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi: Do not cite the current maintainer.
|
||||
Reported by: Micah Cowan <micah@cowan.name>.
|
||||
|
||||
2010-12-22 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi (HTTP Options): Remove sentence which doesn't reflect
|
||||
the wget behaviour when -k -K are used with -E.
|
||||
Reported by: pike-wget@kw.nl.
|
||||
|
||||
2010-08-08 Reza Snowdon <vivi@mage.me.uk>
|
||||
* wget.texi: Added information about the config option to the
|
||||
'Overview' section and a description of the option in
|
||||
'Logging and Input File Options'.
|
||||
|
||||
2010-10-26 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi (Download Options): Remove unclear statement about the
|
||||
--waitretry option.
|
||||
Reported by: Manfred Koizar <mkoi-pg@aon.at>.
|
||||
|
||||
2010-09-25 Merinov Nikolay <kim.roader@gmail.com>
|
||||
|
||||
* wget.texi (Download Options): Document --unlink option.
|
||||
|
||||
2010-09-13 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi (Recursive Accept/Reject Options): Remove superfluous dot.
|
||||
Reported by: Snader_LB.
|
||||
|
||||
2010-07-28 Alon Bar-Lev <alon.barlev@gmail.com> (tiny change)
|
||||
|
||||
* texi2pod.pl: Use the warnings module only when it is available.
|
||||
|
||||
2010-05-27 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* wget.texi (Download Options): Document that -k can be used with -O
|
||||
only with regular files.
|
||||
|
||||
2010-05-08 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||
|
||||
* Makefile.am: Update copyright years.
|
||||
|
||||
* fdl.texi: Likewise.
|
||||
|
||||
* texi2pod.pl: Likewise.
|
||||
|
||||
* wget.texi: Likewise.
|
||||
|
||||
2010-01-09 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* wget.texi (Download Options): Documented
|
||||
--no-use-server-timestamps.
|
||||
|
||||
2009-09-04 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* wget.texi (Time-Stamping): "older" -> "not newer".
|
||||
@@ -74,10 +266,10 @@
|
||||
|
||||
2008-11-15 Steven Schubiger <stsc@members.fsf.org>
|
||||
|
||||
* sample.wgetrc: Comment the waitretry "default" value,
|
||||
* sample.wgetrc: Comment the waitretry "default" value,
|
||||
because there is a global one now.
|
||||
|
||||
* wget.texi (Download Options): Mention the global
|
||||
* wget.texi (Download Options): Mention the global
|
||||
default value.
|
||||
|
||||
2008-11-10 Micah Cowan <micah@cowan.name>
|
||||
@@ -89,7 +281,7 @@
|
||||
added subsection headings.
|
||||
|
||||
Update node pointers.
|
||||
|
||||
|
||||
2008-11-05 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* wget.texi: Move --no-http-keep-alive from FTP Options to HTTP
|
||||
@@ -108,7 +300,7 @@
|
||||
|
||||
2008-09-30 Steven Schubiger <stsc@members.fsf.org>
|
||||
|
||||
* wget.texi (Wgetrc Commands): Add default_page, save_headers,
|
||||
* wget.texi (Wgetrc Commands): Add default_page, save_headers,
|
||||
spider and user_agent to the list of recognized commands.
|
||||
|
||||
2008-09-10 Michael Kessler <kessler.michael@aon.at>
|
||||
@@ -569,15 +761,15 @@
|
||||
to 1.4.
|
||||
|
||||
2005-02-11 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||
|
||||
|
||||
* wget.texi: Added Simone Piunno as new contributor.
|
||||
|
||||
|
||||
2005-01-01 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||
|
||||
* wget.texi: Updated copyright information, added new contributors.
|
||||
|
||||
2004-11-20 Hans-Andreas Engel <engel@node.ch>
|
||||
|
||||
|
||||
* wget.texi: Describe limitations of combining `-O' with `-k'.
|
||||
|
||||
2004-05-13 Nico R. <n-roeser@gmx.net>
|
||||
@@ -886,12 +1078,12 @@
|
||||
* wget.texi (Recursive Retrieval Options): Explained that you need
|
||||
to use -r -l1 -p to get the two levels of requisites for a
|
||||
<FRAMESET> page. Also made a few other wording improvements.
|
||||
|
||||
|
||||
2001-03-17 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* Makefile.in: Using '^' in the sed call caused a weird failure on
|
||||
* Makefile.in: Using '^' in the sed call caused a weird failure on
|
||||
Solaris 2.6. Changed it to a ','. Defined top_builddir.
|
||||
|
||||
|
||||
2001-02-23 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* wget.texi: Corrections, clarifications, and English fixes to
|
||||
@@ -900,7 +1092,7 @@
|
||||
Alphabetized FTP options by long option name. Mentioned that
|
||||
.listing symlinked to /etc/passwd is not a security hole, but that
|
||||
other files could be, so root shouldn't run wget in user dirs.
|
||||
|
||||
|
||||
2001-02-22 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* Makefile.in: Make wget man page and install it if we have
|
||||
@@ -913,12 +1105,12 @@
|
||||
fails -- fixed call of texi2pod.pl that did this wrong.
|
||||
|
||||
* texi2pod.pl: Removed from CVS. Now automatically generated.
|
||||
|
||||
|
||||
* texi2pod.pl.in: This new file is processed into texi2pod.pl,
|
||||
getting the appropriate path to the Perl 5+ executable on this
|
||||
system and becoming executable (CVS files, by contrast, don't
|
||||
arrive executable).
|
||||
|
||||
|
||||
2001-02-19 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* wget.texi (Download Options): Further improvement to --continue
|
||||
@@ -929,20 +1121,20 @@
|
||||
|
||||
* wget.texi (Reporting Bugs): Deleted the setence about Cc-ing the
|
||||
bug report to Wget mailing list as the bug report address is an
|
||||
alias for the mailing ist anyway.
|
||||
alias for the mailing ist anyway.
|
||||
(Mailing List): Added URL for the alternate archive.
|
||||
|
||||
|
||||
* wget.texi: Bunch of cosmetical changes.
|
||||
|
||||
|
||||
* Makefile.in: Added targets for manpage generation using
|
||||
texi2pod.pl and pod2man (comes with Perl5). As we cannot rely on
|
||||
Perl5 being available on the system, manpage is not being built
|
||||
automatically. Updated '*clean' targets to remove
|
||||
'sample.wgetrc.munged...', 'wget.pod', and 'wget.man'.
|
||||
|
||||
|
||||
* texi2pod.pl: New file copied from GCC distribution to facilitate
|
||||
automatic manpage generation.
|
||||
|
||||
|
||||
2001-01-09 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* wget.texi (Download Options): Did a bunch of clarification and
|
||||
@@ -954,7 +1146,7 @@
|
||||
the best way to go about my aim. Removed them in favor of:
|
||||
|
||||
* ChangeLog-branches/1.6_branch.ChangeLog: New file.
|
||||
|
||||
|
||||
2000-12-31 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* Makefile.in (distclean): sample.wgetrc.munged_for_texi_inclusion
|
||||
@@ -963,11 +1155,11 @@
|
||||
regenerated, forcing people to have makeinfo installed
|
||||
unnecessarily. We could use a kludge of a 0-length file in the
|
||||
distro, but the file isn't that big and should compress very well.
|
||||
|
||||
|
||||
* wget.texi: Changed "VERSION 1.5.3+dev" to "VERSION 1.7-dev" and
|
||||
"UPDATED Feb 2000" to "UPDATED Dec 2000". Like the comment in the
|
||||
file says, it'd be nice if these were handled automatically...
|
||||
|
||||
|
||||
* ChangeLog: Since this flat file doesn't have multiple branches,
|
||||
looking at the dates would make you think that things went into
|
||||
1.6 that actually just went into the 1.7-dev branch. Added "[Not
|
||||
@@ -1024,11 +1216,11 @@
|
||||
* wget.texi (Recursive Retrieval Options): Improved --delete-after docs.
|
||||
(Download Options): Documented Rob Mayoff's new --bind-address option.
|
||||
(Wgetrc Commands): Documented Rob Mayoff's new bind_address command.
|
||||
|
||||
|
||||
2000-10-20 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* wget.texi (Recursive Retrieval Options): Sugg. -E on 1-page download.
|
||||
|
||||
|
||||
2000-10-19 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* wget.texi (HTTP Options): Documented my new -E / --html-extension.
|
||||
@@ -1036,7 +1228,7 @@
|
||||
John Daily's "quad" values (which I renamed to "lockable
|
||||
Boolean"). When I documented Damir Dzeko's --referer, I forgot to
|
||||
add the .wgetrc equivalent; mentioned the "referrer" spelling issue.
|
||||
|
||||
|
||||
2000-10-09 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* wget.texi (FTP Options): --retr-symlinks wasn't documented properly.
|
||||
@@ -1045,7 +1237,7 @@
|
||||
|
||||
* wget.texi (Recursive Retrieval Options): Documented new -p option.
|
||||
(Wgetrc Commands): Documented -p's equvialent, page_requisites.
|
||||
|
||||
|
||||
2000-08-23 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* wget.texi (Download Options): Using -c on a file that's already fully
|
||||
@@ -1054,7 +1246,7 @@
|
||||
* wget.texi (Logging and Input File Options): -B / --base was not
|
||||
documented as a separate item, and the .wgetrc version was misleading.
|
||||
|
||||
* wget.texi (Wgetrc Commands): Changed all instances of
|
||||
* wget.texi (Wgetrc Commands): Changed all instances of
|
||||
", the same as" to the more grammatical " -- the same as".
|
||||
|
||||
2000-08-22 Dan Harkless <wget@harkless.org>
|
||||
@@ -1080,12 +1272,12 @@
|
||||
2000-04-18 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* sample.wgetrc: Realized I put a global setting in the local section.
|
||||
|
||||
|
||||
2000-04-13 Dan Harkless <wget@harkless.org>
|
||||
|
||||
* Makefile.in (sample.wgetrc.munged_for_texi_inclusion): Added
|
||||
build, dependencies, and distclean cleanup of this new file.
|
||||
|
||||
|
||||
* sample.wgetrc: Uncommented waitretry and set it to 10, clarified
|
||||
some wording, and re-wrapped some text to 71 columns due to
|
||||
@sample indentation in wget.texi.
|
||||
@@ -1102,7 +1294,7 @@
|
||||
times I ran `make install' after changing sample.wgetrc. Added
|
||||
blank lines around the message and a "<Hit RETURN to
|
||||
acknowledge>", and reworded the message to be a bit more clear.
|
||||
|
||||
|
||||
* sample.wgetrc: Added entries for backup_converted and waitretry.
|
||||
|
||||
* wget.texi (Download Options and Wgetrc Commands): Herold Heiko
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile for `wget' utility
|
||||
# Copyright (C) 1995, 1996, 1997, 2007, 2008, 2009 Free Software
|
||||
# Foundation, Inc.
|
||||
# Copyright (C) 1995, 1996, 1997, 2007, 2008, 2009, 2010, 2011 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
|
||||
@@ -54,7 +54,7 @@ EXTRA_DIST = sample.wgetrc \
|
||||
texi2pod.pl
|
||||
|
||||
wget.pod: $(srcdir)/wget.texi version.texi
|
||||
$(TEXI2POD) $(srcdir)/wget.texi $@
|
||||
$(TEXI2POD) -D VERSION="$(VERSION)" $(srcdir)/wget.texi $@
|
||||
|
||||
$(MAN): wget.pod
|
||||
$(POD2MAN) --center="GNU Wget" --release="GNU Wget @VERSION@" $? > $@
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
@c hence no sectioning command or @node.
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008, 2009 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008, 2009, 2010, 2011
|
||||
Free Software Foundation, Inc.
|
||||
@uref{http://fsf.org/}
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
## You can use this file to change the default behaviour of wget or to
|
||||
## avoid having to type many many command-line options. This file does
|
||||
## not contain a comprehensive list of commands -- look at the manual
|
||||
## to find out what you can put into this file.
|
||||
## to find out what you can put into this file. You can find this here:
|
||||
## $ info wget.info 'Startup File'
|
||||
## Or online here:
|
||||
## https://www.gnu.org/software/wget/manual/wget.html#Startup-File
|
||||
##
|
||||
## Wget initialization file can reside in /usr/local/etc/wgetrc
|
||||
## (global, for all users) or $HOME/.wgetrc (for a single user).
|
||||
@@ -123,3 +126,9 @@
|
||||
|
||||
# Force the default remote server encoding
|
||||
#remoteencoding = UTF-8
|
||||
|
||||
# Turn on to prevent following non-HTTPS links when in recursive mode
|
||||
#httpsonly = off
|
||||
|
||||
# Tune HTTPS security (auto, SSLv2, SSLv3, TLSv1, PFS)
|
||||
#secureprotocol = auto
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#! /usr/bin/env perl
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2003, 2007, 2009 Free Software
|
||||
# Foundation, Inc.
|
||||
# Copyright (C) 1999, 2000, 2001, 2003, 2007, 2009, 2010, 2011 Free
|
||||
# Software Foundation, Inc.
|
||||
|
||||
# This file is part of GCC.
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
# something suitable for a manpage from a Texinfo document.
|
||||
|
||||
use warnings;
|
||||
BEGIN { eval { require warnings; } and warnings->import; }
|
||||
|
||||
$output = 0;
|
||||
$skipping = 0;
|
||||
@@ -290,7 +291,7 @@ while(<$inf>) {
|
||||
if (defined $1) {
|
||||
my $thing = $1;
|
||||
if ($ic =~ /\@asis/) {
|
||||
$_ = "\n=item $thing\n";
|
||||
$_ = "\n=item C<$thing>\n";
|
||||
} else {
|
||||
# Entity escapes prevent munging by the <> processing below.
|
||||
$_ = "\n=item $ic\<$thing\>\n";
|
||||
|
||||
266
doc/wget.texi
266
doc/wget.texi
@@ -20,9 +20,9 @@
|
||||
@set Wget Wget
|
||||
@c man title Wget The non-interactive network downloader.
|
||||
|
||||
@dircategory Network Applications
|
||||
@dircategory Network applications
|
||||
@direntry
|
||||
* Wget: (wget). The non-interactive network downloader.
|
||||
* Wget: (wget). Non-interactive network downloader.
|
||||
@end direntry
|
||||
|
||||
@copying
|
||||
@@ -31,7 +31,8 @@ data.
|
||||
|
||||
@c man begin COPYRIGHT
|
||||
Copyright @copyright{} 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||
2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
@iftex
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
@@ -46,11 +47,11 @@ notice identical to this one except for the removal of this paragraph
|
||||
(this paragraph not being relevant to the printed manual).
|
||||
@end ignore
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
|
||||
copy of the license is included in the section entitled ``GNU Free
|
||||
Documentation License''.
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the section entitled
|
||||
``GNU Free Documentation License''.
|
||||
@c man end
|
||||
@end copying
|
||||
|
||||
@@ -63,7 +64,6 @@ Documentation License''.
|
||||
@ignore
|
||||
@c man begin AUTHOR
|
||||
Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
|
||||
Currently maintained by Micah Cowan <micah@cowan.name>.
|
||||
@c man end
|
||||
@c man begin SEEALSO
|
||||
This is @strong{not} the complete manual for GNU Wget.
|
||||
@@ -190,7 +190,9 @@ gauge can be customized to your preferences.
|
||||
Most of the features are fully configurable, either through command line
|
||||
options, or via the initialization file @file{.wgetrc} (@pxref{Startup
|
||||
File}). Wget allows you to define @dfn{global} startup files
|
||||
(@file{/usr/local/etc/wgetrc} by default) for site settings.
|
||||
(@file{/usr/local/etc/wgetrc} by default) for site settings. You can also
|
||||
specify the location of a startup file with the --config option.
|
||||
|
||||
|
||||
@ignore
|
||||
@c man begin FILES
|
||||
@@ -477,6 +479,9 @@ Turn off verbose without being completely quiet (use @samp{-q} for
|
||||
that), which means that error messages and basic information still get
|
||||
printed.
|
||||
|
||||
@item --report-speed=@var{type}
|
||||
Output bandwidth as @var{type}. The only accepted value is @samp{bits}.
|
||||
|
||||
@cindex input-file
|
||||
@item -i @var{file}
|
||||
@itemx --input-file=@var{file}
|
||||
@@ -524,6 +529,10 @@ presence of a @code{BASE} tag in the @sc{html} input file, with
|
||||
For instance, if you specify @samp{http://foo/bar/a.html} for
|
||||
@var{URL}, and Wget reads @samp{../baz/b.html} from the input file, it
|
||||
would be resolved to @samp{http://foo/baz/b.html}.
|
||||
|
||||
@cindex specify config
|
||||
@item --config=@var{FILE}
|
||||
Specify the location of a startup file you wish to use.
|
||||
@end table
|
||||
|
||||
@node Download Options, Directory Options, Logging and Input File Options, Invoking
|
||||
@@ -541,10 +550,10 @@ IPs.
|
||||
|
||||
@cindex retries
|
||||
@cindex tries
|
||||
@cindex number of retries
|
||||
@cindex number of tries
|
||||
@item -t @var{number}
|
||||
@itemx --tries=@var{number}
|
||||
Set number of retries to @var{number}. Specify 0 or @samp{inf} for
|
||||
Set number of tries to @var{number}. Specify 0 or @samp{inf} for
|
||||
infinite retrying. The default is to retry 20 times, with the exception
|
||||
of fatal errors like ``connection refused'' or ``not found'' (404),
|
||||
which are not retried.
|
||||
@@ -579,7 +588,8 @@ some cases where this behavior can actually have some use.
|
||||
Note that a combination with @samp{-k} is only permitted when
|
||||
downloading a single document, as in that case it will just convert
|
||||
all relative URIs to external ones; @samp{-k} makes no sense for
|
||||
multiple URIs when they're all being downloaded to a single file.
|
||||
multiple URIs when they're all being downloaded to a single file;
|
||||
@samp{-k} can be used only when the output is a regular file.
|
||||
|
||||
@cindex clobbering, file
|
||||
@cindex downloading multiple times
|
||||
@@ -620,6 +630,13 @@ Note that when @samp{-nc} is specified, files with the suffixes
|
||||
@samp{.html} or @samp{.htm} will be loaded from the local disk and
|
||||
parsed as if they had been retrieved from the Web.
|
||||
|
||||
@cindex backing up files
|
||||
@item --backups=@var{backups}
|
||||
Before (over)writing a file, back up an existing file by adding a
|
||||
@samp{.1} suffix (@samp{_1} on VMS) to the file name. Such backup
|
||||
files are rotated to @samp{.2}, @samp{.3}, and so on, up to
|
||||
@var{backups} (and lost beyond that).
|
||||
|
||||
@cindex continue retrieval
|
||||
@cindex incomplete downloads
|
||||
@cindex resume download
|
||||
@@ -705,9 +722,12 @@ different meaning to one dot. With the @code{default} style each dot
|
||||
represents 1K, there are ten dots in a cluster and 50 dots in a line.
|
||||
The @code{binary} style has a more ``computer''-like orientation---8K
|
||||
dots, 16-dots clusters and 48 dots per line (which makes for 384K
|
||||
lines). The @code{mega} style is suitable for downloading very large
|
||||
lines). The @code{mega} style is suitable for downloading large
|
||||
files---each dot represents 64K retrieved, there are eight dots in a
|
||||
cluster, and 48 dots on each line (so each line contains 3M).
|
||||
If @code{mega} is not enough then you can use the @code{giga}
|
||||
style---each dot represents 1M retrieved, there are eight dots in a
|
||||
cluster, and 32 dots on each line (so each line contains 32M).
|
||||
|
||||
Note that you can set the default style using the @code{progress}
|
||||
command in @file{.wgetrc}. That setting may be overridden from the
|
||||
@@ -719,6 +739,16 @@ use @samp{--progress=bar:force}.
|
||||
@itemx --timestamping
|
||||
Turn on time-stamping. @xref{Time-Stamping}, for details.
|
||||
|
||||
@item --no-use-server-timestamps
|
||||
Don't set the local file's timestamp by the one on the server.
|
||||
|
||||
By default, when a file is downloaded, its timestamps are set to
|
||||
match those from the remote file. This allows the use of
|
||||
@samp{--timestamping} on subsequent invocations of wget. However, it
|
||||
is sometimes useful to base the local file's timestamp on when it was
|
||||
actually downloaded; for that purpose, the
|
||||
@samp{--no-use-server-timestamps} option has been provided.
|
||||
|
||||
@cindex server response, print
|
||||
@item -S
|
||||
@itemx --server-response
|
||||
@@ -830,9 +860,7 @@ If you don't want Wget to wait between @emph{every} retrieval, but only
|
||||
between retries of failed downloads, you can use this option. Wget will
|
||||
use @dfn{linear backoff}, waiting 1 second after the first failure on a
|
||||
given file, then waiting 2 seconds after the second failure on that
|
||||
file, up to the maximum number of @var{seconds} you specify. Therefore,
|
||||
a value of 10 will actually make Wget wait up to (1 + 2 + ... + 10) = 55
|
||||
seconds per file.
|
||||
file, up to the maximum number of @var{seconds} you specify.
|
||||
|
||||
By default, Wget will assume a value of 10 seconds.
|
||||
|
||||
@@ -857,7 +885,7 @@ recommendation to block many unrelated users from a web site due to the
|
||||
actions of one.
|
||||
|
||||
@cindex proxy
|
||||
@itemx --no-proxy
|
||||
@item --no-proxy
|
||||
Don't use proxies, even if the appropriate @code{*_proxy} environment
|
||||
variable is defined.
|
||||
|
||||
@@ -958,7 +986,7 @@ are outside the range of @sc{ascii} characters (that is, greater than
|
||||
whose encoding does not match the one used locally.
|
||||
|
||||
@cindex IPv6
|
||||
@itemx -4
|
||||
@item -4
|
||||
@itemx --inet4-only
|
||||
@itemx -6
|
||||
@itemx --inet6-only
|
||||
@@ -1064,6 +1092,13 @@ header and in HTML @code{Content-Type http-equiv} meta tag.
|
||||
You can set the default encoding using the @code{remoteencoding}
|
||||
command in @file{.wgetrc}. That setting may be overridden from the
|
||||
command line.
|
||||
|
||||
@cindex unlink
|
||||
@item --unlink
|
||||
|
||||
Force Wget to unlink file instead of clobbering existing file. This
|
||||
option is useful for downloading to the directory with hardlinks.
|
||||
|
||||
@end table
|
||||
|
||||
@node Directory Options, HTTP Options, Download Options, Invoking
|
||||
@@ -1166,10 +1201,7 @@ Note that filenames changed in this way will be re-downloaded every time
|
||||
you re-mirror a site, because Wget can't tell that the local
|
||||
@file{@var{X}.html} file corresponds to remote URL @samp{@var{X}} (since
|
||||
it doesn't yet know that the URL produces output of type
|
||||
@samp{text/html} or @samp{application/xhtml+xml}. To prevent this
|
||||
re-downloading, you must use @samp{-k} and @samp{-K} so that the original
|
||||
version of the file will be saved as @file{@var{X}.orig} (@pxref{Recursive
|
||||
Retrieval Options}).
|
||||
@samp{text/html} or @samp{application/xhtml+xml}.
|
||||
|
||||
As of version 1.12, Wget will also ensure that any downloaded files of
|
||||
type @samp{text/css} end in the suffix @samp{.css}, and the option was
|
||||
@@ -1426,7 +1458,7 @@ data, whereas @samp{--post-file} sends the contents of @var{file}.
|
||||
Other than that, they work in exactly the same way. In particular,
|
||||
they @emph{both} expect content of the form @code{key1=value1&key2=value2},
|
||||
with percent-encoding for special characters; the only difference is
|
||||
that one expects its content as a command-line paramter and the other
|
||||
that one expects its content as a command-line parameter and the other
|
||||
accepts its content from a file. In particular, @samp{--post-file} is
|
||||
@emph{not} for transmitting files as form attachments: those must
|
||||
appear as @code{key=value} data (with appropriate percent-coding) just
|
||||
@@ -1435,6 +1467,11 @@ like everything else. Wget does not currently support
|
||||
@code{application/x-www-form-urlencoded}. Only one of
|
||||
@samp{--post-data} and @samp{--post-file} should be specified.
|
||||
|
||||
Please note that wget does not require the content to be of the form
|
||||
@code{key1=value1&key2=value2}, and neither does it test for it. Wget will
|
||||
simply transmit whatever data is provided to it. Most servers however expect
|
||||
the POST data to be in the above format when processing HTML Forms.
|
||||
|
||||
Please be aware that Wget needs to know the size of the POST data in
|
||||
advance. Therefore the argument to @code{--post-file} must be a regular
|
||||
file; specifying a FIFO or something like @file{/dev/stdin} won't work.
|
||||
@@ -1445,14 +1482,15 @@ use chunked unless it knows it's talking to an HTTP/1.1 server. And it
|
||||
can't know that until it receives a response, which in turn requires the
|
||||
request to have been completed -- a chicken-and-egg problem.
|
||||
|
||||
Note: if Wget is redirected after the POST request is completed, it
|
||||
will not send the POST data to the redirected URL. This is because
|
||||
URLs that process POST often respond with a redirection to a regular
|
||||
page, which does not desire or accept POST. It is not completely
|
||||
clear that this behavior is optimal; if it doesn't work out, it might
|
||||
be changed in the future.
|
||||
Note: As of version 1.15 if Wget is redirected after the POST request is
|
||||
completed, its behaviour will depend on the response code returned by the
|
||||
server. In case of a 301 Moved Permanently, 302 Moved Temporarily or
|
||||
307 Temporary Redirect, Wget will, in accordance with RFC2616, continue
|
||||
to send a POST request.
|
||||
In case a server wants the client to change the Request method upon
|
||||
redirection, it should send a 303 See Other response code.
|
||||
|
||||
This example shows how to log to a server using POST and then proceed to
|
||||
This example shows how to log in to a server using POST and then proceed to
|
||||
download the desired pages, presumably only accessible to authorized
|
||||
users:
|
||||
|
||||
@@ -1475,6 +1513,37 @@ them (and neither will browsers) and the @file{cookies.txt} file will
|
||||
be empty. In that case use @samp{--keep-session-cookies} along with
|
||||
@samp{--save-cookies} to force saving of session cookies.
|
||||
|
||||
@cindex Other HTTP Methods
|
||||
@item --method=@var{HTTP-Method}
|
||||
For the purpose of RESTful scripting, Wget allows sending of other HTTP Methods
|
||||
without the need to explicitly set them using @samp{--header=Header-Line}.
|
||||
Wget will use whatever string is passed to it after @samp{--method} as the HTTP
|
||||
Method to the server.
|
||||
|
||||
@item --body-data=@var{Data-String}
|
||||
@itemx --body-file=@var{Data-File}
|
||||
Must be set when additional data needs to be sent to the server along with the
|
||||
Method specified using @samp{--method}. @samp{--body-data} sends @var{string} as
|
||||
data, whereas @samp{--body-file} sends the contents of @var{file}. Other than that,
|
||||
they work in exactly the same way.
|
||||
|
||||
Currently, @samp{--body-file} is @emph{not} for transmitting files as a whole.
|
||||
Wget does not currently support @code{multipart/form-data} for transmitting data;
|
||||
only @code{application/x-www-form-urlencoded}. In the future, this may be changed
|
||||
so that wget sends the @samp{--body-file} as a complete file instead of sending its
|
||||
contents to the server. Please be aware that Wget needs to know the contents of
|
||||
BODY Data in advance, and hence the argument to @samp{--body-file} should be a
|
||||
regular file. See @samp{--post-file} for a more detailed explanation.
|
||||
Only one of @samp{--body-data} and @samp{--body-file} should be specified.
|
||||
|
||||
If Wget is redirected after the request is completed, Wget will
|
||||
suspend the current method and send a GET request till the redirection
|
||||
is completed. This is true for all redirection response codes except
|
||||
307 Temporary Redirect which is used to explicitly specify that the
|
||||
request method should @emph{not} change. Another exception is when
|
||||
the method is set to @code{POST}, in which case the redirection rules
|
||||
specified under @samp{--post-data} are followed.
|
||||
|
||||
@cindex Content-Disposition
|
||||
@item --content-disposition
|
||||
|
||||
@@ -1487,6 +1556,19 @@ This option is useful for some file-downloading CGI programs that use
|
||||
@code{Content-Disposition} headers to describe what the name of a
|
||||
downloaded file should be.
|
||||
|
||||
@cindex Content On Error
|
||||
@item --content-on-error
|
||||
|
||||
If this is set to on, wget will not skip the content when the server responds
|
||||
with a http status code that indicates error.
|
||||
|
||||
@cindex Trust server names
|
||||
@item --trust-server-names
|
||||
|
||||
If this is set to on, on a redirect the last component of the
|
||||
redirection URL will be used as the local file name. By default it is
|
||||
used the last component in the original URL.
|
||||
|
||||
@cindex authentication
|
||||
@item --auth-no-challenge
|
||||
|
||||
@@ -1513,16 +1595,24 @@ without SSL support, none of these options are available.
|
||||
@cindex SSL protocol, choose
|
||||
@item --secure-protocol=@var{protocol}
|
||||
Choose the secure protocol to be used. Legal values are @samp{auto},
|
||||
@samp{SSLv2}, @samp{SSLv3}, and @samp{TLSv1}. If @samp{auto} is used,
|
||||
the SSL library is given the liberty of choosing the appropriate
|
||||
@samp{SSLv2}, @samp{SSLv3}, @samp{TLSv1} and @samp{PFS}. If @samp{auto}
|
||||
is used, the SSL library is given the liberty of choosing the appropriate
|
||||
protocol automatically, which is achieved by sending an SSLv2 greeting
|
||||
and announcing support for SSLv3 and TLSv1. This is the default.
|
||||
|
||||
Specifying @samp{SSLv2}, @samp{SSLv3}, or @samp{TLSv1} forces the use
|
||||
of the corresponding protocol. This is useful when talking to old and
|
||||
buggy SSL server implementations that make it hard for OpenSSL to
|
||||
choose the correct protocol version. Fortunately, such servers are
|
||||
quite rare.
|
||||
buggy SSL server implementations that make it hard for the underlying
|
||||
SSL library to choose the correct protocol version. Fortunately, such
|
||||
servers are quite rare.
|
||||
|
||||
Specifying @samp{PFS} enforces the use of the so-called Perfect Forward
|
||||
Security cipher suites. In short, PFS adds security by creating a one-time
|
||||
key for each SSL connection. It has a bit more CPU impact on client and server.
|
||||
We use known to be secure ciphers (e.g. no MD4) and the TLS protocol.
|
||||
|
||||
@item --https-only
|
||||
When in recursive mode, only HTTPS links are followed.
|
||||
|
||||
@cindex SSL certificate, check
|
||||
@item --no-check-certificate
|
||||
@@ -1626,6 +1716,36 @@ not used), EGD is never contacted. EGD is not needed on modern Unix
|
||||
systems that support @file{/dev/random}.
|
||||
@end table
|
||||
|
||||
@cindex WARC
|
||||
@table @samp
|
||||
@item --warc-file=@var{file}
|
||||
Use @var{file} as the destination WARC file.
|
||||
|
||||
@item --warc-header=@var{string}
|
||||
Use @var{string} into as the warcinfo record.
|
||||
|
||||
@item --warc-max-size=@var{size}
|
||||
Set the maximum size of the WARC files to @var{size}.
|
||||
|
||||
@item --warc-cdx
|
||||
Write CDX index files.
|
||||
|
||||
@item --warc-dedup=@var{file}
|
||||
Do not store records listed in this CDX file.
|
||||
|
||||
@item --no-warc-compression
|
||||
Do not compress WARC files with GZIP.
|
||||
|
||||
@item --no-warc-digests
|
||||
Do not calculate SHA1 digests.
|
||||
|
||||
@item --no-warc-keep-log
|
||||
Do not store the log file in a WARC record.
|
||||
|
||||
@item --warc-tempdir=@var{dir}
|
||||
Specify the location for temporary files created by the WARC writer.
|
||||
@end table
|
||||
|
||||
@node FTP Options, Recursive Retrieval Options, HTTPS (SSL/TLS) Options, Invoking
|
||||
@section FTP Options
|
||||
|
||||
@@ -1711,6 +1831,10 @@ in some rare firewall configurations, active FTP actually works when
|
||||
passive FTP doesn't. If you suspect this to be the case, use this
|
||||
option, or set @code{passive_ftp=off} in your init file.
|
||||
|
||||
@cindex file permissions
|
||||
@item --preserve-permissions
|
||||
Preserve remote file permissions instead of permissions set by umask.
|
||||
|
||||
@cindex symbolic links, retrieving
|
||||
@item --retr-symlinks
|
||||
Usually, when retrieving @sc{ftp} directories recursively and a symbolic
|
||||
@@ -1738,12 +1862,12 @@ case.
|
||||
@item -r
|
||||
@itemx --recursive
|
||||
Turn on recursive retrieving. @xref{Recursive Download}, for more
|
||||
details.
|
||||
details. The default maximum depth is 5.
|
||||
|
||||
@item -l @var{depth}
|
||||
@itemx --level=@var{depth}
|
||||
Specify recursion maximum depth level @var{depth} (@pxref{Recursive
|
||||
Download}). The default maximum depth is 5.
|
||||
Download}).
|
||||
|
||||
@cindex proxy filling
|
||||
@cindex delete after retrieval
|
||||
@@ -1947,6 +2071,17 @@ accept or reject (@pxref{Types of Files}). Note that if
|
||||
any of the wildcard characters, @samp{*}, @samp{?}, @samp{[} or
|
||||
@samp{]}, appear in an element of @var{acclist} or @var{rejlist},
|
||||
it will be treated as a pattern, rather than a suffix.
|
||||
In this case, you have to enclose the pattern into quotes to prevent
|
||||
your shell from expanding it, like in @samp{-A "*.mp3"} or @samp{-A '*.mp3'}.
|
||||
|
||||
@item --accept-regex @var{urlregex}
|
||||
@itemx --reject-regex @var{urlregex}
|
||||
Specify a regular expression to accept or reject the complete URL.
|
||||
|
||||
@item --regex-type @var{regextype}
|
||||
Specify the regular expression type. Possible types are @samp{posix} or
|
||||
@samp{pcre}. Note that to be able to use @samp{pcre} type, wget has to be
|
||||
compiled with libpcre support.
|
||||
|
||||
@item -D @var{domain-list}
|
||||
@itemx --domains=@var{domain-list}
|
||||
@@ -1954,7 +2089,7 @@ Set domains to be followed. @var{domain-list} is a comma-separated list
|
||||
of domains. Note that it does @emph{not} turn on @samp{-H}.
|
||||
|
||||
@item --exclude-domains @var{domain-list}
|
||||
Specify the domains that are @emph{not} to be followed.
|
||||
Specify the domains that are @emph{not} to be followed
|
||||
(@pxref{Spanning Hosts}).
|
||||
|
||||
@cindex follow FTP links
|
||||
@@ -1995,8 +2130,10 @@ dedicated @samp{--page-requisites} option.
|
||||
Ignore case when matching files and directories. This influences the
|
||||
behavior of -R, -A, -I, and -X options, as well as globbing
|
||||
implemented when downloading from FTP sites. For example, with this
|
||||
option, @samp{-A *.txt} will match @samp{file1.txt}, but also
|
||||
option, @samp{-A "*.txt"} will match @samp{file1.txt}, but also
|
||||
@samp{file2.TXT}, @samp{file3.TxT}, and so on.
|
||||
The quotes in the example are to prevent the shell from expanding the
|
||||
pattern.
|
||||
|
||||
@item -H
|
||||
@itemx --span-hosts
|
||||
@@ -2252,6 +2389,8 @@ in @file{.wgetrc}.
|
||||
@item -A @var{acclist}
|
||||
@itemx --accept @var{acclist}
|
||||
@itemx accept = @var{acclist}
|
||||
@itemx --accept-regex @var{urlregex}
|
||||
@itemx accept-regex = @var{urlregex}
|
||||
The argument to @samp{--accept} option is a list of file suffixes or
|
||||
patterns that Wget will download during recursive retrieval. A suffix
|
||||
is the ending part of a file, and consists of ``normal'' letters,
|
||||
@@ -2268,6 +2407,9 @@ a description of how pattern matching works.
|
||||
Of course, any number of suffixes and patterns can be combined into a
|
||||
comma-separated list, and given as an argument to @samp{-A}.
|
||||
|
||||
The argument to @samp{--accept-regex} option is a regular expression which
|
||||
is matched against the complete URL.
|
||||
|
||||
@cindex reject wildcards
|
||||
@cindex reject suffixes
|
||||
@cindex wildcards, reject
|
||||
@@ -2275,6 +2417,8 @@ comma-separated list, and given as an argument to @samp{-A}.
|
||||
@item -R @var{rejlist}
|
||||
@itemx --reject @var{rejlist}
|
||||
@itemx reject = @var{rejlist}
|
||||
@itemx --reject-regex @var{urlregex}
|
||||
@itemx reject-regex = @var{urlregex}
|
||||
The @samp{--reject} option works the same way as @samp{--accept}, only
|
||||
its logic is the reverse; Wget will download all files @emph{except} the
|
||||
ones matching the suffixes (or patterns) in the list.
|
||||
@@ -2286,6 +2430,9 @@ Analogously, to download all files except the ones beginning with
|
||||
expansion by the shell.
|
||||
@end table
|
||||
|
||||
The argument to @samp{--accept-regex} option is a regular expression which
|
||||
is matched against the complete URL.
|
||||
|
||||
@noindent
|
||||
The @samp{-A} and @samp{-R} options may be combined to achieve even
|
||||
better fine-tuning of which files to retrieve. E.g. @samp{wget -A
|
||||
@@ -2754,9 +2901,11 @@ enables it).
|
||||
Enable/disable saving pre-converted files with the suffix
|
||||
@samp{.orig}---the same as @samp{-K} (which enables it).
|
||||
|
||||
@c @item backups = @var{number}
|
||||
@c #### Document me!
|
||||
@c
|
||||
@item backups = @var{number}
|
||||
Use up to @var{number} backups for a file. Backups are rotated by
|
||||
adding an incremental counter that starts at @samp{1}. The default is
|
||||
@samp{0}.
|
||||
|
||||
@item base = @var{string}
|
||||
Consider relative @sc{url}s in input files (specified via the
|
||||
@samp{input} command or the @samp{--input-file}/@samp{-i} option,
|
||||
@@ -2799,6 +2948,10 @@ Set the connect timeout---the same as @samp{--connect-timeout}.
|
||||
Turn on recognition of the (non-standard) @samp{Content-Disposition}
|
||||
HTTP header---if set to @samp{on}, the same as @samp{--content-disposition}.
|
||||
|
||||
@item trust_server_names = on/off
|
||||
If set to on, use the last component of a redirection URL for the local
|
||||
file name.
|
||||
|
||||
@item continue = on/off
|
||||
If set to on, force continuation of preexistent partially retrieved
|
||||
files. See @samp{-c} before setting it.
|
||||
@@ -3014,7 +3167,7 @@ display properly---the same as @samp{-p}.
|
||||
Change setting of passive @sc{ftp}, equivalent to the
|
||||
@samp{--passive-ftp} option.
|
||||
|
||||
@itemx password = @var{string}
|
||||
@item password = @var{string}
|
||||
Specify password @var{string} for both @sc{ftp} and @sc{http} file retrieval.
|
||||
This command can be overridden using the @samp{ftp_password} and
|
||||
@samp{http_password} command for @sc{ftp} and @sc{http} respectively.
|
||||
@@ -3141,6 +3294,10 @@ as @samp{--secure-protocol=@var{string}}.
|
||||
Choose whether or not to print the @sc{http} and @sc{ftp} server
|
||||
responses---the same as @samp{-S}.
|
||||
|
||||
@item show_all_dns_entries = on/off
|
||||
When a DNS name is resolved, show all the IP addresses, not just the first
|
||||
three.
|
||||
|
||||
@item span_hosts = on/off
|
||||
Same as @samp{-H}.
|
||||
|
||||
@@ -3157,6 +3314,10 @@ Set all applicable timeout values to @var{n}, the same as @samp{-T
|
||||
@item timestamping = on/off
|
||||
Turn timestamping on/off. The same as @samp{-N} (@pxref{Time-Stamping}).
|
||||
|
||||
@item use_server_timestamps = on/off
|
||||
If set to @samp{off}, Wget won't set the local file's timestamp by the
|
||||
one on the server (same as @samp{--no-use-server-timestamps}).
|
||||
|
||||
@item tries = @var{n}
|
||||
Set number of retries per @sc{url}---the same as @samp{-t @var{n}}.
|
||||
|
||||
@@ -3488,34 +3649,36 @@ internal networks from the rest of Internet. In order to obtain
|
||||
information from the Web, their users connect and retrieve remote data
|
||||
using an authorized proxy.
|
||||
|
||||
@c man begin ENVIRONMENT
|
||||
Wget supports proxies for both @sc{http} and @sc{ftp} retrievals. The
|
||||
standard way to specify proxy location, which Wget recognizes, is using
|
||||
the following environment variables:
|
||||
|
||||
@table @code
|
||||
@table @env
|
||||
@item http_proxy
|
||||
@itemx https_proxy
|
||||
If set, the @code{http_proxy} and @code{https_proxy} variables should
|
||||
If set, the @env{http_proxy} and @env{https_proxy} variables should
|
||||
contain the @sc{url}s of the proxies for @sc{http} and @sc{https}
|
||||
connections respectively.
|
||||
|
||||
@item ftp_proxy
|
||||
This variable should contain the @sc{url} of the proxy for @sc{ftp}
|
||||
connections. It is quite common that @code{http_proxy} and
|
||||
@code{ftp_proxy} are set to the same @sc{url}.
|
||||
connections. It is quite common that @env{http_proxy} and
|
||||
@env{ftp_proxy} are set to the same @sc{url}.
|
||||
|
||||
@item no_proxy
|
||||
This variable should contain a comma-separated list of domain extensions
|
||||
proxy should @emph{not} be used for. For instance, if the value of
|
||||
@code{no_proxy} is @samp{.mit.edu}, proxy will not be used to retrieve
|
||||
@env{no_proxy} is @samp{.mit.edu}, proxy will not be used to retrieve
|
||||
documents from MIT.
|
||||
@end table
|
||||
@c man end
|
||||
|
||||
In addition to the environment variables, proxy location and settings
|
||||
may be specified from within Wget itself.
|
||||
|
||||
@table @samp
|
||||
@itemx --no-proxy
|
||||
@item --no-proxy
|
||||
@itemx proxy = on/off
|
||||
This option and the corresponding command may be used to suppress the
|
||||
use of proxy, even if the appropriate environment variables are set.
|
||||
@@ -3879,9 +4042,8 @@ me).
|
||||
GNU Wget was written by Hrvoje Nik@v{s}i@'{c} @email{hniksic@@xemacs.org},
|
||||
@end iftex
|
||||
@ifnottex
|
||||
GNU Wget was written by Hrvoje Niksic @email{hniksic@@xemacs.org},
|
||||
GNU Wget was written by Hrvoje Niksic @email{hniksic@@xemacs.org}.
|
||||
@end ifnottex
|
||||
and it is currently maintained by Micah Cowan @email{micah@@cowan.name}.
|
||||
|
||||
However, the development of Wget could never have gone as far as it has, were
|
||||
it not for the help of many people, either with bug reports, feature proposals,
|
||||
@@ -4228,7 +4390,7 @@ subscribers of the Wget mailing list.
|
||||
@appendix Copying this manual
|
||||
|
||||
@menu
|
||||
* GNU Free Documentation License:: Licnse for copying this manual.
|
||||
* GNU Free Documentation License:: License for copying this manual.
|
||||
@end menu
|
||||
|
||||
@node GNU Free Documentation License, , Copying this manual, Copying this manual
|
||||
|
||||
1
gnulib
Submodule
1
gnulib
Submodule
Submodule gnulib added at 0ac90c5a98
1019
lib/Makefile.am
1019
lib/Makefile.am
File diff suppressed because it is too large
Load Diff
489
lib/alloca.c
489
lib/alloca.c
@@ -1,489 +0,0 @@
|
||||
/* alloca.c -- allocate automatically reclaimed memory
|
||||
(Mostly) portable public-domain implementation -- D A Gwyn
|
||||
|
||||
This implementation of the PWB library alloca function,
|
||||
which is used to allocate space off the run-time stack so
|
||||
that it is automatically reclaimed upon procedure exit,
|
||||
was inspired by discussions with J. Q. Johnson of Cornell.
|
||||
J.Otto Tennant <jot@cray.com> contributed the Cray support.
|
||||
|
||||
There are some preprocessor constants that can
|
||||
be defined when compiling for your specific system, for
|
||||
improved efficiency; however, the defaults should be okay.
|
||||
|
||||
The general concept of this implementation is to keep
|
||||
track of all alloca-allocated blocks, and reclaim any
|
||||
that are found to be deeper in the stack than the current
|
||||
invocation. This heuristic does not reclaim storage as
|
||||
soon as it becomes invalid, but it will do so eventually.
|
||||
|
||||
As a special case, alloca(0) reclaims storage without
|
||||
allocating any. It is a good idea to use alloca(0) in
|
||||
your main control loop, etc. to force garbage collection. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <alloca.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef emacs
|
||||
# include "lisp.h"
|
||||
# include "blockinput.h"
|
||||
# ifdef EMACS_FREE
|
||||
# undef free
|
||||
# define free EMACS_FREE
|
||||
# endif
|
||||
#else
|
||||
# define memory_full() abort ()
|
||||
#endif
|
||||
|
||||
/* If compiling with GCC 2, this file's not needed. */
|
||||
#if !defined (__GNUC__) || __GNUC__ < 2
|
||||
|
||||
/* If someone has defined alloca as a macro,
|
||||
there must be some other way alloca is supposed to work. */
|
||||
# ifndef alloca
|
||||
|
||||
# ifdef emacs
|
||||
# ifdef static
|
||||
/* actually, only want this if static is defined as ""
|
||||
-- this is for usg, in which emacs must undefine static
|
||||
in order to make unexec workable
|
||||
*/
|
||||
# ifndef STACK_DIRECTION
|
||||
you
|
||||
lose
|
||||
-- must know STACK_DIRECTION at compile-time
|
||||
/* Using #error here is not wise since this file should work for
|
||||
old and obscure compilers. */
|
||||
# endif /* STACK_DIRECTION undefined */
|
||||
# endif /* static */
|
||||
# endif /* emacs */
|
||||
|
||||
/* If your stack is a linked list of frames, you have to
|
||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||
|
||||
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
long i00afunc ();
|
||||
# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
# else
|
||||
# define ADDRESS_FUNCTION(arg) &(arg)
|
||||
# endif
|
||||
|
||||
/* Define STACK_DIRECTION if you know the direction of stack
|
||||
growth for your system; otherwise it will be automatically
|
||||
deduced at run-time.
|
||||
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
|
||||
# ifndef STACK_DIRECTION
|
||||
# define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
# endif
|
||||
|
||||
# if STACK_DIRECTION != 0
|
||||
|
||||
# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
|
||||
# else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
|
||||
static int stack_dir; /* 1 or -1 once known. */
|
||||
# define STACK_DIR stack_dir
|
||||
|
||||
static void
|
||||
find_stack_direction (void)
|
||||
{
|
||||
static char *addr = NULL; /* Address of first `dummy', once known. */
|
||||
auto char dummy; /* To get stack address. */
|
||||
|
||||
if (addr == NULL)
|
||||
{ /* Initial entry. */
|
||||
addr = ADDRESS_FUNCTION (dummy);
|
||||
|
||||
find_stack_direction (); /* Recurse once. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second entry. */
|
||||
if (ADDRESS_FUNCTION (dummy) > addr)
|
||||
stack_dir = 1; /* Stack grew upward. */
|
||||
else
|
||||
stack_dir = -1; /* Stack grew downward. */
|
||||
}
|
||||
}
|
||||
|
||||
# endif /* STACK_DIRECTION == 0 */
|
||||
|
||||
/* An "alloca header" is used to:
|
||||
(a) chain together all alloca'ed blocks;
|
||||
(b) keep track of stack depth.
|
||||
|
||||
It is very important that sizeof(header) agree with malloc
|
||||
alignment chunk size. The following default should work okay. */
|
||||
|
||||
# ifndef ALIGN_SIZE
|
||||
# define ALIGN_SIZE sizeof(double)
|
||||
# endif
|
||||
|
||||
typedef union hdr
|
||||
{
|
||||
char align[ALIGN_SIZE]; /* To force sizeof(header). */
|
||||
struct
|
||||
{
|
||||
union hdr *next; /* For chaining headers. */
|
||||
char *deep; /* For stack depth measure. */
|
||||
} h;
|
||||
} header;
|
||||
|
||||
static header *last_alloca_header = NULL; /* -> last alloca header. */
|
||||
|
||||
/* Return a pointer to at least SIZE bytes of storage,
|
||||
which will be automatically reclaimed upon exit from
|
||||
the procedure that called alloca. Originally, this space
|
||||
was supposed to be taken from the current stack frame of the
|
||||
caller, but that method cannot be made to work for some
|
||||
implementations of C, for example under Gould's UTX/32. */
|
||||
|
||||
void *
|
||||
alloca (size_t size)
|
||||
{
|
||||
auto char probe; /* Probes stack depth: */
|
||||
register char *depth = ADDRESS_FUNCTION (probe);
|
||||
|
||||
# if STACK_DIRECTION == 0
|
||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||
find_stack_direction ();
|
||||
# endif
|
||||
|
||||
/* Reclaim garbage, defined as all alloca'd storage that
|
||||
was allocated from deeper in the stack than currently. */
|
||||
|
||||
{
|
||||
register header *hp; /* Traverses linked list. */
|
||||
|
||||
# ifdef emacs
|
||||
BLOCK_INPUT;
|
||||
# endif
|
||||
|
||||
for (hp = last_alloca_header; hp != NULL;)
|
||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||
|| (STACK_DIR < 0 && hp->h.deep < depth))
|
||||
{
|
||||
register header *np = hp->h.next;
|
||||
|
||||
free (hp); /* Collect garbage. */
|
||||
|
||||
hp = np; /* -> next header. */
|
||||
}
|
||||
else
|
||||
break; /* Rest are not deeper. */
|
||||
|
||||
last_alloca_header = hp; /* -> last valid storage. */
|
||||
|
||||
# ifdef emacs
|
||||
UNBLOCK_INPUT;
|
||||
# endif
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
return NULL; /* No allocation required. */
|
||||
|
||||
/* Allocate combined header + user data storage. */
|
||||
|
||||
{
|
||||
/* Address of header. */
|
||||
register header *new;
|
||||
|
||||
size_t combined_size = sizeof (header) + size;
|
||||
if (combined_size < sizeof (header))
|
||||
memory_full ();
|
||||
|
||||
new = malloc (combined_size);
|
||||
|
||||
if (! new)
|
||||
memory_full ();
|
||||
|
||||
new->h.next = last_alloca_header;
|
||||
new->h.deep = depth;
|
||||
|
||||
last_alloca_header = new;
|
||||
|
||||
/* User storage begins just after header. */
|
||||
|
||||
return (void *) (new + 1);
|
||||
}
|
||||
}
|
||||
|
||||
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
|
||||
# ifndef CRAY_STACK
|
||||
# define CRAY_STACK
|
||||
# ifndef CRAY2
|
||||
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
||||
struct stack_control_header
|
||||
{
|
||||
long shgrow:32; /* Number of times stack has grown. */
|
||||
long shaseg:32; /* Size of increments to stack. */
|
||||
long shhwm:32; /* High water mark of stack. */
|
||||
long shsize:32; /* Current size of stack (all segments). */
|
||||
};
|
||||
|
||||
/* The stack segment linkage control information occurs at
|
||||
the high-address end of a stack segment. (The stack
|
||||
grows from low addresses to high addresses.) The initial
|
||||
part of the stack segment linkage control information is
|
||||
0200 (octal) words. This provides for register storage
|
||||
for the routine which overflows the stack. */
|
||||
|
||||
struct stack_segment_linkage
|
||||
{
|
||||
long ss[0200]; /* 0200 overflow words. */
|
||||
long sssize:32; /* Number of words in this segment. */
|
||||
long ssbase:32; /* Offset to stack base. */
|
||||
long:32;
|
||||
long sspseg:32; /* Offset to linkage control of previous
|
||||
segment of stack. */
|
||||
long:32;
|
||||
long sstcpt:32; /* Pointer to task common address block. */
|
||||
long sscsnm; /* Private control structure number for
|
||||
microtasking. */
|
||||
long ssusr1; /* Reserved for user. */
|
||||
long ssusr2; /* Reserved for user. */
|
||||
long sstpid; /* Process ID for pid based multi-tasking. */
|
||||
long ssgvup; /* Pointer to multitasking thread giveup. */
|
||||
long sscray[7]; /* Reserved for Cray Research. */
|
||||
long ssa0;
|
||||
long ssa1;
|
||||
long ssa2;
|
||||
long ssa3;
|
||||
long ssa4;
|
||||
long ssa5;
|
||||
long ssa6;
|
||||
long ssa7;
|
||||
long sss0;
|
||||
long sss1;
|
||||
long sss2;
|
||||
long sss3;
|
||||
long sss4;
|
||||
long sss5;
|
||||
long sss6;
|
||||
long sss7;
|
||||
};
|
||||
|
||||
# else /* CRAY2 */
|
||||
/* The following structure defines the vector of words
|
||||
returned by the STKSTAT library routine. */
|
||||
struct stk_stat
|
||||
{
|
||||
long now; /* Current total stack size. */
|
||||
long maxc; /* Amount of contiguous space which would
|
||||
be required to satisfy the maximum
|
||||
stack demand to date. */
|
||||
long high_water; /* Stack high-water mark. */
|
||||
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
|
||||
long hits; /* Number of internal buffer hits. */
|
||||
long extends; /* Number of block extensions. */
|
||||
long stko_mallocs; /* Block allocations by $STKOFEN. */
|
||||
long underflows; /* Number of stack underflow calls ($STKRETN). */
|
||||
long stko_free; /* Number of deallocations by $STKRETN. */
|
||||
long stkm_free; /* Number of deallocations by $STKMRET. */
|
||||
long segments; /* Current number of stack segments. */
|
||||
long maxs; /* Maximum number of stack segments so far. */
|
||||
long pad_size; /* Stack pad size. */
|
||||
long current_address; /* Current stack segment address. */
|
||||
long current_size; /* Current stack segment size. This
|
||||
number is actually corrupted by STKSTAT to
|
||||
include the fifteen word trailer area. */
|
||||
long initial_address; /* Address of initial segment. */
|
||||
long initial_size; /* Size of initial segment. */
|
||||
};
|
||||
|
||||
/* The following structure describes the data structure which trails
|
||||
any stack segment. I think that the description in 'asdef' is
|
||||
out of date. I only describe the parts that I am sure about. */
|
||||
|
||||
struct stk_trailer
|
||||
{
|
||||
long this_address; /* Address of this block. */
|
||||
long this_size; /* Size of this block (does not include
|
||||
this trailer). */
|
||||
long unknown2;
|
||||
long unknown3;
|
||||
long link; /* Address of trailer block of previous
|
||||
segment. */
|
||||
long unknown5;
|
||||
long unknown6;
|
||||
long unknown7;
|
||||
long unknown8;
|
||||
long unknown9;
|
||||
long unknown10;
|
||||
long unknown11;
|
||||
long unknown12;
|
||||
long unknown13;
|
||||
long unknown14;
|
||||
};
|
||||
|
||||
# endif /* CRAY2 */
|
||||
# endif /* not CRAY_STACK */
|
||||
|
||||
# ifdef CRAY2
|
||||
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
||||
I doubt that "lint" will like this much. */
|
||||
|
||||
static long
|
||||
i00afunc (long *address)
|
||||
{
|
||||
struct stk_stat status;
|
||||
struct stk_trailer *trailer;
|
||||
long *block, size;
|
||||
long result = 0;
|
||||
|
||||
/* We want to iterate through all of the segments. The first
|
||||
step is to get the stack status structure. We could do this
|
||||
more quickly and more directly, perhaps, by referencing the
|
||||
$LM00 common block, but I know that this works. */
|
||||
|
||||
STKSTAT (&status);
|
||||
|
||||
/* Set up the iteration. */
|
||||
|
||||
trailer = (struct stk_trailer *) (status.current_address
|
||||
+ status.current_size
|
||||
- 15);
|
||||
|
||||
/* There must be at least one stack segment. Therefore it is
|
||||
a fatal error if "trailer" is null. */
|
||||
|
||||
if (trailer == 0)
|
||||
abort ();
|
||||
|
||||
/* Discard segments that do not contain our argument address. */
|
||||
|
||||
while (trailer != 0)
|
||||
{
|
||||
block = (long *) trailer->this_address;
|
||||
size = trailer->this_size;
|
||||
if (block == 0 || size == 0)
|
||||
abort ();
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
if ((block <= address) && (address < (block + size)))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set the result to the offset in this segment and add the sizes
|
||||
of all predecessor segments. */
|
||||
|
||||
result = address - block;
|
||||
|
||||
if (trailer == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (trailer->this_size <= 0)
|
||||
abort ();
|
||||
result += trailer->this_size;
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
}
|
||||
while (trailer != 0);
|
||||
|
||||
/* We are done. Note that if you present a bogus address (one
|
||||
not in any segment), you will get a different number back, formed
|
||||
from subtracting the address of the first block. This is probably
|
||||
not what you want. */
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
# else /* not CRAY2 */
|
||||
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
||||
Determine the number of the cell within the stack,
|
||||
given the address of the cell. The purpose of this
|
||||
routine is to linearize, in some sense, stack addresses
|
||||
for alloca. */
|
||||
|
||||
static long
|
||||
i00afunc (long address)
|
||||
{
|
||||
long stkl = 0;
|
||||
|
||||
long size, pseg, this_segment, stack;
|
||||
long result = 0;
|
||||
|
||||
struct stack_segment_linkage *ssptr;
|
||||
|
||||
/* Register B67 contains the address of the end of the
|
||||
current stack segment. If you (as a subprogram) store
|
||||
your registers on the stack and find that you are past
|
||||
the contents of B67, you have overflowed the segment.
|
||||
|
||||
B67 also points to the stack segment linkage control
|
||||
area, which is what we are really interested in. */
|
||||
|
||||
stkl = CRAY_STACKSEG_END ();
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
|
||||
/* If one subtracts 'size' from the end of the segment,
|
||||
one has the address of the first word of the segment.
|
||||
|
||||
If this is not the first segment, 'pseg' will be
|
||||
nonzero. */
|
||||
|
||||
pseg = ssptr->sspseg;
|
||||
size = ssptr->sssize;
|
||||
|
||||
this_segment = stkl - size;
|
||||
|
||||
/* It is possible that calling this routine itself caused
|
||||
a stack overflow. Discard stack segments which do not
|
||||
contain the target address. */
|
||||
|
||||
while (!(this_segment <= address && address <= stkl))
|
||||
{
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
||||
# endif
|
||||
if (pseg == 0)
|
||||
break;
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
this_segment = stkl - size;
|
||||
}
|
||||
|
||||
result = address - this_segment;
|
||||
|
||||
/* If you subtract pseg from the current end of the stack,
|
||||
you get the address of the previous stack segment's end.
|
||||
This seems a little convoluted to me, but I'll bet you save
|
||||
a cycle somewhere. */
|
||||
|
||||
while (pseg != 0)
|
||||
{
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o\n", pseg, size);
|
||||
# endif
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
result += size;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
# endif /* not CRAY2 */
|
||||
# endif /* CRAY */
|
||||
|
||||
# endif /* no alloca */
|
||||
#endif /* not GCC version 3 */
|
||||
@@ -1,56 +0,0 @@
|
||||
/* Memory allocation on the stack.
|
||||
|
||||
Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004, 2006, 2007, 2008,
|
||||
2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
|
||||
means there is a real alloca function. */
|
||||
#ifndef _GL_ALLOCA_H
|
||||
#define _GL_ALLOCA_H
|
||||
|
||||
/* alloca (N) returns a pointer to N bytes of memory
|
||||
allocated on the stack, which will last until the function returns.
|
||||
Use of alloca should be avoided:
|
||||
- inside arguments of function calls - undefined behaviour,
|
||||
- in inline functions - the allocation may actually last until the
|
||||
calling function returns,
|
||||
- for huge N (say, N >= 65536) - you never know how large (or small)
|
||||
the stack is, and when the stack cannot fulfill the memory allocation
|
||||
request, the program just crashes.
|
||||
*/
|
||||
|
||||
#ifndef alloca
|
||||
# ifdef __GNUC__
|
||||
# define alloca __builtin_alloca
|
||||
# elif defined _AIX
|
||||
# define alloca __alloca
|
||||
# elif defined _MSC_VER
|
||||
# include <malloc.h>
|
||||
# define alloca _alloca
|
||||
# elif defined __DECC && defined __VMS
|
||||
# define alloca __ALLOCA
|
||||
# else
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
void *alloca (size_t);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* _GL_ALLOCA_H */
|
||||
397
lib/c-ctype.c
397
lib/c-ctype.c
@@ -1,397 +0,0 @@
|
||||
/* Character handling in C locale.
|
||||
|
||||
Copyright 2000, 2001, 2002, 2003, 2006, 2009 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 3 of the License, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#define NO_C_CTYPE_MACROS
|
||||
#include "c-ctype.h"
|
||||
|
||||
/* The function isascii is not locale dependent. Its use in EBCDIC is
|
||||
questionable. */
|
||||
bool
|
||||
c_isascii (int c)
|
||||
{
|
||||
return (c >= 0x00 && c <= 0x7f);
|
||||
}
|
||||
|
||||
bool
|
||||
c_isalnum (int c)
|
||||
{
|
||||
#if C_CTYPE_CONSECUTIVE_DIGITS \
|
||||
&& C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
|
||||
#if C_CTYPE_ASCII
|
||||
return ((c >= '0' && c <= '9')
|
||||
|| ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'));
|
||||
#else
|
||||
return ((c >= '0' && c <= '9')
|
||||
|| (c >= 'A' && c <= 'Z')
|
||||
|| (c >= 'a' && c <= 'z'));
|
||||
#endif
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case '0': case '1': case '2': case '3': case '4': case '5':
|
||||
case '6': case '7': case '8': case '9':
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
|
||||
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
|
||||
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
|
||||
case 'Y': case 'Z':
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
|
||||
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
|
||||
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
|
||||
case 'y': case 'z':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
c_isalpha (int c)
|
||||
{
|
||||
#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
|
||||
#if C_CTYPE_ASCII
|
||||
return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z');
|
||||
#else
|
||||
return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
|
||||
#endif
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
|
||||
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
|
||||
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
|
||||
case 'Y': case 'Z':
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
|
||||
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
|
||||
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
|
||||
case 'y': case 'z':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
c_isblank (int c)
|
||||
{
|
||||
return (c == ' ' || c == '\t');
|
||||
}
|
||||
|
||||
bool
|
||||
c_iscntrl (int c)
|
||||
{
|
||||
#if C_CTYPE_ASCII
|
||||
return ((c & ~0x1f) == 0 || c == 0x7f);
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case ' ': case '!': case '"': case '#': case '$': case '%':
|
||||
case '&': case '\'': case '(': case ')': case '*': case '+':
|
||||
case ',': case '-': case '.': case '/':
|
||||
case '0': case '1': case '2': case '3': case '4': case '5':
|
||||
case '6': case '7': case '8': case '9':
|
||||
case ':': case ';': case '<': case '=': case '>': case '?':
|
||||
case '@':
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
|
||||
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
|
||||
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
|
||||
case 'Y': case 'Z':
|
||||
case '[': case '\\': case ']': case '^': case '_': case '`':
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
|
||||
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
|
||||
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
|
||||
case 'y': case 'z':
|
||||
case '{': case '|': case '}': case '~':
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
c_isdigit (int c)
|
||||
{
|
||||
#if C_CTYPE_CONSECUTIVE_DIGITS
|
||||
return (c >= '0' && c <= '9');
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case '0': case '1': case '2': case '3': case '4': case '5':
|
||||
case '6': case '7': case '8': case '9':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
c_islower (int c)
|
||||
{
|
||||
#if C_CTYPE_CONSECUTIVE_LOWERCASE
|
||||
return (c >= 'a' && c <= 'z');
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
|
||||
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
|
||||
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
|
||||
case 'y': case 'z':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
c_isgraph (int c)
|
||||
{
|
||||
#if C_CTYPE_ASCII
|
||||
return (c >= '!' && c <= '~');
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case '!': case '"': case '#': case '$': case '%': case '&':
|
||||
case '\'': case '(': case ')': case '*': case '+': case ',':
|
||||
case '-': case '.': case '/':
|
||||
case '0': case '1': case '2': case '3': case '4': case '5':
|
||||
case '6': case '7': case '8': case '9':
|
||||
case ':': case ';': case '<': case '=': case '>': case '?':
|
||||
case '@':
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
|
||||
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
|
||||
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
|
||||
case 'Y': case 'Z':
|
||||
case '[': case '\\': case ']': case '^': case '_': case '`':
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
|
||||
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
|
||||
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
|
||||
case 'y': case 'z':
|
||||
case '{': case '|': case '}': case '~':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
c_isprint (int c)
|
||||
{
|
||||
#if C_CTYPE_ASCII
|
||||
return (c >= ' ' && c <= '~');
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case ' ': case '!': case '"': case '#': case '$': case '%':
|
||||
case '&': case '\'': case '(': case ')': case '*': case '+':
|
||||
case ',': case '-': case '.': case '/':
|
||||
case '0': case '1': case '2': case '3': case '4': case '5':
|
||||
case '6': case '7': case '8': case '9':
|
||||
case ':': case ';': case '<': case '=': case '>': case '?':
|
||||
case '@':
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
|
||||
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
|
||||
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
|
||||
case 'Y': case 'Z':
|
||||
case '[': case '\\': case ']': case '^': case '_': case '`':
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
|
||||
case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
|
||||
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
|
||||
case 'y': case 'z':
|
||||
case '{': case '|': case '}': case '~':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
c_ispunct (int c)
|
||||
{
|
||||
#if C_CTYPE_ASCII
|
||||
return ((c >= '!' && c <= '~')
|
||||
&& !((c >= '0' && c <= '9')
|
||||
|| ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')));
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case '!': case '"': case '#': case '$': case '%': case '&':
|
||||
case '\'': case '(': case ')': case '*': case '+': case ',':
|
||||
case '-': case '.': case '/':
|
||||
case ':': case ';': case '<': case '=': case '>': case '?':
|
||||
case '@':
|
||||
case '[': case '\\': case ']': case '^': case '_': case '`':
|
||||
case '{': case '|': case '}': case '~':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
c_isspace (int c)
|
||||
{
|
||||
return (c == ' ' || c == '\t'
|
||||
|| c == '\n' || c == '\v' || c == '\f' || c == '\r');
|
||||
}
|
||||
|
||||
bool
|
||||
c_isupper (int c)
|
||||
{
|
||||
#if C_CTYPE_CONSECUTIVE_UPPERCASE
|
||||
return (c >= 'A' && c <= 'Z');
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
|
||||
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
|
||||
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
|
||||
case 'Y': case 'Z':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
c_isxdigit (int c)
|
||||
{
|
||||
#if C_CTYPE_CONSECUTIVE_DIGITS \
|
||||
&& C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
|
||||
#if C_CTYPE_ASCII
|
||||
return ((c >= '0' && c <= '9')
|
||||
|| ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F'));
|
||||
#else
|
||||
return ((c >= '0' && c <= '9')
|
||||
|| (c >= 'A' && c <= 'F')
|
||||
|| (c >= 'a' && c <= 'f'));
|
||||
#endif
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case '0': case '1': case '2': case '3': case '4': case '5':
|
||||
case '6': case '7': case '8': case '9':
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
c_tolower (int c)
|
||||
{
|
||||
#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
|
||||
return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c);
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case 'A': return 'a';
|
||||
case 'B': return 'b';
|
||||
case 'C': return 'c';
|
||||
case 'D': return 'd';
|
||||
case 'E': return 'e';
|
||||
case 'F': return 'f';
|
||||
case 'G': return 'g';
|
||||
case 'H': return 'h';
|
||||
case 'I': return 'i';
|
||||
case 'J': return 'j';
|
||||
case 'K': return 'k';
|
||||
case 'L': return 'l';
|
||||
case 'M': return 'm';
|
||||
case 'N': return 'n';
|
||||
case 'O': return 'o';
|
||||
case 'P': return 'p';
|
||||
case 'Q': return 'q';
|
||||
case 'R': return 'r';
|
||||
case 'S': return 's';
|
||||
case 'T': return 't';
|
||||
case 'U': return 'u';
|
||||
case 'V': return 'v';
|
||||
case 'W': return 'w';
|
||||
case 'X': return 'x';
|
||||
case 'Y': return 'y';
|
||||
case 'Z': return 'z';
|
||||
default: return c;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
c_toupper (int c)
|
||||
{
|
||||
#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
|
||||
return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c);
|
||||
#else
|
||||
switch (c)
|
||||
{
|
||||
case 'a': return 'A';
|
||||
case 'b': return 'B';
|
||||
case 'c': return 'C';
|
||||
case 'd': return 'D';
|
||||
case 'e': return 'E';
|
||||
case 'f': return 'F';
|
||||
case 'g': return 'G';
|
||||
case 'h': return 'H';
|
||||
case 'i': return 'I';
|
||||
case 'j': return 'J';
|
||||
case 'k': return 'K';
|
||||
case 'l': return 'L';
|
||||
case 'm': return 'M';
|
||||
case 'n': return 'N';
|
||||
case 'o': return 'O';
|
||||
case 'p': return 'P';
|
||||
case 'q': return 'Q';
|
||||
case 'r': return 'R';
|
||||
case 's': return 'S';
|
||||
case 't': return 'T';
|
||||
case 'u': return 'U';
|
||||
case 'v': return 'V';
|
||||
case 'w': return 'W';
|
||||
case 'x': return 'X';
|
||||
case 'y': return 'Y';
|
||||
case 'z': return 'Z';
|
||||
default: return c;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
296
lib/c-ctype.h
296
lib/c-ctype.h
@@ -1,296 +0,0 @@
|
||||
/* Character handling in C locale.
|
||||
|
||||
These functions work like the corresponding functions in <ctype.h>,
|
||||
except that they have the C (POSIX) locale hardwired, whereas the
|
||||
<ctype.h> functions' behaviour depends on the current locale set via
|
||||
setlocale.
|
||||
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2006, 2008, 2009 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 3 of the License, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef C_CTYPE_H
|
||||
#define C_CTYPE_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* The functions defined in this file assume the "C" locale and a character
|
||||
set without diacritics (ASCII-US or EBCDIC-US or something like that).
|
||||
Even if the "C" locale on a particular system is an extension of the ASCII
|
||||
character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
|
||||
is ISO-8859-1), the functions in this file recognize only the ASCII
|
||||
characters. */
|
||||
|
||||
|
||||
/* Check whether the ASCII optimizations apply. */
|
||||
|
||||
/* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that
|
||||
'0', '1', ..., '9' have consecutive integer values. */
|
||||
#define C_CTYPE_CONSECUTIVE_DIGITS 1
|
||||
|
||||
#if ('A' <= 'Z') \
|
||||
&& ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \
|
||||
&& ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \
|
||||
&& ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \
|
||||
&& ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \
|
||||
&& ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \
|
||||
&& ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \
|
||||
&& ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \
|
||||
&& ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \
|
||||
&& ('Y' + 1 == 'Z')
|
||||
#define C_CTYPE_CONSECUTIVE_UPPERCASE 1
|
||||
#endif
|
||||
|
||||
#if ('a' <= 'z') \
|
||||
&& ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \
|
||||
&& ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \
|
||||
&& ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \
|
||||
&& ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \
|
||||
&& ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \
|
||||
&& ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \
|
||||
&& ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \
|
||||
&& ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \
|
||||
&& ('y' + 1 == 'z')
|
||||
#define C_CTYPE_CONSECUTIVE_LOWERCASE 1
|
||||
#endif
|
||||
|
||||
#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
|
||||
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
|
||||
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
|
||||
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
|
||||
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
|
||||
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
|
||||
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
|
||||
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
|
||||
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
|
||||
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
|
||||
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
|
||||
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
|
||||
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
|
||||
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
|
||||
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
|
||||
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
|
||||
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
|
||||
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
|
||||
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
|
||||
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
|
||||
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
|
||||
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)
|
||||
/* The character set is ASCII or one of its variants or extensions, not EBCDIC.
|
||||
Testing the value of '\n' and '\r' is not relevant. */
|
||||
#define C_CTYPE_ASCII 1
|
||||
#endif
|
||||
|
||||
|
||||
/* Function declarations. */
|
||||
|
||||
/* Unlike the functions in <ctype.h>, which require an argument in the range
|
||||
of the 'unsigned char' type, the functions here operate on values that are
|
||||
in the 'unsigned char' range or in the 'char' range. In other words,
|
||||
when you have a 'char' value, you need to cast it before using it as
|
||||
argument to a <ctype.h> function:
|
||||
|
||||
const char *s = ...;
|
||||
if (isalpha ((unsigned char) *s)) ...
|
||||
|
||||
but you don't need to cast it for the functions defined in this file:
|
||||
|
||||
const char *s = ...;
|
||||
if (c_isalpha (*s)) ...
|
||||
*/
|
||||
|
||||
extern bool c_isascii (int c); /* not locale dependent */
|
||||
|
||||
extern bool c_isalnum (int c);
|
||||
extern bool c_isalpha (int c);
|
||||
extern bool c_isblank (int c);
|
||||
extern bool c_iscntrl (int c);
|
||||
extern bool c_isdigit (int c);
|
||||
extern bool c_islower (int c);
|
||||
extern bool c_isgraph (int c);
|
||||
extern bool c_isprint (int c);
|
||||
extern bool c_ispunct (int c);
|
||||
extern bool c_isspace (int c);
|
||||
extern bool c_isupper (int c);
|
||||
extern bool c_isxdigit (int c);
|
||||
|
||||
extern int c_tolower (int c);
|
||||
extern int c_toupper (int c);
|
||||
|
||||
|
||||
#if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS
|
||||
|
||||
/* ASCII optimizations. */
|
||||
|
||||
#undef c_isascii
|
||||
#define c_isascii(c) \
|
||||
({ int __c = (c); \
|
||||
(__c >= 0x00 && __c <= 0x7f); \
|
||||
})
|
||||
|
||||
#if C_CTYPE_CONSECUTIVE_DIGITS \
|
||||
&& C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
|
||||
#if C_CTYPE_ASCII
|
||||
#undef c_isalnum
|
||||
#define c_isalnum(c) \
|
||||
({ int __c = (c); \
|
||||
((__c >= '0' && __c <= '9') \
|
||||
|| ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \
|
||||
})
|
||||
#else
|
||||
#undef c_isalnum
|
||||
#define c_isalnum(c) \
|
||||
({ int __c = (c); \
|
||||
((__c >= '0' && __c <= '9') \
|
||||
|| (__c >= 'A' && __c <= 'Z') \
|
||||
|| (__c >= 'a' && __c <= 'z')); \
|
||||
})
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
|
||||
#if C_CTYPE_ASCII
|
||||
#undef c_isalpha
|
||||
#define c_isalpha(c) \
|
||||
({ int __c = (c); \
|
||||
((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \
|
||||
})
|
||||
#else
|
||||
#undef c_isalpha
|
||||
#define c_isalpha(c) \
|
||||
({ int __c = (c); \
|
||||
((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \
|
||||
})
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef c_isblank
|
||||
#define c_isblank(c) \
|
||||
({ int __c = (c); \
|
||||
(__c == ' ' || __c == '\t'); \
|
||||
})
|
||||
|
||||
#if C_CTYPE_ASCII
|
||||
#undef c_iscntrl
|
||||
#define c_iscntrl(c) \
|
||||
({ int __c = (c); \
|
||||
((__c & ~0x1f) == 0 || __c == 0x7f); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#if C_CTYPE_CONSECUTIVE_DIGITS
|
||||
#undef c_isdigit
|
||||
#define c_isdigit(c) \
|
||||
({ int __c = (c); \
|
||||
(__c >= '0' && __c <= '9'); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#if C_CTYPE_CONSECUTIVE_LOWERCASE
|
||||
#undef c_islower
|
||||
#define c_islower(c) \
|
||||
({ int __c = (c); \
|
||||
(__c >= 'a' && __c <= 'z'); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#if C_CTYPE_ASCII
|
||||
#undef c_isgraph
|
||||
#define c_isgraph(c) \
|
||||
({ int __c = (c); \
|
||||
(__c >= '!' && __c <= '~'); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#if C_CTYPE_ASCII
|
||||
#undef c_isprint
|
||||
#define c_isprint(c) \
|
||||
({ int __c = (c); \
|
||||
(__c >= ' ' && __c <= '~'); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#if C_CTYPE_ASCII
|
||||
#undef c_ispunct
|
||||
#define c_ispunct(c) \
|
||||
({ int _c = (c); \
|
||||
(c_isgraph (_c) && ! c_isalnum (_c)); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#undef c_isspace
|
||||
#define c_isspace(c) \
|
||||
({ int __c = (c); \
|
||||
(__c == ' ' || __c == '\t' \
|
||||
|| __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \
|
||||
})
|
||||
|
||||
#if C_CTYPE_CONSECUTIVE_UPPERCASE
|
||||
#undef c_isupper
|
||||
#define c_isupper(c) \
|
||||
({ int __c = (c); \
|
||||
(__c >= 'A' && __c <= 'Z'); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#if C_CTYPE_CONSECUTIVE_DIGITS \
|
||||
&& C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
|
||||
#if C_CTYPE_ASCII
|
||||
#undef c_isxdigit
|
||||
#define c_isxdigit(c) \
|
||||
({ int __c = (c); \
|
||||
((__c >= '0' && __c <= '9') \
|
||||
|| ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \
|
||||
})
|
||||
#else
|
||||
#undef c_isxdigit
|
||||
#define c_isxdigit(c) \
|
||||
({ int __c = (c); \
|
||||
((__c >= '0' && __c <= '9') \
|
||||
|| (__c >= 'A' && __c <= 'F') \
|
||||
|| (__c >= 'a' && __c <= 'f')); \
|
||||
})
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
|
||||
#undef c_tolower
|
||||
#define c_tolower(c) \
|
||||
({ int __c = (c); \
|
||||
(__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \
|
||||
})
|
||||
#undef c_toupper
|
||||
#define c_toupper(c) \
|
||||
({ int __c = (c); \
|
||||
(__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#endif /* optimizing for speed */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* C_CTYPE_H */
|
||||
@@ -1,683 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent table of character encoding aliases.
|
||||
#
|
||||
# Copyright (C) 2000-2004, 2006-2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The table consists of lines of the form
|
||||
# ALIAS CANONICAL
|
||||
#
|
||||
# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
|
||||
# ALIAS is compared in a case sensitive way.
|
||||
#
|
||||
# CANONICAL is the GNU canonical name for this character encoding.
|
||||
# It must be an encoding supported by libiconv. Support by GNU libc is
|
||||
# also desirable. CANONICAL is case insensitive. Usually an upper case
|
||||
# MIME charset name is preferred.
|
||||
# The current list of GNU canonical charset names is as follows.
|
||||
#
|
||||
# name MIME? used by which systems
|
||||
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin
|
||||
# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin
|
||||
# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin
|
||||
# ISO-8859-3 Y glibc solaris
|
||||
# ISO-8859-4 Y osf solaris freebsd netbsd openbsd darwin
|
||||
# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin
|
||||
# ISO-8859-6 Y glibc aix hpux solaris
|
||||
# ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd openbsd darwin
|
||||
# ISO-8859-8 Y glibc aix hpux osf solaris
|
||||
# ISO-8859-9 Y glibc aix hpux irix osf solaris darwin
|
||||
# ISO-8859-13 glibc netbsd openbsd darwin
|
||||
# ISO-8859-14 glibc
|
||||
# ISO-8859-15 glibc aix osf solaris freebsd netbsd openbsd darwin
|
||||
# KOI8-R Y glibc solaris freebsd netbsd openbsd darwin
|
||||
# KOI8-U Y glibc freebsd netbsd openbsd darwin
|
||||
# KOI8-T glibc
|
||||
# CP437 dos
|
||||
# CP775 dos
|
||||
# CP850 aix osf dos
|
||||
# CP852 dos
|
||||
# CP855 dos
|
||||
# CP856 aix
|
||||
# CP857 dos
|
||||
# CP861 dos
|
||||
# CP862 dos
|
||||
# CP864 dos
|
||||
# CP865 dos
|
||||
# CP866 freebsd netbsd openbsd darwin dos
|
||||
# CP869 dos
|
||||
# CP874 woe32 dos
|
||||
# CP922 aix
|
||||
# CP932 aix woe32 dos
|
||||
# CP943 aix
|
||||
# CP949 osf darwin woe32 dos
|
||||
# CP950 woe32 dos
|
||||
# CP1046 aix
|
||||
# CP1124 aix
|
||||
# CP1125 dos
|
||||
# CP1129 aix
|
||||
# CP1131 darwin
|
||||
# CP1250 woe32
|
||||
# CP1251 glibc solaris netbsd openbsd darwin woe32
|
||||
# CP1252 aix woe32
|
||||
# CP1253 woe32
|
||||
# CP1254 woe32
|
||||
# CP1255 glibc woe32
|
||||
# CP1256 woe32
|
||||
# CP1257 woe32
|
||||
# GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin
|
||||
# EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin
|
||||
# EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin
|
||||
# EUC-TW glibc aix hpux irix osf solaris netbsd
|
||||
# BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin
|
||||
# BIG5-HKSCS glibc solaris darwin
|
||||
# GBK glibc aix osf solaris darwin woe32 dos
|
||||
# GB18030 glibc solaris netbsd darwin
|
||||
# SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin
|
||||
# JOHAB glibc solaris woe32
|
||||
# TIS-620 glibc aix hpux osf solaris
|
||||
# VISCII Y glibc
|
||||
# TCVN5712-1 glibc
|
||||
# ARMSCII-8 glibc darwin
|
||||
# GEORGIAN-PS glibc
|
||||
# PT154 glibc
|
||||
# HP-ROMAN8 hpux
|
||||
# HP-ARABIC8 hpux
|
||||
# HP-GREEK8 hpux
|
||||
# HP-HEBREW8 hpux
|
||||
# HP-TURKISH8 hpux
|
||||
# HP-KANA8 hpux
|
||||
# DEC-KANJI osf
|
||||
# DEC-HANYU osf
|
||||
# UTF-8 Y glibc aix hpux osf solaris netbsd darwin
|
||||
#
|
||||
# Note: Names which are not marked as being a MIME name should not be used in
|
||||
# Internet protocols for information interchange (mail, news, etc.).
|
||||
#
|
||||
# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
|
||||
# must understand both names and treat them as equivalent.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
|
||||
host="$1"
|
||||
os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
|
||||
echo "# This file contains a table of character encoding aliases,"
|
||||
echo "# suitable for operating system '${os}'."
|
||||
echo "# It was automatically generated from config.charset."
|
||||
# List of references, updated during installation:
|
||||
echo "# Packages using this file: "
|
||||
case "$os" in
|
||||
linux-gnulibc1*)
|
||||
# Linux libc5 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "C ASCII"
|
||||
echo "POSIX ASCII"
|
||||
for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
|
||||
en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
|
||||
en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
|
||||
es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
|
||||
et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
|
||||
fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
|
||||
it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
|
||||
sv_FI sv_SE; do
|
||||
echo "$l ISO-8859-1"
|
||||
echo "$l.iso-8859-1 ISO-8859-1"
|
||||
echo "$l.iso-8859-15 ISO-8859-15"
|
||||
echo "$l.iso-8859-15@euro ISO-8859-15"
|
||||
echo "$l@euro ISO-8859-15"
|
||||
echo "$l.cp-437 CP437"
|
||||
echo "$l.cp-850 CP850"
|
||||
echo "$l.cp-1252 CP1252"
|
||||
echo "$l.cp-1252@euro CP1252"
|
||||
#echo "$l.atari-st ATARI-ST" # not a commonly used encoding
|
||||
echo "$l.utf-8 UTF-8"
|
||||
echo "$l.utf-8@euro UTF-8"
|
||||
done
|
||||
for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
|
||||
sl_SI sr sr_CS sr_YU; do
|
||||
echo "$l ISO-8859-2"
|
||||
echo "$l.iso-8859-2 ISO-8859-2"
|
||||
echo "$l.cp-852 CP852"
|
||||
echo "$l.cp-1250 CP1250"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in mk mk_MK ru ru_RU; do
|
||||
echo "$l ISO-8859-5"
|
||||
echo "$l.iso-8859-5 ISO-8859-5"
|
||||
echo "$l.koi8-r KOI8-R"
|
||||
echo "$l.cp-866 CP866"
|
||||
echo "$l.cp-1251 CP1251"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in ar ar_SA; do
|
||||
echo "$l ISO-8859-6"
|
||||
echo "$l.iso-8859-6 ISO-8859-6"
|
||||
echo "$l.cp-864 CP864"
|
||||
#echo "$l.cp-868 CP868" # not a commonly used encoding
|
||||
echo "$l.cp-1256 CP1256"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in el el_GR gr gr_GR; do
|
||||
echo "$l ISO-8859-7"
|
||||
echo "$l.iso-8859-7 ISO-8859-7"
|
||||
echo "$l.cp-869 CP869"
|
||||
echo "$l.cp-1253 CP1253"
|
||||
echo "$l.cp-1253@euro CP1253"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
echo "$l.utf-8@euro UTF-8"
|
||||
done
|
||||
for l in he he_IL iw iw_IL; do
|
||||
echo "$l ISO-8859-8"
|
||||
echo "$l.iso-8859-8 ISO-8859-8"
|
||||
echo "$l.cp-862 CP862"
|
||||
echo "$l.cp-1255 CP1255"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in tr tr_TR; do
|
||||
echo "$l ISO-8859-9"
|
||||
echo "$l.iso-8859-9 ISO-8859-9"
|
||||
echo "$l.cp-857 CP857"
|
||||
echo "$l.cp-1254 CP1254"
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
for l in lt lt_LT lv lv_LV; do
|
||||
#echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
|
||||
echo "$l ISO-8859-13"
|
||||
done
|
||||
for l in ru_UA uk uk_UA; do
|
||||
echo "$l KOI8-U"
|
||||
done
|
||||
for l in zh zh_CN; do
|
||||
#echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
|
||||
echo "$l GB2312"
|
||||
done
|
||||
for l in ja ja_JP ja_JP.EUC; do
|
||||
echo "$l EUC-JP"
|
||||
done
|
||||
for l in ko ko_KR; do
|
||||
echo "$l EUC-KR"
|
||||
done
|
||||
for l in th th_TH; do
|
||||
echo "$l TIS-620"
|
||||
done
|
||||
for l in fa fa_IR; do
|
||||
#echo "$l ISIRI-3342" # a broken encoding
|
||||
echo "$l.utf-8 UTF-8"
|
||||
done
|
||||
;;
|
||||
linux* | *-gnu*)
|
||||
# With glibc-2.1 or newer, we don't need any canonicalization,
|
||||
# because glibc has iconv and both glibc and libiconv support all
|
||||
# GNU canonical names directly. Therefore, the Makefile does not
|
||||
# need to install the alias file at all.
|
||||
# The following applies only to glibc-2.0.x and older libcs.
|
||||
echo "ISO_646.IRV:1983 ASCII"
|
||||
;;
|
||||
aix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "IBM-850 CP850"
|
||||
echo "IBM-856 CP856"
|
||||
echo "IBM-921 ISO-8859-13"
|
||||
echo "IBM-922 CP922"
|
||||
echo "IBM-932 CP932"
|
||||
echo "IBM-943 CP943"
|
||||
echo "IBM-1046 CP1046"
|
||||
echo "IBM-1124 CP1124"
|
||||
echo "IBM-1129 CP1129"
|
||||
echo "IBM-1252 CP1252"
|
||||
echo "IBM-eucCN GB2312"
|
||||
echo "IBM-eucJP EUC-JP"
|
||||
echo "IBM-eucKR EUC-KR"
|
||||
echo "IBM-eucTW EUC-TW"
|
||||
echo "big5 BIG5"
|
||||
echo "GBK GBK"
|
||||
echo "TIS-620 TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
hpux*)
|
||||
echo "iso88591 ISO-8859-1"
|
||||
echo "iso88592 ISO-8859-2"
|
||||
echo "iso88595 ISO-8859-5"
|
||||
echo "iso88596 ISO-8859-6"
|
||||
echo "iso88597 ISO-8859-7"
|
||||
echo "iso88598 ISO-8859-8"
|
||||
echo "iso88599 ISO-8859-9"
|
||||
echo "iso885915 ISO-8859-15"
|
||||
echo "roman8 HP-ROMAN8"
|
||||
echo "arabic8 HP-ARABIC8"
|
||||
echo "greek8 HP-GREEK8"
|
||||
echo "hebrew8 HP-HEBREW8"
|
||||
echo "turkish8 HP-TURKISH8"
|
||||
echo "kana8 HP-KANA8"
|
||||
echo "tis620 TIS-620"
|
||||
echo "big5 BIG5"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "hp15CN GB2312"
|
||||
#echo "ccdc ?" # what is this?
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "utf8 UTF-8"
|
||||
;;
|
||||
irix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "eucCN GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
;;
|
||||
osf*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "cp850 CP850"
|
||||
echo "big5 BIG5"
|
||||
echo "dechanyu DEC-HANYU"
|
||||
echo "dechanzi GB2312"
|
||||
echo "deckanji DEC-KANJI"
|
||||
echo "deckorean EUC-KR"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "GBK GBK"
|
||||
echo "KSC5601 CP949"
|
||||
echo "sdeckanji EUC-JP"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "TACTIS TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
solaris*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-3 ISO-8859-3"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "koi8-r KOI8-R"
|
||||
echo "ansi-1251 CP1251"
|
||||
echo "BIG5 BIG5"
|
||||
echo "Big5-HKSCS BIG5-HKSCS"
|
||||
echo "gb2312 GB2312"
|
||||
echo "GBK GBK"
|
||||
echo "GB18030 GB18030"
|
||||
echo "cns11643 EUC-TW"
|
||||
echo "5601 EUC-KR"
|
||||
echo "ko_KR.johap92 JOHAB"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "PCK SHIFT_JIS"
|
||||
echo "TIS620.2533 TIS-620"
|
||||
#echo "sun_eu_greek ?" # what is this?
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
freebsd* | os2*)
|
||||
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
# Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
|
||||
# reuse FreeBSD's locale data for OS/2.
|
||||
echo "C ASCII"
|
||||
echo "US-ASCII ASCII"
|
||||
for l in la_LN lt_LN; do
|
||||
echo "$l.ASCII ASCII"
|
||||
done
|
||||
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
|
||||
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
|
||||
lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
|
||||
echo "$l.ISO_8859-1 ISO-8859-1"
|
||||
echo "$l.DIS_8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
|
||||
echo "$l.ISO_8859-2 ISO-8859-2"
|
||||
done
|
||||
for l in la_LN lt_LT; do
|
||||
echo "$l.ISO_8859-4 ISO-8859-4"
|
||||
done
|
||||
for l in ru_RU ru_SU; do
|
||||
echo "$l.KOI8-R KOI8-R"
|
||||
echo "$l.ISO_8859-5 ISO-8859-5"
|
||||
echo "$l.CP866 CP866"
|
||||
done
|
||||
echo "uk_UA.KOI8-U KOI8-U"
|
||||
echo "zh_TW.BIG5 BIG5"
|
||||
echo "zh_TW.Big5 BIG5"
|
||||
echo "zh_CN.EUC GB2312"
|
||||
echo "ja_JP.EUC EUC-JP"
|
||||
echo "ja_JP.SJIS SHIFT_JIS"
|
||||
echo "ja_JP.Shift_JIS SHIFT_JIS"
|
||||
echo "ko_KR.EUC EUC-KR"
|
||||
;;
|
||||
netbsd*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-13 ISO-8859-13"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "eucCN GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "BIG5 BIG5"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
;;
|
||||
openbsd*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-13 ISO-8859-13"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
;;
|
||||
darwin[56]*)
|
||||
# Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "C ASCII"
|
||||
for l in en_AU en_CA en_GB en_US la_LN; do
|
||||
echo "$l.US-ASCII ASCII"
|
||||
done
|
||||
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
|
||||
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
|
||||
nl_NL no_NO pt_PT sv_SE; do
|
||||
echo "$l ISO-8859-1"
|
||||
echo "$l.ISO8859-1 ISO-8859-1"
|
||||
echo "$l.ISO8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in la_LN; do
|
||||
echo "$l.ISO8859-1 ISO-8859-1"
|
||||
echo "$l.ISO8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
|
||||
echo "$l.ISO8859-2 ISO-8859-2"
|
||||
done
|
||||
for l in la_LN lt_LT; do
|
||||
echo "$l.ISO8859-4 ISO-8859-4"
|
||||
done
|
||||
for l in ru_RU; do
|
||||
echo "$l.KOI8-R KOI8-R"
|
||||
echo "$l.ISO8859-5 ISO-8859-5"
|
||||
echo "$l.CP866 CP866"
|
||||
done
|
||||
for l in bg_BG; do
|
||||
echo "$l.CP1251 CP1251"
|
||||
done
|
||||
echo "uk_UA.KOI8-U KOI8-U"
|
||||
echo "zh_TW.BIG5 BIG5"
|
||||
echo "zh_TW.Big5 BIG5"
|
||||
echo "zh_CN.EUC GB2312"
|
||||
echo "ja_JP.EUC EUC-JP"
|
||||
echo "ja_JP.SJIS SHIFT_JIS"
|
||||
echo "ko_KR.EUC EUC-KR"
|
||||
;;
|
||||
darwin*)
|
||||
# Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is
|
||||
# useless:
|
||||
# - It returns the empty string when LANG is set to a locale of the
|
||||
# form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
|
||||
# LC_CTYPE file.
|
||||
# - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
|
||||
# the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
|
||||
# - The documentation says:
|
||||
# "... all code that calls BSD system routines should ensure
|
||||
# that the const *char parameters of these routines are in UTF-8
|
||||
# encoding. All BSD system functions expect their string
|
||||
# parameters to be in UTF-8 encoding and nothing else."
|
||||
# It also says
|
||||
# "An additional caveat is that string parameters for files,
|
||||
# paths, and other file-system entities must be in canonical
|
||||
# UTF-8. In a canonical UTF-8 Unicode string, all decomposable
|
||||
# characters are decomposed ..."
|
||||
# but this is not true: You can pass non-decomposed UTF-8 strings
|
||||
# to file system functions, and it is the OS which will convert
|
||||
# them to decomposed UTF-8 before accessing the file system.
|
||||
# - The Apple Terminal application displays UTF-8 by default.
|
||||
# - However, other applications are free to use different encodings:
|
||||
# - xterm uses ISO-8859-1 by default.
|
||||
# - TextEdit uses MacRoman by default.
|
||||
# We prefer UTF-8 over decomposed UTF-8-MAC because one should
|
||||
# minimize the use of decomposed Unicode. Unfortunately, through the
|
||||
# Darwin file system, decomposed UTF-8 strings are leaked into user
|
||||
# space nevertheless.
|
||||
# Then there are also the locales with encodings other than US-ASCII
|
||||
# and UTF-8. These locales can be occasionally useful to users (e.g.
|
||||
# when grepping through ISO-8859-1 encoded text files), when all their
|
||||
# file names are in US-ASCII.
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-13 ISO-8859-13"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "KOI8-R KOI8-R"
|
||||
echo "KOI8-U KOI8-U"
|
||||
echo "CP866 CP866"
|
||||
echo "CP949 CP949"
|
||||
echo "CP1131 CP1131"
|
||||
echo "CP1251 CP1251"
|
||||
echo "eucCN GB2312"
|
||||
echo "GB2312 GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "Big5 BIG5"
|
||||
echo "Big5HKSCS BIG5-HKSCS"
|
||||
echo "GBK GBK"
|
||||
echo "GB18030 GB18030"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "ARMSCII-8 ARMSCII-8"
|
||||
echo "PT154 PT154"
|
||||
#echo "ISCII-DEV ?"
|
||||
echo "* UTF-8"
|
||||
;;
|
||||
beos* | haiku*)
|
||||
# BeOS and Haiku have a single locale, and it has UTF-8 encoding.
|
||||
echo "* UTF-8"
|
||||
;;
|
||||
msdosdjgpp*)
|
||||
# DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "#"
|
||||
echo "# The encodings given here may not all be correct."
|
||||
echo "# If you find that the encoding given for your language and"
|
||||
echo "# country is not the one your DOS machine actually uses, just"
|
||||
echo "# correct it in this file, and send a mail to"
|
||||
echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>"
|
||||
echo "# and Bruno Haible <bruno@clisp.org>."
|
||||
echo "#"
|
||||
echo "C ASCII"
|
||||
# ISO-8859-1 languages
|
||||
echo "ca CP850"
|
||||
echo "ca_ES CP850"
|
||||
echo "da CP865" # not CP850 ??
|
||||
echo "da_DK CP865" # not CP850 ??
|
||||
echo "de CP850"
|
||||
echo "de_AT CP850"
|
||||
echo "de_CH CP850"
|
||||
echo "de_DE CP850"
|
||||
echo "en CP850"
|
||||
echo "en_AU CP850" # not CP437 ??
|
||||
echo "en_CA CP850"
|
||||
echo "en_GB CP850"
|
||||
echo "en_NZ CP437"
|
||||
echo "en_US CP437"
|
||||
echo "en_ZA CP850" # not CP437 ??
|
||||
echo "es CP850"
|
||||
echo "es_AR CP850"
|
||||
echo "es_BO CP850"
|
||||
echo "es_CL CP850"
|
||||
echo "es_CO CP850"
|
||||
echo "es_CR CP850"
|
||||
echo "es_CU CP850"
|
||||
echo "es_DO CP850"
|
||||
echo "es_EC CP850"
|
||||
echo "es_ES CP850"
|
||||
echo "es_GT CP850"
|
||||
echo "es_HN CP850"
|
||||
echo "es_MX CP850"
|
||||
echo "es_NI CP850"
|
||||
echo "es_PA CP850"
|
||||
echo "es_PY CP850"
|
||||
echo "es_PE CP850"
|
||||
echo "es_SV CP850"
|
||||
echo "es_UY CP850"
|
||||
echo "es_VE CP850"
|
||||
echo "et CP850"
|
||||
echo "et_EE CP850"
|
||||
echo "eu CP850"
|
||||
echo "eu_ES CP850"
|
||||
echo "fi CP850"
|
||||
echo "fi_FI CP850"
|
||||
echo "fr CP850"
|
||||
echo "fr_BE CP850"
|
||||
echo "fr_CA CP850"
|
||||
echo "fr_CH CP850"
|
||||
echo "fr_FR CP850"
|
||||
echo "ga CP850"
|
||||
echo "ga_IE CP850"
|
||||
echo "gd CP850"
|
||||
echo "gd_GB CP850"
|
||||
echo "gl CP850"
|
||||
echo "gl_ES CP850"
|
||||
echo "id CP850" # not CP437 ??
|
||||
echo "id_ID CP850" # not CP437 ??
|
||||
echo "is CP861" # not CP850 ??
|
||||
echo "is_IS CP861" # not CP850 ??
|
||||
echo "it CP850"
|
||||
echo "it_CH CP850"
|
||||
echo "it_IT CP850"
|
||||
echo "lt CP775"
|
||||
echo "lt_LT CP775"
|
||||
echo "lv CP775"
|
||||
echo "lv_LV CP775"
|
||||
echo "nb CP865" # not CP850 ??
|
||||
echo "nb_NO CP865" # not CP850 ??
|
||||
echo "nl CP850"
|
||||
echo "nl_BE CP850"
|
||||
echo "nl_NL CP850"
|
||||
echo "nn CP865" # not CP850 ??
|
||||
echo "nn_NO CP865" # not CP850 ??
|
||||
echo "no CP865" # not CP850 ??
|
||||
echo "no_NO CP865" # not CP850 ??
|
||||
echo "pt CP850"
|
||||
echo "pt_BR CP850"
|
||||
echo "pt_PT CP850"
|
||||
echo "sv CP850"
|
||||
echo "sv_SE CP850"
|
||||
# ISO-8859-2 languages
|
||||
echo "cs CP852"
|
||||
echo "cs_CZ CP852"
|
||||
echo "hr CP852"
|
||||
echo "hr_HR CP852"
|
||||
echo "hu CP852"
|
||||
echo "hu_HU CP852"
|
||||
echo "pl CP852"
|
||||
echo "pl_PL CP852"
|
||||
echo "ro CP852"
|
||||
echo "ro_RO CP852"
|
||||
echo "sk CP852"
|
||||
echo "sk_SK CP852"
|
||||
echo "sl CP852"
|
||||
echo "sl_SI CP852"
|
||||
echo "sq CP852"
|
||||
echo "sq_AL CP852"
|
||||
echo "sr CP852" # CP852 or CP866 or CP855 ??
|
||||
echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
|
||||
echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
|
||||
# ISO-8859-3 languages
|
||||
echo "mt CP850"
|
||||
echo "mt_MT CP850"
|
||||
# ISO-8859-5 languages
|
||||
echo "be CP866"
|
||||
echo "be_BE CP866"
|
||||
echo "bg CP866" # not CP855 ??
|
||||
echo "bg_BG CP866" # not CP855 ??
|
||||
echo "mk CP866" # not CP855 ??
|
||||
echo "mk_MK CP866" # not CP855 ??
|
||||
echo "ru CP866"
|
||||
echo "ru_RU CP866"
|
||||
echo "uk CP1125"
|
||||
echo "uk_UA CP1125"
|
||||
# ISO-8859-6 languages
|
||||
echo "ar CP864"
|
||||
echo "ar_AE CP864"
|
||||
echo "ar_DZ CP864"
|
||||
echo "ar_EG CP864"
|
||||
echo "ar_IQ CP864"
|
||||
echo "ar_IR CP864"
|
||||
echo "ar_JO CP864"
|
||||
echo "ar_KW CP864"
|
||||
echo "ar_MA CP864"
|
||||
echo "ar_OM CP864"
|
||||
echo "ar_QA CP864"
|
||||
echo "ar_SA CP864"
|
||||
echo "ar_SY CP864"
|
||||
# ISO-8859-7 languages
|
||||
echo "el CP869"
|
||||
echo "el_GR CP869"
|
||||
# ISO-8859-8 languages
|
||||
echo "he CP862"
|
||||
echo "he_IL CP862"
|
||||
# ISO-8859-9 languages
|
||||
echo "tr CP857"
|
||||
echo "tr_TR CP857"
|
||||
# Japanese
|
||||
echo "ja CP932"
|
||||
echo "ja_JP CP932"
|
||||
# Chinese
|
||||
echo "zh_CN GBK"
|
||||
echo "zh_TW CP950" # not CP938 ??
|
||||
# Korean
|
||||
echo "kr CP949" # not CP934 ??
|
||||
echo "kr_KR CP949" # not CP934 ??
|
||||
# Thai
|
||||
echo "th CP874"
|
||||
echo "th_TH CP874"
|
||||
# Other
|
||||
echo "eo CP850"
|
||||
echo "eo_EO CP850"
|
||||
;;
|
||||
esac
|
||||
160
lib/errno.in.h
160
lib/errno.in.h
@@ -1,160 +0,0 @@
|
||||
/* A POSIX-like <errno.h>.
|
||||
|
||||
Copyright (C) 2008-2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _GL_ERRNO_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
|
||||
|
||||
#ifndef _GL_ERRNO_H
|
||||
#define _GL_ERRNO_H
|
||||
|
||||
|
||||
/* On native Windows platforms, many macros are not defined. */
|
||||
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
|
||||
/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value. */
|
||||
# define EWOULDBLOCK EAGAIN
|
||||
|
||||
/* Values >= 100 seem safe to use. */
|
||||
# define ETXTBSY 100
|
||||
# define GNULIB_defined_ETXTBSY 1
|
||||
|
||||
/* These are intentionally the same values as the WSA* error numbers, defined
|
||||
in <winsock2.h>. */
|
||||
# define EINPROGRESS 10036
|
||||
# define EALREADY 10037
|
||||
# define ENOTSOCK 10038
|
||||
# define EDESTADDRREQ 10039
|
||||
# define EMSGSIZE 10040
|
||||
# define EPROTOTYPE 10041
|
||||
# define ENOPROTOOPT 10042
|
||||
# define EPROTONOSUPPORT 10043
|
||||
# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */
|
||||
# define EOPNOTSUPP 10045
|
||||
# define EPFNOSUPPORT 10046 /* not required by POSIX */
|
||||
# define EAFNOSUPPORT 10047
|
||||
# define EADDRINUSE 10048
|
||||
# define EADDRNOTAVAIL 10049
|
||||
# define ENETDOWN 10050
|
||||
# define ENETUNREACH 10051
|
||||
# define ENETRESET 10052
|
||||
# define ECONNABORTED 10053
|
||||
# define ECONNRESET 10054
|
||||
# define ENOBUFS 10055
|
||||
# define EISCONN 10056
|
||||
# define ENOTCONN 10057
|
||||
# define ESHUTDOWN 10058 /* not required by POSIX */
|
||||
# define ETOOMANYREFS 10059 /* not required by POSIX */
|
||||
# define ETIMEDOUT 10060
|
||||
# define ECONNREFUSED 10061
|
||||
# define ELOOP 10062
|
||||
# define EHOSTDOWN 10064 /* not required by POSIX */
|
||||
# define EHOSTUNREACH 10065
|
||||
# define EPROCLIM 10067 /* not required by POSIX */
|
||||
# define EUSERS 10068 /* not required by POSIX */
|
||||
# define EDQUOT 10069
|
||||
# define ESTALE 10070
|
||||
# define EREMOTE 10071 /* not required by POSIX */
|
||||
# define GNULIB_defined_ESOCK 1
|
||||
|
||||
# endif
|
||||
|
||||
|
||||
/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros
|
||||
EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */
|
||||
# if @EMULTIHOP_HIDDEN@
|
||||
# define EMULTIHOP @EMULTIHOP_VALUE@
|
||||
# define GNULIB_defined_EMULTIHOP 1
|
||||
# endif
|
||||
# if @ENOLINK_HIDDEN@
|
||||
# define ENOLINK @ENOLINK_VALUE@
|
||||
# define GNULIB_defined_ENOLINK 1
|
||||
# endif
|
||||
# if @EOVERFLOW_HIDDEN@
|
||||
# define EOVERFLOW @EOVERFLOW_VALUE@
|
||||
# define GNULIB_defined_EOVERFLOW 1
|
||||
# endif
|
||||
|
||||
|
||||
/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
|
||||
EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
|
||||
Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151,
|
||||
HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133.
|
||||
|
||||
Note: When one of these systems defines some of these macros some day,
|
||||
binaries will have to be recompiled so that they recognizes the new
|
||||
errno values from the system. */
|
||||
|
||||
# ifndef ENOMSG
|
||||
# define ENOMSG 2000
|
||||
# define GNULIB_defined_ENOMSG 1
|
||||
# endif
|
||||
|
||||
# ifndef EIDRM
|
||||
# define EIDRM 2001
|
||||
# define GNULIB_defined_EIDRM 1
|
||||
# endif
|
||||
|
||||
# ifndef ENOLINK
|
||||
# define ENOLINK 2002
|
||||
# define GNULIB_defined_ENOLINK 1
|
||||
# endif
|
||||
|
||||
# ifndef EPROTO
|
||||
# define EPROTO 2003
|
||||
# define GNULIB_defined_EPROTO 1
|
||||
# endif
|
||||
|
||||
# ifndef EMULTIHOP
|
||||
# define EMULTIHOP 2004
|
||||
# define GNULIB_defined_EMULTIHOP 1
|
||||
# endif
|
||||
|
||||
# ifndef EBADMSG
|
||||
# define EBADMSG 2005
|
||||
# define GNULIB_defined_EBADMSG 1
|
||||
# endif
|
||||
|
||||
# ifndef EOVERFLOW
|
||||
# define EOVERFLOW 2006
|
||||
# define GNULIB_defined_EOVERFLOW 1
|
||||
# endif
|
||||
|
||||
# ifndef ENOTSUP
|
||||
# define ENOTSUP 2007
|
||||
# define GNULIB_defined_ENOTSUP 1
|
||||
# endif
|
||||
|
||||
# ifndef ESTALE
|
||||
# define ESTALE 2009
|
||||
# define GNULIB_defined_ESTALE 1
|
||||
# endif
|
||||
|
||||
# ifndef ECANCELED
|
||||
# define ECANCELED 2008
|
||||
# define GNULIB_defined_ECANCELED 1
|
||||
# endif
|
||||
|
||||
|
||||
#endif /* _GL_ERRNO_H */
|
||||
#endif /* _GL_ERRNO_H */
|
||||
352
lib/error.c
352
lib/error.c
@@ -1,352 +0,0 @@
|
||||
/* Error handler for noninteractive utilities
|
||||
Copyright (C) 1990-1998, 2000-2007, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
#if !_LIBC
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "error.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !_LIBC && ENABLE_NLS
|
||||
# include "gettext.h"
|
||||
# define _(msgid) gettext (msgid)
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
# include <stdbool.h>
|
||||
# include <stdint.h>
|
||||
# include <wchar.h>
|
||||
# define mbsrtowcs __mbsrtowcs
|
||||
#endif
|
||||
|
||||
#if USE_UNLOCKED_IO
|
||||
# include "unlocked-io.h"
|
||||
#endif
|
||||
|
||||
#ifndef _
|
||||
# define _(String) String
|
||||
#endif
|
||||
|
||||
/* If NULL, error will flush stdout, then print on stderr the program
|
||||
name, a colon and a space. Otherwise, error will call this
|
||||
function without parameters instead. */
|
||||
void (*error_print_progname) (void);
|
||||
|
||||
/* This variable is incremented each time `error' is called. */
|
||||
unsigned int error_message_count;
|
||||
|
||||
#ifdef _LIBC
|
||||
/* In the GNU C library, there is a predefined variable for this. */
|
||||
|
||||
# define program_name program_invocation_name
|
||||
# include <errno.h>
|
||||
# include <limits.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. */
|
||||
extern void __error (int status, int errnum, const char *message, ...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
extern void __error_at_line (int status, int errnum, const char *file_name,
|
||||
unsigned int line_number, const char *message,
|
||||
...)
|
||||
__attribute__ ((__format__ (__printf__, 5, 6)));;
|
||||
# define error __error
|
||||
# define error_at_line __error_at_line
|
||||
|
||||
# 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 */
|
||||
|
||||
# include <fcntl.h>
|
||||
|
||||
# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
|
||||
# ifndef HAVE_DECL_STRERROR_R
|
||||
"this configure-time declaration test was not run"
|
||||
# endif
|
||||
char *strerror_r ();
|
||||
# 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
|
||||
# endif /* HAVE_STRERROR_R || defined strerror_r */
|
||||
#endif /* not _LIBC */
|
||||
|
||||
static void
|
||||
print_errno_message (int errnum)
|
||||
{
|
||||
char const *s;
|
||||
|
||||
#if defined HAVE_STRERROR_R || _LIBC
|
||||
char errbuf[1024];
|
||||
# if STRERROR_R_CHAR_P || _LIBC
|
||||
s = __strerror_r (errnum, errbuf, sizeof errbuf);
|
||||
# else
|
||||
if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
|
||||
s = errbuf;
|
||||
else
|
||||
s = 0;
|
||||
# endif
|
||||
#else
|
||||
s = strerror (errnum);
|
||||
#endif
|
||||
|
||||
#if !_LIBC
|
||||
if (! s)
|
||||
s = _("Unknown system error");
|
||||
#endif
|
||||
|
||||
#if _LIBC
|
||||
__fxprintf (NULL, ": %s", s);
|
||||
#else
|
||||
fprintf (stderr, ": %s", s);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
error_tail (int status, int errnum, const char *message, va_list args)
|
||||
{
|
||||
#if _LIBC
|
||||
if (_IO_fwide (stderr, 0) > 0)
|
||||
{
|
||||
# define ALLOCA_LIMIT 2000
|
||||
size_t len = strlen (message) + 1;
|
||||
wchar_t *wmessage = NULL;
|
||||
mbstate_t st;
|
||||
size_t res;
|
||||
const char *tmp;
|
||||
bool use_malloc = false;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (__libc_use_alloca (len * sizeof (wchar_t)))
|
||||
wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
|
||||
else
|
||||
{
|
||||
if (!use_malloc)
|
||||
wmessage = NULL;
|
||||
|
||||
wchar_t *p = (wchar_t *) realloc (wmessage,
|
||||
len * sizeof (wchar_t));
|
||||
if (p == NULL)
|
||||
{
|
||||
free (wmessage);
|
||||
fputws_unlocked (L"out of memory\n", stderr);
|
||||
return;
|
||||
}
|
||||
wmessage = p;
|
||||
use_malloc = true;
|
||||
}
|
||||
|
||||
memset (&st, '\0', sizeof (st));
|
||||
tmp = message;
|
||||
|
||||
res = mbsrtowcs (wmessage, &tmp, len, &st);
|
||||
if (res != len)
|
||||
break;
|
||||
|
||||
if (__builtin_expect (len >= SIZE_MAX / 2, 0))
|
||||
{
|
||||
/* This really should not happen if everything is fine. */
|
||||
res = (size_t) -1;
|
||||
break;
|
||||
}
|
||||
|
||||
len *= 2;
|
||||
}
|
||||
|
||||
if (res == (size_t) -1)
|
||||
{
|
||||
/* The string cannot be converted. */
|
||||
if (use_malloc)
|
||||
{
|
||||
free (wmessage);
|
||||
use_malloc = false;
|
||||
}
|
||||
wmessage = (wchar_t *) L"???";
|
||||
}
|
||||
|
||||
__vfwprintf (stderr, wmessage, args);
|
||||
|
||||
if (use_malloc)
|
||||
free (wmessage);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
vfprintf (stderr, message, args);
|
||||
va_end (args);
|
||||
|
||||
++error_message_count;
|
||||
if (errnum)
|
||||
print_errno_message (errnum);
|
||||
#if _LIBC
|
||||
__fxprintf (NULL, "\n");
|
||||
#else
|
||||
putc ('\n', stderr);
|
||||
#endif
|
||||
fflush (stderr);
|
||||
if (status)
|
||||
exit (status);
|
||||
}
|
||||
|
||||
|
||||
/* 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. */
|
||||
void
|
||||
error (int status, int errnum, const char *message, ...)
|
||||
{
|
||||
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
|
||||
|
||||
#if !_LIBC && defined F_GETFL
|
||||
/* POSIX states that fflush (stdout) after fclose is unspecified; it
|
||||
is safe in glibc, but not on all other platforms. fflush (NULL)
|
||||
is always defined, but too draconian. */
|
||||
if (0 <= fcntl (1, F_GETFL))
|
||||
#endif
|
||||
fflush (stdout);
|
||||
#ifdef _LIBC
|
||||
_IO_flockfile (stderr);
|
||||
#endif
|
||||
if (error_print_progname)
|
||||
(*error_print_progname) ();
|
||||
else
|
||||
{
|
||||
#if _LIBC
|
||||
__fxprintf (NULL, "%s: ", program_name);
|
||||
#else
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
va_start (args, message);
|
||||
error_tail (status, errnum, message, args);
|
||||
|
||||
#ifdef _LIBC
|
||||
_IO_funlockfile (stderr);
|
||||
# ifdef __libc_ptf_call
|
||||
__libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Sometimes we want to have at most one error per line. This
|
||||
variable controls whether this mode is selected or not. */
|
||||
int error_one_per_line;
|
||||
|
||||
void
|
||||
error_at_line (int status, int errnum, const char *file_name,
|
||||
unsigned int line_number, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if (error_one_per_line)
|
||||
{
|
||||
static const char *old_file_name;
|
||||
static unsigned int old_line_number;
|
||||
|
||||
if (old_line_number == line_number
|
||||
&& (file_name == old_file_name
|
||||
|| strcmp (old_file_name, file_name) == 0))
|
||||
/* Simply return and print nothing. */
|
||||
return;
|
||||
|
||||
old_file_name = file_name;
|
||||
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
|
||||
|
||||
#if !_LIBC && defined F_GETFL
|
||||
/* POSIX states that fflush (stdout) after fclose is unspecified; it
|
||||
is safe in glibc, but not on all other platforms. fflush (NULL)
|
||||
is always defined, but too draconian. */
|
||||
if (0 <= fcntl (1, F_GETFL))
|
||||
#endif
|
||||
fflush (stdout);
|
||||
#ifdef _LIBC
|
||||
_IO_flockfile (stderr);
|
||||
#endif
|
||||
if (error_print_progname)
|
||||
(*error_print_progname) ();
|
||||
else
|
||||
{
|
||||
#if _LIBC
|
||||
__fxprintf (NULL, "%s:", program_name);
|
||||
#else
|
||||
fprintf (stderr, "%s:", program_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBC
|
||||
__fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
|
||||
file_name, line_number);
|
||||
#else
|
||||
fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
|
||||
file_name, line_number);
|
||||
#endif
|
||||
|
||||
va_start (args, message);
|
||||
error_tail (status, errnum, message, args);
|
||||
|
||||
#ifdef _LIBC
|
||||
_IO_funlockfile (stderr);
|
||||
# ifdef __libc_ptf_call
|
||||
__libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Make the weak alias. */
|
||||
# undef error
|
||||
# undef error_at_line
|
||||
weak_alias (__error, error)
|
||||
weak_alias (__error_at_line, error_at_line)
|
||||
#endif
|
||||
66
lib/error.h
66
lib/error.h
@@ -1,66 +0,0 @@
|
||||
/* Declaration for error-reporting function
|
||||
Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _ERROR_H
|
||||
#define _ERROR_H 1
|
||||
|
||||
#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
/* The __-protected variants of `format' and `printf' attributes
|
||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||
# define __format__ format
|
||||
# define __printf__ printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 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, ...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
|
||||
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
|
||||
name, a colon and a space. Otherwise, error will call this
|
||||
function without parameters instead. */
|
||||
extern void (*error_print_progname) (void);
|
||||
|
||||
/* This variable is incremented each time `error' is called. */
|
||||
extern unsigned int error_message_count;
|
||||
|
||||
/* Sometimes we want to have at most one error per line. This
|
||||
variable controls whether this mode is selected or not. */
|
||||
extern int error_one_per_line;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* error.h */
|
||||
@@ -1,25 +0,0 @@
|
||||
/* Failure exit status
|
||||
|
||||
Copyright (C) 2002, 2003, 2005, 2006, 2007, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "exitfail.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int volatile exit_failure = EXIT_FAILURE;
|
||||
@@ -1,18 +0,0 @@
|
||||
/* Failure exit status
|
||||
|
||||
Copyright (C) 2002, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
extern int volatile exit_failure;
|
||||
130
lib/fseeko.c
130
lib/fseeko.c
@@ -1,130 +0,0 @@
|
||||
/* An fseeko() function that, together with fflush(), is POSIX compliant.
|
||||
Copyright (C) 2007-2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <stdio.h>
|
||||
|
||||
/* Get off_t and lseek. */
|
||||
#include <unistd.h>
|
||||
|
||||
#include "stdio-impl.h"
|
||||
|
||||
#undef fseeko
|
||||
#if !HAVE_FSEEKO
|
||||
# undef fseek
|
||||
# define fseeko fseek
|
||||
#endif
|
||||
|
||||
int
|
||||
rpl_fseeko (FILE *fp, off_t offset, int whence)
|
||||
{
|
||||
#if LSEEK_PIPE_BROKEN
|
||||
/* mingw gives bogus answers rather than failure on non-seekable files. */
|
||||
if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
|
||||
return EOF;
|
||||
#endif
|
||||
|
||||
/* These tests are based on fpurge.c. */
|
||||
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
if (fp->_IO_read_end == fp->_IO_read_ptr
|
||||
&& fp->_IO_write_ptr == fp->_IO_write_base
|
||||
&& fp->_IO_save_base == NULL)
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
# if defined __SL64 && defined __SCLE /* Cygwin */
|
||||
if ((fp->_flags & __SL64) == 0)
|
||||
{
|
||||
/* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
|
||||
mode; but has an fseeko that requires 64-bit mode. */
|
||||
FILE *tmp = fopen ("/dev/null", "r");
|
||||
if (!tmp)
|
||||
return -1;
|
||||
fp->_flags |= __SL64;
|
||||
fp->_seek64 = tmp->_seek64;
|
||||
fclose (tmp);
|
||||
}
|
||||
# endif
|
||||
if (fp_->_p == fp_->_bf._base
|
||||
&& fp_->_r == 0
|
||||
&& fp_->_w == ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
|
||||
? fp_->_bf._size
|
||||
: 0)
|
||||
&& fp_ub._base == NULL)
|
||||
#elif defined __EMX__ /* emx+gcc */
|
||||
if (fp->_ptr == fp->_buffer
|
||||
&& fp->_rcount == 0
|
||||
&& fp->_wcount == 0
|
||||
&& fp->_ungetc_count == 0)
|
||||
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */
|
||||
if (fp_->_ptr == fp_->_base
|
||||
&& (fp_->_ptr == NULL || fp_->_cnt == 0))
|
||||
#elif defined __UCLIBC__ /* uClibc */
|
||||
if (((fp->__modeflags & __FLAG_WRITING) == 0
|
||||
|| fp->__bufpos == fp->__bufstart)
|
||||
&& ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
|
||||
|| fp->__bufpos == fp->__bufread))
|
||||
#elif defined __QNX__ /* QNX */
|
||||
if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
|
||||
&& fp->_Rback == fp->_Back + sizeof (fp->_Back)
|
||||
&& fp->_Rsave == NULL)
|
||||
#elif defined __MINT__ /* Atari FreeMiNT */
|
||||
if (fp->__bufp == fp->__buffer
|
||||
&& fp->__get_limit == fp->__bufp
|
||||
&& fp->__put_limit == fp->__bufp
|
||||
&& !fp->__pushed_back)
|
||||
#else
|
||||
#error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
|
||||
#endif
|
||||
{
|
||||
/* We get here when an fflush() call immediately preceded this one. We
|
||||
know there are no buffers.
|
||||
POSIX requires us to modify the file descriptor's position.
|
||||
But we cannot position beyond end of file here. */
|
||||
off_t pos =
|
||||
lseek (fileno (fp),
|
||||
whence == SEEK_END && offset > 0 ? 0 : offset,
|
||||
whence);
|
||||
if (pos == -1)
|
||||
{
|
||||
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_flags &= ~__SOFF;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
fp->_flags &= ~_IO_EOF_SEEN;
|
||||
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
fp_->_offset = pos;
|
||||
fp_->_flags |= __SOFF;
|
||||
fp_->_flags &= ~__SEOF;
|
||||
#elif defined __EMX__ /* emx+gcc */
|
||||
fp->_flags &= ~_IOEOF;
|
||||
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */
|
||||
fp->_flag &= ~_IOEOF;
|
||||
#elif defined __MINT__ /* Atari FreeMiNT */
|
||||
fp->__offset = pos;
|
||||
fp->__eof = 0;
|
||||
#endif
|
||||
/* If we were not requested to position beyond end of file, we're
|
||||
done. */
|
||||
if (!(whence == SEEK_END && offset > 0))
|
||||
return 0;
|
||||
}
|
||||
return fseeko (fp, offset, whence);
|
||||
}
|
||||
133
lib/getdelim.c
133
lib/getdelim.c
@@ -1,133 +0,0 @@
|
||||
/* getdelim.c --- Implementation of replacement getdelim function.
|
||||
Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007,
|
||||
2008, 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
/* Ported from glibc by Simon Josefsson. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef SSIZE_MAX
|
||||
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
|
||||
#endif
|
||||
|
||||
#if USE_UNLOCKED_IO
|
||||
# include "unlocked-io.h"
|
||||
# define getc_maybe_unlocked(fp) getc(fp)
|
||||
#elif !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE || !HAVE_DECL_GETC_UNLOCKED
|
||||
# undef flockfile
|
||||
# undef funlockfile
|
||||
# define flockfile(x) ((void) 0)
|
||||
# define funlockfile(x) ((void) 0)
|
||||
# define getc_maybe_unlocked(fp) getc(fp)
|
||||
#else
|
||||
# define getc_maybe_unlocked(fp) getc_unlocked(fp)
|
||||
#endif
|
||||
|
||||
/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
|
||||
NUL-terminate it). *LINEPTR is a pointer returned from malloc (or
|
||||
NULL), pointing to *N characters of space. It is realloc'ed as
|
||||
necessary. Returns the number of characters read (not including
|
||||
the null terminator), or -1 on error or EOF. */
|
||||
|
||||
ssize_t
|
||||
getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
|
||||
{
|
||||
ssize_t result;
|
||||
size_t cur_len = 0;
|
||||
|
||||
if (lineptr == NULL || n == NULL || fp == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
flockfile (fp);
|
||||
|
||||
if (*lineptr == NULL || *n == 0)
|
||||
{
|
||||
char *new_lineptr;
|
||||
*n = 120;
|
||||
new_lineptr = (char *) realloc (*lineptr, *n);
|
||||
if (new_lineptr == NULL)
|
||||
{
|
||||
result = -1;
|
||||
goto unlock_return;
|
||||
}
|
||||
*lineptr = new_lineptr;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = getc_maybe_unlocked (fp);
|
||||
if (i == EOF)
|
||||
{
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make enough space for len+1 (for final NUL) bytes. */
|
||||
if (cur_len + 1 >= *n)
|
||||
{
|
||||
size_t needed_max =
|
||||
SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
|
||||
size_t needed = 2 * *n + 1; /* Be generous. */
|
||||
char *new_lineptr;
|
||||
|
||||
if (needed_max < needed)
|
||||
needed = needed_max;
|
||||
if (cur_len + 1 >= needed)
|
||||
{
|
||||
result = -1;
|
||||
errno = EOVERFLOW;
|
||||
goto unlock_return;
|
||||
}
|
||||
|
||||
new_lineptr = (char *) realloc (*lineptr, needed);
|
||||
if (new_lineptr == NULL)
|
||||
{
|
||||
result = -1;
|
||||
goto unlock_return;
|
||||
}
|
||||
|
||||
*lineptr = new_lineptr;
|
||||
*n = needed;
|
||||
}
|
||||
|
||||
(*lineptr)[cur_len] = i;
|
||||
cur_len++;
|
||||
|
||||
if (i == delimiter)
|
||||
break;
|
||||
}
|
||||
(*lineptr)[cur_len] = '\0';
|
||||
result = cur_len ? cur_len : result;
|
||||
|
||||
unlock_return:
|
||||
funlockfile (fp); /* doesn't set errno */
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/* getline.c --- Implementation of replacement getline function.
|
||||
Copyright (C) 2005, 2006, 2007, 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
/* Written by Simon Josefsson. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
ssize_t
|
||||
getline (char **lineptr, size_t *n, FILE *stream)
|
||||
{
|
||||
return getdelim (lineptr, n, '\n', stream);
|
||||
}
|
||||
1186
lib/getopt.c
1186
lib/getopt.c
File diff suppressed because it is too large
Load Diff
226
lib/getopt.in.h
226
lib/getopt.in.h
@@ -1,226 +0,0 @@
|
||||
/* Declarations for getopt.
|
||||
Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
|
||||
1999, 2001, 2003, 2004, 2005, 2006, 2007, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
|
||||
#ifndef __need_getopt
|
||||
# define _GETOPT_H 1
|
||||
#endif
|
||||
|
||||
/* Standalone applications should #define __GETOPT_PREFIX to an
|
||||
identifier that prefixes the external functions and variables
|
||||
defined in this header. When this happens, include the
|
||||
headers that might declare getopt so that they will not cause
|
||||
confusion if included after this file. Then systematically rename
|
||||
identifiers so that they do not collide with the system functions
|
||||
and variables. Renaming avoids problems with some compilers and
|
||||
linkers. */
|
||||
#if defined __GETOPT_PREFIX && !defined __need_getopt
|
||||
# include <stdlib.h>
|
||||
# include <stdio.h>
|
||||
# include <unistd.h>
|
||||
# undef __need_getopt
|
||||
# undef getopt
|
||||
# undef getopt_long
|
||||
# undef getopt_long_only
|
||||
# undef optarg
|
||||
# undef opterr
|
||||
# undef optind
|
||||
# undef optopt
|
||||
# define __GETOPT_CONCAT(x, y) x ## y
|
||||
# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
|
||||
# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
|
||||
# define getopt __GETOPT_ID (getopt)
|
||||
# define getopt_long __GETOPT_ID (getopt_long)
|
||||
# define getopt_long_only __GETOPT_ID (getopt_long_only)
|
||||
# define optarg __GETOPT_ID (optarg)
|
||||
# define opterr __GETOPT_ID (opterr)
|
||||
# define optind __GETOPT_ID (optind)
|
||||
# define optopt __GETOPT_ID (optopt)
|
||||
#endif
|
||||
|
||||
/* Standalone applications get correct prototypes for getopt_long and
|
||||
getopt_long_only; they declare "char **argv". libc uses prototypes
|
||||
with "char *const *argv" that are incorrect because getopt_long and
|
||||
getopt_long_only can permute argv; this is required for backward
|
||||
compatibility (e.g., for LSB 2.0.1).
|
||||
|
||||
This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt',
|
||||
but it caused redefinition warnings if both unistd.h and getopt.h were
|
||||
included, since unistd.h includes getopt.h having previously defined
|
||||
__need_getopt.
|
||||
|
||||
The only place where __getopt_argv_const is used is in definitions
|
||||
of getopt_long and getopt_long_only below, but these are visible
|
||||
only if __need_getopt is not defined, so it is quite safe to rewrite
|
||||
the conditional as follows:
|
||||
*/
|
||||
#if !defined __need_getopt
|
||||
# if defined __GETOPT_PREFIX
|
||||
# define __getopt_argv_const /* empty */
|
||||
# else
|
||||
# define __getopt_argv_const const
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
||||
standalone, or this is the first header included in the source file.
|
||||
If we are being used with glibc, we need to include <features.h>, but
|
||||
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
||||
not defined, include <ctype.h>, which will pull in <features.h> for us
|
||||
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
|
||||
doesn't flood the namespace with stuff the way some other headers do.) */
|
||||
#if !defined __GNU_LIBRARY__
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifndef __THROW
|
||||
# ifndef __GNUC_PREREQ
|
||||
# define __GNUC_PREREQ(maj, min) (0)
|
||||
# endif
|
||||
# if defined __cplusplus && __GNUC_PREREQ (2,8)
|
||||
# define __THROW throw ()
|
||||
# else
|
||||
# define __THROW
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to `getopt'.
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message `getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
extern int optopt;
|
||||
|
||||
#ifndef __need_getopt
|
||||
/* Describe the long-named options requested by the application.
|
||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||
of `struct option' terminated by an element containing a name which is
|
||||
zero.
|
||||
|
||||
The field `has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field `flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field `val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an `int' to
|
||||
a compiled-in constant, such as set a value from `optarg', set the
|
||||
option's `flag' field to zero and its `val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero `flag' field, `getopt'
|
||||
returns the contents of the `val' field. */
|
||||
|
||||
struct option
|
||||
{
|
||||
const char *name;
|
||||
/* has_arg can't be an enum because some compilers complain about
|
||||
type mismatches in all the code that assumes it is an int. */
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
|
||||
# define no_argument 0
|
||||
# define required_argument 1
|
||||
# define optional_argument 2
|
||||
#endif /* need getopt */
|
||||
|
||||
|
||||
/* Get definitions and prototypes for functions to process the
|
||||
arguments in ARGV (ARGC of them, minus the program name) for
|
||||
options given in OPTS.
|
||||
|
||||
Return the option character from OPTS just read. Return -1 when
|
||||
there are no more options. For unrecognized options, or options
|
||||
missing arguments, `optopt' is set to the option letter, and '?' is
|
||||
returned.
|
||||
|
||||
The OPTS string is a list of characters which are recognized option
|
||||
letters, optionally followed by colons, specifying that that letter
|
||||
takes an argument, to be placed in `optarg'.
|
||||
|
||||
If a letter in OPTS is followed by two colons, its argument is
|
||||
optional. This behavior is specific to the GNU `getopt'.
|
||||
|
||||
The argument `--' causes premature termination of argument
|
||||
scanning, explicitly telling `getopt' that there are no more
|
||||
options.
|
||||
|
||||
If OPTS begins with `-', then non-option arguments are treated as
|
||||
arguments to the option '\1'. This behavior is specific to the GNU
|
||||
`getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in
|
||||
the environment, then do not permute arguments. */
|
||||
|
||||
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
|
||||
__THROW;
|
||||
|
||||
#ifndef __need_getopt
|
||||
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind)
|
||||
__THROW;
|
||||
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind)
|
||||
__THROW;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make sure we later can get all the definitions and declarations. */
|
||||
#undef __need_getopt
|
||||
|
||||
#endif /* getopt.h */
|
||||
170
lib/getopt1.c
170
lib/getopt1.c
@@ -1,170 +0,0 @@
|
||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006,2009
|
||||
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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <getopt.h>
|
||||
#else
|
||||
# include <config.h>
|
||||
# include "getopt.h"
|
||||
#endif
|
||||
#include "getopt_int.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
int
|
||||
getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
|
||||
const struct option *long_options, int *opt_index)
|
||||
{
|
||||
return _getopt_internal (argc, (char **) argv, options, long_options,
|
||||
opt_index, 0, 0);
|
||||
}
|
||||
|
||||
int
|
||||
_getopt_long_r (int argc, char **argv, const char *options,
|
||||
const struct option *long_options, int *opt_index,
|
||||
struct _getopt_data *d)
|
||||
{
|
||||
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
||||
0, 0, d);
|
||||
}
|
||||
|
||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||
If an option that starts with '-' (not '--') doesn't match a long option,
|
||||
but does match a short option, it is parsed as a short option
|
||||
instead. */
|
||||
|
||||
int
|
||||
getopt_long_only (int argc, char *__getopt_argv_const *argv,
|
||||
const char *options,
|
||||
const struct option *long_options, int *opt_index)
|
||||
{
|
||||
return _getopt_internal (argc, (char **) argv, options, long_options,
|
||||
opt_index, 1, 0);
|
||||
}
|
||||
|
||||
int
|
||||
_getopt_long_only_r (int argc, char **argv, const char *options,
|
||||
const struct option *long_options, int *opt_index,
|
||||
struct _getopt_data *d)
|
||||
{
|
||||
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
||||
1, 0, d);
|
||||
}
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
int option_index = 0;
|
||||
static const struct option long_options[] =
|
||||
{
|
||||
{"add", 1, 0, 0},
|
||||
{"append", 0, 0, 0},
|
||||
{"delete", 1, 0, 0},
|
||||
{"verbose", 0, 0, 0},
|
||||
{"create", 0, 0, 0},
|
||||
{"file", 1, 0, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
printf ("option %s", long_options[option_index].name);
|
||||
if (optarg)
|
||||
printf (" with arg %s", optarg);
|
||||
printf ("\n");
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf ("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf ("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf ("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf ("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf ("option c with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
printf ("option d with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
printf ("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
||||
130
lib/getopt_int.h
130
lib/getopt_int.h
@@ -1,130 +0,0 @@
|
||||
/* Internal declarations for getopt.
|
||||
Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
|
||||
1999, 2001, 2003, 2004, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GETOPT_INT_H
|
||||
#define _GETOPT_INT_H 1
|
||||
|
||||
extern int _getopt_internal (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
int __long_only, int __posixly_correct);
|
||||
|
||||
|
||||
/* Reentrant versions which can handle parsing multiple argument
|
||||
vectors at the same time. */
|
||||
|
||||
/* Data type for reentrant functions. */
|
||||
struct _getopt_data
|
||||
{
|
||||
/* These have exactly the same meaning as the corresponding global
|
||||
variables, except that they are used for the reentrant
|
||||
versions of getopt. */
|
||||
int optind;
|
||||
int opterr;
|
||||
int optopt;
|
||||
char *optarg;
|
||||
|
||||
/* Internal members. */
|
||||
|
||||
/* True if the internal members have been initialized. */
|
||||
int __initialized;
|
||||
|
||||
/* The next char to be scanned in the option-element
|
||||
in which the last option character we returned was found.
|
||||
This allows us to pick up the scan where we left off.
|
||||
|
||||
If this is zero, or a null string, it means resume the scan
|
||||
by advancing to the next ARGV-element. */
|
||||
char *__nextchar;
|
||||
|
||||
/* Describe how to deal with options that follow non-option ARGV-elements.
|
||||
|
||||
If the caller did not specify anything,
|
||||
the default is REQUIRE_ORDER if the environment variable
|
||||
POSIXLY_CORRECT is defined, PERMUTE otherwise.
|
||||
|
||||
REQUIRE_ORDER means don't recognize them as options;
|
||||
stop option processing when the first non-option is seen.
|
||||
This is what Unix does.
|
||||
This mode of operation is selected by either setting the environment
|
||||
variable POSIXLY_CORRECT, or using `+' as the first character
|
||||
of the list of option characters, or by calling getopt.
|
||||
|
||||
PERMUTE is the default. We permute the contents of ARGV as we
|
||||
scan, so that eventually all the non-options are at the end.
|
||||
This allows options to be given in any order, even with programs
|
||||
that were not written to expect this.
|
||||
|
||||
RETURN_IN_ORDER is an option available to programs that were
|
||||
written to expect options and other ARGV-elements in any order
|
||||
and that care about the ordering of the two. We describe each
|
||||
non-option ARGV-element as if it were the argument of an option
|
||||
with character code 1. Using `-' as the first character of the
|
||||
list of option characters selects this mode of operation.
|
||||
|
||||
The special argument `--' forces an end of option-scanning regardless
|
||||
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
|
||||
`--' can cause `getopt' to return -1 with `optind' != ARGC. */
|
||||
|
||||
enum
|
||||
{
|
||||
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
|
||||
} __ordering;
|
||||
|
||||
/* If the POSIXLY_CORRECT environment variable is set
|
||||
or getopt was called. */
|
||||
int __posixly_correct;
|
||||
|
||||
|
||||
/* Handle permutation of arguments. */
|
||||
|
||||
/* Describe the part of ARGV that contains non-options that have
|
||||
been skipped. `first_nonopt' is the index in ARGV of the first
|
||||
of them; `last_nonopt' is the index after the last of them. */
|
||||
|
||||
int __first_nonopt;
|
||||
int __last_nonopt;
|
||||
|
||||
#if defined _LIBC && defined USE_NONOPTION_FLAGS
|
||||
int __nonoption_flags_max_len;
|
||||
int __nonoption_flags_len;
|
||||
# endif
|
||||
};
|
||||
|
||||
/* The initializer is necessary to set OPTIND and OPTERR to their
|
||||
default values and to clear the initialization flag. */
|
||||
#define _GETOPT_DATA_INITIALIZER { 1, 1 }
|
||||
|
||||
extern int _getopt_internal_r (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
int __long_only, int __posixly_correct,
|
||||
struct _getopt_data *__data);
|
||||
|
||||
extern int _getopt_long_r (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
struct _getopt_data *__data);
|
||||
|
||||
extern int _getopt_long_only_r (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts,
|
||||
int *__longind,
|
||||
struct _getopt_data *__data);
|
||||
|
||||
#endif /* getopt_int.h */
|
||||
@@ -1,39 +0,0 @@
|
||||
/* getpagesize emulation for systems where it cannot be done in a C macro.
|
||||
|
||||
Copyright (C) 2007, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible and Martin Lambers. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <unistd.h>
|
||||
|
||||
/* This implementation is only for native Win32 systems. */
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
int
|
||||
getpagesize (void)
|
||||
{
|
||||
SYSTEM_INFO system_info;
|
||||
GetSystemInfo (&system_info);
|
||||
return system_info.dwPageSize;
|
||||
}
|
||||
|
||||
#endif
|
||||
232
lib/getpass.c
232
lib/getpass.c
@@ -1,232 +0,0 @@
|
||||
/* Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2003, 2004, 2005, 2006, 2007, 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _LIBC
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "getpass.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#if HAVE_DECL___FSETLOCKING && HAVE___FSETLOCKING
|
||||
# if HAVE_STDIO_EXT_H
|
||||
# include <stdio_ext.h>
|
||||
# endif
|
||||
#else
|
||||
# define __fsetlocking(stream, type) /* empty */
|
||||
#endif
|
||||
|
||||
#if HAVE_TERMIOS_H
|
||||
# include <termios.h>
|
||||
#endif
|
||||
|
||||
#if USE_UNLOCKED_IO
|
||||
# include "unlocked-io.h"
|
||||
#else
|
||||
# if !HAVE_DECL_FFLUSH_UNLOCKED
|
||||
# undef fflush_unlocked
|
||||
# define fflush_unlocked(x) fflush (x)
|
||||
# endif
|
||||
# if !HAVE_DECL_FLOCKFILE
|
||||
# undef flockfile
|
||||
# define flockfile(x) ((void) 0)
|
||||
# endif
|
||||
# if !HAVE_DECL_FUNLOCKFILE
|
||||
# undef funlockfile
|
||||
# define funlockfile(x) ((void) 0)
|
||||
# endif
|
||||
# if !HAVE_DECL_FPUTS_UNLOCKED
|
||||
# undef fputs_unlocked
|
||||
# define fputs_unlocked(str,stream) fputs (str, stream)
|
||||
# endif
|
||||
# if !HAVE_DECL_PUTC_UNLOCKED
|
||||
# undef putc_unlocked
|
||||
# define putc_unlocked(c,stream) putc (c, stream)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* It is desirable to use this bit on systems that have it.
|
||||
The only bit of terminal state we want to twiddle is echoing, which is
|
||||
done in software; there is no need to change the state of the terminal
|
||||
hardware. */
|
||||
|
||||
#ifndef TCSASOFT
|
||||
# define TCSASOFT 0
|
||||
#endif
|
||||
|
||||
static void
|
||||
call_fclose (void *arg)
|
||||
{
|
||||
if (arg != NULL)
|
||||
fclose (arg);
|
||||
}
|
||||
|
||||
char *
|
||||
getpass (const char *prompt)
|
||||
{
|
||||
FILE *tty;
|
||||
FILE *in, *out;
|
||||
struct termios s, t;
|
||||
bool tty_changed = false;
|
||||
static char *buf;
|
||||
static size_t bufsize;
|
||||
ssize_t nread;
|
||||
|
||||
/* Try to write to and read from the terminal if we can.
|
||||
If we can't open the terminal, use stderr and stdin. */
|
||||
|
||||
tty = fopen ("/dev/tty", "w+");
|
||||
if (tty == NULL)
|
||||
{
|
||||
in = stdin;
|
||||
out = stderr;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We do the locking ourselves. */
|
||||
__fsetlocking (tty, FSETLOCKING_BYCALLER);
|
||||
|
||||
out = in = tty;
|
||||
}
|
||||
|
||||
flockfile (out);
|
||||
|
||||
/* Turn echoing off if it is on now. */
|
||||
#if HAVE_TCGETATTR
|
||||
if (tcgetattr (fileno (in), &t) == 0)
|
||||
{
|
||||
/* Save the old one. */
|
||||
s = t;
|
||||
/* Tricky, tricky. */
|
||||
t.c_lflag &= ~(ECHO | ISIG);
|
||||
tty_changed = (tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &t) == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Write the prompt. */
|
||||
fputs_unlocked (prompt, out);
|
||||
fflush_unlocked (out);
|
||||
|
||||
/* Read the password. */
|
||||
nread = getline (&buf, &bufsize, in);
|
||||
|
||||
/* According to the C standard, input may not be followed by output
|
||||
on the same stream without an intervening call to a file
|
||||
positioning function. Suppose in == out; then without this fseek
|
||||
call, on Solaris, HP-UX, AIX, OSF/1, the previous input gets
|
||||
echoed, whereas on IRIX, the following newline is not output as
|
||||
it should be. POSIX imposes similar restrictions if fileno (in)
|
||||
== fileno (out). The POSIX restrictions are tricky and change
|
||||
from POSIX version to POSIX version, so play it safe and invoke
|
||||
fseek even if in != out. */
|
||||
fseeko (out, 0, SEEK_CUR);
|
||||
|
||||
if (buf != NULL)
|
||||
{
|
||||
if (nread < 0)
|
||||
buf[0] = '\0';
|
||||
else if (buf[nread - 1] == '\n')
|
||||
{
|
||||
/* Remove the newline. */
|
||||
buf[nread - 1] = '\0';
|
||||
if (tty_changed)
|
||||
{
|
||||
/* Write the newline that was not echoed. */
|
||||
putc_unlocked ('\n', out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Restore the original setting. */
|
||||
#if HAVE_TCSETATTR
|
||||
if (tty_changed)
|
||||
tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &s);
|
||||
#endif
|
||||
|
||||
funlockfile (out);
|
||||
|
||||
call_fclose (tty);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
#else /* W32 native */
|
||||
|
||||
/* Windows implementation by Martin Lambers <marlam@marlam.de>,
|
||||
improved by Simon Josefsson. */
|
||||
|
||||
/* For PASS_MAX. */
|
||||
#include <limits.h>
|
||||
/* For _getch(). */
|
||||
#include <conio.h>
|
||||
/* For strdup(). */
|
||||
#include <string.h>
|
||||
|
||||
#ifndef PASS_MAX
|
||||
# define PASS_MAX 512
|
||||
#endif
|
||||
|
||||
char *
|
||||
getpass (const char *prompt)
|
||||
{
|
||||
char getpassbuf[PASS_MAX + 1];
|
||||
size_t i = 0;
|
||||
int c;
|
||||
|
||||
if (prompt)
|
||||
{
|
||||
fputs (prompt, stderr);
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
c = _getch ();
|
||||
if (c == '\r')
|
||||
{
|
||||
getpassbuf[i] = '\0';
|
||||
break;
|
||||
}
|
||||
else if (i < PASS_MAX)
|
||||
{
|
||||
getpassbuf[i++] = c;
|
||||
}
|
||||
|
||||
if (i >= PASS_MAX)
|
||||
{
|
||||
getpassbuf[i] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (prompt)
|
||||
{
|
||||
fputs ("\r\n", stderr);
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
return strdup (getpassbuf);
|
||||
}
|
||||
#endif
|
||||
@@ -1,31 +0,0 @@
|
||||
/* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin.
|
||||
Copyright (C) 2004, 2009 Free Software Foundation, Inc.
|
||||
Contributed by Simon Josefsson <jas@extundo.com>, 2004.
|
||||
|
||||
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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef GETPASS_H
|
||||
# define GETPASS_H
|
||||
|
||||
/* Get getpass declaration, if available. */
|
||||
# include <unistd.h>
|
||||
|
||||
# if defined HAVE_DECL_GETPASS && !HAVE_DECL_GETPASS
|
||||
/* Read a password of arbitrary length from /dev/tty or stdin. */
|
||||
char *getpass (const char *prompt);
|
||||
|
||||
# endif
|
||||
|
||||
#endif /* GETPASS_H */
|
||||
279
lib/gettext.h
279
lib/gettext.h
@@ -1,279 +0,0 @@
|
||||
/* Convenience header for conditional use of GNU <libintl.h>.
|
||||
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _LIBGETTEXT_H
|
||||
#define _LIBGETTEXT_H 1
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
#if ENABLE_NLS
|
||||
|
||||
/* Get declarations of GNU message catalog functions. */
|
||||
# include <libintl.h>
|
||||
|
||||
/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
|
||||
the gettext() and ngettext() macros. This is an alternative to calling
|
||||
textdomain(), and is useful for libraries. */
|
||||
# ifdef DEFAULT_TEXT_DOMAIN
|
||||
# undef gettext
|
||||
# define gettext(Msgid) \
|
||||
dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
|
||||
# undef ngettext
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
|
||||
# endif
|
||||
|
||||
#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
|
||||
later inclusions of <locale.h> a NOP. We don't include <libintl.h>
|
||||
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
|
||||
|
||||
/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
|
||||
<libintl.h>, which chokes if dcgettext is defined as a macro. So include
|
||||
it now, to make later inclusions of <libintl.h> a NOP. */
|
||||
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
|
||||
# include <cstdlib>
|
||||
# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
|
||||
# include <libintl.h>
|
||||
# endif
|
||||
#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". */
|
||||
# undef gettext
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
# undef dgettext
|
||||
# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
|
||||
# undef dcgettext
|
||||
# define dcgettext(Domainname, Msgid, Category) \
|
||||
((void) (Category), dgettext (Domainname, Msgid))
|
||||
# undef ngettext
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 \
|
||||
? ((void) (Msgid2), (const char *) (Msgid1)) \
|
||||
: ((void) (Msgid1), (const char *) (Msgid2)))
|
||||
# undef dngettext
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((void) (Domainname), ngettext (Msgid1, Msgid2, N))
|
||||
# undef dcngettext
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
|
||||
# undef textdomain
|
||||
# define textdomain(Domainname) ((const char *) (Domainname))
|
||||
# undef bindtextdomain
|
||||
# define bindtextdomain(Domainname, Dirname) \
|
||||
((void) (Domainname), (const char *) (Dirname))
|
||||
# undef bind_textdomain_codeset
|
||||
# define bind_textdomain_codeset(Domainname, Codeset) \
|
||||
((void) (Domainname), (const char *) (Codeset))
|
||||
|
||||
#endif
|
||||
|
||||
/* A pseudo function call that serves as a marker for the automated
|
||||
extraction of messages, but does not call gettext(). The run-time
|
||||
translation is done at a different place in the code.
|
||||
The argument, String, should be a literal string. Concatenated strings
|
||||
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
|
||||
|
||||
/* The separator between msgctxt and msgid in a .mo file. */
|
||||
#define GETTEXT_CONTEXT_GLUE "\004"
|
||||
|
||||
/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
|
||||
MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be
|
||||
short and rarely need to change.
|
||||
The letter 'p' stands for 'particular' or 'special'. */
|
||||
#ifdef DEFAULT_TEXT_DOMAIN
|
||||
# define pgettext(Msgctxt, Msgid) \
|
||||
pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#else
|
||||
# define pgettext(Msgctxt, Msgid) \
|
||||
pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#endif
|
||||
#define dpgettext(Domainname, Msgctxt, Msgid) \
|
||||
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
|
||||
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
|
||||
#ifdef DEFAULT_TEXT_DOMAIN
|
||||
# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#else
|
||||
# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#endif
|
||||
#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
|
||||
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
|
||||
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
pgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
int category)
|
||||
{
|
||||
const char *translation = dcgettext (domain, msg_ctxt_id, category);
|
||||
if (translation == msg_ctxt_id)
|
||||
return msgid;
|
||||
else
|
||||
return translation;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
npgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
{
|
||||
const char *translation =
|
||||
dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
if (translation == msg_ctxt_id || translation == msgid_plural)
|
||||
return (n == 1 ? msgid : msgid_plural);
|
||||
else
|
||||
return translation;
|
||||
}
|
||||
|
||||
/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
|
||||
can be arbitrary expressions. But for string literals these macros are
|
||||
less efficient than those above. */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
|
||||
(((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
|
||||
/* || __STDC_VERSION__ >= 199901L */ )
|
||||
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#define pgettext_expr(Msgctxt, Msgid) \
|
||||
dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
|
||||
#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
|
||||
dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
dcpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
int category)
|
||||
{
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
const char *translation;
|
||||
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
char msg_ctxt_id[msgctxt_len + msgid_len];
|
||||
#else
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *) malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id != NULL)
|
||||
#endif
|
||||
{
|
||||
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
|
||||
msg_ctxt_id[msgctxt_len - 1] = '\004';
|
||||
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
|
||||
translation = dcgettext (domain, msg_ctxt_id, category);
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
if (msg_ctxt_id != buf)
|
||||
free (msg_ctxt_id);
|
||||
#endif
|
||||
if (translation != msg_ctxt_id)
|
||||
return translation;
|
||||
}
|
||||
return msgid;
|
||||
}
|
||||
|
||||
#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
|
||||
dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
dcnpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
{
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
const char *translation;
|
||||
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
char msg_ctxt_id[msgctxt_len + msgid_len];
|
||||
#else
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *) malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id != NULL)
|
||||
#endif
|
||||
{
|
||||
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
|
||||
msg_ctxt_id[msgctxt_len - 1] = '\004';
|
||||
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
|
||||
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
if (msg_ctxt_id != buf)
|
||||
free (msg_ctxt_id);
|
||||
#endif
|
||||
if (!(translation == msg_ctxt_id || translation == msgid_plural))
|
||||
return translation;
|
||||
}
|
||||
return (n == 1 ? msgid : msgid_plural);
|
||||
}
|
||||
|
||||
#endif /* _LIBGETTEXT_H */
|
||||
@@ -1,78 +0,0 @@
|
||||
/* intprops.h -- properties of integer types
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
/* The extra casts in the following macros work around compiler bugs,
|
||||
e.g., in Cray C 5.0.3.0. */
|
||||
|
||||
/* True if the arithmetic type T is an integer type. bool counts as
|
||||
an integer. */
|
||||
#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
|
||||
|
||||
/* True if negative values of the signed integer type T use two's
|
||||
complement, ones' complement, or signed magnitude representation,
|
||||
respectively. Much GNU code assumes two's complement, but some
|
||||
people like to be portable to all possible C hosts. */
|
||||
#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
|
||||
#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
|
||||
#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
|
||||
|
||||
/* True if the arithmetic type T is signed. */
|
||||
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
|
||||
/* The maximum and minimum values for the integer type T. These
|
||||
macros have undefined behavior if T is signed and has padding bits.
|
||||
If this is a problem for you, please let us know how to fix it for
|
||||
your host. */
|
||||
#define TYPE_MINIMUM(t) \
|
||||
((t) (! TYPE_SIGNED (t) \
|
||||
? (t) 0 \
|
||||
: TYPE_SIGNED_MAGNITUDE (t) \
|
||||
? ~ (t) 0 \
|
||||
: ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
|
||||
#define TYPE_MAXIMUM(t) \
|
||||
((t) (! TYPE_SIGNED (t) \
|
||||
? (t) -1 \
|
||||
: ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
|
||||
|
||||
/* Return zero if T can be determined to be an unsigned type.
|
||||
Otherwise, return 1.
|
||||
When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a
|
||||
tighter bound. Otherwise, it overestimates the true bound by one byte
|
||||
when applied to unsigned types of size 2, 4, 16, ... bytes.
|
||||
The symbol signed_type_or_expr__ is private to this header file. */
|
||||
#if __GNUC__ >= 2
|
||||
# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
|
||||
#else
|
||||
# define signed_type_or_expr__(t) 1
|
||||
#endif
|
||||
|
||||
/* Bound on length of the string representing an integer type or expression T.
|
||||
Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485;
|
||||
add 1 for integer division truncation; add 1 more for a minus sign
|
||||
if needed. */
|
||||
#define INT_STRLEN_BOUND(t) \
|
||||
((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \
|
||||
+ signed_type_or_expr__ (t) + 1)
|
||||
|
||||
/* Bound on buffer size needed to represent an integer type or expression T,
|
||||
including the terminating null. */
|
||||
#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
|
||||
@@ -1,499 +0,0 @@
|
||||
/* Determine a canonical name for the current locale's character encoding.
|
||||
|
||||
Copyright (C) 2000-2006, 2008-2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "localcharset.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
|
||||
# define DARWIN7 /* Darwin 7 or newer, i.e. MacOS X 10.3 or newer */
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __WIN32__
|
||||
# define WIN32_NATIVE
|
||||
#endif
|
||||
|
||||
#if defined __EMX__
|
||||
/* Assume EMX program runs on OS/2, even if compiled under DOS. */
|
||||
# ifndef OS2
|
||||
# define OS2
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined WIN32_NATIVE
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
# include <langinfo.h>
|
||||
# else
|
||||
# if 0 /* see comment below */
|
||||
# include <locale.h>
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __CYGWIN__
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# endif
|
||||
#elif defined WIN32_NATIVE
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#if defined OS2
|
||||
# define INCL_DOS
|
||||
# include <os2.h>
|
||||
#endif
|
||||
|
||||
#if ENABLE_RELOCATABLE
|
||||
# include "relocatable.h"
|
||||
#else
|
||||
# define relocate(pathname) (pathname)
|
||||
#endif
|
||||
|
||||
/* Get LIBDIR. */
|
||||
#ifndef LIBDIR
|
||||
# include "configmake.h"
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
|
||||
/* Win32, Cygwin, OS/2, DOS */
|
||||
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
|
||||
#endif
|
||||
|
||||
#ifndef DIRECTORY_SEPARATOR
|
||||
# define DIRECTORY_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
#ifndef ISSLASH
|
||||
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL_GETC_UNLOCKED
|
||||
# undef getc
|
||||
# define getc getc_unlocked
|
||||
#endif
|
||||
|
||||
/* The following static variable is declared 'volatile' to avoid a
|
||||
possible multithread problem in the function get_charset_aliases. If we
|
||||
are running in a threaded environment, and if two threads initialize
|
||||
'charset_aliases' simultaneously, both will produce the same value,
|
||||
and everything will be ok if the two assignments to 'charset_aliases'
|
||||
are atomic. But I don't know what will happen if the two assignments mix. */
|
||||
#if __STDC__ != 1
|
||||
# define volatile /* empty */
|
||||
#endif
|
||||
/* Pointer to the contents of the charset.alias file, if it has already been
|
||||
read, else NULL. Its format is:
|
||||
ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
|
||||
static const char * volatile charset_aliases;
|
||||
|
||||
/* Return a pointer to the contents of the charset.alias file. */
|
||||
static const char *
|
||||
get_charset_aliases (void)
|
||||
{
|
||||
const char *cp;
|
||||
|
||||
cp = charset_aliases;
|
||||
if (cp == NULL)
|
||||
{
|
||||
#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
|
||||
FILE *fp;
|
||||
const char *dir;
|
||||
const char *base = "charset.alias";
|
||||
char *file_name;
|
||||
|
||||
/* Make it possible to override the charset.alias location. This is
|
||||
necessary for running the testsuite before "make install". */
|
||||
dir = getenv ("CHARSETALIASDIR");
|
||||
if (dir == NULL || dir[0] == '\0')
|
||||
dir = relocate (LIBDIR);
|
||||
|
||||
/* Concatenate dir and base into freshly allocated file_name. */
|
||||
{
|
||||
size_t dir_len = strlen (dir);
|
||||
size_t base_len = strlen (base);
|
||||
int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
|
||||
file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
|
||||
if (file_name != NULL)
|
||||
{
|
||||
memcpy (file_name, dir, dir_len);
|
||||
if (add_slash)
|
||||
file_name[dir_len] = DIRECTORY_SEPARATOR;
|
||||
memcpy (file_name + dir_len + add_slash, base, base_len + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
|
||||
/* Out of memory or file not found, treat it as empty. */
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
/* Parse the file's contents. */
|
||||
char *res_ptr = NULL;
|
||||
size_t res_size = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int c;
|
||||
char buf1[50+1];
|
||||
char buf2[50+1];
|
||||
size_t l1, l2;
|
||||
char *old_res_ptr;
|
||||
|
||||
c = getc (fp);
|
||||
if (c == EOF)
|
||||
break;
|
||||
if (c == '\n' || c == ' ' || c == '\t')
|
||||
continue;
|
||||
if (c == '#')
|
||||
{
|
||||
/* Skip comment, to end of line. */
|
||||
do
|
||||
c = getc (fp);
|
||||
while (!(c == EOF || c == '\n'));
|
||||
if (c == EOF)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
ungetc (c, fp);
|
||||
if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
|
||||
break;
|
||||
l1 = strlen (buf1);
|
||||
l2 = strlen (buf2);
|
||||
old_res_ptr = res_ptr;
|
||||
if (res_size == 0)
|
||||
{
|
||||
res_size = l1 + 1 + l2 + 1;
|
||||
res_ptr = (char *) malloc (res_size + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
res_size += l1 + 1 + l2 + 1;
|
||||
res_ptr = (char *) realloc (res_ptr, res_size + 1);
|
||||
}
|
||||
if (res_ptr == NULL)
|
||||
{
|
||||
/* Out of memory. */
|
||||
res_size = 0;
|
||||
if (old_res_ptr != NULL)
|
||||
free (old_res_ptr);
|
||||
break;
|
||||
}
|
||||
strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
|
||||
strcpy (res_ptr + res_size - (l2 + 1), buf2);
|
||||
}
|
||||
fclose (fp);
|
||||
if (res_size == 0)
|
||||
cp = "";
|
||||
else
|
||||
{
|
||||
*(res_ptr + res_size) = '\0';
|
||||
cp = res_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_name != NULL)
|
||||
free (file_name);
|
||||
|
||||
#else
|
||||
|
||||
# if defined DARWIN7
|
||||
/* To avoid the trouble of installing a file that is shared by many
|
||||
GNU packages -- many packaging systems have problems with this --,
|
||||
simply inline the aliases here. */
|
||||
cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
|
||||
"ISO8859-2" "\0" "ISO-8859-2" "\0"
|
||||
"ISO8859-4" "\0" "ISO-8859-4" "\0"
|
||||
"ISO8859-5" "\0" "ISO-8859-5" "\0"
|
||||
"ISO8859-7" "\0" "ISO-8859-7" "\0"
|
||||
"ISO8859-9" "\0" "ISO-8859-9" "\0"
|
||||
"ISO8859-13" "\0" "ISO-8859-13" "\0"
|
||||
"ISO8859-15" "\0" "ISO-8859-15" "\0"
|
||||
"KOI8-R" "\0" "KOI8-R" "\0"
|
||||
"KOI8-U" "\0" "KOI8-U" "\0"
|
||||
"CP866" "\0" "CP866" "\0"
|
||||
"CP949" "\0" "CP949" "\0"
|
||||
"CP1131" "\0" "CP1131" "\0"
|
||||
"CP1251" "\0" "CP1251" "\0"
|
||||
"eucCN" "\0" "GB2312" "\0"
|
||||
"GB2312" "\0" "GB2312" "\0"
|
||||
"eucJP" "\0" "EUC-JP" "\0"
|
||||
"eucKR" "\0" "EUC-KR" "\0"
|
||||
"Big5" "\0" "BIG5" "\0"
|
||||
"Big5HKSCS" "\0" "BIG5-HKSCS" "\0"
|
||||
"GBK" "\0" "GBK" "\0"
|
||||
"GB18030" "\0" "GB18030" "\0"
|
||||
"SJIS" "\0" "SHIFT_JIS" "\0"
|
||||
"ARMSCII-8" "\0" "ARMSCII-8" "\0"
|
||||
"PT154" "\0" "PT154" "\0"
|
||||
/*"ISCII-DEV" "\0" "?" "\0"*/
|
||||
"*" "\0" "UTF-8" "\0";
|
||||
# endif
|
||||
|
||||
# if defined VMS
|
||||
/* To avoid the troubles of an extra file charset.alias_vms in the
|
||||
sources of many GNU packages, simply inline the aliases here. */
|
||||
/* The list of encodings is taken from the OpenVMS 7.3-1 documentation
|
||||
"Compaq C Run-Time Library Reference Manual for OpenVMS systems"
|
||||
section 10.7 "Handling Different Character Sets". */
|
||||
cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
|
||||
"ISO8859-2" "\0" "ISO-8859-2" "\0"
|
||||
"ISO8859-5" "\0" "ISO-8859-5" "\0"
|
||||
"ISO8859-7" "\0" "ISO-8859-7" "\0"
|
||||
"ISO8859-8" "\0" "ISO-8859-8" "\0"
|
||||
"ISO8859-9" "\0" "ISO-8859-9" "\0"
|
||||
/* Japanese */
|
||||
"eucJP" "\0" "EUC-JP" "\0"
|
||||
"SJIS" "\0" "SHIFT_JIS" "\0"
|
||||
"DECKANJI" "\0" "DEC-KANJI" "\0"
|
||||
"SDECKANJI" "\0" "EUC-JP" "\0"
|
||||
/* Chinese */
|
||||
"eucTW" "\0" "EUC-TW" "\0"
|
||||
"DECHANYU" "\0" "DEC-HANYU" "\0"
|
||||
"DECHANZI" "\0" "GB2312" "\0"
|
||||
/* Korean */
|
||||
"DECKOREAN" "\0" "EUC-KR" "\0";
|
||||
# endif
|
||||
|
||||
# if defined WIN32_NATIVE || defined __CYGWIN__
|
||||
/* To avoid the troubles of installing a separate file in the same
|
||||
directory as the DLL and of retrieving the DLL's directory at
|
||||
runtime, simply inline the aliases here. */
|
||||
|
||||
cp = "CP936" "\0" "GBK" "\0"
|
||||
"CP1361" "\0" "JOHAB" "\0"
|
||||
"CP20127" "\0" "ASCII" "\0"
|
||||
"CP20866" "\0" "KOI8-R" "\0"
|
||||
"CP20936" "\0" "GB2312" "\0"
|
||||
"CP21866" "\0" "KOI8-RU" "\0"
|
||||
"CP28591" "\0" "ISO-8859-1" "\0"
|
||||
"CP28592" "\0" "ISO-8859-2" "\0"
|
||||
"CP28593" "\0" "ISO-8859-3" "\0"
|
||||
"CP28594" "\0" "ISO-8859-4" "\0"
|
||||
"CP28595" "\0" "ISO-8859-5" "\0"
|
||||
"CP28596" "\0" "ISO-8859-6" "\0"
|
||||
"CP28597" "\0" "ISO-8859-7" "\0"
|
||||
"CP28598" "\0" "ISO-8859-8" "\0"
|
||||
"CP28599" "\0" "ISO-8859-9" "\0"
|
||||
"CP28605" "\0" "ISO-8859-15" "\0"
|
||||
"CP38598" "\0" "ISO-8859-8" "\0"
|
||||
"CP51932" "\0" "EUC-JP" "\0"
|
||||
"CP51936" "\0" "GB2312" "\0"
|
||||
"CP51949" "\0" "EUC-KR" "\0"
|
||||
"CP51950" "\0" "EUC-TW" "\0"
|
||||
"CP54936" "\0" "GB18030" "\0"
|
||||
"CP65001" "\0" "UTF-8" "\0";
|
||||
# endif
|
||||
#endif
|
||||
|
||||
charset_aliases = cp;
|
||||
}
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
/* Determine the current locale's character encoding, and canonicalize it
|
||||
into one of the canonical names listed in config.charset.
|
||||
The result must not be freed; it is statically allocated.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
|
||||
#ifdef STATIC
|
||||
STATIC
|
||||
#endif
|
||||
const char *
|
||||
locale_charset (void)
|
||||
{
|
||||
const char *codeset;
|
||||
const char *aliases;
|
||||
|
||||
#if !(defined WIN32_NATIVE || defined OS2)
|
||||
|
||||
# if HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Most systems support nl_langinfo (CODESET) nowadays. */
|
||||
codeset = nl_langinfo (CODESET);
|
||||
|
||||
# ifdef __CYGWIN__
|
||||
/* Cygwin 2006 does not have locales. nl_langinfo (CODESET) always
|
||||
returns "US-ASCII". As long as this is not fixed, return the suffix
|
||||
of the locale name from the environment variables (if present) or
|
||||
the codepage as a number. */
|
||||
if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
|
||||
{
|
||||
const char *locale;
|
||||
static char buf[2 + 10 + 1];
|
||||
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
if (locale != NULL && locale[0] != '\0')
|
||||
{
|
||||
/* If the locale name contains an encoding after the dot, return
|
||||
it. */
|
||||
const char *dot = strchr (locale, '.');
|
||||
|
||||
if (dot != NULL)
|
||||
{
|
||||
const char *modifier;
|
||||
|
||||
dot++;
|
||||
/* Look for the possible @... trailer and remove it, if any. */
|
||||
modifier = strchr (dot, '@');
|
||||
if (modifier == NULL)
|
||||
return dot;
|
||||
if (modifier - dot < sizeof (buf))
|
||||
{
|
||||
memcpy (buf, dot, modifier - dot);
|
||||
buf [modifier - dot] = '\0';
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Woe32 has a function returning the locale's codepage as a number. */
|
||||
sprintf (buf, "CP%u", GetACP ());
|
||||
codeset = buf;
|
||||
}
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
/* On old systems which lack it, use setlocale or getenv. */
|
||||
const char *locale = NULL;
|
||||
|
||||
/* But most old systems don't have a complete set of locales. Some
|
||||
(like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
|
||||
use setlocale here; it would return "C" when it doesn't support the
|
||||
locale name the user has set. */
|
||||
# if 0
|
||||
locale = setlocale (LC_CTYPE, NULL);
|
||||
# endif
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
}
|
||||
|
||||
/* On some old systems, one used to set locale = "iso8859_1". On others,
|
||||
you set it to "language_COUNTRY.charset". In any case, we resolve it
|
||||
through the charset.alias file. */
|
||||
codeset = locale;
|
||||
|
||||
# endif
|
||||
|
||||
#elif defined WIN32_NATIVE
|
||||
|
||||
static char buf[2 + 10 + 1];
|
||||
|
||||
/* Woe32 has a function returning the locale's codepage as a number. */
|
||||
sprintf (buf, "CP%u", GetACP ());
|
||||
codeset = buf;
|
||||
|
||||
#elif defined OS2
|
||||
|
||||
const char *locale;
|
||||
static char buf[2 + 10 + 1];
|
||||
ULONG cp[3];
|
||||
ULONG cplen;
|
||||
|
||||
/* Allow user to override the codeset, as set in the operating system,
|
||||
with standard language environment variables. */
|
||||
locale = getenv ("LC_ALL");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
{
|
||||
locale = getenv ("LC_CTYPE");
|
||||
if (locale == NULL || locale[0] == '\0')
|
||||
locale = getenv ("LANG");
|
||||
}
|
||||
if (locale != NULL && locale[0] != '\0')
|
||||
{
|
||||
/* If the locale name contains an encoding after the dot, return it. */
|
||||
const char *dot = strchr (locale, '.');
|
||||
|
||||
if (dot != NULL)
|
||||
{
|
||||
const char *modifier;
|
||||
|
||||
dot++;
|
||||
/* Look for the possible @... trailer and remove it, if any. */
|
||||
modifier = strchr (dot, '@');
|
||||
if (modifier == NULL)
|
||||
return dot;
|
||||
if (modifier - dot < sizeof (buf))
|
||||
{
|
||||
memcpy (buf, dot, modifier - dot);
|
||||
buf [modifier - dot] = '\0';
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
/* Resolve through the charset.alias file. */
|
||||
codeset = locale;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* OS/2 has a function returning the locale's codepage as a number. */
|
||||
if (DosQueryCp (sizeof (cp), cp, &cplen))
|
||||
codeset = "";
|
||||
else
|
||||
{
|
||||
sprintf (buf, "CP%u", cp[0]);
|
||||
codeset = buf;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (codeset == NULL)
|
||||
/* The canonical name cannot be determined. */
|
||||
codeset = "";
|
||||
|
||||
/* Resolve alias. */
|
||||
for (aliases = get_charset_aliases ();
|
||||
*aliases != '\0';
|
||||
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
|
||||
if (strcmp (codeset, aliases) == 0
|
||||
|| (aliases[0] == '*' && aliases[1] == '\0'))
|
||||
{
|
||||
codeset = aliases + strlen (aliases) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Don't return an empty string. GNU libc and GNU libiconv interpret
|
||||
the empty string as denoting "the locale's character encoding",
|
||||
thus GNU libiconv would call this function a second time. */
|
||||
if (codeset[0] == '\0')
|
||||
codeset = "ASCII";
|
||||
|
||||
return codeset;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/* Determine a canonical name for the current locale's character encoding.
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation,
|
||||
Inc.
|
||||
This file is part of the GNU CHARSET 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _LOCALCHARSET_H
|
||||
#define _LOCALCHARSET_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine the current locale's character encoding, and canonicalize it
|
||||
into one of the canonical names listed in config.charset.
|
||||
The result must not be freed; it is statically allocated.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
extern const char * locale_charset (void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _LOCALCHARSET_H */
|
||||
62
lib/lseek.c
62
lib/lseek.c
@@ -1,62 +0,0 @@
|
||||
/* An lseek() function that detects pipes.
|
||||
Copyright (C) 2007, 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <unistd.h>
|
||||
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
/* Windows platforms. */
|
||||
/* Get GetFileType. */
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#undef lseek
|
||||
|
||||
off_t
|
||||
rpl_lseek (int fd, off_t offset, int whence)
|
||||
{
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
/* mingw lseek mistakenly succeeds on pipes, sockets, and terminals. */
|
||||
HANDLE h = (HANDLE) _get_osfhandle (fd);
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
if (GetFileType (h) != FILE_TYPE_DISK)
|
||||
{
|
||||
errno = ESPIPE;
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
/* BeOS lseek mistakenly succeeds on pipes... */
|
||||
struct stat statbuf;
|
||||
if (fstat (fd, &statbuf) < 0)
|
||||
return -1;
|
||||
if (!S_ISREG (statbuf.st_mode))
|
||||
{
|
||||
errno = ESPIPE;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
return lseek (fd, offset, whence);
|
||||
}
|
||||
386
lib/mbrtowc.c
386
lib/mbrtowc.c
@@ -1,386 +0,0 @@
|
||||
/* Convert multibyte character to wide character.
|
||||
Copyright (C) 1999-2002, 2005-2009 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2008.
|
||||
|
||||
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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <wchar.h>
|
||||
|
||||
#if GNULIB_defined_mbstate_t
|
||||
/* Implement mbrtowc() on top of mbtowc(). */
|
||||
|
||||
# include <errno.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
# include "localcharset.h"
|
||||
# include "streq.h"
|
||||
# include "verify.h"
|
||||
|
||||
|
||||
verify (sizeof (mbstate_t) >= 4);
|
||||
|
||||
static char internal_state[4];
|
||||
|
||||
size_t
|
||||
mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
||||
{
|
||||
char *pstate = (char *)ps;
|
||||
|
||||
if (pstate == NULL)
|
||||
pstate = internal_state;
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
pwc = NULL;
|
||||
s = "";
|
||||
n = 1;
|
||||
}
|
||||
|
||||
if (n == 0)
|
||||
return (size_t)(-2);
|
||||
|
||||
/* Here n > 0. */
|
||||
{
|
||||
size_t nstate = pstate[0];
|
||||
char buf[4];
|
||||
const char *p;
|
||||
size_t m;
|
||||
|
||||
switch (nstate)
|
||||
{
|
||||
case 0:
|
||||
p = s;
|
||||
m = n;
|
||||
break;
|
||||
case 3:
|
||||
buf[2] = pstate[3];
|
||||
/*FALLTHROUGH*/
|
||||
case 2:
|
||||
buf[1] = pstate[2];
|
||||
/*FALLTHROUGH*/
|
||||
case 1:
|
||||
buf[0] = pstate[1];
|
||||
p = buf;
|
||||
m = nstate;
|
||||
buf[m++] = s[0];
|
||||
if (n >= 2 && m < 4)
|
||||
{
|
||||
buf[m++] = s[1];
|
||||
if (n >= 3 && m < 4)
|
||||
buf[m++] = s[2];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return (size_t)(-1);
|
||||
}
|
||||
|
||||
/* Here m > 0. */
|
||||
|
||||
# if __GLIBC__
|
||||
/* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */
|
||||
mbtowc (NULL, NULL, 0);
|
||||
# endif
|
||||
{
|
||||
int res = mbtowc (pwc, p, m);
|
||||
|
||||
if (res >= 0)
|
||||
{
|
||||
if (pwc != NULL && ((*pwc == 0) != (res == 0)))
|
||||
abort ();
|
||||
if (nstate >= (res > 0 ? res : 1))
|
||||
abort ();
|
||||
res -= nstate;
|
||||
pstate[0] = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
/* mbtowc does not distinguish between invalid and incomplete multibyte
|
||||
sequences. But mbrtowc needs to make this distinction.
|
||||
There are two possible approaches:
|
||||
- Use iconv() and its return value.
|
||||
- Use built-in knowledge about the possible encodings.
|
||||
Given the low quality of implementation of iconv() on the systems that
|
||||
lack mbrtowc(), we use the second approach.
|
||||
The possible encodings are:
|
||||
- 8-bit encodings,
|
||||
- EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS,
|
||||
- UTF-8.
|
||||
Use specialized code for each. */
|
||||
if (m >= 4 || m >= MB_CUR_MAX)
|
||||
goto invalid;
|
||||
/* Here MB_CUR_MAX > 1 and 0 < m < 4. */
|
||||
{
|
||||
const char *encoding = locale_charset ();
|
||||
|
||||
if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
|
||||
{
|
||||
/* Cf. unistr/u8-mblen.c. */
|
||||
unsigned char c = (unsigned char) p[0];
|
||||
|
||||
if (c >= 0xc2)
|
||||
{
|
||||
if (c < 0xe0)
|
||||
{
|
||||
if (m == 1)
|
||||
goto incomplete;
|
||||
}
|
||||
else if (c < 0xf0)
|
||||
{
|
||||
if (m == 1)
|
||||
goto incomplete;
|
||||
if (m == 2)
|
||||
{
|
||||
unsigned char c2 = (unsigned char) p[1];
|
||||
|
||||
if ((c2 ^ 0x80) < 0x40
|
||||
&& (c >= 0xe1 || c2 >= 0xa0)
|
||||
&& (c != 0xed || c2 < 0xa0))
|
||||
goto incomplete;
|
||||
}
|
||||
}
|
||||
else if (c <= 0xf4)
|
||||
{
|
||||
if (m == 1)
|
||||
goto incomplete;
|
||||
else /* m == 2 || m == 3 */
|
||||
{
|
||||
unsigned char c2 = (unsigned char) p[1];
|
||||
|
||||
if ((c2 ^ 0x80) < 0x40
|
||||
&& (c >= 0xf1 || c2 >= 0x90)
|
||||
&& (c < 0xf4 || (c == 0xf4 && c2 < 0x90)))
|
||||
{
|
||||
if (m == 2)
|
||||
goto incomplete;
|
||||
else /* m == 3 */
|
||||
{
|
||||
unsigned char c3 = (unsigned char) p[2];
|
||||
|
||||
if ((c3 ^ 0x80) < 0x40)
|
||||
goto incomplete;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
goto invalid;
|
||||
}
|
||||
|
||||
/* As a reference for this code, you can use the GNU libiconv
|
||||
implementation. Look for uses of the RET_TOOFEW macro. */
|
||||
|
||||
if (STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
|
||||
{
|
||||
if (m == 1)
|
||||
{
|
||||
unsigned char c = (unsigned char) p[0];
|
||||
|
||||
if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f)
|
||||
goto incomplete;
|
||||
}
|
||||
if (m == 2)
|
||||
{
|
||||
unsigned char c = (unsigned char) p[0];
|
||||
|
||||
if (c == 0x8f)
|
||||
{
|
||||
unsigned char c2 = (unsigned char) p[1];
|
||||
|
||||
if (c2 >= 0xa1 && c2 < 0xff)
|
||||
goto incomplete;
|
||||
}
|
||||
}
|
||||
goto invalid;
|
||||
}
|
||||
if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
|
||||
|| STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
|
||||
|| STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
|
||||
{
|
||||
if (m == 1)
|
||||
{
|
||||
unsigned char c = (unsigned char) p[0];
|
||||
|
||||
if (c >= 0xa1 && c < 0xff)
|
||||
goto incomplete;
|
||||
}
|
||||
goto invalid;
|
||||
}
|
||||
if (STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
|
||||
{
|
||||
if (m == 1)
|
||||
{
|
||||
unsigned char c = (unsigned char) p[0];
|
||||
|
||||
if ((c >= 0xa1 && c < 0xff) || c == 0x8e)
|
||||
goto incomplete;
|
||||
}
|
||||
else /* m == 2 || m == 3 */
|
||||
{
|
||||
unsigned char c = (unsigned char) p[0];
|
||||
|
||||
if (c == 0x8e)
|
||||
goto incomplete;
|
||||
}
|
||||
goto invalid;
|
||||
}
|
||||
if (STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
|
||||
{
|
||||
if (m == 1)
|
||||
{
|
||||
unsigned char c = (unsigned char) p[0];
|
||||
|
||||
if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe))
|
||||
goto incomplete;
|
||||
}
|
||||
else /* m == 2 || m == 3 */
|
||||
{
|
||||
unsigned char c = (unsigned char) p[0];
|
||||
|
||||
if (c >= 0x90 && c <= 0xe3)
|
||||
{
|
||||
unsigned char c2 = (unsigned char) p[1];
|
||||
|
||||
if (c2 >= 0x30 && c2 <= 0x39)
|
||||
{
|
||||
if (m == 2)
|
||||
goto incomplete;
|
||||
else /* m == 3 */
|
||||
{
|
||||
unsigned char c3 = (unsigned char) p[2];
|
||||
|
||||
if (c3 >= 0x81 && c3 <= 0xfe)
|
||||
goto incomplete;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
goto invalid;
|
||||
}
|
||||
if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
|
||||
{
|
||||
if (m == 1)
|
||||
{
|
||||
unsigned char c = (unsigned char) p[0];
|
||||
|
||||
if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)
|
||||
|| (c >= 0xf0 && c <= 0xf9))
|
||||
goto incomplete;
|
||||
}
|
||||
goto invalid;
|
||||
}
|
||||
|
||||
/* An unknown multibyte encoding. */
|
||||
goto incomplete;
|
||||
}
|
||||
|
||||
incomplete:
|
||||
{
|
||||
size_t k = nstate;
|
||||
/* Here 0 <= k < m < 4. */
|
||||
pstate[++k] = s[0];
|
||||
if (k < m)
|
||||
{
|
||||
pstate[++k] = s[1];
|
||||
if (k < m)
|
||||
pstate[++k] = s[2];
|
||||
}
|
||||
if (k != m)
|
||||
abort ();
|
||||
}
|
||||
pstate[0] = m;
|
||||
return (size_t)(-2);
|
||||
|
||||
invalid:
|
||||
errno = EILSEQ;
|
||||
/* The conversion state is undefined, says POSIX. */
|
||||
return (size_t)(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
/* Override the system's mbrtowc() function. */
|
||||
|
||||
# undef mbrtowc
|
||||
|
||||
size_t
|
||||
rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
||||
{
|
||||
# if MBRTOWC_NULL_ARG_BUG || MBRTOWC_RETVAL_BUG
|
||||
if (s == NULL)
|
||||
{
|
||||
pwc = NULL;
|
||||
s = "";
|
||||
n = 1;
|
||||
}
|
||||
# endif
|
||||
|
||||
# if MBRTOWC_RETVAL_BUG
|
||||
{
|
||||
static mbstate_t internal_state;
|
||||
|
||||
/* Override mbrtowc's internal state. We can not call mbsinit() on the
|
||||
hidden internal state, but we can call it on our variable. */
|
||||
if (ps == NULL)
|
||||
ps = &internal_state;
|
||||
|
||||
if (!mbsinit (ps))
|
||||
{
|
||||
/* Parse the rest of the multibyte character byte for byte. */
|
||||
size_t count = 0;
|
||||
for (; n > 0; s++, n--)
|
||||
{
|
||||
wchar_t wc;
|
||||
size_t ret = mbrtowc (&wc, s, 1, ps);
|
||||
|
||||
if (ret == (size_t)(-1))
|
||||
return (size_t)(-1);
|
||||
count++;
|
||||
if (ret != (size_t)(-2))
|
||||
{
|
||||
/* The multibyte character has been completed. */
|
||||
if (pwc != NULL)
|
||||
*pwc = wc;
|
||||
return (wc == 0 ? 0 : count);
|
||||
}
|
||||
}
|
||||
return (size_t)(-2);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
# if MBRTOWC_NUL_RETVAL_BUG
|
||||
{
|
||||
wchar_t wc;
|
||||
size_t ret = mbrtowc (&wc, s, n, ps);
|
||||
|
||||
if (ret != (size_t)(-1) && ret != (size_t)(-2))
|
||||
{
|
||||
if (pwc != NULL)
|
||||
*pwc = wc;
|
||||
if (wc == 0)
|
||||
ret = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
# else
|
||||
return mbrtowc (pwc, s, n, ps);
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,47 +0,0 @@
|
||||
/* Test for initial conversion state.
|
||||
Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2008.
|
||||
|
||||
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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <wchar.h>
|
||||
|
||||
#include "verify.h"
|
||||
|
||||
/* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs()
|
||||
and wcrtomb(), wcsrtombs().
|
||||
We assume that
|
||||
- sizeof (mbstate_t) >= 4,
|
||||
- only stateless encodings are supported (such as UTF-8 and EUC-JP, but
|
||||
not ISO-2022 variants),
|
||||
- for each encoding, the number of bytes for a wide character is <= 4.
|
||||
(This maximum is attained for UTF-8, GB18030, EUC-TW.)
|
||||
We define the meaning of mbstate_t as follows:
|
||||
- In mb -> wc direction, mbstate_t's first byte contains the number of
|
||||
buffered bytes (in the range 0..3), followed by up to 3 buffered bytes.
|
||||
- In wc -> mb direction, mbstate_t contains no information. In other
|
||||
words, it is always in the initial state. */
|
||||
|
||||
verify (sizeof (mbstate_t) >= 4);
|
||||
|
||||
int
|
||||
mbsinit (const mbstate_t *ps)
|
||||
{
|
||||
const char *pstate = (const char *)ps;
|
||||
|
||||
return pstate[0] == 0;
|
||||
}
|
||||
172
lib/memchr.c
172
lib/memchr.c
@@ -1,172 +0,0 @@
|
||||
/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2006,
|
||||
2008, 2009 Free Software Foundation, Inc.
|
||||
|
||||
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
|
||||
with help from Dan Sahlin (dan@sics.se) and
|
||||
commentary by Jim Blandy (jimb@ai.mit.edu);
|
||||
adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
|
||||
and implemented by Roland McGrath (roland@ai.mit.edu).
|
||||
|
||||
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 3 of the License, or 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIBC
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined _LIBC
|
||||
# include <memcopy.h>
|
||||
#else
|
||||
# define reg_char char
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#if HAVE_BP_SYM_H || defined _LIBC
|
||||
# include <bp-sym.h>
|
||||
#else
|
||||
# define BP_SYM(sym) sym
|
||||
#endif
|
||||
|
||||
#undef __memchr
|
||||
#ifdef _LIBC
|
||||
# undef memchr
|
||||
#endif
|
||||
|
||||
#ifndef weak_alias
|
||||
# define __memchr memchr
|
||||
#endif
|
||||
|
||||
/* Search no more than N bytes of S for C. */
|
||||
void *
|
||||
__memchr (void const *s, int c_in, size_t n)
|
||||
{
|
||||
/* On 32-bit hardware, choosing longword to be a 32-bit unsigned
|
||||
long instead of a 64-bit uintmax_t tends to give better
|
||||
performance. On 64-bit hardware, unsigned long is generally 64
|
||||
bits already. Change this typedef to experiment with
|
||||
performance. */
|
||||
typedef unsigned long int longword;
|
||||
|
||||
const unsigned char *char_ptr;
|
||||
const longword *longword_ptr;
|
||||
longword repeated_one;
|
||||
longword repeated_c;
|
||||
unsigned reg_char c;
|
||||
|
||||
c = (unsigned char) c_in;
|
||||
|
||||
/* Handle the first few bytes by reading one byte at a time.
|
||||
Do this until CHAR_PTR is aligned on a longword boundary. */
|
||||
for (char_ptr = (const unsigned char *) s;
|
||||
n > 0 && (size_t) char_ptr % sizeof (longword) != 0;
|
||||
--n, ++char_ptr)
|
||||
if (*char_ptr == c)
|
||||
return (void *) char_ptr;
|
||||
|
||||
longword_ptr = (const longword *) char_ptr;
|
||||
|
||||
/* All these elucidatory comments refer to 4-byte longwords,
|
||||
but the theory applies equally well to any size longwords. */
|
||||
|
||||
/* Compute auxiliary longword values:
|
||||
repeated_one is a value which has a 1 in every byte.
|
||||
repeated_c has c in every byte. */
|
||||
repeated_one = 0x01010101;
|
||||
repeated_c = c | (c << 8);
|
||||
repeated_c |= repeated_c << 16;
|
||||
if (0xffffffffU < (longword) -1)
|
||||
{
|
||||
repeated_one |= repeated_one << 31 << 1;
|
||||
repeated_c |= repeated_c << 31 << 1;
|
||||
if (8 < sizeof (longword))
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 64; i < sizeof (longword) * 8; i *= 2)
|
||||
{
|
||||
repeated_one |= repeated_one << i;
|
||||
repeated_c |= repeated_c << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Instead of the traditional loop which tests each byte, we will test a
|
||||
longword at a time. The tricky part is testing if *any of the four*
|
||||
bytes in the longword in question are equal to c. We first use an xor
|
||||
with repeated_c. This reduces the task to testing whether *any of the
|
||||
four* bytes in longword1 is zero.
|
||||
|
||||
We compute tmp =
|
||||
((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
|
||||
That is, we perform the following operations:
|
||||
1. Subtract repeated_one.
|
||||
2. & ~longword1.
|
||||
3. & a mask consisting of 0x80 in every byte.
|
||||
Consider what happens in each byte:
|
||||
- If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
|
||||
and step 3 transforms it into 0x80. A carry can also be propagated
|
||||
to more significant bytes.
|
||||
- If a byte of longword1 is nonzero, let its lowest 1 bit be at
|
||||
position k (0 <= k <= 7); so the lowest k bits are 0. After step 1,
|
||||
the byte ends in a single bit of value 0 and k bits of value 1.
|
||||
After step 2, the result is just k bits of value 1: 2^k - 1. After
|
||||
step 3, the result is 0. And no carry is produced.
|
||||
So, if longword1 has only non-zero bytes, tmp is zero.
|
||||
Whereas if longword1 has a zero byte, call j the position of the least
|
||||
significant zero byte. Then the result has a zero at positions 0, ...,
|
||||
j-1 and a 0x80 at position j. We cannot predict the result at the more
|
||||
significant bytes (positions j+1..3), but it does not matter since we
|
||||
already have a non-zero bit at position 8*j+7.
|
||||
|
||||
So, the test whether any byte in longword1 is zero is equivalent to
|
||||
testing whether tmp is nonzero. */
|
||||
|
||||
while (n >= sizeof (longword))
|
||||
{
|
||||
longword longword1 = *longword_ptr ^ repeated_c;
|
||||
|
||||
if ((((longword1 - repeated_one) & ~longword1)
|
||||
& (repeated_one << 7)) != 0)
|
||||
break;
|
||||
longword_ptr++;
|
||||
n -= sizeof (longword);
|
||||
}
|
||||
|
||||
char_ptr = (const unsigned char *) longword_ptr;
|
||||
|
||||
/* At this point, we know that either n < sizeof (longword), or one of the
|
||||
sizeof (longword) bytes starting at char_ptr is == c. On little-endian
|
||||
machines, we could determine the first such byte without any further
|
||||
memory accesses, just by looking at the tmp result from the last loop
|
||||
iteration. But this does not work on big-endian machines. Choose code
|
||||
that works in both cases. */
|
||||
|
||||
for (; n > 0; --n, ++char_ptr)
|
||||
{
|
||||
if (*char_ptr == c)
|
||||
return (void *) char_ptr;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#ifdef weak_alias
|
||||
weak_alias (__memchr, BP_SYM (memchr))
|
||||
#endif
|
||||
@@ -1,14 +0,0 @@
|
||||
# Suppress a valgrind message about use of uninitialized memory in memchr().
|
||||
# POSIX states that when the character is found, memchr must not read extra
|
||||
# bytes in an overestimated length (for example, where memchr is used to
|
||||
# implement strnlen). However, we use a safe word read to provide a speedup.
|
||||
{
|
||||
memchr-value4
|
||||
Memcheck:Value4
|
||||
fun:rpl_memchr
|
||||
}
|
||||
{
|
||||
memchr-value8
|
||||
Memcheck:Value8
|
||||
fun:rpl_memchr
|
||||
}
|
||||
40
lib/quote.c
40
lib/quote.c
@@ -1,40 +0,0 @@
|
||||
/* quote.c - quote arguments for output
|
||||
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005, 2006, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paul Eggert <eggert@twinsun.com> */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "quotearg.h"
|
||||
#include "quote.h"
|
||||
|
||||
/* 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. */
|
||||
char const *
|
||||
quote (char const *name)
|
||||
{
|
||||
return quote_n (0, name);
|
||||
}
|
||||
21
lib/quote.h
21
lib/quote.h
@@ -1,21 +0,0 @@
|
||||
/* quote.h - prototypes for quote.c
|
||||
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2003, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
char const *quote_n (int n, char const *name);
|
||||
char const *quote (char const *name);
|
||||
889
lib/quotearg.c
889
lib/quotearg.c
@@ -1,889 +0,0 @@
|
||||
/* quotearg.c - quote arguments for output
|
||||
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007,
|
||||
2008, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paul Eggert <eggert@twinsun.com> */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "quotearg.h"
|
||||
|
||||
#include "xalloc.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
#define N_(msgid) msgid
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
# define SIZE_MAX ((size_t) -1)
|
||||
#endif
|
||||
|
||||
#define INT_BITS (sizeof (int) * CHAR_BIT)
|
||||
|
||||
struct quoting_options
|
||||
{
|
||||
/* Basic quoting style. */
|
||||
enum quoting_style style;
|
||||
|
||||
/* Additional flags. Bitwise combination of enum quoting_flags. */
|
||||
int flags;
|
||||
|
||||
/* Quote the characters indicated by this bit vector even if the
|
||||
quoting style would not normally require them to be quoted. */
|
||||
unsigned int quote_these_too[(UCHAR_MAX / INT_BITS) + 1];
|
||||
|
||||
/* The left quote for custom_quoting_style. */
|
||||
char const *left_quote;
|
||||
|
||||
/* The right quote for custom_quoting_style. */
|
||||
char const *right_quote;
|
||||
};
|
||||
|
||||
/* Names of quoting styles. */
|
||||
char const *const quoting_style_args[] =
|
||||
{
|
||||
"literal",
|
||||
"shell",
|
||||
"shell-always",
|
||||
"c",
|
||||
"c-maybe",
|
||||
"escape",
|
||||
"locale",
|
||||
"clocale",
|
||||
0
|
||||
};
|
||||
|
||||
/* Correspondences to quoting style names. */
|
||||
enum quoting_style const quoting_style_vals[] =
|
||||
{
|
||||
literal_quoting_style,
|
||||
shell_quoting_style,
|
||||
shell_always_quoting_style,
|
||||
c_quoting_style,
|
||||
c_maybe_quoting_style,
|
||||
escape_quoting_style,
|
||||
locale_quoting_style,
|
||||
clocale_quoting_style
|
||||
};
|
||||
|
||||
/* The default quoting options. */
|
||||
static struct quoting_options default_quoting_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 (struct quoting_options *o)
|
||||
{
|
||||
int e = errno;
|
||||
struct quoting_options *p = xmemdup (o ? o : &default_quoting_options,
|
||||
sizeof *o);
|
||||
errno = e;
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Get the value of O's quoting style. If O is null, use the default. */
|
||||
enum quoting_style
|
||||
get_quoting_style (struct quoting_options *o)
|
||||
{
|
||||
return (o ? o : &default_quoting_options)->style;
|
||||
}
|
||||
|
||||
/* In O (or in the default if O is null),
|
||||
set the value of the quoting style to S. */
|
||||
void
|
||||
set_quoting_style (struct quoting_options *o, enum quoting_style s)
|
||||
{
|
||||
(o ? o : &default_quoting_options)->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 (struct quoting_options *o, char c, int i)
|
||||
{
|
||||
unsigned char uc = c;
|
||||
unsigned int *p =
|
||||
(o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS;
|
||||
int shift = uc % INT_BITS;
|
||||
int r = (*p >> shift) & 1;
|
||||
*p ^= ((i & 1) ^ r) << shift;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* In O (or in the default if O is null),
|
||||
set the value of the quoting options flag to I, which can be a
|
||||
bitwise combination of enum quoting_flags, or 0 for default
|
||||
behavior. Return the old value. */
|
||||
int
|
||||
set_quoting_flags (struct quoting_options *o, int i)
|
||||
{
|
||||
int r;
|
||||
if (!o)
|
||||
o = &default_quoting_options;
|
||||
r = o->flags;
|
||||
o->flags = i;
|
||||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
set_custom_quoting (struct quoting_options *o,
|
||||
char const *left_quote, char const *right_quote)
|
||||
{
|
||||
if (!o)
|
||||
o = &default_quoting_options;
|
||||
o->style = custom_quoting_style;
|
||||
if (!left_quote || !right_quote)
|
||||
abort ();
|
||||
o->left_quote = left_quote;
|
||||
o->right_quote = right_quote;
|
||||
}
|
||||
|
||||
/* Return quoting options for STYLE, with no extra quoting. */
|
||||
static struct quoting_options
|
||||
quoting_options_from_style (enum quoting_style style)
|
||||
{
|
||||
struct quoting_options o;
|
||||
o.style = style;
|
||||
o.flags = 0;
|
||||
memset (o.quote_these_too, 0, sizeof o.quote_these_too);
|
||||
return o;
|
||||
}
|
||||
|
||||
/* MSGID approximates a quotation mark. Return its translation if it
|
||||
has one; otherwise, return either it or "\"", depending on S. */
|
||||
static char const *
|
||||
gettext_quote (char const *msgid, enum quoting_style s)
|
||||
{
|
||||
char const *translation = _(msgid);
|
||||
if (translation == msgid && s == clocale_quoting_style)
|
||||
translation = "\"";
|
||||
return translation;
|
||||
}
|
||||
|
||||
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
|
||||
argument ARG (of size ARGSIZE), using QUOTING_STYLE, FLAGS, and
|
||||
QUOTE_THESE_TOO to control quoting.
|
||||
Terminate the output with a null character, and return the written
|
||||
size of the output, not counting the terminating null.
|
||||
If BUFFERSIZE is too small to store the output string, return the
|
||||
value that would have been returned had BUFFERSIZE been large enough.
|
||||
If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE.
|
||||
|
||||
This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG,
|
||||
ARGSIZE, O), except it breaks O into its component pieces and is
|
||||
not careful about errno. */
|
||||
|
||||
static size_t
|
||||
quotearg_buffer_restyled (char *buffer, size_t buffersize,
|
||||
char const *arg, size_t argsize,
|
||||
enum quoting_style quoting_style, int flags,
|
||||
unsigned int const *quote_these_too,
|
||||
char const *left_quote,
|
||||
char const *right_quote)
|
||||
{
|
||||
size_t i;
|
||||
size_t len = 0;
|
||||
char const *quote_string = 0;
|
||||
size_t quote_string_len = 0;
|
||||
bool backslash_escapes = false;
|
||||
bool unibyte_locale = MB_CUR_MAX == 1;
|
||||
bool elide_outer_quotes = (flags & QA_ELIDE_OUTER_QUOTES) != 0;
|
||||
|
||||
#define STORE(c) \
|
||||
do \
|
||||
{ \
|
||||
if (len < buffersize) \
|
||||
buffer[len] = (c); \
|
||||
len++; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
switch (quoting_style)
|
||||
{
|
||||
case c_maybe_quoting_style:
|
||||
quoting_style = c_quoting_style;
|
||||
elide_outer_quotes = true;
|
||||
/* Fall through. */
|
||||
case c_quoting_style:
|
||||
if (!elide_outer_quotes)
|
||||
STORE ('"');
|
||||
backslash_escapes = true;
|
||||
quote_string = "\"";
|
||||
quote_string_len = 1;
|
||||
break;
|
||||
|
||||
case escape_quoting_style:
|
||||
backslash_escapes = true;
|
||||
elide_outer_quotes = false;
|
||||
break;
|
||||
|
||||
case locale_quoting_style:
|
||||
case clocale_quoting_style:
|
||||
case custom_quoting_style:
|
||||
{
|
||||
if (quoting_style != custom_quoting_style)
|
||||
{
|
||||
/* TRANSLATORS:
|
||||
Get translations for open and closing quotation marks.
|
||||
|
||||
The message catalog should translate "`" to a left
|
||||
quotation mark suitable for the locale, and similarly for
|
||||
"'". If the catalog has no translation,
|
||||
locale_quoting_style quotes `like this', and
|
||||
clocale_quoting_style quotes "like this".
|
||||
|
||||
For example, an American English Unicode locale should
|
||||
translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and
|
||||
should translate "'" to U+201D (RIGHT DOUBLE QUOTATION
|
||||
MARK). A British English Unicode locale should instead
|
||||
translate these to U+2018 (LEFT SINGLE QUOTATION MARK)
|
||||
and U+2019 (RIGHT SINGLE QUOTATION MARK), respectively.
|
||||
|
||||
If you don't know what to put here, please see
|
||||
<http://en.wikipedia.org/wiki/Quotation_mark#Glyphs>
|
||||
and use glyphs suitable for your language. */
|
||||
left_quote = gettext_quote (N_("`"), quoting_style);
|
||||
right_quote = gettext_quote (N_("'"), quoting_style);
|
||||
}
|
||||
if (!elide_outer_quotes)
|
||||
for (quote_string = left_quote; *quote_string; quote_string++)
|
||||
STORE (*quote_string);
|
||||
backslash_escapes = true;
|
||||
quote_string = right_quote;
|
||||
quote_string_len = strlen (quote_string);
|
||||
}
|
||||
break;
|
||||
|
||||
case shell_quoting_style:
|
||||
quoting_style = shell_always_quoting_style;
|
||||
elide_outer_quotes = true;
|
||||
/* Fall through. */
|
||||
case shell_always_quoting_style:
|
||||
if (!elide_outer_quotes)
|
||||
STORE ('\'');
|
||||
quote_string = "'";
|
||||
quote_string_len = 1;
|
||||
break;
|
||||
|
||||
case literal_quoting_style:
|
||||
elide_outer_quotes = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
for (i = 0; ! (argsize == SIZE_MAX ? arg[i] == '\0' : i == argsize); i++)
|
||||
{
|
||||
unsigned char c;
|
||||
unsigned char esc;
|
||||
bool is_right_quote = false;
|
||||
|
||||
if (backslash_escapes
|
||||
&& quote_string_len
|
||||
&& i + quote_string_len <= argsize
|
||||
&& memcmp (arg + i, quote_string, quote_string_len) == 0)
|
||||
{
|
||||
if (elide_outer_quotes)
|
||||
goto force_outer_quoting_style;
|
||||
is_right_quote = true;
|
||||
}
|
||||
|
||||
c = arg[i];
|
||||
switch (c)
|
||||
{
|
||||
case '\0':
|
||||
if (backslash_escapes)
|
||||
{
|
||||
if (elide_outer_quotes)
|
||||
goto force_outer_quoting_style;
|
||||
STORE ('\\');
|
||||
/* If quote_string were to begin with digits, we'd need to
|
||||
test for the end of the arg as well. However, it's
|
||||
hard to imagine any locale that would use digits in
|
||||
quotes, and set_custom_quoting is documented not to
|
||||
accept them. */
|
||||
if (i + 1 < argsize && '0' <= arg[i + 1] && arg[i + 1] <= '9')
|
||||
{
|
||||
STORE ('0');
|
||||
STORE ('0');
|
||||
}
|
||||
c = '0';
|
||||
/* We don't have to worry that this last '0' will be
|
||||
backslash-escaped because, again, quote_string should
|
||||
not start with it and because quote_these_too is
|
||||
documented as not accepting it. */
|
||||
}
|
||||
else if (flags & QA_ELIDE_NULL_BYTES)
|
||||
continue;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
switch (quoting_style)
|
||||
{
|
||||
case shell_always_quoting_style:
|
||||
if (elide_outer_quotes)
|
||||
goto force_outer_quoting_style;
|
||||
break;
|
||||
|
||||
case c_quoting_style:
|
||||
if ((flags & QA_SPLIT_TRIGRAPHS)
|
||||
&& i + 2 < argsize && arg[i + 1] == '?')
|
||||
switch (arg[i + 2])
|
||||
{
|
||||
case '!': case '\'':
|
||||
case '(': case ')': case '-': case '/':
|
||||
case '<': case '=': case '>':
|
||||
/* Escape the second '?' in what would otherwise be
|
||||
a trigraph. */
|
||||
if (elide_outer_quotes)
|
||||
goto force_outer_quoting_style;
|
||||
c = arg[i + 2];
|
||||
i += 2;
|
||||
STORE ('?');
|
||||
STORE ('"');
|
||||
STORE ('"');
|
||||
STORE ('?');
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
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;
|
||||
case '\r': esc = 'r'; goto c_and_shell_escape;
|
||||
case '\t': esc = 't'; goto c_and_shell_escape;
|
||||
case '\v': esc = 'v'; goto c_escape;
|
||||
case '\\': esc = c;
|
||||
/* No need to escape the escape if we are trying to elide
|
||||
outer quotes and nothing else is problematic. */
|
||||
if (backslash_escapes && elide_outer_quotes && quote_string_len)
|
||||
goto store_c;
|
||||
|
||||
c_and_shell_escape:
|
||||
if (quoting_style == shell_always_quoting_style
|
||||
&& elide_outer_quotes)
|
||||
goto force_outer_quoting_style;
|
||||
/* Fall through. */
|
||||
c_escape:
|
||||
if (backslash_escapes)
|
||||
{
|
||||
c = esc;
|
||||
goto store_escape;
|
||||
}
|
||||
break;
|
||||
|
||||
case '{': case '}': /* sometimes special if isolated */
|
||||
if (! (argsize == SIZE_MAX ? arg[1] == '\0' : argsize == 1))
|
||||
break;
|
||||
/* Fall through. */
|
||||
case '#': case '~':
|
||||
if (i != 0)
|
||||
break;
|
||||
/* Fall through. */
|
||||
case ' ':
|
||||
case '!': /* special in bash */
|
||||
case '"': case '$': case '&':
|
||||
case '(': case ')': case '*': case ';':
|
||||
case '<':
|
||||
case '=': /* sometimes special in 0th or (with "set -k") later args */
|
||||
case '>': case '[':
|
||||
case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */
|
||||
case '`': case '|':
|
||||
/* A shell special character. In theory, '$' and '`' could
|
||||
be the first bytes of multibyte characters, which means
|
||||
we should check them with mbrtowc, but in practice this
|
||||
doesn't happen so it's not worth worrying about. */
|
||||
if (quoting_style == shell_always_quoting_style
|
||||
&& elide_outer_quotes)
|
||||
goto force_outer_quoting_style;
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
if (quoting_style == shell_always_quoting_style)
|
||||
{
|
||||
if (elide_outer_quotes)
|
||||
goto force_outer_quoting_style;
|
||||
STORE ('\'');
|
||||
STORE ('\\');
|
||||
STORE ('\'');
|
||||
}
|
||||
break;
|
||||
|
||||
case '%': case '+': case ',': case '-': case '.': case '/':
|
||||
case '0': case '1': case '2': case '3': case '4': case '5':
|
||||
case '6': case '7': case '8': case '9': case ':':
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
|
||||
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
|
||||
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
|
||||
case 'Y': case 'Z': case ']': case '_': case 'a': case 'b':
|
||||
case 'c': case 'd': case 'e': case 'f': case 'g': case 'h':
|
||||
case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
|
||||
case 'o': case 'p': case 'q': case 'r': case 's': case 't':
|
||||
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
|
||||
/* These characters don't cause problems, no matter what the
|
||||
quoting style is. They cannot start multibyte sequences.
|
||||
A digit or a special letter would cause trouble if it
|
||||
appeared at the beginning of quote_string because we'd then
|
||||
escape by prepending a backslash. However, it's hard to
|
||||
imagine any locale that would use digits or letters as
|
||||
quotes, and set_custom_quoting is documented not to accept
|
||||
them. Also, a digit or a special letter would cause
|
||||
trouble if it appeared in quote_these_too, but that's also
|
||||
documented as not accepting them. */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* If we have a multibyte sequence, copy it until we reach
|
||||
its end, find an error, or come back to the initial shift
|
||||
state. For C-like styles, if the sequence has
|
||||
unprintable characters, escape the whole sequence, since
|
||||
we can't easily escape single characters within it. */
|
||||
{
|
||||
/* Length of multibyte sequence found so far. */
|
||||
size_t m;
|
||||
|
||||
bool printable;
|
||||
|
||||
if (unibyte_locale)
|
||||
{
|
||||
m = 1;
|
||||
printable = isprint (c) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mbstate_t mbstate;
|
||||
memset (&mbstate, 0, sizeof mbstate);
|
||||
|
||||
m = 0;
|
||||
printable = true;
|
||||
if (argsize == SIZE_MAX)
|
||||
argsize = strlen (arg);
|
||||
|
||||
do
|
||||
{
|
||||
wchar_t w;
|
||||
size_t bytes = mbrtowc (&w, &arg[i + m],
|
||||
argsize - (i + m), &mbstate);
|
||||
if (bytes == 0)
|
||||
break;
|
||||
else if (bytes == (size_t) -1)
|
||||
{
|
||||
printable = false;
|
||||
break;
|
||||
}
|
||||
else if (bytes == (size_t) -2)
|
||||
{
|
||||
printable = false;
|
||||
while (i + m < argsize && arg[i + m])
|
||||
m++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Work around a bug with older shells that "see" a '\'
|
||||
that is really the 2nd byte of a multibyte character.
|
||||
In practice the problem is limited to ASCII
|
||||
chars >= '@' that are shell special chars. */
|
||||
if ('[' == 0x5b && elide_outer_quotes
|
||||
&& quoting_style == shell_always_quoting_style)
|
||||
{
|
||||
size_t j;
|
||||
for (j = 1; j < bytes; j++)
|
||||
switch (arg[i + m + j])
|
||||
{
|
||||
case '[': case '\\': case '^':
|
||||
case '`': case '|':
|
||||
goto force_outer_quoting_style;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! iswprint (w))
|
||||
printable = false;
|
||||
m += bytes;
|
||||
}
|
||||
}
|
||||
while (! mbsinit (&mbstate));
|
||||
}
|
||||
|
||||
if (1 < m || (backslash_escapes && ! printable))
|
||||
{
|
||||
/* Output a multibyte sequence, or an escaped
|
||||
unprintable unibyte character. */
|
||||
size_t ilim = i + m;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (backslash_escapes && ! printable)
|
||||
{
|
||||
if (elide_outer_quotes)
|
||||
goto force_outer_quoting_style;
|
||||
STORE ('\\');
|
||||
STORE ('0' + (c >> 6));
|
||||
STORE ('0' + ((c >> 3) & 7));
|
||||
c = '0' + (c & 7);
|
||||
}
|
||||
else if (is_right_quote)
|
||||
{
|
||||
STORE ('\\');
|
||||
is_right_quote = false;
|
||||
}
|
||||
if (ilim <= i + 1)
|
||||
break;
|
||||
STORE (c);
|
||||
c = arg[++i];
|
||||
}
|
||||
|
||||
goto store_c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! ((backslash_escapes || elide_outer_quotes)
|
||||
&& quote_these_too
|
||||
&& quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))
|
||||
&& !is_right_quote)
|
||||
goto store_c;
|
||||
|
||||
store_escape:
|
||||
if (elide_outer_quotes)
|
||||
goto force_outer_quoting_style;
|
||||
STORE ('\\');
|
||||
|
||||
store_c:
|
||||
STORE (c);
|
||||
}
|
||||
|
||||
if (len == 0 && quoting_style == shell_always_quoting_style
|
||||
&& elide_outer_quotes)
|
||||
goto force_outer_quoting_style;
|
||||
|
||||
if (quote_string && !elide_outer_quotes)
|
||||
for (; *quote_string; quote_string++)
|
||||
STORE (*quote_string);
|
||||
|
||||
if (len < buffersize)
|
||||
buffer[len] = '\0';
|
||||
return len;
|
||||
|
||||
force_outer_quoting_style:
|
||||
/* Don't reuse quote_these_too, since the addition of outer quotes
|
||||
sufficiently quotes the specified characters. */
|
||||
return quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
|
||||
quoting_style,
|
||||
flags & ~QA_ELIDE_OUTER_QUOTES, NULL,
|
||||
left_quote, right_quote);
|
||||
}
|
||||
|
||||
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
|
||||
argument ARG (of size ARGSIZE), using O to control quoting.
|
||||
If O is null, use the default.
|
||||
Terminate the output with a null character, and return the written
|
||||
size of the output, not counting the terminating null.
|
||||
If BUFFERSIZE is too small to store the output string, return the
|
||||
value that would have been returned had BUFFERSIZE been large enough.
|
||||
If ARGSIZE is SIZE_MAX, use the string length of the argument for
|
||||
ARGSIZE. */
|
||||
size_t
|
||||
quotearg_buffer (char *buffer, size_t buffersize,
|
||||
char const *arg, size_t argsize,
|
||||
struct quoting_options const *o)
|
||||
{
|
||||
struct quoting_options const *p = o ? o : &default_quoting_options;
|
||||
int e = errno;
|
||||
size_t r = quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
|
||||
p->style, p->flags, p->quote_these_too,
|
||||
p->left_quote, p->right_quote);
|
||||
errno = e;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Equivalent to quotearg_alloc (ARG, ARGSIZE, NULL, O). */
|
||||
char *
|
||||
quotearg_alloc (char const *arg, size_t argsize,
|
||||
struct quoting_options const *o)
|
||||
{
|
||||
return quotearg_alloc_mem (arg, argsize, NULL, o);
|
||||
}
|
||||
|
||||
/* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly
|
||||
allocated storage containing the quoted string, and store the
|
||||
resulting size into *SIZE, if non-NULL. The result can contain
|
||||
embedded null bytes only if ARGSIZE is not SIZE_MAX, SIZE is not
|
||||
NULL, and set_quoting_flags has not set the null byte elision
|
||||
flag. */
|
||||
char *
|
||||
quotearg_alloc_mem (char const *arg, size_t argsize, size_t *size,
|
||||
struct quoting_options const *o)
|
||||
{
|
||||
struct quoting_options const *p = o ? o : &default_quoting_options;
|
||||
int e = errno;
|
||||
/* Elide embedded null bytes if we can't return a size. */
|
||||
int flags = p->flags | (size ? 0 : QA_ELIDE_NULL_BYTES);
|
||||
size_t bufsize = quotearg_buffer_restyled (0, 0, arg, argsize, p->style,
|
||||
flags, p->quote_these_too,
|
||||
p->left_quote,
|
||||
p->right_quote) + 1;
|
||||
char *buf = xcharalloc (bufsize);
|
||||
quotearg_buffer_restyled (buf, bufsize, arg, argsize, p->style, flags,
|
||||
p->quote_these_too,
|
||||
p->left_quote, p->right_quote);
|
||||
errno = e;
|
||||
if (size)
|
||||
*size = bufsize - 1;
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* A storage slot with size and pointer to a value. */
|
||||
struct slotvec
|
||||
{
|
||||
size_t size;
|
||||
char *val;
|
||||
};
|
||||
|
||||
/* 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];
|
||||
static unsigned int nslots = 1;
|
||||
static struct slotvec slotvec0 = {sizeof slot0, slot0};
|
||||
static struct slotvec *slotvec = &slotvec0;
|
||||
|
||||
void
|
||||
quotearg_free (void)
|
||||
{
|
||||
struct slotvec *sv = slotvec;
|
||||
unsigned int i;
|
||||
for (i = 1; i < nslots; i++)
|
||||
free (sv[i].val);
|
||||
if (sv[0].val != slot0)
|
||||
{
|
||||
free (sv[0].val);
|
||||
slotvec0.size = sizeof slot0;
|
||||
slotvec0.val = slot0;
|
||||
}
|
||||
if (sv != &slotvec0)
|
||||
{
|
||||
free (sv);
|
||||
slotvec = &slotvec0;
|
||||
}
|
||||
nslots = 1;
|
||||
}
|
||||
|
||||
/* Use storage slot N to return a quoted version of argument ARG.
|
||||
ARG is of size ARGSIZE, but if that is SIZE_MAX, ARG is a
|
||||
null-terminated string.
|
||||
OPTIONS specifies the quoting options.
|
||||
The returned value points to static storage that can be
|
||||
reused by the next call to this function with the same value of N.
|
||||
N must be nonnegative. N is deliberately declared with type "int"
|
||||
to allow for future extensions (using negative values). */
|
||||
static char *
|
||||
quotearg_n_options (int n, char const *arg, size_t argsize,
|
||||
struct quoting_options const *options)
|
||||
{
|
||||
int e = errno;
|
||||
|
||||
unsigned int n0 = n;
|
||||
struct slotvec *sv = slotvec;
|
||||
|
||||
if (n < 0)
|
||||
abort ();
|
||||
|
||||
if (nslots <= n0)
|
||||
{
|
||||
/* FIXME: technically, the type of n1 should be `unsigned int',
|
||||
but that evokes an unsuppressible warning from gcc-4.0.1 and
|
||||
older. If gcc ever provides an option to suppress that warning,
|
||||
revert to the original type, so that the test in xalloc_oversized
|
||||
is once again performed only at compile time. */
|
||||
size_t n1 = n0 + 1;
|
||||
bool preallocated = (sv == &slotvec0);
|
||||
|
||||
if (xalloc_oversized (n1, sizeof *sv))
|
||||
xalloc_die ();
|
||||
|
||||
slotvec = sv = xrealloc (preallocated ? NULL : sv, n1 * sizeof *sv);
|
||||
if (preallocated)
|
||||
*sv = slotvec0;
|
||||
memset (sv + nslots, 0, (n1 - nslots) * sizeof *sv);
|
||||
nslots = n1;
|
||||
}
|
||||
|
||||
{
|
||||
size_t size = sv[n].size;
|
||||
char *val = sv[n].val;
|
||||
/* Elide embedded null bytes since we don't return a size. */
|
||||
int flags = options->flags | QA_ELIDE_NULL_BYTES;
|
||||
size_t qsize = quotearg_buffer_restyled (val, size, arg, argsize,
|
||||
options->style, flags,
|
||||
options->quote_these_too,
|
||||
options->left_quote,
|
||||
options->right_quote);
|
||||
|
||||
if (size <= qsize)
|
||||
{
|
||||
sv[n].size = size = qsize + 1;
|
||||
if (val != slot0)
|
||||
free (val);
|
||||
sv[n].val = val = xcharalloc (size);
|
||||
quotearg_buffer_restyled (val, size, arg, argsize, options->style,
|
||||
flags, options->quote_these_too,
|
||||
options->left_quote,
|
||||
options->right_quote);
|
||||
}
|
||||
|
||||
errno = e;
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_n (int n, char const *arg)
|
||||
{
|
||||
return quotearg_n_options (n, arg, SIZE_MAX, &default_quoting_options);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_n_mem (int n, char const *arg, size_t argsize)
|
||||
{
|
||||
return quotearg_n_options (n, arg, argsize, &default_quoting_options);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg (char const *arg)
|
||||
{
|
||||
return quotearg_n (0, arg);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_mem (char const *arg, size_t argsize)
|
||||
{
|
||||
return quotearg_n_mem (0, arg, argsize);
|
||||
}
|
||||
|
||||
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_MAX, &o);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_n_style_mem (int n, enum quoting_style s,
|
||||
char const *arg, size_t argsize)
|
||||
{
|
||||
struct quoting_options const o = quoting_options_from_style (s);
|
||||
return quotearg_n_options (n, arg, argsize, &o);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_style (enum quoting_style s, char const *arg)
|
||||
{
|
||||
return quotearg_n_style (0, s, arg);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_style_mem (enum quoting_style s, char const *arg, size_t argsize)
|
||||
{
|
||||
return quotearg_n_style_mem (0, s, arg, argsize);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_char_mem (char const *arg, size_t argsize, char ch)
|
||||
{
|
||||
struct quoting_options options;
|
||||
options = default_quoting_options;
|
||||
set_char_quoting (&options, ch, 1);
|
||||
return quotearg_n_options (0, arg, argsize, &options);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_char (char const *arg, char ch)
|
||||
{
|
||||
return quotearg_char_mem (arg, SIZE_MAX, ch);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_colon (char const *arg)
|
||||
{
|
||||
return quotearg_char (arg, ':');
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_colon_mem (char const *arg, size_t argsize)
|
||||
{
|
||||
return quotearg_char_mem (arg, argsize, ':');
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_n_custom (int n, char const *left_quote,
|
||||
char const *right_quote, char const *arg)
|
||||
{
|
||||
return quotearg_n_custom_mem (n, left_quote, right_quote, arg,
|
||||
SIZE_MAX);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_n_custom_mem (int n, char const *left_quote,
|
||||
char const *right_quote,
|
||||
char const *arg, size_t argsize)
|
||||
{
|
||||
struct quoting_options o = default_quoting_options;
|
||||
set_custom_quoting (&o, left_quote, right_quote);
|
||||
return quotearg_n_options (n, arg, argsize, &o);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_custom (char const *left_quote, char const *right_quote,
|
||||
char const *arg)
|
||||
{
|
||||
return quotearg_n_custom (0, left_quote, right_quote, arg);
|
||||
}
|
||||
|
||||
char *
|
||||
quotearg_custom_mem (char const *left_quote, char const *right_quote,
|
||||
char const *arg, size_t argsize)
|
||||
{
|
||||
return quotearg_n_custom_mem (0, left_quote, right_quote, arg,
|
||||
argsize);
|
||||
}
|
||||
389
lib/quotearg.h
389
lib/quotearg.h
@@ -1,389 +0,0 @@
|
||||
/* quotearg.h - quote arguments for output
|
||||
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009
|
||||
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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paul Eggert <eggert@twinsun.com> */
|
||||
|
||||
#ifndef QUOTEARG_H_
|
||||
# define QUOTEARG_H_ 1
|
||||
|
||||
# include <stddef.h>
|
||||
|
||||
/* Basic quoting styles. For each style, an example is given on the
|
||||
input strings "simple", "\0 \t\n'\"\033?""?/\\", and "a:b", using
|
||||
quotearg_buffer, quotearg_mem, and quotearg_colon_mem with that
|
||||
style and the default flags and quoted characters. Note that the
|
||||
examples are shown here as valid C strings rather than what
|
||||
displays on a terminal (with "??/" as a trigraph for "\\"). */
|
||||
enum quoting_style
|
||||
{
|
||||
/* Output names as-is (ls --quoting-style=literal). Can result in
|
||||
embedded null bytes if QA_ELIDE_NULL_BYTES is not in
|
||||
effect.
|
||||
|
||||
quotearg_buffer:
|
||||
"simple", "\0 \t\n'\"\033??/\\", "a:b"
|
||||
quotearg:
|
||||
"simple", " \t\n'\"\033??/\\", "a:b"
|
||||
quotearg_colon:
|
||||
"simple", " \t\n'\"\033??/\\", "a:b"
|
||||
*/
|
||||
literal_quoting_style,
|
||||
|
||||
/* Quote names for the shell if they contain shell metacharacters
|
||||
or would cause ambiguous output (ls --quoting-style=shell).
|
||||
Can result in embedded null bytes if QA_ELIDE_NULL_BYTES is not
|
||||
in effect.
|
||||
|
||||
quotearg_buffer:
|
||||
"simple", "'\0 \t\n'\\''\"\033??/\\'", "a:b"
|
||||
quotearg:
|
||||
"simple", "' \t\n'\\''\"\033??/\\'", "a:b"
|
||||
quotearg_colon:
|
||||
"simple", "' \t\n'\\''\"\033??/\\'", "'a:b'"
|
||||
*/
|
||||
shell_quoting_style,
|
||||
|
||||
/* Quote names for the shell, even if they would normally not
|
||||
require quoting (ls --quoting-style=shell-always). Can result
|
||||
in embedded null bytes if QA_ELIDE_NULL_BYTES is not in effect.
|
||||
Behaves like shell_quoting_style if QA_ELIDE_OUTER_QUOTES is in
|
||||
effect.
|
||||
|
||||
quotearg_buffer:
|
||||
"'simple'", "'\0 \t\n'\\''\"\033??/\\'", "'a:b'"
|
||||
quotearg:
|
||||
"'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'"
|
||||
quotearg_colon:
|
||||
"'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'"
|
||||
*/
|
||||
shell_always_quoting_style,
|
||||
|
||||
/* Quote names as for a C language string (ls --quoting-style=c).
|
||||
Behaves like c_maybe_quoting_style if QA_ELIDE_OUTER_QUOTES is
|
||||
in effect. Split into consecutive strings if
|
||||
QA_SPLIT_TRIGRAPHS.
|
||||
|
||||
quotearg_buffer:
|
||||
"\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
|
||||
quotearg:
|
||||
"\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
|
||||
quotearg_colon:
|
||||
"\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\""
|
||||
*/
|
||||
c_quoting_style,
|
||||
|
||||
/* Like c_quoting_style except omit the surrounding double-quote
|
||||
characters if no quoted characters are encountered.
|
||||
|
||||
quotearg_buffer:
|
||||
"simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b"
|
||||
quotearg:
|
||||
"simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b"
|
||||
quotearg_colon:
|
||||
"simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
|
||||
*/
|
||||
c_maybe_quoting_style,
|
||||
|
||||
/* Like c_quoting_style except always omit the surrounding
|
||||
double-quote characters and ignore QA_SPLIT_TRIGRAPHS
|
||||
(ls --quoting-style=escape).
|
||||
|
||||
quotearg_buffer:
|
||||
"simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b"
|
||||
quotearg:
|
||||
"simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b"
|
||||
quotearg_colon:
|
||||
"simple", "\\0 \\t\\n'\"\\033??/\\\\", "a\\:b"
|
||||
*/
|
||||
escape_quoting_style,
|
||||
|
||||
/* Like clocale_quoting_style, but quote `like this' instead of
|
||||
"like this" in the default C locale (ls --quoting-style=locale).
|
||||
|
||||
LC_MESSAGES=C
|
||||
quotearg_buffer:
|
||||
"`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a:b'"
|
||||
quotearg:
|
||||
"`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a:b'"
|
||||
quotearg_colon:
|
||||
"`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a\\:b'"
|
||||
|
||||
LC_MESSAGES=pt_PT.utf8
|
||||
quotearg_buffer:
|
||||
"\302\253simple\302\273",
|
||||
"\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
|
||||
quotearg:
|
||||
"\302\253simple\302\273",
|
||||
"\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
|
||||
quotearg_colon:
|
||||
"\302\253simple\302\273",
|
||||
"\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273"
|
||||
*/
|
||||
locale_quoting_style,
|
||||
|
||||
/* Like c_quoting_style except use quotation marks appropriate for
|
||||
the locale and ignore QA_SPLIT_TRIGRAPHS
|
||||
(ls --quoting-style=clocale).
|
||||
|
||||
LC_MESSAGES=C
|
||||
quotearg_buffer:
|
||||
"\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
|
||||
quotearg:
|
||||
"\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
|
||||
quotearg_colon:
|
||||
"\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\""
|
||||
|
||||
LC_MESSAGES=pt_PT.utf8
|
||||
quotearg_buffer:
|
||||
"\302\253simple\302\273",
|
||||
"\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
|
||||
quotearg:
|
||||
"\302\253simple\302\273",
|
||||
"\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
|
||||
quotearg_colon:
|
||||
"\302\253simple\302\273",
|
||||
"\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273"
|
||||
*/
|
||||
clocale_quoting_style,
|
||||
|
||||
/* Like clocale_quoting_style except use the custom quotation marks
|
||||
set by set_custom_quoting. If custom quotation marks are not
|
||||
set, the behavior is undefined.
|
||||
|
||||
left_quote = right_quote = "'"
|
||||
quotearg_buffer:
|
||||
"'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a:b'"
|
||||
quotearg:
|
||||
"'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a:b'"
|
||||
quotearg_colon:
|
||||
"'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a\\:b'"
|
||||
|
||||
left_quote = "(" and right_quote = ")"
|
||||
quotearg_buffer:
|
||||
"(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a:b)"
|
||||
quotearg:
|
||||
"(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a:b)"
|
||||
quotearg_colon:
|
||||
"(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a\\:b)"
|
||||
|
||||
left_quote = ":" and right_quote = " "
|
||||
quotearg_buffer:
|
||||
":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a:b "
|
||||
quotearg:
|
||||
":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a:b "
|
||||
quotearg_colon:
|
||||
":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a\\:b "
|
||||
|
||||
left_quote = "\"'" and right_quote = "'\""
|
||||
Notice that this is treated as a single level of quotes or two
|
||||
levels where the outer quote need not be escaped within the inner
|
||||
quotes. For two levels where the outer quote must be escaped
|
||||
within the inner quotes, you must use separate quotearg
|
||||
invocations.
|
||||
quotearg_buffer:
|
||||
"\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a:b'\""
|
||||
quotearg:
|
||||
"\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a:b'\""
|
||||
quotearg_colon:
|
||||
"\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a\\:b'\""
|
||||
*/
|
||||
custom_quoting_style
|
||||
};
|
||||
|
||||
/* Flags for use in set_quoting_flags. */
|
||||
enum quoting_flags
|
||||
{
|
||||
/* Always elide null bytes from styles that do not quote them,
|
||||
even when the length of the result is available to the
|
||||
caller. */
|
||||
QA_ELIDE_NULL_BYTES = 0x01,
|
||||
|
||||
/* Omit the surrounding quote characters if no escaped characters
|
||||
are encountered. Note that if no other character needs
|
||||
escaping, then neither does the escape character. */
|
||||
QA_ELIDE_OUTER_QUOTES = 0x02,
|
||||
|
||||
/* In the c_quoting_style and c_maybe_quoting_style, split ANSI
|
||||
trigraph sequences into concatenated strings (for example,
|
||||
"?""?/" rather than "??/", which could be confused with
|
||||
"\\"). */
|
||||
QA_SPLIT_TRIGRAPHS = 0x04
|
||||
};
|
||||
|
||||
/* For now, --quoting-style=literal is the default, but this may change. */
|
||||
# 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[];
|
||||
extern enum quoting_style const quoting_style_vals[];
|
||||
|
||||
struct quoting_options;
|
||||
|
||||
/* 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 (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 (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 (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). C must never be a digit or a
|
||||
letter that has special meaning after a backslash (for example, "\t"
|
||||
for tab). */
|
||||
int set_char_quoting (struct quoting_options *o, char c, int i);
|
||||
|
||||
/* In O (or in the default if O is null),
|
||||
set the value of the quoting options flag to I, which can be a
|
||||
bitwise combination of enum quoting_flags, or 0 for default
|
||||
behavior. Return the old value. */
|
||||
int set_quoting_flags (struct quoting_options *o, int i);
|
||||
|
||||
/* In O (or in the default if O is null),
|
||||
set the value of the quoting style to custom_quoting_style,
|
||||
set the left quote to LEFT_QUOTE, and set the right quote to
|
||||
RIGHT_QUOTE. Each of LEFT_QUOTE and RIGHT_QUOTE must be
|
||||
null-terminated and can be the empty string. Because backslashes are
|
||||
used for escaping, it does not make sense for RIGHT_QUOTE to contain
|
||||
a backslash. RIGHT_QUOTE must not begin with a digit or a letter
|
||||
that has special meaning after a backslash (for example, "\t" for
|
||||
tab). */
|
||||
void set_custom_quoting (struct quoting_options *o,
|
||||
char const *left_quote,
|
||||
char const *right_quote);
|
||||
|
||||
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
|
||||
argument ARG (of size ARGSIZE), using O to control quoting.
|
||||
If O is null, use the default.
|
||||
Terminate the output with a null character, and return the written
|
||||
size of the output, not counting the terminating null.
|
||||
If BUFFERSIZE is too small to store the output string, return the
|
||||
value that would have been returned had BUFFERSIZE been large enough.
|
||||
If ARGSIZE is -1, use the string length of the argument for ARGSIZE.
|
||||
On output, BUFFER might contain embedded null bytes if ARGSIZE was
|
||||
not -1, the style of O does not use backslash escapes, and the
|
||||
flags of O do not request elision of null bytes.*/
|
||||
size_t quotearg_buffer (char *buffer, size_t buffersize,
|
||||
char const *arg, size_t argsize,
|
||||
struct quoting_options const *o);
|
||||
|
||||
/* Like quotearg_buffer, except return the result in a newly allocated
|
||||
buffer. It is the caller's responsibility to free the result. The
|
||||
result will not contain embedded null bytes. */
|
||||
char *quotearg_alloc (char const *arg, size_t argsize,
|
||||
struct quoting_options const *o);
|
||||
|
||||
/* Like quotearg_alloc, except that the length of the result,
|
||||
excluding the terminating null byte, is stored into SIZE if it is
|
||||
non-NULL. The result might contain embedded null bytes if ARGSIZE
|
||||
was not -1, SIZE was not NULL, the style of O does not use
|
||||
backslash escapes, and the flags of O do not request elision of
|
||||
null bytes.*/
|
||||
char *quotearg_alloc_mem (char const *arg, size_t argsize,
|
||||
size_t *size, 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. The output of all functions in the
|
||||
quotearg_n family are guaranteed to not contain embedded null
|
||||
bytes.*/
|
||||
char *quotearg_n (int n, char const *arg);
|
||||
|
||||
/* Equivalent to quotearg_n (0, ARG). */
|
||||
char *quotearg (char const *arg);
|
||||
|
||||
/* Use storage slot N to return a quoted version of the argument ARG
|
||||
of size ARGSIZE. This is like quotearg_n (N, ARG), except it can
|
||||
quote null bytes. */
|
||||
char *quotearg_n_mem (int n, char const *arg, size_t argsize);
|
||||
|
||||
/* Equivalent to quotearg_n_mem (0, ARG, ARGSIZE). */
|
||||
char *quotearg_mem (char const *arg, size_t argsize);
|
||||
|
||||
/* 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 (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 (int n, enum quoting_style s,
|
||||
char const *arg, size_t argsize);
|
||||
|
||||
/* Equivalent to quotearg_n_style (0, S, ARG). */
|
||||
char *quotearg_style (enum quoting_style s, char const *arg);
|
||||
|
||||
/* Equivalent to quotearg_n_style_mem (0, S, ARG, ARGSIZE). */
|
||||
char *quotearg_style_mem (enum quoting_style s,
|
||||
char const *arg, size_t argsize);
|
||||
|
||||
/* Like quotearg (ARG), except also quote any instances of CH.
|
||||
See set_char_quoting for a description of acceptable CH values. */
|
||||
char *quotearg_char (char const *arg, char ch);
|
||||
|
||||
/* Like quotearg_char (ARG, CH), except it can quote null bytes. */
|
||||
char *quotearg_char_mem (char const *arg, size_t argsize, char ch);
|
||||
|
||||
/* Equivalent to quotearg_char (ARG, ':'). */
|
||||
char *quotearg_colon (char const *arg);
|
||||
|
||||
/* Like quotearg_colon (ARG), except it can quote null bytes. */
|
||||
char *quotearg_colon_mem (char const *arg, size_t argsize);
|
||||
|
||||
/* Like quotearg_n_style (N, S, ARG) but with S as custom_quoting_style
|
||||
with left quote as LEFT_QUOTE and right quote as RIGHT_QUOTE. See
|
||||
set_custom_quoting for a description of acceptable LEFT_QUOTE and
|
||||
RIGHT_QUOTE values. */
|
||||
char *quotearg_n_custom (int n, char const *left_quote,
|
||||
char const *right_quote, char const *arg);
|
||||
|
||||
/* Like quotearg_n_custom (N, LEFT_QUOTE, RIGHT_QUOTE, ARG) except it
|
||||
can quote null bytes. */
|
||||
char *quotearg_n_custom_mem (int n, char const *left_quote,
|
||||
char const *right_quote,
|
||||
char const *arg, size_t argsize);
|
||||
|
||||
/* Equivalent to quotearg_n_custom (0, LEFT_QUOTE, RIGHT_QUOTE, ARG). */
|
||||
char *quotearg_custom (char const *left_quote, char const *right_quote,
|
||||
char const *arg);
|
||||
|
||||
/* Equivalent to quotearg_n_custom_mem (0, LEFT_QUOTE, RIGHT_QUOTE, ARG,
|
||||
ARGSIZE). */
|
||||
char *quotearg_custom_mem (char const *left_quote,
|
||||
char const *right_quote,
|
||||
char const *arg, size_t argsize);
|
||||
|
||||
/* Free any dynamically allocated memory. */
|
||||
void quotearg_free (void);
|
||||
|
||||
#endif /* !QUOTEARG_H_ */
|
||||
@@ -1,88 +0,0 @@
|
||||
/* realloc() function that is glibc compatible.
|
||||
|
||||
Copyright (C) 1997, 2003, 2004, 2006, 2007, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* written by Jim Meyering and Bruno Haible */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */
|
||||
#ifdef realloc
|
||||
# define NEED_REALLOC_GNU 1
|
||||
#endif
|
||||
|
||||
/* Infer the properties of the system's malloc function.
|
||||
Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
|
||||
#if GNULIB_MALLOC_GNU && !defined malloc
|
||||
# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1
|
||||
#endif
|
||||
|
||||
/* Below we want to call the system's malloc and realloc.
|
||||
Undefine the symbols here so that including <stdlib.h> provides a
|
||||
declaration of malloc(), not of rpl_malloc(), and likewise for realloc. */
|
||||
#undef malloc
|
||||
#undef realloc
|
||||
|
||||
/* Specification. */
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Below we want to call the system's malloc and realloc.
|
||||
Undefine the symbols, if they were defined by gnulib's <stdlib.h>
|
||||
replacement. */
|
||||
#undef malloc
|
||||
#undef realloc
|
||||
|
||||
/* Change the size of an allocated block of memory P to N bytes,
|
||||
with error checking. If N is zero, change it to 1. If P is NULL,
|
||||
use malloc. */
|
||||
|
||||
void *
|
||||
rpl_realloc (void *p, size_t n)
|
||||
{
|
||||
void *result;
|
||||
|
||||
#if NEED_REALLOC_GNU
|
||||
if (n == 0)
|
||||
{
|
||||
n = 1;
|
||||
|
||||
/* In theory realloc might fail, so don't rely on it to free. */
|
||||
free (p);
|
||||
p = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
#if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE
|
||||
if (n == 0)
|
||||
n = 1;
|
||||
#endif
|
||||
result = malloc (n);
|
||||
}
|
||||
else
|
||||
result = realloc (p, n);
|
||||
|
||||
#if !HAVE_REALLOC_POSIX
|
||||
if (result == NULL)
|
||||
errno = ENOMEM;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
# Add this package to a list of references stored in a text file.
|
||||
#
|
||||
# Copyright (C) 2000, 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# Written by Bruno Haible <haible@clisp.cons.org>.
|
||||
#
|
||||
/^# Packages using this file: / {
|
||||
s/# Packages using this file://
|
||||
ta
|
||||
:a
|
||||
s/ @PACKAGE@ / @PACKAGE@ /
|
||||
tb
|
||||
s/ $/ @PACKAGE@ /
|
||||
:b
|
||||
s/^/# Packages using this file:/
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
# Remove this package from a list of references stored in a text file.
|
||||
#
|
||||
# Copyright (C) 2000, 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# Written by Bruno Haible <haible@clisp.cons.org>.
|
||||
#
|
||||
/^# Packages using this file: / {
|
||||
s/# Packages using this file://
|
||||
s/ @PACKAGE@ / /
|
||||
s/^/# Packages using this file:/
|
||||
}
|
||||
120
lib/stdbool.in.h
120
lib/stdbool.in.h
@@ -1,120 +0,0 @@
|
||||
/* Copyright (C) 2001, 2002, 2003, 2006, 2007, 2008, 2009 Free Software
|
||||
Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
||||
|
||||
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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _GL_STDBOOL_H
|
||||
#define _GL_STDBOOL_H
|
||||
|
||||
/* ISO C 99 <stdbool.h> for platforms that lack it. */
|
||||
|
||||
/* Usage suggestions:
|
||||
|
||||
Programs that use <stdbool.h> should be aware of some limitations
|
||||
and standards compliance issues.
|
||||
|
||||
Standards compliance:
|
||||
|
||||
- <stdbool.h> must be #included before 'bool', 'false', 'true'
|
||||
can be used.
|
||||
|
||||
- You cannot assume that sizeof (bool) == 1.
|
||||
|
||||
- Programs should not undefine the macros bool, true, and false,
|
||||
as C99 lists that as an "obsolescent feature".
|
||||
|
||||
Limitations of this substitute, when used in a C89 environment:
|
||||
|
||||
- <stdbool.h> must be #included before the '_Bool' type can be used.
|
||||
|
||||
- You cannot assume that _Bool is a typedef; it might be a macro.
|
||||
|
||||
- Bit-fields of type 'bool' are not supported. Portable code
|
||||
should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
|
||||
|
||||
- In C99, casts and automatic conversions to '_Bool' or 'bool' are
|
||||
performed in such a way that every nonzero value gets converted
|
||||
to 'true', and zero gets converted to 'false'. This doesn't work
|
||||
with this substitute. With this substitute, only the values 0 and 1
|
||||
give the expected result when converted to _Bool' or 'bool'.
|
||||
|
||||
Also, it is suggested that programs use 'bool' rather than '_Bool';
|
||||
this isn't required, but 'bool' is more common. */
|
||||
|
||||
|
||||
/* 7.16. Boolean type and values */
|
||||
|
||||
/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
|
||||
definitions below, but temporarily we have to #undef them. */
|
||||
#if defined __BEOS__ && !defined __HAIKU__
|
||||
# include <OS.h> /* defines bool but not _Bool */
|
||||
# undef false
|
||||
# undef true
|
||||
#endif
|
||||
|
||||
/* For the sake of symbolic names in gdb, we define true and false as
|
||||
enum constants, not only as macros.
|
||||
It is tempting to write
|
||||
typedef enum { false = 0, true = 1 } _Bool;
|
||||
so that gdb prints values of type 'bool' symbolically. But if we do
|
||||
this, values of type '_Bool' may promote to 'int' or 'unsigned int'
|
||||
(see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
|
||||
(see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
|
||||
enum; this ensures that '_Bool' promotes to 'int'. */
|
||||
#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__)
|
||||
/* A compiler known to have 'bool'. */
|
||||
/* If the compiler already has both 'bool' and '_Bool', we can assume they
|
||||
are the same types. */
|
||||
# if !@HAVE__BOOL@
|
||||
typedef bool _Bool;
|
||||
# endif
|
||||
#else
|
||||
# if !defined __GNUC__
|
||||
/* If @HAVE__BOOL@:
|
||||
Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
|
||||
the built-in _Bool type is used. See
|
||||
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
|
||||
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
|
||||
http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
|
||||
Similar bugs are likely with other compilers as well; this file
|
||||
wouldn't be used if <stdbool.h> was working.
|
||||
So we override the _Bool type.
|
||||
If !@HAVE__BOOL@:
|
||||
Need to define _Bool ourselves. As 'signed char' or as an enum type?
|
||||
Use of a typedef, with SunPRO C, leads to a stupid
|
||||
"warning: _Bool is a keyword in ISO C99".
|
||||
Use of an enum type, with IRIX cc, leads to a stupid
|
||||
"warning(1185): enumerated type mixed with another type".
|
||||
Even the existence of an enum type, without a typedef,
|
||||
"Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
|
||||
The only benefit of the enum, debuggability, is not important
|
||||
with these compilers. So use 'signed char' and no enum. */
|
||||
# define _Bool signed char
|
||||
# else
|
||||
/* With this compiler, trust the _Bool type if the compiler has it. */
|
||||
# if !@HAVE__BOOL@
|
||||
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#define bool _Bool
|
||||
|
||||
/* The other macros must be usable in preprocessor directives. */
|
||||
#define false 0
|
||||
#define true 1
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif /* _GL_STDBOOL_H */
|
||||
@@ -1,86 +0,0 @@
|
||||
/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
|
||||
|
||||
Copyright (C) 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Eric Blake. */
|
||||
|
||||
/*
|
||||
* POSIX 2008 <stddef.h> for platforms that have issues.
|
||||
* <http://www.opengroup.org/susv3xbd/stddef.h.html>
|
||||
*/
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
|
||||
#if defined __need_wchar_t || defined __need_size_t \
|
||||
|| defined __need_ptrdiff_t || defined __need_NULL \
|
||||
|| defined __need_wint_t
|
||||
/* Special invocation convention inside gcc header files. In
|
||||
particular, gcc provides a version of <stddef.h> that blindly
|
||||
redefines NULL even when __need_wint_t was defined, even though
|
||||
wint_t is not normally provided by <stddef.h>. Hence, we must
|
||||
remember if special invocation has ever been used to obtain wint_t,
|
||||
in which case we need to clean up NULL yet again. */
|
||||
|
||||
# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T)
|
||||
# ifdef __need_wint_t
|
||||
# undef _GL_STDDEF_H
|
||||
# define _GL_STDDEF_WINT_T
|
||||
# endif
|
||||
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
|
||||
# endif
|
||||
|
||||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
# ifndef _GL_STDDEF_H
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
|
||||
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
|
||||
|
||||
# ifndef _GL_STDDEF_H
|
||||
# define _GL_STDDEF_H
|
||||
|
||||
/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
|
||||
#if @REPLACE_NULL@
|
||||
# undef NULL
|
||||
# ifdef __cplusplus
|
||||
/* ISO C++ says that the macro NULL must expand to an integer constant
|
||||
expression, hence '((void *) 0)' is not allowed in C++. */
|
||||
# if __GNUG__ >= 3
|
||||
/* GNU C++ has a __null macro that behaves like an integer ('int' or
|
||||
'long') but has the same size as a pointer. Use that, to avoid
|
||||
warnings. */
|
||||
# define NULL __null
|
||||
# else
|
||||
# define NULL 0L
|
||||
# endif
|
||||
# else
|
||||
# define NULL ((void *) 0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Some platforms lack wchar_t. */
|
||||
#if !@HAVE_WCHAR_T@
|
||||
# define wchar_t int
|
||||
#endif
|
||||
|
||||
# endif /* _GL_STDDEF_H */
|
||||
# endif /* _GL_STDDEF_H */
|
||||
#endif /* __need_XXX */
|
||||
567
lib/stdint.in.h
567
lib/stdint.in.h
@@ -1,567 +0,0 @@
|
||||
/* Copyright (C) 2001-2002, 2004-2009 Free Software Foundation, Inc.
|
||||
Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
|
||||
This file is part of gnulib.
|
||||
|
||||
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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/*
|
||||
* ISO C 99 <stdint.h> for platforms that lack it.
|
||||
* <http://www.opengroup.org/susv3xbd/stdint.h.html>
|
||||
*/
|
||||
|
||||
#ifndef _GL_STDINT_H
|
||||
|
||||
/* When including a system file that in turn includes <inttypes.h>,
|
||||
use the system <inttypes.h>, not our substitute. This avoids
|
||||
problems with (for example) VMS, whose <sys/bitypes.h> includes
|
||||
<inttypes.h>. */
|
||||
#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
|
||||
|
||||
/* Get those types that are already defined in other system include
|
||||
files, so that we can "#define int8_t signed char" below without
|
||||
worrying about a later system include file containing a "typedef
|
||||
signed char int8_t;" that will get messed up by our macro. Our
|
||||
macros should all be consistent with the system versions, except
|
||||
for the "fast" types and macros, which we recommend against using
|
||||
in public interfaces due to compiler differences. */
|
||||
|
||||
#if @HAVE_STDINT_H@
|
||||
# if defined __sgi && ! defined __c99
|
||||
/* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
|
||||
with "This header file is to be used only for c99 mode compilations"
|
||||
diagnostics. */
|
||||
# define __STDINT_H__
|
||||
# endif
|
||||
/* Other systems may have an incomplete or buggy <stdint.h>.
|
||||
Include it before <inttypes.h>, since any "#include <stdint.h>"
|
||||
in <inttypes.h> would reinclude us, skipping our contents because
|
||||
_GL_STDINT_H is defined.
|
||||
The include_next requires a split double-inclusion guard. */
|
||||
# if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
# endif
|
||||
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
|
||||
#endif
|
||||
|
||||
#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
|
||||
#define _GL_STDINT_H
|
||||
|
||||
/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
|
||||
IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
|
||||
AIX 5.2 <sys/types.h> isn't needed and causes troubles.
|
||||
MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
|
||||
relies on the system <stdint.h> definitions, so include
|
||||
<sys/types.h> after @NEXT_STDINT_H@. */
|
||||
#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */
|
||||
#include <limits.h>
|
||||
|
||||
#if @HAVE_INTTYPES_H@
|
||||
/* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
|
||||
int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
|
||||
<inttypes.h> also defines intptr_t and uintptr_t. */
|
||||
# include <inttypes.h>
|
||||
#elif @HAVE_SYS_INTTYPES_H@
|
||||
/* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
|
||||
the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
|
||||
# include <sys/inttypes.h>
|
||||
#endif
|
||||
|
||||
#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
|
||||
/* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
|
||||
int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
|
||||
included by <sys/types.h>. */
|
||||
# include <sys/bitypes.h>
|
||||
#endif
|
||||
|
||||
#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
|
||||
|
||||
/* Minimum and maximum values for a integer type under the usual assumption.
|
||||
Return an unspecified value if BITS == 0, adding a check to pacify
|
||||
picky compilers. */
|
||||
|
||||
#define _STDINT_MIN(signed, bits, zero) \
|
||||
((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
|
||||
|
||||
#define _STDINT_MAX(signed, bits, zero) \
|
||||
((signed) \
|
||||
? ~ _STDINT_MIN (signed, bits, zero) \
|
||||
: /* The expression for the unsigned case. The subtraction of (signed) \
|
||||
is a nop in the unsigned case and avoids "signed integer overflow" \
|
||||
warnings in the signed case. */ \
|
||||
((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
|
||||
|
||||
/* 7.18.1.1. Exact-width integer types */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. */
|
||||
|
||||
#undef int8_t
|
||||
#undef uint8_t
|
||||
typedef signed char gl_int8_t;
|
||||
typedef unsigned char gl_uint8_t;
|
||||
#define int8_t gl_int8_t
|
||||
#define uint8_t gl_uint8_t
|
||||
|
||||
#undef int16_t
|
||||
#undef uint16_t
|
||||
typedef short int gl_int16_t;
|
||||
typedef unsigned short int gl_uint16_t;
|
||||
#define int16_t gl_int16_t
|
||||
#define uint16_t gl_uint16_t
|
||||
|
||||
#undef int32_t
|
||||
#undef uint32_t
|
||||
typedef int gl_int32_t;
|
||||
typedef unsigned int gl_uint32_t;
|
||||
#define int32_t gl_int32_t
|
||||
#define uint32_t gl_uint32_t
|
||||
|
||||
/* Do not undefine int64_t if gnulib is not being used with 64-bit
|
||||
types, since otherwise it breaks platforms like Tandem/NSK. */
|
||||
#if LONG_MAX >> 31 >> 31 == 1
|
||||
# undef int64_t
|
||||
typedef long int gl_int64_t;
|
||||
# define int64_t gl_int64_t
|
||||
# define GL_INT64_T
|
||||
#elif defined _MSC_VER
|
||||
# undef int64_t
|
||||
typedef __int64 gl_int64_t;
|
||||
# define int64_t gl_int64_t
|
||||
# define GL_INT64_T
|
||||
#elif @HAVE_LONG_LONG_INT@
|
||||
# undef int64_t
|
||||
typedef long long int gl_int64_t;
|
||||
# define int64_t gl_int64_t
|
||||
# define GL_INT64_T
|
||||
#endif
|
||||
|
||||
#if ULONG_MAX >> 31 >> 31 >> 1 == 1
|
||||
# undef uint64_t
|
||||
typedef unsigned long int gl_uint64_t;
|
||||
# define uint64_t gl_uint64_t
|
||||
# define GL_UINT64_T
|
||||
#elif defined _MSC_VER
|
||||
# undef uint64_t
|
||||
typedef unsigned __int64 gl_uint64_t;
|
||||
# define uint64_t gl_uint64_t
|
||||
# define GL_UINT64_T
|
||||
#elif @HAVE_UNSIGNED_LONG_LONG_INT@
|
||||
# undef uint64_t
|
||||
typedef unsigned long long int gl_uint64_t;
|
||||
# define uint64_t gl_uint64_t
|
||||
# define GL_UINT64_T
|
||||
#endif
|
||||
|
||||
/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
|
||||
#define _UINT8_T
|
||||
#define _UINT32_T
|
||||
#define _UINT64_T
|
||||
|
||||
|
||||
/* 7.18.1.2. Minimum-width integer types */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
|
||||
are the same as the corresponding N_t types. */
|
||||
|
||||
#undef int_least8_t
|
||||
#undef uint_least8_t
|
||||
#undef int_least16_t
|
||||
#undef uint_least16_t
|
||||
#undef int_least32_t
|
||||
#undef uint_least32_t
|
||||
#undef int_least64_t
|
||||
#undef uint_least64_t
|
||||
#define int_least8_t int8_t
|
||||
#define uint_least8_t uint8_t
|
||||
#define int_least16_t int16_t
|
||||
#define uint_least16_t uint16_t
|
||||
#define int_least32_t int32_t
|
||||
#define uint_least32_t uint32_t
|
||||
#ifdef GL_INT64_T
|
||||
# define int_least64_t int64_t
|
||||
#endif
|
||||
#ifdef GL_UINT64_T
|
||||
# define uint_least64_t uint64_t
|
||||
#endif
|
||||
|
||||
/* 7.18.1.3. Fastest minimum-width integer types */
|
||||
|
||||
/* Note: Other <stdint.h> substitutes may define these types differently.
|
||||
It is not recommended to use these types in public header files. */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
|
||||
are taken from the same list of types. Assume that 'long int'
|
||||
is fast enough for all narrower integers. */
|
||||
|
||||
#undef int_fast8_t
|
||||
#undef uint_fast8_t
|
||||
#undef int_fast16_t
|
||||
#undef uint_fast16_t
|
||||
#undef int_fast32_t
|
||||
#undef uint_fast32_t
|
||||
#undef int_fast64_t
|
||||
#undef uint_fast64_t
|
||||
typedef long int gl_int_fast8_t;
|
||||
typedef unsigned long int gl_uint_fast8_t;
|
||||
typedef long int gl_int_fast16_t;
|
||||
typedef unsigned long int gl_uint_fast16_t;
|
||||
typedef long int gl_int_fast32_t;
|
||||
typedef unsigned long int gl_uint_fast32_t;
|
||||
#define int_fast8_t gl_int_fast8_t
|
||||
#define uint_fast8_t gl_uint_fast8_t
|
||||
#define int_fast16_t gl_int_fast16_t
|
||||
#define uint_fast16_t gl_uint_fast16_t
|
||||
#define int_fast32_t gl_int_fast32_t
|
||||
#define uint_fast32_t gl_uint_fast32_t
|
||||
#ifdef GL_INT64_T
|
||||
# define int_fast64_t int64_t
|
||||
#endif
|
||||
#ifdef GL_UINT64_T
|
||||
# define uint_fast64_t uint64_t
|
||||
#endif
|
||||
|
||||
/* 7.18.1.4. Integer types capable of holding object pointers */
|
||||
|
||||
#undef intptr_t
|
||||
#undef uintptr_t
|
||||
typedef long int gl_intptr_t;
|
||||
typedef unsigned long int gl_uintptr_t;
|
||||
#define intptr_t gl_intptr_t
|
||||
#define uintptr_t gl_uintptr_t
|
||||
|
||||
/* 7.18.1.5. Greatest-width integer types */
|
||||
|
||||
/* Note: These types are compiler dependent. It may be unwise to use them in
|
||||
public header files. */
|
||||
|
||||
#undef intmax_t
|
||||
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
|
||||
typedef long long int gl_intmax_t;
|
||||
# define intmax_t gl_intmax_t
|
||||
#elif defined GL_INT64_T
|
||||
# define intmax_t int64_t
|
||||
#else
|
||||
typedef long int gl_intmax_t;
|
||||
# define intmax_t gl_intmax_t
|
||||
#endif
|
||||
|
||||
#undef uintmax_t
|
||||
#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
|
||||
typedef unsigned long long int gl_uintmax_t;
|
||||
# define uintmax_t gl_uintmax_t
|
||||
#elif defined GL_UINT64_T
|
||||
# define uintmax_t uint64_t
|
||||
#else
|
||||
typedef unsigned long int gl_uintmax_t;
|
||||
# define uintmax_t gl_uintmax_t
|
||||
#endif
|
||||
|
||||
/* Verify that intmax_t and uintmax_t have the same size. Too much code
|
||||
breaks if this is not the case. If this check fails, the reason is likely
|
||||
to be found in the autoconf macros. */
|
||||
typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
|
||||
|
||||
/* 7.18.2. Limits of specified-width integer types */
|
||||
|
||||
#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
|
||||
|
||||
/* 7.18.2.1. Limits of exact-width integer types */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. */
|
||||
|
||||
#undef INT8_MIN
|
||||
#undef INT8_MAX
|
||||
#undef UINT8_MAX
|
||||
#define INT8_MIN (~ INT8_MAX)
|
||||
#define INT8_MAX 127
|
||||
#define UINT8_MAX 255
|
||||
|
||||
#undef INT16_MIN
|
||||
#undef INT16_MAX
|
||||
#undef UINT16_MAX
|
||||
#define INT16_MIN (~ INT16_MAX)
|
||||
#define INT16_MAX 32767
|
||||
#define UINT16_MAX 65535
|
||||
|
||||
#undef INT32_MIN
|
||||
#undef INT32_MAX
|
||||
#undef UINT32_MAX
|
||||
#define INT32_MIN (~ INT32_MAX)
|
||||
#define INT32_MAX 2147483647
|
||||
#define UINT32_MAX 4294967295U
|
||||
|
||||
#undef INT64_MIN
|
||||
#undef INT64_MAX
|
||||
#ifdef GL_INT64_T
|
||||
/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
|
||||
evaluates the latter incorrectly in preprocessor expressions. */
|
||||
# define INT64_MIN (- INTMAX_C (1) << 63)
|
||||
# define INT64_MAX INTMAX_C (9223372036854775807)
|
||||
#endif
|
||||
|
||||
#undef UINT64_MAX
|
||||
#ifdef GL_UINT64_T
|
||||
# define UINT64_MAX UINTMAX_C (18446744073709551615)
|
||||
#endif
|
||||
|
||||
/* 7.18.2.2. Limits of minimum-width integer types */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
|
||||
are the same as the corresponding N_t types. */
|
||||
|
||||
#undef INT_LEAST8_MIN
|
||||
#undef INT_LEAST8_MAX
|
||||
#undef UINT_LEAST8_MAX
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
|
||||
#undef INT_LEAST16_MIN
|
||||
#undef INT_LEAST16_MAX
|
||||
#undef UINT_LEAST16_MAX
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
|
||||
#undef INT_LEAST32_MIN
|
||||
#undef INT_LEAST32_MAX
|
||||
#undef UINT_LEAST32_MAX
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
|
||||
#undef INT_LEAST64_MIN
|
||||
#undef INT_LEAST64_MAX
|
||||
#ifdef GL_INT64_T
|
||||
# define INT_LEAST64_MIN INT64_MIN
|
||||
# define INT_LEAST64_MAX INT64_MAX
|
||||
#endif
|
||||
|
||||
#undef UINT_LEAST64_MAX
|
||||
#ifdef GL_UINT64_T
|
||||
# define UINT_LEAST64_MAX UINT64_MAX
|
||||
#endif
|
||||
|
||||
/* 7.18.2.3. Limits of fastest minimum-width integer types */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
|
||||
are taken from the same list of types. */
|
||||
|
||||
#undef INT_FAST8_MIN
|
||||
#undef INT_FAST8_MAX
|
||||
#undef UINT_FAST8_MAX
|
||||
#define INT_FAST8_MIN LONG_MIN
|
||||
#define INT_FAST8_MAX LONG_MAX
|
||||
#define UINT_FAST8_MAX ULONG_MAX
|
||||
|
||||
#undef INT_FAST16_MIN
|
||||
#undef INT_FAST16_MAX
|
||||
#undef UINT_FAST16_MAX
|
||||
#define INT_FAST16_MIN LONG_MIN
|
||||
#define INT_FAST16_MAX LONG_MAX
|
||||
#define UINT_FAST16_MAX ULONG_MAX
|
||||
|
||||
#undef INT_FAST32_MIN
|
||||
#undef INT_FAST32_MAX
|
||||
#undef UINT_FAST32_MAX
|
||||
#define INT_FAST32_MIN LONG_MIN
|
||||
#define INT_FAST32_MAX LONG_MAX
|
||||
#define UINT_FAST32_MAX ULONG_MAX
|
||||
|
||||
#undef INT_FAST64_MIN
|
||||
#undef INT_FAST64_MAX
|
||||
#ifdef GL_INT64_T
|
||||
# define INT_FAST64_MIN INT64_MIN
|
||||
# define INT_FAST64_MAX INT64_MAX
|
||||
#endif
|
||||
|
||||
#undef UINT_FAST64_MAX
|
||||
#ifdef GL_UINT64_T
|
||||
# define UINT_FAST64_MAX UINT64_MAX
|
||||
#endif
|
||||
|
||||
/* 7.18.2.4. Limits of integer types capable of holding object pointers */
|
||||
|
||||
#undef INTPTR_MIN
|
||||
#undef INTPTR_MAX
|
||||
#undef UINTPTR_MAX
|
||||
#define INTPTR_MIN LONG_MIN
|
||||
#define INTPTR_MAX LONG_MAX
|
||||
#define UINTPTR_MAX ULONG_MAX
|
||||
|
||||
/* 7.18.2.5. Limits of greatest-width integer types */
|
||||
|
||||
#undef INTMAX_MIN
|
||||
#undef INTMAX_MAX
|
||||
#ifdef INT64_MAX
|
||||
# define INTMAX_MIN INT64_MIN
|
||||
# define INTMAX_MAX INT64_MAX
|
||||
#else
|
||||
# define INTMAX_MIN INT32_MIN
|
||||
# define INTMAX_MAX INT32_MAX
|
||||
#endif
|
||||
|
||||
#undef UINTMAX_MAX
|
||||
#ifdef UINT64_MAX
|
||||
# define UINTMAX_MAX UINT64_MAX
|
||||
#else
|
||||
# define UINTMAX_MAX UINT32_MAX
|
||||
#endif
|
||||
|
||||
/* 7.18.3. Limits of other integer types */
|
||||
|
||||
/* ptrdiff_t limits */
|
||||
#undef PTRDIFF_MIN
|
||||
#undef PTRDIFF_MAX
|
||||
#if @APPLE_UNIVERSAL_BUILD@
|
||||
# ifdef _LP64
|
||||
# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l)
|
||||
# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l)
|
||||
# else
|
||||
# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0)
|
||||
# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0)
|
||||
# endif
|
||||
#else
|
||||
# define PTRDIFF_MIN \
|
||||
_STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
|
||||
# define PTRDIFF_MAX \
|
||||
_STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
|
||||
#endif
|
||||
|
||||
/* sig_atomic_t limits */
|
||||
#undef SIG_ATOMIC_MIN
|
||||
#undef SIG_ATOMIC_MAX
|
||||
#define SIG_ATOMIC_MIN \
|
||||
_STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
|
||||
0@SIG_ATOMIC_T_SUFFIX@)
|
||||
#define SIG_ATOMIC_MAX \
|
||||
_STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
|
||||
0@SIG_ATOMIC_T_SUFFIX@)
|
||||
|
||||
|
||||
/* size_t limit */
|
||||
#undef SIZE_MAX
|
||||
#if @APPLE_UNIVERSAL_BUILD@
|
||||
# ifdef _LP64
|
||||
# define SIZE_MAX _STDINT_MAX (0, 64, 0ul)
|
||||
# else
|
||||
# define SIZE_MAX _STDINT_MAX (0, 32, 0ul)
|
||||
# endif
|
||||
#else
|
||||
# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
|
||||
#endif
|
||||
|
||||
/* wchar_t limits */
|
||||
/* Get WCHAR_MIN, WCHAR_MAX.
|
||||
This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested
|
||||
includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
|
||||
<stdint.h> and assumes its types are already defined. */
|
||||
#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
|
||||
# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
|
||||
# include <wchar.h>
|
||||
# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
|
||||
#endif
|
||||
#undef WCHAR_MIN
|
||||
#undef WCHAR_MAX
|
||||
#define WCHAR_MIN \
|
||||
_STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
|
||||
#define WCHAR_MAX \
|
||||
_STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
|
||||
|
||||
/* wint_t limits */
|
||||
#undef WINT_MIN
|
||||
#undef WINT_MAX
|
||||
#define WINT_MIN \
|
||||
_STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
|
||||
#define WINT_MAX \
|
||||
_STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
|
||||
|
||||
#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
|
||||
|
||||
/* 7.18.4. Macros for integer constants */
|
||||
|
||||
#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
|
||||
|
||||
/* 7.18.4.1. Macros for minimum-width integer constants */
|
||||
/* According to ISO C 99 Technical Corrigendum 1 */
|
||||
|
||||
/* Here we assume a standard architecture where the hardware integer
|
||||
types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */
|
||||
|
||||
#undef INT8_C
|
||||
#undef UINT8_C
|
||||
#define INT8_C(x) x
|
||||
#define UINT8_C(x) x
|
||||
|
||||
#undef INT16_C
|
||||
#undef UINT16_C
|
||||
#define INT16_C(x) x
|
||||
#define UINT16_C(x) x
|
||||
|
||||
#undef INT32_C
|
||||
#undef UINT32_C
|
||||
#define INT32_C(x) x
|
||||
#define UINT32_C(x) x ## U
|
||||
|
||||
#undef INT64_C
|
||||
#undef UINT64_C
|
||||
#if LONG_MAX >> 31 >> 31 == 1
|
||||
# define INT64_C(x) x##L
|
||||
#elif defined _MSC_VER
|
||||
# define INT64_C(x) x##i64
|
||||
#elif @HAVE_LONG_LONG_INT@
|
||||
# define INT64_C(x) x##LL
|
||||
#endif
|
||||
#if ULONG_MAX >> 31 >> 31 >> 1 == 1
|
||||
# define UINT64_C(x) x##UL
|
||||
#elif defined _MSC_VER
|
||||
# define UINT64_C(x) x##ui64
|
||||
#elif @HAVE_UNSIGNED_LONG_LONG_INT@
|
||||
# define UINT64_C(x) x##ULL
|
||||
#endif
|
||||
|
||||
/* 7.18.4.2. Macros for greatest-width integer constants */
|
||||
|
||||
#undef INTMAX_C
|
||||
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
|
||||
# define INTMAX_C(x) x##LL
|
||||
#elif defined GL_INT64_T
|
||||
# define INTMAX_C(x) INT64_C(x)
|
||||
#else
|
||||
# define INTMAX_C(x) x##L
|
||||
#endif
|
||||
|
||||
#undef UINTMAX_C
|
||||
#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
|
||||
# define UINTMAX_C(x) x##ULL
|
||||
#elif defined GL_UINT64_T
|
||||
# define UINTMAX_C(x) UINT64_C(x)
|
||||
#else
|
||||
# define UINTMAX_C(x) x##UL
|
||||
#endif
|
||||
|
||||
#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
|
||||
|
||||
#endif /* _GL_STDINT_H */
|
||||
#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
|
||||
@@ -1,94 +0,0 @@
|
||||
/* Implementation details of FILE streams.
|
||||
Copyright (C) 2007, 2008, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Many stdio implementations have the same logic and therefore can share
|
||||
the same implementation of stdio extension API, except that some fields
|
||||
have different naming conventions, or their access requires some casts. */
|
||||
|
||||
|
||||
/* BSD stdio derived implementations. */
|
||||
|
||||
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
||||
|
||||
# if defined __DragonFly__ /* DragonFly */
|
||||
/* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
|
||||
# define fp_ ((struct { struct __FILE_public pub; \
|
||||
struct { unsigned char *_base; int _size; } _bf; \
|
||||
void *cookie; \
|
||||
void *_close; \
|
||||
void *_read; \
|
||||
void *_seek; \
|
||||
void *_write; \
|
||||
struct { unsigned char *_base; int _size; } _ub; \
|
||||
int _ur; \
|
||||
unsigned char _ubuf[3]; \
|
||||
unsigned char _nbuf[1]; \
|
||||
struct { unsigned char *_base; int _size; } _lb; \
|
||||
int _blksize; \
|
||||
fpos_t _offset; \
|
||||
/* More fields, not relevant here. */ \
|
||||
} *) fp)
|
||||
/* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
|
||||
# define _p pub._p
|
||||
# define _flags pub._flags
|
||||
# define _r pub._r
|
||||
# define _w pub._w
|
||||
# else
|
||||
# define fp_ fp
|
||||
# endif
|
||||
|
||||
# if defined __NetBSD__ || defined __OpenBSD__ /* NetBSD, OpenBSD */
|
||||
/* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
|
||||
and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
|
||||
struct __sfileext
|
||||
{
|
||||
struct __sbuf _ub; /* ungetc buffer */
|
||||
/* More fields, not relevant here. */
|
||||
};
|
||||
# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
|
||||
# else /* FreeBSD, DragonFly, MacOS X, Cygwin */
|
||||
# define fp_ub fp_->_ub
|
||||
# endif
|
||||
|
||||
# define HASUB(fp) (fp_ub._base != NULL)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* SystemV derived implementations. */
|
||||
|
||||
#if defined _IOERR
|
||||
|
||||
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
|
||||
# define fp_ ((struct { unsigned char *_ptr; \
|
||||
unsigned char *_base; \
|
||||
unsigned char *_end; \
|
||||
long _cnt; \
|
||||
int _file; \
|
||||
unsigned int _flag; \
|
||||
} *) fp)
|
||||
# else
|
||||
# define fp_ fp
|
||||
# endif
|
||||
|
||||
# if defined _SCO_DS /* OpenServer */
|
||||
# define _cnt __cnt
|
||||
# define _ptr __ptr
|
||||
# define _base __base
|
||||
# define _flag __flag
|
||||
# endif
|
||||
|
||||
#endif
|
||||
@@ -1,150 +0,0 @@
|
||||
/* POSIX compatible FILE stream write function.
|
||||
Copyright (C) 2008-2009 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2008.
|
||||
|
||||
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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <stdio.h>
|
||||
|
||||
/* Replace these functions only if module 'sigpipe' is requested. */
|
||||
#if GNULIB_SIGPIPE
|
||||
|
||||
/* On native Windows platforms, SIGPIPE does not exist. When write() is
|
||||
called on a pipe with no readers, WriteFile() fails with error
|
||||
GetLastError() = ERROR_NO_DATA, and write() in consequence fails with
|
||||
error EINVAL. This write() function is at the basis of the function
|
||||
which flushes the buffer of a FILE stream. */
|
||||
|
||||
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
|
||||
# include <errno.h>
|
||||
# include <signal.h>
|
||||
# include <io.h>
|
||||
|
||||
# define WIN32_LEAN_AND_MEAN /* avoid including junk */
|
||||
# include <windows.h>
|
||||
|
||||
# define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \
|
||||
if (ferror (stream)) \
|
||||
return (EXPRESSION); \
|
||||
else \
|
||||
{ \
|
||||
RETTYPE ret; \
|
||||
SetLastError (0); \
|
||||
ret = (EXPRESSION); \
|
||||
if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream)) \
|
||||
{ \
|
||||
int fd = fileno (stream); \
|
||||
if (fd >= 0 \
|
||||
&& GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
|
||||
{ \
|
||||
/* Try to raise signal SIGPIPE. */ \
|
||||
raise (SIGPIPE); \
|
||||
/* If it is currently blocked or ignored, change errno from \
|
||||
EINVAL to EPIPE. */ \
|
||||
errno = EPIPE; \
|
||||
} \
|
||||
} \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
# if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */
|
||||
# if !DEPENDS_ON_LIBINTL /* avoid collision with intl/printf.c */
|
||||
int
|
||||
printf (const char *format, ...)
|
||||
{
|
||||
int retval;
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
retval = vfprintf (stdout, format, args);
|
||||
va_end (args);
|
||||
|
||||
return retval;
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */
|
||||
int
|
||||
fprintf (FILE *stream, const char *format, ...)
|
||||
{
|
||||
int retval;
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
retval = vfprintf (stream, format, args);
|
||||
va_end (args);
|
||||
|
||||
return retval;
|
||||
}
|
||||
# endif
|
||||
|
||||
# if !REPLACE_VPRINTF_POSIX /* avoid collision with vprintf.c */
|
||||
int
|
||||
vprintf (const char *format, va_list args)
|
||||
{
|
||||
return vfprintf (stdout, format, args);
|
||||
}
|
||||
# endif
|
||||
|
||||
# if !REPLACE_VFPRINTF_POSIX /* avoid collision with vfprintf.c */
|
||||
int
|
||||
vfprintf (FILE *stream, const char *format, va_list args)
|
||||
#undef vfprintf
|
||||
{
|
||||
CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF)
|
||||
}
|
||||
# endif
|
||||
|
||||
int
|
||||
putchar (int c)
|
||||
{
|
||||
return fputc (c, stdout);
|
||||
}
|
||||
|
||||
int
|
||||
fputc (int c, FILE *stream)
|
||||
#undef fputc
|
||||
{
|
||||
CALL_WITH_SIGPIPE_EMULATION (int, fputc (c, stream), ret == EOF)
|
||||
}
|
||||
|
||||
int
|
||||
fputs (const char *string, FILE *stream)
|
||||
#undef fputs
|
||||
{
|
||||
CALL_WITH_SIGPIPE_EMULATION (int, fputs (string, stream), ret == EOF)
|
||||
}
|
||||
|
||||
int
|
||||
puts (const char *string)
|
||||
#undef puts
|
||||
{
|
||||
FILE *stream = stdout;
|
||||
CALL_WITH_SIGPIPE_EMULATION (int, puts (string), ret == EOF)
|
||||
}
|
||||
|
||||
size_t
|
||||
fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
|
||||
#undef fwrite
|
||||
{
|
||||
CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n)
|
||||
}
|
||||
|
||||
# endif
|
||||
#endif
|
||||
559
lib/stdio.in.h
559
lib/stdio.in.h
@@ -1,559 +0,0 @@
|
||||
/* A GNU-like <stdio.h>.
|
||||
|
||||
Copyright (C) 2004, 2007-2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
|
||||
#if defined __need_FILE || defined __need___FILE
|
||||
/* Special invocation convention inside glibc header files. */
|
||||
|
||||
#@INCLUDE_NEXT@ @NEXT_STDIO_H@
|
||||
|
||||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _GL_STDIO_H
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_STDIO_H@
|
||||
|
||||
#ifndef _GL_STDIO_H
|
||||
#define _GL_STDIO_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
|
||||
|| (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
|
||||
|| (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
|
||||
|| (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
|
||||
/* Get off_t and ssize_t. */
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
/* The __-protected variants of `format' and `printf' attributes
|
||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||
# define __format__ format
|
||||
# define __printf__ printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* The definition of GL_LINK_WARNING is copied here. */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_FPRINTF_POSIX@
|
||||
# if @REPLACE_FPRINTF@
|
||||
# define fprintf rpl_fprintf
|
||||
extern int fprintf (FILE *fp, const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
# endif
|
||||
#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
|
||||
# define fprintf rpl_fprintf
|
||||
extern int fprintf (FILE *fp, const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fprintf
|
||||
# define fprintf \
|
||||
(GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
|
||||
"use gnulib module fprintf-posix for portable " \
|
||||
"POSIX compliance"), \
|
||||
fprintf)
|
||||
#endif
|
||||
|
||||
#if @GNULIB_VFPRINTF_POSIX@
|
||||
# if @REPLACE_VFPRINTF@
|
||||
# define vfprintf rpl_vfprintf
|
||||
extern int vfprintf (FILE *fp, const char *format, va_list args)
|
||||
__attribute__ ((__format__ (__printf__, 2, 0)));
|
||||
# endif
|
||||
#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
|
||||
# define vfprintf rpl_vfprintf
|
||||
extern int vfprintf (FILE *fp, const char *format, va_list args)
|
||||
__attribute__ ((__format__ (__printf__, 2, 0)));
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef vfprintf
|
||||
# define vfprintf(s,f,a) \
|
||||
(GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
|
||||
"use gnulib module vfprintf-posix for portable " \
|
||||
"POSIX compliance"), \
|
||||
vfprintf (s, f, a))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_PRINTF_POSIX@
|
||||
# if @REPLACE_PRINTF@
|
||||
/* Don't break __attribute__((format(printf,M,N))). */
|
||||
# define printf __printf__
|
||||
extern int printf (const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
# endif
|
||||
#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
|
||||
/* Don't break __attribute__((format(printf,M,N))). */
|
||||
# define printf __printf__
|
||||
extern int printf (const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef printf
|
||||
# define printf \
|
||||
(GL_LINK_WARNING ("printf is not always POSIX compliant - " \
|
||||
"use gnulib module printf-posix for portable " \
|
||||
"POSIX compliance"), \
|
||||
printf)
|
||||
/* Don't break __attribute__((format(printf,M,N))). */
|
||||
# define format(kind,m,n) format (__##kind##__, m, n)
|
||||
# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
|
||||
# define ____printf____ __printf__
|
||||
# define ____scanf____ __scanf__
|
||||
# define ____strftime____ __strftime__
|
||||
# define ____strfmon____ __strfmon__
|
||||
#endif
|
||||
|
||||
#if @GNULIB_VPRINTF_POSIX@
|
||||
# if @REPLACE_VPRINTF@
|
||||
# define vprintf rpl_vprintf
|
||||
extern int vprintf (const char *format, va_list args)
|
||||
__attribute__ ((__format__ (__printf__, 1, 0)));
|
||||
# endif
|
||||
#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
|
||||
# define vprintf rpl_vprintf
|
||||
extern int vprintf (const char *format, va_list args)
|
||||
__attribute__ ((__format__ (__printf__, 1, 0)));
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef vprintf
|
||||
# define vprintf(f,a) \
|
||||
(GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
|
||||
"use gnulib module vprintf-posix for portable " \
|
||||
"POSIX compliance"), \
|
||||
vprintf (f, a))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_SNPRINTF@
|
||||
# if @REPLACE_SNPRINTF@
|
||||
# define snprintf rpl_snprintf
|
||||
# endif
|
||||
# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
|
||||
extern int snprintf (char *str, size_t size, const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef snprintf
|
||||
# define snprintf \
|
||||
(GL_LINK_WARNING ("snprintf is unportable - " \
|
||||
"use gnulib module snprintf for portability"), \
|
||||
snprintf)
|
||||
#endif
|
||||
|
||||
#if @GNULIB_VSNPRINTF@
|
||||
# if @REPLACE_VSNPRINTF@
|
||||
# define vsnprintf rpl_vsnprintf
|
||||
# endif
|
||||
# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
|
||||
extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
|
||||
__attribute__ ((__format__ (__printf__, 3, 0)));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef vsnprintf
|
||||
# define vsnprintf(b,s,f,a) \
|
||||
(GL_LINK_WARNING ("vsnprintf is unportable - " \
|
||||
"use gnulib module vsnprintf for portability"), \
|
||||
vsnprintf (b, s, f, a))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_SPRINTF_POSIX@
|
||||
# if @REPLACE_SPRINTF@
|
||||
# define sprintf rpl_sprintf
|
||||
extern int sprintf (char *str, const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef sprintf
|
||||
# define sprintf \
|
||||
(GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
|
||||
"use gnulib module sprintf-posix for portable " \
|
||||
"POSIX compliance"), \
|
||||
sprintf)
|
||||
#endif
|
||||
|
||||
#if @GNULIB_VSPRINTF_POSIX@
|
||||
# if @REPLACE_VSPRINTF@
|
||||
# define vsprintf rpl_vsprintf
|
||||
extern int vsprintf (char *str, const char *format, va_list args)
|
||||
__attribute__ ((__format__ (__printf__, 2, 0)));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef vsprintf
|
||||
# define vsprintf(b,f,a) \
|
||||
(GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
|
||||
"use gnulib module vsprintf-posix for portable " \
|
||||
"POSIX compliance"), \
|
||||
vsprintf (b, f, a))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_DPRINTF@
|
||||
# if @REPLACE_DPRINTF@
|
||||
# define dprintf rpl_dprintf
|
||||
# endif
|
||||
# if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
|
||||
extern int dprintf (int fd, const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef dprintf
|
||||
# define dprintf(d,f,a) \
|
||||
(GL_LINK_WARNING ("dprintf is unportable - " \
|
||||
"use gnulib module dprintf for portability"), \
|
||||
dprintf (d, f, a))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_VDPRINTF@
|
||||
# if @REPLACE_VDPRINTF@
|
||||
# define vdprintf rpl_vdprintf
|
||||
# endif
|
||||
# if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
|
||||
extern int vdprintf (int fd, const char *format, va_list args)
|
||||
__attribute__ ((__format__ (__printf__, 2, 0)));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef vdprintf
|
||||
# define vdprintf(d,f,a) \
|
||||
(GL_LINK_WARNING ("vdprintf is unportable - " \
|
||||
"use gnulib module vdprintf for portability"), \
|
||||
vdprintf (d, f, a))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_VASPRINTF@
|
||||
# if @REPLACE_VASPRINTF@
|
||||
# define asprintf rpl_asprintf
|
||||
# define vasprintf rpl_vasprintf
|
||||
# endif
|
||||
# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
|
||||
/* Write formatted output to a string dynamically allocated with malloc().
|
||||
If the memory allocation succeeds, store the address of the string in
|
||||
*RESULT and return the number of resulting bytes, excluding the trailing
|
||||
NUL. Upon memory allocation error, or some other error, return -1. */
|
||||
extern int asprintf (char **result, const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
extern int vasprintf (char **result, const char *format, va_list args)
|
||||
__attribute__ ((__format__ (__printf__, 2, 0)));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_OBSTACK_PRINTF@
|
||||
# if @REPLACE_OBSTACK_PRINTF@
|
||||
# define obstack_printf rpl_osbtack_printf
|
||||
# define obstack_vprintf rpl_obstack_vprintf
|
||||
# endif
|
||||
# if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
|
||||
struct obstack;
|
||||
/* Grow an obstack with formatted output. Return the number of
|
||||
bytes added to OBS. No trailing nul byte is added, and the
|
||||
object should be closed with obstack_finish before use. Upon
|
||||
memory allocation error, call obstack_alloc_failed_handler. Upon
|
||||
other error, return -1. */
|
||||
extern int obstack_printf (struct obstack *obs, const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
extern int obstack_vprintf (struct obstack *obs, const char *format,
|
||||
va_list args)
|
||||
__attribute__ ((__format__ (__printf__, 2, 0)));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FOPEN@
|
||||
# if @REPLACE_FOPEN@
|
||||
# undef fopen
|
||||
# define fopen rpl_fopen
|
||||
extern FILE * fopen (const char *filename, const char *mode);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fopen
|
||||
# define fopen(f,m) \
|
||||
(GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
|
||||
"use gnulib module fopen for portability"), \
|
||||
fopen (f, m))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FREOPEN@
|
||||
# if @REPLACE_FREOPEN@
|
||||
# undef freopen
|
||||
# define freopen rpl_freopen
|
||||
extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef freopen
|
||||
# define freopen(f,m,s) \
|
||||
(GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
|
||||
"use gnulib module freopen for portability"), \
|
||||
freopen (f, m, s))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FSEEKO@
|
||||
# if @REPLACE_FSEEKO@
|
||||
/* Provide fseek, fseeko functions that are aware of a preceding
|
||||
fflush(), and which detect pipes. */
|
||||
# define fseeko rpl_fseeko
|
||||
extern int fseeko (FILE *fp, off_t offset, int whence);
|
||||
# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fseeko
|
||||
# define fseeko(f,o,w) \
|
||||
(GL_LINK_WARNING ("fseeko is unportable - " \
|
||||
"use gnulib module fseeko for portability"), \
|
||||
fseeko (f, o, w))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
|
||||
extern int rpl_fseek (FILE *fp, long offset, int whence);
|
||||
# undef fseek
|
||||
# if defined GNULIB_POSIXCHECK
|
||||
# define fseek(f,o,w) \
|
||||
(GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
|
||||
"on 32-bit platforms - " \
|
||||
"use fseeko function for handling of large files"), \
|
||||
rpl_fseek (f, o, w))
|
||||
# else
|
||||
# define fseek rpl_fseek
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# ifndef fseek
|
||||
# define fseek(f,o,w) \
|
||||
(GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
|
||||
"on 32-bit platforms - " \
|
||||
"use fseeko function for handling of large files"), \
|
||||
fseek (f, o, w))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FTELLO@
|
||||
# if @REPLACE_FTELLO@
|
||||
# define ftello rpl_ftello
|
||||
extern off_t ftello (FILE *fp);
|
||||
# define ftell(fp) ftello (fp)
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef ftello
|
||||
# define ftello(f) \
|
||||
(GL_LINK_WARNING ("ftello is unportable - " \
|
||||
"use gnulib module ftello for portability"), \
|
||||
ftello (f))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FTELL@ && @REPLACE_FTELL@
|
||||
extern long rpl_ftell (FILE *fp);
|
||||
# undef ftell
|
||||
# if GNULIB_POSIXCHECK
|
||||
# define ftell(f) \
|
||||
(GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
|
||||
"on 32-bit platforms - " \
|
||||
"use ftello function for handling of large files"), \
|
||||
rpl_ftell (f))
|
||||
# else
|
||||
# define ftell rpl_ftell
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# ifndef ftell
|
||||
# define ftell(f) \
|
||||
(GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
|
||||
"on 32-bit platforms - " \
|
||||
"use ftello function for handling of large files"), \
|
||||
ftell (f))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FFLUSH@
|
||||
# if @REPLACE_FFLUSH@
|
||||
# define fflush rpl_fflush
|
||||
/* Flush all pending data on STREAM according to POSIX rules. Both
|
||||
output and seekable input streams are supported.
|
||||
Note! LOSS OF DATA can occur if fflush is applied on an input stream
|
||||
that is _not_seekable_ or on an update stream that is _not_seekable_
|
||||
and in which the most recent operation was input. Seekability can
|
||||
be tested with lseek(fileno(fp),0,SEEK_CUR). */
|
||||
extern int fflush (FILE *gl_stream);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fflush
|
||||
# define fflush(f) \
|
||||
(GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
|
||||
"use gnulib module fflush for portable " \
|
||||
"POSIX compliance"), \
|
||||
fflush (f))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FPURGE@
|
||||
# if @REPLACE_FPURGE@
|
||||
# define fpurge rpl_fpurge
|
||||
# endif
|
||||
# if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@
|
||||
/* Discard all pending buffered I/O data on STREAM.
|
||||
STREAM must not be wide-character oriented.
|
||||
When discarding pending output, the file position is set back to where it
|
||||
was before the write calls. When discarding pending input, the file
|
||||
position is advanced to match the end of the previously read input.
|
||||
Return 0 if successful. Upon error, return -1 and set errno. */
|
||||
extern int fpurge (FILE *gl_stream);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fpurge
|
||||
# define fpurge(f) \
|
||||
(GL_LINK_WARNING ("fpurge is not always present - " \
|
||||
"use gnulib module fpurge for portability"), \
|
||||
fpurge (f))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FCLOSE@
|
||||
# if @REPLACE_FCLOSE@
|
||||
# define fclose rpl_fclose
|
||||
/* Close STREAM and its underlying file descriptor. */
|
||||
extern int fclose (FILE *stream);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fclose
|
||||
# define fclose(f) \
|
||||
(GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
|
||||
"use gnulib module fclose for portable " \
|
||||
"POSIX compliance"), \
|
||||
fclose (f))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
|
||||
# undef fputc
|
||||
# define fputc rpl_fputc
|
||||
extern int fputc (int c, FILE *stream);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
|
||||
# undef putc
|
||||
# define putc rpl_fputc
|
||||
extern int putc (int c, FILE *stream);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
|
||||
# undef putchar
|
||||
# define putchar rpl_putchar
|
||||
extern int putchar (int c);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
|
||||
# undef fputs
|
||||
# define fputs rpl_fputs
|
||||
extern int fputs (const char *string, FILE *stream);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
|
||||
# undef puts
|
||||
# define puts rpl_puts
|
||||
extern int puts (const char *string);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
|
||||
# undef fwrite
|
||||
# define fwrite rpl_fwrite
|
||||
extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_POPEN@
|
||||
# if @REPLACE_POPEN@
|
||||
# undef popen
|
||||
# define popen rpl_popen
|
||||
extern FILE *popen (const char *cmd, const char *mode);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef popen
|
||||
# define popen(c,m) \
|
||||
(GL_LINK_WARNING ("popen is buggy on some platforms - " \
|
||||
"use gnulib module popen or pipe for more portability"), \
|
||||
popen (c, m))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_GETDELIM@
|
||||
# if !@HAVE_DECL_GETDELIM@
|
||||
/* Read input, up to (and including) the next occurrence of DELIMITER, from
|
||||
STREAM, store it in *LINEPTR (and NUL-terminate it).
|
||||
*LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
|
||||
bytes of space. It is realloc'd as necessary.
|
||||
Return the number of bytes read and stored at *LINEPTR (not including the
|
||||
NUL terminator), or -1 on error or EOF. */
|
||||
extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
|
||||
FILE *stream);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getdelim
|
||||
# define getdelim(l, s, d, f) \
|
||||
(GL_LINK_WARNING ("getdelim is unportable - " \
|
||||
"use gnulib module getdelim for portability"), \
|
||||
getdelim (l, s, d, f))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_GETLINE@
|
||||
# if @REPLACE_GETLINE@
|
||||
# undef getline
|
||||
# define getline rpl_getline
|
||||
# endif
|
||||
# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
|
||||
/* Read a line, up to (and including) the next newline, from STREAM, store it
|
||||
in *LINEPTR (and NUL-terminate it).
|
||||
*LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
|
||||
bytes of space. It is realloc'd as necessary.
|
||||
Return the number of bytes read and stored at *LINEPTR (not including the
|
||||
NUL terminator), or -1 on error or EOF. */
|
||||
extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getline
|
||||
# define getline(l, s, f) \
|
||||
(GL_LINK_WARNING ("getline is unportable - " \
|
||||
"use gnulib module getline for portability"), \
|
||||
getline (l, s, f))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_PERROR@
|
||||
# if @REPLACE_PERROR@
|
||||
# define perror rpl_perror
|
||||
/* Print a message to standard error, describing the value of ERRNO,
|
||||
(if STRING is not NULL and not empty) prefixed with STRING and ": ",
|
||||
and terminated with a newline. */
|
||||
extern void perror (const char *string);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef perror
|
||||
# define perror(s) \
|
||||
(GL_LINK_WARNING ("perror is not always POSIX compliant - " \
|
||||
"use gnulib module perror for portability"), \
|
||||
perror (s))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GL_STDIO_H */
|
||||
#endif /* _GL_STDIO_H */
|
||||
#endif
|
||||
410
lib/stdlib.in.h
410
lib/stdlib.in.h
@@ -1,410 +0,0 @@
|
||||
/* A GNU-like <stdlib.h>.
|
||||
|
||||
Copyright (C) 1995, 2001-2004, 2006-2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
|
||||
#if defined __need_malloc_and_calloc
|
||||
/* Special invocation convention inside glibc header files. */
|
||||
|
||||
#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
|
||||
|
||||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _GL_STDLIB_H
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
|
||||
|
||||
#ifndef _GL_STDLIB_H
|
||||
#define _GL_STDLIB_H
|
||||
|
||||
/* NetBSD 5.0 mis-defines NULL. */
|
||||
#include <stddef.h>
|
||||
|
||||
/* Solaris declares getloadavg() in <sys/loadavg.h>. */
|
||||
#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@
|
||||
# include <sys/loadavg.h>
|
||||
#endif
|
||||
|
||||
/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
|
||||
from <stdlib.h> if _REENTRANT is defined. Include it always. */
|
||||
#if @HAVE_RANDOM_H@
|
||||
# include <random.h>
|
||||
#endif
|
||||
|
||||
#if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if !@HAVE_STRUCT_RANDOM_DATA@
|
||||
struct random_data
|
||||
{
|
||||
int32_t *fptr; /* Front pointer. */
|
||||
int32_t *rptr; /* Rear pointer. */
|
||||
int32_t *state; /* Array of state values. */
|
||||
int rand_type; /* Type of random number generator. */
|
||||
int rand_deg; /* Degree of random number generator. */
|
||||
int rand_sep; /* Distance between front and rear. */
|
||||
int32_t *end_ptr; /* Pointer behind state table. */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* The definition of GL_LINK_WARNING is copied here. */
|
||||
|
||||
|
||||
/* Some systems do not define EXIT_*, despite otherwise supporting C89. */
|
||||
#ifndef EXIT_SUCCESS
|
||||
# define EXIT_SUCCESS 0
|
||||
#endif
|
||||
/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
|
||||
with proper operation of xargs. */
|
||||
#ifndef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
#elif EXIT_FAILURE != 1
|
||||
# undef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_MALLOC_POSIX@
|
||||
# if !@HAVE_MALLOC_POSIX@
|
||||
# undef malloc
|
||||
# define malloc rpl_malloc
|
||||
extern void * malloc (size_t size);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef malloc
|
||||
# define malloc(s) \
|
||||
(GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
|
||||
"use gnulib module malloc-posix for portability"), \
|
||||
malloc (s))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_REALLOC_POSIX@
|
||||
# if !@HAVE_REALLOC_POSIX@
|
||||
# undef realloc
|
||||
# define realloc rpl_realloc
|
||||
extern void * realloc (void *ptr, size_t size);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef realloc
|
||||
# define realloc(p,s) \
|
||||
(GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
|
||||
"use gnulib module realloc-posix for portability"), \
|
||||
realloc (p, s))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_CALLOC_POSIX@
|
||||
# if !@HAVE_CALLOC_POSIX@
|
||||
# undef calloc
|
||||
# define calloc rpl_calloc
|
||||
extern void * calloc (size_t nmemb, size_t size);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef calloc
|
||||
# define calloc(n,s) \
|
||||
(GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
|
||||
"use gnulib module calloc-posix for portability"), \
|
||||
calloc (n, s))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_ATOLL@
|
||||
# if !@HAVE_ATOLL@
|
||||
/* Parse a signed decimal integer.
|
||||
Returns the value of the integer. Errors are not detected. */
|
||||
extern long long atoll (const char *string);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef atoll
|
||||
# define atoll(s) \
|
||||
(GL_LINK_WARNING ("atoll is unportable - " \
|
||||
"use gnulib module atoll for portability"), \
|
||||
atoll (s))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_GETLOADAVG@
|
||||
# if !@HAVE_DECL_GETLOADAVG@
|
||||
/* Store max(NELEM,3) load average numbers in LOADAVG[].
|
||||
The three numbers are the load average of the last 1 minute, the last 5
|
||||
minutes, and the last 15 minutes, respectively.
|
||||
LOADAVG is an array of NELEM numbers. */
|
||||
extern int getloadavg (double loadavg[], int nelem);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getloadavg
|
||||
# define getloadavg(l,n) \
|
||||
(GL_LINK_WARNING ("getloadavg is not portable - " \
|
||||
"use gnulib module getloadavg for portability"), \
|
||||
getloadavg (l, n))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_GETSUBOPT@
|
||||
/* Assuming *OPTIONP is a comma separated list of elements of the form
|
||||
"token" or "token=value", getsubopt parses the first of these elements.
|
||||
If the first element refers to a "token" that is member of the given
|
||||
NULL-terminated array of tokens:
|
||||
- It replaces the comma with a NUL byte, updates *OPTIONP to point past
|
||||
the first option and the comma, sets *VALUEP to the value of the
|
||||
element (or NULL if it doesn't contain an "=" sign),
|
||||
- It returns the index of the "token" in the given array of tokens.
|
||||
Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
|
||||
For more details see the POSIX:2001 specification.
|
||||
http://www.opengroup.org/susv3xsh/getsubopt.html */
|
||||
# if !@HAVE_GETSUBOPT@
|
||||
extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getsubopt
|
||||
# define getsubopt(o,t,v) \
|
||||
(GL_LINK_WARNING ("getsubopt is unportable - " \
|
||||
"use gnulib module getsubopt for portability"), \
|
||||
getsubopt (o, t, v))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_MKDTEMP@
|
||||
# if !@HAVE_MKDTEMP@
|
||||
/* Create a unique temporary directory from TEMPLATE.
|
||||
The last six characters of TEMPLATE must be "XXXXXX";
|
||||
they are replaced with a string that makes the directory name unique.
|
||||
Returns TEMPLATE, or a null pointer if it cannot get a unique name.
|
||||
The directory is created mode 700. */
|
||||
extern char * mkdtemp (char * /*template*/);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mkdtemp
|
||||
# define mkdtemp(t) \
|
||||
(GL_LINK_WARNING ("mkdtemp is unportable - " \
|
||||
"use gnulib module mkdtemp for portability"), \
|
||||
mkdtemp (t))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_MKOSTEMP@
|
||||
# if !@HAVE_MKOSTEMP@
|
||||
/* Create a unique temporary file from TEMPLATE.
|
||||
The last six characters of TEMPLATE must be "XXXXXX";
|
||||
they are replaced with a string that makes the file name unique.
|
||||
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
|
||||
and O_TEXT, O_BINARY (defined in "binary-io.h").
|
||||
The file is then created, with the specified flags, ensuring it didn't exist
|
||||
before.
|
||||
The file is created read-write (mask at least 0600 & ~umask), but it may be
|
||||
world-readable and world-writable (mask 0666 & ~umask), depending on the
|
||||
implementation.
|
||||
Returns the open file descriptor if successful, otherwise -1 and errno
|
||||
set. */
|
||||
extern int mkostemp (char * /*template*/, int /*flags*/);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mkostemp
|
||||
# define mkostemp(t,f) \
|
||||
(GL_LINK_WARNING ("mkostemp is unportable - " \
|
||||
"use gnulib module mkostemp for portability"), \
|
||||
mkostemp (t, f))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_MKSTEMP@
|
||||
# if @REPLACE_MKSTEMP@
|
||||
/* Create a unique temporary file from TEMPLATE.
|
||||
The last six characters of TEMPLATE must be "XXXXXX";
|
||||
they are replaced with a string that makes the file name unique.
|
||||
The file is then created, ensuring it didn't exist before.
|
||||
The file is created read-write (mask at least 0600 & ~umask), but it may be
|
||||
world-readable and world-writable (mask 0666 & ~umask), depending on the
|
||||
implementation.
|
||||
Returns the open file descriptor if successful, otherwise -1 and errno
|
||||
set. */
|
||||
# define mkstemp rpl_mkstemp
|
||||
extern int mkstemp (char * /*template*/);
|
||||
# else
|
||||
/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mkstemp
|
||||
# define mkstemp(t) \
|
||||
(GL_LINK_WARNING ("mkstemp is unportable - " \
|
||||
"use gnulib module mkstemp for portability"), \
|
||||
mkstemp (t))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_PUTENV@
|
||||
# if @REPLACE_PUTENV@
|
||||
# undef putenv
|
||||
# define putenv rpl_putenv
|
||||
extern int putenv (char *string);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_RANDOM_R@
|
||||
# if !@HAVE_RANDOM_R@
|
||||
|
||||
# ifndef RAND_MAX
|
||||
# define RAND_MAX 2147483647
|
||||
# endif
|
||||
|
||||
int srandom_r (unsigned int seed, struct random_data *rand_state);
|
||||
int initstate_r (unsigned int seed, char *buf, size_t buf_size,
|
||||
struct random_data *rand_state);
|
||||
int setstate_r (char *arg_state, struct random_data *rand_state);
|
||||
int random_r (struct random_data *buf, int32_t *result);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef random_r
|
||||
# define random_r(b,r) \
|
||||
(GL_LINK_WARNING ("random_r is unportable - " \
|
||||
"use gnulib module random_r for portability"), \
|
||||
random_r (b,r))
|
||||
# undef initstate_r
|
||||
# define initstate_r(s,b,sz,r) \
|
||||
(GL_LINK_WARNING ("initstate_r is unportable - " \
|
||||
"use gnulib module random_r for portability"), \
|
||||
initstate_r (s,b,sz,r))
|
||||
# undef srandom_r
|
||||
# define srandom_r(s,r) \
|
||||
(GL_LINK_WARNING ("srandom_r is unportable - " \
|
||||
"use gnulib module random_r for portability"), \
|
||||
srandom_r (s,r))
|
||||
# undef setstate_r
|
||||
# define setstate_r(a,r) \
|
||||
(GL_LINK_WARNING ("setstate_r is unportable - " \
|
||||
"use gnulib module random_r for portability"), \
|
||||
setstate_r (a,r))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_RPMATCH@
|
||||
# if !@HAVE_RPMATCH@
|
||||
/* Test a user response to a question.
|
||||
Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
|
||||
extern int rpmatch (const char *response);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef rpmatch
|
||||
# define rpmatch(r) \
|
||||
(GL_LINK_WARNING ("rpmatch is unportable - " \
|
||||
"use gnulib module rpmatch for portability"), \
|
||||
rpmatch (r))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_SETENV@
|
||||
# if !@HAVE_SETENV@
|
||||
/* Set NAME to VALUE in the environment.
|
||||
If REPLACE is nonzero, overwrite an existing value. */
|
||||
extern int setenv (const char *name, const char *value, int replace);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_UNSETENV@
|
||||
# if @HAVE_UNSETENV@
|
||||
# if @VOID_UNSETENV@
|
||||
/* On some systems, unsetenv() returns void.
|
||||
This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */
|
||||
# define unsetenv(name) ((unsetenv)(name), 0)
|
||||
# endif
|
||||
# else
|
||||
/* Remove the variable NAME from the environment. */
|
||||
extern int unsetenv (const char *name);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_STRTOD@
|
||||
# if @REPLACE_STRTOD@
|
||||
# define strtod rpl_strtod
|
||||
# endif
|
||||
# if !@HAVE_STRTOD@ || @REPLACE_STRTOD@
|
||||
/* Parse a double from STRING, updating ENDP if appropriate. */
|
||||
extern double strtod (const char *str, char **endp);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strtod
|
||||
# define strtod(s, e) \
|
||||
(GL_LINK_WARNING ("strtod is unportable - " \
|
||||
"use gnulib module strtod for portability"), \
|
||||
strtod (s, e))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_STRTOLL@
|
||||
# if !@HAVE_STRTOLL@
|
||||
/* Parse a signed integer whose textual representation starts at STRING.
|
||||
The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
|
||||
it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
|
||||
"0x").
|
||||
If ENDPTR is not NULL, the address of the first byte after the integer is
|
||||
stored in *ENDPTR.
|
||||
Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
|
||||
to ERANGE. */
|
||||
extern long long strtoll (const char *string, char **endptr, int base);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strtoll
|
||||
# define strtoll(s,e,b) \
|
||||
(GL_LINK_WARNING ("strtoll is unportable - " \
|
||||
"use gnulib module strtoll for portability"), \
|
||||
strtoll (s, e, b))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_STRTOULL@
|
||||
# if !@HAVE_STRTOULL@
|
||||
/* Parse an unsigned integer whose textual representation starts at STRING.
|
||||
The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
|
||||
it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
|
||||
"0x").
|
||||
If ENDPTR is not NULL, the address of the first byte after the integer is
|
||||
stored in *ENDPTR.
|
||||
Upon overflow, the return value is ULLONG_MAX, and errno is set to
|
||||
ERANGE. */
|
||||
extern unsigned long long strtoull (const char *string, char **endptr, int base);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strtoull
|
||||
# define strtoull(s,e,b) \
|
||||
(GL_LINK_WARNING ("strtoull is unportable - " \
|
||||
"use gnulib module strtoull for portability"), \
|
||||
strtoull (s, e, b))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GL_STDLIB_H */
|
||||
#endif /* _GL_STDLIB_H */
|
||||
#endif
|
||||
@@ -1,429 +0,0 @@
|
||||
/* Byte-wise substring search, using the Two-Way algorithm.
|
||||
Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Eric Blake <ebb9@byu.net>, 2008.
|
||||
|
||||
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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Before including this file, you need to include <config.h> and
|
||||
<string.h>, and define:
|
||||
RESULT_TYPE A macro that expands to the return type.
|
||||
AVAILABLE(h, h_l, j, n_l)
|
||||
A macro that returns nonzero if there are
|
||||
at least N_L bytes left starting at H[J].
|
||||
H is 'unsigned char *', H_L, J, and N_L
|
||||
are 'size_t'; H_L is an lvalue. For
|
||||
NUL-terminated searches, H_L can be
|
||||
modified each iteration to avoid having
|
||||
to compute the end of H up front.
|
||||
|
||||
For case-insensitivity, you may optionally define:
|
||||
CMP_FUNC(p1, p2, l) A macro that returns 0 iff the first L
|
||||
characters of P1 and P2 are equal.
|
||||
CANON_ELEMENT(c) A macro that canonicalizes an element right after
|
||||
it has been fetched from one of the two strings.
|
||||
The argument is an 'unsigned char'; the result
|
||||
must be an 'unsigned char' as well.
|
||||
|
||||
This file undefines the macros documented above, and defines
|
||||
LONG_NEEDLE_THRESHOLD.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* We use the Two-Way string matching algorithm, which guarantees
|
||||
linear complexity with constant space. Additionally, for long
|
||||
needles, we also use a bad character shift table similar to the
|
||||
Boyer-Moore algorithm to achieve improved (potentially sub-linear)
|
||||
performance.
|
||||
|
||||
See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260
|
||||
and http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm
|
||||
*/
|
||||
|
||||
/* Point at which computing a bad-byte shift table is likely to be
|
||||
worthwhile. Small needles should not compute a table, since it
|
||||
adds (1 << CHAR_BIT) + NEEDLE_LEN computations of preparation for a
|
||||
speedup no greater than a factor of NEEDLE_LEN. The larger the
|
||||
needle, the better the potential performance gain. On the other
|
||||
hand, on non-POSIX systems with CHAR_BIT larger than eight, the
|
||||
memory required for the table is prohibitive. */
|
||||
#if CHAR_BIT < 10
|
||||
# define LONG_NEEDLE_THRESHOLD 32U
|
||||
#else
|
||||
# define LONG_NEEDLE_THRESHOLD SIZE_MAX
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a, b) ((a < b) ? (b) : (a))
|
||||
#endif
|
||||
|
||||
#ifndef CANON_ELEMENT
|
||||
# define CANON_ELEMENT(c) c
|
||||
#endif
|
||||
#ifndef CMP_FUNC
|
||||
# define CMP_FUNC memcmp
|
||||
#endif
|
||||
|
||||
/* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN.
|
||||
Return the index of the first byte in the right half, and set
|
||||
*PERIOD to the global period of the right half.
|
||||
|
||||
The global period of a string is the smallest index (possibly its
|
||||
length) at which all remaining bytes in the string are repetitions
|
||||
of the prefix (the last repetition may be a subset of the prefix).
|
||||
|
||||
When NEEDLE is factored into two halves, a local period is the
|
||||
length of the smallest word that shares a suffix with the left half
|
||||
and shares a prefix with the right half. All factorizations of a
|
||||
non-empty NEEDLE have a local period of at least 1 and no greater
|
||||
than NEEDLE_LEN.
|
||||
|
||||
A critical factorization has the property that the local period
|
||||
equals the global period. All strings have at least one critical
|
||||
factorization with the left half smaller than the global period.
|
||||
|
||||
Given an ordered alphabet, a critical factorization can be computed
|
||||
in linear time, with 2 * NEEDLE_LEN comparisons, by computing the
|
||||
larger of two ordered maximal suffixes. The ordered maximal
|
||||
suffixes are determined by lexicographic comparison of
|
||||
periodicity. */
|
||||
static size_t
|
||||
critical_factorization (const unsigned char *needle, size_t needle_len,
|
||||
size_t *period)
|
||||
{
|
||||
/* Index of last byte of left half, or SIZE_MAX. */
|
||||
size_t max_suffix, max_suffix_rev;
|
||||
size_t j; /* Index into NEEDLE for current candidate suffix. */
|
||||
size_t k; /* Offset into current period. */
|
||||
size_t p; /* Intermediate period. */
|
||||
unsigned char a, b; /* Current comparison bytes. */
|
||||
|
||||
/* Invariants:
|
||||
0 <= j < NEEDLE_LEN - 1
|
||||
-1 <= max_suffix{,_rev} < j (treating SIZE_MAX as if it were signed)
|
||||
min(max_suffix, max_suffix_rev) < global period of NEEDLE
|
||||
1 <= p <= global period of NEEDLE
|
||||
p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j]
|
||||
1 <= k <= p
|
||||
*/
|
||||
|
||||
/* Perform lexicographic search. */
|
||||
max_suffix = SIZE_MAX;
|
||||
j = 0;
|
||||
k = p = 1;
|
||||
while (j + k < needle_len)
|
||||
{
|
||||
a = CANON_ELEMENT (needle[j + k]);
|
||||
b = CANON_ELEMENT (needle[max_suffix + k]);
|
||||
if (a < b)
|
||||
{
|
||||
/* Suffix is smaller, period is entire prefix so far. */
|
||||
j += k;
|
||||
k = 1;
|
||||
p = j - max_suffix;
|
||||
}
|
||||
else if (a == b)
|
||||
{
|
||||
/* Advance through repetition of the current period. */
|
||||
if (k != p)
|
||||
++k;
|
||||
else
|
||||
{
|
||||
j += p;
|
||||
k = 1;
|
||||
}
|
||||
}
|
||||
else /* b < a */
|
||||
{
|
||||
/* Suffix is larger, start over from current location. */
|
||||
max_suffix = j++;
|
||||
k = p = 1;
|
||||
}
|
||||
}
|
||||
*period = p;
|
||||
|
||||
/* Perform reverse lexicographic search. */
|
||||
max_suffix_rev = SIZE_MAX;
|
||||
j = 0;
|
||||
k = p = 1;
|
||||
while (j + k < needle_len)
|
||||
{
|
||||
a = CANON_ELEMENT (needle[j + k]);
|
||||
b = CANON_ELEMENT (needle[max_suffix_rev + k]);
|
||||
if (b < a)
|
||||
{
|
||||
/* Suffix is smaller, period is entire prefix so far. */
|
||||
j += k;
|
||||
k = 1;
|
||||
p = j - max_suffix_rev;
|
||||
}
|
||||
else if (a == b)
|
||||
{
|
||||
/* Advance through repetition of the current period. */
|
||||
if (k != p)
|
||||
++k;
|
||||
else
|
||||
{
|
||||
j += p;
|
||||
k = 1;
|
||||
}
|
||||
}
|
||||
else /* a < b */
|
||||
{
|
||||
/* Suffix is larger, start over from current location. */
|
||||
max_suffix_rev = j++;
|
||||
k = p = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Choose the longer suffix. Return the first byte of the right
|
||||
half, rather than the last byte of the left half. */
|
||||
if (max_suffix_rev + 1 < max_suffix + 1)
|
||||
return max_suffix + 1;
|
||||
*period = p;
|
||||
return max_suffix_rev + 1;
|
||||
}
|
||||
|
||||
/* Return the first location of non-empty NEEDLE within HAYSTACK, or
|
||||
NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This
|
||||
method is optimized for NEEDLE_LEN < LONG_NEEDLE_THRESHOLD.
|
||||
Performance is guaranteed to be linear, with an initialization cost
|
||||
of 2 * NEEDLE_LEN comparisons.
|
||||
|
||||
If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
|
||||
most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.
|
||||
If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
|
||||
HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. */
|
||||
static RETURN_TYPE
|
||||
two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
|
||||
const unsigned char *needle, size_t needle_len)
|
||||
{
|
||||
size_t i; /* Index into current byte of NEEDLE. */
|
||||
size_t j; /* Index into current window of HAYSTACK. */
|
||||
size_t period; /* The period of the right half of needle. */
|
||||
size_t suffix; /* The index of the right half of needle. */
|
||||
|
||||
/* Factor the needle into two halves, such that the left half is
|
||||
smaller than the global period, and the right half is
|
||||
periodic (with a period as large as NEEDLE_LEN - suffix). */
|
||||
suffix = critical_factorization (needle, needle_len, &period);
|
||||
|
||||
/* Perform the search. Each iteration compares the right half
|
||||
first. */
|
||||
if (CMP_FUNC (needle, needle + period, suffix) == 0)
|
||||
{
|
||||
/* Entire needle is periodic; a mismatch can only advance by the
|
||||
period, so use memory to avoid rescanning known occurrences
|
||||
of the period. */
|
||||
size_t memory = 0;
|
||||
j = 0;
|
||||
while (AVAILABLE (haystack, haystack_len, j, needle_len))
|
||||
{
|
||||
/* Scan for matches in right half. */
|
||||
i = MAX (suffix, memory);
|
||||
while (i < needle_len && (CANON_ELEMENT (needle[i])
|
||||
== CANON_ELEMENT (haystack[i + j])))
|
||||
++i;
|
||||
if (needle_len <= i)
|
||||
{
|
||||
/* Scan for matches in left half. */
|
||||
i = suffix - 1;
|
||||
while (memory < i + 1 && (CANON_ELEMENT (needle[i])
|
||||
== CANON_ELEMENT (haystack[i + j])))
|
||||
--i;
|
||||
if (i + 1 < memory + 1)
|
||||
return (RETURN_TYPE) (haystack + j);
|
||||
/* No match, so remember how many repetitions of period
|
||||
on the right half were scanned. */
|
||||
j += period;
|
||||
memory = needle_len - period;
|
||||
}
|
||||
else
|
||||
{
|
||||
j += i - suffix + 1;
|
||||
memory = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The two halves of needle are distinct; no extra memory is
|
||||
required, and any mismatch results in a maximal shift. */
|
||||
period = MAX (suffix, needle_len - suffix) + 1;
|
||||
j = 0;
|
||||
while (AVAILABLE (haystack, haystack_len, j, needle_len))
|
||||
{
|
||||
/* Scan for matches in right half. */
|
||||
i = suffix;
|
||||
while (i < needle_len && (CANON_ELEMENT (needle[i])
|
||||
== CANON_ELEMENT (haystack[i + j])))
|
||||
++i;
|
||||
if (needle_len <= i)
|
||||
{
|
||||
/* Scan for matches in left half. */
|
||||
i = suffix - 1;
|
||||
while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
|
||||
== CANON_ELEMENT (haystack[i + j])))
|
||||
--i;
|
||||
if (i == SIZE_MAX)
|
||||
return (RETURN_TYPE) (haystack + j);
|
||||
j += period;
|
||||
}
|
||||
else
|
||||
j += i - suffix + 1;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return the first location of non-empty NEEDLE within HAYSTACK, or
|
||||
NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This
|
||||
method is optimized for LONG_NEEDLE_THRESHOLD <= NEEDLE_LEN.
|
||||
Performance is guaranteed to be linear, with an initialization cost
|
||||
of 3 * NEEDLE_LEN + (1 << CHAR_BIT) operations.
|
||||
|
||||
If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
|
||||
most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching,
|
||||
and sublinear performance O(HAYSTACK_LEN / NEEDLE_LEN) is possible.
|
||||
If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
|
||||
HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and
|
||||
sublinear performance is not possible. */
|
||||
static RETURN_TYPE
|
||||
two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
|
||||
const unsigned char *needle, size_t needle_len)
|
||||
{
|
||||
size_t i; /* Index into current byte of NEEDLE. */
|
||||
size_t j; /* Index into current window of HAYSTACK. */
|
||||
size_t period; /* The period of the right half of needle. */
|
||||
size_t suffix; /* The index of the right half of needle. */
|
||||
size_t shift_table[1U << CHAR_BIT]; /* See below. */
|
||||
|
||||
/* Factor the needle into two halves, such that the left half is
|
||||
smaller than the global period, and the right half is
|
||||
periodic (with a period as large as NEEDLE_LEN - suffix). */
|
||||
suffix = critical_factorization (needle, needle_len, &period);
|
||||
|
||||
/* Populate shift_table. For each possible byte value c,
|
||||
shift_table[c] is the distance from the last occurrence of c to
|
||||
the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE.
|
||||
shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */
|
||||
for (i = 0; i < 1U << CHAR_BIT; i++)
|
||||
shift_table[i] = needle_len;
|
||||
for (i = 0; i < needle_len; i++)
|
||||
shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1;
|
||||
|
||||
/* Perform the search. Each iteration compares the right half
|
||||
first. */
|
||||
if (CMP_FUNC (needle, needle + period, suffix) == 0)
|
||||
{
|
||||
/* Entire needle is periodic; a mismatch can only advance by the
|
||||
period, so use memory to avoid rescanning known occurrences
|
||||
of the period. */
|
||||
size_t memory = 0;
|
||||
size_t shift;
|
||||
j = 0;
|
||||
while (AVAILABLE (haystack, haystack_len, j, needle_len))
|
||||
{
|
||||
/* Check the last byte first; if it does not match, then
|
||||
shift to the next possible match location. */
|
||||
shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
|
||||
if (0 < shift)
|
||||
{
|
||||
if (memory && shift < period)
|
||||
{
|
||||
/* Since needle is periodic, but the last period has
|
||||
a byte out of place, there can be no match until
|
||||
after the mismatch. */
|
||||
shift = needle_len - period;
|
||||
memory = 0;
|
||||
}
|
||||
j += shift;
|
||||
continue;
|
||||
}
|
||||
/* Scan for matches in right half. The last byte has
|
||||
already been matched, by virtue of the shift table. */
|
||||
i = MAX (suffix, memory);
|
||||
while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
|
||||
== CANON_ELEMENT (haystack[i + j])))
|
||||
++i;
|
||||
if (needle_len - 1 <= i)
|
||||
{
|
||||
/* Scan for matches in left half. */
|
||||
i = suffix - 1;
|
||||
while (memory < i + 1 && (CANON_ELEMENT (needle[i])
|
||||
== CANON_ELEMENT (haystack[i + j])))
|
||||
--i;
|
||||
if (i + 1 < memory + 1)
|
||||
return (RETURN_TYPE) (haystack + j);
|
||||
/* No match, so remember how many repetitions of period
|
||||
on the right half were scanned. */
|
||||
j += period;
|
||||
memory = needle_len - period;
|
||||
}
|
||||
else
|
||||
{
|
||||
j += i - suffix + 1;
|
||||
memory = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The two halves of needle are distinct; no extra memory is
|
||||
required, and any mismatch results in a maximal shift. */
|
||||
size_t shift;
|
||||
period = MAX (suffix, needle_len - suffix) + 1;
|
||||
j = 0;
|
||||
while (AVAILABLE (haystack, haystack_len, j, needle_len))
|
||||
{
|
||||
/* Check the last byte first; if it does not match, then
|
||||
shift to the next possible match location. */
|
||||
shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
|
||||
if (0 < shift)
|
||||
{
|
||||
j += shift;
|
||||
continue;
|
||||
}
|
||||
/* Scan for matches in right half. The last byte has
|
||||
already been matched, by virtue of the shift table. */
|
||||
i = suffix;
|
||||
while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
|
||||
== CANON_ELEMENT (haystack[i + j])))
|
||||
++i;
|
||||
if (needle_len - 1 <= i)
|
||||
{
|
||||
/* Scan for matches in left half. */
|
||||
i = suffix - 1;
|
||||
while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
|
||||
== CANON_ELEMENT (haystack[i + j])))
|
||||
--i;
|
||||
if (i == SIZE_MAX)
|
||||
return (RETURN_TYPE) (haystack + j);
|
||||
j += period;
|
||||
}
|
||||
else
|
||||
j += i - suffix + 1;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#undef AVAILABLE
|
||||
#undef CANON_ELEMENT
|
||||
#undef CMP_FUNC
|
||||
#undef MAX
|
||||
#undef RETURN_TYPE
|
||||
@@ -1,64 +0,0 @@
|
||||
/* Case-insensitive string comparison function.
|
||||
Copyright (C) 1998, 1999, 2005, 2006, 2007, 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <string.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
|
||||
|
||||
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
|
||||
greater than zero if S1 is lexicographically less than, equal to or greater
|
||||
than S2.
|
||||
Note: This function does not work with multibyte strings! */
|
||||
|
||||
int
|
||||
strcasecmp (const char *s1, const char *s2)
|
||||
{
|
||||
const unsigned char *p1 = (const unsigned char *) s1;
|
||||
const unsigned char *p2 = (const unsigned char *) s2;
|
||||
unsigned char c1, c2;
|
||||
|
||||
if (p1 == p2)
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
c1 = TOLOWER (*p1);
|
||||
c2 = TOLOWER (*p2);
|
||||
|
||||
if (c1 == '\0')
|
||||
break;
|
||||
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
|
||||
if (UCHAR_MAX <= INT_MAX)
|
||||
return c1 - c2;
|
||||
else
|
||||
/* On machines where 'char' and 'int' are types of the same size, the
|
||||
difference of two 'unsigned char' values - including the sign bit -
|
||||
doesn't fit in an 'int'. */
|
||||
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/* Case-insensitive searching in a string.
|
||||
Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2005.
|
||||
|
||||
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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <string.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdbool.h>
|
||||
#include <strings.h>
|
||||
|
||||
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
|
||||
|
||||
/* Two-Way algorithm. */
|
||||
#define RETURN_TYPE char *
|
||||
#define AVAILABLE(h, h_l, j, n_l) \
|
||||
(!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \
|
||||
&& ((h_l) = (j) + (n_l)))
|
||||
#define CANON_ELEMENT(c) TOLOWER (c)
|
||||
#define CMP_FUNC(p1, p2, l) \
|
||||
strncasecmp ((const char *) (p1), (const char *) (p2), l)
|
||||
#include "str-two-way.h"
|
||||
|
||||
/* Find the first occurrence of NEEDLE in HAYSTACK, using
|
||||
case-insensitive comparison. This function gives unspecified
|
||||
results in multibyte locales. */
|
||||
char *
|
||||
strcasestr (const char *haystack_start, const char *needle_start)
|
||||
{
|
||||
const char *haystack = haystack_start;
|
||||
const char *needle = needle_start;
|
||||
size_t needle_len; /* Length of NEEDLE. */
|
||||
size_t haystack_len; /* Known minimum length of HAYSTACK. */
|
||||
bool ok = true; /* True if NEEDLE is prefix of HAYSTACK. */
|
||||
|
||||
/* Determine length of NEEDLE, and in the process, make sure
|
||||
HAYSTACK is at least as long (no point processing all of a long
|
||||
NEEDLE if HAYSTACK is too short). */
|
||||
while (*haystack && *needle)
|
||||
{
|
||||
ok &= (TOLOWER ((unsigned char) *haystack)
|
||||
== TOLOWER ((unsigned char) *needle));
|
||||
haystack++;
|
||||
needle++;
|
||||
}
|
||||
if (*needle)
|
||||
return NULL;
|
||||
if (ok)
|
||||
return (char *) haystack_start;
|
||||
needle_len = needle - needle_start;
|
||||
haystack = haystack_start + 1;
|
||||
haystack_len = needle_len - 1;
|
||||
|
||||
/* Perform the search. Abstract memory is considered to be an array
|
||||
of 'unsigned char' values, not an array of 'char' values. See
|
||||
ISO C 99 section 6.2.6.1. */
|
||||
if (needle_len < LONG_NEEDLE_THRESHOLD)
|
||||
return two_way_short_needle ((const unsigned char *) haystack,
|
||||
haystack_len,
|
||||
(const unsigned char *) needle_start,
|
||||
needle_len);
|
||||
return two_way_long_needle ((const unsigned char *) haystack, haystack_len,
|
||||
(const unsigned char *) needle_start,
|
||||
needle_len);
|
||||
}
|
||||
|
||||
#undef LONG_NEEDLE_THRESHOLD
|
||||
176
lib/streq.h
176
lib/streq.h
@@ -1,176 +0,0 @@
|
||||
/* Optimized string comparison.
|
||||
Copyright (C) 2001, 2002, 2007, 2009 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 3 of the License, 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>. */
|
||||
|
||||
#ifndef _GL_STREQ_H
|
||||
#define _GL_STREQ_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* STREQ allows to optimize string comparison with a small literal string.
|
||||
STREQ (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
|
||||
is semantically equivalent to
|
||||
strcmp (s, "EUC-KR") == 0
|
||||
just faster. */
|
||||
|
||||
/* Help GCC to generate good code for string comparisons with
|
||||
immediate strings. */
|
||||
#if defined (__GNUC__) && defined (__OPTIMIZE__)
|
||||
|
||||
static inline int
|
||||
streq9 (const char *s1, const char *s2)
|
||||
{
|
||||
return strcmp (s1 + 9, s2 + 9) == 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
streq8 (const char *s1, const char *s2, char s28)
|
||||
{
|
||||
if (s1[8] == s28)
|
||||
{
|
||||
if (s28 == 0)
|
||||
return 1;
|
||||
else
|
||||
return streq9 (s1, s2);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
streq7 (const char *s1, const char *s2, char s27, char s28)
|
||||
{
|
||||
if (s1[7] == s27)
|
||||
{
|
||||
if (s27 == 0)
|
||||
return 1;
|
||||
else
|
||||
return streq8 (s1, s2, s28);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
streq6 (const char *s1, const char *s2, char s26, char s27, char s28)
|
||||
{
|
||||
if (s1[6] == s26)
|
||||
{
|
||||
if (s26 == 0)
|
||||
return 1;
|
||||
else
|
||||
return streq7 (s1, s2, s27, s28);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28)
|
||||
{
|
||||
if (s1[5] == s25)
|
||||
{
|
||||
if (s25 == 0)
|
||||
return 1;
|
||||
else
|
||||
return streq6 (s1, s2, s26, s27, s28);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28)
|
||||
{
|
||||
if (s1[4] == s24)
|
||||
{
|
||||
if (s24 == 0)
|
||||
return 1;
|
||||
else
|
||||
return streq5 (s1, s2, s25, s26, s27, s28);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28)
|
||||
{
|
||||
if (s1[3] == s23)
|
||||
{
|
||||
if (s23 == 0)
|
||||
return 1;
|
||||
else
|
||||
return streq4 (s1, s2, s24, s25, s26, s27, s28);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
|
||||
{
|
||||
if (s1[2] == s22)
|
||||
{
|
||||
if (s22 == 0)
|
||||
return 1;
|
||||
else
|
||||
return streq3 (s1, s2, s23, s24, s25, s26, s27, s28);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
|
||||
{
|
||||
if (s1[1] == s21)
|
||||
{
|
||||
if (s21 == 0)
|
||||
return 1;
|
||||
else
|
||||
return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
|
||||
{
|
||||
if (s1[0] == s20)
|
||||
{
|
||||
if (s20 == 0)
|
||||
return 1;
|
||||
else
|
||||
return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
|
||||
streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
|
||||
|
||||
#else
|
||||
|
||||
#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
|
||||
(strcmp (s1, s2) == 0)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _GL_STREQ_H */
|
||||
347
lib/strerror.c
347
lib/strerror.c
@@ -1,347 +0,0 @@
|
||||
/* strerror.c --- POSIX compatible system error routine
|
||||
|
||||
Copyright (C) 2007-2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if REPLACE_STRERROR
|
||||
|
||||
# include <errno.h>
|
||||
# include <stdio.h>
|
||||
|
||||
# if GNULIB_defined_ESOCK /* native Windows platforms */
|
||||
# if HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# include "intprops.h"
|
||||
|
||||
# undef strerror
|
||||
# if ! HAVE_DECL_STRERROR
|
||||
# define strerror(n) NULL
|
||||
# endif
|
||||
|
||||
char *
|
||||
rpl_strerror (int n)
|
||||
{
|
||||
char const *msg = NULL;
|
||||
/* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */
|
||||
switch (n)
|
||||
{
|
||||
# if GNULIB_defined_ETXTBSY
|
||||
case ETXTBSY:
|
||||
msg = "Text file busy";
|
||||
break;
|
||||
# endif
|
||||
|
||||
# if GNULIB_defined_ESOCK /* native Windows platforms */
|
||||
/* EWOULDBLOCK is the same as EAGAIN. */
|
||||
case EINPROGRESS:
|
||||
msg = "Operation now in progress";
|
||||
break;
|
||||
case EALREADY:
|
||||
msg = "Operation already in progress";
|
||||
break;
|
||||
case ENOTSOCK:
|
||||
msg = "Socket operation on non-socket";
|
||||
break;
|
||||
case EDESTADDRREQ:
|
||||
msg = "Destination address required";
|
||||
break;
|
||||
case EMSGSIZE:
|
||||
msg = "Message too long";
|
||||
break;
|
||||
case EPROTOTYPE:
|
||||
msg = "Protocol wrong type for socket";
|
||||
break;
|
||||
case ENOPROTOOPT:
|
||||
msg = "Protocol not available";
|
||||
break;
|
||||
case EPROTONOSUPPORT:
|
||||
msg = "Protocol not supported";
|
||||
break;
|
||||
case ESOCKTNOSUPPORT:
|
||||
msg = "Socket type not supported";
|
||||
break;
|
||||
case EOPNOTSUPP:
|
||||
msg = "Operation not supported";
|
||||
break;
|
||||
case EPFNOSUPPORT:
|
||||
msg = "Protocol family not supported";
|
||||
break;
|
||||
case EAFNOSUPPORT:
|
||||
msg = "Address family not supported by protocol";
|
||||
break;
|
||||
case EADDRINUSE:
|
||||
msg = "Address already in use";
|
||||
break;
|
||||
case EADDRNOTAVAIL:
|
||||
msg = "Cannot assign requested address";
|
||||
break;
|
||||
case ENETDOWN:
|
||||
msg = "Network is down";
|
||||
break;
|
||||
case ENETUNREACH:
|
||||
msg = "Network is unreachable";
|
||||
break;
|
||||
case ENETRESET:
|
||||
msg = "Network dropped connection on reset";
|
||||
break;
|
||||
case ECONNABORTED:
|
||||
msg = "Software caused connection abort";
|
||||
break;
|
||||
case ECONNRESET:
|
||||
msg = "Connection reset by peer";
|
||||
break;
|
||||
case ENOBUFS:
|
||||
msg = "No buffer space available";
|
||||
break;
|
||||
case EISCONN:
|
||||
msg = "Transport endpoint is already connected";
|
||||
break;
|
||||
case ENOTCONN:
|
||||
msg = "Transport endpoint is not connected";
|
||||
break;
|
||||
case ESHUTDOWN:
|
||||
msg = "Cannot send after transport endpoint shutdown";
|
||||
break;
|
||||
case ETOOMANYREFS:
|
||||
msg = "Too many references: cannot splice";
|
||||
break;
|
||||
case ETIMEDOUT:
|
||||
msg = "Connection timed out";
|
||||
break;
|
||||
case ECONNREFUSED:
|
||||
msg = "Connection refused";
|
||||
break;
|
||||
case ELOOP:
|
||||
msg = "Too many levels of symbolic links";
|
||||
break;
|
||||
case EHOSTDOWN:
|
||||
msg = "Host is down";
|
||||
break;
|
||||
case EHOSTUNREACH:
|
||||
msg = "No route to host";
|
||||
break;
|
||||
case EPROCLIM:
|
||||
msg = "Too many processes";
|
||||
break;
|
||||
case EUSERS:
|
||||
msg = "Too many users";
|
||||
break;
|
||||
case EDQUOT:
|
||||
msg = "Disk quota exceeded";
|
||||
break;
|
||||
case ESTALE:
|
||||
msg = "Stale NFS file handle";
|
||||
break;
|
||||
case EREMOTE:
|
||||
msg = "Object is remote";
|
||||
break;
|
||||
# if HAVE_WINSOCK2_H
|
||||
/* WSA_INVALID_HANDLE maps to EBADF */
|
||||
/* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
|
||||
/* WSA_INVALID_PARAMETER maps to EINVAL */
|
||||
case WSA_OPERATION_ABORTED:
|
||||
msg = "Overlapped operation aborted";
|
||||
break;
|
||||
case WSA_IO_INCOMPLETE:
|
||||
msg = "Overlapped I/O event object not in signaled state";
|
||||
break;
|
||||
case WSA_IO_PENDING:
|
||||
msg = "Overlapped operations will complete later";
|
||||
break;
|
||||
/* WSAEINTR maps to EINTR */
|
||||
/* WSAEBADF maps to EBADF */
|
||||
/* WSAEACCES maps to EACCES */
|
||||
/* WSAEFAULT maps to EFAULT */
|
||||
/* WSAEINVAL maps to EINVAL */
|
||||
/* WSAEMFILE maps to EMFILE */
|
||||
/* WSAEWOULDBLOCK maps to EWOULDBLOCK */
|
||||
/* WSAEINPROGRESS is EINPROGRESS */
|
||||
/* WSAEALREADY is EALREADY */
|
||||
/* WSAENOTSOCK is ENOTSOCK */
|
||||
/* WSAEDESTADDRREQ is EDESTADDRREQ */
|
||||
/* WSAEMSGSIZE is EMSGSIZE */
|
||||
/* WSAEPROTOTYPE is EPROTOTYPE */
|
||||
/* WSAENOPROTOOPT is ENOPROTOOPT */
|
||||
/* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */
|
||||
/* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
|
||||
/* WSAEOPNOTSUPP is EOPNOTSUPP */
|
||||
/* WSAEPFNOSUPPORT is EPFNOSUPPORT */
|
||||
/* WSAEAFNOSUPPORT is EAFNOSUPPORT */
|
||||
/* WSAEADDRINUSE is EADDRINUSE */
|
||||
/* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */
|
||||
/* WSAENETDOWN is ENETDOWN */
|
||||
/* WSAENETUNREACH is ENETUNREACH */
|
||||
/* WSAENETRESET is ENETRESET */
|
||||
/* WSAECONNABORTED is ECONNABORTED */
|
||||
/* WSAECONNRESET is ECONNRESET */
|
||||
/* WSAENOBUFS is ENOBUFS */
|
||||
/* WSAEISCONN is EISCONN */
|
||||
/* WSAENOTCONN is ENOTCONN */
|
||||
/* WSAESHUTDOWN is ESHUTDOWN */
|
||||
/* WSAETOOMANYREFS is ETOOMANYREFS */
|
||||
/* WSAETIMEDOUT is ETIMEDOUT */
|
||||
/* WSAECONNREFUSED is ECONNREFUSED */
|
||||
/* WSAELOOP is ELOOP */
|
||||
/* WSAENAMETOOLONG maps to ENAMETOOLONG */
|
||||
/* WSAEHOSTDOWN is EHOSTDOWN */
|
||||
/* WSAEHOSTUNREACH is EHOSTUNREACH */
|
||||
/* WSAENOTEMPTY maps to ENOTEMPTY */
|
||||
/* WSAEPROCLIM is EPROCLIM */
|
||||
/* WSAEUSERS is EUSERS */
|
||||
/* WSAEDQUOT is EDQUOT */
|
||||
/* WSAESTALE is ESTALE */
|
||||
/* WSAEREMOTE is EREMOTE */
|
||||
case WSASYSNOTREADY:
|
||||
msg = "Network subsystem is unavailable";
|
||||
break;
|
||||
case WSAVERNOTSUPPORTED:
|
||||
msg = "Winsock.dll version out of range";
|
||||
break;
|
||||
case WSANOTINITIALISED:
|
||||
msg = "Successful WSAStartup not yet performed";
|
||||
break;
|
||||
case WSAEDISCON:
|
||||
msg = "Graceful shutdown in progress";
|
||||
break;
|
||||
case WSAENOMORE: case WSA_E_NO_MORE:
|
||||
msg = "No more results";
|
||||
break;
|
||||
case WSAECANCELLED: case WSA_E_CANCELLED:
|
||||
msg = "Call was canceled";
|
||||
break;
|
||||
case WSAEINVALIDPROCTABLE:
|
||||
msg = "Procedure call table is invalid";
|
||||
break;
|
||||
case WSAEINVALIDPROVIDER:
|
||||
msg = "Service provider is invalid";
|
||||
break;
|
||||
case WSAEPROVIDERFAILEDINIT:
|
||||
msg = "Service provider failed to initialize";
|
||||
break;
|
||||
case WSASYSCALLFAILURE:
|
||||
msg = "System call failure";
|
||||
break;
|
||||
case WSASERVICE_NOT_FOUND:
|
||||
msg = "Service not found";
|
||||
break;
|
||||
case WSATYPE_NOT_FOUND:
|
||||
msg = "Class type not found";
|
||||
break;
|
||||
case WSAEREFUSED:
|
||||
msg = "Database query was refused";
|
||||
break;
|
||||
case WSAHOST_NOT_FOUND:
|
||||
msg = "Host not found";
|
||||
break;
|
||||
case WSATRY_AGAIN:
|
||||
msg = "Nonauthoritative host not found";
|
||||
break;
|
||||
case WSANO_RECOVERY:
|
||||
msg = "Nonrecoverable error";
|
||||
break;
|
||||
case WSANO_DATA:
|
||||
msg = "Valid name, no data record of requested type";
|
||||
break;
|
||||
/* WSA_QOS_* omitted */
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if GNULIB_defined_ENOMSG
|
||||
case ENOMSG:
|
||||
msg = "No message of desired type";
|
||||
break;
|
||||
# endif
|
||||
|
||||
# if GNULIB_defined_EIDRM
|
||||
case EIDRM:
|
||||
msg = "Identifier removed";
|
||||
break;
|
||||
# endif
|
||||
|
||||
# if GNULIB_defined_ENOLINK
|
||||
case ENOLINK:
|
||||
msg = "Link has been severed";
|
||||
break;
|
||||
# endif
|
||||
|
||||
# if GNULIB_defined_EPROTO
|
||||
case EPROTO:
|
||||
msg = "Protocol error";
|
||||
break;
|
||||
# endif
|
||||
|
||||
# if GNULIB_defined_EMULTIHOP
|
||||
case EMULTIHOP:
|
||||
msg = "Multihop attempted";
|
||||
break;
|
||||
# endif
|
||||
|
||||
# if GNULIB_defined_EBADMSG
|
||||
case EBADMSG:
|
||||
msg = "Bad message";
|
||||
break;
|
||||
# endif
|
||||
|
||||
# if GNULIB_defined_EOVERFLOW
|
||||
case EOVERFLOW:
|
||||
msg = "Value too large for defined data type";
|
||||
break;
|
||||
# endif
|
||||
|
||||
# if GNULIB_defined_ENOTSUP
|
||||
case ENOTSUP:
|
||||
msg = "Not supported";
|
||||
break;
|
||||
# endif
|
||||
|
||||
# if GNULIB_defined_ESTALE
|
||||
case ESTALE:
|
||||
msg = "Stale NFS file handle";
|
||||
break;
|
||||
# endif
|
||||
|
||||
# if GNULIB_defined_ECANCELED
|
||||
case ECANCELED:
|
||||
msg = "Operation canceled";
|
||||
break;
|
||||
# endif
|
||||
}
|
||||
|
||||
if (msg)
|
||||
return (char *) msg;
|
||||
|
||||
{
|
||||
char *result = strerror (n);
|
||||
|
||||
if (result == NULL || result[0] == '\0')
|
||||
{
|
||||
static char const fmt[] = "Unknown error (%d)";
|
||||
static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
|
||||
sprintf (msg_buf, fmt, n);
|
||||
return msg_buf;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
622
lib/string.in.h
622
lib/string.in.h
@@ -1,622 +0,0 @@
|
||||
/* A GNU-like <string.h>.
|
||||
|
||||
Copyright (C) 1995-1996, 2001-2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _GL_STRING_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_STRING_H@
|
||||
|
||||
#ifndef _GL_STRING_H
|
||||
#define _GL_STRING_H
|
||||
|
||||
/* NetBSD 5.0 mis-defines NULL. */
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
|
||||
# define __pure__ /* empty */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* The definition of GL_LINK_WARNING is copied here. */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Return the first instance of C within N bytes of S, or NULL. */
|
||||
#if @GNULIB_MEMCHR@
|
||||
# if @REPLACE_MEMCHR@
|
||||
# define memchr rpl_memchr
|
||||
extern void *memchr (void const *__s, int __c, size_t __n)
|
||||
__attribute__ ((__pure__));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef memchr
|
||||
# define memchr(s,c,n) \
|
||||
(GL_LINK_WARNING ("memchr has platform-specific bugs - " \
|
||||
"use gnulib module memchr for portability" ), \
|
||||
memchr (s, c, n))
|
||||
#endif
|
||||
|
||||
/* Return the first occurrence of NEEDLE in HAYSTACK. */
|
||||
#if @GNULIB_MEMMEM@
|
||||
# if @REPLACE_MEMMEM@
|
||||
# define memmem rpl_memmem
|
||||
# endif
|
||||
# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
|
||||
extern void *memmem (void const *__haystack, size_t __haystack_len,
|
||||
void const *__needle, size_t __needle_len)
|
||||
__attribute__ ((__pure__));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef memmem
|
||||
# define memmem(a,al,b,bl) \
|
||||
(GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
|
||||
"use gnulib module memmem-simple for portability, " \
|
||||
"and module memmem for speed" ), \
|
||||
memmem (a, al, b, bl))
|
||||
#endif
|
||||
|
||||
/* Copy N bytes of SRC to DEST, return pointer to bytes after the
|
||||
last written byte. */
|
||||
#if @GNULIB_MEMPCPY@
|
||||
# if ! @HAVE_MEMPCPY@
|
||||
extern void *mempcpy (void *restrict __dest, void const *restrict __src,
|
||||
size_t __n);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mempcpy
|
||||
# define mempcpy(a,b,n) \
|
||||
(GL_LINK_WARNING ("mempcpy is unportable - " \
|
||||
"use gnulib module mempcpy for portability"), \
|
||||
mempcpy (a, b, n))
|
||||
#endif
|
||||
|
||||
/* Search backwards through a block for a byte (specified as an int). */
|
||||
#if @GNULIB_MEMRCHR@
|
||||
# if ! @HAVE_DECL_MEMRCHR@
|
||||
extern void *memrchr (void const *, int, size_t)
|
||||
__attribute__ ((__pure__));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef memrchr
|
||||
# define memrchr(a,b,c) \
|
||||
(GL_LINK_WARNING ("memrchr is unportable - " \
|
||||
"use gnulib module memrchr for portability"), \
|
||||
memrchr (a, b, c))
|
||||
#endif
|
||||
|
||||
/* Find the first occurrence of C in S. More efficient than
|
||||
memchr(S,C,N), at the expense of undefined behavior if C does not
|
||||
occur within N bytes. */
|
||||
#if @GNULIB_RAWMEMCHR@
|
||||
# if ! @HAVE_RAWMEMCHR@
|
||||
extern void *rawmemchr (void const *__s, int __c_in)
|
||||
__attribute__ ((__pure__));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef rawmemchr
|
||||
# define rawmemchr(a,b) \
|
||||
(GL_LINK_WARNING ("rawmemchr is unportable - " \
|
||||
"use gnulib module rawmemchr for portability"), \
|
||||
rawmemchr (a, b))
|
||||
#endif
|
||||
|
||||
/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
|
||||
#if @GNULIB_STPCPY@
|
||||
# if ! @HAVE_STPCPY@
|
||||
extern char *stpcpy (char *restrict __dst, char const *restrict __src);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef stpcpy
|
||||
# define stpcpy(a,b) \
|
||||
(GL_LINK_WARNING ("stpcpy is unportable - " \
|
||||
"use gnulib module stpcpy for portability"), \
|
||||
stpcpy (a, b))
|
||||
#endif
|
||||
|
||||
/* Copy no more than N bytes of SRC to DST, returning a pointer past the
|
||||
last non-NUL byte written into DST. */
|
||||
#if @GNULIB_STPNCPY@
|
||||
# if ! @HAVE_STPNCPY@
|
||||
# define stpncpy gnu_stpncpy
|
||||
extern char *stpncpy (char *restrict __dst, char const *restrict __src,
|
||||
size_t __n);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef stpncpy
|
||||
# define stpncpy(a,b,n) \
|
||||
(GL_LINK_WARNING ("stpncpy is unportable - " \
|
||||
"use gnulib module stpncpy for portability"), \
|
||||
stpncpy (a, b, n))
|
||||
#endif
|
||||
|
||||
#if defined GNULIB_POSIXCHECK
|
||||
/* strchr() does not work with multibyte strings if the locale encoding is
|
||||
GB18030 and the character to be searched is a digit. */
|
||||
# undef strchr
|
||||
# define strchr(s,c) \
|
||||
(GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
|
||||
"in some multibyte locales - " \
|
||||
"use mbschr if you care about internationalization"), \
|
||||
strchr (s, c))
|
||||
#endif
|
||||
|
||||
/* Find the first occurrence of C in S or the final NUL byte. */
|
||||
#if @GNULIB_STRCHRNUL@
|
||||
# if ! @HAVE_STRCHRNUL@
|
||||
extern char *strchrnul (char const *__s, int __c_in)
|
||||
__attribute__ ((__pure__));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strchrnul
|
||||
# define strchrnul(a,b) \
|
||||
(GL_LINK_WARNING ("strchrnul is unportable - " \
|
||||
"use gnulib module strchrnul for portability"), \
|
||||
strchrnul (a, b))
|
||||
#endif
|
||||
|
||||
/* Duplicate S, returning an identical malloc'd string. */
|
||||
#if @GNULIB_STRDUP@
|
||||
# if @REPLACE_STRDUP@
|
||||
# undef strdup
|
||||
# define strdup rpl_strdup
|
||||
# endif
|
||||
# if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@
|
||||
extern char *strdup (char const *__s);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strdup
|
||||
# define strdup(a) \
|
||||
(GL_LINK_WARNING ("strdup is unportable - " \
|
||||
"use gnulib module strdup for portability"), \
|
||||
strdup (a))
|
||||
#endif
|
||||
|
||||
/* Return a newly allocated copy of at most N bytes of STRING. */
|
||||
#if @GNULIB_STRNDUP@
|
||||
# if ! @HAVE_STRNDUP@
|
||||
# undef strndup
|
||||
# define strndup rpl_strndup
|
||||
# endif
|
||||
# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
|
||||
extern char *strndup (char const *__string, size_t __n);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strndup
|
||||
# define strndup(a,n) \
|
||||
(GL_LINK_WARNING ("strndup is unportable - " \
|
||||
"use gnulib module strndup for portability"), \
|
||||
strndup (a, n))
|
||||
#endif
|
||||
|
||||
/* Find the length (number of bytes) of STRING, but scan at most
|
||||
MAXLEN bytes. If no '\0' terminator is found in that many bytes,
|
||||
return MAXLEN. */
|
||||
#if @GNULIB_STRNLEN@
|
||||
# if ! @HAVE_DECL_STRNLEN@
|
||||
extern size_t strnlen (char const *__string, size_t __maxlen)
|
||||
__attribute__ ((__pure__));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strnlen
|
||||
# define strnlen(a,n) \
|
||||
(GL_LINK_WARNING ("strnlen is unportable - " \
|
||||
"use gnulib module strnlen for portability"), \
|
||||
strnlen (a, n))
|
||||
#endif
|
||||
|
||||
#if defined GNULIB_POSIXCHECK
|
||||
/* strcspn() assumes the second argument is a list of single-byte characters.
|
||||
Even in this simple case, it does not work with multibyte strings if the
|
||||
locale encoding is GB18030 and one of the characters to be searched is a
|
||||
digit. */
|
||||
# undef strcspn
|
||||
# define strcspn(s,a) \
|
||||
(GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
|
||||
"in multibyte locales - " \
|
||||
"use mbscspn if you care about internationalization"), \
|
||||
strcspn (s, a))
|
||||
#endif
|
||||
|
||||
/* Find the first occurrence in S of any character in ACCEPT. */
|
||||
#if @GNULIB_STRPBRK@
|
||||
# if ! @HAVE_STRPBRK@
|
||||
extern char *strpbrk (char const *__s, char const *__accept)
|
||||
__attribute__ ((__pure__));
|
||||
# endif
|
||||
# if defined GNULIB_POSIXCHECK
|
||||
/* strpbrk() assumes the second argument is a list of single-byte characters.
|
||||
Even in this simple case, it does not work with multibyte strings if the
|
||||
locale encoding is GB18030 and one of the characters to be searched is a
|
||||
digit. */
|
||||
# undef strpbrk
|
||||
# define strpbrk(s,a) \
|
||||
(GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
|
||||
"in multibyte locales - " \
|
||||
"use mbspbrk if you care about internationalization"), \
|
||||
strpbrk (s, a))
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strpbrk
|
||||
# define strpbrk(s,a) \
|
||||
(GL_LINK_WARNING ("strpbrk is unportable - " \
|
||||
"use gnulib module strpbrk for portability"), \
|
||||
strpbrk (s, a))
|
||||
#endif
|
||||
|
||||
#if defined GNULIB_POSIXCHECK
|
||||
/* strspn() assumes the second argument is a list of single-byte characters.
|
||||
Even in this simple case, it cannot work with multibyte strings. */
|
||||
# undef strspn
|
||||
# define strspn(s,a) \
|
||||
(GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
|
||||
"in multibyte locales - " \
|
||||
"use mbsspn if you care about internationalization"), \
|
||||
strspn (s, a))
|
||||
#endif
|
||||
|
||||
#if defined GNULIB_POSIXCHECK
|
||||
/* strrchr() does not work with multibyte strings if the locale encoding is
|
||||
GB18030 and the character to be searched is a digit. */
|
||||
# undef strrchr
|
||||
# define strrchr(s,c) \
|
||||
(GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
|
||||
"in some multibyte locales - " \
|
||||
"use mbsrchr if you care about internationalization"), \
|
||||
strrchr (s, c))
|
||||
#endif
|
||||
|
||||
/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
|
||||
If one is found, overwrite it with a NUL, and advance *STRINGP
|
||||
to point to the next char after it. Otherwise, set *STRINGP to NULL.
|
||||
If *STRINGP was already NULL, nothing happens.
|
||||
Return the old value of *STRINGP.
|
||||
|
||||
This is a variant of strtok() that is multithread-safe and supports
|
||||
empty fields.
|
||||
|
||||
Caveat: It modifies the original string.
|
||||
Caveat: These functions cannot be used on constant strings.
|
||||
Caveat: The identity of the delimiting character is lost.
|
||||
Caveat: It doesn't work with multibyte strings unless all of the delimiter
|
||||
characters are ASCII characters < 0x30.
|
||||
|
||||
See also strtok_r(). */
|
||||
#if @GNULIB_STRSEP@
|
||||
# if ! @HAVE_STRSEP@
|
||||
extern char *strsep (char **restrict __stringp, char const *restrict __delim);
|
||||
# endif
|
||||
# if defined GNULIB_POSIXCHECK
|
||||
# undef strsep
|
||||
# define strsep(s,d) \
|
||||
(GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
|
||||
"in multibyte locales - " \
|
||||
"use mbssep if you care about internationalization"), \
|
||||
strsep (s, d))
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strsep
|
||||
# define strsep(s,d) \
|
||||
(GL_LINK_WARNING ("strsep is unportable - " \
|
||||
"use gnulib module strsep for portability"), \
|
||||
strsep (s, d))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_STRSTR@
|
||||
# if @REPLACE_STRSTR@
|
||||
# define strstr rpl_strstr
|
||||
char *strstr (const char *haystack, const char *needle)
|
||||
__attribute__ ((__pure__));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
/* strstr() does not work with multibyte strings if the locale encoding is
|
||||
different from UTF-8:
|
||||
POSIX says that it operates on "strings", and "string" in POSIX is defined
|
||||
as a sequence of bytes, not of characters. */
|
||||
# undef strstr
|
||||
# define strstr(a,b) \
|
||||
(GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
|
||||
"work correctly on character strings in most " \
|
||||
"multibyte locales - " \
|
||||
"use mbsstr if you care about internationalization, " \
|
||||
"or use strstr if you care about speed"), \
|
||||
strstr (a, b))
|
||||
#endif
|
||||
|
||||
/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
|
||||
comparison. */
|
||||
#if @GNULIB_STRCASESTR@
|
||||
# if @REPLACE_STRCASESTR@
|
||||
# define strcasestr rpl_strcasestr
|
||||
# endif
|
||||
# if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
|
||||
extern char *strcasestr (const char *haystack, const char *needle)
|
||||
__attribute__ ((__pure__));
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
/* strcasestr() does not work with multibyte strings:
|
||||
It is a glibc extension, and glibc implements it only for unibyte
|
||||
locales. */
|
||||
# undef strcasestr
|
||||
# define strcasestr(a,b) \
|
||||
(GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
|
||||
"in multibyte locales - " \
|
||||
"use mbscasestr if you care about " \
|
||||
"internationalization, or use c-strcasestr if you want " \
|
||||
"a locale independent function"), \
|
||||
strcasestr (a, b))
|
||||
#endif
|
||||
|
||||
/* Parse S into tokens separated by characters in DELIM.
|
||||
If S is NULL, the saved pointer in SAVE_PTR is used as
|
||||
the next starting point. For example:
|
||||
char s[] = "-abc-=-def";
|
||||
char *sp;
|
||||
x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
|
||||
x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
|
||||
x = strtok_r(NULL, "=", &sp); // x = NULL
|
||||
// s = "abc\0-def\0"
|
||||
|
||||
This is a variant of strtok() that is multithread-safe.
|
||||
|
||||
For the POSIX documentation for this function, see:
|
||||
http://www.opengroup.org/susv3xsh/strtok.html
|
||||
|
||||
Caveat: It modifies the original string.
|
||||
Caveat: These functions cannot be used on constant strings.
|
||||
Caveat: The identity of the delimiting character is lost.
|
||||
Caveat: It doesn't work with multibyte strings unless all of the delimiter
|
||||
characters are ASCII characters < 0x30.
|
||||
|
||||
See also strsep(). */
|
||||
#if @GNULIB_STRTOK_R@
|
||||
# if ! @HAVE_DECL_STRTOK_R@
|
||||
extern char *strtok_r (char *restrict s, char const *restrict delim,
|
||||
char **restrict save_ptr);
|
||||
# endif
|
||||
# if defined GNULIB_POSIXCHECK
|
||||
# undef strtok_r
|
||||
# define strtok_r(s,d,p) \
|
||||
(GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
|
||||
"in multibyte locales - " \
|
||||
"use mbstok_r if you care about internationalization"), \
|
||||
strtok_r (s, d, p))
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strtok_r
|
||||
# define strtok_r(s,d,p) \
|
||||
(GL_LINK_WARNING ("strtok_r is unportable - " \
|
||||
"use gnulib module strtok_r for portability"), \
|
||||
strtok_r (s, d, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* The following functions are not specified by POSIX. They are gnulib
|
||||
extensions. */
|
||||
|
||||
#if @GNULIB_MBSLEN@
|
||||
/* Return the number of multibyte characters in the character string STRING.
|
||||
This considers multibyte characters, unlike strlen, which counts bytes. */
|
||||
extern size_t mbslen (const char *string);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSNLEN@
|
||||
/* Return the number of multibyte characters in the character string starting
|
||||
at STRING and ending at STRING + LEN. */
|
||||
extern size_t mbsnlen (const char *string, size_t len);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSCHR@
|
||||
/* Locate the first single-byte character C in the character string STRING,
|
||||
and return a pointer to it. Return NULL if C is not found in STRING.
|
||||
Unlike strchr(), this function works correctly in multibyte locales with
|
||||
encodings such as GB18030. */
|
||||
# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
|
||||
extern char * mbschr (const char *string, int c);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSRCHR@
|
||||
/* Locate the last single-byte character C in the character string STRING,
|
||||
and return a pointer to it. Return NULL if C is not found in STRING.
|
||||
Unlike strrchr(), this function works correctly in multibyte locales with
|
||||
encodings such as GB18030. */
|
||||
# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
|
||||
extern char * mbsrchr (const char *string, int c);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSSTR@
|
||||
/* Find the first occurrence of the character string NEEDLE in the character
|
||||
string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK.
|
||||
Unlike strstr(), this function works correctly in multibyte locales with
|
||||
encodings different from UTF-8. */
|
||||
extern char * mbsstr (const char *haystack, const char *needle);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSCASECMP@
|
||||
/* Compare the character strings S1 and S2, ignoring case, returning less than,
|
||||
equal to or greater than zero if S1 is lexicographically less than, equal to
|
||||
or greater than S2.
|
||||
Note: This function may, in multibyte locales, return 0 for strings of
|
||||
different lengths!
|
||||
Unlike strcasecmp(), this function works correctly in multibyte locales. */
|
||||
extern int mbscasecmp (const char *s1, const char *s2);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSNCASECMP@
|
||||
/* Compare the initial segment of the character string S1 consisting of at most
|
||||
N characters with the initial segment of the character string S2 consisting
|
||||
of at most N characters, ignoring case, returning less than, equal to or
|
||||
greater than zero if the initial segment of S1 is lexicographically less
|
||||
than, equal to or greater than the initial segment of S2.
|
||||
Note: This function may, in multibyte locales, return 0 for initial segments
|
||||
of different lengths!
|
||||
Unlike strncasecmp(), this function works correctly in multibyte locales.
|
||||
But beware that N is not a byte count but a character count! */
|
||||
extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSPCASECMP@
|
||||
/* Compare the initial segment of the character string STRING consisting of
|
||||
at most mbslen (PREFIX) characters with the character string PREFIX,
|
||||
ignoring case, returning less than, equal to or greater than zero if this
|
||||
initial segment is lexicographically less than, equal to or greater than
|
||||
PREFIX.
|
||||
Note: This function may, in multibyte locales, return 0 if STRING is of
|
||||
smaller length than PREFIX!
|
||||
Unlike strncasecmp(), this function works correctly in multibyte
|
||||
locales. */
|
||||
extern char * mbspcasecmp (const char *string, const char *prefix);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSCASESTR@
|
||||
/* Find the first occurrence of the character string NEEDLE in the character
|
||||
string HAYSTACK, using case-insensitive comparison.
|
||||
Note: This function may, in multibyte locales, return success even if
|
||||
strlen (haystack) < strlen (needle) !
|
||||
Unlike strcasestr(), this function works correctly in multibyte locales. */
|
||||
extern char * mbscasestr (const char *haystack, const char *needle);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSCSPN@
|
||||
/* Find the first occurrence in the character string STRING of any character
|
||||
in the character string ACCEPT. Return the number of bytes from the
|
||||
beginning of the string to this occurrence, or to the end of the string
|
||||
if none exists.
|
||||
Unlike strcspn(), this function works correctly in multibyte locales. */
|
||||
extern size_t mbscspn (const char *string, const char *accept);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSPBRK@
|
||||
/* Find the first occurrence in the character string STRING of any character
|
||||
in the character string ACCEPT. Return the pointer to it, or NULL if none
|
||||
exists.
|
||||
Unlike strpbrk(), this function works correctly in multibyte locales. */
|
||||
# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
|
||||
extern char * mbspbrk (const char *string, const char *accept);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSSPN@
|
||||
/* Find the first occurrence in the character string STRING of any character
|
||||
not in the character string REJECT. Return the number of bytes from the
|
||||
beginning of the string to this occurrence, or to the end of the string
|
||||
if none exists.
|
||||
Unlike strspn(), this function works correctly in multibyte locales. */
|
||||
extern size_t mbsspn (const char *string, const char *reject);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSSEP@
|
||||
/* Search the next delimiter (multibyte character listed in the character
|
||||
string DELIM) starting at the character string *STRINGP.
|
||||
If one is found, overwrite it with a NUL, and advance *STRINGP to point
|
||||
to the next multibyte character after it. Otherwise, set *STRINGP to NULL.
|
||||
If *STRINGP was already NULL, nothing happens.
|
||||
Return the old value of *STRINGP.
|
||||
|
||||
This is a variant of mbstok_r() that supports empty fields.
|
||||
|
||||
Caveat: It modifies the original string.
|
||||
Caveat: These functions cannot be used on constant strings.
|
||||
Caveat: The identity of the delimiting character is lost.
|
||||
|
||||
See also mbstok_r(). */
|
||||
extern char * mbssep (char **stringp, const char *delim);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBSTOK_R@
|
||||
/* Parse the character string STRING into tokens separated by characters in
|
||||
the character string DELIM.
|
||||
If STRING is NULL, the saved pointer in SAVE_PTR is used as
|
||||
the next starting point. For example:
|
||||
char s[] = "-abc-=-def";
|
||||
char *sp;
|
||||
x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def"
|
||||
x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL
|
||||
x = mbstok_r(NULL, "=", &sp); // x = NULL
|
||||
// s = "abc\0-def\0"
|
||||
|
||||
Caveat: It modifies the original string.
|
||||
Caveat: These functions cannot be used on constant strings.
|
||||
Caveat: The identity of the delimiting character is lost.
|
||||
|
||||
See also mbssep(). */
|
||||
extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
|
||||
#endif
|
||||
|
||||
/* Map any int, typically from errno, into an error message. */
|
||||
#if @GNULIB_STRERROR@
|
||||
# if @REPLACE_STRERROR@
|
||||
# undef strerror
|
||||
# define strerror rpl_strerror
|
||||
extern char *strerror (int);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strerror
|
||||
# define strerror(e) \
|
||||
(GL_LINK_WARNING ("strerror is unportable - " \
|
||||
"use gnulib module strerror to guarantee non-NULL result"), \
|
||||
strerror (e))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_STRSIGNAL@
|
||||
# if @REPLACE_STRSIGNAL@
|
||||
# define strsignal rpl_strsignal
|
||||
# endif
|
||||
# if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@
|
||||
extern char *strsignal (int __sig);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strsignal
|
||||
# define strsignal(a) \
|
||||
(GL_LINK_WARNING ("strsignal is unportable - " \
|
||||
"use gnulib module strsignal for portability"), \
|
||||
strsignal (a))
|
||||
#endif
|
||||
|
||||
#if @GNULIB_STRVERSCMP@
|
||||
# if !@HAVE_STRVERSCMP@
|
||||
extern int strverscmp (const char *, const char *);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strverscmp
|
||||
# define strverscmp(a, b) \
|
||||
(GL_LINK_WARNING ("strverscmp is unportable - " \
|
||||
"use gnulib module strverscmp for portability"), \
|
||||
strverscmp (a, b))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GL_STRING_H */
|
||||
#endif /* _GL_STRING_H */
|
||||
@@ -1,90 +0,0 @@
|
||||
/* A substitute <strings.h>.
|
||||
|
||||
Copyright (C) 2007, 2008, 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _GL_STRINGS_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_STRINGS_H@
|
||||
|
||||
#ifndef _GL_STRINGS_H
|
||||
#define _GL_STRINGS_H
|
||||
|
||||
|
||||
/* The definition of GL_LINK_WARNING is copied here. */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
|
||||
greater than zero if S1 is lexicographically less than, equal to or greater
|
||||
than S2.
|
||||
Note: This function does not work in multibyte locales. */
|
||||
#if ! @HAVE_STRCASECMP@
|
||||
extern int strcasecmp (char const *s1, char const *s2);
|
||||
#endif
|
||||
#if defined GNULIB_POSIXCHECK
|
||||
/* strcasecmp() does not work with multibyte strings:
|
||||
POSIX says that it operates on "strings", and "string" in POSIX is defined
|
||||
as a sequence of bytes, not of characters. */
|
||||
# undef strcasecmp
|
||||
# define strcasecmp(a,b) \
|
||||
(GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " \
|
||||
"in multibyte locales - " \
|
||||
"use mbscasecmp if you care about " \
|
||||
"internationalization, or use c_strcasecmp (from " \
|
||||
"gnulib module c-strcase) if you want a locale " \
|
||||
"independent function"), \
|
||||
strcasecmp (a, b))
|
||||
#endif
|
||||
|
||||
/* Compare no more than N bytes of strings S1 and S2, ignoring case,
|
||||
returning less than, equal to or greater than zero if S1 is
|
||||
lexicographically less than, equal to or greater than S2.
|
||||
Note: This function cannot work correctly in multibyte locales. */
|
||||
#if ! @HAVE_DECL_STRNCASECMP@
|
||||
extern int strncasecmp (char const *s1, char const *s2, size_t n);
|
||||
#endif
|
||||
#if defined GNULIB_POSIXCHECK
|
||||
/* strncasecmp() does not work with multibyte strings:
|
||||
POSIX says that it operates on "strings", and "string" in POSIX is defined
|
||||
as a sequence of bytes, not of characters. */
|
||||
# undef strncasecmp
|
||||
# define strncasecmp(a,b,n) \
|
||||
(GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
|
||||
"strings in multibyte locales - " \
|
||||
"use mbsncasecmp or mbspcasecmp if you care about " \
|
||||
"internationalization, or use c_strncasecmp (from " \
|
||||
"gnulib module c-strcase) if you want a locale " \
|
||||
"independent function"), \
|
||||
strncasecmp (a, b, n))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GL_STRING_H */
|
||||
#endif /* _GL_STRING_H */
|
||||
@@ -1,64 +0,0 @@
|
||||
/* strncasecmp.c -- case insensitive string comparator
|
||||
Copyright (C) 1998, 1999, 2005, 2006, 2007, 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <string.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
|
||||
|
||||
/* Compare no more than N bytes of strings S1 and S2, ignoring case,
|
||||
returning less than, equal to or greater than zero if S1 is
|
||||
lexicographically less than, equal to or greater than S2.
|
||||
Note: This function cannot work correctly in multibyte locales. */
|
||||
|
||||
int
|
||||
strncasecmp (const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
register const unsigned char *p1 = (const unsigned char *) s1;
|
||||
register const unsigned char *p2 = (const unsigned char *) s2;
|
||||
unsigned char c1, c2;
|
||||
|
||||
if (p1 == p2 || n == 0)
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
c1 = TOLOWER (*p1);
|
||||
c2 = TOLOWER (*p2);
|
||||
|
||||
if (--n == 0 || c1 == '\0')
|
||||
break;
|
||||
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
|
||||
if (UCHAR_MAX <= INT_MAX)
|
||||
return c1 - c2;
|
||||
else
|
||||
/* On machines where 'char' and 'int' are types of the same size, the
|
||||
difference of two 'unsigned char' values - including the sign bit -
|
||||
doesn't fit in an 'int'. */
|
||||
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
|
||||
}
|
||||
630
lib/unistd.in.h
630
lib/unistd.in.h
@@ -1,630 +0,0 @@
|
||||
/* Substitute for and wrapper around <unistd.h>.
|
||||
Copyright (C) 2003-2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _GL_UNISTD_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#if @HAVE_UNISTD_H@
|
||||
# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
|
||||
#endif
|
||||
|
||||
#ifndef _GL_UNISTD_H
|
||||
#define _GL_UNISTD_H
|
||||
|
||||
/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
|
||||
#include <stddef.h>
|
||||
|
||||
/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
|
||||
#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
|
||||
/* mingw fails to declare _exit in <unistd.h>. */
|
||||
/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
|
||||
#include <stdlib.h>
|
||||
|
||||
#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
|
||||
/* Get ssize_t. */
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Get getopt(), optarg, optind, opterr, optopt. */
|
||||
#if @GNULIB_UNISTD_H_GETOPT@
|
||||
# include <getopt.h>
|
||||
#endif
|
||||
|
||||
#if @GNULIB_GETHOSTNAME@
|
||||
/* Get all possible declarations of gethostname(). */
|
||||
# if @UNISTD_H_HAVE_WINSOCK2_H@
|
||||
# include <winsock2.h>
|
||||
# if !defined _GL_SYS_SOCKET_H
|
||||
# undef socket
|
||||
# define socket socket_used_without_including_sys_socket_h
|
||||
# undef connect
|
||||
# define connect connect_used_without_including_sys_socket_h
|
||||
# undef accept
|
||||
# define accept accept_used_without_including_sys_socket_h
|
||||
# undef bind
|
||||
# define bind bind_used_without_including_sys_socket_h
|
||||
# undef getpeername
|
||||
# define getpeername getpeername_used_without_including_sys_socket_h
|
||||
# undef getsockname
|
||||
# define getsockname getsockname_used_without_including_sys_socket_h
|
||||
# undef getsockopt
|
||||
# define getsockopt getsockopt_used_without_including_sys_socket_h
|
||||
# undef listen
|
||||
# define listen listen_used_without_including_sys_socket_h
|
||||
# undef recv
|
||||
# define recv recv_used_without_including_sys_socket_h
|
||||
# undef send
|
||||
# define send send_used_without_including_sys_socket_h
|
||||
# undef recvfrom
|
||||
# define recvfrom recvfrom_used_without_including_sys_socket_h
|
||||
# undef sendto
|
||||
# define sendto sendto_used_without_including_sys_socket_h
|
||||
# undef setsockopt
|
||||
# define setsockopt setsockopt_used_without_including_sys_socket_h
|
||||
# undef shutdown
|
||||
# define shutdown shutdown_used_without_including_sys_socket_h
|
||||
# endif
|
||||
# if !defined _GL_SYS_SELECT_H
|
||||
# undef select
|
||||
# define select select_used_without_including_sys_select_h
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The definition of GL_LINK_WARNING is copied here. */
|
||||
|
||||
|
||||
/* OS/2 EMX lacks these macros. */
|
||||
#ifndef STDIN_FILENO
|
||||
# define STDIN_FILENO 0
|
||||
#endif
|
||||
#ifndef STDOUT_FILENO
|
||||
# define STDOUT_FILENO 1
|
||||
#endif
|
||||
#ifndef STDERR_FILENO
|
||||
# define STDERR_FILENO 2
|
||||
#endif
|
||||
|
||||
/* Declare overridden functions. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_CHOWN@
|
||||
# if @REPLACE_CHOWN@
|
||||
# ifndef REPLACE_CHOWN
|
||||
# define REPLACE_CHOWN 1
|
||||
# endif
|
||||
# if REPLACE_CHOWN
|
||||
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
|
||||
to GID (if GID is not -1). Follow symbolic links.
|
||||
Return 0 if successful, otherwise -1 and errno set.
|
||||
See the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/chown.html>. */
|
||||
# define chown rpl_chown
|
||||
extern int chown (const char *file, uid_t uid, gid_t gid);
|
||||
# endif
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef chown
|
||||
# define chown(f,u,g) \
|
||||
(GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
|
||||
"doesn't treat a uid or gid of -1 on some systems - " \
|
||||
"use gnulib module chown for portability"), \
|
||||
chown (f, u, g))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_CLOSE@
|
||||
# if @REPLACE_CLOSE@
|
||||
/* Automatically included by modules that need a replacement for close. */
|
||||
# undef close
|
||||
# define close rpl_close
|
||||
extern int close (int);
|
||||
# endif
|
||||
#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
|
||||
# undef close
|
||||
# define close close_used_without_requesting_gnulib_module_close
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef close
|
||||
# define close(f) \
|
||||
(GL_LINK_WARNING ("close does not portably work on sockets - " \
|
||||
"use gnulib module close for portability"), \
|
||||
close (f))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_DUP2@
|
||||
# if @REPLACE_DUP2@
|
||||
# define dup2 rpl_dup2
|
||||
# endif
|
||||
# if !@HAVE_DUP2@ || @REPLACE_DUP2@
|
||||
/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
|
||||
NEWFD = OLDFD, otherwise close NEWFD first if it is open.
|
||||
Return newfd if successful, otherwise -1 and errno set.
|
||||
See the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/dup2.html>. */
|
||||
extern int dup2 (int oldfd, int newfd);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef dup2
|
||||
# define dup2(o,n) \
|
||||
(GL_LINK_WARNING ("dup2 is unportable - " \
|
||||
"use gnulib module dup2 for portability"), \
|
||||
dup2 (o, n))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_DUP3@
|
||||
/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
|
||||
specified flags.
|
||||
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
|
||||
and O_TEXT, O_BINARY (defined in "binary-io.h").
|
||||
Close NEWFD first if it is open.
|
||||
Return newfd if successful, otherwise -1 and errno set.
|
||||
See the Linux man page at
|
||||
<http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
|
||||
# if @HAVE_DUP3@
|
||||
# define dup3 rpl_dup3
|
||||
# endif
|
||||
extern int dup3 (int oldfd, int newfd, int flags);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef dup3
|
||||
# define dup3(o,n,f) \
|
||||
(GL_LINK_WARNING ("dup3 is unportable - " \
|
||||
"use gnulib module dup3 for portability"), \
|
||||
dup3 (o, n, f))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_ENVIRON@
|
||||
# if !@HAVE_DECL_ENVIRON@
|
||||
/* Set of environment variables and values. An array of strings of the form
|
||||
"VARIABLE=VALUE", terminated with a NULL. */
|
||||
# if defined __APPLE__ && defined __MACH__
|
||||
# include <crt_externs.h>
|
||||
# define environ (*_NSGetEnviron ())
|
||||
# else
|
||||
extern char **environ;
|
||||
# endif
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef environ
|
||||
# define environ \
|
||||
(GL_LINK_WARNING ("environ is unportable - " \
|
||||
"use gnulib module environ for portability"), \
|
||||
environ)
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_EUIDACCESS@
|
||||
# if !@HAVE_EUIDACCESS@
|
||||
/* Like access(), except that is uses the effective user id and group id of
|
||||
the current process. */
|
||||
extern int euidaccess (const char *filename, int mode);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef euidaccess
|
||||
# define euidaccess(f,m) \
|
||||
(GL_LINK_WARNING ("euidaccess is unportable - " \
|
||||
"use gnulib module euidaccess for portability"), \
|
||||
euidaccess (f, m))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_FCHDIR@
|
||||
# if @REPLACE_FCHDIR@
|
||||
|
||||
/* Change the process' current working directory to the directory on which
|
||||
the given file descriptor is open.
|
||||
Return 0 if successful, otherwise -1 and errno set.
|
||||
See the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/fchdir.html>. */
|
||||
extern int fchdir (int /*fd*/);
|
||||
|
||||
# define dup rpl_dup
|
||||
extern int dup (int);
|
||||
|
||||
/* Gnulib internal hooks needed to maintain the fchdir metadata. */
|
||||
extern int _gl_register_fd (int fd, const char *filename);
|
||||
extern void _gl_unregister_fd (int fd);
|
||||
extern int _gl_register_dup (int oldfd, int newfd);
|
||||
extern const char *_gl_directory_name (int fd);
|
||||
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fchdir
|
||||
# define fchdir(f) \
|
||||
(GL_LINK_WARNING ("fchdir is unportable - " \
|
||||
"use gnulib module fchdir for portability"), \
|
||||
fchdir (f))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_FSYNC@
|
||||
/* Synchronize changes to a file.
|
||||
Return 0 if successful, otherwise -1 and errno set.
|
||||
See POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/fsync.html>. */
|
||||
# if !@HAVE_FSYNC@
|
||||
extern int fsync (int fd);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef fsync
|
||||
# define fsync(fd) \
|
||||
(GL_LINK_WARNING ("fsync is unportable - " \
|
||||
"use gnulib module fsync for portability"), \
|
||||
fsync (fd))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_FTRUNCATE@
|
||||
# if !@HAVE_FTRUNCATE@
|
||||
/* Change the size of the file to which FD is opened to become equal to LENGTH.
|
||||
Return 0 if successful, otherwise -1 and errno set.
|
||||
See the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/ftruncate.html>. */
|
||||
extern int ftruncate (int fd, off_t length);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef ftruncate
|
||||
# define ftruncate(f,l) \
|
||||
(GL_LINK_WARNING ("ftruncate is unportable - " \
|
||||
"use gnulib module ftruncate for portability"), \
|
||||
ftruncate (f, l))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_GETCWD@
|
||||
/* Include the headers that might declare getcwd so that they will not
|
||||
cause confusion if included after this file. */
|
||||
# include <stdlib.h>
|
||||
# if @REPLACE_GETCWD@
|
||||
/* Get the name of the current working directory, and put it in SIZE bytes
|
||||
of BUF.
|
||||
Return BUF if successful, or NULL if the directory couldn't be determined
|
||||
or SIZE was too small.
|
||||
See the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/getcwd.html>.
|
||||
Additionally, the gnulib module 'getcwd' guarantees the following GNU
|
||||
extension: If BUF is NULL, an array is allocated with 'malloc'; the array
|
||||
is SIZE bytes long, unless SIZE == 0, in which case it is as big as
|
||||
necessary. */
|
||||
# define getcwd rpl_getcwd
|
||||
extern char * getcwd (char *buf, size_t size);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getcwd
|
||||
# define getcwd(b,s) \
|
||||
(GL_LINK_WARNING ("getcwd is unportable - " \
|
||||
"use gnulib module getcwd for portability"), \
|
||||
getcwd (b, s))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_GETDOMAINNAME@
|
||||
/* Return the NIS domain name of the machine.
|
||||
WARNING! The NIS domain name is unrelated to the fully qualified host name
|
||||
of the machine. It is also unrelated to email addresses.
|
||||
WARNING! The NIS domain name is usually the empty string or "(none)" when
|
||||
not using NIS.
|
||||
|
||||
Put up to LEN bytes of the NIS domain name into NAME.
|
||||
Null terminate it if the name is shorter than LEN.
|
||||
If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
|
||||
Return 0 if successful, otherwise set errno and return -1. */
|
||||
# if !@HAVE_GETDOMAINNAME@
|
||||
extern int getdomainname(char *name, size_t len);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getdomainname
|
||||
# define getdomainname(n,l) \
|
||||
(GL_LINK_WARNING ("getdomainname is unportable - " \
|
||||
"use gnulib module getdomainname for portability"), \
|
||||
getdomainname (n, l))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_GETDTABLESIZE@
|
||||
# if !@HAVE_GETDTABLESIZE@
|
||||
/* Return the maximum number of file descriptors in the current process.
|
||||
In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
|
||||
extern int getdtablesize (void);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getdtablesize
|
||||
# define getdtablesize() \
|
||||
(GL_LINK_WARNING ("getdtablesize is unportable - " \
|
||||
"use gnulib module getdtablesize for portability"), \
|
||||
getdtablesize ())
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_GETHOSTNAME@
|
||||
/* Return the standard host name of the machine.
|
||||
WARNING! The host name may or may not be fully qualified.
|
||||
|
||||
Put up to LEN bytes of the host name into NAME.
|
||||
Null terminate it if the name is shorter than LEN.
|
||||
If the host name is longer than LEN, set errno = EINVAL and return -1.
|
||||
Return 0 if successful, otherwise set errno and return -1. */
|
||||
# if @UNISTD_H_HAVE_WINSOCK2_H@
|
||||
# undef gethostname
|
||||
# define gethostname rpl_gethostname
|
||||
# endif
|
||||
# if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@
|
||||
extern int gethostname(char *name, size_t len);
|
||||
# endif
|
||||
#elif @UNISTD_H_HAVE_WINSOCK2_H@
|
||||
# undef gethostname
|
||||
# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef gethostname
|
||||
# define gethostname(n,l) \
|
||||
(GL_LINK_WARNING ("gethostname is unportable - " \
|
||||
"use gnulib module gethostname for portability"), \
|
||||
gethostname (n, l))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_GETLOGIN_R@
|
||||
/* Copies the user's login name to NAME.
|
||||
The array pointed to by NAME has room for SIZE bytes.
|
||||
|
||||
Returns 0 if successful. Upon error, an error number is returned, or -1 in
|
||||
the case that the login name cannot be found but no specific error is
|
||||
provided (this case is hopefully rare but is left open by the POSIX spec).
|
||||
|
||||
See <http://www.opengroup.org/susv3xsh/getlogin.html>.
|
||||
*/
|
||||
# if !@HAVE_DECL_GETLOGIN_R@
|
||||
extern int getlogin_r (char *name, size_t size);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getlogin_r
|
||||
# define getlogin_r(n,s) \
|
||||
(GL_LINK_WARNING ("getlogin_r is unportable - " \
|
||||
"use gnulib module getlogin_r for portability"), \
|
||||
getlogin_r (n, s))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_GETPAGESIZE@
|
||||
# if @REPLACE_GETPAGESIZE@
|
||||
# define getpagesize rpl_getpagesize
|
||||
extern int getpagesize (void);
|
||||
# elif !@HAVE_GETPAGESIZE@
|
||||
/* This is for POSIX systems. */
|
||||
# if !defined getpagesize && defined _SC_PAGESIZE
|
||||
# if ! (defined __VMS && __VMS_VER < 70000000)
|
||||
# define getpagesize() sysconf (_SC_PAGESIZE)
|
||||
# endif
|
||||
# endif
|
||||
/* This is for older VMS. */
|
||||
# if !defined getpagesize && defined __VMS
|
||||
# ifdef __ALPHA
|
||||
# define getpagesize() 8192
|
||||
# else
|
||||
# define getpagesize() 512
|
||||
# endif
|
||||
# endif
|
||||
/* This is for BeOS. */
|
||||
# if !defined getpagesize && @HAVE_OS_H@
|
||||
# include <OS.h>
|
||||
# if defined B_PAGE_SIZE
|
||||
# define getpagesize() B_PAGE_SIZE
|
||||
# endif
|
||||
# endif
|
||||
/* This is for AmigaOS4.0. */
|
||||
# if !defined getpagesize && defined __amigaos4__
|
||||
# define getpagesize() 2048
|
||||
# endif
|
||||
/* This is for older Unix systems. */
|
||||
# if !defined getpagesize && @HAVE_SYS_PARAM_H@
|
||||
# include <sys/param.h>
|
||||
# ifdef EXEC_PAGESIZE
|
||||
# define getpagesize() EXEC_PAGESIZE
|
||||
# else
|
||||
# ifdef NBPG
|
||||
# ifndef CLSIZE
|
||||
# define CLSIZE 1
|
||||
# endif
|
||||
# define getpagesize() (NBPG * CLSIZE)
|
||||
# else
|
||||
# ifdef NBPC
|
||||
# define getpagesize() NBPC
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getpagesize
|
||||
# define getpagesize() \
|
||||
(GL_LINK_WARNING ("getpagesize is unportable - " \
|
||||
"use gnulib module getpagesize for portability"), \
|
||||
getpagesize ())
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_GETUSERSHELL@
|
||||
# if !@HAVE_GETUSERSHELL@
|
||||
/* Return the next valid login shell on the system, or NULL when the end of
|
||||
the list has been reached. */
|
||||
extern char *getusershell (void);
|
||||
/* Rewind to pointer that is advanced at each getusershell() call. */
|
||||
extern void setusershell (void);
|
||||
/* Free the pointer that is advanced at each getusershell() call and
|
||||
associated resources. */
|
||||
extern void endusershell (void);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getusershell
|
||||
# define getusershell() \
|
||||
(GL_LINK_WARNING ("getusershell is unportable - " \
|
||||
"use gnulib module getusershell for portability"), \
|
||||
getusershell ())
|
||||
# undef setusershell
|
||||
# define setusershell() \
|
||||
(GL_LINK_WARNING ("setusershell is unportable - " \
|
||||
"use gnulib module getusershell for portability"), \
|
||||
setusershell ())
|
||||
# undef endusershell
|
||||
# define endusershell() \
|
||||
(GL_LINK_WARNING ("endusershell is unportable - " \
|
||||
"use gnulib module getusershell for portability"), \
|
||||
endusershell ())
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_LCHOWN@
|
||||
# if @REPLACE_LCHOWN@
|
||||
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
|
||||
to GID (if GID is not -1). Do not follow symbolic links.
|
||||
Return 0 if successful, otherwise -1 and errno set.
|
||||
See the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/lchown.html>. */
|
||||
# define lchown rpl_lchown
|
||||
extern int lchown (char const *file, uid_t owner, gid_t group);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef lchown
|
||||
# define lchown(f,u,g) \
|
||||
(GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
|
||||
"systems - use gnulib module lchown for portability"), \
|
||||
lchown (f, u, g))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_LINK@
|
||||
/* Create a new hard link for an existing file.
|
||||
Return 0 if successful, otherwise -1 and errno set.
|
||||
See POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/link.html>. */
|
||||
# if !@HAVE_LINK@
|
||||
extern int link (const char *path1, const char *path2);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef link
|
||||
# define link(path1,path2) \
|
||||
(GL_LINK_WARNING ("link is unportable - " \
|
||||
"use gnulib module link for portability"), \
|
||||
link (path1, path2))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_LSEEK@
|
||||
# if @REPLACE_LSEEK@
|
||||
/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
|
||||
Return the new offset if successful, otherwise -1 and errno set.
|
||||
See the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/lseek.html>. */
|
||||
# define lseek rpl_lseek
|
||||
extern off_t lseek (int fd, off_t offset, int whence);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef lseek
|
||||
# define lseek(f,o,w) \
|
||||
(GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
|
||||
"systems - use gnulib module lseek for portability"), \
|
||||
lseek (f, o, w))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_PIPE2@
|
||||
/* Create a pipe, applying the given flags when opening the read-end of the
|
||||
pipe and the write-end of the pipe.
|
||||
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
|
||||
and O_TEXT, O_BINARY (defined in "binary-io.h").
|
||||
Store the read-end as fd[0] and the write-end as fd[1].
|
||||
Return 0 upon success, or -1 with errno set upon failure.
|
||||
See also the Linux man page at
|
||||
<http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
|
||||
# if @HAVE_PIPE2@
|
||||
# define pipe2 rpl_pipe2
|
||||
# endif
|
||||
extern int pipe2 (int fd[2], int flags);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef pipe2
|
||||
# define pipe2(f,o) \
|
||||
(GL_LINK_WARNING ("pipe2 is unportable - " \
|
||||
"use gnulib module pipe2 for portability"), \
|
||||
pipe2 (f, o))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_READLINK@
|
||||
/* Read the contents of the symbolic link FILE and place the first BUFSIZE
|
||||
bytes of it into BUF. Return the number of bytes placed into BUF if
|
||||
successful, otherwise -1 and errno set.
|
||||
See the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/readlink.html>. */
|
||||
# if !@HAVE_READLINK@
|
||||
extern int readlink (const char *file, char *buf, size_t bufsize);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef readlink
|
||||
# define readlink(f,b,s) \
|
||||
(GL_LINK_WARNING ("readlink is unportable - " \
|
||||
"use gnulib module readlink for portability"), \
|
||||
readlink (f, b, s))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_SLEEP@
|
||||
/* Pause the execution of the current thread for N seconds.
|
||||
Returns the number of seconds left to sleep.
|
||||
See the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/sleep.html>. */
|
||||
# if !@HAVE_SLEEP@
|
||||
extern unsigned int sleep (unsigned int n);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef sleep
|
||||
# define sleep(n) \
|
||||
(GL_LINK_WARNING ("sleep is unportable - " \
|
||||
"use gnulib module sleep for portability"), \
|
||||
sleep (n))
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
|
||||
/* Write up to COUNT bytes starting at BUF to file descriptor FD.
|
||||
See the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/write.html>. */
|
||||
# undef write
|
||||
# define write rpl_write
|
||||
extern ssize_t write (int fd, const void *buf, size_t count);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _GL_UNISTD_H */
|
||||
#endif /* _GL_UNISTD_H */
|
||||
140
lib/verify.h
140
lib/verify.h
@@ -1,140 +0,0 @@
|
||||
/* Compile-time assert-like macros.
|
||||
|
||||
Copyright (C) 2005, 2006, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
|
||||
|
||||
#ifndef VERIFY_H
|
||||
# define VERIFY_H 1
|
||||
|
||||
/* Each of these macros verifies that its argument R is nonzero. To
|
||||
be portable, R should be an integer constant expression. Unlike
|
||||
assert (R), there is no run-time overhead.
|
||||
|
||||
There are two macros, since no single macro can be used in all
|
||||
contexts in C. verify_true (R) is for scalar contexts, including
|
||||
integer constant expression contexts. verify (R) is for declaration
|
||||
contexts, e.g., the top level.
|
||||
|
||||
Symbols ending in "__" are private to this header.
|
||||
|
||||
The code below uses several ideas.
|
||||
|
||||
* The first step is ((R) ? 1 : -1). Given an expression R, of
|
||||
integral or boolean or floating-point type, this yields an
|
||||
expression of integral type, whose value is later verified to be
|
||||
constant and nonnegative.
|
||||
|
||||
* Next this expression W is wrapped in a type
|
||||
struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }.
|
||||
If W is negative, this yields a compile-time error. No compiler can
|
||||
deal with a bit-field of negative size.
|
||||
|
||||
One might think that an array size check would have the same
|
||||
effect, that is, that the type struct { unsigned int dummy[W]; }
|
||||
would work as well. However, inside a function, some compilers
|
||||
(such as C++ compilers and GNU C) allow local parameters and
|
||||
variables inside array size expressions. With these compilers,
|
||||
an array size check would not properly diagnose this misuse of
|
||||
the verify macro:
|
||||
|
||||
void function (int n) { verify (n < 0); }
|
||||
|
||||
* For the verify macro, the struct verify_type__ will need to
|
||||
somehow be embedded into a declaration. To be portable, this
|
||||
declaration must declare an object, a constant, a function, or a
|
||||
typedef name. If the declared entity uses the type directly,
|
||||
such as in
|
||||
|
||||
struct dummy {...};
|
||||
typedef struct {...} dummy;
|
||||
extern struct {...} *dummy;
|
||||
extern void dummy (struct {...} *);
|
||||
extern struct {...} *dummy (void);
|
||||
|
||||
two uses of the verify macro would yield colliding declarations
|
||||
if the entity names are not disambiguated. A workaround is to
|
||||
attach the current line number to the entity name:
|
||||
|
||||
#define GL_CONCAT0(x, y) x##y
|
||||
#define GL_CONCAT(x, y) GL_CONCAT0 (x, y)
|
||||
extern struct {...} * GL_CONCAT(dummy,__LINE__);
|
||||
|
||||
But this has the problem that two invocations of verify from
|
||||
within the same macro would collide, since the __LINE__ value
|
||||
would be the same for both invocations.
|
||||
|
||||
A solution is to use the sizeof operator. It yields a number,
|
||||
getting rid of the identity of the type. Declarations like
|
||||
|
||||
extern int dummy [sizeof (struct {...})];
|
||||
extern void dummy (int [sizeof (struct {...})]);
|
||||
extern int (*dummy (void)) [sizeof (struct {...})];
|
||||
|
||||
can be repeated.
|
||||
|
||||
* Should the implementation use a named struct or an unnamed struct?
|
||||
Which of the following alternatives can be used?
|
||||
|
||||
extern int dummy [sizeof (struct {...})];
|
||||
extern int dummy [sizeof (struct verify_type__ {...})];
|
||||
extern void dummy (int [sizeof (struct {...})]);
|
||||
extern void dummy (int [sizeof (struct verify_type__ {...})]);
|
||||
extern int (*dummy (void)) [sizeof (struct {...})];
|
||||
extern int (*dummy (void)) [sizeof (struct verify_type__ {...})];
|
||||
|
||||
In the second and sixth case, the struct type is exported to the
|
||||
outer scope; two such declarations therefore collide. GCC warns
|
||||
about the first, third, and fourth cases. So the only remaining
|
||||
possibility is the fifth case:
|
||||
|
||||
extern int (*dummy (void)) [sizeof (struct {...})];
|
||||
|
||||
* This implementation exploits the fact that GCC does not warn about
|
||||
the last declaration mentioned above. If a future version of GCC
|
||||
introduces a warning for this, the problem could be worked around
|
||||
by using code specialized to GCC, e.g.,:
|
||||
|
||||
#if 4 <= __GNUC__
|
||||
# define verify(R) \
|
||||
extern int (* verify_function__ (void)) \
|
||||
[__builtin_constant_p (R) && (R) ? 1 : -1]
|
||||
#endif
|
||||
|
||||
* In C++, any struct definition inside sizeof is invalid.
|
||||
Use a template type to work around the problem. */
|
||||
|
||||
|
||||
/* Verify requirement R at compile-time, as an integer constant expression.
|
||||
Return 1. */
|
||||
|
||||
# ifdef __cplusplus
|
||||
template <int w>
|
||||
struct verify_type__ { unsigned int verify_error_if_negative_size__: w; };
|
||||
# define verify_true(R) \
|
||||
(!!sizeof (verify_type__<(R) ? 1 : -1>))
|
||||
# else
|
||||
# define verify_true(R) \
|
||||
(!!sizeof \
|
||||
(struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
|
||||
# endif
|
||||
|
||||
/* Verify requirement R at compile-time, as a declaration without a
|
||||
trailing ';'. */
|
||||
|
||||
# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)]
|
||||
|
||||
#endif
|
||||
310
lib/wchar.in.h
310
lib/wchar.in.h
@@ -1,310 +0,0 @@
|
||||
/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
|
||||
|
||||
Copyright (C) 2007-2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Eric Blake. */
|
||||
|
||||
/*
|
||||
* ISO C 99 <wchar.h> for platforms that have issues.
|
||||
* <http://www.opengroup.org/susv3xbd/wchar.h.html>
|
||||
*
|
||||
* For now, this just ensures proper prerequisite inclusion order and
|
||||
* the declaration of wcwidth().
|
||||
*/
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
|
||||
#if defined __need_mbstate_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
|
||||
/* Special invocation convention:
|
||||
- Inside uClibc header files.
|
||||
- On HP-UX 11.00 we have a sequence of nested includes
|
||||
<wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
|
||||
once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
|
||||
and once directly. In both situations 'wint_t' is not yet defined,
|
||||
therefore we cannot provide the function overrides; instead include only
|
||||
the system's <wchar.h>.
|
||||
- On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
|
||||
the latter includes <wchar.h>. But here, we have no way to detect whether
|
||||
<wctype.h> is completely included or is still being included. */
|
||||
|
||||
#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
|
||||
|
||||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _GL_WCHAR_H
|
||||
|
||||
#define _GL_ALREADY_INCLUDING_WCHAR_H
|
||||
|
||||
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
||||
<wchar.h>.
|
||||
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
||||
included before <wchar.h>. */
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
/* Include the original <wchar.h> if it exists.
|
||||
Some builds of uClibc lack it. */
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#if @HAVE_WCHAR_H@
|
||||
# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
|
||||
#endif
|
||||
|
||||
#undef _GL_ALREADY_INCLUDING_WCHAR_H
|
||||
|
||||
#ifndef _GL_WCHAR_H
|
||||
#define _GL_WCHAR_H
|
||||
|
||||
/* The definition of GL_LINK_WARNING is copied here. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Define wint_t. (Also done in wctype.in.h.) */
|
||||
#if !@HAVE_WINT_T@ && !defined wint_t
|
||||
# define wint_t int
|
||||
# ifndef WEOF
|
||||
# define WEOF -1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Override mbstate_t if it is too small.
|
||||
On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
|
||||
implementing mbrtowc for encodings like UTF-8. */
|
||||
#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
|
||||
typedef int rpl_mbstate_t;
|
||||
# undef mbstate_t
|
||||
# define mbstate_t rpl_mbstate_t
|
||||
# define GNULIB_defined_mbstate_t 1
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a single-byte character to a wide character. */
|
||||
#if @GNULIB_BTOWC@
|
||||
# if @REPLACE_BTOWC@
|
||||
# undef btowc
|
||||
# define btowc rpl_btowc
|
||||
# endif
|
||||
# if !@HAVE_BTOWC@ || @REPLACE_BTOWC@
|
||||
extern wint_t btowc (int c);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef btowc
|
||||
# define btowc(c) \
|
||||
(GL_LINK_WARNING ("btowc is unportable - " \
|
||||
"use gnulib module btowc for portability"), \
|
||||
btowc (c))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a wide character to a single-byte character. */
|
||||
#if @GNULIB_WCTOB@
|
||||
# if @REPLACE_WCTOB@
|
||||
# undef wctob
|
||||
# define wctob rpl_wctob
|
||||
# endif
|
||||
# if (!defined wctob && !@HAVE_DECL_WCTOB@) || @REPLACE_WCTOB@
|
||||
/* wctob is provided by gnulib, or wctob exists but is not declared. */
|
||||
extern int wctob (wint_t wc);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef wctob
|
||||
# define wctob(w) \
|
||||
(GL_LINK_WARNING ("wctob is unportable - " \
|
||||
"use gnulib module wctob for portability"), \
|
||||
wctob (w))
|
||||
#endif
|
||||
|
||||
|
||||
/* Test whether *PS is in the initial state. */
|
||||
#if @GNULIB_MBSINIT@
|
||||
# if @REPLACE_MBSINIT@
|
||||
# undef mbsinit
|
||||
# define mbsinit rpl_mbsinit
|
||||
# endif
|
||||
# if !@HAVE_MBSINIT@ || @REPLACE_MBSINIT@
|
||||
extern int mbsinit (const mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mbsinit
|
||||
# define mbsinit(p) \
|
||||
(GL_LINK_WARNING ("mbsinit is unportable - " \
|
||||
"use gnulib module mbsinit for portability"), \
|
||||
mbsinit (p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a multibyte character to a wide character. */
|
||||
#if @GNULIB_MBRTOWC@
|
||||
# if @REPLACE_MBRTOWC@
|
||||
# undef mbrtowc
|
||||
# define mbrtowc rpl_mbrtowc
|
||||
# endif
|
||||
# if !@HAVE_MBRTOWC@ || @REPLACE_MBRTOWC@
|
||||
extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mbrtowc
|
||||
# define mbrtowc(w,s,n,p) \
|
||||
(GL_LINK_WARNING ("mbrtowc is unportable - " \
|
||||
"use gnulib module mbrtowc for portability"), \
|
||||
mbrtowc (w, s, n, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Recognize a multibyte character. */
|
||||
#if @GNULIB_MBRLEN@
|
||||
# if @REPLACE_MBRLEN@
|
||||
# undef mbrlen
|
||||
# define mbrlen rpl_mbrlen
|
||||
# endif
|
||||
# if !@HAVE_MBRLEN@ || @REPLACE_MBRLEN@
|
||||
extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mbrlen
|
||||
# define mbrlen(s,n,p) \
|
||||
(GL_LINK_WARNING ("mbrlen is unportable - " \
|
||||
"use gnulib module mbrlen for portability"), \
|
||||
mbrlen (s, n, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a string to a wide string. */
|
||||
#if @GNULIB_MBSRTOWCS@
|
||||
# if @REPLACE_MBSRTOWCS@
|
||||
# undef mbsrtowcs
|
||||
# define mbsrtowcs rpl_mbsrtowcs
|
||||
# endif
|
||||
# if !@HAVE_MBSRTOWCS@ || @REPLACE_MBSRTOWCS@
|
||||
extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mbsrtowcs
|
||||
# define mbsrtowcs(d,s,l,p) \
|
||||
(GL_LINK_WARNING ("mbsrtowcs is unportable - " \
|
||||
"use gnulib module mbsrtowcs for portability"), \
|
||||
mbsrtowcs (d, s, l, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a string to a wide string. */
|
||||
#if @GNULIB_MBSNRTOWCS@
|
||||
# if @REPLACE_MBSNRTOWCS@
|
||||
# undef mbsnrtowcs
|
||||
# define mbsnrtowcs rpl_mbsnrtowcs
|
||||
# endif
|
||||
# if !@HAVE_MBSNRTOWCS@ || @REPLACE_MBSNRTOWCS@
|
||||
extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mbsnrtowcs
|
||||
# define mbsnrtowcs(d,s,n,l,p) \
|
||||
(GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
|
||||
"use gnulib module mbsnrtowcs for portability"), \
|
||||
mbsnrtowcs (d, s, n, l, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a wide character to a multibyte character. */
|
||||
#if @GNULIB_WCRTOMB@
|
||||
# if @REPLACE_WCRTOMB@
|
||||
# undef wcrtomb
|
||||
# define wcrtomb rpl_wcrtomb
|
||||
# endif
|
||||
# if !@HAVE_WCRTOMB@ || @REPLACE_WCRTOMB@
|
||||
extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef wcrtomb
|
||||
# define wcrtomb(s,w,p) \
|
||||
(GL_LINK_WARNING ("wcrtomb is unportable - " \
|
||||
"use gnulib module wcrtomb for portability"), \
|
||||
wcrtomb (s, w, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a wide string to a string. */
|
||||
#if @GNULIB_WCSRTOMBS@
|
||||
# if @REPLACE_WCSRTOMBS@
|
||||
# undef wcsrtombs
|
||||
# define wcsrtombs rpl_wcsrtombs
|
||||
# endif
|
||||
# if !@HAVE_WCSRTOMBS@ || @REPLACE_WCSRTOMBS@
|
||||
extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef wcsrtombs
|
||||
# define wcsrtombs(d,s,l,p) \
|
||||
(GL_LINK_WARNING ("wcsrtombs is unportable - " \
|
||||
"use gnulib module wcsrtombs for portability"), \
|
||||
wcsrtombs (d, s, l, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert a wide string to a string. */
|
||||
#if @GNULIB_WCSNRTOMBS@
|
||||
# if @REPLACE_WCSNRTOMBS@
|
||||
# undef wcsnrtombs
|
||||
# define wcsnrtombs rpl_wcsnrtombs
|
||||
# endif
|
||||
# if !@HAVE_WCSNRTOMBS@ || @REPLACE_WCSNRTOMBS@
|
||||
extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef wcsnrtombs
|
||||
# define wcsnrtombs(d,s,n,l,p) \
|
||||
(GL_LINK_WARNING ("wcsnrtombs is unportable - " \
|
||||
"use gnulib module wcsnrtombs for portability"), \
|
||||
wcsnrtombs (d, s, n, l, p))
|
||||
#endif
|
||||
|
||||
|
||||
/* Return the number of screen columns needed for WC. */
|
||||
#if @GNULIB_WCWIDTH@
|
||||
# if @REPLACE_WCWIDTH@
|
||||
# undef wcwidth
|
||||
# define wcwidth rpl_wcwidth
|
||||
extern int wcwidth (wchar_t);
|
||||
# else
|
||||
# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@
|
||||
/* wcwidth exists but is not declared. */
|
||||
extern int wcwidth (int /* actually wchar_t */);
|
||||
# endif
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef wcwidth
|
||||
# define wcwidth(w) \
|
||||
(GL_LINK_WARNING ("wcwidth is unportable - " \
|
||||
"use gnulib module wcwidth for portability"), \
|
||||
wcwidth (w))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GL_WCHAR_H */
|
||||
#endif /* _GL_WCHAR_H */
|
||||
#endif
|
||||
184
lib/wctype.in.h
184
lib/wctype.in.h
@@ -1,184 +0,0 @@
|
||||
/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
|
||||
|
||||
Copyright (C) 2006, 2007, 2008, 2009 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Bruno Haible and Paul Eggert. */
|
||||
|
||||
/*
|
||||
* ISO C 99 <wctype.h> for platforms that lack it.
|
||||
* <http://www.opengroup.org/susv3xbd/wctype.h.html>
|
||||
*
|
||||
* iswctype, towctrans, towlower, towupper, wctrans, wctype,
|
||||
* wctrans_t, and wctype_t are not yet implemented.
|
||||
*/
|
||||
|
||||
#ifndef _GL_WCTYPE_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
|
||||
#if @HAVE_WINT_T@
|
||||
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
|
||||
Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
||||
<wchar.h>.
|
||||
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
||||
included before <wchar.h>. */
|
||||
# include <stddef.h>
|
||||
# include <stdio.h>
|
||||
# include <time.h>
|
||||
# include <wchar.h>
|
||||
#endif
|
||||
|
||||
/* Include the original <wctype.h> if it exists.
|
||||
BeOS 5 has the functions but no <wctype.h>. */
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#if @HAVE_WCTYPE_H@
|
||||
# @INCLUDE_NEXT@ @NEXT_WCTYPE_H@
|
||||
#endif
|
||||
|
||||
#ifndef _GL_WCTYPE_H
|
||||
#define _GL_WCTYPE_H
|
||||
|
||||
/* Define wint_t. (Also done in wchar.in.h.) */
|
||||
#if !@HAVE_WINT_T@ && !defined wint_t
|
||||
# define wint_t int
|
||||
# ifndef WEOF
|
||||
# define WEOF -1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
|
||||
Linux libc5 has <wctype.h> and the functions but they are broken.
|
||||
Assume all 12 functions are implemented the same way, or not at all. */
|
||||
#if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
|
||||
|
||||
/* IRIX 5.3 has macros but no functions, its isw* macros refer to an
|
||||
undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
|
||||
refer to system functions like _iswctype that are not in the
|
||||
standard C library. Rather than try to get ancient buggy
|
||||
implementations like this to work, just disable them. */
|
||||
# undef iswalnum
|
||||
# undef iswalpha
|
||||
# undef iswblank
|
||||
# undef iswcntrl
|
||||
# undef iswdigit
|
||||
# undef iswgraph
|
||||
# undef iswlower
|
||||
# undef iswprint
|
||||
# undef iswpunct
|
||||
# undef iswspace
|
||||
# undef iswupper
|
||||
# undef iswxdigit
|
||||
|
||||
/* Linux libc5 has <wctype.h> and the functions but they are broken. */
|
||||
# if @REPLACE_ISWCNTRL@
|
||||
# define iswalnum rpl_iswalnum
|
||||
# define iswalpha rpl_iswalpha
|
||||
# define iswblank rpl_iswblank
|
||||
# define iswcntrl rpl_iswcntrl
|
||||
# define iswdigit rpl_iswdigit
|
||||
# define iswgraph rpl_iswgraph
|
||||
# define iswlower rpl_iswlower
|
||||
# define iswprint rpl_iswprint
|
||||
# define iswpunct rpl_iswpunct
|
||||
# define iswspace rpl_iswspace
|
||||
# define iswupper rpl_iswupper
|
||||
# define iswxdigit rpl_iswxdigit
|
||||
# endif
|
||||
|
||||
static inline int
|
||||
iswalnum (wint_t wc)
|
||||
{
|
||||
return ((wc >= '0' && wc <= '9')
|
||||
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
|
||||
}
|
||||
|
||||
static inline int
|
||||
iswalpha (wint_t wc)
|
||||
{
|
||||
return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
|
||||
}
|
||||
|
||||
static inline int
|
||||
iswblank (wint_t wc)
|
||||
{
|
||||
return wc == ' ' || wc == '\t';
|
||||
}
|
||||
|
||||
static inline int
|
||||
iswcntrl (wint_t wc)
|
||||
{
|
||||
return (wc & ~0x1f) == 0 || wc == 0x7f;
|
||||
}
|
||||
|
||||
static inline int
|
||||
iswdigit (wint_t wc)
|
||||
{
|
||||
return wc >= '0' && wc <= '9';
|
||||
}
|
||||
|
||||
static inline int
|
||||
iswgraph (wint_t wc)
|
||||
{
|
||||
return wc >= '!' && wc <= '~';
|
||||
}
|
||||
|
||||
static inline int
|
||||
iswlower (wint_t wc)
|
||||
{
|
||||
return wc >= 'a' && wc <= 'z';
|
||||
}
|
||||
|
||||
static inline int
|
||||
iswprint (wint_t wc)
|
||||
{
|
||||
return wc >= ' ' && wc <= '~';
|
||||
}
|
||||
|
||||
static inline int
|
||||
iswpunct (wint_t wc)
|
||||
{
|
||||
return (wc >= '!' && wc <= '~'
|
||||
&& !((wc >= '0' && wc <= '9')
|
||||
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
|
||||
}
|
||||
|
||||
static inline int
|
||||
iswspace (wint_t wc)
|
||||
{
|
||||
return (wc == ' ' || wc == '\t'
|
||||
|| wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
|
||||
}
|
||||
|
||||
static inline int
|
||||
iswupper (wint_t wc)
|
||||
{
|
||||
return wc >= 'A' && wc <= 'Z';
|
||||
}
|
||||
|
||||
static inline int
|
||||
iswxdigit (wint_t wc)
|
||||
{
|
||||
return ((wc >= '0' && wc <= '9')
|
||||
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
|
||||
}
|
||||
|
||||
# endif /* ! HAVE_ISWCNTRL */
|
||||
|
||||
#endif /* _GL_WCTYPE_H */
|
||||
#endif /* _GL_WCTYPE_H */
|
||||
@@ -1,41 +0,0 @@
|
||||
/* Report a memory allocation failure and exit.
|
||||
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2009
|
||||
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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "xalloc.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "error.h"
|
||||
#include "exitfail.h"
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
void
|
||||
xalloc_die (void)
|
||||
{
|
||||
error (exit_failure, 0, "%s", _("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 not return, call abort. Also, the abort is a
|
||||
safety feature if exit_failure is 0 (which shouldn't happen). */
|
||||
abort ();
|
||||
}
|
||||
281
lib/xalloc.h
281
lib/xalloc.h
@@ -1,281 +0,0 @@
|
||||
/* xalloc.h -- malloc with out-of-memory checking
|
||||
|
||||
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||
1999, 2000, 2003, 2004, 2006, 2007, 2008, 2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef XALLOC_H_
|
||||
# define XALLOC_H_
|
||||
|
||||
# include <stddef.h>
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
|
||||
# ifndef __attribute__
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
|
||||
# define __attribute__(x)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef ATTRIBUTE_NORETURN
|
||||
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
|
||||
# endif
|
||||
|
||||
# ifndef ATTRIBUTE_MALLOC
|
||||
# if __GNUC__ >= 3
|
||||
# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
|
||||
# else
|
||||
# define ATTRIBUTE_MALLOC
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* This function is always triggered when memory is exhausted.
|
||||
It must be defined by the application, either explicitly
|
||||
or by using gnulib's xalloc-die module. This is the
|
||||
function to call when one wants the program to die because of a
|
||||
memory allocation failure. */
|
||||
extern void xalloc_die (void) ATTRIBUTE_NORETURN;
|
||||
|
||||
void *xmalloc (size_t s) ATTRIBUTE_MALLOC;
|
||||
void *xzalloc (size_t s) ATTRIBUTE_MALLOC;
|
||||
void *xcalloc (size_t n, size_t s) ATTRIBUTE_MALLOC;
|
||||
void *xrealloc (void *p, size_t s);
|
||||
void *x2realloc (void *p, size_t *pn);
|
||||
void *xmemdup (void const *p, size_t s) ATTRIBUTE_MALLOC;
|
||||
char *xstrdup (char const *str) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* 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.
|
||||
|
||||
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))
|
||||
|
||||
|
||||
/* In the following macros, T must be an elementary or structure/union or
|
||||
typedef'ed type, or a pointer to such a type. To apply one of the
|
||||
following macros to a function pointer or array type, you need to typedef
|
||||
it first and use the typedef name. */
|
||||
|
||||
/* Allocate an object of type T dynamically, with error checking. */
|
||||
/* extern t *XMALLOC (typename t); */
|
||||
# define XMALLOC(t) ((t *) xmalloc (sizeof (t)))
|
||||
|
||||
/* Allocate memory for N elements of type T, with error checking. */
|
||||
/* extern t *XNMALLOC (size_t n, typename t); */
|
||||
# define XNMALLOC(n, t) \
|
||||
((t *) (sizeof (t) == 1 ? xmalloc (n) : xnmalloc (n, sizeof (t))))
|
||||
|
||||
/* Allocate an object of type T dynamically, with error checking,
|
||||
and zero it. */
|
||||
/* extern t *XZALLOC (typename t); */
|
||||
# define XZALLOC(t) ((t *) xzalloc (sizeof (t)))
|
||||
|
||||
/* Allocate memory for N elements of type T, with error checking,
|
||||
and zero it. */
|
||||
/* extern t *XCALLOC (size_t n, typename t); */
|
||||
# define XCALLOC(n, t) \
|
||||
((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t))))
|
||||
|
||||
|
||||
# if HAVE_INLINE
|
||||
# define static_inline static inline
|
||||
# else
|
||||
void *xnmalloc (size_t n, size_t s) ATTRIBUTE_MALLOC;
|
||||
void *xnrealloc (void *p, size_t n, size_t s);
|
||||
void *x2nrealloc (void *p, size_t *pn, size_t s);
|
||||
char *xcharalloc (size_t n) ATTRIBUTE_MALLOC;
|
||||
# endif
|
||||
|
||||
# ifdef static_inline
|
||||
|
||||
/* Allocate an array of N objects, each with S bytes of memory,
|
||||
dynamically, with error checking. S must be nonzero. */
|
||||
|
||||
static_inline void *xnmalloc (size_t n, size_t s) ATTRIBUTE_MALLOC;
|
||||
static_inline void *
|
||||
xnmalloc (size_t n, size_t s)
|
||||
{
|
||||
if (xalloc_oversized (n, s))
|
||||
xalloc_die ();
|
||||
return xmalloc (n * s);
|
||||
}
|
||||
|
||||
/* 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 (void *p, size_t n, size_t s)
|
||||
{
|
||||
if (xalloc_oversized (n, s))
|
||||
xalloc_die ();
|
||||
return xrealloc (p, n * s);
|
||||
}
|
||||
|
||||
/* 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 increased by a
|
||||
factor of approximately 1.5 so that repeated reallocations have
|
||||
O(N) overall cost rather than O(N**2) cost, but the
|
||||
specification for this function does not guarantee that rate.
|
||||
|
||||
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 (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
|
||||
{
|
||||
/* Set N = ceil (1.5 * N) so that progress is made if N == 1.
|
||||
Check for overflow, so that N * S stays in size_t range.
|
||||
The check is slightly conservative, but an exact check isn't
|
||||
worth the trouble. */
|
||||
if ((size_t) -1 / 3 * 2 / s <= n)
|
||||
xalloc_die ();
|
||||
n += (n + 1) / 2;
|
||||
}
|
||||
|
||||
*pn = n;
|
||||
return xrealloc (p, n * s);
|
||||
}
|
||||
|
||||
/* Return a pointer to a new buffer of N bytes. This is like xmalloc,
|
||||
except it returns char *. */
|
||||
|
||||
static_inline char *xcharalloc (size_t n) ATTRIBUTE_MALLOC;
|
||||
static_inline char *
|
||||
xcharalloc (size_t n)
|
||||
{
|
||||
return XNMALLOC (n, char);
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
|
||||
/* C++ does not allow conversions from void * to other pointer types
|
||||
without a cast. Use templates to work around the problem when
|
||||
possible. */
|
||||
|
||||
template <typename T> inline T *
|
||||
xrealloc (T *p, size_t s)
|
||||
{
|
||||
return (T *) xrealloc ((void *) p, s);
|
||||
}
|
||||
|
||||
template <typename T> inline T *
|
||||
xnrealloc (T *p, size_t n, size_t s)
|
||||
{
|
||||
return (T *) xnrealloc ((void *) p, n, s);
|
||||
}
|
||||
|
||||
template <typename T> inline T *
|
||||
x2realloc (T *p, size_t *pn)
|
||||
{
|
||||
return (T *) x2realloc ((void *) p, pn);
|
||||
}
|
||||
|
||||
template <typename T> inline T *
|
||||
x2nrealloc (T *p, size_t *pn, size_t s)
|
||||
{
|
||||
return (T *) x2nrealloc ((void *) p, pn, s);
|
||||
}
|
||||
|
||||
template <typename T> inline T *
|
||||
xmemdup (T const *p, size_t s)
|
||||
{
|
||||
return (T *) xmemdup ((void const *) p, s);
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
|
||||
#endif /* !XALLOC_H_ */
|
||||
118
lib/xmalloc.c
118
lib/xmalloc.c
@@ -1,118 +0,0 @@
|
||||
/* xmalloc.c -- malloc with out of memory checking
|
||||
|
||||
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||
1999, 2000, 2002, 2003, 2004, 2005, 2006, 2008-2009 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if ! HAVE_INLINE
|
||||
# define static_inline
|
||||
#endif
|
||||
#include "xalloc.h"
|
||||
#undef static_inline
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* 1 if calloc is known to be compatible with GNU calloc. This
|
||||
matters if we are not also using the calloc module, which defines
|
||||
HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */
|
||||
#if defined HAVE_CALLOC || defined __GLIBC__
|
||||
enum { HAVE_GNU_CALLOC = 1 };
|
||||
#else
|
||||
enum { HAVE_GNU_CALLOC = 0 };
|
||||
#endif
|
||||
|
||||
/* Allocate N bytes of memory dynamically, with error checking. */
|
||||
|
||||
void *
|
||||
xmalloc (size_t n)
|
||||
{
|
||||
void *p = malloc (n);
|
||||
if (!p && n != 0)
|
||||
xalloc_die ();
|
||||
return p;
|
||||
}
|
||||
|
||||
/* 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 && n != 0)
|
||||
xalloc_die ();
|
||||
return p;
|
||||
}
|
||||
|
||||
/* 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 (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;
|
||||
/* Test for overflow, since some calloc implementations don't have
|
||||
proper overflow checks. But omit overflow and size-zero tests if
|
||||
HAVE_GNU_CALLOC, since GNU calloc catches overflow and never
|
||||
returns NULL if successful. */
|
||||
if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s))
|
||||
|| (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0)))
|
||||
xalloc_die ();
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Clone an object P of size S, with error checking. There's no need
|
||||
for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any
|
||||
need for an arithmetic overflow check. */
|
||||
|
||||
void *
|
||||
xmemdup (void const *p, size_t s)
|
||||
{
|
||||
return memcpy (xmalloc (s), p, s);
|
||||
}
|
||||
|
||||
/* Clone STRING. */
|
||||
|
||||
char *
|
||||
xstrdup (char const *string)
|
||||
{
|
||||
return xmemdup (string, strlen (string) + 1);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
# 00gnulib.m4 serial 2
|
||||
dnl Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This file must be named something that sorts before all other
|
||||
dnl gnulib-provided .m4 files. It is needed until such time as we can
|
||||
dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics.
|
||||
|
||||
# AC_DEFUN_ONCE([NAME], VALUE)
|
||||
# ----------------------------
|
||||
# Define NAME to expand to VALUE on the first use (whether by direct
|
||||
# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses.
|
||||
# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This
|
||||
# definition is slower than the version in Autoconf 2.64, because it
|
||||
# can only use interfaces that existed since 2.59; but it achieves the
|
||||
# same effect. Quoting is necessary to avoid confusing Automake.
|
||||
m4_version_prereq([2.63.263], [],
|
||||
[m4_define([AC][_DEFUN_ONCE],
|
||||
[AC][_DEFUN([$1],
|
||||
[AC_REQUIRE([_gl_DEFUN_ONCE([$1])],
|
||||
[m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl
|
||||
[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])])
|
||||
|
||||
# gl_00GNULIB
|
||||
# -----------
|
||||
# Witness macro that this file has been included. Needed to force
|
||||
# Automake to include this file prior to all other gnulib .m4 files.
|
||||
AC_DEFUN([gl_00GNULIB])
|
||||
46
m4/alloca.m4
46
m4/alloca.m4
@@ -1,46 +0,0 @@
|
||||
# alloca.m4 serial 9
|
||||
dnl Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FUNC_ALLOCA],
|
||||
[
|
||||
dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
|
||||
AC_REQUIRE([AC_PROG_CPP])
|
||||
AC_REQUIRE([AC_PROG_EGREP])
|
||||
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])
|
||||
if test $ac_cv_func_alloca_works = no; then
|
||||
gl_PREREQ_ALLOCA
|
||||
fi
|
||||
|
||||
# Define an additional variable used in the Makefile substitution.
|
||||
if test $ac_cv_working_alloca_h = yes; then
|
||||
AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [
|
||||
AC_EGREP_CPP([Need own alloca], [
|
||||
#if defined __GNUC__ || defined _AIX || defined _MSC_VER
|
||||
Need own alloca
|
||||
#endif
|
||||
], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no])
|
||||
])
|
||||
if test $gl_cv_rpl_alloca = yes; then
|
||||
dnl OK, alloca can be implemented through a compiler built-in.
|
||||
AC_DEFINE([HAVE_ALLOCA], [1],
|
||||
[Define to 1 if you have 'alloca' after including <alloca.h>,
|
||||
a header that may be supplied by this distribution.])
|
||||
ALLOCA_H=alloca.h
|
||||
else
|
||||
dnl alloca exists as a library function, i.e. it is slow and probably
|
||||
dnl a memory leak. Don't define HAVE_ALLOCA in this case.
|
||||
ALLOCA_H=
|
||||
fi
|
||||
else
|
||||
ALLOCA_H=alloca.h
|
||||
fi
|
||||
AC_SUBST([ALLOCA_H])
|
||||
])
|
||||
|
||||
# Prerequisites of lib/alloca.c.
|
||||
# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
|
||||
AC_DEFUN([gl_PREREQ_ALLOCA], [:])
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user