mirror of
https://github.com/mirror/wget.git
synced 2026-08-20 01:43:29 +08:00
Compare commits
1173 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba6b44f674 | ||
|
|
d892291fb8 | ||
|
|
bec4c215a8 | ||
|
|
27d78d944f | ||
|
|
60f033426f | ||
|
|
6f3b995993 | ||
|
|
c451eec155 | ||
|
|
b543dfe783 | ||
|
|
08ed2a5530 | ||
|
|
951d3e4cdd | ||
|
|
3ad3b3e36c | ||
|
|
5fb6b6bd68 | ||
|
|
f42229b1fd | ||
|
|
21154bdc36 | ||
|
|
ae293c945a | ||
|
|
407c1f990a | ||
|
|
86b46a34a5 | ||
|
|
5d4ada1b7b | ||
|
|
876def8ebe | ||
|
|
f8c3df1f40 | ||
|
|
17960b57d5 | ||
|
|
40c0d30f5c | ||
|
|
e2c702571f | ||
|
|
269fb6201d | ||
|
|
c08778aeb3 | ||
|
|
297c1e2ac3 | ||
|
|
936efc3564 | ||
|
|
11d3de74ca | ||
|
|
35d5b67cc1 | ||
|
|
da50a1ecc3 | ||
|
|
1068ca07d3 | ||
|
|
0666e0f375 | ||
|
|
0d9f8280e0 | ||
|
|
17f0e16ecc | ||
|
|
cc74f8b7e2 | ||
|
|
2894a37189 | ||
|
|
4669ba5e0c | ||
|
|
b5c2d083ea | ||
|
|
466afc62b0 | ||
|
|
f68d001626 | ||
|
|
ffe75d0867 | ||
|
|
9aa894853f | ||
|
|
5337b94ce5 | ||
|
|
a26e6f3527 | ||
|
|
b9fb74ddfa | ||
|
|
3132049ae4 | ||
|
|
c0c42da653 | ||
|
|
888cc82c9d | ||
|
|
fce1b689e8 | ||
|
|
580067d1e6 | ||
|
|
5c4cc011fe | ||
|
|
2a96249469 | ||
|
|
0b41c7543a | ||
|
|
c4a2b2e77e | ||
|
|
f6376ac0dc | ||
|
|
ac519c041e | ||
|
|
56c78c4b09 | ||
|
|
0ec46cb109 | ||
|
|
67cb37ce5a | ||
|
|
0004d3ec22 | ||
|
|
92bfe2a2e4 | ||
|
|
fc2f4233ed | ||
|
|
b2c38d33e1 | ||
|
|
6ef493b19e | ||
|
|
7ffe93cabb | ||
|
|
f381831d88 | ||
|
|
02d40a4676 | ||
|
|
e89267fbbc | ||
|
|
400b8eba6c | ||
|
|
90a0a7499c | ||
|
|
1d71645c06 | ||
|
|
e249844143 | ||
|
|
84a93f4127 | ||
|
|
f31b93424b | ||
|
|
90b487369a | ||
|
|
57d748117f | ||
|
|
4d729e322f | ||
|
|
63c2aea255 | ||
|
|
ac4fed3220 | ||
|
|
cf5df5593d | ||
|
|
2215ee8d10 | ||
|
|
32e26dc199 | ||
|
|
21ac4ae356 | ||
|
|
838c185ca9 | ||
|
|
ac9be9b756 | ||
|
|
6620c5156f | ||
|
|
aebd49d9d4 | ||
|
|
d6d00006a0 | ||
|
|
05acf5d3f6 | ||
|
|
80c62c238e | ||
|
|
977276374d | ||
|
|
785c4b92dd | ||
|
|
d7c34dc0a8 | ||
|
|
d061e553a1 | ||
|
|
2ddd2b69e4 | ||
|
|
990f3d67d3 | ||
|
|
d680b0b551 | ||
|
|
31ac36e170 | ||
|
|
51b401f5c4 | ||
|
|
f2c4289557 | ||
|
|
58546e52e2 | ||
|
|
820f3fc2b4 | ||
|
|
cc8464206d | ||
|
|
366d82f349 | ||
|
|
f2574e90b7 | ||
|
|
81b3aaf75c | ||
|
|
17d2f42a3d | ||
|
|
638df40476 | ||
|
|
00bafe72f1 | ||
|
|
e777c01f43 | ||
|
|
3ba112ea57 | ||
|
|
485fcfcc20 | ||
|
|
a5094731cd | ||
|
|
3186eb2976 | ||
|
|
9947663af8 | ||
|
|
cfae085665 | ||
|
|
e69808256b | ||
|
|
11989ef669 | ||
|
|
5fceab6cb9 | ||
|
|
d6eead1794 | ||
|
|
d0e02a54ae | ||
|
|
2e70409844 | ||
|
|
4734e8d4d7 | ||
|
|
0fe8a5c40e | ||
|
|
1b9374ee59 | ||
|
|
6de24fe3c0 | ||
|
|
0ab3d92c85 | ||
|
|
4cf8af84e0 | ||
|
|
42b8761cbc | ||
|
|
fd0f759597 | ||
|
|
a384f5e2e9 | ||
|
|
5ae1f37902 | ||
|
|
0eb4a21b6c | ||
|
|
60dc3c21b2 | ||
|
|
1a01a6b2d0 | ||
|
|
2427ca4ac0 | ||
|
|
42c2ce71bc | ||
|
|
def133f26f | ||
|
|
b9ed06afd8 | ||
|
|
1bdc20d774 | ||
|
|
e4e9d3c1c8 | ||
|
|
dcdd618b18 | ||
|
|
3c796b9a85 | ||
|
|
00ae9b4ee2 | ||
|
|
2242d5aee4 | ||
|
|
77a546348c | ||
|
|
be5517f98f | ||
|
|
dd5c549f6a | ||
|
|
78e0ec5f03 | ||
|
|
807d1c7d94 | ||
|
|
3d1d5b317b | ||
|
|
517d799b6f | ||
|
|
f79bb20f1b | ||
|
|
e5164a8260 | ||
|
|
a35f3dd4f6 | ||
|
|
c403e67935 | ||
|
|
3021466817 | ||
|
|
c89767d8d1 | ||
|
|
f030cdf8e2 | ||
|
|
5dccb2a9ce | ||
|
|
0538e791fb | ||
|
|
acb1d1a668 | ||
|
|
628fb565c7 | ||
|
|
64ab90ee66 | ||
|
|
9532861aef | ||
|
|
8aca8fc80d | ||
|
|
ba82a47173 | ||
|
|
70360b3eab | ||
|
|
c29983a044 | ||
|
|
5f3ed5eec8 | ||
|
|
43ec7008f2 | ||
|
|
7d4942864b | ||
|
|
666b7862bf | ||
|
|
f3f349a0cf | ||
|
|
6b1860da37 | ||
|
|
ff444ebc2a | ||
|
|
96554861f9 | ||
|
|
bcb9bf7ae4 | ||
|
|
ea038006d1 | ||
|
|
77e2c54991 | ||
|
|
7ffbccec4c | ||
|
|
a2c4849900 | ||
|
|
40870e1271 | ||
|
|
15c1e0eb7b | ||
|
|
eba724a128 | ||
|
|
66a9883c8f | ||
|
|
4febe72bd2 | ||
|
|
c629ec7fd1 | ||
|
|
03da900c5b | ||
|
|
b7b67e23cd | ||
|
|
22aed3ed4b | ||
|
|
b4465afa8a | ||
|
|
a232835fd1 | ||
|
|
a78b83b1e9 | ||
|
|
37a5257c66 | ||
|
|
49af22ca94 | ||
|
|
d505714a32 | ||
|
|
21e1725e12 | ||
|
|
796e30dcea | ||
|
|
b919f988f2 | ||
|
|
ca1ee7d32f | ||
|
|
690c47e3b1 | ||
|
|
9ffb64ba6a | ||
|
|
6698260f15 | ||
|
|
0787d7253e | ||
|
|
964f4646da | ||
|
|
262baeb113 | ||
|
|
f4aeb41899 | ||
|
|
a9d49e5b15 | ||
|
|
0fe79eeacb | ||
|
|
e3fb4c3859 | ||
|
|
943a6d585f | ||
|
|
7fad76db4c | ||
|
|
3e7e29f358 | ||
|
|
e0b60fd073 | ||
|
|
9db02a0c46 | ||
|
|
edad3c1df3 | ||
|
|
20cac2c5ab | ||
|
|
a933bdd31e | ||
|
|
ef372a4f27 | ||
|
|
0b151f51eb | ||
|
|
309e72c74f | ||
|
|
2318c309d4 | ||
|
|
cdc3e28d8e | ||
|
|
43359f47c4 | ||
|
|
e1e7afb210 | ||
|
|
7e585fe23d | ||
|
|
526e98f7c4 | ||
|
|
d75f43f083 | ||
|
|
d4f97dc9af | ||
|
|
ade62eb400 | ||
|
|
bd7f36705b | ||
|
|
e996e322ff | ||
|
|
2bdfc4f521 | ||
|
|
2c736abb4c | ||
|
|
7c0752c4cb | ||
|
|
302aa79abb | ||
|
|
5224d752a5 | ||
|
|
2aaf12990c | ||
|
|
2e6f629061 | ||
|
|
a952f81f3e | ||
|
|
42cc84b6b6 | ||
|
|
96ab9cad88 | ||
|
|
268163444d | ||
|
|
53800415a9 | ||
|
|
528770ca8b | ||
|
|
2f1c6a05c8 | ||
|
|
33d860e1ef | ||
|
|
99fc712f21 | ||
|
|
54746578e9 | ||
|
|
926e42d467 | ||
|
|
d286d5408b | ||
|
|
9883f9fb10 | ||
|
|
d26377053d | ||
|
|
722675553c | ||
|
|
281ad7dfb9 | ||
|
|
f3e63f0071 | ||
|
|
b916595168 | ||
|
|
76ef65b23c | ||
|
|
d7726f8a13 | ||
|
|
598445ebd1 | ||
|
|
7cb9efa668 | ||
|
|
44aedd8321 | ||
|
|
c28f51aadf | ||
|
|
7099f48998 | ||
|
|
75e5be7aad | ||
|
|
100da11312 | ||
|
|
cceb5932b4 | ||
|
|
cacac6f996 | ||
|
|
3056617e9c | ||
|
|
c190677cab | ||
|
|
4c2dc5010f | ||
|
|
b30500f0f4 | ||
|
|
59b920874d | ||
|
|
9a6e63bee9 | ||
|
|
cbbeca2af4 | ||
|
|
93c1517c40 | ||
|
|
bf5d7e9236 | ||
|
|
94d9b68db9 | ||
|
|
be7d19f478 | ||
|
|
358a3c330f | ||
|
|
478a584609 | ||
|
|
994c4dcce7 | ||
|
|
f65f522f58 | ||
|
|
be84711ea4 | ||
|
|
bf56bf4560 | ||
|
|
3eddf5c173 | ||
|
|
160f0e908f | ||
|
|
30b0705fa6 | ||
|
|
9933da2b9f | ||
|
|
df7cb9a1b9 | ||
|
|
636a5f9a1c | ||
|
|
44937634a3 | ||
|
|
2257d3ebf8 | ||
|
|
b0d2fa5748 | ||
|
|
ca0c272eae | ||
|
|
8977e63239 | ||
|
|
ad5a283528 | ||
|
|
3dd2e78256 | ||
|
|
81061571d1 | ||
|
|
4e37fb6191 | ||
|
|
218d81f6e5 | ||
|
|
46cd721c0f | ||
|
|
b1c7777037 | ||
|
|
8c12260d4b | ||
|
|
99aa7b4f5e | ||
|
|
76da642aaf | ||
|
|
2cfcadf5e6 | ||
|
|
08ece891b5 | ||
|
|
4ed540ddc7 | ||
|
|
d1a329536a | ||
|
|
2b418d1146 | ||
|
|
b041658451 | ||
|
|
6cdfc9c143 | ||
|
|
b14eeb5aee | ||
|
|
71979f1643 | ||
|
|
4ad201a7e7 | ||
|
|
3608c3001c | ||
|
|
d484b14174 | ||
|
|
b8ee370571 | ||
|
|
f5a63e3100 | ||
|
|
077e897819 | ||
|
|
1e7ccfe275 | ||
|
|
26fadc55c2 | ||
|
|
e51076e683 | ||
|
|
c387db6451 | ||
|
|
12dfc03116 | ||
|
|
3ea0beec6f | ||
|
|
b50300a7a2 | ||
|
|
f8901af4e0 | ||
|
|
e624732563 | ||
|
|
f2cb6e050a | ||
|
|
84b9abbf3c | ||
|
|
58917dcde1 | ||
|
|
ab47d9fa3a | ||
|
|
187edb604a | ||
|
|
b06fca60ac | ||
|
|
c809398e8c | ||
|
|
88a1a79bc1 | ||
|
|
398699c438 | ||
|
|
d3504b9261 | ||
|
|
6b5acff566 | ||
|
|
5c4489db9b | ||
|
|
7bed9a6f8f | ||
|
|
d080a70a3a | ||
|
|
2d2ddb25d8 | ||
|
|
030c3379d1 | ||
|
|
d3d8de8223 | ||
|
|
e04c5989ff | ||
|
|
12bae50b28 | ||
|
|
f71887bbe5 | ||
|
|
84c405e690 | ||
|
|
075d755696 | ||
|
|
7578e47d49 | ||
|
|
3a708f7ef8 | ||
|
|
474935665e | ||
|
|
f8519b52f0 | ||
|
|
98272d2c8d | ||
|
|
7e5079c40f | ||
|
|
e4db00d74d | ||
|
|
670eb924e7 | ||
|
|
5d55018ce6 | ||
|
|
4e56a91001 | ||
|
|
595f219a17 | ||
|
|
b6e242cd6f | ||
|
|
207006ef25 | ||
|
|
843634db59 | ||
|
|
54058d2b18 | ||
|
|
b60131a399 | ||
|
|
fc8a545bfd | ||
|
|
9e12b8ca39 | ||
|
|
4c3043d19d | ||
|
|
6064f21c66 | ||
|
|
97389a7497 | ||
|
|
225a87d4a2 | ||
|
|
92a889b278 | ||
|
|
1113e78534 | ||
|
|
70cbd59ed6 | ||
|
|
0e7aff7623 | ||
|
|
792dd09a87 | ||
|
|
a4f5ced797 | ||
|
|
05c30c3b1b | ||
|
|
37b58e3976 | ||
|
|
80303366ae | ||
|
|
bd0ffcf8bc | ||
|
|
25c9b462bf | ||
|
|
77f5a27e65 | ||
|
|
ae58d8a78b | ||
|
|
58702ffd4f | ||
|
|
103f940950 | ||
|
|
5f0818d9f1 | ||
|
|
c6ac51d5bc | ||
|
|
fd3a3245eb | ||
|
|
48acb6693d | ||
|
|
885eaaa214 | ||
|
|
8a8d138dcc | ||
|
|
0e8d2d4251 | ||
|
|
be4f91737a | ||
|
|
901bc98edf | ||
|
|
e397a48f6a | ||
|
|
83537f2415 | ||
|
|
8682c2612f | ||
|
|
b0820d553b | ||
|
|
b6b1388fb7 | ||
|
|
9b1dd6dab8 | ||
|
|
1cc835dc5b | ||
|
|
6b8dfe1d6e | ||
|
|
0e6d6ca963 | ||
|
|
3765a1b266 | ||
|
|
8654f7e2e7 | ||
|
|
566696cb82 | ||
|
|
bebe462a67 | ||
|
|
c579c7bf1e | ||
|
|
4dde3e200f | ||
|
|
8e0dd0d870 | ||
|
|
c6af2fddee | ||
|
|
e7e3227b34 | ||
|
|
5c5d45ae49 | ||
|
|
f4072e5d0b | ||
|
|
bef5945202 | ||
|
|
ac40b84ee1 | ||
|
|
45463eaad7 | ||
|
|
d03b40e31e | ||
|
|
268e6aef72 | ||
|
|
5efb24e4a2 | ||
|
|
eae8b1d565 | ||
|
|
045463b814 | ||
|
|
621c313b94 | ||
|
|
52a7d0ad85 | ||
|
|
59e9ef00e6 | ||
|
|
14bbc18512 | ||
|
|
8aa63e482e | ||
|
|
0bc2757713 | ||
|
|
f8abb9dd00 | ||
|
|
29850e77d0 | ||
|
|
799c545722 | ||
|
|
014b1d6041 | ||
|
|
8d4bb928b9 | ||
|
|
d0f406a13f | ||
|
|
87b52e510c | ||
|
|
cc9f76c5a4 | ||
|
|
53b22974cb | ||
|
|
7d5a7ef9ca | ||
|
|
735cc220e3 | ||
|
|
524f26a200 | ||
|
|
16f1fb1d1f | ||
|
|
b74ac4c7e0 | ||
|
|
91e9a20752 | ||
|
|
4a214bc9a3 | ||
|
|
b7b6d7fd89 | ||
|
|
3a00b37bc2 | ||
|
|
adcc793a26 | ||
|
|
d94d9cd98b | ||
|
|
882ed28d59 | ||
|
|
e316d253fa | ||
|
|
9dde436dd6 | ||
|
|
bf868e8840 | ||
|
|
5352eac8fa | ||
|
|
d419cd7c0c | ||
|
|
33c5d979ce | ||
|
|
9df2250f4c | ||
|
|
3d8e765c1d | ||
|
|
c83f344564 | ||
|
|
07a350d30c | ||
|
|
875d0819c4 | ||
|
|
b25fbe5afc | ||
|
|
4e8e159289 | ||
|
|
8705e27e20 | ||
|
|
a7e9a05a89 | ||
|
|
87f4fee8c9 | ||
|
|
5e3a760731 | ||
|
|
01d5177f7a | ||
|
|
103cbf1751 | ||
|
|
6f62bc5cd8 | ||
|
|
f6b28575cc | ||
|
|
5de8ab2a0b | ||
|
|
a8d437d827 | ||
|
|
fc336758ab | ||
|
|
9ee2fdd50d | ||
|
|
cfe7589397 | ||
|
|
15f18e7606 | ||
|
|
ee196f6fe5 | ||
|
|
0417ef8b50 | ||
|
|
56c0098063 | ||
|
|
712d607f9b | ||
|
|
32499e717d | ||
|
|
b147fb1638 | ||
|
|
365aeba704 | ||
|
|
b0893e84b3 | ||
|
|
f0de37cc27 | ||
|
|
05d73a926a | ||
|
|
ec5e0f421c | ||
|
|
0d9615292e | ||
|
|
6bc2620592 | ||
|
|
b0b1cde6e2 | ||
|
|
f37dd1aa2d | ||
|
|
b5778699f0 | ||
|
|
b8c567a3ef | ||
|
|
425368c602 | ||
|
|
1ca88a4208 | ||
|
|
26790c3583 | ||
|
|
fcd3b3c473 | ||
|
|
eb0789d43f | ||
|
|
ab2d5d83d2 | ||
|
|
cbaabe78e8 | ||
|
|
0a4826f4a1 | ||
|
|
71425f1bb3 | ||
|
|
f59dac3023 | ||
|
|
8b50cd4b61 | ||
|
|
a80986a8c9 | ||
|
|
94447e31a6 | ||
|
|
e6713474c0 | ||
|
|
aaefe8bc83 | ||
|
|
4b845615fa | ||
|
|
aeca2c33c0 | ||
|
|
11c6dcb705 | ||
|
|
ce088c2b9e | ||
|
|
d9ab65abd2 | ||
|
|
e4583ab364 | ||
|
|
4850e9c873 | ||
|
|
d9325f5db5 | ||
|
|
5d3b52d0b8 | ||
|
|
e194c1dfd3 | ||
|
|
3e609a1192 | ||
|
|
5edc97f3f8 | ||
|
|
007bee88d8 | ||
|
|
d87fdecd55 | ||
|
|
f0e7326c20 | ||
|
|
54227091b8 | ||
|
|
1853e425f5 | ||
|
|
fe0bfb5ee9 | ||
|
|
255133326b | ||
|
|
0c18773308 | ||
|
|
9217b864d8 | ||
|
|
5e2ecaf277 | ||
|
|
cd23c7fe0e | ||
|
|
ed996fe32f | ||
|
|
1b8e54b808 | ||
|
|
eab0f5d222 | ||
|
|
e94a542d0f | ||
|
|
b6de436547 | ||
|
|
c6b750061a | ||
|
|
b41a3a6568 | ||
|
|
f687547d6e | ||
|
|
841efb0108 | ||
|
|
09d47ead18 | ||
|
|
00203b2888 | ||
|
|
1553c70961 | ||
|
|
bc75d2ecdf | ||
|
|
e15ef0b4da | ||
|
|
b19d8032c2 | ||
|
|
3c51ad7f02 | ||
|
|
6a9b2d36e1 | ||
|
|
40f3613b67 | ||
|
|
acc76b1e02 | ||
|
|
e4be5e3b9a | ||
|
|
bfbc2866c5 | ||
|
|
d9f21b4b95 | ||
|
|
7b43510fe3 | ||
|
|
1356e90a14 | ||
|
|
f9646a0c14 | ||
|
|
1ce1a40f94 | ||
|
|
7a7a241e5b | ||
|
|
18fe274e1c | ||
|
|
c6ee033425 | ||
|
|
0c1bff841b | ||
|
|
f518d6cea1 | ||
|
|
50ec4d9c3d | ||
|
|
94b8458af1 | ||
|
|
db621341a4 | ||
|
|
2ece0cc425 | ||
|
|
0ae74cde39 | ||
|
|
2bac75dbc5 | ||
|
|
6ab8659ff5 | ||
|
|
bd8893a76c | ||
|
|
6c989c7131 | ||
|
|
425584b61e | ||
|
|
ff6fc1f8dd | ||
|
|
94805ad55a | ||
|
|
897ef07712 | ||
|
|
6e259b76b7 | ||
|
|
cf4991d602 | ||
|
|
176c2b17fc | ||
|
|
9823dc1989 | ||
|
|
2457715e7d | ||
|
|
a0c30fc72b | ||
|
|
e4a8fe84e2 | ||
|
|
170a469533 | ||
|
|
d81a8d5f56 | ||
|
|
831b9d1880 | ||
|
|
7259c30929 | ||
|
|
b6d8e1e707 | ||
|
|
43e5f022e2 | ||
|
|
51415ad5d6 | ||
|
|
e0f149d29d | ||
|
|
375b671f01 | ||
|
|
981c7456ff | ||
|
|
5e71d5aea1 | ||
|
|
c6300a3ac7 | ||
|
|
2303793a62 | ||
|
|
e52879514f | ||
|
|
fdd8b8c997 | ||
|
|
35bfcb34b0 | ||
|
|
8078adee7f | ||
|
|
9f83e0e13c | ||
|
|
f48be4e0c6 | ||
|
|
5ae5d2eaeb | ||
|
|
47d0d4c331 | ||
|
|
d272339fda | ||
|
|
297d040ce1 | ||
|
|
ea97693b54 | ||
|
|
fb8f81040a | ||
|
|
4ea40809cb | ||
|
|
64a3d521de | ||
|
|
c2bb6bc875 | ||
|
|
a5c6ae8f28 | ||
|
|
42333c4a5e | ||
|
|
a6c2ba73d9 | ||
|
|
9dd6ea7481 | ||
|
|
c81e3df2bc | ||
|
|
148065bc00 | ||
|
|
4152e98bb0 | ||
|
|
3e2c95b0dd | ||
|
|
605d9053e5 | ||
|
|
6092205538 | ||
|
|
9c34d4ed09 | ||
|
|
3eff3ad69a | ||
|
|
56a02c1a44 | ||
|
|
e5cb0f77e6 | ||
|
|
3697fd9451 | ||
|
|
b4440d96cf | ||
|
|
69c45cba43 | ||
|
|
18b0979357 | ||
|
|
c986ea790c | ||
|
|
3e3073ca7b | ||
|
|
796da8da3a | ||
|
|
7cd528a4e9 | ||
|
|
601b282cd8 | ||
|
|
bc347cc36f | ||
|
|
6fc11e46ec | ||
|
|
ff876a3710 | ||
|
|
21fc7546ef | ||
|
|
afbcaaecba | ||
|
|
b64fa2eb84 | ||
|
|
8c2d9afd08 | ||
|
|
b36c3e48c4 | ||
|
|
efe090df89 | ||
|
|
f8e9a64ec7 | ||
|
|
5753ed4a72 | ||
|
|
03f8babefe | ||
|
|
3858500de4 | ||
|
|
e29020e10c | ||
|
|
be78cba9e5 | ||
|
|
6cb857502f | ||
|
|
65fc59aefa | ||
|
|
8b83306d54 | ||
|
|
b89cda0a77 | ||
|
|
0606f1a133 | ||
|
|
c443399ab1 | ||
|
|
7cbe8141d1 | ||
|
|
eab853b7e6 | ||
|
|
3d7797c46e | ||
|
|
cae32d41c1 | ||
|
|
a44841cbe2 | ||
|
|
e43ae39dff | ||
|
|
c5f2c7fcef | ||
|
|
550cd6e9d2 | ||
|
|
97ce41b2d0 | ||
|
|
416d0e892c | ||
|
|
e2c8436e17 | ||
|
|
ebda24eb69 | ||
|
|
582e5d8ef7 | ||
|
|
601401da71 | ||
|
|
f3289f76ec | ||
|
|
26787225c1 | ||
|
|
104fd20ac3 | ||
|
|
ca402e2f81 | ||
|
|
8445279306 | ||
|
|
bb025955c3 | ||
|
|
08cedb953b | ||
|
|
c03855be40 | ||
|
|
3e8f9a6436 | ||
|
|
5a712b5bcf | ||
|
|
964ba0a0d5 | ||
|
|
ffccc7d3be | ||
|
|
d1ab00cab4 | ||
|
|
dd1b69c600 | ||
|
|
3b502901c0 | ||
|
|
a22cd7394b | ||
|
|
8a83a9d893 | ||
|
|
8e6de1fb5f | ||
|
|
8a919932a6 | ||
|
|
087e17be1c | ||
|
|
ee5b28367c | ||
|
|
4d77b190fd | ||
|
|
854ebbf4dd | ||
|
|
8624553a31 | ||
|
|
4eeabffee6 | ||
|
|
f2b9004e8f | ||
|
|
38a7829dcb | ||
|
|
351e438e51 | ||
|
|
6d4158122c | ||
|
|
8c2fd06ba8 | ||
|
|
67a4c6cf97 | ||
|
|
848d7537e1 | ||
|
|
6c572cbc33 | ||
|
|
97787110a2 | ||
|
|
226785838a | ||
|
|
320cfdcb65 | ||
|
|
d7ea21b2e7 | ||
|
|
c9bc854938 | ||
|
|
ed54c64ad2 | ||
|
|
701e407af5 | ||
|
|
dfa1f4e064 | ||
|
|
43c89ab7a5 | ||
|
|
5bb2f43165 | ||
|
|
605eafa792 | ||
|
|
d68295bdb1 | ||
|
|
59080465d1 | ||
|
|
b65b9cb8c5 | ||
|
|
593b59c697 | ||
|
|
b9e5c3e8b3 | ||
|
|
87186cbc2f | ||
|
|
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 |
95
.gitignore
vendored
Normal file
95
.gitignore
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
# Project Root
|
||||
/.sc-start-sc_bindtextdomain
|
||||
/.sc-start-sc_prohibit_HAVE_MBRTOWC
|
||||
/.version
|
||||
/ABOUT-NLS
|
||||
/GNUmakefile
|
||||
/INSTALL
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
/aclocal.m4
|
||||
/autom4te.cache/
|
||||
/config.cache
|
||||
/config.log
|
||||
/config.status
|
||||
/configure
|
||||
/lib/
|
||||
/maint.mk
|
||||
# Wildcard Ignores
|
||||
*~
|
||||
po/*.gmo*
|
||||
po/*.po*
|
||||
src/*.o
|
||||
tests/*.log
|
||||
tests/*.trs
|
||||
testenv/*.log
|
||||
testenv/*.trs
|
||||
# build-aux/
|
||||
build-aux/.gitignore
|
||||
build-aux/ar-lib
|
||||
build-aux/compile
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
build-aux/depcomp
|
||||
build-aux/install-sh
|
||||
build-aux/mdate-sh
|
||||
build-aux/missing
|
||||
build-aux/snippet/
|
||||
build-aux/test-driver
|
||||
build-aux/texinfo.tex
|
||||
# doc/
|
||||
doc/Makefile
|
||||
doc/Makefile.in
|
||||
doc/sample.wgetrc.munged_for_texi_inclusion
|
||||
doc/stamp-vti
|
||||
doc/version.texi
|
||||
doc/wget.1
|
||||
doc/wget.info
|
||||
doc/wget.pod
|
||||
# m4/
|
||||
m4/.gitignore
|
||||
m4/gnulib-cache.m4
|
||||
# po/
|
||||
po/.gitignore
|
||||
po/.reference/
|
||||
po/LINGUAS
|
||||
po/Makefile
|
||||
po/Makefile.in
|
||||
po/Makevars
|
||||
po/POTFILES
|
||||
po/wget.pot
|
||||
po/stamp-po
|
||||
# src/
|
||||
src/.deps/
|
||||
src/Makefile
|
||||
src/Makefile.in
|
||||
src/build_info.c
|
||||
src/config.h
|
||||
src/config.h.in
|
||||
src/cscope.out
|
||||
src/css.c
|
||||
src/css_.c
|
||||
src/libunittest.a
|
||||
src/stamp-h1
|
||||
src/tags
|
||||
src/version.c
|
||||
src/wget
|
||||
# testenv/
|
||||
testenv/conf/__pycache__/
|
||||
testenv/exc/__pycache__/
|
||||
testenv/misc/__pycache__/
|
||||
testenv/server/__pycache__/
|
||||
testenv/server/http/__pycache__/
|
||||
testenv/test/__pycache__/
|
||||
testenv/Makefile
|
||||
testenv/Makefile.in
|
||||
# tests/
|
||||
tests/Makefile
|
||||
tests/Makefile.in
|
||||
tests/unit-tests
|
||||
# util/
|
||||
util/Makefile
|
||||
util/Makefile.in
|
||||
# others
|
||||
/tags
|
||||
/cscope.out
|
||||
124
.gitlab-ci.yml
Normal file
124
.gitlab-ci.yml
Normal file
@@ -0,0 +1,124 @@
|
||||
variables:
|
||||
BUILD_IMAGES_PROJECT: gnuwget/build-images
|
||||
DEBIAN_BUILD: buildenv-debian-stretch
|
||||
FEDORA_BUILD: buildenv-f25
|
||||
CENTOS7_BUILD: buildenv-centos7
|
||||
GET_SOURCES_ATTEMPTS: "3"
|
||||
|
||||
# In this build we combine
|
||||
# * syntax-check
|
||||
# * abi-check
|
||||
# * build/valgrind-check
|
||||
# * build/asan-check
|
||||
# * build w/Werror and ubsan-check
|
||||
Debian GNU/Linux build:
|
||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_BUILD
|
||||
script:
|
||||
- echo "127.0.0.1 wgettestingserver" >>/etc/hosts
|
||||
- cat /etc/hosts
|
||||
- touch .manywarnings
|
||||
- alias make="make -j$(nproc)"
|
||||
- ./bootstrap
|
||||
- ./configure -C
|
||||
- make syntax-check
|
||||
- make check
|
||||
# - make abi-check
|
||||
- make distcheck
|
||||
- make check-valgrind
|
||||
- ./configure -C --with-ssl=openssl
|
||||
- make clean
|
||||
- make check
|
||||
# - ./configure -C --enable-fsanitize-asan
|
||||
# - make clean
|
||||
# - make check
|
||||
# - ./configure -C --enable-fsanitize-ubsan
|
||||
# - make clean
|
||||
# - make check
|
||||
# - ./configure -C --enable-fsanitize-msan
|
||||
# - make clean
|
||||
# - make check
|
||||
tags:
|
||||
- shared
|
||||
artifacts:
|
||||
expire_in: 2 weeks
|
||||
when: on_failure
|
||||
paths:
|
||||
- tests/*.log
|
||||
# - compat_reports/
|
||||
|
||||
#Centos7 build:
|
||||
# image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$CENTOS7_BUILD
|
||||
# script:
|
||||
# - sed -i 's/AM_GNU_GETTEXT_VERSION(0.19.3)/AM_GNU_GETTEXT_VERSION(0.18.2)/g' configure.ac
|
||||
# - ./bootstrap && ./configure --enable-gcc-warnings --disable-doc && make -j$(nproc) check
|
||||
# tags:
|
||||
# - shared
|
||||
# artifacts:
|
||||
# expire_in: 2 weeks
|
||||
# when: on_failure
|
||||
# paths:
|
||||
# - tests/*.log
|
||||
# - compat_reports/
|
||||
|
||||
#clang-analyzer/Fedora:
|
||||
# image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||
# script:
|
||||
# - ./bootstrap
|
||||
# - scan-build ./configure --disable-doc --enable-gcc-warnings
|
||||
# - make -j$(nproc) -C gl
|
||||
# - scan-build --status-bugs -o scan-build-lib make -j$(nproc) -C lib
|
||||
# tags:
|
||||
# - shared
|
||||
# except:
|
||||
# - tags
|
||||
# artifacts:
|
||||
# expire_in: 2 weeks
|
||||
# when: on_failure
|
||||
# paths:
|
||||
# - scan-build-lib/*
|
||||
|
||||
#pages:
|
||||
# image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_BUILD
|
||||
# script:
|
||||
# - ./bootstrap
|
||||
# - CFLAGS="-g -O0" ./configure --enable-gtk-doc --enable-code-coverage --disable-gcc-warnings
|
||||
# - make -j$(nproc) check
|
||||
# - make local-code-coverage-output
|
||||
# - mkdir -p public
|
||||
# - rm -rf public/coverage
|
||||
# - mv libidn2-*-coverage public/coverage
|
||||
# - rm -rf public/reference
|
||||
# - mv doc/reference/html public/reference
|
||||
# - make -C doc manual
|
||||
# - rm -rf public/manual
|
||||
# - mv doc/manual public/manual
|
||||
# tags:
|
||||
# - shared
|
||||
# artifacts:
|
||||
# when: on_success
|
||||
# paths:
|
||||
# - public
|
||||
# only:
|
||||
# - master
|
||||
|
||||
#MinGW64:
|
||||
# image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||
# before_script:
|
||||
# - mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc &&
|
||||
# echo ':DOSWin:M::MZ::/usr/bin/wine64:' > /proc/sys/fs/binfmt_misc/register
|
||||
# script:
|
||||
# - ./bootstrap
|
||||
# - mingw64-configure --disable-valgrind-tests --disable-doc
|
||||
# - mingw64-make -j$(nproc)
|
||||
# - mingw64-make -j$(nproc) check
|
||||
# tags:
|
||||
# - shared
|
||||
# - docker
|
||||
# except:
|
||||
# - tags
|
||||
# artifacts:
|
||||
# expire_in: 2 weeks
|
||||
# when: on_failure
|
||||
# paths:
|
||||
# - ./*.log
|
||||
# - tests/*.log
|
||||
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
|
||||
51
.travis.yml
Normal file
51
.travis.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
sudo: no
|
||||
dist: trusty
|
||||
|
||||
language: c
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- darnir@gmail.com
|
||||
- bug-wget@gnu.org
|
||||
on_success: change
|
||||
on_failure: always
|
||||
|
||||
env:
|
||||
global:
|
||||
- PERLLIB=$PERLLIB:../../tests
|
||||
- PERL5LIB=$PERL5LIB:../../tests
|
||||
matrix:
|
||||
- SSL=""
|
||||
- SSL="openssl"
|
||||
- SSL="gnutls"
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- automake
|
||||
- autoconf
|
||||
- autopoint
|
||||
- flex
|
||||
- texinfo
|
||||
- pkg-config
|
||||
- libgnutls-dev
|
||||
- libssl-dev
|
||||
- make
|
||||
- libhttp-daemon-perl
|
||||
- libio-socket-ssl-perl
|
||||
- libidn2-dev
|
||||
- gettext
|
||||
- texlive
|
||||
- python3
|
||||
- valgrind
|
||||
- language-pack-tr
|
||||
- language-pack-ru
|
||||
|
||||
script:
|
||||
- make distclean || true
|
||||
- ./bootstrap
|
||||
- ./contrib/travis-ci $SSL
|
||||
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.
|
||||
|
||||
21536
ChangeLog-2014-12-10
Normal file
21536
ChangeLog-2014-12-10
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,16 +0,0 @@
|
||||
Please note that Wget has more than one ChangeLog file:
|
||||
|
||||
./ChangeLog: documents changes to files in the top-level directory
|
||||
and to files in subdirectories like po/ that don't have
|
||||
their own ChangeLogs
|
||||
|
||||
src/ChangeLog: documents only changes to files in the src directory
|
||||
|
||||
doc/ChangeLog: documents only changes to files in the doc directory
|
||||
|
||||
windows/ChangeLog: documents only changes to files in the windows directory
|
||||
|
||||
msdos/ChangeLog: documents only changes to files in the msdos directory
|
||||
|
||||
When checking to see if a patch you sent in has been applied, please
|
||||
look in the appropriate ChangeLog(s).
|
||||
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'.
|
||||
10
MAILING-LIST
10
MAILING-LIST
@@ -23,15 +23,6 @@ Gmane archives conveniently include messages from both the current
|
||||
list, and the previous one. Messages also show up in the Gmane archives
|
||||
sooner than they do at `lists.gnu.org'.
|
||||
|
||||
Bug Notices List
|
||||
----------------
|
||||
|
||||
Additionally, there is the <wget-notify@addictivecode.org> mailing
|
||||
list. This is a non-discussion list that receives bug report
|
||||
notifications from the bug-tracker. To subscribe to this list, send an
|
||||
email to <wget-notify-join@addictivecode.org>, or visit
|
||||
`http://addictivecode.org/mailman/listinfo/wget-notify'.
|
||||
|
||||
Obsolete Lists
|
||||
--------------
|
||||
|
||||
@@ -47,4 +38,3 @@ for submitting and discussing patches to GNU Wget.
|
||||
|
||||
Messages from <wget-patches@sunsite.dk> are archived at
|
||||
`http://news.gmane.org/gmane.comp.web.wget.patches'.
|
||||
|
||||
|
||||
47
Makefile.am
47
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,45 @@ 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 testenv
|
||||
|
||||
EXTRA_DIST = ChangeLog.README configure.bat MAILING-LIST \
|
||||
msdos/ChangeLog msdos/config.h msdos/Makefile.DJ \
|
||||
msdos/Makefile.WC ABOUT-NLS autogen.sh \
|
||||
build-aux/build_info.pl
|
||||
EXTRA_DIST = MAILING-LIST \
|
||||
msdos/config.h msdos/Makefile.DJ \
|
||||
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: gen-ChangeLog
|
||||
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
|
||||
|
||||
gen_start_date = 2014-12-10
|
||||
.PHONY: gen-ChangeLog
|
||||
gen-ChangeLog:
|
||||
$(AM_V_GEN)if test -d .git; then \
|
||||
log_fix="$(srcdir)/build-aux/git-log-fix"; \
|
||||
test -e "$$log_fix" \
|
||||
|| amend_git_log=; \
|
||||
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
||||
$$amend_git_log --since=$(gen_start_date) > $(distdir)/cl-t && \
|
||||
echo >> $(distdir)/cl-t && \
|
||||
cat ChangeLog-2014-12-10 >> $(distdir)/cl-t && \
|
||||
{ rm -f $(distdir)/ChangeLog && \
|
||||
mv $(distdir)/cl-t $(distdir)/ChangeLog; } \
|
||||
fi
|
||||
|
||||
check-valgrind:
|
||||
TESTS_ENVIRONMENT="VALGRIND_TESTS=1" $(MAKE) check
|
||||
|
||||
397
NEWS
397
NEWS
@@ -1,11 +1,342 @@
|
||||
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.
|
||||
Copyright (C) 1997-2017 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.19.2
|
||||
|
||||
* Fix CVE-2017-13089 (Stack overflow in HTTP protocol handling)
|
||||
|
||||
* Fix CVE-2017-13090 (Heap overflow in HTTP protocol handling)
|
||||
|
||||
* New option --compression for gzip Content-Encoding
|
||||
|
||||
* New option --[no]-netrc to control .netrc parsing
|
||||
|
||||
* Added GNU extensions to .netrc parsing
|
||||
|
||||
* Improved IDNA 2003 compatibility
|
||||
|
||||
* Fix VPATH issues
|
||||
|
||||
* Improved and extended the test suite
|
||||
|
||||
* Support Wayback Machine's X-Archive-Orig-last-modified
|
||||
|
||||
* Several bug fixes
|
||||
|
||||
|
||||
* Changes in Wget 1.19.1
|
||||
|
||||
* Fix bugs, a regression, portability/build issues
|
||||
|
||||
* Add new option --retry-on-http-error
|
||||
|
||||
|
||||
* Changes in Wget 1.19
|
||||
|
||||
* New option --use-askpass=COMMAND. Fetch user/password by calling
|
||||
an external program.
|
||||
|
||||
* Use IDNA2008 (+ TR46 if available) through libidn2
|
||||
|
||||
* When processing a Metalink header, --metalink-index=<number> allows
|
||||
to process the header's application/metalink4+xml files.
|
||||
|
||||
* When processing a Metalink file, --trust-server-names enables the
|
||||
use of the destination file names specified in the Metalink file,
|
||||
otherwise a safe destination file name is computed.
|
||||
|
||||
* When processing a Metalink file, enforce a safe destination path.
|
||||
Remove any drive letter prefix under w32, i.e. 'C:D:file'. Call
|
||||
libmetalink's metalink_check_safe_path() to prevent absolute,
|
||||
relative, or home paths:
|
||||
https://tools.ietf.org/html/rfc5854#section-4.1.2.1
|
||||
https://tools.ietf.org/html/rfc5854#section-4.2.8.3
|
||||
|
||||
* When processing a Metalink file, --directory-prefix=<prefix> sets
|
||||
the top of the retrieval tree to prefix for Metalink downloads.
|
||||
|
||||
* When processing a Metalink file, reject downloaded files which don't
|
||||
agree with their own metalink:size value:
|
||||
https://tools.ietf.org/html/rfc5854#section-4.2.16
|
||||
|
||||
* When processing a Metalink file, with --continue resume partially
|
||||
downloaded files and keep fully downloaded files even if they fail
|
||||
the verification.
|
||||
|
||||
* When processing a Metalink file, create the parent directories of a
|
||||
"path/file" destination file name:
|
||||
https://tools.ietf.org/html/rfc5854#section-4.1.2.1
|
||||
https://tools.ietf.org/html/rfc5854#section-4.2.8.3
|
||||
|
||||
* On a recursive download, append a .tmp suffix to temporary files
|
||||
that will be deleted after being parsed, and create them
|
||||
readable/writable only by the owner.
|
||||
|
||||
* New make target 'check-valgrind'
|
||||
|
||||
* Fix several bugs
|
||||
|
||||
* Fix compatibility issues
|
||||
|
||||
* Changes in Wget 1.18
|
||||
|
||||
* By default, on server redirects to a FTP resource, use the original
|
||||
URL to get the local file name. Close CVE-2016-4971. This
|
||||
introduces a backward-incompatibility for HTTP->FTP redirects and
|
||||
any script that relies on the old behaviour must use
|
||||
--trust-server-names.
|
||||
|
||||
* Check the HSTS file is not world-writable before using it.
|
||||
|
||||
* Parse <img srcset> attributes on a recursive download.
|
||||
|
||||
* Fix problem with SNI server names having trailing dot(s)
|
||||
|
||||
* New options --bind-dns-address and --dns-servers.
|
||||
|
||||
* When Wget is built with libiconv, it now converts non-ASCII URIs to
|
||||
the locale's codeset when it creates files. The encoding of the
|
||||
remote files and URIs is taken from --remote-encoding, defaulting to
|
||||
UTF-8. The result is that non-ASCII URIs and files downloaded via
|
||||
HTTP/HTTPS and FTP will have names on the local filesystem that
|
||||
correspond to their remote names.
|
||||
|
||||
* Changes in Wget 1.17.1
|
||||
|
||||
* Fix compile error when IPv6 is disabled or SSL is not present.
|
||||
|
||||
* Fix HSTS memory leak.
|
||||
|
||||
* Fix progress output in non-C locales.
|
||||
|
||||
* Fix SIGSEGV when -N and --content-disposition are used together.
|
||||
|
||||
* Add --check-certificate=quiet to tell wget to not print any warning about
|
||||
invalid certificates.
|
||||
|
||||
* Changes in Wget 1.17
|
||||
|
||||
** Remove FTP passive to active fallback due to privacy concerns.
|
||||
|
||||
** Add support for --if-modified-since.
|
||||
|
||||
** Add support for metalink through --input-metalink and --metalink-over-http.
|
||||
|
||||
** Add support for HSTS through --hsts and --hsts-file.
|
||||
|
||||
** Add option to restrict filenames under VMS.
|
||||
|
||||
** Add support for --rejected-log which logs to a separate file the reasons why
|
||||
URLs are being rejected and some context around it.
|
||||
|
||||
** Add support for FTPS.
|
||||
|
||||
** Do not download/save file on error when --spider enabled
|
||||
|
||||
** Add --convert-file-only option. This option converts only the
|
||||
filename part of the URLs, leaving the rest of the URLs untouched.
|
||||
|
||||
* Changes in Wget 1.16.3
|
||||
|
||||
** Fix a regression introduced by wget 1.16.2 that --quiet is not
|
||||
really quiet anymore.
|
||||
|
||||
* Changes in Wget 1.16.2
|
||||
|
||||
** Native uuid generation on Windows
|
||||
|
||||
** Fix build on Solaris
|
||||
|
||||
** Allow progress bar on stderr when -o is used
|
||||
|
||||
** Accept 5-digit port numbers in FTP EPSV responses.
|
||||
|
||||
** Support older versions of flex.
|
||||
|
||||
** Updated translations.
|
||||
|
||||
* Changes in Wget 1.16.1
|
||||
|
||||
** Add --enable-assert configure option.
|
||||
|
||||
** Use pkg-config to check for libraries presence.
|
||||
|
||||
** Do not limit --secure-protocol=auto|pfs to TLSv1.0.
|
||||
|
||||
** Add --secure-protocol=TLSv1_1|TLSv1_2 .
|
||||
|
||||
** Full C89 source code compliance.
|
||||
|
||||
** Select and use the most secure authentication scheme with HTTP connections.
|
||||
|
||||
** Fix issues with turkish locales.
|
||||
|
||||
** Handle 504 Gateway Timeout.
|
||||
|
||||
** New option --crl-file to load Certificate Revocation Lists.
|
||||
|
||||
** Add valgrind support to tests suite.
|
||||
|
||||
** Fix an off-by-one problem in the progress bar (introduced in 1.16).
|
||||
|
||||
* Changes in Wget 1.16
|
||||
|
||||
** No longer create local symbolic links by default. Closes CVE-2014-4877.
|
||||
|
||||
** Use libpsl for verifying cookie domains.
|
||||
|
||||
** Default progress bar output changed.
|
||||
|
||||
** Introduce --show-progress to force display the progress bar.
|
||||
|
||||
** Introduce --no-config. The wgetrc files will not be read.
|
||||
|
||||
** Introduce --start-pos to allow starting downloads from a specified position.
|
||||
|
||||
** Fix a problem with ISA Server Proxy and keep-alive connections.
|
||||
|
||||
* 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-regex 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
|
||||
@@ -59,7 +390,7 @@ forces the percent-encoding of all non-ASCII bytes
|
||||
now documented: save_headers, spider, and user_agent,
|
||||
auth_no_challenge, and keep_session_cookies. Also added documentation
|
||||
for the "lowercase" and "uppercase" values for --restrict-file-names, which had been present since Wget 1.11.
|
||||
|
||||
|
||||
* Changes in Wget 1.11.4
|
||||
|
||||
** Fixed an issue (apparently a regression) where -O would refuse to
|
||||
@@ -73,13 +404,13 @@ locally with content.
|
||||
to a pointer-to-time_t.
|
||||
|
||||
** Translation updates for Catalan.
|
||||
|
||||
|
||||
* Changes in Wget 1.11.3
|
||||
|
||||
** Downgraded -N with -O to a warning, rather than an error.
|
||||
|
||||
** Translation updates
|
||||
|
||||
|
||||
* Changes in Wget 1.11.2
|
||||
|
||||
** Fixed a problem in authenticating over HTTPS through a proxy.
|
||||
@@ -101,7 +432,7 @@ multiple times. This has been fixed in 1.11.2.
|
||||
for improved conformance with RFC 3986. However, this behavior presents
|
||||
problems for some FTP setups, and so they are now preserved again, for
|
||||
FTP URLs only.
|
||||
|
||||
|
||||
* Changes in Wget 1.11.1.
|
||||
|
||||
** Interrupted downloads no longer result in renaming the file
|
||||
@@ -123,7 +454,7 @@ be surprising, and notes that they may change in the future.
|
||||
|
||||
** Documentation of --no-parents now explains how a trailing slash, or
|
||||
lack thereof, in the specified URL, will affect behavior.
|
||||
|
||||
|
||||
* Changes in Wget 1.11.
|
||||
|
||||
** Timestamping now uses the value from the most recent HTTP response,
|
||||
@@ -169,7 +500,7 @@ available at http://hg.addictivecode.org/. Prior to this, the source
|
||||
code was hosted on Subversion (migrated from the original CVS); you can
|
||||
still get access to older tags and branches for Wget in the Subversion
|
||||
repository at http://addictivecode.org/svn/wget/.
|
||||
|
||||
|
||||
* Changes in Wget 1.10.
|
||||
|
||||
** Downloading files larger than 2GB, sometimes referred to as "large
|
||||
@@ -280,9 +611,9 @@ http_password and proxy_password respectively. The login and passwd
|
||||
.wgetrc commands have been deprecated.
|
||||
|
||||
* `wget -b' now works correctly under Windows.
|
||||
|
||||
|
||||
* Wget 1.9.1 is a bugfix release with no user-visible changes.
|
||||
|
||||
|
||||
* Changes in Wget 1.9.
|
||||
|
||||
** It is now possible to specify that POST method be used for HTTP
|
||||
@@ -334,11 +665,11 @@ values "yes" and "no" along with the traditional "on" and "off".
|
||||
** It is now possible to specify decimal values for timeouts, waiting
|
||||
periods, and download rate. For instance, `--wait=0.5' now works as
|
||||
expected, as does `--dns-timeout=0.5' and even `--limit-rate=2.5k'.
|
||||
|
||||
|
||||
* Wget 1.8.2 is a bugfix release with no user-visible changes.
|
||||
|
||||
|
||||
* Wget 1.8.1 is a bugfix release with no user-visible changes.
|
||||
|
||||
|
||||
* Changes in Wget 1.8.
|
||||
|
||||
** A new progress indicator is now available and used by default.
|
||||
@@ -390,7 +721,7 @@ addresses when accessing the first one fails.
|
||||
non-standard port.
|
||||
|
||||
** Wget now supports the robots.txt directives specified in
|
||||
<http://www.robotstxt.org/wc/norobots-rfc.txt>.
|
||||
<http://www.robotstxt.org/norobots-rfc.txt>.
|
||||
|
||||
** URL parser has been fixed, especially the infamous overzealous
|
||||
quoting. Wget no longer dequotes reserved characters, e.g. `%3F' is
|
||||
@@ -398,9 +729,9 @@ no longer translated to `?', nor `%2B' to `+'. Unsafe characters
|
||||
which are not reserved are still escaped, of course.
|
||||
|
||||
** No more than 20 successive redirections are allowed.
|
||||
|
||||
|
||||
* Wget 1.7.1 is a bugfix release with no user-visible changes.
|
||||
|
||||
|
||||
* Changes in Wget 1.7.
|
||||
|
||||
** SSL (`https') pages now work if you compile Wget with SSL support;
|
||||
@@ -442,7 +773,7 @@ large sites (thousands of documents).
|
||||
documentation. (The last version that shipped with a man page was
|
||||
1.4.5). To get this, you need to have pod2man from the Perl
|
||||
distribution installed on your system.
|
||||
|
||||
|
||||
* Changes in Wget 1.6
|
||||
|
||||
** Administrative changes.
|
||||
@@ -493,13 +824,13 @@ passive_ftp is the only .wgetrc command which takes a lockable Boolean.
|
||||
bound to multiple IP addresses.
|
||||
|
||||
** wget now accepts (illegal per HTTP spec) relative URLs in HTTP redirects.
|
||||
|
||||
|
||||
* Wget 1.5.3 is a bugfix release with no user-visible changes.
|
||||
|
||||
|
||||
* Wget 1.5.2 is a bugfix release with no user-visible changes.
|
||||
|
||||
|
||||
* Wget 1.5.1 is a bugfix release with no user-visible changes.
|
||||
|
||||
|
||||
* Changes in Wget 1.5.0
|
||||
|
||||
** Wget speaks many languages!
|
||||
@@ -534,7 +865,7 @@ ASCII type transfer:
|
||||
|
||||
wget "ftp://ftp.somewhere.com/welcome.msg;type=a"
|
||||
|
||||
** `--help' and `--version' options have been redone to to conform to
|
||||
** `--help' and `--version' options have been redone to conform to
|
||||
standards set by other GNU utilities.
|
||||
|
||||
** Wget should now be compilable under MS Windows environment. MS
|
||||
@@ -545,11 +876,11 @@ download.
|
||||
|
||||
** The manual page, now hopelessly out of date, is no longer
|
||||
distributed with Wget.
|
||||
|
||||
|
||||
* Wget 1.4.5 is a bugfix release with no user-visible changes.
|
||||
|
||||
|
||||
* Wget 1.4.4 is a bugfix release with no user-visible changes.
|
||||
|
||||
|
||||
* Changes in Wget 1.4.3
|
||||
|
||||
** Wget is now a GNU utility.
|
||||
@@ -565,7 +896,7 @@ distributed with Wget.
|
||||
** Global wgetrc now goes to /usr/local/etc (i.e. $sysconfdir).
|
||||
|
||||
** Lots of bugfixes.
|
||||
|
||||
|
||||
* Changes in Wget 1.4.2
|
||||
|
||||
** New mirror site at ftp://sunsite.auc.dk/pub/infosystems/wget/,
|
||||
@@ -583,7 +914,7 @@ files.
|
||||
** --convert-links should work now.
|
||||
|
||||
** Minor bugfixes.
|
||||
|
||||
|
||||
* Changes in Wget 1.4.1
|
||||
|
||||
** Minor bugfixes.
|
||||
@@ -591,7 +922,7 @@ files.
|
||||
** Added -I (the opposite of -X).
|
||||
|
||||
** Dot tracing is now customizable; try wget --dot-style=binary
|
||||
|
||||
|
||||
* Changes in Wget 1.4.0
|
||||
|
||||
** Wget 1.4.0 [formerly known as Geturl] is an extensive rewrite of
|
||||
@@ -672,7 +1003,7 @@ turn on mirroring options).
|
||||
** Lots of small features I can't remember. :-)
|
||||
|
||||
** A host of bugfixes.
|
||||
|
||||
|
||||
* Changes in Geturl 1.3
|
||||
|
||||
** Added FTP globbing support (ftp://fly.cc.fer.hr/*)
|
||||
@@ -690,9 +1021,9 @@ turn on mirroring options).
|
||||
** Added support for robots.txt
|
||||
|
||||
** Fixed some minor bugs
|
||||
|
||||
|
||||
* Geturl 1.2 is a bugfix release with no user-visible changes.
|
||||
|
||||
|
||||
* Changes in Geturl 1.1
|
||||
|
||||
** REST supported in FTP
|
||||
@@ -710,7 +1041,7 @@ geturl -vo log http://fly.cc.fer.hr/
|
||||
** <base href="xxx"> supported
|
||||
|
||||
** autoconf supported
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Copyright information:
|
||||
|
||||
|
||||
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.
|
||||
|
||||
203
README.checkout
203
README.checkout
@@ -4,8 +4,9 @@ Compiling From Repository Sources
|
||||
does not contain automatically-generated files, even when these are
|
||||
normally present in the distribution tarballs. Therefore, to build GNU
|
||||
Wget from the sources in the repository, you'll need to have one or
|
||||
more of the following (note that gettext, OpenSSL, libidn and libiconv
|
||||
are not absolutely required):
|
||||
more of the following (note that gettext, OpenSSL, GnuTLS, libidn2,
|
||||
libiconv, libpsl, libpcre, pkg-config, libmetalink and GnuPG are not
|
||||
absolutely required):
|
||||
|
||||
* [20]autoconf (currently, GNU Wget requires version 2.61). This is
|
||||
needed to generate the configure script from configure.in. This is
|
||||
@@ -23,12 +24,18 @@ Compiling From Repository Sources
|
||||
* [23]Perl, if you wish to generate the wget(1) manpage, or run the
|
||||
tests in the tests/ sub directory. Tarball distributions include an
|
||||
already-generated wget.1 manual. The command "make check" runs the
|
||||
test suite written in perl. To execute all the tests you need
|
||||
[24]libwww-perl perl library. If "perl -MCPAN -e 'install
|
||||
Bundle::LWP'" fails then you most likely don't have cpan module
|
||||
installed. First download [25]CPAN and [26]install it. Then execute
|
||||
"perl -MCPAN -e 'install Bundle::LWP'". Now "make check" should
|
||||
pass most of the tests in the test suite.
|
||||
test suite written in perl and python (see below). To execute all the tests
|
||||
you need libwww-perl and libio-socket-ssl-perl perl library.
|
||||
GNU/Linux distros likely have these two libraries packaged.
|
||||
If not, install them directly with "perl -MCPAN -e 'install Bundle::LWP'"[24].
|
||||
If that fails then you most likely don't have the CPAN module installed.
|
||||
First download [25]CPAN and [26]install it, then try again the above command.
|
||||
Now "make check" should pass most of the tests in the test suite.
|
||||
|
||||
* [45]Python3, if you want to run the tests in the testenv/ subdirectory.
|
||||
Keep in mind that "make check" will try to run all the Perl and Python3
|
||||
tests. More information about the test suite below in the section
|
||||
"Testing and development".
|
||||
|
||||
* [27]texinfo in order to generate Info, PostScript and/or HTML
|
||||
documentation. You don't need texinfo in order to generate the
|
||||
@@ -46,30 +53,65 @@ Compiling From Repository Sources
|
||||
to export M4=<new m4 path>, to be sure that autoconf/automake use
|
||||
it instead of the old one.
|
||||
|
||||
* [29]OpenSSL to handle encrypted web sessions. You almost certainly
|
||||
want this. It is not enough to have the library installed; you need
|
||||
to have the header files available to compile against as well. For
|
||||
GNU/Linux systems, this usually means installing a "developer"
|
||||
package for openssl (for example, [30]Debian systems require
|
||||
installation of the libssl-dev package). Alternatively, you can
|
||||
compile GNU Wget against the [31]GNUTLS library instead, by
|
||||
specifying --with-ssl=gnutls to the ./configure script; however,
|
||||
building against GNUTLS is currently experimental, and not
|
||||
officially supported. If you have OpenSSL and its development
|
||||
headers installed, but don't want to build Wget with it, specify
|
||||
--without-ssl to the ./configure script.
|
||||
* [29]GnuTLS to allow encrypted data transfer (HTTPS).
|
||||
You need the header files and the library installed.
|
||||
As an alternative, you can use [30]OpenSSL by specifying
|
||||
--with-ssl=openssl to the ./configure script.
|
||||
If you do not want HTTPS support, specify --without-ssl to the
|
||||
./configure script.
|
||||
If you want to compile+link a non-system library version use
|
||||
--with-libgnutls-prefix (or if having pkg-config: see description
|
||||
below).
|
||||
|
||||
* [32]libidn is required for IDN/IRI support (non-ASCII characters
|
||||
* [30]OpenSSL to allow encrypted data transfer (HTTPS) an
|
||||
alternative to [31]GnuTLS.
|
||||
You need the header files and the library installed.
|
||||
If you want to compile+link a non-system library version use
|
||||
--with-libssl-prefix (or if having pkg-config: see description below).
|
||||
|
||||
* [31]libidn2 is required for IDN/IRI support (non-ASCII characters
|
||||
within what would otherwise be URLs).
|
||||
|
||||
* [33]libiconv is required on non-GNU systems, for IDN/IRI support.
|
||||
* [32]libiconv is required on non-GNU systems, for IDN/IRI support.
|
||||
On GNU systems, the functionality provided by libiconv is already
|
||||
present in the system libraries.
|
||||
|
||||
* [33]git is used to fetch gnulib files trough the bootstrap.sh script.
|
||||
|
||||
* [34]libpsl is required for using a public suffix list to check for valid
|
||||
cookie domains. You need the header files and the library installed.
|
||||
|
||||
* [35]libpcre is required for using Perl-compatible regular expressions
|
||||
with --accept-regex and --reject-regex. You need the header files and
|
||||
the library installed to compile and link Wget with PCRE support.
|
||||
|
||||
* [36]pkg-config helps the ./configure script to find installed libraries.
|
||||
Most libraries provide a pkg-config file (.pc extension) with
|
||||
information about dependencies, header file and library locations.
|
||||
Distributions deliver their specific .pc file to each library.
|
||||
If you want to compile+link against your own library version, make a
|
||||
copy of the appropriate .pc file and amend it to your needs (e.g. edit
|
||||
the line starting with prefix=). Before you execute the ./configure
|
||||
script, set (and export) PKG_CONFIG_PATH to the directory where you
|
||||
saved the .pc file. Example:
|
||||
$ PKG_CONFIG_PATH="." ./configure
|
||||
|
||||
* [46]libmetalink is needed to enable Metalink files support.
|
||||
|
||||
* [47]GnuPG with GPGME is used to verify GPG-signed Metalink resources.
|
||||
|
||||
* [48]libcares is needed to bind DNS resolving to a given IP address.
|
||||
The command line options --dns-servers and --bind-dns-address are
|
||||
only available when configured with --with-cares.
|
||||
|
||||
* [49]Gpef is required by some gnulib modules, most notably "unicase". You
|
||||
need the application installed on the machine to compile Wget from git.
|
||||
|
||||
|
||||
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 has been provided. After
|
||||
calling ./bootstrap 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,65 +120,100 @@ 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 (or: bash ./bootstrap)
|
||||
3. Configure the package and compile it:
|
||||
$ ./configure [some_parameters]
|
||||
$ ./configure --enable-assert [some_parameters]
|
||||
$ make
|
||||
4. Hack, compile, test, hack, compile, test...
|
||||
$ src/wget --version
|
||||
GNU Wget 1.12-devel (9cb2563197bc)
|
||||
|
||||
Copyright © 2008 Free Software Foundation, Inc.
|
||||
Testing and development
|
||||
|
||||
All developers are requested to enable the assertions on their development
|
||||
builds to ensure a stable codebase. Assertions are added to state certain
|
||||
assumptions about the code and its data which all developers should be mindful
|
||||
of. To enable assertions, run the configure command with the --enable-assert
|
||||
option, like this:
|
||||
|
||||
$ ./configure --enable-assert [other configure options]
|
||||
|
||||
Both the Perl and Python test suites (test/ and testenv/) include support for GDB and Valgrind.
|
||||
The environment variables GDB_TESTS and VALGRIND_TESTS are available to
|
||||
enable such wrappers. If specified, Wget would be run through either of them
|
||||
during the test. For example:
|
||||
|
||||
$ cd testenv
|
||||
$ VALGRIND_TESTS=1 ./Test-O.py
|
||||
|
||||
That would execute Test-O.py test case, but running Wget through Valgrind.
|
||||
|
||||
GDB has preference over Valgrind. If both variables have been asserted,
|
||||
Wget would be run through GDB.
|
||||
|
||||
If you run a test case through GDB, please bear in mind that it could give
|
||||
a false negative. This is because some tests that expect Wget to fail
|
||||
rely on Wget's return code. However, when run through GDB, its return code
|
||||
will always be zero, causing the test to claim failure. This wrapper for
|
||||
GDB is, however, very useful to tackle bugs, allowing one to write a test case
|
||||
for some specific bug and then using GDB to fix it more easily. Otherwise,
|
||||
a dedicated server would have to be set up and write a custom CGI just to reproduce
|
||||
that bug, which might be tedious. Tests should only be run through GDB for that purpose.
|
||||
|
||||
|
||||
Copyright (C) 2008,2010,2014,2015 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later
|
||||
<http://www.gnu.org/licenses/gpl.html>.
|
||||
<https://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
|
||||
* [37]Info
|
||||
* [38]Attachments
|
||||
* [36]Edit
|
||||
* [37]Comments
|
||||
* [38]Info
|
||||
* [39]Attachments
|
||||
* More Actions:
|
||||
[Raw Text................] Do
|
||||
|
||||
* [39]MoinMoin Powered
|
||||
* [40]Python Powered
|
||||
* [41]GPL licensed
|
||||
* [42]Valid HTML 4.01
|
||||
* [40]MoinMoin Powered
|
||||
* [41]Python Powered
|
||||
* [42]GPL licensed
|
||||
* [43]Valid HTML 4.01
|
||||
__________________________________________________________________
|
||||
|
||||
All content © 2007 Free Software Foundation. For terms of use,
|
||||
redistribution, and modification, please see the [43]WikiLicense page.
|
||||
All content (C) 2007 Free Software Foundation. For terms of use,
|
||||
redistribution, and modification, please see the [45]WikiLicense page.
|
||||
|
||||
References
|
||||
|
||||
20. http://www.gnu.org/software/autoconf/
|
||||
21. http://www.gnu.org/software/automake/
|
||||
22. http://flex.sourceforge.net/
|
||||
23. http://www.perl.org/
|
||||
20. https://www.gnu.org/software/autoconf/
|
||||
21. https://www.gnu.org/software/automake/
|
||||
22. https://github.com/westes/flex
|
||||
23. https://www.perl.org/
|
||||
24. http://search.cpan.org/dist/libwww-perl/lib/Bundle/LWP.pm
|
||||
25. http://search.cpan.org/CPAN/authors/id/A/AN/ANDK/CPAN-1.9402.tar.gz
|
||||
26. http://apthorpe.cynistar.net/code/configuring_cpan.html
|
||||
27. http://www.gnu.org/software/texinfo/
|
||||
28. http://www.gnu.org/software/gettext/
|
||||
29. http://www.openssl.org/
|
||||
30. http://www.debian.org/
|
||||
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
|
||||
35. http://wget.addictivecode.org/CompilingRepoSources?action=edit&editor=text
|
||||
36. http://wget.addictivecode.org/CompilingRepoSources
|
||||
37. http://wget.addictivecode.org/CompilingRepoSources?action=info
|
||||
38. http://wget.addictivecode.org/CompilingRepoSources?action=AttachFile
|
||||
39. http://moinmo.in/
|
||||
40. http://moinmo.in/Python
|
||||
41. http://moinmo.in/GPL
|
||||
42. http://validator.w3.org/check?uri=referer
|
||||
43. http://wget.addictivecode.org/WikiLicense
|
||||
27. https://www.gnu.org/software/texinfo/
|
||||
28. https://www.gnu.org/software/gettext/
|
||||
29. https://www.gnu.org/software/gnutls/
|
||||
30. https://www.openssl.org/
|
||||
31. https://www.gnu.org/software/libidn/#libidn2
|
||||
32. https://www.gnu.org/software/libiconv/
|
||||
33. https://git-scm.com/
|
||||
34. https://github.com/rockdaboot/libpsl
|
||||
35. http://www.pcre.org
|
||||
36. http://wget.addictivecode.org/CompilingRepoSources?action=edit&editor=text
|
||||
37. http://wget.addictivecode.org/CompilingRepoSources
|
||||
38. http://wget.addictivecode.org/CompilingRepoSources?action=info
|
||||
39. http://wget.addictivecode.org/CompilingRepoSources?action=AttachFile
|
||||
40. https://moinmo.in/
|
||||
41. https://moinmo.in/Python
|
||||
42. https://moinmo.in/GPL
|
||||
43. https://validator.w3.org/check?uri=referer
|
||||
44. http://wget.addictivecode.org/WikiLicense
|
||||
45. https://www.python.org/
|
||||
46. https://launchpad.net/libmetalink
|
||||
47. https://www.gnupg.org
|
||||
48. https://c-ares.haxx.se/
|
||||
49. https://www.gnu.org/software/gperf/
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
exec autoreconf
|
||||
167
bootstrap.conf
Normal file
167
bootstrap.conf
Normal file
@@ -0,0 +1,167 @@
|
||||
# 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
|
||||
c-strcase
|
||||
c-strcasestr
|
||||
clock-time
|
||||
close
|
||||
connect
|
||||
dirname
|
||||
fcntl
|
||||
flock
|
||||
fnmatch
|
||||
fopen
|
||||
futimens
|
||||
ftello
|
||||
getaddrinfo
|
||||
getline
|
||||
getopt-gnu
|
||||
getpass-gnu
|
||||
getpeername
|
||||
getsockname
|
||||
gettext
|
||||
gitlog-to-changelog
|
||||
git-version-gen
|
||||
gnupload
|
||||
group-member
|
||||
hostent
|
||||
ioctl
|
||||
iconv
|
||||
iconv-h
|
||||
inet_ntop
|
||||
intprops
|
||||
inttypes
|
||||
langinfo
|
||||
limits-h
|
||||
link
|
||||
listen
|
||||
maintainer-makefile
|
||||
mbiter
|
||||
mbtowc
|
||||
memrchr
|
||||
mkdir
|
||||
mkstemp
|
||||
mkostemp
|
||||
nanosleep
|
||||
crypto/md2
|
||||
crypto/md4
|
||||
crypto/md5
|
||||
crypto/sha1
|
||||
crypto/sha256
|
||||
crypto/sha512
|
||||
open
|
||||
pipe-posix
|
||||
posix_spawn
|
||||
quote
|
||||
quotearg
|
||||
recv
|
||||
regex
|
||||
select
|
||||
send
|
||||
setsockopt
|
||||
signal-h
|
||||
sigprocmask
|
||||
sigpipe
|
||||
snprintf
|
||||
socket
|
||||
spawn-pipe
|
||||
stat
|
||||
stdbool
|
||||
stdint
|
||||
strcase
|
||||
strerror_r-posix
|
||||
strpbrk
|
||||
strptime
|
||||
strtok_r
|
||||
strtoll
|
||||
symlink
|
||||
sys_types
|
||||
timegm
|
||||
tmpdir
|
||||
unlink
|
||||
unlocked-io
|
||||
update-copyright
|
||||
libunistring-optional
|
||||
unistr/u8-strlen
|
||||
unicase/u8-tolower
|
||||
utimens
|
||||
vasprintf
|
||||
vsnprintf
|
||||
wcwidth
|
||||
write
|
||||
xmemdup0
|
||||
xstrndup
|
||||
"
|
||||
|
||||
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 -
|
||||
flex -
|
||||
gperf -
|
||||
"
|
||||
|
||||
bootstrap_post_import_hook ()
|
||||
{
|
||||
# We need to patch unicase/special-casing-table.h for gperf < 3.1
|
||||
GPERF_VER=$(gperf --version | {
|
||||
IFS=' .' read x y major minor bugfix _
|
||||
printf "%d%02d%02d" $major $minor $bugfix
|
||||
})
|
||||
|
||||
if [ $GPERF_VER -lt 30100 ]; then
|
||||
echo "Creating lib/unicase/special-casing-table.h for gperf < 3.1"
|
||||
gperf -m 10 lib/unicase/special-casing-table.gperf | \
|
||||
sed -e "s/gl_unicase_special_lookup.*/gl_unicase_special_lookup\ \(const char \*str, size_t len\)/g" \
|
||||
> lib/unicase/special-casing-table.h
|
||||
fi
|
||||
}
|
||||
@@ -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
|
||||
@@ -105,3 +137,4 @@ __DATA__
|
||||
|
||||
#include "wget.h"
|
||||
#include <stdio.h>
|
||||
#include "version.h"
|
||||
|
||||
@@ -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:
|
||||
14
cfg.mk
14
cfg.mk
@@ -1,10 +1,12 @@
|
||||
export VC_LIST_EXCEPT_DEFAULT=^(lib/.*|m4/.*|md5/.*|build-aux/.*|src/gettext\.h|.*ChangeLog)$$
|
||||
# Explicit syntax-check exceptions.
|
||||
exclude_file_name_regexp--sc_trailing_blank = ^doc/annou.*$$
|
||||
|
||||
export VC_LIST_EXCEPT_DEFAULT=^(lib/.*|m4/.*|md5/.*|build-aux/.*|src/gettext\.h|.*ChangeLog|tests/certs/.*)$$
|
||||
|
||||
local-checks-to-skip = \
|
||||
sc_const_long_option \
|
||||
sc_error_message_uppercase \
|
||||
sc_file_system \
|
||||
sc_makefile_TAB_only_indentation \
|
||||
sc_immutable_NEWS \
|
||||
sc_copyright_check \
|
||||
sc_makefile_path_separator_check \
|
||||
@@ -13,17 +15,19 @@ local-checks-to-skip = \
|
||||
sc_two_space_separator_in_usage \
|
||||
sc_useless_cpp_parens \
|
||||
\
|
||||
sc_space_tab \
|
||||
sc_prohibit_atoi_atof \
|
||||
sc_prohibit_strcmp \
|
||||
sc_makefile_check \
|
||||
sc_cast_of_alloca_return_value \
|
||||
sc_cast_of_x_alloc_return_value \
|
||||
sc_prohibit_S_IS_definition \
|
||||
\
|
||||
sc_program_name \
|
||||
|
||||
sc_makefile_at_at_check \
|
||||
sc_cast_of_argument_to_free \
|
||||
sc_prohibit_undesirable_word_seq
|
||||
|
||||
#SHELL=bash -x
|
||||
show-vc-list-except:
|
||||
@$(VC_LIST_EXCEPT)
|
||||
|
||||
VC_LIST_ALWAYS_EXCLUDE_REGEX = ^ABOUT-NLS|((msdos|vms)/.*)|ChangeLog-2014-12-10|/.*.der|^tests/certs/.*$$
|
||||
|
||||
670
configure.ac
670
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, 2012,
|
||||
dnl 2013, 2014 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
|
||||
@@ -55,41 +57,108 @@ AC_CANONICAL_HOST
|
||||
AC_DEFINE_UNQUOTED([OS_TYPE], "$host_os",
|
||||
[Define to be the name of the operating system.])
|
||||
|
||||
dnl Non-verbose make
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
dnl
|
||||
dnl Process features.
|
||||
dnl Process External Libraries
|
||||
dnl
|
||||
|
||||
AC_ARG_WITH(ssl,
|
||||
[[ --without-ssl disable SSL autodetection]])
|
||||
dnl Libpsl: Public Suffix List checking
|
||||
AC_ARG_WITH([libpsl],
|
||||
[AS_HELP_STRING([--without-libpsl], [disable support for libpsl cookie checking.])])
|
||||
|
||||
AC_ARG_ENABLE(opie,
|
||||
[ --disable-opie disable support for opie or s/key FTP login],
|
||||
ENABLE_OPIE=$enableval, ENABLE_OPIE=yes)
|
||||
test x"${ENABLE_OPIE}" = xyes && AC_DEFINE([ENABLE_OPIE], 1,
|
||||
[Define if you want the Opie support for FTP compiled in.])
|
||||
dnl SSL: Configure SSL backend to use
|
||||
AC_ARG_WITH([ssl],
|
||||
[AS_HELP_STRING([--with-ssl={gnutls,openssl}], [specify SSL backend. GNU TLS is the default.])])
|
||||
|
||||
AC_ARG_ENABLE(digest,
|
||||
[ --disable-digest disable support for HTTP digest authorization],
|
||||
ENABLE_DIGEST=$enableval, ENABLE_DIGEST=yes)
|
||||
test x"${ENABLE_DIGEST}" = xyes && AC_DEFINE([ENABLE_DIGEST], 1,
|
||||
[Define if you want the HTTP Digest Authorization compiled in.])
|
||||
dnl Zlib: Configure use of zlib for compression
|
||||
AC_ARG_WITH([zlib],
|
||||
[AS_HELP_STRING([--without-zlib], [disable zlib.])])
|
||||
|
||||
AC_ARG_ENABLE(ntlm,
|
||||
[ --disable-ntlm disable support for NTLM authorization],
|
||||
[ENABLE_NTLM=$enableval], [ENABLE_NTLM=auto])
|
||||
dnl Metalink: Configure use of the Metalink library
|
||||
AC_ARG_WITH([metalink],
|
||||
[AS_HELP_STRING([--with-metalink], [enable support for metalinks.])])
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --disable-debug disable support for debugging output],
|
||||
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.])
|
||||
dnl C-Ares: Configure use of the c-ares library for DNS lookup
|
||||
AC_ARG_WITH(cares, AS_HELP_STRING([--with-cares], [enable support for C-Ares DNS lookup.]), with_cares=$withval, with_cares=no)
|
||||
|
||||
wget_need_md5=no
|
||||
dnl
|
||||
dnl Process features
|
||||
dnl
|
||||
|
||||
case "${ENABLE_OPIE}${ENABLE_DIGEST}" in
|
||||
*yes*)
|
||||
wget_need_md5=yes
|
||||
esac
|
||||
dnl Opie: Support for opie s/key FTP logins
|
||||
AC_ARG_ENABLE([opie],
|
||||
[AS_HELP_STRING([--disable-opie], [disable support for opie or s/key FTP login])],
|
||||
[ENABLE_OPIE=$enableval],
|
||||
[ENABLE_OPIE=yes])
|
||||
|
||||
AS_IF([test "x$ENABLE_OPIE" = xyes],
|
||||
[AC_DEFINE([ENABLE_OPIE], [1], [Define if you want Opie support for FTP compiled in.])],
|
||||
[]
|
||||
)
|
||||
|
||||
|
||||
dnl Digest: Support for HTTP Digest Authentication
|
||||
AC_ARG_ENABLE([digest],
|
||||
[AS_HELP_STRING([--disable-digest], [disable support for HTTP digest authorization])],
|
||||
[ENABLE_DIGEST=$enableval],
|
||||
[ENABLE_DIGEST=yes])
|
||||
|
||||
AS_IF([test "x$ENABLE_DIGEST" = xyes],
|
||||
[AC_DEFINE([ENABLE_DIGEST], [1], [Define if you want the HTTP Digest Authorization compiled in.])],
|
||||
[]
|
||||
)
|
||||
|
||||
|
||||
dnl NTLM: Support for HTTP NTLM Authentication
|
||||
AC_ARG_ENABLE([ntlm],
|
||||
[AS_HELP_STRING([--disable-ntlm], [disable support for NTLM authorization])],
|
||||
[ENABLE_NTLM=$enableval],
|
||||
[ENABLE_NTLM=auto]
|
||||
)
|
||||
|
||||
|
||||
dnl Debug: Support for printing debugging output
|
||||
AC_ARG_ENABLE([debug],
|
||||
[AS_HELP_STRING([--disable-debug], [disable support for debugging output])],
|
||||
[ENABLE_DEBUG=$enableval],
|
||||
[ENABLE_DEBUG=yes])
|
||||
|
||||
AS_IF([test "x$ENABLE_DEBUG" = xyes],
|
||||
[AC_DEFINE([ENABLE_DEBUG], [1], [Define if you want the debug output support compiled in.])],
|
||||
[]
|
||||
)
|
||||
|
||||
dnl Valgrind-tests: Should test suite be run under valgrind?
|
||||
AC_ARG_ENABLE(valgrind-tests,
|
||||
[AS_HELP_STRING([--enable-valgrind-tests], [enable using Valgrind for tests])],
|
||||
[ENABLE_VALGRIND=$enableval],
|
||||
[ENABLE_VALGRIND=no])
|
||||
|
||||
AS_IF([test "x$ENABLE_VALGRIND" != xno], [
|
||||
AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
|
||||
AS_IF([test "x$HAVE_VALGRIND" = xyes], [
|
||||
VALGRIND_TESTS="1"
|
||||
AC_SUBST(VALGRIND_TESTS)
|
||||
VALGRIND_INFO="Test suite will be run under Valgrind"
|
||||
], [
|
||||
VALGRIND_INFO="Valgrind not found"
|
||||
])
|
||||
], [
|
||||
VALGRIND_INFO="Valgrind testing not enabled"
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(assert,
|
||||
[AS_HELP_STRING([--enable-assert], [enable assertions in code base])],
|
||||
[ENABLE_ASSERTION=$enableval],
|
||||
[ENABLE_ASSERTION=no]
|
||||
)
|
||||
|
||||
AS_IF([test "x$ENABLE_ASSERTION" != xyes], [
|
||||
CFLAGS="-DNDEBUG $CFLAGS"
|
||||
],
|
||||
[])
|
||||
|
||||
dnl
|
||||
dnl Find the compiler
|
||||
@@ -104,13 +173,18 @@ AM_PROG_CC_C_O
|
||||
AC_AIX
|
||||
|
||||
gl_EARLY
|
||||
md5_EARLY
|
||||
|
||||
dnl
|
||||
dnl Find python3
|
||||
dnl
|
||||
AM_PATH_PYTHON([3.0],,[:])
|
||||
AM_CONDITIONAL([HAVE_PYTHON3], [test "$PYTHON" != :])
|
||||
|
||||
dnl
|
||||
dnl Gettext
|
||||
dnl
|
||||
AM_GNU_GETTEXT([external],[need-ngettext])
|
||||
AM_GNU_GETTEXT_VERSION([0.17])
|
||||
AM_GNU_GETTEXT_VERSION([0.18.1])
|
||||
|
||||
AC_PROG_RANLIB
|
||||
|
||||
@@ -123,9 +197,11 @@ dnl if compiler is gcc, then
|
||||
dnl use -O2 and some warning flags
|
||||
dnl else
|
||||
dnl use os-specific flags or -O
|
||||
dnl
|
||||
dnl For these tests, the system considers clang to be gcc
|
||||
if test -n "$auto_cflags"; then
|
||||
if test -n "$GCC"; then
|
||||
CFLAGS="$CFLAGS -O2 -Wall"
|
||||
CFLAGS="$CFLAGS -O2 -Wall -Wextra"
|
||||
else
|
||||
case "$host_os" in
|
||||
*hpux*) CFLAGS="$CFLAGS +O3" ;;
|
||||
@@ -144,8 +220,7 @@ AC_C_VOLATILE
|
||||
|
||||
dnl Check for basic headers, even though we expect them to exist and
|
||||
dnl #include them unconditionally in the code. Their detection is
|
||||
dnl still needed because test programs used by Autoconf macros check
|
||||
dnl for STDC_HEADERS, HAVE_SYS_TYPES_H, etc. before using them.
|
||||
dnl still needed because test programs used by Autoconf macros check.
|
||||
dnl Without the checks they will fail to be included in test programs,
|
||||
dnl which will subsequently fail.
|
||||
AC_HEADER_STDC
|
||||
@@ -171,11 +246,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.
|
||||
@@ -186,9 +261,7 @@ AC_CHECK_TYPES([uint32_t, uintptr_t, intptr_t, int64_t])
|
||||
AC_CHECK_TYPES(sig_atomic_t, [], [], [
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#include <signal.h>
|
||||
])
|
||||
|
||||
@@ -200,8 +273,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 strlcpy random)
|
||||
|
||||
if test x"$ENABLE_OPIE" = xyes; then
|
||||
AC_LIBOBJ([ftp-opie])
|
||||
@@ -215,37 +289,66 @@ 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.])
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
AS_IF([test "x$with_libpsl" != xno], [
|
||||
PKG_CHECK_MODULES([LIBPSL], libpsl, [
|
||||
with_libpsl=yes
|
||||
# correct $LIBPSL_LIBS (in libpsl <= 0.6.0)
|
||||
AS_IF([test "x$LIBPSL_LIBS" = "x-llibpsl "], [LIBPSL_LIBS="-lpsl"])
|
||||
LIBS="$LIBPSL_LIBS $LIBS"
|
||||
CFLAGS="$LIBPSL_CFLAGS $CFLAGS"
|
||||
AC_DEFINE([HAVE_LIBPSL], [1], [PSL support enabled])
|
||||
], [
|
||||
AC_SEARCH_LIBS(psl_builtin, psl,
|
||||
[with_libpsl=yes; AC_DEFINE([HAVE_LIBPSL], [1], [PSL support enabled])],
|
||||
[with_libpsl=no; AC_MSG_WARN(*** libpsl was not found. Fallback to builtin cookie checking.)])
|
||||
])
|
||||
])
|
||||
|
||||
AS_IF([test x"$with_libpsl" = xyes], [
|
||||
AC_CHECK_FUNCS(psl_latest)
|
||||
])
|
||||
|
||||
AS_IF([test x"$with_zlib" != xno], [
|
||||
with_zlib=yes
|
||||
PKG_CHECK_MODULES([ZLIB], zlib, [
|
||||
LIBS="$ZLIB_LIBS $LIBS"
|
||||
CFLAGS="$ZLIB_CFLAGS $CFLAGS"
|
||||
AC_DEFINE([HAVE_LIBZ], [1], [Define if using zlib.])
|
||||
], [
|
||||
AC_CHECK_LIB(z, compress)
|
||||
])
|
||||
])
|
||||
|
||||
AS_IF([test x"$with_ssl" = xopenssl], [
|
||||
if [test x"$with_libssl_prefix" = x]; then
|
||||
PKG_CHECK_MODULES([OPENSSL], [openssl], [
|
||||
AC_MSG_NOTICE([compiling in support for SSL via OpenSSL])
|
||||
AC_LIBOBJ([openssl])
|
||||
LIBS="$OPENSSL_LIBS $LIBS"
|
||||
CFLAGS="$OPENSSL_CFLAGS -DHAVE_LIBSSL $CFLAGS"
|
||||
LIBSSL=" " # ntlm check below wants this
|
||||
AC_CHECK_FUNCS([RAND_egd])
|
||||
AC_DEFINE([HAVE_LIBSSL], [1], [Define if using openssl.])
|
||||
ssl_found=yes
|
||||
])
|
||||
fi
|
||||
], [
|
||||
# --with-ssl is not gnutls: check if it's no
|
||||
AS_IF([test x"$with_ssl" != xno], [
|
||||
if [test x"$ssl_found" != xyes]; then
|
||||
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
|
||||
@@ -254,114 +357,164 @@ AS_IF([test x"$with_ssl" = xgnutls], [
|
||||
AC_CHECK_LIB(dl, shl_load)
|
||||
])
|
||||
|
||||
dnl Now actually check for -lssl
|
||||
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>
|
||||
], [SSL_library_init ()])
|
||||
if test x"$LIBSSL" != x
|
||||
then
|
||||
AC_MSG_NOTICE([compiling in support for SSL via OpenSSL])
|
||||
AC_LIBOBJ([openssl])
|
||||
elif test x"$with_ssl" != x
|
||||
then
|
||||
AC_MSG_ERROR([--with-ssl was given, but SSL is not available.])
|
||||
fi
|
||||
]) # endif: --with-ssl == no?
|
||||
]) # endif: --with-ssl == gnutls?
|
||||
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>
|
||||
], [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"
|
||||
AC_CHECK_FUNCS([RAND_egd])
|
||||
elif test x"$with_ssl" != x
|
||||
then
|
||||
AC_MSG_ERROR([--with-ssl=openssl was given, but SSL is not available.])
|
||||
fi
|
||||
])
|
||||
fi
|
||||
], [
|
||||
# --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
|
||||
if [test x"$with_libgnutls_prefix" = x]; then
|
||||
PKG_CHECK_MODULES([GNUTLS], [gnutls], [
|
||||
AC_MSG_NOTICE([compiling in support for SSL via GnuTLS])
|
||||
AC_LIBOBJ([gnutls])
|
||||
LIBS="$GNUTLS_LIBS $LIBS"
|
||||
CFLAGS="$GNUTLS_CFLAGS -DHAVE_LIBGNUTLS $CFLAGS"
|
||||
AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define if using gnutls.])
|
||||
ssl_found=yes
|
||||
])
|
||||
fi
|
||||
if [test x"$ssl_found" != xyes]; then
|
||||
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([GnuTLS has not been found. Use --with-ssl=openssl if you explicitly want OpenSSL.])
|
||||
fi
|
||||
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
|
||||
dnl Check for libmetalink
|
||||
dnl
|
||||
AS_IF([test x"$with_metalink" != xno], [
|
||||
PKG_CHECK_MODULES([METALINK], libmetalink, [
|
||||
LIBS="$METALINK_LIBS $LIBS"
|
||||
CFLAGS="$METALINK_CFLAGS $CFLAGS"
|
||||
AC_DEFINE([HAVE_METALINK], [1], [Define if using metalink.])
|
||||
with_metalink=yes
|
||||
], [
|
||||
with_metalink=no
|
||||
])
|
||||
|
||||
have_gpg=no
|
||||
AS_IF([test x"$with_metalink" = xyes], [
|
||||
dnl
|
||||
dnl Check for GPGME
|
||||
dnl
|
||||
m4_ifdef([AM_PATH_GPGME], [
|
||||
AM_PATH_GPGME([], [
|
||||
LIBS="$GPGME_LIBS $LIBS"
|
||||
CFLAGS="$GPGME_CFLAGS $CFLAGS"
|
||||
AC_DEFINE([HAVE_GPGME], [1], [Define if GPGME is available.])
|
||||
have_gpg=yes
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Checks for IPv6
|
||||
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 +549,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 +574,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
|
||||
@@ -495,9 +630,6 @@ AC_ARG_ENABLE(iri,
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
|
||||
[Support IDN/IRIs (needs GNU Libidn)]),
|
||||
libidn=$withval, libidn="")
|
||||
AS_IF([test "X$iri" != "Xno"],[
|
||||
AM_ICONV
|
||||
|
||||
@@ -509,51 +641,175 @@ AS_IF([test "X$iri" != "Xno"],[
|
||||
AC_MSG_NOTICE([disabling IRIs because libiconv wasn't found])
|
||||
fi
|
||||
fi
|
||||
],[ # else
|
||||
# For some reason, this seems to be set even when we don't check.
|
||||
# Explicitly unset.
|
||||
LIBICONV=
|
||||
])
|
||||
|
||||
AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
|
||||
[Support IDN2008/IRIs (needs GNU libidn2 + libunicode)]),
|
||||
libidn=$withval, libidn="")
|
||||
if test "X$iri" != "Xno"; then
|
||||
if test "$libidn" != ""; then
|
||||
LDFLAGS="${LDFLAGS} -L$libidn/lib"
|
||||
CPPFLAGS="${CPPFLAGS} -I$libidn/include"
|
||||
fi
|
||||
AS_IF([test "x$with_libidn2" != xno], [
|
||||
AC_SEARCH_LIBS(idn2_lookup_u8, idn2,
|
||||
[with_libidn2=yes; AC_DEFINE([ENABLE_IRI], 1, [Define if IRI support is enabled.])],
|
||||
[with_libidn2=no; iri=no; AC_MSG_WARN(*** LIBIDN2 was not found. You will not be able to use IDN2008 support)])
|
||||
|
||||
# If idna.h can't be found, check to see if it was installed under
|
||||
# /usr/include/idn (OpenSolaris, at least, places it there).
|
||||
# Check for idn-int.h in that case, because idna.h won't find
|
||||
# idn-int.h until we've decided to add -I/usr/include/idn.
|
||||
AC_CHECK_HEADER(idna.h, ,
|
||||
[AC_CHECK_HEADER(idn/idn-int.h,
|
||||
[CPPFLAGS="${CPPFLAGS} -I/usr/include/idn"],
|
||||
[iri=no])]
|
||||
)
|
||||
|
||||
if test "X$iri" != "Xno"; then
|
||||
AC_CHECK_LIB(idn, stringprep_check_version,
|
||||
[iri=yes LIBS="${LIBS} -lidn"], iri=no)
|
||||
fi
|
||||
|
||||
if test "X$iri" != "Xno" ; then
|
||||
AC_DEFINE([ENABLE_IRI], 1, [Define if IRI support is enabled.])
|
||||
AC_MSG_NOTICE([Enabling support for IRI.])
|
||||
else
|
||||
AC_MSG_WARN([Libidn not found])
|
||||
fi
|
||||
# AS_IF([test "x$with_libidn2" = xyes], [
|
||||
# AC_SEARCH_LIBS(u8_tolower, unistring,
|
||||
# [AC_DEFINE([ENABLE_IRI], 1, [Define if IRI support is enabled.])],
|
||||
# [iri=no; AC_MSG_WARN(*** LIBUNISTRING was not found. You will not be able to use IDN2008 support)])
|
||||
# ])
|
||||
])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check for UUID
|
||||
dnl
|
||||
|
||||
AC_ARG_WITH(libuuid, AC_HELP_STRING([--without-libuuid],
|
||||
[Generate UUIDs for WARC files via libuuid]))
|
||||
|
||||
AS_IF([test "x$with_libuuid" = xyes], [
|
||||
# libuuid was explicitly requested
|
||||
PKG_CHECK_MODULES([UUID], uuid, [
|
||||
LIBS="$UUID_LIBS $LIBS"
|
||||
CFLAGS="$UUID_CFLAGS $CFLAGS"
|
||||
uuid_mode=1
|
||||
], [
|
||||
AC_SEARCH_LIBS(uuid_generate, uuid,
|
||||
[uuid_mode=1],
|
||||
[AC_MSG_ERROR(*** libuuid was explicitly requested but wasn't found.)])
|
||||
])
|
||||
], [test "x$with_libuuid" = xno], [
|
||||
# libuuid was explicitly *not* requested
|
||||
AC_CHECK_HEADER(uuid.h,
|
||||
AC_CHECK_FUNC(uuid_create, [uuid_mode=2]))
|
||||
], [
|
||||
# default:
|
||||
AC_CHECK_HEADER(uuid.h, [
|
||||
AC_CHECK_FUNC(uuid_create, [uuid_mode=2])
|
||||
], [
|
||||
AC_CHECK_HEADER(uuid/uuid.h,
|
||||
AC_SEARCH_LIBS(uuid_generate, uuid, [uuid_mode=1]))
|
||||
])
|
||||
])
|
||||
|
||||
AS_IF([test "x$uuid_mode" = x1], [
|
||||
AC_DEFINE([HAVE_LIBUUID], [1], [Define if using libuuid.])
|
||||
], [test "x$uuid_mode" = x2], [
|
||||
AC_DEFINE([HAVE_UUID_CREATE], 1, [Define if uuid_create is available.])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Check for PCRE
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(pcre, AC_HELP_STRING([--disable-pcre],
|
||||
[Disable PCRE style regular expressions]))
|
||||
|
||||
AS_IF([test "X$enable_pcre" != "Xno"],[
|
||||
PKG_CHECK_MODULES([PCRE], libpcre, [
|
||||
CFLAGS="$PCRE_CFLAGS $CFLAGS"
|
||||
AC_CHECK_HEADER(pcre.h, [
|
||||
LIBS="$PCRE_LIBS $LIBS"
|
||||
AC_DEFINE([HAVE_LIBPCRE], [1], [Define if libpcre is available.])
|
||||
])
|
||||
], [
|
||||
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
|
||||
dnl Check for libcares (resolver library)
|
||||
dnl
|
||||
|
||||
AS_IF([test "X$with_cares" = "Xyes"],[
|
||||
PKG_CHECK_MODULES([CARES], libcares, [
|
||||
CFLAGS="$CARES_CFLAGS $CFLAGS"
|
||||
AC_CHECK_HEADER(ares.h, [
|
||||
LIBS="$CARES_LIBS $LIBS"
|
||||
AC_DEFINE([HAVE_LIBCARES], [1], [Define if libcares is available.])
|
||||
RESOLVER_INFO="libcares, --bind-dns-address and --dns-servers available"
|
||||
])
|
||||
], [
|
||||
AC_CHECK_HEADER(ares.h, [
|
||||
AC_CHECK_LIB(cares, ares_set_local_ip4, [
|
||||
LIBS="-lcares ${LIBS}"
|
||||
AC_DEFINE([HAVE_LIBCARES], 1, [Define if libcares is available.])
|
||||
RESOLVER_INFO="libcares, --bind-dns-address and --dns-servers available"
|
||||
])
|
||||
])
|
||||
])
|
||||
], [
|
||||
RESOLVER_INFO="libc, --bind-dns-address and --dns-servers not available"
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Extended Attribute support
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE([xattr],
|
||||
[AS_HELP_STRING([--disable-xattr], [disable support for POSIX Extended Attributes])],
|
||||
[ENABLE_XATTR=$enableval],
|
||||
[ENABLE_XATTR=yes])
|
||||
|
||||
case "$host_os" in
|
||||
*linux* | *darwin*) xattr_syscalls="fsetxattr" ;;
|
||||
freebsd*) xattr_syscalls="extattr_set_fd" ;;
|
||||
*) AC_MSG_NOTICE([Disabling Extended Attribute support: your system is not known to support extended attributes.])
|
||||
ENABLE_XATTR=no
|
||||
esac
|
||||
|
||||
if test "X${ENABLE_XATTR}" = "Xyes"; then
|
||||
AC_CHECK_FUNCS([$xattr_syscalls], [], [
|
||||
AC_MSG_NOTICE([Disabling Extended Attribute support: your system does not support $xattr_syscalls])
|
||||
ENABLE_XATTR=no
|
||||
])
|
||||
fi
|
||||
|
||||
test "X${ENABLE_XATTR}" = "Xyes" && AC_DEFINE([ENABLE_XATTR], 1,
|
||||
[Define if you want file meta-data storing into POSIX Extended Attributes compiled in.])
|
||||
|
||||
dnl Needed by src/Makefile.am
|
||||
AM_CONDITIONAL([IRI_IS_ENABLED], [test "X$iri" != "Xno"])
|
||||
|
||||
AM_CONDITIONAL([WITH_SSL], [test "X$with_ssl" != "Xno"])
|
||||
AM_CONDITIONAL([METALINK_IS_ENABLED], [test "X$with_metalink" != "Xno"])
|
||||
AM_CONDITIONAL([WITH_XATTR], [test "X$ENABLE_XATTR" != "Xno"])
|
||||
|
||||
dnl
|
||||
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])
|
||||
po/Makefile.in tests/Makefile
|
||||
lib/Makefile testenv/Makefile
|
||||
tests/certs/interca.conf tests/certs/rootca.conf])
|
||||
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
|
||||
PSL: $with_libpsl
|
||||
Digest: $ENABLE_DIGEST
|
||||
NTLM: $ENABLE_NTLM
|
||||
OPIE: $ENABLE_OPIE
|
||||
POSIX xattr: $ENABLE_XATTR
|
||||
Debugging: $ENABLE_DEBUG
|
||||
Assertions: $ENABLE_ASSERTION
|
||||
Valgrind: $VALGRIND_INFO
|
||||
Metalink: $with_metalink
|
||||
Resolver: $RESOLVER_INFO
|
||||
GPGME: $have_gpg
|
||||
IRI: $iri
|
||||
])
|
||||
|
||||
@@ -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
|
||||
55
contrib/check-hard
Executable file
55
contrib/check-hard
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Do some checking before 'git push'.
|
||||
|
||||
# Set a stricter bash mode
|
||||
set -e
|
||||
set -u
|
||||
|
||||
CORES=$(grep -c ^processor /proc/cpuinfo 2> /dev/null || echo 0)
|
||||
if [ $CORES -lt 1 ]; then CORES=1; fi
|
||||
|
||||
echo "Running: make distclean"
|
||||
make distclean > /dev/null || true
|
||||
|
||||
#CFLAGS="-std=c89 -pedantic -O0 -g -Wall -Wextra -Wstrict-prototypes -Wold-style-definition -Wwrite-strings -Wshadow -Wformat -Wformat-security -Wunreachable-code -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition"
|
||||
CFLAGS="-Wall -Wextra -O2 -g"
|
||||
|
||||
CACHEFILE=$PWD/config_check.cache
|
||||
|
||||
# measure time consumed and print it at the end of the script
|
||||
START=$(date +%s.%N)
|
||||
|
||||
echo "Running: ./bootstrap"
|
||||
./bootstrap > /dev/null
|
||||
echo
|
||||
|
||||
for CC in gcc clang; do
|
||||
export CC
|
||||
echo "*** Testing with CC=$CC"
|
||||
|
||||
# the compiler changed, so we have to remove the cache file here
|
||||
rm -f $CACHEFILE
|
||||
|
||||
for options in "" "--with-ssl=openssl" "--disable-iri"; do
|
||||
export DISTCHECK_CONFIGURE_FLAGS="-C --cache-file=$CACHEFILE $options"
|
||||
echo " ./configure $DISTCHECK_CONFIGURE_FLAGS"
|
||||
./configure $DISTCHECK_CONFIGURE_FLAGS CFLAGS="$CFLAGS" > /dev/null
|
||||
|
||||
for xVALGRIND in 0 1; do
|
||||
for xLCALL in C tr_TR.utf8; do
|
||||
export TESTS_ENVIRONMENT="LC_ALL=$xLCALL VALGRIND_TESTS=$xVALGRIND"
|
||||
echo " TESTS_ENVIRONMENT=\"$TESTS_ENVIRONMENT\"" make check -j$CORES
|
||||
make check -j$CORES > /dev/null
|
||||
done
|
||||
done
|
||||
|
||||
unset TESTS_ENVIRONMENT
|
||||
export TESTS_ENVIRONMENT
|
||||
echo " make distcheck CFLAGS=$CFLAGS -j$CORES"
|
||||
make distcheck CFLAGS="$CFLAGS" -j$CORES > /dev/null
|
||||
done
|
||||
done
|
||||
|
||||
END=$(date +%s.%N)
|
||||
echo "Duration: "$(echo "$END - $START" | bc)
|
||||
112
contrib/release
Executable file
112
contrib/release
Executable file
@@ -0,0 +1,112 @@
|
||||
#!/bin/bash -e
|
||||
#
|
||||
# Written 2016 by Tim Ruehsen
|
||||
|
||||
extensions="gz xz"
|
||||
app_name=$(grep "^PACKAGE_NAME='" configure|cut -d "'" -f2)
|
||||
app_ver=$(grep "^PACKAGE_VERSION='" configure|cut -d "'" -f2)
|
||||
|
||||
echo "Current version of $app_name is $app_ver"
|
||||
echo
|
||||
echo -n "Enter Y if that is OK, else enter N and edit configure.ac: "
|
||||
read x
|
||||
[ "$x" != "y" -a "$x" != "Y" ] && exit 0
|
||||
|
||||
echo
|
||||
grep -i "Changes in $app_name" NEWS|head -1
|
||||
echo -n "Did you edit the NEWS file ? [y/N] "
|
||||
read x
|
||||
[ "$x" != "y" -a "$x" != "Y" ] && exit 0
|
||||
|
||||
echo
|
||||
|
||||
export CFLAGS="-g -O2 -Wall"
|
||||
|
||||
echo "* Bootstrap"
|
||||
./bootstrap >/dev/null
|
||||
|
||||
echo "* Configure"
|
||||
./configure -q
|
||||
|
||||
echo "* Make"
|
||||
make -s clean
|
||||
make -s
|
||||
|
||||
echo "* Make distcheck"
|
||||
make -s distcheck >/dev/null
|
||||
|
||||
echo "* Make dist"
|
||||
make -s dist >/dev/null
|
||||
make -s dist-xz >/dev/null
|
||||
|
||||
while true; do
|
||||
echo "Alpha or Regular release ? [r/A] "
|
||||
read x
|
||||
if test "$x" = "r" || test "$x" = "R"; then
|
||||
directory="/incoming/ftp"
|
||||
break
|
||||
elif test "$x" = "a" || test "$x" = "A"; then
|
||||
directory="/incoming/alpha"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
x=$(gpg --list-secret-keys 2>/dev/null|grep ^sec|awk '{ print $2 }')
|
||||
echo $x
|
||||
if [ "$x" = "" ]; then
|
||||
echo No signing key found - please check with 'gpg --list-secret-keys'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# arrays just work in Bash
|
||||
keys=($x)
|
||||
if [ ${#keys[@]} -eq 1 ]; then
|
||||
IFS='/' arr=($x)
|
||||
signing_key=${arr[1]}
|
||||
else
|
||||
for ((i=0; i < ${#keys[@]}; i++)); do
|
||||
echo "$((i+1))) ${keys[i]}"
|
||||
done
|
||||
while true; do
|
||||
echo -n "Enter 1-${#keys[@]}: "
|
||||
read x
|
||||
|
||||
# check for digits only
|
||||
if [ -n "${i//[0-9]/}" ]; then continue; fi
|
||||
|
||||
if test $x -ge 1 || test $x -le ${#keys[@]}; then
|
||||
IFS='/' arr=(${keys[$((x-1))]})
|
||||
signing_key=${arr[1]}
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
unset IFS
|
||||
echo $signing_key
|
||||
|
||||
# fetch app_version again, just in case
|
||||
app_ver=$(grep "^PACKAGE_VERSION='" configure|cut -d "'" -f2)
|
||||
|
||||
for ext in $extensions; do
|
||||
app_tarball="${app_name}-${app_ver}.tar.$ext"
|
||||
gpg --default-key $signing_key --yes -b $app_tarball
|
||||
|
||||
echo -e "version: 1.2\nfilename: ${app_tarball}\ndirectory: ${app_name}\n" >${app_tarball}.directive
|
||||
gpg --default-key $signing_key --yes --clearsign ${app_tarball}.directive
|
||||
|
||||
ftp -v -n -i -p ftp-upload.gnu.org <<EOF
|
||||
user anonymous
|
||||
cd $directory
|
||||
put ${app_tarball}
|
||||
put ${app_tarball}.sig
|
||||
put ${app_tarball}.directive.asc
|
||||
EOF
|
||||
|
||||
done
|
||||
|
||||
prev_tag=`git tag|tail -2|head -1`
|
||||
echo "Don't forget to mention the following contributors in the announcement:"
|
||||
(
|
||||
git log ${prev_tag}.. --format="%aN" --reverse
|
||||
git log ${prev_tag}.. --reverse|grep -i reported|cut -d':' -f2|cut -d'<' -f1|cut -d' ' -f2-|tr -d '"'
|
||||
) | sort -u
|
||||
60
contrib/travis-ci
Executable file
60
contrib/travis-ci
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set a stricter bash mode
|
||||
set -e
|
||||
set -u
|
||||
|
||||
# Set up the subset of tests this Matrix instance will run.
|
||||
|
||||
# One instance is forked for each of the SSL library possibilities
|
||||
SSL=${1:-""}
|
||||
case $SSL in
|
||||
"") SSL_LIB="--without-ssl";;
|
||||
"openssl") SSL_LIB="--with-ssl=openssl";;
|
||||
"gnutls") SSL_LIB="--with-ssl=gnutls";;
|
||||
esac
|
||||
|
||||
# For some reason. /proc/cpuinfo reports 16 cores on Travis, while the docs
|
||||
# claim that each instance has only 2 cores. We believe the docs and force a
|
||||
# value of n+1 here.
|
||||
CORES=3
|
||||
|
||||
# Define a large number of Warning flags for the compiler. Hopefully, someone
|
||||
# will sit and analyze the output to clean the warnings from the codebase.
|
||||
CFLAGS="-std=c89 -pedantic -O0 -Wall -Wextra -Wstrict-prototypes -Wold-style-definition -Wwrite-strings -Wshadow -Wformat -Wformat-security -Wunreachable-code -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition"
|
||||
|
||||
# A cachefile for ./configure. Saves significant time when reconfiguring
|
||||
CACHEFILE=$PWD/config_check.cache
|
||||
|
||||
# measure time consumed and print it at the end of the script
|
||||
START=$(date +%s)
|
||||
|
||||
# Test different Permutations of Wget. Always under Valgrind
|
||||
#
|
||||
# Options:
|
||||
# - All Features Enabled
|
||||
# - C [Default Locale]
|
||||
# - Russian [Multibyte / Multicolumn Locale]
|
||||
# - Turkish [Special Test due to issues with language]
|
||||
# - IPv6 Disabled
|
||||
# - C
|
||||
for options in "" "--disable-ipv6"; do
|
||||
export DISTCHECK_CONFIGURE_FLAGS="-C --cache-file=$CACHEFILE --enable-assert --enable-valgrind-tests $SSL_LIB $options"
|
||||
echo " ./configure $DISTCHECK_CONFIGURE_FLAGS CFLAGS=\"$CFLAGS\""
|
||||
./configure $DISTCHECK_CONFIGURE_FLAGS CFLAGS="$CFLAGS"
|
||||
|
||||
if [[ -z $options ]]; then
|
||||
LANG_ARR=("ru_RU.UTF-8" "tr_TR.UTF-8" "C")
|
||||
else
|
||||
LANG_ARR=("C")
|
||||
fi
|
||||
|
||||
for xLCALL in "${LANG_ARR[@]}"; do
|
||||
export TESTS_ENVIRONMENT="LC_ALL=$xLCALL VALGRIND_TESTS=1"
|
||||
echo " TESTS_ENVIRONMENT=\"$TESTS_ENVIRONMENT\" make distcheck CFLAGS=$CFLAGS -j$CORES"
|
||||
make distcheck CFLAGS="$CFLAGS" -j$CORES
|
||||
done
|
||||
done
|
||||
|
||||
END=$(date +%s)
|
||||
echo "Duration: $((END-START))"
|
||||
90
contrib/tsocked-wget
Executable file
90
contrib/tsocked-wget
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script that executes wget using a socks proxy if the environment variable
|
||||
# socks_proxy is set.
|
||||
#
|
||||
# The socks_proxy variable shall have one of the forms:
|
||||
# socks://username:password@host:port
|
||||
# socks4://username:password@host:port
|
||||
# socks5://username:password@host:port
|
||||
# with username, password and port fields being optional
|
||||
#
|
||||
# As socksification applies to the whole process, domains defined in the
|
||||
# no_proxy setting are *not* excluded.
|
||||
#
|
||||
|
||||
# Requisites: bash (version 3.2.3 or later), tsocks and wget
|
||||
|
||||
####################################
|
||||
# Copyright (C) 2014 Ángel González
|
||||
# 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
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
set -eu
|
||||
|
||||
# Binary to be executed. Use an absolute path if installing this script as 'wget'
|
||||
WGET=wget
|
||||
|
||||
if [ -z "${socks_proxy:-}" ]; then
|
||||
exec "$WGET" "$@"
|
||||
fi
|
||||
|
||||
CONFIG=""
|
||||
|
||||
if [[ "${socks_proxy}" =~ ^socks[45]?:// ]]; then
|
||||
if [[ "${socks_proxy:5:1}" != ":" ]]; then
|
||||
CONFIG+="server_type = ${socks_proxy:5:1}"
|
||||
socks_proxy="${socks_proxy:9}"
|
||||
else
|
||||
socks_proxy="${socks_proxy:8}"
|
||||
fi
|
||||
elif [[ "${socks_proxy}" =~ ^[[:alnum:]]*:// ]]; then
|
||||
echo "Bad value specified for socks_proxy: $socks_proxy" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ "${socks_proxy}" =~ ^([^@:]*)(:([^@]*))?@ ]]; then
|
||||
unset TSOCKS_USERNAME
|
||||
CONFIG+="
|
||||
default_user = ${BASH_REMATCH[1]}"
|
||||
|
||||
if [ ! -z "${BASH_REMATCH[3]}" ]; then
|
||||
unset TSOCKS_PASSWORD
|
||||
CONFIG+="
|
||||
default_pass = ${BASH_REMATCH[3]}"
|
||||
fi
|
||||
socks_proxy="${socks_proxy:${#BASH_REMATCH[0]}}"
|
||||
fi
|
||||
|
||||
|
||||
# Get rid of trailing slashes
|
||||
if [[ "${socks_proxy}" =~ ^([^/]*)/ ]]; then
|
||||
socks_proxy="${socks_proxy:0:${#BASH_REMATCH[1]}}"
|
||||
fi
|
||||
|
||||
if [[ "${socks_proxy}" =~ :([0-9]+)$ ]]; then
|
||||
CONFIG+="
|
||||
server_port = ${BASH_REMATCH[1]}"
|
||||
socks_proxy=${socks_proxy:0:${#socks_proxy} - ${#BASH_REMATCH[0]}}
|
||||
fi
|
||||
|
||||
CONFIG+="
|
||||
server = ${socks_proxy}"
|
||||
|
||||
TSOCKS_CONF_FILE=<(echo "$CONFIG") exec tsocks "$WGET" --no-proxy "$@"
|
||||
1392
doc/ChangeLog
1392
doc/ChangeLog
File diff suppressed because it is too large
Load Diff
@@ -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, 2015
|
||||
# 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,9 +54,10 @@ 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@" --utf8 $? > $@ || \
|
||||
$(POD2MAN) --center="GNU Wget" --release="GNU Wget @VERSION@" $? > $@
|
||||
|
||||
#wget.cat: $(MAN)
|
||||
|
||||
104
doc/announcement_1.19.txt
Normal file
104
doc/announcement_1.19.txt
Normal file
@@ -0,0 +1,104 @@
|
||||
Hello,
|
||||
|
||||
we are pleased to announce the new version of GNU wget 1.19.
|
||||
|
||||
It comes with major improvements for Metalink, IDNA2008 for
|
||||
international domain names, an option to call external tools
|
||||
for fetching user/password, several bugfixes and improvements.
|
||||
|
||||
Many thanks go to all the contributors and list activists !
|
||||
|
||||
Contributors (from the git log):
|
||||
Ander Juaristi
|
||||
Dale R. Worley
|
||||
Eli Zaretskii
|
||||
Gisle Vanem
|
||||
Giuseppe Scrivano
|
||||
Göran Uddeborg
|
||||
Jann Horn
|
||||
Jeffery To
|
||||
Jérémie Courrèges-Anglas
|
||||
Liam R. Howlett
|
||||
losgrandes
|
||||
Matthew White
|
||||
Misra, Deapesh
|
||||
Nikos Mavrogiannopoulos
|
||||
Noël Köthe
|
||||
Piotr Wajda
|
||||
Rahul Bedarkar
|
||||
Sean Burford
|
||||
Tim Rühsen
|
||||
Tobias Stoeckmann
|
||||
vijeth-aradhya
|
||||
|
||||
|
||||
The new version is available for download here:
|
||||
|
||||
https://ftp.gnu.org/gnu/wget/wget-1.19.tar.gz
|
||||
https://ftp.gnu.org/gnu/wget/wget-1.19.tar.xz
|
||||
|
||||
and the GPG detached signatures using the key 0x08302DB6A2670428:
|
||||
|
||||
https://ftp.gnu.org/gnu/wget/wget-1.19.tar.gz.sig
|
||||
https://ftp.gnu.org/gnu/wget/wget-1.19.tar.xz.sig
|
||||
|
||||
To reduce load on the main server, you can use this redirector service
|
||||
which automatically redirects you to a mirror:
|
||||
|
||||
http://ftpmirror.gnu.org/wget/wget-1.19.tar.gz
|
||||
http://ftpmirror.gnu.org/wget/wget-1.19.tar.xz
|
||||
|
||||
|
||||
Noteworthy changes:
|
||||
|
||||
* New option --use-askpass=COMMAND. Fetch user/password by calling
|
||||
an external program.
|
||||
|
||||
* Use IDNA2008 (+ TR46 if available) through libidn2
|
||||
|
||||
* When processing a Metalink header, --metalink-index=<number> allows
|
||||
to process the header's application/metalink4+xml files.
|
||||
|
||||
* When processing a Metalink file, --trust-server-names enables the
|
||||
use of the destination file names specified in the Metalink file,
|
||||
otherwise a safe destination file name is computed.
|
||||
|
||||
* When processing a Metalink file, enforce a safe destination path.
|
||||
Remove any drive letter prefix under w32, i.e. 'C:D:file'. Call
|
||||
libmetalink's metalink_check_safe_path() to prevent absolute,
|
||||
relative, or home paths:
|
||||
https://tools.ietf.org/html/rfc5854#section-4.1.2.1
|
||||
https://tools.ietf.org/html/rfc5854#section-4.2.8.3
|
||||
|
||||
* When processing a Metalink file, --directory-prefix=<prefix> sets
|
||||
the top of the retrieval tree to prefix for Metalink downloads.
|
||||
|
||||
* When processing a Metalink file, reject downloaded files which don't
|
||||
agree with their own metalink:size value:
|
||||
https://tools.ietf.org/html/rfc5854#section-4.2.16
|
||||
|
||||
* When processing a Metalink file, with --continue resume partially
|
||||
downloaded files and keep fully downloaded files even if they fail
|
||||
the verification.
|
||||
|
||||
* When processing a Metalink file, create the parent directories of a
|
||||
"path/file" destination file name:
|
||||
https://tools.ietf.org/html/rfc5854#section-4.1.2.1
|
||||
https://tools.ietf.org/html/rfc5854#section-4.2.8.3
|
||||
|
||||
* On a recursive download, append a .tmp suffix to temporary files
|
||||
that will be deleted after being parsed, and create them
|
||||
readable/writable only by the owner.
|
||||
|
||||
* New make target 'check-valgrind'
|
||||
|
||||
* Fix several bugs
|
||||
|
||||
* Fix compatibility issues
|
||||
|
||||
|
||||
Please report any problem you may experience to the bug-wget@gnu.org
|
||||
mailing list.
|
||||
|
||||
For the maintainers of Wget,
|
||||
Tim
|
||||
25
doc/fdl.texi
25
doc/fdl.texi
@@ -5,7 +5,7 @@
|
||||
@c hence no sectioning command or @node.
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008, 2009 Free Software
|
||||
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008, 2015 Free Software
|
||||
Foundation, Inc.
|
||||
@uref{http://fsf.org/}
|
||||
|
||||
@@ -93,16 +93,16 @@ An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not ``Transparent'' is called ``Opaque''.
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
@sc{ascii} without markup, Texinfo input format, La@TeX{} input
|
||||
format, @acronym{SGML} or @acronym{XML} using a publicly available
|
||||
@acronym{DTD}, and standard-conforming simple @acronym{HTML},
|
||||
PostScript or @acronym{PDF} designed for human modification. Examples
|
||||
of transparent image formats include @acronym{PNG}, @acronym{XCF} and
|
||||
@acronym{JPG}. Opaque formats include proprietary formats that can be
|
||||
read and edited only by proprietary word processors, @acronym{SGML} or
|
||||
@acronym{XML} for which the @acronym{DTD} and/or processing tools are
|
||||
not generally available, and the machine-generated @acronym{HTML},
|
||||
PostScript or @acronym{PDF} produced by some word processors for
|
||||
ASCII without markup, Texinfo input format, La@TeX{} input
|
||||
format, SGML or XML using a publicly available
|
||||
DTD, and standard-conforming simple HTML,
|
||||
PostScript or PDF designed for human modification. Examples
|
||||
of transparent image formats include PNG, XCF and
|
||||
JPG@. Opaque formats include proprietary formats that can be
|
||||
read and edited only by proprietary word processors, SGML or
|
||||
XML for which the DTD and/or processing tools are
|
||||
not generally available, and the machine-generated HTML,
|
||||
PostScript or PDF produced by some word processors for
|
||||
output purposes only.
|
||||
|
||||
The ``Title Page'' means, for a printed book, the title page itself,
|
||||
@@ -482,7 +482,7 @@ license notices just after the title page:
|
||||
@end smallexample
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the ``with@dots{}Texts.'' line with this:
|
||||
replace the ``with@dots{}Texts.''@: line with this:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
@@ -504,4 +504,3 @@ to permit their use in free software.
|
||||
@c Local Variables:
|
||||
@c ispell-local-pdict: "ispell-dict"
|
||||
@c End:
|
||||
|
||||
|
||||
233
doc/metalink-standard.txt
Normal file
233
doc/metalink-standard.txt
Normal file
@@ -0,0 +1,233 @@
|
||||
GNU Wget Metalink recommended behaviour
|
||||
|
||||
Metalink/XML and Metalink/HTTP standard reference
|
||||
|
||||
|
||||
1. Security features
|
||||
********************
|
||||
|
||||
Only metalink:file elements with safe "name" fields shall be accepted
|
||||
[1 #section-4.1.2.1]. If unsafe metalink:file elements are saved, any
|
||||
related test shall fail (see '2. Tests').
|
||||
|
||||
By design, libmetalink rejects unsafe metalink:file elements [3]:
|
||||
* lib/metalink_helper.c (metalink_check_safe_path): Verify path
|
||||
|
||||
1.1 Exceptions
|
||||
==============
|
||||
|
||||
The option --directory-prefix could allow to use an absolute, relative
|
||||
or home path.
|
||||
|
||||
2. Tests
|
||||
********
|
||||
|
||||
Saving a file to an unexpected path poses a security problem. We must
|
||||
ensure that Wget's automated tests never modify the root and the home
|
||||
paths or descend/escalate to a relative path unexpectedly.
|
||||
|
||||
2.1 Metalink/XML implemented tests
|
||||
==================================
|
||||
|
||||
See testenv/Makefile.am (METALINK_TESTS).
|
||||
|
||||
2.2 Metalink/HTTP implemented tests
|
||||
===================================
|
||||
|
||||
See testenv/Makefile.am (METALINK_TESTS).
|
||||
|
||||
3. Download file name
|
||||
*********************
|
||||
|
||||
The download file name shall be decided by precise rules which prevent
|
||||
any naming uncertainty and security issues.
|
||||
|
||||
3.1 Naming rules
|
||||
================
|
||||
|
||||
The final name of downloaded files is computed starting from a trusted
|
||||
name, which is then combined with the "Directory Options". The result
|
||||
is verified and eventually made safer following security rules. If the
|
||||
final name isn't found safe enough, then the file isn't downloaded.
|
||||
|
||||
Depending on the options used, a suffix could be appended to the final
|
||||
name to not overwrite existing files.
|
||||
|
||||
3.1.1 The trusted name
|
||||
======================
|
||||
|
||||
The option --trust-server-names decides what is the trusted name.
|
||||
|
||||
Any Metalink/XML element with an unsafe metalink:file "name" field is
|
||||
ignored, see '1. Security features'.
|
||||
|
||||
3.1.1.1 Without --trust-server-names
|
||||
====================================
|
||||
|
||||
When --trust-server-names is off, the basename of the --input-metalink
|
||||
file, if available, or of the mother URL is trusted. This trusted name
|
||||
is the radix of any subsequent file name.
|
||||
|
||||
When a Metalink/HTTP in encountered, any fetched Metalink/XML file has
|
||||
its own ordinal number appended as suffix to the trusted name. In this
|
||||
case scenario, an unique Metalink/XML file is saved each time applying
|
||||
an additional suffix to the currently computed name when necessary.
|
||||
|
||||
The files described by a Metalink/XML file will be named sequentially
|
||||
applying an additional suffix to the currently trusted/computed name.
|
||||
|
||||
3.1.1.2 With --trust-server-names
|
||||
=================================
|
||||
|
||||
When --trust-server-names is on, the metalink:file "name" field parsed
|
||||
from Metalink/XML files is trusted. When no Metalink/XML is available,
|
||||
the mother URL is trusted.
|
||||
|
||||
Any Metalink/HTTP application/metalink4+xml file is saved using the
|
||||
basename of its own Link header "name" field, if available.
|
||||
|
||||
In conjunction with the option --content-disposition, a 'Content-Type:
|
||||
application/metalink4+xml' file is saved using the basename of its own
|
||||
Content-Disposition header "filename" field, if available.
|
||||
|
||||
3.1.2 The final name
|
||||
====================
|
||||
|
||||
The "Directory Options" are combined with the trusted name. The result
|
||||
is evaluated again by the '1. Security features'. If the path is found
|
||||
unsafe, only the basename of the final name is considered. If this is
|
||||
found unsafe too, the file is not downloaded.
|
||||
|
||||
4. Metalink/XML
|
||||
***************
|
||||
|
||||
4.1 Example files
|
||||
=================
|
||||
|
||||
See [1 #section-1.1].
|
||||
|
||||
cat > bugus.meta4 << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metalink xmlns="urn:ietf:params:xml:ns:metalink">
|
||||
<file name="/dir/A/File1">
|
||||
<size>1617</size>
|
||||
<hash type="sha256">ecb3dff2648667513e31554b3ad054ccd89fce38e33367c9459ac3a285153742</hash>
|
||||
<url>http://another.url/common_name</url>
|
||||
<url>http://ftpmirror.gnu.org/bash/bash-4.3-patches/bash43-001</url>
|
||||
</file>
|
||||
<file name="dir/B/File2">
|
||||
<size>1594</size>
|
||||
<hash type="sha256">eee7cd7062ab29a9e4f02924d9c367264dcb8b162703f74ff6eb8f175a91502b</hash>
|
||||
<url>http://another.url/again/common_name</url>
|
||||
<url>http://ftpmirror.gnu.org/bash/bash-4.3-patches/bash43-002</url>
|
||||
</file>
|
||||
</metalink>
|
||||
EOF
|
||||
|
||||
4.2 Command line example
|
||||
========================
|
||||
|
||||
$ wget --input-metalink=bogus.meta4
|
||||
|
||||
4.3 Metalink/XML file parsing
|
||||
=============================
|
||||
|
||||
The metalink xml file is parsed by one of the following libmetalink's
|
||||
functions [3], depending upon the library configured to use:
|
||||
* lib/libexpat_metalink_parser.c (metalink_parse_file): Expat [4]
|
||||
* lib/libxml2_metalink_parser.c (metalink_parse_file): Libxml2 [5]
|
||||
|
||||
The result returned doesn't include unsafe metalink:file elements, as
|
||||
stated at point '1. Security features'.
|
||||
|
||||
An empty result shall not be considered an error. Parsing errors will
|
||||
be informed to the caller of libmetalink's metalink_parse_file().
|
||||
|
||||
4.4 Saving files
|
||||
================
|
||||
|
||||
Fetched metalink:file elements shall be wrote using the unique "name"
|
||||
field as file name [1 #section-4.1.2.1].
|
||||
|
||||
A metalink:file url's file name shall not substitute the "name" field.
|
||||
|
||||
Security exceptions are explained in '3. Download file name'.
|
||||
|
||||
4.5 Multi-Source download
|
||||
=========================
|
||||
|
||||
Parallel range requests are allowed [1 #section-1].
|
||||
|
||||
5. Metalink/HTTP
|
||||
****************
|
||||
|
||||
5.1 HTTP server
|
||||
===============
|
||||
|
||||
The local server http://127.0.0.1 is used as reference in the course
|
||||
of this chapter. Any server service capable of sending Metalink/HTTP
|
||||
header answers may be used.
|
||||
|
||||
5.2 Command line example
|
||||
========================
|
||||
|
||||
$ wget --metalink-over-http http://127.0.0.1/dir/file.ext
|
||||
|
||||
5.3 Metalink/HTTP header answer
|
||||
===============================
|
||||
|
||||
See [2 #section-1.1].
|
||||
|
||||
Etag: "thvDyvhfIqlvFe+A9MYgxAfm1q5="
|
||||
Link: <http://www2.example.com/example.ext>; rel=duplicate
|
||||
Link: <ftp://ftp.example.com/example.ext>; rel=duplicate
|
||||
Link: <http://example.com/example.ext.torrent>; rel=describedby;
|
||||
type="application/x-bittorrent"
|
||||
Link: <http://example.com/example.ext.meta4>; rel=describedby;
|
||||
type="application/metalink4+xml"
|
||||
Link: <http://example.com/example.ext.asc>; rel=describedby;
|
||||
type="application/pgp-signature"
|
||||
Digest: SHA-256=MWVkMWQxYTRiMzk5MDQ0MzI3NGU5NDEyZTk5OWY1ZGFmNzgyZTJlO
|
||||
DYzYjRjYzFhOTlmNTQwYzI2M2QwM2U2MQ==
|
||||
|
||||
See [2 #section-4].
|
||||
|
||||
Link: <http://example.com/example.ext.torrent>; rel=describedby;
|
||||
type="application/x-bittorrent"; name="differentname.ext"
|
||||
Link: <http://example.com/example.ext.meta4>; rel=describedby;
|
||||
type="application/metalink4+xml"
|
||||
|
||||
5.4 Saving files
|
||||
================
|
||||
|
||||
When none of --output-document and/or --content-disposition is used,
|
||||
the file name to wrote is computed from the cli's url hierarchy. The
|
||||
purpose of the "Directory Options" is as usual, and the file name is
|
||||
the cli's url file name, see wget(1).
|
||||
|
||||
The url followed to download the file shall not substitute the cli's
|
||||
url to compute the file name to wrote, except when it redirects to a
|
||||
Metalink/XML file, following the rules in '3. Download file name'.
|
||||
|
||||
5.5 Multi-Source download
|
||||
=========================
|
||||
|
||||
Parallel range requests are allowed [2 #section-7].
|
||||
|
||||
4. References
|
||||
*************
|
||||
|
||||
[1] The Metalink Download Description Format
|
||||
https://tools.ietf.org/html/rfc5854
|
||||
|
||||
[2] Metalink/HTTP: Mirrors and Hashes
|
||||
https://tools.ietf.org/html/rfc6249
|
||||
|
||||
[3] Libmetalink
|
||||
https://github.com/metalink-dev/libmetalink
|
||||
|
||||
[4] Expat
|
||||
http://www.libexpat.org
|
||||
|
||||
[5] Libxml2
|
||||
http://xmlsoft.org
|
||||
165
doc/metalink.txt
Normal file
165
doc/metalink.txt
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU Wget Metalink module
|
||||
|
||||
Evaluation of the Metalink/XML and Metalink/HTTP implementations
|
||||
|
||||
|
||||
1. Introduction
|
||||
***************
|
||||
|
||||
This document, and the results contained in it, is focused over the
|
||||
evaluation of the Metalink/XML and Metalink/HTTP implementations.
|
||||
|
||||
The "Directory Options" mentioned here are used on the command line in
|
||||
conjunction with the option '--input-metalink=file' for Metalink/XML,
|
||||
and '--metalink-over-http' for Metalink/HTTP.
|
||||
|
||||
$ wget --input-metalink=<file> [directory options]
|
||||
$ wget --metalink-over-http [directory options] <url>
|
||||
|
||||
2. Notes
|
||||
********
|
||||
|
||||
Tests for metalink:file names beginning with '/', '~/', './', or '../'
|
||||
(e.g. "/path/file") shall be run manually due to security concerns.
|
||||
|
||||
3. Metalink files used as reference
|
||||
***********************************
|
||||
|
||||
3.1 Test: metalink:file with "path/file" name format
|
||||
====================================================
|
||||
|
||||
cat > test.meta4 << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metalink xmlns="urn:ietf:params:xml:ns:metalink">
|
||||
<file name="path/file">
|
||||
<size>543</size>
|
||||
<hash type="sha256">d37d3965f8e1a7b16504b4273b09c392776b7e4dd17e601256c7b2fd9ce5f56e</hash>
|
||||
<hash type="md5">0f6ff5cdc15603f1b81227b5a296f001</hash>
|
||||
<url>http://wrongurl.really/gnu/wget/wget-1.18.tar.xz.sig</url>
|
||||
<url>http://ftpmirror.gnu.org/wget/wget-1.18.tar.xz.sig</url>
|
||||
<url>http://ftp.gnu.org/gnu/wget/wget-1.18.tar.xz.sig</url>
|
||||
<url>http://nl.mirror.babylon.network/gnu/wget/wget-1.18.tar.xz.sig</url>
|
||||
</file>
|
||||
</metalink>
|
||||
EOF
|
||||
|
||||
4. `wget --input-metalink=test.meta4`
|
||||
*************************************
|
||||
|
||||
4.1 Implemented safety features
|
||||
===============================
|
||||
|
||||
Any metalink:file name containing an absolute, relative, or home path
|
||||
(see '2. Notes') parsed from Metalink/XML files is rejected.
|
||||
|
||||
This is a libmetalink's design decision implemented in the function
|
||||
metalink_check_safe_path(). This feature shall not be modified.
|
||||
|
||||
All the above conform to the RFC5854 standard.
|
||||
|
||||
References:
|
||||
https://tools.ietf.org/html/rfc5854#section-4.1.2.1
|
||||
https://tools.ietf.org/html/rfc5854#section-4.2.8.3
|
||||
|
||||
4.2 File download behaviour
|
||||
===========================
|
||||
|
||||
When a Metalink/XML file is parsed:
|
||||
1. create the metalink:file "path/file" tree;
|
||||
2. download the metalink:url file as "path/file";
|
||||
3. verify the "path/file" size, if declared;
|
||||
4. verify the "path/file" checksum.
|
||||
|
||||
All the above conform to the RFC5854 standard.
|
||||
|
||||
References:
|
||||
https://tools.ietf.org/html/rfc5854
|
||||
|
||||
4.3 Questionable behaviours
|
||||
===========================
|
||||
|
||||
If more metalink:file elements are the same, wget downloads them all.
|
||||
|
||||
5. `wget --metalink-over-http`
|
||||
******************************
|
||||
|
||||
5.1 Implemented safety features
|
||||
===============================
|
||||
|
||||
The function url_file_name() is responsible of parsing the url's file
|
||||
name and mixing in the "Directory Options" wrote on the command line.
|
||||
|
||||
The use of libmetalink's metalink_check_safe_path() shouldn't be
|
||||
necessary (see '4.1 Implemented safety features').
|
||||
|
||||
All the above comform to the usual Wget's download behaviour.
|
||||
|
||||
References:
|
||||
wget(1)
|
||||
|
||||
5.2 File download behaviour
|
||||
===========================
|
||||
|
||||
When a Metalink/HTTP header is parsed:
|
||||
1. extract metalink metadata from the header;
|
||||
2. download the file from the mirror with the highest priority;
|
||||
3. verify the file's size, if declared;
|
||||
4. verify the file's checksum.
|
||||
|
||||
All the above comform to the usual Wget's download behaviour and to
|
||||
the RFC6249 standard.
|
||||
|
||||
References:
|
||||
wget(1)
|
||||
https://tools.ietf.org/html/rfc6249
|
||||
|
||||
6. Directory Options
|
||||
********************
|
||||
|
||||
'-nd'
|
||||
'--no-directories'
|
||||
|
||||
Do not apply to Metalink/XML files (aka --input-metalink=<file>).
|
||||
|
||||
Apply to Metalink/HTTP urls as described in the Wget's manual, see
|
||||
wget(1). The target url is the url wrote on the command line.
|
||||
|
||||
'-x'
|
||||
'--force-directories'
|
||||
|
||||
Do not apply to Metalink/XML files (aka --input-metalink=<file>).
|
||||
|
||||
Apply to Metalink/HTTP urls as described in the Wget's manual, see
|
||||
wget(1). The target url is the url wrote on the command line.
|
||||
|
||||
'-nH'
|
||||
'--no-host-directories'
|
||||
|
||||
Do not apply to Metalink/XML files (aka --input-metalink=<file>).
|
||||
|
||||
Apply to Metalink/HTTP urls as described in the Wget's manual, see
|
||||
wget(1). The target url is the url wrote on the command line.
|
||||
|
||||
'--protocol-directories'
|
||||
|
||||
Do not apply to Metalink/XML files (aka --input-metalink=<file>).
|
||||
|
||||
Apply to Metalink/HTTP urls as described in the Wget's manual, see
|
||||
wget(1). The target url is the url wrote on the command line.
|
||||
|
||||
'--cut-dirs=number'
|
||||
|
||||
Do not apply to Metalink/XML files (aka --input-metalink=<file>).
|
||||
|
||||
Apply to Metalink/HTTP urls as described in the Wget's manual, see
|
||||
wget(1). The target url is the url wrote on the command line.
|
||||
|
||||
'-P prefix'
|
||||
'--directory-prefix=prefix'
|
||||
|
||||
Set the top of the retrieval tree to prefix for both Metalink/XML
|
||||
and Metalink/HTTP downloads, see wget(1).
|
||||
|
||||
If combining the prefix with the file name results in an absolute,
|
||||
relative, or home path, the directory components are stripped and
|
||||
only the basename is used. See '4.1 Implemented safety features'.
|
||||
@@ -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).
|
||||
@@ -13,6 +16,9 @@
|
||||
## To use the settings in this file, you will have to uncomment them,
|
||||
## as well as change them, in most cases, as the values on the
|
||||
## commented-out lines are the default values (e.g. "off").
|
||||
##
|
||||
## Command are case-, underscore- and minus-insensitive.
|
||||
## For example ftp_proxy, ftp-proxy and ftpproxy are the same.
|
||||
|
||||
|
||||
##
|
||||
@@ -119,7 +125,13 @@
|
||||
#iri = off
|
||||
|
||||
# Force the default system encoding
|
||||
#locale = UTF-8
|
||||
#localencoding = UTF-8
|
||||
|
||||
# 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, 2015
|
||||
# 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";
|
||||
@@ -314,6 +315,8 @@ die "No filename or title\n" unless defined $fn && defined $tl;
|
||||
$sects{NAME} = "$fn \- $tl\n";
|
||||
$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
|
||||
|
||||
print "=encoding utf-8\n\n";
|
||||
|
||||
for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT EXITSTATUS
|
||||
FILES BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
|
||||
if(exists $sects{$sect}) {
|
||||
|
||||
916
doc/wget.texi
916
doc/wget.texi
File diff suppressed because it is too large
Load Diff
1
gnulib
Submodule
1
gnulib
Submodule
Submodule gnulib added at f497bc109a
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);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user