mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
3064 Commits
ISDIGIT-bu
...
FILEUTILS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
731cbc77fb | ||
|
|
2bd16e646e | ||
|
|
7f2c13e703 | ||
|
|
635a7c3186 | ||
|
|
42d1927306 | ||
|
|
ba246b0f36 | ||
|
|
13ff080b78 | ||
|
|
06a5782edd | ||
|
|
12f377da25 | ||
|
|
c423a2d74a | ||
|
|
04a1a572f4 | ||
|
|
1ba3bd3896 | ||
|
|
fb59a28b16 | ||
|
|
ab48b17dca | ||
|
|
d2ca2163c6 | ||
|
|
5ae342e1a9 | ||
|
|
6c635d1f27 | ||
|
|
42640f71df | ||
|
|
0b83b3090b | ||
|
|
4b583d1691 | ||
|
|
a182aa4e5a | ||
|
|
22ca9b17a5 | ||
|
|
04916b80de | ||
|
|
d7d7ae76b2 | ||
|
|
da7809f65c | ||
|
|
b7d3a68ce5 | ||
|
|
8794c292e7 | ||
|
|
ece3b1d144 | ||
|
|
8087dd5668 | ||
|
|
1a622aa2d9 | ||
|
|
1ea9952168 | ||
|
|
4df74fe308 | ||
|
|
68545c98ed | ||
|
|
4650315342 | ||
|
|
fbfde91f6a | ||
|
|
e3f1d80dd9 | ||
|
|
5e58599e6e | ||
|
|
c22036ab86 | ||
|
|
34ffd87f30 | ||
|
|
cea704d6da | ||
|
|
ddf8459662 | ||
|
|
8320e65164 | ||
|
|
f42460fb09 | ||
|
|
24a118665e | ||
|
|
3bcffe04d7 | ||
|
|
79523152dd | ||
|
|
35aaa568cd | ||
|
|
85da146bd2 | ||
|
|
ae8ee650ea | ||
|
|
4a11d01711 | ||
|
|
f76a4b618e | ||
|
|
c8c91b5e20 | ||
|
|
70155d8013 | ||
|
|
af14a04c19 | ||
|
|
6e62afaaed | ||
|
|
9190f77006 | ||
|
|
5d845a1678 | ||
|
|
f6c32178c7 | ||
|
|
ff5cd3f6a3 | ||
|
|
b3d8117527 | ||
|
|
103713c42b | ||
|
|
c84fb64144 | ||
|
|
8e02fb10ab | ||
|
|
1b47ed2714 | ||
|
|
dcd02c8008 | ||
|
|
a80c49322b | ||
|
|
3982e9cdf8 | ||
|
|
a5b6fae599 | ||
|
|
b660d78cf5 | ||
|
|
c86883a62a | ||
|
|
e36197cd8f | ||
|
|
2185c1f3d8 | ||
|
|
48a76e855c | ||
|
|
19b5a4f761 | ||
|
|
9dbd283b1e | ||
|
|
4376f9f2ce | ||
|
|
37fea371b7 | ||
|
|
bb02f48670 | ||
|
|
64cd458e0a | ||
|
|
bc9aded4b9 | ||
|
|
a611c6cbf6 | ||
|
|
68c33eea03 | ||
|
|
fec6a430da | ||
|
|
1266fc26ee | ||
|
|
41a41dd48e | ||
|
|
e59e2e803c | ||
|
|
52c7e3147e | ||
|
|
8829551700 | ||
|
|
e95fe088e1 | ||
|
|
e13281014a | ||
|
|
aac56cabe4 | ||
|
|
df5f33a5bf | ||
|
|
0799786a33 | ||
|
|
6621f0a9a9 | ||
|
|
d5b9b29ac6 | ||
|
|
022a19b21f | ||
|
|
12133d7f01 | ||
|
|
58dfd6b442 | ||
|
|
5fc47138b1 | ||
|
|
4a2b289e7c | ||
|
|
bab072f3aa | ||
|
|
8679e372cd | ||
|
|
b0690ba414 | ||
|
|
ed354b6490 | ||
|
|
81d1fa5cb6 | ||
|
|
421e75544b | ||
|
|
7466f41075 | ||
|
|
1e7d4b9c70 | ||
|
|
6a13b75511 | ||
|
|
ebefd435aa | ||
|
|
b3335ab809 | ||
|
|
d293e5f03c | ||
|
|
0a470f01de | ||
|
|
b181d31372 | ||
|
|
b3a49ee8d0 | ||
|
|
35b886ad7b | ||
|
|
cecde31171 | ||
|
|
ae6c43a3ab | ||
|
|
17432bd066 | ||
|
|
c835f92a61 | ||
|
|
89b765e32c | ||
|
|
3752e13942 | ||
|
|
858afc04d2 | ||
|
|
5fecd9e4d5 | ||
|
|
ae5ee331f1 | ||
|
|
954c7bc4cc | ||
|
|
625dc74361 | ||
|
|
b26beb4996 | ||
|
|
0b3d661480 | ||
|
|
33448d128a | ||
|
|
b3ef6f599d | ||
|
|
72f95044eb | ||
|
|
859f8587f8 | ||
|
|
24e15328df | ||
|
|
357c53621f | ||
|
|
fd688bcc5f | ||
|
|
e8c6c8175b | ||
|
|
561e4c139e | ||
|
|
507288d2c7 | ||
|
|
6c47524481 | ||
|
|
300c151b8b | ||
|
|
3c7e9fec08 | ||
|
|
7235fb47cc | ||
|
|
8ef2abf7e9 | ||
|
|
5e55e49972 | ||
|
|
48a255beb0 | ||
|
|
17a2ec94a8 | ||
|
|
e7f8503138 | ||
|
|
f789ddbdda | ||
|
|
1f1bd53b86 | ||
|
|
3a2afe3311 | ||
|
|
20b960db10 | ||
|
|
8fd3e8664b | ||
|
|
1b25f1c2cd | ||
|
|
8569e32ec8 | ||
|
|
1321f30e73 | ||
|
|
290ee99712 | ||
|
|
3008ad90f4 | ||
|
|
8c5b30bc1e | ||
|
|
f0fa287b4f | ||
|
|
4ecb3b28f1 | ||
|
|
ea93e0b7ad | ||
|
|
7603401c86 | ||
|
|
90d97b9703 | ||
|
|
4091022393 | ||
|
|
338061e307 | ||
|
|
6a99b4cc40 | ||
|
|
86d6c36d09 | ||
|
|
a7f5043de8 | ||
|
|
5110583f3e | ||
|
|
813c8e8bb6 | ||
|
|
7d72c942bb | ||
|
|
f17cc2e29c | ||
|
|
4f4111709c | ||
|
|
beed39a03c | ||
|
|
d5f09a0fd1 | ||
|
|
3692f57123 | ||
|
|
d3d5565035 | ||
|
|
3e39947b49 | ||
|
|
c8a3fc9bed | ||
|
|
d43b4dcaf8 | ||
|
|
54f9b87874 | ||
|
|
1c28626053 | ||
|
|
6c674869b3 | ||
|
|
888a5250a5 | ||
|
|
d468c227b0 | ||
|
|
52314f2cd8 | ||
|
|
8d2b4f9786 | ||
|
|
b44299cfd7 | ||
|
|
5ea5ea9d2c | ||
|
|
7d21f2f4d0 | ||
|
|
73db5c12b9 | ||
|
|
53ac4c028b | ||
|
|
916a46a980 | ||
|
|
8b59538e69 | ||
|
|
eb34cbfc13 | ||
|
|
4360d0f52d | ||
|
|
e74a22ebb7 | ||
|
|
fcc65666b5 | ||
|
|
a16b0a142f | ||
|
|
5c39a3b65b | ||
|
|
4885753994 | ||
|
|
156de2ae7a | ||
|
|
40f8a7ad2b | ||
|
|
8f477a9072 | ||
|
|
d5ce3b1c3c | ||
|
|
54d0c0bb5a | ||
|
|
09c73133aa | ||
|
|
17fe725ebb | ||
|
|
c02f8ed500 | ||
|
|
90b901cd1c | ||
|
|
73c7efa3ee | ||
|
|
e155f4bf01 | ||
|
|
1d3c57118b | ||
|
|
195b5ebbe7 | ||
|
|
ba788477a8 | ||
|
|
6846ffa9d9 | ||
|
|
4fb3a6f765 | ||
|
|
5460d4a9c8 | ||
|
|
7f5d303c61 | ||
|
|
a65bae921e | ||
|
|
89cf1fc2cf | ||
|
|
a13947a7a3 | ||
|
|
ddc2531899 | ||
|
|
80729c5841 | ||
|
|
83ada8596c | ||
|
|
2a1d6f9b5f | ||
|
|
f2ac53d4ea | ||
|
|
f31b9b9fee | ||
|
|
acc8601b65 | ||
|
|
8dd5415e02 | ||
|
|
8a4da0e3ff | ||
|
|
95f9b268e9 | ||
|
|
d2ad9d8cf4 | ||
|
|
0ccd71dd94 | ||
|
|
1c7be9d1bb | ||
|
|
c9893d18e3 | ||
|
|
fb1f09c76e | ||
|
|
b1cc662215 | ||
|
|
f86a3c16d3 | ||
|
|
6d244887aa | ||
|
|
f86df3250c | ||
|
|
65a915647c | ||
|
|
2882d4477d | ||
|
|
2793223907 | ||
|
|
a5937bbc71 | ||
|
|
d0cac59c72 | ||
|
|
ed0923a11c | ||
|
|
42096600e3 | ||
|
|
523fb680f6 | ||
|
|
3f36b30756 | ||
|
|
4a1512e4b2 | ||
|
|
ad44ac84c8 | ||
|
|
c7975ba578 | ||
|
|
62a92dec57 | ||
|
|
a37e7e6b78 | ||
|
|
d5718682cc | ||
|
|
81e3dc9283 | ||
|
|
daa3f22091 | ||
|
|
b87899c834 | ||
|
|
4accfeb4e0 | ||
|
|
377b0c7942 | ||
|
|
4331f5f978 | ||
|
|
fb19eec511 | ||
|
|
b712dcba25 | ||
|
|
caad57f5d0 | ||
|
|
807b8b05c2 | ||
|
|
5f3fa7a284 | ||
|
|
c1032f08e5 | ||
|
|
0aa0b007b0 | ||
|
|
c6973beeec | ||
|
|
d99d106c55 | ||
|
|
61f8fa059c | ||
|
|
9279ffdf29 | ||
|
|
0682a5efe9 | ||
|
|
dc68073b21 | ||
|
|
78c6df8fb8 | ||
|
|
f03282e857 | ||
|
|
7e9e29f392 | ||
|
|
28f8f53bb6 | ||
|
|
ab8182fa71 | ||
|
|
d740a98d4a | ||
|
|
40e0727bed | ||
|
|
a387531246 | ||
|
|
be44044a29 | ||
|
|
ae9d905134 | ||
|
|
bcb8610977 | ||
|
|
ac66871c65 | ||
|
|
3fa102417e | ||
|
|
59b58a58f6 | ||
|
|
f46bcc918b | ||
|
|
784928401d | ||
|
|
1a62ae1a5c | ||
|
|
952a4436eb | ||
|
|
a098f5b9b6 | ||
|
|
5d691b7b74 | ||
|
|
84ee79c745 | ||
|
|
4b091b8a14 | ||
|
|
c51d0a5a9b | ||
|
|
29ea1d5db9 | ||
|
|
b910477e63 | ||
|
|
2f74178b8b | ||
|
|
fe171f7d8f | ||
|
|
b0244698f9 | ||
|
|
7c0ec3e569 | ||
|
|
4677a7e42f | ||
|
|
520f4efee9 | ||
|
|
0d43bad18e | ||
|
|
0dd914edd1 | ||
|
|
161db26bd1 | ||
|
|
a992c841ae | ||
|
|
9299cf1e78 | ||
|
|
970083559f | ||
|
|
459453639e | ||
|
|
0e0ae2b348 | ||
|
|
cb7fcc32ff | ||
|
|
d7e8ccb6f3 | ||
|
|
a811674834 | ||
|
|
fa9f16326a | ||
|
|
c13ff9b8bc | ||
|
|
bded355394 | ||
|
|
f43bd3fafc | ||
|
|
e298f1f300 | ||
|
|
8102404465 | ||
|
|
bef51e36a4 | ||
|
|
5425625fb3 | ||
|
|
94d1ea4fa9 | ||
|
|
9645d076db | ||
|
|
b683d9194f | ||
|
|
38da840313 | ||
|
|
b36e061e8a | ||
|
|
0d3f6a6665 | ||
|
|
aa00ea2e88 | ||
|
|
aad274a82b | ||
|
|
fc949b713e | ||
|
|
fbc246ca8f | ||
|
|
789a8aa03a | ||
|
|
179a2c3034 | ||
|
|
a27d168615 | ||
|
|
29fa517ae4 | ||
|
|
4b7c7e9d33 | ||
|
|
daf9bddd16 | ||
|
|
9b3733bd9a | ||
|
|
a4f0dde547 | ||
|
|
e604ed756f | ||
|
|
1cf3018183 | ||
|
|
138d155fb8 | ||
|
|
4d091498a4 | ||
|
|
1e3de0b6d9 | ||
|
|
25a9b70b2e | ||
|
|
45bf8ec9d0 | ||
|
|
4a253e5be0 | ||
|
|
71a04268b5 | ||
|
|
6c6ea1a14d | ||
|
|
9691c2050b | ||
|
|
2876587b55 | ||
|
|
1eb3a8c9ba | ||
|
|
39fd156a8e | ||
|
|
f137758903 | ||
|
|
895c2213db | ||
|
|
50720fb367 | ||
|
|
f6516b6dd3 | ||
|
|
564001a9e7 | ||
|
|
25abc2a9b4 | ||
|
|
70196747af | ||
|
|
04e102f64f | ||
|
|
432ebf7912 | ||
|
|
84b3a78396 | ||
|
|
9eb9f31c3a | ||
|
|
7f82c56f15 | ||
|
|
5582e6dad3 | ||
|
|
2e55854100 | ||
|
|
8114f3fcdb | ||
|
|
45c541daa1 | ||
|
|
17c0c658f1 | ||
|
|
b8e689dc67 | ||
|
|
87b19e8a11 | ||
|
|
a1c6ed64c0 | ||
|
|
f2c14100c3 | ||
|
|
1a58046071 | ||
|
|
b3b3cf98c6 | ||
|
|
30bf49ce02 | ||
|
|
a5ecd84c1f | ||
|
|
9b29731f08 | ||
|
|
a140942848 | ||
|
|
1291b1652a | ||
|
|
1b5b75d13e | ||
|
|
f1af346ad5 | ||
|
|
431bbb9c57 | ||
|
|
7d62b5ce1c | ||
|
|
a345a56001 | ||
|
|
b5f8cdecfb | ||
|
|
fa53b43c97 | ||
|
|
23bce5b115 | ||
|
|
da952f6227 | ||
|
|
31926f3a37 | ||
|
|
a71e22991b | ||
|
|
d74d789bea | ||
|
|
950325ee23 | ||
|
|
c941e1742d | ||
|
|
0bd1289ad1 | ||
|
|
febf70b73f | ||
|
|
b5a71af82a | ||
|
|
876c63c92f | ||
|
|
b3ca6696cd | ||
|
|
24e88142ba | ||
|
|
f9cd2cf6e2 | ||
|
|
0a1ac00ad6 | ||
|
|
e5947e883e | ||
|
|
679918ec84 | ||
|
|
a9b6fe5c83 | ||
|
|
8619a0d598 | ||
|
|
d34e6897d8 | ||
|
|
55681891e5 | ||
|
|
3772a9e885 | ||
|
|
1220685f78 | ||
|
|
f3129d9b19 | ||
|
|
b0fd7c9185 | ||
|
|
7d70c26629 | ||
|
|
ac96de6db4 | ||
|
|
1f49981a1f | ||
|
|
d09ffcb711 | ||
|
|
33b2a8a1ae | ||
|
|
32969f8571 | ||
|
|
4abe75d3b1 | ||
|
|
e623bf9a03 | ||
|
|
0815914f28 | ||
|
|
70cf07775b | ||
|
|
06382a007d | ||
|
|
d7749da3e9 | ||
|
|
84b8cf9fcf | ||
|
|
c673119b0b | ||
|
|
45d223328e | ||
|
|
b8ad9be908 | ||
|
|
2be918d5cd | ||
|
|
db69dbe9ab | ||
|
|
4215f6b53a | ||
|
|
e1298617bf | ||
|
|
720341312b | ||
|
|
ed44302c4a | ||
|
|
c3b3d48cd4 | ||
|
|
a73047bde4 | ||
|
|
20862d675d | ||
|
|
17e8314c79 | ||
|
|
ee791d8ca1 | ||
|
|
0c410767ab | ||
|
|
3896da90cc | ||
|
|
0ed25421c6 | ||
|
|
194f3d7f5a | ||
|
|
e028e025df | ||
|
|
8978c64869 | ||
|
|
0fd3107ec7 | ||
|
|
0416bd8ed0 | ||
|
|
d63a1efe26 | ||
|
|
43294523f4 | ||
|
|
625354dd9e | ||
|
|
dc14f81457 | ||
|
|
32f42e0a34 | ||
|
|
263773a385 | ||
|
|
6afff604a4 | ||
|
|
7b4f54f83f | ||
|
|
24b532175e | ||
|
|
543f479cc8 | ||
|
|
4b1e41570b | ||
|
|
d0fa9d9689 | ||
|
|
4516e9ec55 | ||
|
|
d15f56325a | ||
|
|
1dde8333c1 | ||
|
|
ac22b4589d | ||
|
|
2f03e544e1 | ||
|
|
412cc2f3fc | ||
|
|
3cbc95de84 | ||
|
|
b3d2d7745e | ||
|
|
66d52e0b28 | ||
|
|
5ba02801bd | ||
|
|
03c0cd6569 | ||
|
|
c12be5c1d8 | ||
|
|
d565995d9b | ||
|
|
9fd1b85231 | ||
|
|
350690112e | ||
|
|
d0acd7bfa5 | ||
|
|
4ba06c4102 | ||
|
|
cb84de4217 | ||
|
|
7111d93669 | ||
|
|
97f0f916a2 | ||
|
|
42e52b5017 | ||
|
|
8ce9769e2f | ||
|
|
7d969dab50 | ||
|
|
d7074bc0e4 | ||
|
|
e24c0713be | ||
|
|
9b3498acb2 | ||
|
|
ffc5c802c4 | ||
|
|
12b4578595 | ||
|
|
e98991ee51 | ||
|
|
10076ae36a | ||
|
|
c96ca77338 | ||
|
|
e82e83086c | ||
|
|
70ef71caf5 | ||
|
|
56d2307664 | ||
|
|
e98dee7cdd | ||
|
|
f3701815f7 | ||
|
|
cf3c9c6a11 | ||
|
|
beb67dc954 | ||
|
|
242f2fa2e1 | ||
|
|
3d91b69385 | ||
|
|
41dfaf296a | ||
|
|
bc2d814543 | ||
|
|
8cb23387cb | ||
|
|
82fa812558 | ||
|
|
1487a7da95 | ||
|
|
1751c454c2 | ||
|
|
da59dde0bb | ||
|
|
6099958eda | ||
|
|
ffd5a79535 | ||
|
|
320268ae6d | ||
|
|
e45d62703e | ||
|
|
6ed9fd4b58 | ||
|
|
d0909b6911 | ||
|
|
a64289005d | ||
|
|
e42dca4684 | ||
|
|
51293cdf6f | ||
|
|
4d0af9ead4 | ||
|
|
eed23c25dc | ||
|
|
8204d34b97 | ||
|
|
d80da392e0 | ||
|
|
4c53aee40c | ||
|
|
3d35ef8670 | ||
|
|
5921df05c5 | ||
|
|
1a7260cada | ||
|
|
969950e526 | ||
|
|
fb9ee923ba | ||
|
|
8af03634e6 | ||
|
|
e5e9f3ee5d | ||
|
|
62ae6ccc22 | ||
|
|
c3830e800f | ||
|
|
7200c7fd2e | ||
|
|
d16bea8f84 | ||
|
|
ae0dc43e79 | ||
|
|
c6500ed364 | ||
|
|
2a5b5534ab | ||
|
|
2dc3ad1a76 | ||
|
|
1e2d02ace5 | ||
|
|
fde482ef0e | ||
|
|
9de1f7a589 | ||
|
|
983e0032e0 | ||
|
|
60cb394696 | ||
|
|
c5c0528abe | ||
|
|
fecbdd9ab1 | ||
|
|
5b2210ce71 | ||
|
|
3df36d5e2f | ||
|
|
a49fa29fed | ||
|
|
bb3ecf85bc | ||
|
|
b5a2377dc2 | ||
|
|
46b5894b8f | ||
|
|
1a68844645 | ||
|
|
dc522f984c | ||
|
|
8573fc6ac9 | ||
|
|
d4cf394f30 | ||
|
|
79f3064bfa | ||
|
|
900e16e5d5 | ||
|
|
dfc9fc2202 | ||
|
|
1b5b3bf6e2 | ||
|
|
cb806c0218 | ||
|
|
0e6d3d87e4 | ||
|
|
4b08923fe8 | ||
|
|
2edcf647de | ||
|
|
0a713ad019 | ||
|
|
7026c59810 | ||
|
|
4c4eb1ab6c | ||
|
|
638d6e19f0 | ||
|
|
27d2263af1 | ||
|
|
320b9cc697 | ||
|
|
28e0bda43b | ||
|
|
04af619ed2 | ||
|
|
255931762f | ||
|
|
f98969cf69 | ||
|
|
7c17502e74 | ||
|
|
4a2eda04aa | ||
|
|
ed43629995 | ||
|
|
c177b96b17 | ||
|
|
c5de1e3532 | ||
|
|
148ec1ad9c | ||
|
|
a13e04ed9d | ||
|
|
98564790bd | ||
|
|
f04044ed86 | ||
|
|
09711894fe | ||
|
|
4f28f318d8 | ||
|
|
e22c80dcf0 | ||
|
|
b350b74916 | ||
|
|
3400ffe3f2 | ||
|
|
fdd16fdb62 | ||
|
|
6f67177fae | ||
|
|
2c035a7cfd | ||
|
|
be4153d2a8 | ||
|
|
630b771f1b | ||
|
|
de05a873ec | ||
|
|
3361bd2bca | ||
|
|
1c6698b17d | ||
|
|
a3edb3f940 | ||
|
|
9b34a4a7c6 | ||
|
|
56c8b44ec6 | ||
|
|
50c823be8a | ||
|
|
4909374105 | ||
|
|
2a91869144 | ||
|
|
41bf50ecb3 | ||
|
|
349c3796be | ||
|
|
717429e4bc | ||
|
|
6c81b98e46 | ||
|
|
cf64a504d8 | ||
|
|
ec693397f0 | ||
|
|
04838c31ce | ||
|
|
fa3bbe8eb2 | ||
|
|
39c406f18a | ||
|
|
d7f77ef1cf | ||
|
|
31053908a0 | ||
|
|
0c7040607d | ||
|
|
d81cbf71b4 | ||
|
|
b339cb8d84 | ||
|
|
d8880083a6 | ||
|
|
96cdeb978e | ||
|
|
b2cc136736 | ||
|
|
b394529747 | ||
|
|
edfafcd7b7 | ||
|
|
1c75eb6a98 | ||
|
|
814dc35407 | ||
|
|
99fe905035 | ||
|
|
ccf556a616 | ||
|
|
d96a2d9e14 | ||
|
|
8e11d5dfae | ||
|
|
f64f586fdc | ||
|
|
6f8e1b2134 | ||
|
|
8888bceb65 | ||
|
|
78315499ba | ||
|
|
e666e3459e | ||
|
|
6a9d144a66 | ||
|
|
f34578f297 | ||
|
|
1dc643390a | ||
|
|
ea3702aa6d | ||
|
|
59b9296742 | ||
|
|
bf3b759a61 | ||
|
|
bc24ebbed0 | ||
|
|
10ac9ed1ba | ||
|
|
f28de0cbe3 | ||
|
|
d7477dbf0c | ||
|
|
b4062862f6 | ||
|
|
4ddff14202 | ||
|
|
c98881bb59 | ||
|
|
9016aac157 | ||
|
|
8c5a8ba959 | ||
|
|
62a6b18a77 | ||
|
|
0f39512ec6 | ||
|
|
77becb06e1 | ||
|
|
2ff0c1870c | ||
|
|
9438eff8ec | ||
|
|
4097b92a07 | ||
|
|
7c695a0e5a | ||
|
|
85cddd3119 | ||
|
|
3661c96081 | ||
|
|
d4368d4802 | ||
|
|
34c992c065 | ||
|
|
e904744174 | ||
|
|
47e8713900 | ||
|
|
5637dfa191 | ||
|
|
ce5730d5c2 | ||
|
|
f1a405c1e9 | ||
|
|
7f88c2b896 | ||
|
|
eaa41b023f | ||
|
|
0867d4efd3 | ||
|
|
b12923594b | ||
|
|
4f208e731c | ||
|
|
26b61d5962 | ||
|
|
955f5eb1f4 | ||
|
|
0e02a64c99 | ||
|
|
545c237530 | ||
|
|
3cc1863ab3 | ||
|
|
815261aefc | ||
|
|
f599541be9 | ||
|
|
c62a6dbaa9 | ||
|
|
74388abca3 | ||
|
|
e044081627 | ||
|
|
d1320b7277 | ||
|
|
6ac49bdf47 | ||
|
|
c74ae79fd9 | ||
|
|
4b29186f72 | ||
|
|
94435a6401 | ||
|
|
1e26d4455a | ||
|
|
3683b0b3ef | ||
|
|
2d30458a75 | ||
|
|
9cde1990ab | ||
|
|
3fc07d456b | ||
|
|
73ca459085 | ||
|
|
85219ddf0f | ||
|
|
f471847cac | ||
|
|
edbc415595 | ||
|
|
e4c1c5efca | ||
|
|
c830d53afb | ||
|
|
4526777121 | ||
|
|
97df7b0013 | ||
|
|
9c28acb705 | ||
|
|
7b9e7765ee | ||
|
|
14c6c66b64 | ||
|
|
58b136578a | ||
|
|
139408f867 | ||
|
|
d2c6e7cba9 | ||
|
|
62e0054a8d | ||
|
|
a5be9924f2 | ||
|
|
f709048a82 | ||
|
|
d1f996b486 | ||
|
|
d3900b79bc | ||
|
|
34d871d67d | ||
|
|
71066e34b9 | ||
|
|
4be8ee6d75 | ||
|
|
63a48d0278 | ||
|
|
b8d66b1704 | ||
|
|
d64ae4c1be | ||
|
|
1a9771061b | ||
|
|
5c8eaa8139 | ||
|
|
4cfd024d37 | ||
|
|
5e053a624b | ||
|
|
e3625e3032 | ||
|
|
4c9586c01b | ||
|
|
d9be56f638 | ||
|
|
57592bb00e | ||
|
|
d4fc1b970c | ||
|
|
c609fd3e0a | ||
|
|
e9d17da073 | ||
|
|
82e99127d2 | ||
|
|
c609ba2d13 | ||
|
|
6a52479e0a | ||
|
|
1cd5fb882c | ||
|
|
27586e4d1b | ||
|
|
bfe2a56ac6 | ||
|
|
c9fff51897 | ||
|
|
7e294bac78 | ||
|
|
3d672b27ca | ||
|
|
8726a1e79e | ||
|
|
7aea26b817 | ||
|
|
a8676a3282 | ||
|
|
e8f7310474 | ||
|
|
3e1ecd65dd | ||
|
|
b0ed797534 | ||
|
|
3329d17b3e | ||
|
|
41e757beb6 | ||
|
|
efe35c166d | ||
|
|
2f70dd59c6 | ||
|
|
d57a5cc166 | ||
|
|
7216f62cad | ||
|
|
f2be7b3cc4 | ||
|
|
5c0b9744ab | ||
|
|
b0a21fce4c | ||
|
|
3649121dff | ||
|
|
383690a5f2 | ||
|
|
90ce25327c | ||
|
|
840c73b381 | ||
|
|
7ec03a4414 | ||
|
|
0ba429223d | ||
|
|
7d234bb98e | ||
|
|
a0d34ce173 | ||
|
|
1a6ee7a625 | ||
|
|
34ac19cd34 | ||
|
|
a79e4f054a | ||
|
|
ad1a0015be | ||
|
|
2592c30822 | ||
|
|
5e6706b750 | ||
|
|
77f32e0b49 | ||
|
|
a0810c6cae | ||
|
|
a023f4519e | ||
|
|
0055d0a4cc | ||
|
|
416715cf93 | ||
|
|
730ec4650a | ||
|
|
98b9e6e30b | ||
|
|
9d76e7ffbb | ||
|
|
d9f30fc643 | ||
|
|
597e0b2a8e | ||
|
|
56cd9b9a02 | ||
|
|
12d30b5cd0 | ||
|
|
c64c32d89e | ||
|
|
7d490ad462 | ||
|
|
0347f76632 | ||
|
|
b012712ff5 | ||
|
|
6f1a0acdbd | ||
|
|
b32398d02c | ||
|
|
ea15a1e0e5 | ||
|
|
c7066e8caa | ||
|
|
fa674d651c | ||
|
|
5220e9a46b | ||
|
|
afddedbd9f | ||
|
|
b98971b7a0 | ||
|
|
9cccef82ce | ||
|
|
f6d73bdb80 | ||
|
|
91c0d0de6a | ||
|
|
283b1a297d | ||
|
|
26259134ee | ||
|
|
39cf848828 | ||
|
|
8dd548d895 | ||
|
|
daa3462c64 | ||
|
|
b7bf84fd73 | ||
|
|
a62273dca5 | ||
|
|
32f7fc5503 | ||
|
|
99708d72f6 | ||
|
|
ec4159d6f6 | ||
|
|
3c39169751 | ||
|
|
1a68c9ac75 | ||
|
|
e7a59c2594 | ||
|
|
1ddf714c24 | ||
|
|
69a2d6bce1 | ||
|
|
408cfc09b2 | ||
|
|
eebe6a6c0c | ||
|
|
abd282bf34 | ||
|
|
441ebad5cc | ||
|
|
26a8544c83 | ||
|
|
4fd0132dfc | ||
|
|
bd3627904b | ||
|
|
a1ab7fb789 | ||
|
|
0e4f0390ef | ||
|
|
b741c592c5 | ||
|
|
81d574033a | ||
|
|
aa49f63378 | ||
|
|
1a038cb55e | ||
|
|
1c892790d9 | ||
|
|
bd51f25754 | ||
|
|
406c6613bb | ||
|
|
c5449cea5a | ||
|
|
7cc00778d1 | ||
|
|
1dc1d2996a | ||
|
|
3cf0da722f | ||
|
|
7532e57941 | ||
|
|
5b8cad3534 | ||
|
|
e1df5e7167 | ||
|
|
1d8ed38329 | ||
|
|
c87d06546a | ||
|
|
afe669874a | ||
|
|
ee2e84bb6f | ||
|
|
d5aa78b540 | ||
|
|
2a5f4c45e1 | ||
|
|
0fa3eb4d22 | ||
|
|
b10f778bf5 | ||
|
|
e9ed1c0601 | ||
|
|
729bd79cb8 | ||
|
|
402b4612f8 | ||
|
|
a044608569 | ||
|
|
d660831c5a | ||
|
|
9ba877cf28 | ||
|
|
e22b1e56e6 | ||
|
|
cd2e2180d9 | ||
|
|
6932ade12e | ||
|
|
c49c9a04e1 | ||
|
|
b294dd43a1 | ||
|
|
7ce576ff06 | ||
|
|
733c16465d | ||
|
|
981f5ba012 | ||
|
|
0e180c8f19 | ||
|
|
005ed75540 | ||
|
|
52211041ad | ||
|
|
304295c24c | ||
|
|
a56da10982 | ||
|
|
1089f9b929 | ||
|
|
ccd0e2e27a | ||
|
|
96a39fa3f6 | ||
|
|
08ffff5615 | ||
|
|
16efa02b77 | ||
|
|
7f26c2724a | ||
|
|
81b7ecbc14 | ||
|
|
bd6aa3080a | ||
|
|
7f1cf81aba | ||
|
|
3af4a12ae3 | ||
|
|
deee2015f3 | ||
|
|
9d06a0075d | ||
|
|
1d791a1487 | ||
|
|
998e5ad1c0 | ||
|
|
67c2366944 | ||
|
|
bb952869e7 | ||
|
|
35b1d6a948 | ||
|
|
63dece38a1 | ||
|
|
3904fb599e | ||
|
|
7b7b289e2d | ||
|
|
f8939357a3 | ||
|
|
5f79c9e91b | ||
|
|
16c56c7d73 | ||
|
|
8c074a6577 | ||
|
|
2feeeb5972 | ||
|
|
89495b81dd | ||
|
|
a5c67e1c05 | ||
|
|
b288e0f8f5 | ||
|
|
5d3af013b0 | ||
|
|
b734adb860 | ||
|
|
88db35dd77 | ||
|
|
6efc03fd41 | ||
|
|
befcaa08e8 | ||
|
|
59834c2c06 | ||
|
|
ed48dc8cae | ||
|
|
f3bcc28b21 | ||
|
|
e549af7279 | ||
|
|
e5c3e23ec4 | ||
|
|
03cc8c8ca3 | ||
|
|
dc84f5c5c9 | ||
|
|
e0ac832842 | ||
|
|
ff1fc50954 | ||
|
|
9e10989282 | ||
|
|
4bca95c431 | ||
|
|
f60dafdac2 | ||
|
|
ee9cf50a0f | ||
|
|
e023911555 | ||
|
|
b19da298ac | ||
|
|
7efa2ba5c4 | ||
|
|
19bff1c02d | ||
|
|
fd984b9655 | ||
|
|
6014da9e30 | ||
|
|
e5e6e34ead | ||
|
|
e8b07e3796 | ||
|
|
1b5bb5c05a | ||
|
|
1df37f767c | ||
|
|
77973edc33 | ||
|
|
48e4b51e96 | ||
|
|
9c53920ae6 | ||
|
|
993b49a693 | ||
|
|
bf72a5728f | ||
|
|
48209ca1ba | ||
|
|
7cb6a4e2f1 | ||
|
|
7d026dd508 | ||
|
|
178f23fbb7 | ||
|
|
75b93231ca | ||
|
|
23684f8383 | ||
|
|
4b8b59894b | ||
|
|
ade337e1a8 | ||
|
|
d38f60e27c | ||
|
|
bf75b72e46 | ||
|
|
dbd0c33f24 | ||
|
|
4d7a57cf34 | ||
|
|
1c2c9330d9 | ||
|
|
836935c5e6 | ||
|
|
2e789ea9b2 | ||
|
|
a4a64560c0 | ||
|
|
65f957107e | ||
|
|
e9d60dc000 | ||
|
|
c58cd08bf9 | ||
|
|
900a826cf8 | ||
|
|
7fe510422e | ||
|
|
1ba9563160 | ||
|
|
4bef2ec5f7 | ||
|
|
c98ea50c21 | ||
|
|
78697777d7 | ||
|
|
83696460f0 | ||
|
|
bb8acb3640 | ||
|
|
4f29f1aeb2 | ||
|
|
36a4ba8ba3 | ||
|
|
aaafa60129 | ||
|
|
866e778210 | ||
|
|
805484b693 | ||
|
|
a10e992cbc | ||
|
|
44b11d6e67 | ||
|
|
108f50670d | ||
|
|
5885cbf0d2 | ||
|
|
640cdd2df4 | ||
|
|
a4d13e4b8f | ||
|
|
12beb90e58 | ||
|
|
4623f5dca3 | ||
|
|
b124be4eb1 | ||
|
|
c8feafc2a5 | ||
|
|
84b6d13a3c | ||
|
|
fb604ebdf4 | ||
|
|
778dd49f55 | ||
|
|
3e0fdc1a0b | ||
|
|
c4610f8bb6 | ||
|
|
824081f660 | ||
|
|
417bda1b99 | ||
|
|
dbb6fa88fd | ||
|
|
013f2fe433 | ||
|
|
de75384c2b | ||
|
|
9d691ba42f | ||
|
|
744ef2d96f | ||
|
|
0d978396d7 | ||
|
|
581db2ffeb | ||
|
|
0d1de84756 | ||
|
|
c4f9b63aea | ||
|
|
0472107417 | ||
|
|
e1de1d3a93 | ||
|
|
46b486ab5b | ||
|
|
68bd38e8a0 | ||
|
|
b5c86e8130 | ||
|
|
bd54740062 | ||
|
|
8596e37d97 | ||
|
|
5eb689ade0 | ||
|
|
195f8a213e | ||
|
|
4d6b56a932 | ||
|
|
62a9c01c6d | ||
|
|
12dd329a29 | ||
|
|
4a7000742c | ||
|
|
f41e1ff806 | ||
|
|
fa5ef15197 | ||
|
|
2b1f600cbd | ||
|
|
0396e35b5a | ||
|
|
9824efff73 | ||
|
|
7fbe57368e | ||
|
|
21c0d8f1f0 | ||
|
|
316490baea | ||
|
|
bd77322580 | ||
|
|
09cf102456 | ||
|
|
f8514af7a6 | ||
|
|
6b4aadc588 | ||
|
|
e2e512d2d6 | ||
|
|
a7d29c59fa | ||
|
|
b2e339dc25 | ||
|
|
e7342330e5 | ||
|
|
3f868304cf | ||
|
|
2926167cfa | ||
|
|
84448306a4 | ||
|
|
b97436b18b | ||
|
|
db07df5448 | ||
|
|
4adeb81260 | ||
|
|
9684207d04 | ||
|
|
b467d6d513 | ||
|
|
36454232a5 | ||
|
|
ce85352146 | ||
|
|
7786c6e2cf | ||
|
|
4bd1ffa49a | ||
|
|
38762b8f78 | ||
|
|
7b2cea5ab2 | ||
|
|
b0d3bfa316 | ||
|
|
1672bf6d27 | ||
|
|
8736952b0b | ||
|
|
bd1fc1c256 | ||
|
|
bb4d193ac7 | ||
|
|
7379bd7274 | ||
|
|
1372968ab0 | ||
|
|
d2b4bca42e | ||
|
|
6dceaa1d9d | ||
|
|
b288652bbd | ||
|
|
2b37242292 | ||
|
|
afd2d8e4cf | ||
|
|
c18996947c | ||
|
|
23b80c8e30 | ||
|
|
3b92bd0090 | ||
|
|
14bc2891a8 | ||
|
|
1ebe204c2f | ||
|
|
27725d0745 | ||
|
|
8977920253 | ||
|
|
41b9ee8834 | ||
|
|
c4d50b0133 | ||
|
|
bb389bead8 | ||
|
|
326cc336af | ||
|
|
cd53ea93c5 | ||
|
|
aec69ce220 | ||
|
|
b2d08f91db | ||
|
|
50cdbb37c8 | ||
|
|
e81d02baf1 | ||
|
|
b73817cc6e | ||
|
|
0fefdeb526 | ||
|
|
8dfac9573a | ||
|
|
369361ae70 | ||
|
|
1afd3473fb | ||
|
|
117fb47f99 | ||
|
|
1bff89846b | ||
|
|
ba87d08c0e | ||
|
|
d9c0413f79 | ||
|
|
216777ea17 | ||
|
|
325411e109 | ||
|
|
e5aecd47c4 | ||
|
|
c84a7a232e | ||
|
|
16c5d19ce5 | ||
|
|
ac96f15bf3 | ||
|
|
0c0537fdce | ||
|
|
f58702e8f9 | ||
|
|
80c03e37ba | ||
|
|
71e65bb036 | ||
|
|
522141076e | ||
|
|
408a47499e | ||
|
|
30a65b1aa3 | ||
|
|
0a3fdd250a | ||
|
|
b617aa5f3f | ||
|
|
8b0cf1dde4 | ||
|
|
d392de74de | ||
|
|
e5b4feb70a | ||
|
|
af41baeb91 | ||
|
|
5540d977f4 | ||
|
|
98b663a29b | ||
|
|
e3c3d0b385 | ||
|
|
cfda609a21 | ||
|
|
229598b807 | ||
|
|
4c6221ee37 | ||
|
|
d76f7a7ce4 | ||
|
|
fc05e28803 | ||
|
|
0bbec4b26e | ||
|
|
93cff2fae1 | ||
|
|
ec0f2c34d3 | ||
|
|
e26d180b8c | ||
|
|
cb0cd6afdb | ||
|
|
b95e3d2f47 | ||
|
|
b5eadff384 | ||
|
|
a0321a68c0 | ||
|
|
9ed0e96ba7 | ||
|
|
087f809fe7 | ||
|
|
dd6c617d24 | ||
|
|
b4e8fc709e | ||
|
|
487366d091 | ||
|
|
6099222717 | ||
|
|
608e780536 | ||
|
|
0f73666749 | ||
|
|
e72e877181 | ||
|
|
4063f0aea3 | ||
|
|
0c8d33de03 | ||
|
|
e94070eb22 | ||
|
|
8aef0cde12 | ||
|
|
d355dcec62 | ||
|
|
c0a9e11235 | ||
|
|
8469bec1cc | ||
|
|
28a71c3409 | ||
|
|
85c407a740 | ||
|
|
2a01f209a6 | ||
|
|
1137a26bcf | ||
|
|
8157b18b8a | ||
|
|
c8c25a4610 | ||
|
|
031e782bb9 | ||
|
|
289ee58ce3 | ||
|
|
53af79cfe4 | ||
|
|
57beda9b45 | ||
|
|
0f3ff1725d | ||
|
|
7188179fc0 | ||
|
|
6544a589ed | ||
|
|
79ae2a4af9 | ||
|
|
b952290dc3 | ||
|
|
737f1f03a5 | ||
|
|
cf83dc5456 | ||
|
|
652ad8aaa3 | ||
|
|
5e969c1033 | ||
|
|
e42cc5be8a | ||
|
|
8cb05a6bfa | ||
|
|
4fb75ded4c | ||
|
|
1c883e2882 | ||
|
|
d6bf80ccc7 | ||
|
|
cd536776a0 | ||
|
|
f51eb4a5cc | ||
|
|
de40301f0a | ||
|
|
aa41cdbb65 | ||
|
|
4d02bdd9b0 | ||
|
|
41e8b21fb7 | ||
|
|
fe9da7ee9b | ||
|
|
bd8218fbe9 | ||
|
|
d52bc68220 | ||
|
|
090cd9f443 | ||
|
|
b6c83bbaa0 | ||
|
|
5946c46972 | ||
|
|
20522f2f5d | ||
|
|
7b297f76c4 | ||
|
|
3c467c0d22 | ||
|
|
b2ae052c6d | ||
|
|
8ee7e2c0c8 | ||
|
|
3270b340e8 | ||
|
|
22978078f7 | ||
|
|
53e41464fd | ||
|
|
86f7daf592 | ||
|
|
91e12f541f | ||
|
|
176a02c5d9 | ||
|
|
c6836cfdda | ||
|
|
090a56eb9c | ||
|
|
8c0d3621b3 | ||
|
|
86d6d4c47c | ||
|
|
f1d4b41340 | ||
|
|
ab8cec12c9 | ||
|
|
3bd31fac90 | ||
|
|
31f9f9f24c | ||
|
|
e7b4a0bced | ||
|
|
a3b44d2fd5 | ||
|
|
55dcae1c8d | ||
|
|
a01eaef0fd | ||
|
|
9da759a317 | ||
|
|
d2d2d043ff | ||
|
|
afd4dcf3b2 | ||
|
|
9b7bbe7b0b | ||
|
|
d84462d473 | ||
|
|
e3579cb231 | ||
|
|
1a34934e94 | ||
|
|
c2705c1e62 | ||
|
|
63d49273c4 | ||
|
|
2df44bba5b | ||
|
|
4b17c0b9ac | ||
|
|
71d6f09173 | ||
|
|
5faf3cd5fb | ||
|
|
b4a30ded4c | ||
|
|
e1dc14d3a1 | ||
|
|
4c8f853735 | ||
|
|
6225a43223 | ||
|
|
abda80a05a | ||
|
|
6ab8d020db | ||
|
|
5daa998b30 | ||
|
|
5840eaec8d | ||
|
|
4a6d0824c9 | ||
|
|
166523ca2b | ||
|
|
04a5f54547 | ||
|
|
8f47502291 | ||
|
|
fb71b69665 | ||
|
|
f8a5744b34 | ||
|
|
e3fa3463d6 | ||
|
|
a712177a4b | ||
|
|
b9ad7b9a9c | ||
|
|
47e20014b0 | ||
|
|
2f4e768ff4 | ||
|
|
f1aea23023 | ||
|
|
4734b96d4e | ||
|
|
faf0038376 | ||
|
|
dd7aea80f7 | ||
|
|
4ff1b892d0 | ||
|
|
22125a047d | ||
|
|
b2191ea8e1 | ||
|
|
971c5b1379 | ||
|
|
2d8de9b8ab | ||
|
|
271a7e6bb3 | ||
|
|
573c16a666 | ||
|
|
bae16cb45b | ||
|
|
b80225264a | ||
|
|
dcc145f13a | ||
|
|
51958e82aa | ||
|
|
ca0a087f3d | ||
|
|
22dc22c127 | ||
|
|
a56783bbb4 | ||
|
|
699808bcad | ||
|
|
7176037aa2 | ||
|
|
55447abbdf | ||
|
|
2c226bf49d | ||
|
|
8a623ebc61 | ||
|
|
fce70ef38b | ||
|
|
9622bd6207 | ||
|
|
f177941b93 | ||
|
|
a2c6905133 | ||
|
|
3df9acbfc9 | ||
|
|
9f58b3b3d5 | ||
|
|
e6b5a4d682 | ||
|
|
1fb27efd70 | ||
|
|
d4a3e63ec8 | ||
|
|
f64964aa1d | ||
|
|
97775c5655 | ||
|
|
483e2421c9 | ||
|
|
ac4a274dcf | ||
|
|
8b3d87d197 | ||
|
|
bee873f407 | ||
|
|
7b33a9910c | ||
|
|
d60264342d | ||
|
|
3cd2c9e1c8 | ||
|
|
c94ffee869 | ||
|
|
7da69e79df | ||
|
|
a79461545e | ||
|
|
32e36bd888 | ||
|
|
15e49fdbfb | ||
|
|
1b0419e8fd | ||
|
|
bd395b3bfc | ||
|
|
b7c1e2526a | ||
|
|
9300fb41f8 | ||
|
|
c434fa5195 | ||
|
|
7f504f2317 | ||
|
|
cafa5c1c2d | ||
|
|
73a90d1006 | ||
|
|
d4e2205ea9 | ||
|
|
8e9d1adf75 | ||
|
|
2f6c94da4c | ||
|
|
68898bb9a7 | ||
|
|
812fdadfca | ||
|
|
0e307a526c | ||
|
|
c1997cb5c3 | ||
|
|
74445dae42 | ||
|
|
fcf3192814 | ||
|
|
916861c0e8 | ||
|
|
437e9a0bc4 | ||
|
|
389c4049b3 | ||
|
|
a9ec4db8f2 | ||
|
|
9cda4e6527 | ||
|
|
cf1bd0e401 | ||
|
|
419daeb511 | ||
|
|
5555b3c9db | ||
|
|
482d5be531 | ||
|
|
87afdbeb7d | ||
|
|
a84f4f6087 | ||
|
|
12da649245 | ||
|
|
22aec49d4c | ||
|
|
6580f24783 | ||
|
|
a3c143bd82 | ||
|
|
07e148c8e7 | ||
|
|
8455ea2e13 | ||
|
|
95439d0f33 | ||
|
|
aa7d0d8c85 | ||
|
|
3ce3cb772d | ||
|
|
e08a28e045 | ||
|
|
6ea9602009 | ||
|
|
ea11fd8868 | ||
|
|
346b0368cf | ||
|
|
175585876f | ||
|
|
1ecd1b9c52 | ||
|
|
30f76e827e | ||
|
|
8b9e784e1e | ||
|
|
5a5938db82 | ||
|
|
3c57cea2ce | ||
|
|
0143b2901f | ||
|
|
527b07a1ad | ||
|
|
347c2d6d30 | ||
|
|
9af8f15624 | ||
|
|
c17caa0c0f | ||
|
|
77da45645d | ||
|
|
8b2c88998b | ||
|
|
4cf126f7ce | ||
|
|
1c4ecd2a95 | ||
|
|
56d10407e7 | ||
|
|
f3194fe603 | ||
|
|
f59d1dac46 | ||
|
|
359f885aae | ||
|
|
272f8d891e | ||
|
|
25f22cdc5d | ||
|
|
af781b708c | ||
|
|
0a9eb68f77 | ||
|
|
59d334f4d4 | ||
|
|
e6eece1575 | ||
|
|
8fbeb80792 | ||
|
|
dc98736719 | ||
|
|
3f4c6398be | ||
|
|
7e4384f810 | ||
|
|
fdd4dd9b35 | ||
|
|
bba8ab25f1 | ||
|
|
aa05c43a5f | ||
|
|
69e6145e1e | ||
|
|
fb19d01b96 | ||
|
|
b380f45a13 | ||
|
|
8e12bada8a | ||
|
|
ade410fae0 | ||
|
|
6d668c6160 | ||
|
|
78273e9d23 | ||
|
|
2b5207bc59 | ||
|
|
deeb3e0c49 | ||
|
|
2b00449aa7 | ||
|
|
98d8740ccd | ||
|
|
56bc01ab4a | ||
|
|
1d43796211 | ||
|
|
e8a641509f | ||
|
|
674180c97f | ||
|
|
c264e159a4 | ||
|
|
a5a67731da | ||
|
|
d7bf7dee47 | ||
|
|
3032beba73 | ||
|
|
50b029f4d9 | ||
|
|
c07d15973c | ||
|
|
5beebbd8da | ||
|
|
763d748cf2 | ||
|
|
0e442c97a5 | ||
|
|
2411847f16 | ||
|
|
874f418e03 | ||
|
|
0126f74936 | ||
|
|
7d956ece8c | ||
|
|
ee708ff4aa | ||
|
|
c1f1f8ac3a | ||
|
|
0aa556c39c | ||
|
|
b76ab178d1 | ||
|
|
dfbe6788b4 | ||
|
|
1d2c0959c9 | ||
|
|
fc0f5b4539 | ||
|
|
49af3f858e | ||
|
|
0528939c0a | ||
|
|
a2d90c1616 | ||
|
|
5ac0cdbfce | ||
|
|
b8654f033b | ||
|
|
f60c8ea48b | ||
|
|
dafd2cb4e2 | ||
|
|
f970591c5a | ||
|
|
d729e4cab7 | ||
|
|
cccb23f01b | ||
|
|
199923e3cc | ||
|
|
706389d9df | ||
|
|
bba21e6815 | ||
|
|
0f459ed24c | ||
|
|
c1a0ddea63 | ||
|
|
337e927dae | ||
|
|
d8ab22727f | ||
|
|
505b859fe9 | ||
|
|
e6cfa98486 | ||
|
|
93bd527109 | ||
|
|
d283aef5ca | ||
|
|
be333ac3a5 | ||
|
|
62b978f77c | ||
|
|
84e64a529a | ||
|
|
b4a20010e6 | ||
|
|
b8b9306a9a | ||
|
|
5ec32b62e5 | ||
|
|
c659704b20 | ||
|
|
ce339a4a50 | ||
|
|
53ff5566ce | ||
|
|
c1bf67ee67 | ||
|
|
5dbe03ea6c | ||
|
|
a2b6134e37 | ||
|
|
d82c2c9274 | ||
|
|
cc6711057e | ||
|
|
c60619245a | ||
|
|
a7b3ea4189 | ||
|
|
7057c83fd4 | ||
|
|
737ea4d4f9 | ||
|
|
ac22df9290 | ||
|
|
a33c222135 | ||
|
|
f6d1e06932 | ||
|
|
447a13cdd4 | ||
|
|
727a9ed970 | ||
|
|
5d5979d9a8 | ||
|
|
5eb19629b0 | ||
|
|
cbfdc4fd51 | ||
|
|
24c0303794 | ||
|
|
d9422a21e0 | ||
|
|
4be30f34c2 | ||
|
|
4da76e0c6f | ||
|
|
39c92b4dc4 | ||
|
|
c74a04a26f | ||
|
|
aedf3f9fc5 | ||
|
|
7e76b8b7da | ||
|
|
d9fe359377 | ||
|
|
c32c5775be | ||
|
|
3220407d48 | ||
|
|
45c51b256a | ||
|
|
c1505fc01f | ||
|
|
cca1377d96 | ||
|
|
8024d6459c | ||
|
|
78732c5421 | ||
|
|
0e199278c1 | ||
|
|
9d22ab92f9 | ||
|
|
8a6f26dfd6 | ||
|
|
43b84ec02e | ||
|
|
dadd9cf997 | ||
|
|
dacd5d7572 | ||
|
|
a8b09f0b0a | ||
|
|
7670167015 | ||
|
|
7f00439ebe | ||
|
|
a6263137d7 | ||
|
|
efb6a6917b | ||
|
|
987f70fee5 | ||
|
|
42a0e84308 | ||
|
|
564707901d | ||
|
|
70a316cc3d | ||
|
|
7ef62e1fda | ||
|
|
118e780f0d | ||
|
|
3c5b5b8b03 | ||
|
|
0a6412bea9 | ||
|
|
4a8b8d5f68 | ||
|
|
e00bceb7f2 | ||
|
|
58dce30461 | ||
|
|
3583bcd14d | ||
|
|
3191649a85 | ||
|
|
4325d27ddd | ||
|
|
834a0cf023 | ||
|
|
778abcac1e | ||
|
|
741c894274 | ||
|
|
651e543fd6 | ||
|
|
ae56578d18 | ||
|
|
74ca57dfe8 | ||
|
|
91aab55475 | ||
|
|
fa9c4632bb | ||
|
|
3d1c60aba7 | ||
|
|
399abab9bc | ||
|
|
908040f25e | ||
|
|
ac906fde2f | ||
|
|
57dcd53d86 | ||
|
|
45479ef311 | ||
|
|
21fb4595e6 | ||
|
|
43c812bc6a | ||
|
|
86110845b2 | ||
|
|
f9045181fd | ||
|
|
850ad58630 | ||
|
|
a95c870766 | ||
|
|
56d806cf6f | ||
|
|
c2efd628df | ||
|
|
5eceb4fed1 | ||
|
|
38457c3dac | ||
|
|
fee163dd57 | ||
|
|
f954f74302 | ||
|
|
0271d97259 | ||
|
|
9cb8617078 | ||
|
|
7c5f9f7faa | ||
|
|
053855b040 | ||
|
|
a5b5719d3b | ||
|
|
01b69091e2 | ||
|
|
d30fa5d58e | ||
|
|
b54cd94fe7 | ||
|
|
5de0b392f2 | ||
|
|
3613700a38 | ||
|
|
318a497768 | ||
|
|
7b428cdeda | ||
|
|
b28595b502 | ||
|
|
f9714aa24d | ||
|
|
a9ff449aa6 | ||
|
|
236c02759b | ||
|
|
777948e773 | ||
|
|
6e45576dd6 | ||
|
|
2bc35b0348 | ||
|
|
818d29db9b | ||
|
|
47f70113d4 | ||
|
|
2fa0c16e5e | ||
|
|
8060afb088 | ||
|
|
a1bc39d130 | ||
|
|
e6fae6c23f | ||
|
|
adb160df0f | ||
|
|
74a776f9ae | ||
|
|
12ea18c68d | ||
|
|
f870ecb4a6 | ||
|
|
6d6bfafbdd | ||
|
|
7178674807 | ||
|
|
1954f681c6 | ||
|
|
bb6a548712 | ||
|
|
403816eb85 | ||
|
|
adb7c216b2 | ||
|
|
92d78458e0 | ||
|
|
dd5db06467 | ||
|
|
b13e6b03cc | ||
|
|
a2b8387b70 | ||
|
|
4229a555fc | ||
|
|
688833b80e | ||
|
|
ca0246a4c1 | ||
|
|
c1cdafa1b4 | ||
|
|
ed960988ee | ||
|
|
3ee97d4d5b | ||
|
|
b34f300eaf | ||
|
|
2e5cc5e04e | ||
|
|
182c784a99 | ||
|
|
b14b621029 | ||
|
|
8825dba4e7 | ||
|
|
9922b56ffb | ||
|
|
6681674e3c | ||
|
|
99f35e8204 | ||
|
|
c46f149efd | ||
|
|
644d185dea | ||
|
|
6fc4ae7a28 | ||
|
|
3f92a4421a | ||
|
|
7a4a5dd66c | ||
|
|
fe456215a6 | ||
|
|
65957278ab | ||
|
|
6f2e1d1ce2 | ||
|
|
51078dff7f | ||
|
|
03824c9e29 | ||
|
|
10c96c43ac | ||
|
|
8e8fd5439a | ||
|
|
d3bcbd9968 | ||
|
|
6526b37460 | ||
|
|
9379b5aed5 | ||
|
|
f2794b3c5d | ||
|
|
f090816a3f | ||
|
|
d385bbc985 | ||
|
|
715765a548 | ||
|
|
de0fdbb080 | ||
|
|
e6800f5073 | ||
|
|
e1ff4d762b | ||
|
|
ffccedee33 | ||
|
|
8ddd60a387 | ||
|
|
eaf359df0c | ||
|
|
ff6400a018 | ||
|
|
a74458a36e | ||
|
|
e6c847ea05 | ||
|
|
c7d28e2bd8 | ||
|
|
898f3e5757 | ||
|
|
c239e82816 | ||
|
|
aaa9cb7c22 | ||
|
|
73d802bead | ||
|
|
29b0ceae9f | ||
|
|
b21af8a7dd | ||
|
|
7a888be2e5 | ||
|
|
815b5ca1d5 | ||
|
|
76118226b6 | ||
|
|
091c054eed | ||
|
|
3d2a9041f9 | ||
|
|
aeb85812a1 | ||
|
|
3a3b589b06 | ||
|
|
20c8b4db54 | ||
|
|
c44dd6ddad | ||
|
|
446976666c | ||
|
|
c997ad6f05 | ||
|
|
27a6efc25b | ||
|
|
557514f55c | ||
|
|
5ba09e9ace | ||
|
|
60ae95f973 | ||
|
|
9a181424ac | ||
|
|
4e3478c9d6 | ||
|
|
3803547285 | ||
|
|
cbdd4ce994 | ||
|
|
3749705b11 | ||
|
|
c940655b0f | ||
|
|
db18c4898e | ||
|
|
5d78a2a235 | ||
|
|
268ddc7d50 | ||
|
|
dee715bb6f | ||
|
|
edac0ff420 | ||
|
|
3f10c64fca | ||
|
|
d706ee318c | ||
|
|
a4d2c17357 | ||
|
|
6f37efd8b2 | ||
|
|
746c5e5528 | ||
|
|
6ff9e537fe | ||
|
|
b12057e3bd | ||
|
|
34e1cf8304 | ||
|
|
178d3b59d5 | ||
|
|
ce4e2493ee | ||
|
|
85f9983c19 | ||
|
|
9cb56e2980 | ||
|
|
c5134a9b13 | ||
|
|
475d6600c1 | ||
|
|
3dbdcab168 | ||
|
|
756fe67e60 | ||
|
|
23d07a32b2 | ||
|
|
9f82a64eb6 | ||
|
|
79b86f69e6 | ||
|
|
4d81490eb3 | ||
|
|
28a24ea3be | ||
|
|
6a4e9d5422 | ||
|
|
777d5f0ba8 | ||
|
|
9e7cf8346d | ||
|
|
1f37d82ce4 | ||
|
|
baf2a7b0fe | ||
|
|
73d5e9c5dd | ||
|
|
daf7870cb0 | ||
|
|
796e41bedf | ||
|
|
816194943b | ||
|
|
2eabfeeea8 | ||
|
|
5715c04ceb | ||
|
|
dd05029135 | ||
|
|
78362fb43a | ||
|
|
1723365c85 | ||
|
|
7e9524d7b9 | ||
|
|
c4b593538b | ||
|
|
0b2ebf9875 | ||
|
|
aa35ed104c | ||
|
|
737a7a7116 | ||
|
|
4634a5c628 | ||
|
|
c33725a845 | ||
|
|
e70623f196 | ||
|
|
862593b1f7 | ||
|
|
215318944a | ||
|
|
58e02de834 | ||
|
|
e02a4a825a | ||
|
|
73c74c0303 | ||
|
|
2d882a7200 | ||
|
|
d2a3720ad0 | ||
|
|
e6777f1523 | ||
|
|
41d5fb8189 | ||
|
|
3480c29030 | ||
|
|
a5c268a9f9 | ||
|
|
4f3121b654 | ||
|
|
73b2951ffe | ||
|
|
46505987ea | ||
|
|
bf58f8aea9 | ||
|
|
6c52fbcdfd | ||
|
|
e76eb59d84 | ||
|
|
5b093c28e1 | ||
|
|
9d3b949aa6 | ||
|
|
a468d7579f | ||
|
|
4eb32cb4f2 | ||
|
|
8f08533808 | ||
|
|
3b69e6514c | ||
|
|
9018ec3d41 | ||
|
|
5d16193294 | ||
|
|
61b305d30d | ||
|
|
efc9004234 | ||
|
|
ba733f2d38 | ||
|
|
34a122edc8 | ||
|
|
a5afd877aa | ||
|
|
1289479fce | ||
|
|
7bfb13dea7 | ||
|
|
744d31d57a | ||
|
|
a58305d61e | ||
|
|
3bd2561144 | ||
|
|
156a61c86d | ||
|
|
5850877aea | ||
|
|
847dcc878b | ||
|
|
84791e75cc | ||
|
|
e30230223c | ||
|
|
884e63790c | ||
|
|
a0b8bf89d3 | ||
|
|
c3e64b1b2d | ||
|
|
2131b2e9d5 | ||
|
|
6981af01ee | ||
|
|
863c253425 | ||
|
|
08d800d44e | ||
|
|
e23e3f656a | ||
|
|
4ad4b8aaec | ||
|
|
0f32a82524 | ||
|
|
2a0d3143dd | ||
|
|
6e867c19c9 | ||
|
|
c78152220a | ||
|
|
be2519d4dd | ||
|
|
9800c1597f | ||
|
|
2bf12371d8 | ||
|
|
7243acff2a | ||
|
|
bfa30819b9 | ||
|
|
ac5e053d8f | ||
|
|
13751495a1 | ||
|
|
1d2f218bff | ||
|
|
00b953713e | ||
|
|
ed4a024430 | ||
|
|
53398947a1 | ||
|
|
5e14cce7ae | ||
|
|
27276e481d | ||
|
|
7949927db6 | ||
|
|
634853cee6 | ||
|
|
0f100b0d3f | ||
|
|
83adf65c37 | ||
|
|
67b467223a | ||
|
|
2e6b75c735 | ||
|
|
0ec5eacc92 | ||
|
|
b024130dc2 | ||
|
|
aff66fa170 | ||
|
|
92e8245d90 | ||
|
|
c300ac7a4d | ||
|
|
67b836ed72 | ||
|
|
388569f846 | ||
|
|
981d081027 | ||
|
|
6a7bd50a0b | ||
|
|
f280d719f3 | ||
|
|
1d39399861 | ||
|
|
008d74220b | ||
|
|
0f0189167b | ||
|
|
bf6bcd3c16 | ||
|
|
b439039b9b | ||
|
|
2cada8c970 | ||
|
|
360b2870d8 | ||
|
|
b669dbd1ad | ||
|
|
b81692a8a9 | ||
|
|
dfa0cede72 | ||
|
|
add1d7c11f | ||
|
|
221ef68cc3 | ||
|
|
a7190a7381 | ||
|
|
f721ed2bf4 | ||
|
|
6dde9c58fe | ||
|
|
f1a5372cbc | ||
|
|
c22b040b21 | ||
|
|
0c5abc43a0 | ||
|
|
d5f4d5f22e | ||
|
|
2a5c6dea54 | ||
|
|
05d30f2715 | ||
|
|
c8d085374c | ||
|
|
9ceb93e7ff | ||
|
|
b808e70940 | ||
|
|
654ad9e596 | ||
|
|
8cff7ef2b9 | ||
|
|
137cf55755 | ||
|
|
ddc22e05ab | ||
|
|
42fcbf3950 | ||
|
|
11f5ed65ba | ||
|
|
99cf57df5f | ||
|
|
b71a140977 | ||
|
|
e49897affc | ||
|
|
2ef6cb6073 | ||
|
|
4db03fe797 | ||
|
|
8506a6bc2a | ||
|
|
8303c90f14 | ||
|
|
a530d04879 | ||
|
|
4a99368c87 | ||
|
|
46faa9979f | ||
|
|
c038102c6a | ||
|
|
23cfe44342 | ||
|
|
b3d7a51157 | ||
|
|
23f91764bc | ||
|
|
2ab1921d24 | ||
|
|
1c2d713cab | ||
|
|
395224e372 | ||
|
|
43cdd09d2d | ||
|
|
de6c7a9b78 | ||
|
|
7d7530446c | ||
|
|
208fa17ad0 | ||
|
|
5a1b7d267a | ||
|
|
1bcceb8ba4 | ||
|
|
e0bcf6c00d | ||
|
|
0a5f63aee2 | ||
|
|
2008517b36 | ||
|
|
517bef6ccd | ||
|
|
e2db29a312 | ||
|
|
a3fa97f5e3 | ||
|
|
7fc45bccbd | ||
|
|
7d3a280b7a | ||
|
|
be60b8e319 | ||
|
|
4090d52520 | ||
|
|
1f88c647cd | ||
|
|
08b596b409 | ||
|
|
e625640bd0 | ||
|
|
a6a2dbc63c | ||
|
|
5c3c1931dd | ||
|
|
d75c1aaea1 | ||
|
|
f1a905664b | ||
|
|
5cf455d736 | ||
|
|
8ef322d66f | ||
|
|
1d5b09348e | ||
|
|
5782ca8976 | ||
|
|
623ce837c7 | ||
|
|
73f21f7813 | ||
|
|
a8377ab773 | ||
|
|
5106e930d1 | ||
|
|
74b4707ea6 | ||
|
|
99b8fcfb0d | ||
|
|
5df13c9b0a | ||
|
|
5eeef11a3b | ||
|
|
cfbca54a71 | ||
|
|
f0f6a9c44e | ||
|
|
cc1a9180a7 | ||
|
|
155639bf0f | ||
|
|
c0f51577fd | ||
|
|
efac765819 | ||
|
|
1c7a2ac60f | ||
|
|
f4b094e098 | ||
|
|
e984b74461 | ||
|
|
c1e61448b3 | ||
|
|
2f077ef41f | ||
|
|
cfc48b6ee9 | ||
|
|
073c4cb543 | ||
|
|
8bacb0720c | ||
|
|
da8c36f53f | ||
|
|
83cf5efca9 | ||
|
|
4d9669b8d9 | ||
|
|
18573f3eb2 | ||
|
|
57ec0f45c9 | ||
|
|
a7830ac93b | ||
|
|
488bd9911e | ||
|
|
7956c15081 | ||
|
|
0402200daf | ||
|
|
dc0708fa82 | ||
|
|
7b9ad5a22f | ||
|
|
c4e9f56745 | ||
|
|
b69a467146 | ||
|
|
75cce0c815 | ||
|
|
546754d2e9 | ||
|
|
e8f8b7a82d | ||
|
|
c54a604289 | ||
|
|
f52e14c576 | ||
|
|
a0aef26c06 | ||
|
|
4d4a6210f7 | ||
|
|
a5ad9a2579 | ||
|
|
79d6ddd36a | ||
|
|
18da62e303 | ||
|
|
77469b714b | ||
|
|
1fbac54162 | ||
|
|
cf14c509f3 | ||
|
|
02bde8d334 | ||
|
|
e99f534046 | ||
|
|
aeac9910cb | ||
|
|
f84513b43e | ||
|
|
34fc818d7e | ||
|
|
f1e1eb58be | ||
|
|
3d6c17e94f | ||
|
|
ef3e297950 | ||
|
|
5cf3719e7b | ||
|
|
b36e366ef4 | ||
|
|
c2b86aabe0 | ||
|
|
849a1c46cf | ||
|
|
7c863aef95 | ||
|
|
cc7705fe6f | ||
|
|
e97b60d16a | ||
|
|
1b1382a3a9 | ||
|
|
ff0e048521 | ||
|
|
0af7afd19f | ||
|
|
24aec7f87f | ||
|
|
acb7c4ee48 | ||
|
|
5796c221a1 | ||
|
|
dde28b7ffe | ||
|
|
dfa21e5966 | ||
|
|
8014db4d68 | ||
|
|
c6394074a8 | ||
|
|
83ce0dcba6 | ||
|
|
9a69ea769a | ||
|
|
3044600151 | ||
|
|
da6d91f64b | ||
|
|
c6ca8a1528 | ||
|
|
8108bc26d6 | ||
|
|
908b4d6cb9 | ||
|
|
0683df4bf8 | ||
|
|
05907fc584 | ||
|
|
ca56751421 | ||
|
|
dd084ce340 | ||
|
|
92278a462b | ||
|
|
ca56be1e3e | ||
|
|
09f8e7fb03 | ||
|
|
c2e9e7a31b | ||
|
|
49f397e6e7 | ||
|
|
6161f25abc | ||
|
|
0898b54377 | ||
|
|
6f1c4b7a75 | ||
|
|
b7b00aad08 | ||
|
|
ec2a94a410 | ||
|
|
4796ddfe36 | ||
|
|
31856b16c3 | ||
|
|
6732422b97 | ||
|
|
2b3ce6fab9 | ||
|
|
b951477c80 | ||
|
|
0bf332a016 | ||
|
|
3e12088cf0 | ||
|
|
c0d94c89ec | ||
|
|
dd3a088973 | ||
|
|
5c15113c49 | ||
|
|
553eb65acd | ||
|
|
0c43179cf9 | ||
|
|
b031f89b29 | ||
|
|
b7df779b8b | ||
|
|
96ed803f48 | ||
|
|
fd798dd6fe | ||
|
|
dd8b68966f | ||
|
|
72ce8c67c5 | ||
|
|
22132a47aa | ||
|
|
0705aa7388 | ||
|
|
762769cf3b | ||
|
|
82eae6c9b5 | ||
|
|
86f04e3bb3 | ||
|
|
ce5f4177bc | ||
|
|
48f3bca87e | ||
|
|
adf0ec7008 | ||
|
|
5b4dde5a7b | ||
|
|
2224409994 | ||
|
|
30d11429a9 | ||
|
|
c4176dd559 | ||
|
|
47d5042d1e | ||
|
|
6df632b672 | ||
|
|
6875b205d6 | ||
|
|
47306242ec | ||
|
|
83780d95f0 | ||
|
|
5b804afa6a | ||
|
|
83b9d5e9ef | ||
|
|
a2b0b9846d | ||
|
|
a0ad16498b | ||
|
|
aa084c8407 | ||
|
|
ac821ab1ef | ||
|
|
6e146d4216 | ||
|
|
e4a96fff58 | ||
|
|
aa6cde5ca1 | ||
|
|
05a5e42609 | ||
|
|
11a013bf87 | ||
|
|
de4de17bc5 | ||
|
|
b0302bb3a6 | ||
|
|
334f8dcbb7 | ||
|
|
47eaf4a1e8 | ||
|
|
1e30b2f8c4 | ||
|
|
84df8be864 | ||
|
|
f05befc26c | ||
|
|
96e22ecc78 | ||
|
|
9eb195d6a5 | ||
|
|
40f0f4d2e8 | ||
|
|
4fa07774d6 | ||
|
|
7567c84e76 | ||
|
|
a87c771012 | ||
|
|
a2535fc95f | ||
|
|
d2aaf842b4 | ||
|
|
13e93efe91 | ||
|
|
af1033c63c | ||
|
|
768f92072f | ||
|
|
8b92864e1d | ||
|
|
d97d668b69 | ||
|
|
5d1c0a2af5 | ||
|
|
b1c9ce6621 | ||
|
|
aec547d764 | ||
|
|
185c59d3bd | ||
|
|
f1c5cfd5f2 | ||
|
|
c848009e29 | ||
|
|
a0d766c204 | ||
|
|
c1f248d670 | ||
|
|
9b1d63b4a3 | ||
|
|
c7262bbe86 | ||
|
|
008028896b | ||
|
|
c5716550a6 | ||
|
|
b43f5fb25b | ||
|
|
013277d331 | ||
|
|
09eedba01f | ||
|
|
ca59b76b50 | ||
|
|
b9485b8d52 | ||
|
|
66b9285a6f | ||
|
|
470e773e76 | ||
|
|
039942bfc1 | ||
|
|
a94e341d85 | ||
|
|
db98ca11cf | ||
|
|
22a5274de9 | ||
|
|
2ee6cf8ea0 | ||
|
|
baf81e4974 | ||
|
|
bda4a5e5b7 | ||
|
|
0598102472 | ||
|
|
4aba8a55f2 | ||
|
|
6f6a35a9a1 | ||
|
|
d691ea7ebc | ||
|
|
ca63ca90ab | ||
|
|
43dd57eba9 | ||
|
|
6dd358e12d | ||
|
|
c73aa6b629 | ||
|
|
63b348b3a9 | ||
|
|
6181f175e3 | ||
|
|
5a52e61271 | ||
|
|
e74c290ac7 | ||
|
|
5ea57c875d | ||
|
|
492b177ca5 | ||
|
|
daa976fff6 | ||
|
|
871d176f15 | ||
|
|
fc2e23b1ad | ||
|
|
1cde2ceb5c | ||
|
|
539457f1ae | ||
|
|
b6ff24fb7f | ||
|
|
da20dc044a | ||
|
|
a42c7fe2d1 | ||
|
|
b792f7aa0e | ||
|
|
9242af95a3 | ||
|
|
9583179c1b | ||
|
|
d9dee002e6 | ||
|
|
434b809272 | ||
|
|
4feb3b1e06 | ||
|
|
14390d1fed | ||
|
|
8831ffbec4 | ||
|
|
45d4def5e4 | ||
|
|
b9c1393e5f | ||
|
|
c5bf4b6c9c | ||
|
|
3ac64eda17 | ||
|
|
148f37c34e | ||
|
|
9845d179b3 | ||
|
|
11b87d29cc | ||
|
|
bc7210e563 | ||
|
|
e1ab53f969 | ||
|
|
790196a645 | ||
|
|
b5c8c81d4d | ||
|
|
91a709b210 | ||
|
|
5e25ee19e4 | ||
|
|
70390f60ec | ||
|
|
c22889019c | ||
|
|
06ea91f2f3 | ||
|
|
3c7699600f | ||
|
|
c8c90bb532 | ||
|
|
6f63d53e1b | ||
|
|
cd1dbbcfc1 | ||
|
|
4bbadbb14a | ||
|
|
cc61df7131 | ||
|
|
965c0bf39d | ||
|
|
6fc3c211ec | ||
|
|
c25dcdd843 | ||
|
|
e387fd1471 | ||
|
|
1c7bc6028a | ||
|
|
74f061de82 | ||
|
|
47b91b8948 | ||
|
|
2d73c959cc | ||
|
|
9a17340b10 | ||
|
|
a9de4d485a | ||
|
|
111cb717e8 | ||
|
|
6a45f61547 | ||
|
|
026d10d369 | ||
|
|
d832bf77eb | ||
|
|
de97a7099c | ||
|
|
1d15980fb6 | ||
|
|
b3303ba072 | ||
|
|
eddb25aa26 | ||
|
|
40c6966137 | ||
|
|
4de6eab547 | ||
|
|
caa2df2274 | ||
|
|
4c8c0b69ba | ||
|
|
527d04d44b | ||
|
|
9a12d05216 | ||
|
|
77c46a6b42 | ||
|
|
744393f0f4 | ||
|
|
6f200d7982 | ||
|
|
12e85d31e2 | ||
|
|
17821cc15e | ||
|
|
0bcd6e68a9 | ||
|
|
528390fa58 | ||
|
|
a719a87508 | ||
|
|
a1fa4eff25 | ||
|
|
f344b7fab6 | ||
|
|
eca98f76ac | ||
|
|
f30618bac7 | ||
|
|
dc4a18b537 | ||
|
|
9801e9cde1 | ||
|
|
1b16c152bd | ||
|
|
3ed71a2fdd | ||
|
|
0e15d57a89 | ||
|
|
c253d247ca | ||
|
|
656fac3d80 | ||
|
|
dde2c138e9 | ||
|
|
7823351d6b | ||
|
|
b23b6bbcf7 | ||
|
|
800e219a2d | ||
|
|
ecf0d31b72 | ||
|
|
c3f476d467 | ||
|
|
7f3e86b27b | ||
|
|
b0453a43c0 | ||
|
|
b30b152bb7 | ||
|
|
a030007908 | ||
|
|
10c5aeabc5 | ||
|
|
9c5f82a7f1 | ||
|
|
7bbe6cbe82 | ||
|
|
b014a71007 | ||
|
|
36c29006f8 | ||
|
|
59e80c1a0a | ||
|
|
e4dc3d6d36 | ||
|
|
a6fdb5b75d | ||
|
|
26574d5284 | ||
|
|
c02722d395 | ||
|
|
b3d74743a8 | ||
|
|
f03f8dcc44 | ||
|
|
a5656326f0 | ||
|
|
f0556f3517 | ||
|
|
6b853ebe01 | ||
|
|
d0e2b9c466 | ||
|
|
a94a8dd402 | ||
|
|
7c342fe2a1 | ||
|
|
9c3f1711e2 | ||
|
|
0347634ad3 | ||
|
|
92c50e7f52 | ||
|
|
22ebf9c6ac | ||
|
|
5fa76547cf | ||
|
|
e29f6ae24d | ||
|
|
00dadad79c | ||
|
|
767768457c | ||
|
|
a468aa55b6 | ||
|
|
cbc82e5cc3 | ||
|
|
b0aa8e6985 | ||
|
|
c3f2e69471 | ||
|
|
86c9719f0a | ||
|
|
be22aff966 | ||
|
|
0159470d3d | ||
|
|
2adeb32b35 | ||
|
|
351cf87351 | ||
|
|
3139de9726 | ||
|
|
b4a47508d4 | ||
|
|
f7860d6172 | ||
|
|
f6b3413fcc | ||
|
|
e799d19df8 | ||
|
|
b1ab76f3e4 | ||
|
|
ccb00b7ef9 | ||
|
|
ac37278a41 | ||
|
|
fc88df7458 | ||
|
|
11ec25d3ce | ||
|
|
4aa1e2f2e8 | ||
|
|
ea4cda6907 | ||
|
|
ba477b681a | ||
|
|
f2fc6e4cad | ||
|
|
6473e3638f | ||
|
|
7e93c0f64b | ||
|
|
1126d3b93e | ||
|
|
c02e97e2c5 | ||
|
|
f7ccdd300d | ||
|
|
8904d4a45c | ||
|
|
8c17f50aea | ||
|
|
28e28e6d74 | ||
|
|
7732d5d7cf | ||
|
|
5f33b78417 | ||
|
|
6abd6fdd72 | ||
|
|
0e7bce124f | ||
|
|
35eda3509e | ||
|
|
58b1195eb4 | ||
|
|
bb79abc8a3 | ||
|
|
574cc98b23 | ||
|
|
855741c7cb | ||
|
|
d58bdcd4fa | ||
|
|
1ae54a6140 | ||
|
|
db566dba37 | ||
|
|
3d699e8ee0 | ||
|
|
e20e0ba392 | ||
|
|
dfe3d8837e | ||
|
|
e59ec88ea2 | ||
|
|
66c43ec708 | ||
|
|
e692090b89 | ||
|
|
1e74962c8a | ||
|
|
14aaf3eab3 | ||
|
|
adfa243b0d | ||
|
|
37ba8d9867 | ||
|
|
c20ee98ac8 | ||
|
|
21aa588967 | ||
|
|
ba34723398 | ||
|
|
51c3164ba3 | ||
|
|
307526e92d | ||
|
|
6dfad5e900 | ||
|
|
ccfb7f032d | ||
|
|
bb5590f7b6 | ||
|
|
67718aff76 | ||
|
|
b9d3dc4101 | ||
|
|
20b6a5b40a | ||
|
|
72d4155c90 | ||
|
|
e7c2d62889 | ||
|
|
c8e05ecd8d | ||
|
|
9c8e5123bd | ||
|
|
9a5882ba80 | ||
|
|
7981e85eb3 | ||
|
|
1d7e1a535b | ||
|
|
4610e33cb2 | ||
|
|
9cda676546 | ||
|
|
f5ff11c61d | ||
|
|
86671a4ed0 | ||
|
|
5cd7a18539 | ||
|
|
4b366ceed5 | ||
|
|
eb5665733a | ||
|
|
ec8d1fce62 | ||
|
|
4afe3f334a | ||
|
|
b27934a727 | ||
|
|
e7d420aabb | ||
|
|
3f76720636 | ||
|
|
3fba1e486e | ||
|
|
59f93bf56c | ||
|
|
6ebaf82426 | ||
|
|
d96ba2d153 | ||
|
|
2adaaa8521 | ||
|
|
755cdcee27 | ||
|
|
643a49ea6c | ||
|
|
583e66e5b0 | ||
|
|
769f82b90b | ||
|
|
19ffe3f16e | ||
|
|
66196f8fd7 | ||
|
|
820cd5c090 | ||
|
|
cdfc0cf26f | ||
|
|
aab046d29b | ||
|
|
ad1b9f0851 | ||
|
|
f9f17d4b0f | ||
|
|
33969b2c90 | ||
|
|
88b9522242 | ||
|
|
2907e4e4f1 | ||
|
|
84876e7e9e | ||
|
|
8f6e9e8827 | ||
|
|
9387b92371 | ||
|
|
a04bfe9cbf | ||
|
|
f7c77084b4 | ||
|
|
60437a80ca | ||
|
|
891c9b5cc7 | ||
|
|
1aa5954b42 | ||
|
|
46a1fec4a5 | ||
|
|
ca73f85acf | ||
|
|
da78e2df64 | ||
|
|
bcee3d43ca | ||
|
|
afe762e4e6 | ||
|
|
5b45da2a71 | ||
|
|
bb789f462c | ||
|
|
a14d08e891 | ||
|
|
81ca3a8b6c | ||
|
|
fd9df74e75 | ||
|
|
c502988b26 | ||
|
|
1d1094a69e | ||
|
|
8ddb66cff4 | ||
|
|
3763a4f24e | ||
|
|
c3754d6f21 | ||
|
|
a2e52e58b1 | ||
|
|
85bf8c2e1c | ||
|
|
f97e625d3d | ||
|
|
9584732376 | ||
|
|
0a73924f60 | ||
|
|
d1a5552fbe | ||
|
|
e1c9600ae7 | ||
|
|
88daaaf385 | ||
|
|
5c08b11b30 | ||
|
|
22e09d7c8e | ||
|
|
0dfe7fe96e | ||
|
|
4657b1e9ec | ||
|
|
4fb3e0f061 | ||
|
|
a528bd5d9f | ||
|
|
4662661e71 | ||
|
|
4d00132265 | ||
|
|
0be7c19204 | ||
|
|
ae3864618a | ||
|
|
1bca766a5d | ||
|
|
a660862d4c | ||
|
|
871da9a196 | ||
|
|
e4326d5926 | ||
|
|
ec651d2263 | ||
|
|
0895e4a7c4 | ||
|
|
ee79446888 | ||
|
|
d0da35f3d2 | ||
|
|
b8a56f0503 | ||
|
|
f001fccf74 | ||
|
|
9451f098d6 | ||
|
|
a42221d051 | ||
|
|
f76df4e179 | ||
|
|
937f55f61f | ||
|
|
7f9311c20e | ||
|
|
37a6bc3abf | ||
|
|
e364481ca4 | ||
|
|
4b54af76ea | ||
|
|
e8db76575a | ||
|
|
9918713e5b | ||
|
|
4c9e84124c | ||
|
|
0753cff4a1 | ||
|
|
3bfa2eb8bb | ||
|
|
c253f9ba51 | ||
|
|
1fffbc7472 | ||
|
|
a693d752bc | ||
|
|
a547f02ddf | ||
|
|
c9c8ba714c | ||
|
|
be7c86dfd2 | ||
|
|
68681fe067 | ||
|
|
6a3f88500f | ||
|
|
b03da97486 | ||
|
|
0dc531502b | ||
|
|
635b1b5b6e | ||
|
|
2c74d574d3 | ||
|
|
7cdc7a0bd9 | ||
|
|
e8be969ec8 | ||
|
|
56c8261d7e | ||
|
|
fe6756d42e | ||
|
|
c093a8e789 | ||
|
|
7ce06ceca7 | ||
|
|
8a7a1fda12 | ||
|
|
eec5824b1a | ||
|
|
b3fc4e375f | ||
|
|
5a69bc6e5f | ||
|
|
e8bfedbcd4 | ||
|
|
627abb8251 | ||
|
|
4198f93479 | ||
|
|
26abb25bd0 | ||
|
|
d931bb8005 | ||
|
|
e5be6fdf8a | ||
|
|
143415e6b8 | ||
|
|
99ce9e9832 | ||
|
|
466ecc5db8 | ||
|
|
274e5f86b5 | ||
|
|
31faa61270 | ||
|
|
7108d098ae | ||
|
|
63c91c859f | ||
|
|
01eb16e339 | ||
|
|
821c7fe59e | ||
|
|
344458e890 | ||
|
|
b0aa499bb2 | ||
|
|
6ebd309cb8 | ||
|
|
151f4af0da | ||
|
|
a5da850f3f | ||
|
|
21657d3c67 | ||
|
|
04c2f73f6f | ||
|
|
f45ff2cfaf | ||
|
|
6cd5abb0c4 | ||
|
|
70b90a6f9d | ||
|
|
6d94a2954d | ||
|
|
843193374f | ||
|
|
732fb15b45 | ||
|
|
00c3a48bd7 | ||
|
|
1fa0e4dfd6 | ||
|
|
7008c3aa9d | ||
|
|
14755ac891 | ||
|
|
9c5392e4af | ||
|
|
fd3bfce0cc | ||
|
|
a3edacb315 | ||
|
|
062c5a1fd0 | ||
|
|
1b51c7e73b | ||
|
|
af8e117d0d | ||
|
|
a87015327e | ||
|
|
775493dedd | ||
|
|
27f19ab42b | ||
|
|
586c892910 | ||
|
|
f9834f6bee | ||
|
|
5e1b1dabb2 | ||
|
|
93b95d2b78 | ||
|
|
73daf89227 | ||
|
|
9f888b86b8 | ||
|
|
364c21f831 | ||
|
|
d71f5443c9 | ||
|
|
1beb8c40f3 | ||
|
|
09dec6f72f | ||
|
|
42357adff5 | ||
|
|
ebaf614a13 | ||
|
|
80fab638f1 | ||
|
|
5ddea12690 | ||
|
|
107da866a6 | ||
|
|
88650610c1 | ||
|
|
c70ee3bf4a | ||
|
|
429a8df30a | ||
|
|
f371bb0b80 | ||
|
|
4b72e436e6 | ||
|
|
6ac40b721e | ||
|
|
16c1678f6d | ||
|
|
b94687cecb | ||
|
|
4976b0c0c2 | ||
|
|
cb715fe584 | ||
|
|
858157b65b | ||
|
|
f8b678f7c8 | ||
|
|
e71dcd4c81 | ||
|
|
ae50e4b6fc | ||
|
|
91f5d65874 | ||
|
|
e677aefec1 | ||
|
|
1423198343 | ||
|
|
0d6850348c | ||
|
|
eba8aab7f2 | ||
|
|
c2c77cdc0f | ||
|
|
d307cc738a | ||
|
|
6e811f30ac | ||
|
|
40f6e92067 | ||
|
|
b53cae8492 | ||
|
|
861ff7f26c | ||
|
|
9ac5e4ef97 | ||
|
|
2b4f9ff609 | ||
|
|
7cdef7f19f | ||
|
|
e9c2895a55 | ||
|
|
30d09ddbed | ||
|
|
617dbb12c2 | ||
|
|
5d49fcbeaa | ||
|
|
788bd6716f | ||
|
|
829c226954 | ||
|
|
06b585059b | ||
|
|
0988b76df5 | ||
|
|
8467987e4b | ||
|
|
5f40ddc1a1 | ||
|
|
6812f61900 | ||
|
|
aeebbd038c | ||
|
|
875eafd489 | ||
|
|
03daea30a6 | ||
|
|
44416660ae | ||
|
|
695dd11003 | ||
|
|
e1453c467f | ||
|
|
a40b092725 | ||
|
|
b4994dc3fe | ||
|
|
4ef39a33cb | ||
|
|
b743f8afc3 | ||
|
|
f299c4e0f6 | ||
|
|
79c16924de | ||
|
|
a3d2e589ed | ||
|
|
15d9f70d1a | ||
|
|
d131ddcf1f | ||
|
|
05d1bec3e5 | ||
|
|
b968f43e95 | ||
|
|
5695b2f051 | ||
|
|
faed18c267 | ||
|
|
8c3911c2b4 | ||
|
|
a6f7c6d0c7 | ||
|
|
6be15c9af0 | ||
|
|
7fc638a948 | ||
|
|
3cd9e1dd23 | ||
|
|
af7e99c091 | ||
|
|
9646d48630 | ||
|
|
849868e342 | ||
|
|
197bc3fd5a | ||
|
|
392dd54529 | ||
|
|
3794d3b8ad | ||
|
|
42a6a38712 | ||
|
|
45f162ad7a | ||
|
|
9a915d886e | ||
|
|
1976546062 | ||
|
|
fedcb63136 | ||
|
|
7ccb88fbc5 | ||
|
|
0fd3803567 | ||
|
|
b284f343cb | ||
|
|
5dabd0cdec | ||
|
|
fbf807583e | ||
|
|
e6e3d524da | ||
|
|
69f39255bc | ||
|
|
b4cde80810 | ||
|
|
85bb215ab8 | ||
|
|
b38a5a7a17 | ||
|
|
4ecaaf1fa7 | ||
|
|
428920f8fc | ||
|
|
4e2a9fa5f2 | ||
|
|
1a41e74d32 | ||
|
|
66444bdafb | ||
|
|
b554fee401 | ||
|
|
293530a4c8 | ||
|
|
8b285f6be9 | ||
|
|
851162a0da | ||
|
|
41fc246374 | ||
|
|
cfaf788606 | ||
|
|
98b530a36d | ||
|
|
9485d96553 | ||
|
|
f30ca710d9 | ||
|
|
4ad4a00de4 | ||
|
|
81f671740e | ||
|
|
d6b36e21cb | ||
|
|
47d3dc6fc3 | ||
|
|
d4ba41692f | ||
|
|
a872332ad9 | ||
|
|
e8bb8dff6a | ||
|
|
e0c2f72ee5 | ||
|
|
60d3ac3f15 | ||
|
|
e50ceb339f | ||
|
|
6a8f231a9c | ||
|
|
029da0400b | ||
|
|
3de797b535 | ||
|
|
14842c9a59 | ||
|
|
652d4c6cd6 | ||
|
|
59097c0922 | ||
|
|
dcb4b37240 | ||
|
|
410e779e8d | ||
|
|
d7cd6fb738 | ||
|
|
ca39edc494 | ||
|
|
2ea2c7bf78 | ||
|
|
b772193f4b | ||
|
|
c84154eb28 | ||
|
|
72bb9e6307 | ||
|
|
7c141b258d | ||
|
|
2999aefb84 | ||
|
|
a9f1783e20 | ||
|
|
6bb619d33c | ||
|
|
0477175963 | ||
|
|
eaa5cc3f91 | ||
|
|
735c6a9adc | ||
|
|
6d59e126b5 | ||
|
|
bb705c7c3e | ||
|
|
398dbbb832 | ||
|
|
90a33c19fe | ||
|
|
3205d087e2 | ||
|
|
a09358fc2c | ||
|
|
c5811b6a26 | ||
|
|
73d8d0a43f | ||
|
|
7323b7d9f2 | ||
|
|
8d6c6946dd | ||
|
|
029fcaa913 | ||
|
|
bebb9b3286 | ||
|
|
3ae9a27c25 | ||
|
|
0050411112 | ||
|
|
5bfdd91cdf | ||
|
|
88442ad885 | ||
|
|
f46511eb69 | ||
|
|
cfa6527373 | ||
|
|
0e168c7d03 | ||
|
|
9c5d0aa7a6 | ||
|
|
5b66c03ac0 | ||
|
|
5dd4159e77 | ||
|
|
b3d3591aed | ||
|
|
fb5c9e690f | ||
|
|
e737fe145f | ||
|
|
abdf594b85 | ||
|
|
33c44e1d1b | ||
|
|
ec27c85596 | ||
|
|
36a504f605 | ||
|
|
c95989d148 | ||
|
|
06f4d47a29 | ||
|
|
7f58bbba88 | ||
|
|
651ccf648d | ||
|
|
2a242b8989 | ||
|
|
f445de3b86 | ||
|
|
12042b2fa2 | ||
|
|
06084cb7e8 | ||
|
|
96dd28efa2 | ||
|
|
3b0ea78aef | ||
|
|
be4a8a192a | ||
|
|
fec974e60e | ||
|
|
5150ebf157 | ||
|
|
9a102f76c8 | ||
|
|
1d6dc36be9 | ||
|
|
9f715b2bdb | ||
|
|
103e83b65e | ||
|
|
f55a29ab93 | ||
|
|
97f9755aeb | ||
|
|
f2fc6e9054 | ||
|
|
04b546bdb9 | ||
|
|
f214bd45dc | ||
|
|
f021d0ca05 | ||
|
|
c65e1fe89f | ||
|
|
7f2c21525b | ||
|
|
5fce52076e | ||
|
|
42c03d3135 | ||
|
|
fdfd720ec4 | ||
|
|
53c46c67ac | ||
|
|
13e79f4f72 | ||
|
|
67af2936fa | ||
|
|
5d9de33889 | ||
|
|
5356de1df7 | ||
|
|
c85cac33ab | ||
|
|
b4a1e5cb83 | ||
|
|
c35f55124b | ||
|
|
005bf81461 | ||
|
|
6b558ed117 | ||
|
|
b81d2117e2 | ||
|
|
34406025e5 | ||
|
|
75d902ef01 | ||
|
|
da098ddd8a | ||
|
|
cb4c5aaf0a | ||
|
|
8761507929 | ||
|
|
ba2a317029 | ||
|
|
c47ec4af2a | ||
|
|
1f875effab | ||
|
|
4c722a96ba | ||
|
|
c67fdb5c94 | ||
|
|
398d617cc9 | ||
|
|
0683ef74d1 | ||
|
|
4f89d5bcfa | ||
|
|
9bfdace83a | ||
|
|
fad3ef71a4 | ||
|
|
c21a3a4ec6 | ||
|
|
05bcdf4d41 | ||
|
|
cda4ac2e91 | ||
|
|
8de255ea61 | ||
|
|
4b579f1836 | ||
|
|
8edc08d48e | ||
|
|
3b99cd3ae3 | ||
|
|
0ccaadc62c | ||
|
|
aebff608dc | ||
|
|
0e1e2d8069 | ||
|
|
7cced49416 | ||
|
|
70fe5e3261 | ||
|
|
b808409fe7 | ||
|
|
17a29b6eea | ||
|
|
8d447abdbf | ||
|
|
1423156a9c | ||
|
|
40f3df0acd | ||
|
|
4e253268e1 | ||
|
|
21229f21b4 | ||
|
|
995c18ba28 | ||
|
|
c6411b91f5 | ||
|
|
346a1b2351 | ||
|
|
32340b45e7 | ||
|
|
7a5462a0b7 | ||
|
|
ca83b5d174 | ||
|
|
7a1813fe39 | ||
|
|
e877a26079 | ||
|
|
a175b4affb | ||
|
|
159929688d | ||
|
|
5b4430b4d2 | ||
|
|
67e2c217d6 | ||
|
|
c2f3b72b93 | ||
|
|
2654c2012b | ||
|
|
21b82f43b9 | ||
|
|
1fd77b2ddf | ||
|
|
2ef20008e8 | ||
|
|
c0119ac534 | ||
|
|
1cd8c36e4d | ||
|
|
2e9d555f8c | ||
|
|
f6b8bdc529 | ||
|
|
0c9fb4050b | ||
|
|
2ba9e70e52 | ||
|
|
51244615e9 | ||
|
|
c0c7ee9ab1 | ||
|
|
4c8adc4821 | ||
|
|
9f7d860db2 | ||
|
|
4cc84a6164 | ||
|
|
b902a4439e | ||
|
|
aa3d6d01e8 | ||
|
|
154bd660bb | ||
|
|
adeff820d3 | ||
|
|
3bdb536a55 | ||
|
|
5868a8d57c | ||
|
|
550968ec92 | ||
|
|
9f167c85b0 | ||
|
|
544baf5482 | ||
|
|
6a76abbf9c | ||
|
|
131aa77dd9 | ||
|
|
3e9cafcf42 | ||
|
|
ee2f172106 | ||
|
|
f9fea3cd18 | ||
|
|
ed41665d78 | ||
|
|
d8843f4b6e | ||
|
|
f45f10b17d | ||
|
|
ff18f4c072 | ||
|
|
4157d2bf7f | ||
|
|
977995573d | ||
|
|
3593b80a51 | ||
|
|
d3a7a3d262 | ||
|
|
d3d49453a4 | ||
|
|
ec7c19de56 | ||
|
|
a41f5ad96e | ||
|
|
eb57e662fc | ||
|
|
c0723b4189 | ||
|
|
e8670c071b | ||
|
|
09b0c4ab6e | ||
|
|
deef174caa | ||
|
|
35adb7c5be | ||
|
|
f827615b89 | ||
|
|
09d7d195be | ||
|
|
4b8534f940 | ||
|
|
7354f66153 | ||
|
|
9c9b761562 | ||
|
|
d72ab4ffe7 | ||
|
|
d734172c73 | ||
|
|
5a31cea3d4 | ||
|
|
0eb406c7e6 | ||
|
|
94d327a68a | ||
|
|
33a89ddba5 | ||
|
|
83577ddb4d | ||
|
|
c9b696a6bd | ||
|
|
b2e7f0596a | ||
|
|
3994e55f58 | ||
|
|
7079da8b5a | ||
|
|
d9a92fd81c | ||
|
|
f1ce35a10c | ||
|
|
c543c4b10c | ||
|
|
ff6263f4f9 | ||
|
|
f17c045d21 | ||
|
|
b055972c6b | ||
|
|
bc60940ea9 | ||
|
|
11020daf89 | ||
|
|
e9bbe5be67 | ||
|
|
fe1ad4509c | ||
|
|
ea89a760d8 | ||
|
|
ec90359f34 | ||
|
|
c8131583ac | ||
|
|
10c7a38d84 | ||
|
|
7413391dae | ||
|
|
eed9880cdd | ||
|
|
dccf44af32 | ||
|
|
3c28751b48 | ||
|
|
31d95cf0ca | ||
|
|
8a693e3070 | ||
|
|
5cfcf6dc93 | ||
|
|
0a0800fe25 | ||
|
|
e13a0b7f49 | ||
|
|
d67dbfcf80 | ||
|
|
552cc77dcf | ||
|
|
08b0b0fe95 | ||
|
|
7d3aa65903 | ||
|
|
649d081fee | ||
|
|
4bac19f0bf | ||
|
|
c09c590616 | ||
|
|
451fa3013e | ||
|
|
1ba691350b | ||
|
|
4e2b49d717 | ||
|
|
c312500094 | ||
|
|
b659452519 | ||
|
|
67c493ed67 | ||
|
|
bfb7a14ab7 | ||
|
|
cbee99cebe | ||
|
|
3d74506f21 | ||
|
|
d26f6b1796 | ||
|
|
553cabb1d1 | ||
|
|
fed388a533 | ||
|
|
fd16a39c69 | ||
|
|
43545372ed | ||
|
|
00aa944946 | ||
|
|
f0ea13bbe9 | ||
|
|
2ab8e21d5d | ||
|
|
fe106be46b | ||
|
|
73b9e4b762 | ||
|
|
920c0db5c0 | ||
|
|
e1b35181ba | ||
|
|
b4baf84d32 | ||
|
|
1401f3e3f9 | ||
|
|
ec13d92b20 | ||
|
|
00dceaff2e | ||
|
|
556b9f622f | ||
|
|
b58bc13bee | ||
|
|
4e0d869f9a | ||
|
|
83e202ca50 | ||
|
|
d7e6b36faa | ||
|
|
b8b4c48285 | ||
|
|
6c0ec66614 | ||
|
|
af52175661 | ||
|
|
de8c62d0f0 | ||
|
|
52b4bf84e7 | ||
|
|
fe4becacb4 | ||
|
|
e1a2cd7e46 | ||
|
|
94172d0764 | ||
|
|
6d3aa2169e | ||
|
|
4fb9a0a740 | ||
|
|
326b01a327 | ||
|
|
da13561d3d | ||
|
|
8a5d6318e7 | ||
|
|
109d16cbce | ||
|
|
cb6cf9485c | ||
|
|
257b028a06 | ||
|
|
86ba2b2bdf | ||
|
|
e50688802c | ||
|
|
1763c83a50 | ||
|
|
e1640b71fa | ||
|
|
b946e9ee2e | ||
|
|
a8778c2665 | ||
|
|
32bd426778 | ||
|
|
a272d8b0c6 | ||
|
|
15ddd652be | ||
|
|
2c4f4e60d8 | ||
|
|
2399435ba4 | ||
|
|
2ac5b86618 | ||
|
|
aa60b32c1c | ||
|
|
be7d4a230e | ||
|
|
a1d3a7aee6 | ||
|
|
f1f85daaed | ||
|
|
88494fb8f3 | ||
|
|
2e3cc9b7b9 | ||
|
|
7b5a41383b | ||
|
|
6cab708162 | ||
|
|
340d9cec31 | ||
|
|
eebb80a187 | ||
|
|
fc0bbac463 | ||
|
|
754e4abb56 | ||
|
|
7314448bef | ||
|
|
dd46047168 | ||
|
|
35b631eb04 | ||
|
|
545ac40616 | ||
|
|
d2205a42a1 | ||
|
|
e577b09b46 | ||
|
|
53cd09b3bc | ||
|
|
792d894bd9 | ||
|
|
363b712c93 | ||
|
|
763968d428 | ||
|
|
f980ff966d | ||
|
|
926b8285be | ||
|
|
59c6679733 | ||
|
|
414e5b1d06 | ||
|
|
c1920a67e2 | ||
|
|
5c92a5735d | ||
|
|
4eb8e70031 | ||
|
|
a32610143c | ||
|
|
844a6c1a11 | ||
|
|
9e01db73f9 | ||
|
|
8dedd7864d | ||
|
|
11023e1493 | ||
|
|
1cf80189ac | ||
|
|
1525e2cb30 | ||
|
|
6b1785ed05 | ||
|
|
d62acd19e9 | ||
|
|
7a3fb2d7ad | ||
|
|
3a3b00cc54 | ||
|
|
0d3ba947f3 | ||
|
|
2bdde50d3f | ||
|
|
a3ad002027 | ||
|
|
33fec67464 | ||
|
|
cb9d9f0f71 | ||
|
|
e3360a98c2 | ||
|
|
f277d830bb | ||
|
|
cf1d805fec | ||
|
|
b98b0e107f | ||
|
|
a0f30b3f2c | ||
|
|
8b21a5c229 | ||
|
|
2d981879d6 | ||
|
|
6874eb8797 | ||
|
|
323e95c8b3 | ||
|
|
af6e86c537 | ||
|
|
1f53ad0803 | ||
|
|
31c8ce9ef8 | ||
|
|
a99f319d12 | ||
|
|
758d3a260d | ||
|
|
556cdce5c8 | ||
|
|
3118577120 | ||
|
|
bd3061bed9 | ||
|
|
92434b0b67 | ||
|
|
2812688dfc | ||
|
|
23441bf2ab | ||
|
|
d90d17e378 | ||
|
|
f770080426 | ||
|
|
07474b189d | ||
|
|
4fe59aa3b9 | ||
|
|
085c609f77 | ||
|
|
36f920112b | ||
|
|
256a906698 | ||
|
|
7c68f857d0 | ||
|
|
e628e7bb9e | ||
|
|
33955663ad | ||
|
|
e614cf3cbb | ||
|
|
f1e3280296 | ||
|
|
85274fb910 | ||
|
|
b26bc02086 | ||
|
|
85842e28eb | ||
|
|
baaac7ac25 | ||
|
|
7960ad7d8b | ||
|
|
abbc6f5242 | ||
|
|
9bc0437bab | ||
|
|
196ad04add | ||
|
|
de330273f1 | ||
|
|
2c2e515911 | ||
|
|
23ae451acb | ||
|
|
88049ac444 | ||
|
|
8bf5a6ed18 | ||
|
|
8bcd22c510 | ||
|
|
eaf35aca32 | ||
|
|
91bfcc7c16 | ||
|
|
945f1c9781 | ||
|
|
239d98e18d | ||
|
|
3e13a5f6dc | ||
|
|
bd25077b16 | ||
|
|
f2b1a05bff | ||
|
|
cbd7649260 | ||
|
|
77e63b2236 | ||
|
|
dde7c39a92 | ||
|
|
d7fbc5eaba | ||
|
|
31b899e2e1 | ||
|
|
01b914a12e | ||
|
|
695581bf65 | ||
|
|
4923c48619 | ||
|
|
c6f59f7abe | ||
|
|
e4aba2047a | ||
|
|
fd69d39c66 | ||
|
|
026dac4594 | ||
|
|
86af3d8f1b | ||
|
|
1731098e4d | ||
|
|
380435c33b | ||
|
|
9935449e9d | ||
|
|
4caa3d07cf | ||
|
|
589f6b1c17 | ||
|
|
a751e87562 | ||
|
|
75a474834b | ||
|
|
525ecdfbe1 | ||
|
|
7b3845a4a5 | ||
|
|
200b442ee4 | ||
|
|
ad82404564 | ||
|
|
d5dc4b055f | ||
|
|
c6756ec787 | ||
|
|
f1adf86d09 | ||
|
|
63e9766256 | ||
|
|
35b0248480 | ||
|
|
5629153f1e | ||
|
|
2b16e3652c | ||
|
|
ac736f7cdc | ||
|
|
370edcd71f | ||
|
|
a63a148116 | ||
|
|
cd7ed8b383 | ||
|
|
1fc09c536b | ||
|
|
07cd9a8d15 | ||
|
|
4f90578a4f | ||
|
|
5bed1ce3db | ||
|
|
82a7098474 | ||
|
|
2c921595f2 | ||
|
|
8067b6fb73 | ||
|
|
9a30fc037e | ||
|
|
39f2fdda08 | ||
|
|
3ffdef958d | ||
|
|
0f5e2eba7c | ||
|
|
704a7eba4a | ||
|
|
2db44d14e4 | ||
|
|
5fbc4e2384 | ||
|
|
d7daf7444e | ||
|
|
797585985f | ||
|
|
9883bf7280 | ||
|
|
7061c33d7b | ||
|
|
0311e952db | ||
|
|
f4c0b38042 | ||
|
|
22110bde07 | ||
|
|
a8e2420def | ||
|
|
4ebaf0fd9c | ||
|
|
80d70870f5 | ||
|
|
3ea7d72957 | ||
|
|
22ba8f3323 | ||
|
|
700f99c873 | ||
|
|
76b0654112 | ||
|
|
bef401e8dc | ||
|
|
8c26c6bbba | ||
|
|
c75156c7c8 | ||
|
|
4bce07bc25 | ||
|
|
39fd5971dd | ||
|
|
a1b9bc9a42 | ||
|
|
2d0c47b8aa | ||
|
|
56deeee42b | ||
|
|
693e5c427a | ||
|
|
c7ebcc8326 | ||
|
|
01e9d7611a | ||
|
|
5f5fe4ae6d | ||
|
|
ce4dbc8513 | ||
|
|
f5da03589e | ||
|
|
d7c526e66d | ||
|
|
cfe240bbd8 | ||
|
|
3bc2827212 | ||
|
|
6d920eca0c | ||
|
|
cd908e158d | ||
|
|
b869639f46 | ||
|
|
d1df8c198d | ||
|
|
df1e389479 | ||
|
|
193e68abd4 | ||
|
|
0f8257073a | ||
|
|
e9220f5117 | ||
|
|
c24cb37374 | ||
|
|
4a18680233 | ||
|
|
723d3d528d | ||
|
|
712ac6d5a0 | ||
|
|
47ff7adaa2 | ||
|
|
ce559ec2e5 | ||
|
|
53c1f3e4c6 | ||
|
|
64b0b993f6 | ||
|
|
214c19a8b3 | ||
|
|
1958250cc6 | ||
|
|
fa7a1e19e2 | ||
|
|
6e1a4cca68 | ||
|
|
c2b140693b | ||
|
|
6a06c02f21 | ||
|
|
20905f2c93 | ||
|
|
7691d2fba0 | ||
|
|
ff6b97e13e | ||
|
|
44c053f008 | ||
|
|
9cfcec5b05 | ||
|
|
d463bda066 | ||
|
|
87fa23e641 | ||
|
|
f12b53b2ce | ||
|
|
87372cd3ae | ||
|
|
4ab2d8f53a | ||
|
|
ae89477b9b | ||
|
|
95f7eb6267 | ||
|
|
d9d6720b77 | ||
|
|
f2080b7714 | ||
|
|
19cd821ddb | ||
|
|
061697058c | ||
|
|
712109716a | ||
|
|
3b5543d431 | ||
|
|
5bf316d15e | ||
|
|
3134fad324 | ||
|
|
ae0074289c | ||
|
|
219bbb0758 | ||
|
|
27049d3bfc | ||
|
|
429043125e | ||
|
|
410da16d02 | ||
|
|
08701d38a4 | ||
|
|
75dd041027 | ||
|
|
adcd9b9c14 | ||
|
|
2a33928da6 | ||
|
|
eb3d538fdd | ||
|
|
e500c52f49 | ||
|
|
6587c39b3a | ||
|
|
d1c5cbfcdd | ||
|
|
5ca6750d57 | ||
|
|
9a96f7c461 | ||
|
|
f7999d7584 | ||
|
|
236ab993af | ||
|
|
93dcd18946 | ||
|
|
a4bfda47ac | ||
|
|
d7fcb354de | ||
|
|
cd3f5c47d5 | ||
|
|
2ff4fc1672 | ||
|
|
19272693f5 | ||
|
|
8993498904 | ||
|
|
cff8d231ff | ||
|
|
adcff142d8 | ||
|
|
29c0442cad | ||
|
|
0c6e5c710b | ||
|
|
67c4edfeb2 | ||
|
|
5e292210c9 | ||
|
|
ffcc3ee57c | ||
|
|
9b8fe62dc8 | ||
|
|
e5a97dc971 | ||
|
|
b93c15a217 | ||
|
|
5c0034bed5 | ||
|
|
7f7cd1d678 | ||
|
|
fb81d346de | ||
|
|
d059fe157a | ||
|
|
cb06e8f515 | ||
|
|
4cc0ccbeba | ||
|
|
43a62704e9 | ||
|
|
5b21dc1ece | ||
|
|
7ff4e5a700 | ||
|
|
0df7488562 | ||
|
|
7db02117a9 | ||
|
|
dc903be45e | ||
|
|
223b1d7604 | ||
|
|
9cf66fe2b1 | ||
|
|
febc4c49c1 | ||
|
|
0ab48a40d7 | ||
|
|
0f1b91f942 | ||
|
|
cf4b6ee8fe | ||
|
|
a92a94f719 | ||
|
|
dc932e0a18 | ||
|
|
2469b27db0 | ||
|
|
5a09fe4494 | ||
|
|
7597dbd0da | ||
|
|
6b9e1727c8 | ||
|
|
32821bb3f4 | ||
|
|
4d78dd47ab | ||
|
|
ee871dbed8 | ||
|
|
0a6061f1f9 | ||
|
|
326ea43a59 | ||
|
|
5c9a84b610 | ||
|
|
def996ca60 | ||
|
|
0f4b670f25 | ||
|
|
d24f7571cc | ||
|
|
0f8d90bd48 | ||
|
|
b681a22c29 | ||
|
|
e2780ba79b | ||
|
|
a3dc0b45fc | ||
|
|
6cc9334011 | ||
|
|
a7c3b38bb6 | ||
|
|
f1f04bac77 | ||
|
|
c3798f9e61 | ||
|
|
6a08b3a1e5 | ||
|
|
56b1029ccf | ||
|
|
86a2a3f5f6 | ||
|
|
80f8bd8e8c | ||
|
|
eb652720df | ||
|
|
7b90e466f9 | ||
|
|
16e01be2da | ||
|
|
4e66f13a79 | ||
|
|
d446f94a60 | ||
|
|
7735ccac5e | ||
|
|
a34d7ff0ac | ||
|
|
c1c67d3295 | ||
|
|
fbc2f821ff | ||
|
|
d4f175199f | ||
|
|
c7fdeca168 | ||
|
|
c9b0bde5e6 | ||
|
|
1a34a11854 | ||
|
|
0fb79b9ee4 | ||
|
|
89ed6c2fec | ||
|
|
82bdb546d9 | ||
|
|
38456f092f | ||
|
|
4f0f13ad00 | ||
|
|
45849c5602 | ||
|
|
b1770970a8 | ||
|
|
a299f3cc81 | ||
|
|
90a2952982 | ||
|
|
3855a21213 | ||
|
|
8a010c44a5 | ||
|
|
978afa51c0 | ||
|
|
d71cb4d9c7 | ||
|
|
d766e142ea | ||
|
|
63354f0c3f | ||
|
|
efd83f0b57 | ||
|
|
bc18a8e7f7 | ||
|
|
f7c04842b9 | ||
|
|
8ae407c539 |
226
ABOUT-NLS
Normal file
226
ABOUT-NLS
Normal file
@@ -0,0 +1,226 @@
|
||||
Notes on the GNU Translation Project
|
||||
************************************
|
||||
|
||||
GNU is going international! The GNU Translation Project is a way to
|
||||
get maintainers, translators, and users all together, so that GNU will
|
||||
gradually become able to speak many languages. A few packages already
|
||||
provide translations for their messages.
|
||||
|
||||
If you found this `ABOUT-NLS' file inside a GNU distribution, you
|
||||
may assume that the distributed package does use GNU `gettext'
|
||||
internally, itself available at your nearest GNU archive site. But you
|
||||
do *not* need to install GNU `gettext' prior to configuring, installing
|
||||
or using this package with messages translated.
|
||||
|
||||
Installers will find here some useful hints. These notes also
|
||||
explain how users should proceed for getting the programs to use the
|
||||
available translations. They tell how people wanting to contribute and
|
||||
work at translations should contact the appropriate team.
|
||||
|
||||
When reporting bugs in the `intl/' directory or bugs which may be
|
||||
related to internationalization, you should tell about the version of
|
||||
`gettext' which is used. The information can be found in the
|
||||
`intl/VERSION' file, in internationalized packages.
|
||||
|
||||
One advise in advance
|
||||
=====================
|
||||
|
||||
If you want to exploit the full power of internationalization, you
|
||||
should configure it using
|
||||
|
||||
./configure --with-included-gettext
|
||||
|
||||
to force usage of internationalizing routines provided within this
|
||||
package, despite the existence of internationalizing capabilities in
|
||||
the operating system where this package is being installed. So far, no
|
||||
prior implementation provides as many useful features (such as locale
|
||||
alias or message inheritance). It is also not possible to offer this
|
||||
additional functionality on top of a `catgets' implementation. Future
|
||||
versions of GNU `gettext' will very likely convey even more
|
||||
functionality. So it might be a good idea to change to GNU `gettext'
|
||||
as soon as possible.
|
||||
|
||||
INSTALL Matters
|
||||
===============
|
||||
|
||||
Some GNU packages are "localizable" when properly installed; the
|
||||
programs they contain can be made to speak your own native language.
|
||||
Most such packages use GNU `gettext'. Other packages have their own
|
||||
ways to internationalization, predating GNU `gettext'.
|
||||
|
||||
By default, this package will be installed to allow translation of
|
||||
messages. It will automatically detect whether the system provides
|
||||
usable `catgets' (if using this is selected by the installer) or
|
||||
`gettext' functions. If neither is available, the GNU `gettext' own
|
||||
library will be used. This library is wholly contained within this
|
||||
package, usually in the `intl/' subdirectory, so prior installation of
|
||||
the GNU `gettext' package is *not* required. Installers may use
|
||||
special options at configuration time for changing the default
|
||||
behaviour. The commands:
|
||||
|
||||
./configure --with-included-gettext
|
||||
./configure --with-catgets
|
||||
./configure --disable-nls
|
||||
|
||||
will respectively bypass any pre-existing `catgets' or `gettext' to use
|
||||
the internationalizing routines provided within this package, enable
|
||||
the use of the `catgets' functions (if found on the locale system), or
|
||||
else, *totally* disable translation of messages.
|
||||
|
||||
When you already have GNU `gettext' installed on your system and run
|
||||
configure without an option for your new package, `configure' will
|
||||
probably detect the previously built and installed `libintl.a' file and
|
||||
will decide to use this. This might be not what is desirable. You
|
||||
should use the more recent version of the GNU `gettext' library. I.e.
|
||||
if the file `intl/VERSION' shows that the library which comes with this
|
||||
package is more recent, you should use
|
||||
|
||||
./configure --with-included-gettext
|
||||
|
||||
to prevent auto-detection.
|
||||
|
||||
By default the configuration process will not test for the `catgets'
|
||||
function and therefore they will not be used. The reasons are already
|
||||
given above: the emulation on top of `catgets' cannot provide all the
|
||||
extensions provided by the GNU `gettext' library. If you nevertheless
|
||||
want to use the `catgets' functions use
|
||||
|
||||
./configure --with-catgets
|
||||
|
||||
to enable the test for `catgets' (this causes no harm if `catgets' is
|
||||
not available on your system). If you really select this option we
|
||||
would like to hear about the reasons because we cannot think of any
|
||||
good one ourself.
|
||||
|
||||
Internationalized packages have usually many `po/LL.po' files, where
|
||||
LL gives an ISO 639 two-letter code identifying the language. Unless
|
||||
translations have been forbidden at `configure' time by using the
|
||||
`--disable-nls' switch, all available translations are installed
|
||||
together with the package. However, the environment variable `LINGUAS'
|
||||
may be set, prior to configuration, to limit the installed set.
|
||||
`LINGUAS' should then contain a space separated list of two-letter
|
||||
codes, stating which languages are allowed.
|
||||
|
||||
Using This Package
|
||||
==================
|
||||
|
||||
As a user, if your language has been installed for this package, you
|
||||
only have to set the `LANG' environment variable to the appropriate
|
||||
ISO 639 `LL' two-letter code prior to using the programs in the
|
||||
package. For example, let's suppose that you speak German. At the
|
||||
shell prompt, merely execute `setenv LANG de' (in `csh'),
|
||||
`export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This
|
||||
can be done from your `.login' or `.profile' file, once and for all.
|
||||
|
||||
An operating system might already offer message localization for
|
||||
many of its programs, while other programs (whether GNU or not) have
|
||||
been installed locally with the full capabilities of GNU `gettext'.
|
||||
Just using `gettext' extended syntax for `LANG' would break proper
|
||||
localization of already available operating system programs. In this
|
||||
case, users should set both `LANGUAGE' and `LANG' variables in their
|
||||
environment, as programs using GNU `gettext' give preference to
|
||||
`LANGUAGE'. For example, some Swedish users would rather read
|
||||
translations in German than English for when Swedish is not available.
|
||||
This is easily accomplished by setting `LANGUAGE' to `sv:de' while
|
||||
leaving `LANG' to `sv'.
|
||||
|
||||
Translating Teams
|
||||
=================
|
||||
|
||||
For the GNU Translation Project to be a success, we need interested
|
||||
people who like their own language and write it well, and who are also
|
||||
able to synergize with other translators speaking the same language.
|
||||
Each translation team has its own mailing list, courtesy of Linux
|
||||
International. You may reach your translation team at the address
|
||||
`LL@li.org', replacing LL by the two-letter ISO 639 code for your
|
||||
language. Language codes are *not* the same as the country codes given
|
||||
in ISO 3166. The following translation teams exist, as of December
|
||||
1996:
|
||||
|
||||
Arabic `ar', Chinese `zh', Czech `cs', Danish `da', Dutch `nl',
|
||||
English `en', Esperanto `eo', Finnish `fi', French `fr', German
|
||||
`de', Greek `el', Hebrew `he', Hungarian `hu', Irish `ga', Italian
|
||||
`it', Indonesian `id', Japanese `ja', Korean `ko', Latin `la',
|
||||
Norwegian `no', Persian `fa', Polish `pl', Portuguese `pt',
|
||||
Russian `ru', Slovenian `sl', Spanish `es', Swedish `sv', Telugu
|
||||
`te', Turkish `tr' and Ukrainian `uk'.
|
||||
|
||||
For example, you may reach the Chinese translation team by writing to
|
||||
`zh@li.org'.
|
||||
|
||||
If you'd like to volunteer to *work* at translating messages, you
|
||||
should become a member of the translating team for your own language.
|
||||
The subscribing address is *not* the same as the list itself, it has
|
||||
`-request' appended. For example, speakers of Swedish can send a
|
||||
message to `sv-request@li.org', having this message body:
|
||||
|
||||
subscribe
|
||||
|
||||
Keep in mind that team members are expected to participate
|
||||
*actively* in translations, or at solving translational difficulties,
|
||||
rather than merely lurking around. If your team does not exist yet and
|
||||
you want to start one, or if you are unsure about what to do or how to
|
||||
get started, please write to `gnu-translation@gnu.ai.mit.edu' to reach
|
||||
the GNU coordinator for all translator teams.
|
||||
|
||||
The English team is special. It works at improving and uniformizing
|
||||
the terminology used in GNU. Proven linguistic skill are praised more
|
||||
than programming skill, here. For the time being, please avoid
|
||||
subscribing to the English team unless explicitly invited to do so.
|
||||
|
||||
Available Packages
|
||||
==================
|
||||
|
||||
Languages are not equally supported in all GNU packages. The
|
||||
following matrix shows the current state of GNU internationalization,
|
||||
as of December 1996. The matrix shows, in regard of each package, for
|
||||
which languages PO files have been submitted to translation
|
||||
coordination.
|
||||
|
||||
Ready PO files cs de en es fi fr ja ko nl no pl pt sl sv
|
||||
.-------------------------------------------.
|
||||
bash | [] [] [] | 3
|
||||
bison | [] [] [] | 3
|
||||
clisp | [] [] [] | 3
|
||||
cpio | [] [] [] [] | 4
|
||||
diffutils | [] [] [] [] | 4
|
||||
enscript | [] [] [] [] [] | 5
|
||||
fileutils | [] [] [] [] [] [] [] [] | 8
|
||||
findutils | [] [] [] [] [] [] | 6
|
||||
flex | [] [] | 2
|
||||
gcal | [] [] [] | 3
|
||||
gettext | [] [] [] [] [] [] [] [] [] [] | 11
|
||||
grep | [] [] [] [] [] [] [] [] | 8
|
||||
hello | [] [] [] [] [] [] [] [] [] [] | 10
|
||||
id-utils | [] [] | 2
|
||||
indent | | 0
|
||||
libc | [] [] [] [] [] [] | 6
|
||||
m4 | [] [] [] [] [] | 5
|
||||
make | [] [] [] [] [] | 5
|
||||
music | [] | 1
|
||||
ptx | [] [] [] [] [] [] [] [] | 8
|
||||
recode | [] [] [] [] [] [] [] | 7
|
||||
sh-utils | [] [] [] [] [] | 5
|
||||
sharutils | [] [] [] [] | 4
|
||||
tar | [] [] [] [] [] [] [] [] [] | 9
|
||||
texinfo | | 0
|
||||
textutils | [] [] [] [] [] [] | 6
|
||||
wdiff | [] [] [] [] [] [] [] [] | 8
|
||||
`-------------------------------------------'
|
||||
14 languages cs de en es fi fr ja ko nl no pl pt sl sv
|
||||
27 packages 1 21 1 11 1 24 1 8 20 7 14 6 7 14 136
|
||||
|
||||
Some counters in the preceding matrix are higher than the number of
|
||||
visible blocks let us expect. This is because a few extra PO files are
|
||||
used for implementing regional variants of languages, or language
|
||||
dialects.
|
||||
|
||||
For a PO file in the matrix above to be effective, the package to
|
||||
which it applies should also have been internationalized and
|
||||
distributed as such by its maintainer. There might be an observable
|
||||
lag between the mere existence a PO file and its wide availability in a
|
||||
GNU distribution.
|
||||
|
||||
If December 1996 seems to be old, you may fetch a more recent copy
|
||||
of this `ABOUT-NLS' file on most GNU archive sites.
|
||||
|
||||
6
COPYING
6
COPYING
@@ -2,7 +2,7 @@
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -304,8 +304,8 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
|
||||
250
INSTALL
250
INSTALL
@@ -1,111 +1,181 @@
|
||||
This is a generic INSTALL file for utilities distributions.
|
||||
If this package does not come with, e.g., installable documentation or
|
||||
data files, please ignore the references to them below.
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
To compile this package:
|
||||
These are generic installation instructions.
|
||||
|
||||
1. Configure the package for your system. In the directory that this
|
||||
file is in, type `./configure'. If you're using `csh' on an old
|
||||
version of System V, you might need to type `sh configure' instead to
|
||||
prevent `csh' from trying to execute `configure' itself.
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation, and
|
||||
creates the Makefile(s) (one in each subdirectory of the source
|
||||
directory). In some packages it creates a C header file containing
|
||||
system-dependent definitions. It also creates a file `config.status'
|
||||
that you can run in the future to recreate the current configuration.
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
Running `configure' takes a minute or two. While it is running, it
|
||||
prints some messages that tell what it is doing. If you don't want to
|
||||
see the messages, run `configure' with its standard output redirected
|
||||
to `/dev/null'; for example, `./configure >/dev/null'.
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
To compile the package in a different directory from the one
|
||||
containing the source code, you must use a version of make that
|
||||
supports the VPATH variable, such as GNU make. `cd' to the directory
|
||||
where you want the object files and executables to go and run
|
||||
`configure'. `configure' automatically checks for the source code in
|
||||
the directory that `configure' is in and in `..'. If for some reason
|
||||
`configure' is not in the source code directory that you are
|
||||
configuring, then it will report that it can't find the source code.
|
||||
In that case, run `configure' with the option `--srcdir=DIR', where
|
||||
DIR is the directory that contains the source code.
|
||||
The simplest way to compile this package is:
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
/usr/local/bin, /usr/local/lib, /usr/local/man, etc. You can specify
|
||||
an installation prefix other than /usr/local by giving `configure' the
|
||||
option `--prefix=PATH'. Alternately, you can do so by giving a value
|
||||
for the `prefix' variable when you run `make', e.g.,
|
||||
make prefix=/usr/gnu
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If
|
||||
you give `configure' the option `--exec_prefix=PATH' or set the
|
||||
`make' variable `exec_prefix' to PATH, the package will use PATH as
|
||||
the prefix for installing programs and libraries. Data files and
|
||||
documentation will still use the regular prefix. Normally, all files
|
||||
are installed using the regular prefix.
|
||||
Running `configure' takes a while. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
You can tell `configure' to figure out the configuration for your
|
||||
system, and record it in `config.status', without actually configuring
|
||||
the package (creating `Makefile's and perhaps a configuration header
|
||||
file). To do this, give `configure' the `--no-create' option. Later,
|
||||
you can run `./config.status' to actually configure the package. This
|
||||
option is useful mainly in `Makefile' rules for updating `config.status'
|
||||
and `Makefile'. You can also give `config.status' the `--recheck'
|
||||
option, which makes it re-run `configure' with the same arguments you
|
||||
used before. This is useful if you change `configure'.
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
`configure' ignores any other arguments that you give it.
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
If your system requires unusual options for compilation or linking
|
||||
that `configure' doesn't know about, you can give `configure' initial
|
||||
values for some variables by setting them in the environment. In
|
||||
Bourne-compatible shells, you can do that on the command line like
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC='gcc -traditional' DEFS=-D_POSIX_SOURCE ./configure
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
The `make' variables that you might want to override with environment
|
||||
variables when running `configure' are:
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
(For these variables, any value given in the environment overrides the
|
||||
value that `configure' would choose:)
|
||||
CC C compiler program.
|
||||
Default is `cc', or `gcc' if `gcc' is in your PATH.
|
||||
INSTALL Program to use to install files.
|
||||
Default is `install' if you have it, `cp' otherwise.
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
(For these variables, any value given in the environment is added to
|
||||
the value that `configure' chooses:)
|
||||
DEFS Configuration options, in the form `-Dfoo -Dbar ...'
|
||||
LIBS Libraries to link with, in the form `-lfoo -lbar ...'
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you need to do unusual things to compile the package, we encourage
|
||||
you to figure out how `configure' could check whether to do them, and
|
||||
mail diffs or instructions to the address given in the README so we
|
||||
can include them in the next release.
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
2. Type `make' to compile the package. If you want, you can override
|
||||
the `make' variables CFLAGS and LDFLAGS like this:
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
make CFLAGS=-O2 LDFLAGS=-s
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
3. If the package comes with self-tests and you want to run them,
|
||||
type `make check'. If you're not sure whether there are any, try it;
|
||||
if `make' responds with something like
|
||||
make: *** No way to make target `check'. Stop.
|
||||
then the package does not come with self-tests.
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
4. Type `make install' to install programs, data files, and
|
||||
documentation.
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source directory by typing `make clean'. To also remove the
|
||||
Makefile(s), the header file containing system-dependent definitions
|
||||
(if the package uses one), and `config.status' (all the files that
|
||||
`configure' created), type `make distclean'.
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made.
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
||||
The file `configure.in' is used as a template to create `configure' by
|
||||
a program called `autoconf'. You will only need it if you want to
|
||||
regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
17
THANKS
Normal file
17
THANKS
Normal file
@@ -0,0 +1,17 @@
|
||||
This is just a start at listing e-mail addresses of contributors.
|
||||
The rest of the addresses are still in the ChangeLog.
|
||||
|
||||
Bauke Jan Douma: bjdouma@xs4all.nl
|
||||
Charles Karney: karney@pppl.gov
|
||||
Emile LeBlanc: leblanc@math.toronto.edu
|
||||
James Antill: jmanti%essex.ac.uk@seralph21.essex.ac.uk
|
||||
Jesse Thilo: jgt2@eecs.lehigh.edu
|
||||
Joakim Rosqvist: dvljrt@cs.umu.se
|
||||
Marcus Daniels: marcus@sysc.pdx.edu
|
||||
Mark A. Thomas: thommark@access.digex.net
|
||||
Miles Bader: miles@gnu.ai.mit.edu
|
||||
Peter Eriksson: peter@ifm.liu.se
|
||||
Santiago Vila Doncel: sanvila@ctv.es
|
||||
Thomas Bushnell, n/BSG: thomas@gnu.ai.mit.edu
|
||||
Tony Leneis: tony@plaza.ds.adp.com
|
||||
Wayne Stewart: wstewa@atl.com
|
||||
20
doc/.cvsignore
Normal file
20
doc/.cvsignore
Normal file
@@ -0,0 +1,20 @@
|
||||
Makefile
|
||||
fileutils.info
|
||||
version.texi
|
||||
fileutils.info*
|
||||
fileutils.log
|
||||
fileutils.dvi
|
||||
fileutils.aux
|
||||
fileutils.toc
|
||||
fileutils.cp
|
||||
fileutils.fn
|
||||
fileutils.vr
|
||||
fileutils.tp
|
||||
fileutils.ky
|
||||
fileutils.pg
|
||||
fileutils.cm
|
||||
fileutils.fl
|
||||
fileutils.op
|
||||
fileutils.cps
|
||||
stamp-vti
|
||||
version.texi
|
||||
12
doc/Makefile.am
Normal file
12
doc/Makefile.am
Normal file
@@ -0,0 +1,12 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
info_TEXINFOS = fileutils.texi
|
||||
|
||||
# FIXME: remove texinfo.tex when automake has been fixed to include it
|
||||
# automatically
|
||||
EXTRA_DIST = perm.texi getdate.texi texinfo.tex
|
||||
|
||||
# Tell makeinfo to put everything in a single info file: sh-utils.info.
|
||||
# Otherwise, it would also generate files with names like sh-utils.info-[123],
|
||||
# and those names all map to one 14-byte name (sh-utils.info-) on some crufty
|
||||
# old systems.
|
||||
MAKEINFO = makeinfo --no-split
|
||||
260
doc/Makefile.in
Normal file
260
doc/Makefile.in
Normal file
@@ -0,0 +1,260 @@
|
||||
# Makefile.in generated automatically by automake 1.1l from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
YACC = @YACC@
|
||||
GENCAT = @GENCAT@
|
||||
PERL = @PERL@
|
||||
MV = @MV@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
CC = @CC@
|
||||
RANLIB = @RANLIB@
|
||||
LN = @LN@
|
||||
RM = @RM@
|
||||
|
||||
info_TEXINFOS = fileutils.texi
|
||||
|
||||
# FIXME: remove texinfo.tex when automake has been fixed to include it
|
||||
# automatically
|
||||
EXTRA_DIST = perm.texi getdate.texi texinfo.tex
|
||||
|
||||
# Tell makeinfo to put everything in a single info file: sh-utils.info.
|
||||
# Otherwise, it would also generate files with names like sh-utils.info-[123],
|
||||
# and those names all map to one 14-byte name (sh-utils.info-) on some crufty
|
||||
# old systems.
|
||||
MAKEINFO = makeinfo --no-split
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
TEXI2DVI = texi2dvi
|
||||
INFO_DEPS = fileutils.info
|
||||
DVIS = fileutils.dvi
|
||||
TEXINFOS = fileutils.texi
|
||||
DIST_COMMON = Makefile.am Makefile.in mdate-sh stamp-vti texinfo.tex \
|
||||
version.texi
|
||||
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \
|
||||
$(TEXINFOS) $(MANS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .texi .texinfo .info .dvi .ps
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL)
|
||||
cd $(top_srcdir) && automake --gnu doc/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
version.texi: @MAINT@stamp-vti
|
||||
|
||||
stamp-vti: fileutils.texi $(top_srcdir)/configure.in
|
||||
echo "@set UPDATED `cd $(srcdir) \
|
||||
&& $(SHELL) ./mdate-sh fileutils.texi`" > vti.tmp
|
||||
echo "@set EDITION $(VERSION)" >> vti.tmp
|
||||
echo "@set VERSION $(VERSION)" >> vti.tmp
|
||||
cmp -s vti.tmp $(srcdir)/version.texi || cp vti.tmp $(srcdir)/version.texi
|
||||
rm vti.tmp
|
||||
echo timestamp > $(srcdir)/stamp-vti
|
||||
|
||||
mostlyclean-vti:
|
||||
rm -f vti.tmp
|
||||
|
||||
clean-vti:
|
||||
|
||||
distclean-vti:
|
||||
|
||||
maintainer-clean-vti:
|
||||
@MAINT@rm -f stamp-vti version.texi
|
||||
|
||||
fileutils.info: fileutils.texi version.texi
|
||||
fileutils.dvi: fileutils.texi version.texi
|
||||
|
||||
|
||||
DVIPS = dvips
|
||||
|
||||
.texi.info:
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texi.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.texinfo.info:
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS $(TEXI2DVI) $<
|
||||
.dvi.ps:
|
||||
$(DVIPS) $< -o $@
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(infodir)
|
||||
@for file in $(INFO_DEPS); do \
|
||||
for ifile in `cd $(srcdir) && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
|
||||
if test -f $(srcdir)/$$ifile; then \
|
||||
echo "$(INSTALL_DATA) $(srcdir)/$$ifile $(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$ifile $(infodir)/$$ifile; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done
|
||||
$(POST_INSTALL)
|
||||
@if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
|
||||
for file in $(INFO_DEPS); do \
|
||||
echo "install-info --info-dir=$(infodir) $(infodir)/$$file";\
|
||||
install-info --info-dir=$(infodir) $(infodir)/$$file; :;\
|
||||
done; \
|
||||
else : ; fi
|
||||
|
||||
uninstall-info:
|
||||
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
|
||||
ii=yes; \
|
||||
else ii=; fi; \
|
||||
for file in $(INFO_DEPS); do \
|
||||
(cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
test -z $ii || install-info --info-dir=$(infodir) --remove $$file; \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
for base in $(INFO_DEPS); do \
|
||||
d=$(srcdir); \
|
||||
for file in `cd $$d && eval echo $$base*`; do \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done; \
|
||||
done
|
||||
|
||||
mostlyclean-info:
|
||||
rm -f fileutils.aux fileutils.cp fileutils.cps fileutils.dvi \
|
||||
fileutils.fn fileutils.fns fileutils.ky fileutils.log \
|
||||
fileutils.pg fileutils.toc fileutils.tp fileutils.vr \
|
||||
fileutils.op
|
||||
|
||||
clean-info:
|
||||
|
||||
distclean-info:
|
||||
|
||||
maintainer-clean-info:
|
||||
for i in $(INFO_DEPS); do rm -f `eval echo $$i*`; done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = doc
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
$(MAKE) distdir="$(distdir)" dist-info
|
||||
info: $(INFO_DEPS)
|
||||
dvi: $(DVIS)
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-info-am
|
||||
$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-info
|
||||
|
||||
all: $(INFO_DEPS) Makefile
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(infodir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
rm -f Makefile $(DISTCLEANFILES)
|
||||
rm -f config.cache config.log stamp-h
|
||||
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-vti mostlyclean-info mostlyclean-generic
|
||||
|
||||
clean: clean-vti clean-info clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-vti distclean-info distclean-generic clean
|
||||
rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-vti maintainer-clean-info \
|
||||
maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default mostlyclean-vti distclean-vti clean-vti \
|
||||
maintainer-clean-vti install-info-am uninstall-info mostlyclean-info \
|
||||
distclean-info clean-info maintainer-clean-info tags distdir info dvi \
|
||||
installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
501
doc/getdate.texi
Normal file
501
doc/getdate.texi
Normal file
@@ -0,0 +1,501 @@
|
||||
@node Date input formats
|
||||
@chapter Date input formats
|
||||
|
||||
@cindex date input formats
|
||||
@findex getdate
|
||||
|
||||
@quotation
|
||||
Our units of temporal measurement, from seconds on up to months, are so
|
||||
complicated, asymmetrical and disjunctive so as to make coherent mental
|
||||
reckoning in time all but impossible. Indeed, had some tyrannical god
|
||||
contrived to enslave our minds to time, to make it all but impossible
|
||||
for us to escape subjection to sodden routines and unpleasant surprises,
|
||||
he could hardly have done better than handing down our present system.
|
||||
It is like a set of trapezoidal building blocks, with no vertical or
|
||||
horizontal surfaces, like a language in which the simplest thought
|
||||
demands ornate constructions, useless particles and lengthy
|
||||
circumlocutions. Unlike the more successful patterns of language and
|
||||
science, which enable us to face experience boldly or at least
|
||||
level-headedly, our system of temporal calculation silently and
|
||||
persistently encourages our terror of time.
|
||||
|
||||
@dots{} It is as though architects had to measure length in feet, width
|
||||
in meters and height in ells; as though basic instruction manuals
|
||||
demanded a knowledge of five different languages. It is no wonder then
|
||||
that we often look into our own immediate past or future, last Tuesday
|
||||
or a week from Sunday, with feelings of helpless confusion. @dots{}
|
||||
|
||||
--- Robert Grudin, @cite{Time and the Art of Living}.
|
||||
@end quotation
|
||||
|
||||
This section describes the textual date representations that GNU
|
||||
programs accept. These are the strings you, as a user, can supply as
|
||||
arguments to the various programs. The C interface (via the
|
||||
@code{getdate} function) is not described here.
|
||||
|
||||
@cindex beginning of time, for Unix
|
||||
@cindex epoch, for Unix
|
||||
Although the date syntax here can represent any possible time since zero
|
||||
A.D., computer integers are not big enough for such a (comparatively)
|
||||
long time. The earliest date semantically allowed on Unix systems is
|
||||
midnight, 1 January 1970 UCT.
|
||||
|
||||
@menu
|
||||
* General date syntax:: Common rules.
|
||||
* Calendar date item:: 19 Dec 1994.
|
||||
* Time of day item:: 9:20pm.
|
||||
* Timezone item:: EST, DST, BST, UCT, AHST, ...
|
||||
* Day of week item:: Monday and others.
|
||||
* Relative item in date strings:: next tuesday, 2 years ago.
|
||||
* Pure numbers in date strings:: 19931219, 1440.
|
||||
* Authors of getdate:: Bellovin, Salz, Berets, et al.
|
||||
@end menu
|
||||
|
||||
|
||||
@node General date syntax
|
||||
@section General date syntax
|
||||
|
||||
@cindex general date syntax
|
||||
|
||||
@cindex items in date strings
|
||||
A @dfn{date} is a string, possibly empty, containing many items
|
||||
separated by whitespace. The whitespace may be omitted when no
|
||||
ambiguity arises. The empty string means the beginning of today (i.e.,
|
||||
midnight). Order of the items is immaterial. A date string may contain
|
||||
many flavors of items:
|
||||
|
||||
@itemize @bullet
|
||||
@item calendar date items
|
||||
@item time of the day items
|
||||
@item time zone items
|
||||
@item day of the week items
|
||||
@item relative items
|
||||
@item pure numbers.
|
||||
@end itemize
|
||||
|
||||
@noindent We describe each of these item types in turn, below.
|
||||
|
||||
@cindex numbers, written-out
|
||||
@cindex ordinal numbers
|
||||
@findex first @r{in date strings}
|
||||
@findex next @r{in date strings}
|
||||
@findex last @r{in date strings}
|
||||
A few numbers may be written out in words in most contexts. This is
|
||||
most useful for specifying day of the week items or relative items (see
|
||||
below). Here is the list: @samp{first} for 1, @samp{next} for 2,
|
||||
@samp{third} for 3, @samp{fourth} for 4, @samp{fifth} for 5,
|
||||
@samp{sixth} for 6, @samp{seventh} for 7, @samp{eighth} for 8,
|
||||
@samp{ninth} for 9, @samp{tenth} for 10, @samp{eleventh} for 11 and
|
||||
@samp{twelfth} for 12. Also, @samp{last} means exactly @math{-1}.
|
||||
|
||||
@cindex months, written-out
|
||||
When a month is written this way, it is still considered to be written
|
||||
numerically, instead of being ``spelled in full''; this changes the
|
||||
allowed strings.
|
||||
|
||||
@cindex case, ignored in dates
|
||||
@cindex comments, in dates
|
||||
Alphabetic case is completely ignored in dates. Comments may be introduced
|
||||
between round parentheses, as long as included parentheses are properly
|
||||
nested. Hyphens not followed by a digit are currently ignored. Leading
|
||||
zeros on numbers are ignored.
|
||||
|
||||
|
||||
@node Calendar date item
|
||||
@section Calendar date item
|
||||
|
||||
@cindex calendar date item
|
||||
|
||||
A @dfn{calendar date item} specifies a day of the year. It is
|
||||
specified differently, depending on whether the month is specified
|
||||
numerically or literally. All these strings specify the same calendar date:
|
||||
|
||||
@example
|
||||
1970-09-17 # ISO 8601.
|
||||
70-9-17 # This century assumed by default.
|
||||
70-09-17 # Leading zeros are ignored.
|
||||
9/17/72 # Common U.S. writing.
|
||||
24 September 1972
|
||||
24 Sept 72 # September has a special abbreviation.
|
||||
24 Sep 72 # Three-letter abbreviations always allowed.
|
||||
Sep 24, 1972
|
||||
24-sep-72
|
||||
24sep72
|
||||
@end example
|
||||
|
||||
The year can also be omitted. In this case, the last specified year is
|
||||
used, or the current year if none. For example:
|
||||
|
||||
@example
|
||||
9/17
|
||||
sep 17
|
||||
@end example
|
||||
|
||||
Here are the rules.
|
||||
|
||||
@cindex ISO 8601 date format
|
||||
@cindex date format, ISO 8601
|
||||
For numeric months, the ISO 8601 format
|
||||
@samp{@var{year}-@var{month}-@var{day}} is allowed, where @var{year} is
|
||||
any positive number, @var{month} is a number between 01 and 12, and
|
||||
@var{day} is a number between 01 and 31. A leading zero must be present
|
||||
if a number is less than ten. If @var{year} is less than 100, then 1900
|
||||
is added to it to force a date in this century. The construct
|
||||
@samp{@var{month}/@var{day}/@var{year}}, popular in the United States,
|
||||
is accepted. Also @samp{@var{month}/@var{day}}, omitting the year.
|
||||
|
||||
@cindex month names in date strings
|
||||
@cindex abbreviations for months
|
||||
Literal months may be spelled out in full: @samp{January},
|
||||
@samp{February}, @samp{March}, @samp{April}, @samp{May}, @samp{June},
|
||||
@samp{July}, @samp{August}, @samp{September}, @samp{October},
|
||||
@samp{November} or @samp{December}. Literal months may be abbreviated
|
||||
to their first three letters, possibly followed by an abbreviating dot.
|
||||
It is also permitted to write @samp{Sept} instead of @samp{September}.
|
||||
|
||||
When months are written literally, the calendar date may be given as any
|
||||
of the following:
|
||||
|
||||
@example
|
||||
@var{day} @var{month} @var{year}
|
||||
@var{day} @var{month}
|
||||
@var{month} @var{day} @var{year}
|
||||
@var{day}-@var{month}-@var{year}
|
||||
@end example
|
||||
|
||||
Or, omitting the year:
|
||||
|
||||
@example
|
||||
@var{month} @var{day}
|
||||
@end example
|
||||
|
||||
|
||||
@node Time of day item
|
||||
@section Time of day item
|
||||
|
||||
@cindex time of day item
|
||||
|
||||
A @dfn{time of day item} in date strings specifies the time on a given
|
||||
day. Here are some examples, all of which represent the same time:
|
||||
|
||||
@example
|
||||
20:02:0
|
||||
20:02
|
||||
8:02pm
|
||||
20:02-0500 # In EST (Eastern U.S. Standard Time).
|
||||
@end example
|
||||
|
||||
More generally, the time of the day may be given as
|
||||
@samp{@var{hour}:@var{minute}:@var{second}}, where @var{hour} is
|
||||
a number between 0 and 23, @var{minute} is a number between 0 and
|
||||
59, and @var{second} is a number between 0 and 59. Alternatively,
|
||||
@samp{:@var{second}} can be omitted, in which case it is taken to
|
||||
be zero.
|
||||
|
||||
@findex am @r{in date strings}
|
||||
@findex pm @r{in date strings}
|
||||
@findex midnight @r{in date strings}
|
||||
@findex noon @r{in date strings}
|
||||
If the time is followed by @samp{am} or @samp{pm} (or @samp{a.m.}
|
||||
or @samp{p.m.}), @var{hour} is restricted to run from 1 to 12, and
|
||||
@samp{:@var{minute}} may be omitted (taken to be zero). @samp{am}
|
||||
indicates the first half of the day, @samp{pm} indicates the second
|
||||
half of the day. In this notation, 12 is the predecessor of 1:
|
||||
midnight is @samp{12am} while noon is @samp{12pm}.
|
||||
|
||||
@cindex timezone correction
|
||||
@cindex minutes, timezone correction by
|
||||
The time may alternatively be followed by a timezone correction,
|
||||
expressed as @samp{@var{s}@var{hh}@var{mm}}, where @var{s} is @samp{+}
|
||||
or @samp{-}, @var{hh} is a number of zone hours and @var{mm} is a number
|
||||
of zone minutes. When a timezone correction is given this way, it
|
||||
forces interpretation of the time in UTC, overriding any previous
|
||||
specification for the timezone or the local timezone. The @var{minute}
|
||||
part of the time of the day may not be elided when a timezone correction
|
||||
is used. This is the only way to specify a timezone correction by
|
||||
fractional parts of an hour.
|
||||
|
||||
Either @samp{am}/@samp{pm} or a timezone correction may be specified,
|
||||
but not both.
|
||||
|
||||
|
||||
@node Timezone item
|
||||
@section Timezone item
|
||||
|
||||
@cindex timezone item
|
||||
|
||||
A @dfn{timezone item} specifies an international timezone, indicated by
|
||||
a small set of letters. Any included period is ignored. Military
|
||||
timezone designations use a single letter. Currently, only integral
|
||||
zone hours may be represented in a timezone item. See the previous
|
||||
section for a finer control over the timezone correction.
|
||||
|
||||
Here are many non-daylight-savings-time timezones, indexed by the zone
|
||||
hour value.
|
||||
|
||||
@table @asis
|
||||
@item +000
|
||||
@cindex Greenwich Mean Time
|
||||
@cindex Universal Coordinated Time
|
||||
@cindex Western European Time
|
||||
@samp{GMT} for Greenwich Mean, @samp{UT} or @samp{UTC} for Universal
|
||||
(Coordinated), @samp{WET} for Western European and @samp{Z} for
|
||||
militaries.
|
||||
@item +100
|
||||
@cindex West African Time
|
||||
@samp{WAT} for West Africa and
|
||||
@samp{A} for militaries.
|
||||
@item +200
|
||||
@cindex Azores Time
|
||||
@samp{AT} for Azores and @samp{B} for militaries.
|
||||
@item +300
|
||||
@samp{C} for militaries.
|
||||
@item +400
|
||||
@cindex Atlantic Standard Time
|
||||
@samp{AST} for Atlantic Standard and @samp{D} for militaries.
|
||||
@item +500
|
||||
@cindex Eastern Standard Time
|
||||
@samp{E} for militaries and @samp{EST} for Eastern Standard.
|
||||
@item +600
|
||||
@cindex Central Standard Time
|
||||
@samp{CST} for Central Standard and @samp{F} for militaries.
|
||||
@item +700
|
||||
@cindex Mountain Standard Time
|
||||
@samp{G} for militaries and @samp{MST} for Mountain Standard.
|
||||
@item +800
|
||||
@cindex Pacific Standard Time
|
||||
@samp{H} for militaries and @samp{PST} for Pacific Standard.
|
||||
@item +900
|
||||
@cindex Yukon Standard Time
|
||||
@samp{I} for militaries and @samp{YST} for Yukon Standard.
|
||||
@item +1000
|
||||
@cindex Alaska-Hawaii Time
|
||||
@cindex Central Alaska Time
|
||||
@cindex Hawaii Standard Time
|
||||
@samp{AHST} for Alaska-Hawaii Standard, @samp{CAT} for Central Alaska,
|
||||
@samp{HST} for Hawaii Standard and @samp{K} for militaries.
|
||||
@item +1100
|
||||
@cindex Nome Standard Time
|
||||
@samp{L} for militaries and @samp{NT} for Nome.
|
||||
@item +1200
|
||||
@cindex International Date Line West
|
||||
@samp{IDLW} for International Date Line West and @samp{M} for
|
||||
militaries.
|
||||
@item -100
|
||||
@cindex Central European Time
|
||||
@cindex Middle European Time
|
||||
@cindex Middle European Winter Time
|
||||
@cindex French Winter Time
|
||||
@cindex Swedish Winter Time
|
||||
@samp{CET} for Central European, @samp{FWT} for French Winter,
|
||||
@samp{MET} for Middle European, @samp{MEWT} for Middle European
|
||||
Winter, @samp{N} for militaries and @samp{SWT} for Swedish Winter.
|
||||
@item -200
|
||||
@cindex Eastern European Time
|
||||
@cindex USSR Zone
|
||||
@samp{EET} for Eastern European, USSR Zone 1 and @samp{O} for militaries.
|
||||
@item -300
|
||||
@cindex Baghdad Time
|
||||
@samp{BT} for Baghdad, USSR Zone 2 and @samp{P} for militaries.
|
||||
@item -400
|
||||
@samp{Q} for militaries and @samp{ZP4} for USSR Zone 3.
|
||||
@item -500
|
||||
@samp{R} for militaries and @samp{ZP5} for USSR Zone 4.
|
||||
@item -600
|
||||
@samp{S} for militaries and @samp{ZP6} for USSR Zone 5.
|
||||
@item -700
|
||||
@cindex West Australian Standard Time
|
||||
@samp{T} for militaries and @samp{WAST} for West Australian Standard.
|
||||
@item -800
|
||||
@cindex China Coast Time
|
||||
@samp{CCT} for China Coast, USSR Zone 7 and @samp{U} for militaries.
|
||||
@item -900
|
||||
@cindex Japan Standard Time
|
||||
@samp{JST} for Japan Standard, USSR Zone 8 and @samp{V} for militaries.
|
||||
@item -1000
|
||||
@cindex East Australian Standard Time
|
||||
@cindex Guam Standard Time
|
||||
@samp{EAST} for East Australian Standard, @samp{GST} for Guam
|
||||
Standard, USSR Zone 9 and @samp{W} for militaries.
|
||||
@item -1100
|
||||
@samp{X} for militaries.
|
||||
@item -1200
|
||||
@cindex International Date Line East
|
||||
@cindex New Zealand Standard Time
|
||||
@samp{IDLE} for International Date Line East, @samp{NZST} for
|
||||
New Zealand Standard, @samp{NZT} for New Zealand and @samp{Y} for
|
||||
militaries.
|
||||
@end table
|
||||
|
||||
@cindex daylight savings time
|
||||
Here are many DST timezones, indexed by the zone hour value. Also, by
|
||||
following a non-DST timezone by the string @samp{DST} in a separate word
|
||||
(that is, separated by some whitespace), the corresponding DST timezone
|
||||
may be specified.
|
||||
|
||||
@table @asis
|
||||
@item 0
|
||||
@samp{BST} for British Summer.
|
||||
@item +400
|
||||
@samp{ADT} for Atlantic Daylight.
|
||||
@item +500
|
||||
@samp{EDT} for Eastern Daylight.
|
||||
@item +600
|
||||
@samp{CDT} for Central Daylight.
|
||||
@item +700
|
||||
@samp{MDT} for Mountain Daylight.
|
||||
@item +800
|
||||
@samp{PDT} for Pacific Daylight.
|
||||
@item +900
|
||||
@samp{YDT} for Yukon Daylight.
|
||||
@item +1000
|
||||
@samp{HDT} for Hawaii Daylight.
|
||||
@item -100
|
||||
@samp{MEST} for Middle European Summer, @samp{MESZ} for Middle European
|
||||
Summer, @samp{SST} for Swedish Summer and @samp{FST} for French Summer.
|
||||
@item -700
|
||||
@samp{WADT} for West Australian Daylight.
|
||||
@item -1000
|
||||
@samp{EADT} for Eastern Australian Daylight.
|
||||
@item -1200
|
||||
@samp{NZDT} for New Zealand Daylight.
|
||||
@end table
|
||||
|
||||
|
||||
@node Day of week item
|
||||
@section Day of week item
|
||||
|
||||
@cindex day of week item
|
||||
|
||||
The explicit mention of a day of the week will forward the date
|
||||
(only if necessary) to reach that day of the week in the future.
|
||||
|
||||
Days of the week may be spelled out in full: @samp{Sunday},
|
||||
@samp{Monday}, @samp{Tuesday}, @samp{Wednesday}, @samp{Thursday},
|
||||
@samp{Friday} or @samp{Saturday}. Days may be abbreviated to their
|
||||
first three letters, optionally followed by a period. The special
|
||||
abbreviations @samp{Tues} for @samp{Tuesday}, @samp{Wednes} for
|
||||
@samp{Wednesday} and @samp{Thur} or @samp{Thurs} for @samp{Thursday} are
|
||||
also allowed.
|
||||
|
||||
@findex next @var{day}
|
||||
@findex last @var{day}
|
||||
A number may precede a day of the week item to move forward
|
||||
supplementary weeks. It is best used in expression like @samp{third
|
||||
monday}. In this context, @samp{last @var{day}} or @samp{next
|
||||
@var{day}} is also acceptable; they move one week before or after
|
||||
the day that @var{day} by itself would represent.
|
||||
|
||||
A comma following a day of the week item is ignored.
|
||||
|
||||
|
||||
@node Relative item in date strings
|
||||
@section Relative item in date strings
|
||||
|
||||
@cindex relative items in date strings
|
||||
@cindex displacement of dates
|
||||
|
||||
@dfn{Relative items} adjust a date (or the current date if none) forward
|
||||
or backward. The effects of relative items accumulate. Here are some
|
||||
examples:
|
||||
|
||||
@example
|
||||
1 year
|
||||
1 year ago
|
||||
3 years
|
||||
2 days
|
||||
@end example
|
||||
|
||||
@findex year @r{in date strings}
|
||||
@findex month @r{in date strings}
|
||||
@findex fortnight @r{in date strings}
|
||||
@findex week @r{in date strings}
|
||||
@findex day @r{in date strings}
|
||||
@findex hour @r{in date strings}
|
||||
@findex minute @r{in date strings}
|
||||
The unit of time displacement may be selected by the string @samp{year}
|
||||
or @samp{month} for moving by whole years or months. These are fuzzy
|
||||
units, as years and months are not all of equal duration. More precise
|
||||
units are @samp{fortnight} which is worth 14 days, @samp{week} worth 7
|
||||
days, @samp{day} worth 24 hours, @samp{hour} worth 60 minutes,
|
||||
@samp{minute} or @samp{min} worth 60 seconds, and @samp{second} or
|
||||
@samp{sec} worth one second. An @samp{s} suffix on these units is
|
||||
accepted and ignored.
|
||||
|
||||
@findex ago @r{in date strings}
|
||||
The unit of time may be preceded by a multiplier, given as an optionally
|
||||
signed number. Unsigned numbers are taken as positively signed. No
|
||||
number at all implies 1 for a multiplier. Following a relative item by
|
||||
the string @samp{ago} is equivalent to preceding the unit by a
|
||||
multiplicator with value @math{-1}.
|
||||
|
||||
@findex day @r{in date strings}
|
||||
@findex tomorrow @r{in date strings}
|
||||
@findex yesterday @r{in date strings}
|
||||
The string @samp{tomorrow} is worth one day in the future (equivalent
|
||||
to @samp{day}), the string @samp{yesterday} is worth
|
||||
one day in the past (equivalent to @samp{day ago}).
|
||||
|
||||
@findex now @r{in date strings}
|
||||
@findex today @r{in date strings}
|
||||
@findex this @r{in date strings}
|
||||
The strings @samp{now} or @samp{today} are relative items corresponding
|
||||
to zero-valued time displacement, these strings come from the fact
|
||||
a zero-valued time displacement represents the current time when not
|
||||
otherwise change by previous items. They may be used to stress other
|
||||
items, like in @samp{12:00 today}. The string @samp{this} also has
|
||||
the meaning of a zero-valued time displacement, but is preferred in
|
||||
date strings like @samp{this thursday}.
|
||||
|
||||
When a relative item makes the resulting date to cross the boundary
|
||||
between DST and non-DST (or vice-versa), the hour is adjusted according
|
||||
to the local time.
|
||||
|
||||
|
||||
@node Pure numbers in date strings
|
||||
@section Pure numbers in date strings
|
||||
|
||||
@cindex pure numbers in date strings
|
||||
|
||||
The precise intepretation of a pure decimal number is dependent of
|
||||
the context in the date string.
|
||||
|
||||
If the decimal number is of the form @var{yyyy}@var{mm}@var{dd} and no
|
||||
other calendar date item (@pxref{Calendar date item}) appears before it
|
||||
in the date string, then @var{yyyy} is read as the year, @var{mm} as the
|
||||
month number and @var{dd} as the day of the month, for the specified
|
||||
calendar date.
|
||||
|
||||
If the decimal number is of the form @var{hh}@var{mm} and no other time
|
||||
of day item appears before it in the date string, then @var{hh} is read
|
||||
as the hour of the day and @var{mm} as the minute of the hour, for the
|
||||
specified time of the day. @var{mm} can also be omitted.
|
||||
|
||||
If both a calendar date and a time of day appear to the left of a number
|
||||
in the date string, but no relative item, then the number overrides the
|
||||
year.
|
||||
|
||||
|
||||
@node Authors of getdate
|
||||
@section Authors of @code{getdate}
|
||||
|
||||
@cindex authors of @code{getdate}
|
||||
|
||||
@cindex Bellovin, Steven M.
|
||||
@cindex Salz, Rich
|
||||
@cindex Berets, Jim
|
||||
@cindex MacKenzie, David
|
||||
@cindex Meyering, Jim
|
||||
@code{getdate} was originally implemented by Steven M. Bellovin
|
||||
(@samp{smb@@research.att.com}) while at the University of North Carolina
|
||||
at Chapel Hill. The code was later tweaked by a couple of people on
|
||||
Usenet, then completely overhauled by Rich $alz (@samp{rsalz@@bbn.com})
|
||||
and Jim Berets (@samp{jberets@@bbn.com}) in August, 1990. Various
|
||||
revisions for the GNU system were made by David MacKenzie, Jim Meyering,
|
||||
and others.
|
||||
|
||||
@cindex Pinard, F.
|
||||
@cindex Berry, K.
|
||||
This chapter was originally produced by Fran@,{c}ois Pinard
|
||||
(@samp{pinard@@iro.umontreal.ca}) from the @file{getdate.y} source code,
|
||||
and then edited by K.@: Berry (@samp{kb@@cs.umb.edu}).
|
||||
91
doc/mdate-sh
Executable file
91
doc/mdate-sh
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/bin/sh
|
||||
# mdate-sh - get modification time of a file and pretty-print it.
|
||||
# Copyright (C) 1995, 1996 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Prevent date giving response in another language.
|
||||
LANG=C
|
||||
export LANG
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
|
||||
# Get the extended ls output of the file.
|
||||
if ls -L /dev/null 1>/dev/null 2>&1; then
|
||||
set - `ls -L -l $1`
|
||||
else
|
||||
set - `ls -l $1`
|
||||
fi
|
||||
# The month is at least the fourth argument.
|
||||
# (3 shifts here, the next inside the loop)
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
|
||||
# Find the month. Next argument is day, followed by the year or time.
|
||||
month=
|
||||
until test $month
|
||||
do
|
||||
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
|
||||
|
||||
day=$2
|
||||
|
||||
# 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
|
||||
478
doc/perm.texi
Normal file
478
doc/perm.texi
Normal file
@@ -0,0 +1,478 @@
|
||||
Each file has a set of @dfn{permissions} that control the kinds of
|
||||
access that users have to that file. The permissions for a file are
|
||||
also called its @dfn{access mode}. They can be represented either in
|
||||
symbolic form or as an octal number.
|
||||
|
||||
@menu
|
||||
* Mode Structure:: Structure of file permissions.
|
||||
* Symbolic Modes:: Mnemonic permissions representation.
|
||||
* Numeric Modes:: Permissions as octal numbers.
|
||||
@end menu
|
||||
|
||||
@node Mode Structure
|
||||
@section Structure of File Permissions
|
||||
|
||||
There are three kinds of permissions that a user can have for a file:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
@cindex read permission
|
||||
permission to read the file. For directories, this means permission to
|
||||
list the contents of the directory.
|
||||
@item
|
||||
@cindex write permission
|
||||
permission to write to (change) the file. For directories, this means
|
||||
permission to create and remove files in the directory.
|
||||
@item
|
||||
@cindex execute permission
|
||||
permission to execute the file (run it as a program). For directories,
|
||||
this means permission to access files in the directory.
|
||||
@end enumerate
|
||||
|
||||
There are three categories of users who may have different permissions
|
||||
to perform any of the above operations on a file:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
the file's owner;
|
||||
@item
|
||||
other users who are in the file's group;
|
||||
@item
|
||||
everyone else.
|
||||
@end enumerate
|
||||
|
||||
@cindex owner, default
|
||||
@cindex group owner, default
|
||||
Files are given an owner and group when they are created. Usually the
|
||||
owner is the current user and the group is the group of the directory
|
||||
the file is in, but this varies with the operating system, the
|
||||
filesystem the file is created on, and the way the file is created. You
|
||||
can change the owner and group of a file by using the @code{chown} and
|
||||
@code{chgrp} commands.
|
||||
|
||||
In addition to the three sets of three permissions listed above, a
|
||||
file's permissions have three special components, which affect only
|
||||
executable files (programs) and, on some systems, directories:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
@cindex setuid
|
||||
set the process's effective user ID to that of the file upon execution
|
||||
(called the @dfn{setuid bit}). No effect on directories.
|
||||
@item
|
||||
@cindex setgid
|
||||
set the process's effective group ID to that of the file upon execution
|
||||
(called the @dfn{setgid bit}). For directories on some systems, put
|
||||
files created in the directory into the same group as the directory, no
|
||||
matter what group the user who creates them is in.
|
||||
@item
|
||||
@cindex sticky
|
||||
@cindex swap space, saving text image in
|
||||
@cindex text image, saving in swap space
|
||||
@cindex append-only directories
|
||||
save the program's text image on the swap device so it will load more
|
||||
quickly when run (called the @dfn{sticky bit}). For directories on some
|
||||
systems, prevent users from removing files that they do not own in the
|
||||
directory; this is called making the directory @dfn{append-only}.
|
||||
@end enumerate
|
||||
|
||||
@node Symbolic Modes
|
||||
@section Symbolic Modes
|
||||
|
||||
@cindex symbolic modes
|
||||
@dfn{Symbolic modes} represent changes to files' permissions as
|
||||
operations on single-character symbols. They allow you to modify either
|
||||
all or selected parts of files' permissions, optionally based on
|
||||
their previous values, and perhaps on the current @code{umask} as well
|
||||
(@pxref{Umask and Protection}).
|
||||
|
||||
The format of symbolic modes is:
|
||||
|
||||
@example
|
||||
@r{[}ugoa@dots{}@r{][[}+-=@r{][}rwxXstugo@dots{}@r{]}@dots{}@r{][},@dots{}@r{]}
|
||||
@end example
|
||||
|
||||
The following sections describe the operators and other details of
|
||||
symbolic modes.
|
||||
|
||||
@menu
|
||||
* Setting Permissions:: Basic operations on permissions.
|
||||
* Copying Permissions:: Copying existing permissions.
|
||||
* Changing Special Permissions:: Special permissions.
|
||||
* Conditional Executability:: Conditionally affecting executability.
|
||||
* Multiple Changes:: Making multiple changes.
|
||||
* Umask and Protection:: The effect of the umask.
|
||||
@end menu
|
||||
|
||||
@node Setting Permissions
|
||||
@subsection Setting Permissions
|
||||
|
||||
The basic symbolic operations on a file's permissions are adding,
|
||||
removing, and setting the permission that certain users have to read,
|
||||
write, and execute the file. These operations have the following
|
||||
format:
|
||||
|
||||
@example
|
||||
@var{users} @var{operation} @var{permissions}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
The spaces between the three parts above are shown for readability only;
|
||||
symbolic modes can not contain spaces.
|
||||
|
||||
The @var{users} part tells which users' access to the file is changed.
|
||||
It consists of one or more of the following letters (or it can be empty;
|
||||
@pxref{Umask and Protection}, for a description of what happens then). When
|
||||
more than one of these letters is given, the order that they are in does
|
||||
not matter.
|
||||
|
||||
@table @code
|
||||
@item u
|
||||
@cindex owner of file, permissions for
|
||||
the user who owns the file;
|
||||
@item g
|
||||
@cindex group, permissions for
|
||||
other users who are in the file's group;
|
||||
@item o
|
||||
@cindex other permissions
|
||||
all other users;
|
||||
@item a
|
||||
all users; the same as @samp{ugo}.
|
||||
@end table
|
||||
|
||||
The @var{operation} part tells how to change the affected users' access
|
||||
to the file, and is one of the following symbols:
|
||||
|
||||
@table @code
|
||||
@item +
|
||||
@cindex adding permissions
|
||||
to add the @var{permissions} to whatever permissions the @var{users}
|
||||
already have for the file;
|
||||
@item -
|
||||
@cindex removing permissions
|
||||
@cindex subtracting permissions
|
||||
to remove the @var{permissions} from whatever permissions the
|
||||
@var{users} already have for the file;
|
||||
@item =
|
||||
@cindex setting permissions
|
||||
to make the @var{permissions} the only permissions that the @var{users}
|
||||
have for the file.
|
||||
@end table
|
||||
|
||||
The @var{permissions} part tells what kind of access to the file should
|
||||
be changed; it is zero or more of the following letters. As with the
|
||||
@var{users} part, the order does not matter when more than one letter is
|
||||
given. Omitting the @var{permissions} part is useful only with the
|
||||
@samp{=} operation, where it gives the specified @var{users} no access
|
||||
at all to the file.
|
||||
|
||||
@table @code
|
||||
@item r
|
||||
@cindex read permission, symbolic
|
||||
the permission the @var{users} have to read the file;
|
||||
@item w
|
||||
@cindex write permission, symbolic
|
||||
the permission the @var{users} have to write to the file;
|
||||
@item x
|
||||
@cindex execute permission, symbolic
|
||||
the permission the @var{users} have to execute the file.
|
||||
@end table
|
||||
|
||||
For example, to give everyone permission to read and write a file,
|
||||
but not to execute it, use:
|
||||
|
||||
@example
|
||||
a=rw
|
||||
@end example
|
||||
|
||||
To remove write permission for from all users other than the file's
|
||||
owner, use:
|
||||
|
||||
@example
|
||||
go-w
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
The above command does not affect the access that the owner of
|
||||
the file has to it, nor does it affect whether other users can
|
||||
read or execute the file.
|
||||
|
||||
To give everyone except a file's owner no permission to do anything with
|
||||
that file, use the mode below. Other users could still remove the file,
|
||||
if they have write permission on the directory it is in.
|
||||
|
||||
@example
|
||||
go=
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Another way to specify the same thing is:
|
||||
|
||||
@example
|
||||
og-rxw
|
||||
@end example
|
||||
|
||||
@node Copying Permissions
|
||||
@subsection Copying Existing Permissions
|
||||
|
||||
@cindex copying existing permissions
|
||||
@cindex permissions, copying existing
|
||||
You can base a file's permissions on its existing permissions. To do
|
||||
this, instead of using @samp{r}, @samp{w}, or @samp{x} after the
|
||||
operator, you use the letter @samp{u}, @samp{g}, or @samp{o}. For
|
||||
example, the mode
|
||||
@example
|
||||
o+g
|
||||
@end example
|
||||
@noindent
|
||||
adds the permissions for users who are in a file's group to the
|
||||
permissions that other users have for the file. Thus, if the file
|
||||
started out as mode 664 (@samp{rw-rw-r--}), the above mode would change
|
||||
it to mode 666 (@samp{rw-rw-rw-}). If the file had started out as mode
|
||||
741 (@samp{rwxr----x}), the above mode would change it to mode 745
|
||||
(@samp{rwxr--r-x}). The @samp{-} and @samp{=} operations work
|
||||
analogously.
|
||||
|
||||
@node Changing Special Permissions
|
||||
@subsection Changing Special Permissions
|
||||
|
||||
@cindex changing special permissions
|
||||
In addition to changing a file's read, write, and execute permissions,
|
||||
you can change its special permissions. @xref{Mode Structure}, for a
|
||||
summary of these permissions.
|
||||
|
||||
To change a file's permission to set the user ID on execution, use
|
||||
@samp{u} in the @var{users} part of the symbolic mode and
|
||||
@samp{s} in the @var{permissions} part.
|
||||
|
||||
To change a file's permission to set the group ID on execution, use
|
||||
@samp{g} in the @var{users} part of the symbolic mode and
|
||||
@samp{s} in the @var{permissions} part.
|
||||
|
||||
To change a file's permission to stay permanently on the swap device,
|
||||
use @samp{o} in the @var{users} part of the symbolic mode and
|
||||
@samp{t} in the @var{permissions} part.
|
||||
|
||||
For example, to add set user ID permission to a program,
|
||||
you can use the mode:
|
||||
|
||||
@example
|
||||
u+s
|
||||
@end example
|
||||
|
||||
To remove both set user ID and set group ID permission from
|
||||
it, you can use the mode:
|
||||
|
||||
@example
|
||||
ug-s
|
||||
@end example
|
||||
|
||||
To cause a program to be saved on the swap device, you can use
|
||||
the mode:
|
||||
|
||||
@example
|
||||
o+t
|
||||
@end example
|
||||
|
||||
Remember that the special permissions only affect files that are
|
||||
executable, plus, on some systems, directories (on which they have
|
||||
different meanings; @pxref{Mode Structure}). Using @samp{a}
|
||||
in the @var{users} part of a symbolic mode does not cause the special
|
||||
permissions to be affected; thus,
|
||||
|
||||
@example
|
||||
a+s
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
has @emph{no effect}. You must use @samp{u}, @samp{g}, and @samp{o}
|
||||
explicitly to affect the special permissions. Also, the
|
||||
combinations @samp{u+t}, @samp{g+t}, and @samp{o+s} have no effect.
|
||||
|
||||
The @samp{=} operator is not very useful with special permissions; for
|
||||
example, the mode:
|
||||
|
||||
@example
|
||||
o=t
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
does cause the file to be saved on the swap device, but it also
|
||||
removes all read, write, and execute permissions that users not in the
|
||||
file's group might have had for it.
|
||||
|
||||
@node Conditional Executability
|
||||
@subsection Conditional Executability
|
||||
|
||||
@cindex conditional executability
|
||||
There is one more special type of symbolic permission: if you use
|
||||
@samp{X} instead of @samp{x}, execute permission is affected only if the
|
||||
file already had execute permission or is a directory. It affects
|
||||
directories' execute permission even if they did not initially have any
|
||||
execute permissions set.
|
||||
|
||||
For example, this mode:
|
||||
|
||||
@example
|
||||
a+X
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
gives all users permission to execute files (or search directories) if
|
||||
anyone could before.
|
||||
|
||||
@node Multiple Changes
|
||||
@subsection Making Multiple Changes
|
||||
|
||||
@cindex multiple changes to permissions
|
||||
The format of symbolic modes is actually more complex than described
|
||||
above (@pxref{Setting Permissions}). It provides two ways to make
|
||||
multiple changes to files' permissions.
|
||||
|
||||
The first way is to specify multiple @var{operation} and
|
||||
@var{permissions} parts after a @var{users} part in the symbolic mode.
|
||||
|
||||
For example, the mode:
|
||||
|
||||
@example
|
||||
og+rX-w
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
gives users other than the owner of the file read permission and, if
|
||||
it is a directory or if someone already had execute permission
|
||||
to it, gives them execute permission; and it also denies them write
|
||||
permission to it file. It does not affect the permission that the
|
||||
owner of the file has for it. The above mode is equivalent to
|
||||
the two modes:
|
||||
|
||||
@example
|
||||
og+rX
|
||||
og-w
|
||||
@end example
|
||||
|
||||
The second way to make multiple changes is to specify more than one
|
||||
simple symbolic mode, separated by commas. For example, the mode:
|
||||
|
||||
@example
|
||||
a+r,go-w
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
gives everyone permission to read the file and removes write
|
||||
permission on it for all users except its owner. Another example:
|
||||
|
||||
@example
|
||||
u=rwx,g=rx,o=
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
sets all of the non-special permissions for the file explicitly. (It
|
||||
gives users who are not in the file's group no permission at all for
|
||||
it.)
|
||||
|
||||
The two methods can be combined. The mode:
|
||||
|
||||
@example
|
||||
a+r,g+x-w
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
gives all users permission to read the file, and gives users who are in
|
||||
the file's group permission to execute it, as well, but not permission
|
||||
to write to it. The above mode could be written in several different
|
||||
ways; another is:
|
||||
|
||||
@example
|
||||
u+r,g+rx,o+r,g-w
|
||||
@end example
|
||||
|
||||
@node Umask and Protection
|
||||
@subsection The Umask and Protection
|
||||
|
||||
@cindex umask and modes
|
||||
@cindex modes and umask
|
||||
If the @var{users} part of a symbolic mode is omitted, it defaults to
|
||||
@samp{a} (affect all users), except that any permissions that are
|
||||
@emph{set} in the system variable @code{umask} are @emph{not affected}.
|
||||
The value of @code{umask} can be set using the
|
||||
@code{umask} command. Its default value varies from system to system.
|
||||
|
||||
@cindex giving away permissions
|
||||
Omitting the @var{users} part of a symbolic mode is generally not useful
|
||||
with operations other than @samp{+}. It is useful with @samp{+} because
|
||||
it allows you to use @code{umask} as an easily customizable protection
|
||||
against giving away more permission to files than you intended to.
|
||||
|
||||
As an example, if @code{umask} has the value 2, which removes write
|
||||
permission for users who are not in the file's group, then the mode:
|
||||
|
||||
@example
|
||||
+w
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
adds permission to write to the file to its owner and to other users who
|
||||
are in the file's group, but @emph{not} to other users. In contrast,
|
||||
the mode:
|
||||
|
||||
@example
|
||||
a+w
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
ignores @code{umask}, and @emph{does} give write permission for
|
||||
the file to all users.
|
||||
|
||||
@node Numeric Modes
|
||||
@section Numeric Modes
|
||||
|
||||
@cindex numeric modes
|
||||
@cindex file permissions, numeric
|
||||
@cindex octal numbers for file modes
|
||||
File permissions are stored internally as 16 bit integers. As an
|
||||
alternative to giving a symbolic mode, you can give an octal (base 8)
|
||||
number that corresponds to the internal representation of the new mode.
|
||||
This number is always interpreted in octal; you do not have to add a
|
||||
leading 0, as you do in C. Mode 0055 is the same as mode 55.
|
||||
|
||||
A numeric mode is usually shorter than the corresponding symbolic
|
||||
mode, but it is limited in that it can not take into account a file's
|
||||
previous permissions; it can only set them absolutely.
|
||||
|
||||
The permissions granted to the user, to other users in the file's group,
|
||||
and to other users not in the file's group are each stored as three
|
||||
bits, which are represented as one octal digit. The three special
|
||||
permissions are also each stored as one bit, and they are as a group
|
||||
represented as another octal digit. Here is how the bits are arranged
|
||||
in the 16 bit integer, starting with the lowest valued bit:
|
||||
|
||||
@example
|
||||
Value in Corresponding
|
||||
Mode Permission
|
||||
|
||||
Other users not in the file's group:
|
||||
1 Execute
|
||||
2 Write
|
||||
4 Read
|
||||
|
||||
Other users in the file's group:
|
||||
10 Execute
|
||||
20 Write
|
||||
40 Read
|
||||
|
||||
The file's owner:
|
||||
100 Execute
|
||||
200 Write
|
||||
400 Read
|
||||
|
||||
Special permissions:
|
||||
1000 Save text image on swap device
|
||||
2000 Set group ID on execution
|
||||
4000 Set user ID on execution
|
||||
@end example
|
||||
|
||||
For example, numeric mode 4755 corresponds to symbolic mode
|
||||
@samp{u=rwxs,go=rx}, and numeric mode 664 corresponds to symbolic mode
|
||||
@samp{ug=rw,o=r}. Numeric mode 0 corresponds to symbolic mode
|
||||
@samp{ugo=}.
|
||||
3017
doc/sh-utils.texi
Normal file
3017
doc/sh-utils.texi
Normal file
File diff suppressed because it is too large
Load Diff
4692
doc/texinfo.tex
Normal file
4692
doc/texinfo.tex
Normal file
File diff suppressed because it is too large
Load Diff
3380
doc/textutils.texi
Normal file
3380
doc/textutils.texi
Normal file
File diff suppressed because it is too large
Load Diff
9
lib/.cvsignore
Normal file
9
lib/.cvsignore
Normal file
@@ -0,0 +1,9 @@
|
||||
Makefile
|
||||
getdate.c
|
||||
posixtm.c
|
||||
safe-stat.h
|
||||
safe-stat.c
|
||||
safe-lstat.c
|
||||
safe-lstat.h
|
||||
getdate.tab.c
|
||||
.deps
|
||||
25
lib/Makefile.am
Normal file
25
lib/Makefile.am
Normal file
@@ -0,0 +1,25 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
noinst_LIBRARIES = libfu.a
|
||||
|
||||
## FIXME: Remove mvdir.c, and rmdir.c when
|
||||
## automake is fixed -- probably for 1.1g
|
||||
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c getgroups.c
|
||||
|
||||
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||
|
||||
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
|
||||
argmatch.c backupfile.c dirname.c filemode.c \
|
||||
full-write.c getversion.c idcache.c \
|
||||
isdir.c long-options.c makepath.c modechange.c path-concat.c \
|
||||
safe-read.c save-cwd.c savedir.c stripslash.c userspec.c xgetcwd.c \
|
||||
xmalloc.c xstrdup.c xstrtol.c xstrtoul.c yesno.c
|
||||
|
||||
libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
|
||||
|
||||
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
|
||||
getline.h getopt.h group-member.h long-options.h makepath.h modechange.h \
|
||||
mountlist.h path-concat.h pathmax.h \
|
||||
save-cwd.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
339
lib/Makefile.in
339
lib/Makefile.in
@@ -1,98 +1,295 @@
|
||||
# Makefile for library files used by GNU fileutils.
|
||||
# Do not use this makefile directly, but only from `../Makefile'.
|
||||
# Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
# Makefile.in generated automatically by automake 1.1l from Makefile.am
|
||||
|
||||
# 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.
|
||||
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
SOURCES = argmatch.c backupfile.c basename.c dirname.c eaccess.c \
|
||||
error.c filemode.c fsusage.c getopt.c getopt1.c \
|
||||
getversion.c idcache.c isdir.c makepath.c \
|
||||
modechange.c mountlist.c savedir.c \
|
||||
stripslash.c xgetcwd.c xmalloc.c xstrdup.c userspec.c yesno.c \
|
||||
getdate.y posixtm.y \
|
||||
fileblocks.c fnmatch.c ftruncate.c mkdir.c mktime.c rename.c stpcpy.c \
|
||||
strdup.c strstr.c alloca.c
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
OBJECTS = argmatch.o backupfile.o basename.o dirname.o eaccess.o \
|
||||
error.o filemode.o getopt.o getopt1.o \
|
||||
getversion.o idcache.o isdir.o makepath.o \
|
||||
modechange.o savedir.o \
|
||||
stripslash.o xgetcwd.o xmalloc.o xstrdup.o userspec.o yesno.o \
|
||||
getdate.o posixtm.o @LIBOBJS@ @ALLOCA@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
DISTFILES = Makefile.in backupfile.h getopt.h modechange.h \
|
||||
fnmatch.h fsusage.h mountlist.h pathmax.h system.h $(SOURCES)
|
||||
top_builddir = ..
|
||||
|
||||
all: libfu.a
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
YACC = @YACC@
|
||||
GENCAT = @GENCAT@
|
||||
PERL = @PERL@
|
||||
MV = @MV@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
CC = @CC@
|
||||
RANLIB = @RANLIB@
|
||||
LN = @LN@
|
||||
RM = @RM@
|
||||
|
||||
noinst_LIBRARIES = libfu.a
|
||||
|
||||
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c getgroups.c
|
||||
|
||||
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||
|
||||
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
|
||||
argmatch.c backupfile.c dirname.c filemode.c \
|
||||
full-write.c getversion.c idcache.c \
|
||||
isdir.c long-options.c makepath.c modechange.c path-concat.c \
|
||||
safe-read.c save-cwd.c savedir.c stripslash.c userspec.c xgetcwd.c \
|
||||
xmalloc.c xstrdup.c xstrtol.c xstrtoul.c yesno.c
|
||||
|
||||
libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
|
||||
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
|
||||
|
||||
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
|
||||
getline.h getopt.h group-member.h long-options.h makepath.h modechange.h \
|
||||
mountlist.h path-concat.h pathmax.h \
|
||||
save-cwd.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
libfu_a_OBJECTS = getdate.o posixtm.o getopt.o getopt1.o argmatch.o \
|
||||
backupfile.o dirname.o filemode.o full-write.o getversion.o idcache.o \
|
||||
isdir.o long-options.o makepath.o modechange.o path-concat.o \
|
||||
safe-read.o save-cwd.o savedir.o stripslash.o userspec.o xgetcwd.o \
|
||||
xmalloc.o xstrdup.o xstrtol.o xstrtoul.o yesno.o
|
||||
AR = ar
|
||||
INTERLOCK = ./interlock
|
||||
YLWRAP = ./ylwrap
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK = $(CC) $(LDFLAGS) -o $@
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in alloca.c basename.c error.c \
|
||||
error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
|
||||
getdate.c getgroups.c getline.c group-member.c interlock memcmp.c \
|
||||
memcpy.c memset.c mkdir.c mktime.c mountlist.c obstack.c obstack.h \
|
||||
posixtm.c regex.c regex.h rename.c rmdir.c rpmatch.c rx.c rx.h stpcpy.c \
|
||||
strcasecmp.c strdup.c strndup.c strstr.c strtol.c strtoul.c ylwrap
|
||||
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \
|
||||
$(TEXINFOS) $(MANS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
DEP_FILES = .deps/alloca.P .deps/argmatch.P .deps/backupfile.P \
|
||||
.deps/basename.P .deps/dirname.P .deps/error.P .deps/euidaccess.P \
|
||||
.deps/fileblocks.P .deps/filemode.P .deps/fnmatch.P .deps/fsusage.P \
|
||||
.deps/ftruncate.P .deps/full-write.P .deps/getdate.P .deps/getgroups.P \
|
||||
.deps/getline.P .deps/getopt.P .deps/getopt1.P .deps/getversion.P \
|
||||
.deps/group-member.P .deps/idcache.P .deps/isdir.P .deps/long-options.P \
|
||||
.deps/makepath.P .deps/memcmp.P .deps/memcpy.P .deps/memset.P \
|
||||
.deps/mkdir.P .deps/mktime.P .deps/modechange.P .deps/mountlist.P \
|
||||
.deps/obstack.P .deps/path-concat.P .deps/posixtm.P .deps/regex.P \
|
||||
.deps/rename.P .deps/rmdir.P .deps/rpmatch.P .deps/rx.P \
|
||||
.deps/safe-read.P .deps/save-cwd.P .deps/savedir.P .deps/stpcpy.P \
|
||||
.deps/strcasecmp.P .deps/strdup.P .deps/stripslash.P .deps/strndup.P \
|
||||
.deps/strstr.P .deps/strtol.P .deps/strtoul.P .deps/userspec.P \
|
||||
.deps/xgetcwd.P .deps/xmalloc.P .deps/xstrdup.P .deps/xstrtol.P \
|
||||
.deps/xstrtoul.P .deps/yesno.P
|
||||
SOURCES = $(libfu_a_SOURCES)
|
||||
OBJECTS = $(libfu_a_OBJECTS)
|
||||
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .y
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL)
|
||||
cd $(top_srcdir) && automake --gnu lib/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-noinstLIBRARIES:
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
|
||||
distclean-noinstLIBRARIES:
|
||||
|
||||
maintainer-clean-noinstLIBRARIES:
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -I$(srcdir) $<
|
||||
$(COMPILE) -c $<
|
||||
|
||||
install: all
|
||||
mostlyclean-compile:
|
||||
rm -f *.o core
|
||||
|
||||
uninstall:
|
||||
clean-compile:
|
||||
|
||||
TAGS: $(SOURCES)
|
||||
etags $(SOURCES)
|
||||
distclean-compile:
|
||||
rm -f *.tab.c
|
||||
|
||||
clean:
|
||||
rm -f *.a *.o
|
||||
maintainer-clean-compile:
|
||||
$(libfu_a_OBJECTS): ../config.h
|
||||
|
||||
mostlyclean: clean
|
||||
libfu.a: $(libfu_a_OBJECTS) $(libfu_a_DEPENDENCIES)
|
||||
rm -f libfu.a
|
||||
$(AR) cru libfu.a $(libfu_a_OBJECTS) $(libfu_a_LIBADD)
|
||||
$(RANLIB) libfu.a
|
||||
.y.c:
|
||||
$(SHELL) $(INTERLOCK) =yacclockdir $(YLWRAP) "$(YACC)" y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS) $<
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile *.tab.c getdate.c *posixtm.c
|
||||
tags: TAGS
|
||||
|
||||
realclean: distclean
|
||||
rm -f TAGS
|
||||
ID: $(HEADERS) $(SOURCES)
|
||||
here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
|
||||
|
||||
dist:
|
||||
ln $(DISTFILES) ../`cat ../.fname`/lib
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list="$(SUBDIRS)"; for subdir in $$list; do \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
done; \
|
||||
test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \
|
||||
|| cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS
|
||||
|
||||
libfu.a: $(OBJECTS)
|
||||
rm -f $@
|
||||
$(AR) cr $@ $(OBJECTS)
|
||||
-$(RANLIB) $@
|
||||
mostlyclean-tags:
|
||||
|
||||
# Since this directory contains two parsers, using bison without -y
|
||||
# is the only way to reliably do a parallel make.
|
||||
getdate.c: getdate.y
|
||||
@echo expect 9 shift/reduce conflicts
|
||||
-bison -o getdate.c $(srcdir)/getdate.y || yacc $(srcdir)/getdate.y
|
||||
test ! -f y.tab.c || mv y.tab.c getdate.c
|
||||
clean-tags:
|
||||
|
||||
# Make the rename atomic, in case sed is interrupted and later rerun.
|
||||
posixtm.c: posixtm.y
|
||||
-bison -o posixtm.tab.c $(srcdir)/posixtm.y || yacc $(srcdir)/posixtm.y
|
||||
test ! -f y.tab.c || mv y.tab.c posixtm.tab.c
|
||||
sed -e 's/yy/zz/g' posixtm.tab.c > tposixtm.c
|
||||
mv tposixtm.c posixtm.c
|
||||
rm -f posixtm.tab.c
|
||||
distclean-tags:
|
||||
rm -f TAGS ID
|
||||
|
||||
backupfile.o getversion.o: backupfile.h
|
||||
fnmatch.o: fnmatch.h
|
||||
fsusage.o: fsusage.h
|
||||
getopt1.o: getopt.h
|
||||
modechange.o: modechange.h
|
||||
mountlist.o: mountlist.h
|
||||
xgetcwd.o: pathmax.h
|
||||
maintainer-clean-tags:
|
||||
|
||||
# Prevent GNU make v3 from overflowing arg limit on SysV.
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = lib
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
|
||||
MKDEP = gcc -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
|
||||
-include .deps/.P
|
||||
.deps/.P:
|
||||
test -d .deps || mkdir .deps
|
||||
echo > $@
|
||||
|
||||
-include $(DEP_FILES)
|
||||
$(DEP_FILES): .deps/.P
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
|
||||
maintainer-clean-depend:
|
||||
rm -rf .deps
|
||||
|
||||
.deps/%.P: $(srcdir)/%.c
|
||||
@echo "Computing dependencies for $<..."
|
||||
@o='o'; \
|
||||
test -n "$o" && o='$$o'; \
|
||||
$(MKDEP) $< | sed "s/^\(.*\)\.o:/\1.$$o \1.l$$o:/" > $@
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall:
|
||||
|
||||
all: $(LIBRARIES) $(BUILT_SOURCES) $(HEADERS) Makefile
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
rm -f Makefile $(DISTCLEANFILES)
|
||||
rm -f config.cache config.log stamp-h
|
||||
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-noinstLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-tags mostlyclean-depend mostlyclean-generic
|
||||
|
||||
clean: clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
|
||||
clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \
|
||||
distclean-depend distclean-generic clean
|
||||
rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-noinstLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-tags \
|
||||
maintainer-clean-depend maintainer-clean-generic \
|
||||
distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
|
||||
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
|
||||
distclean-depend clean-depend maintainer-clean-depend info dvi \
|
||||
installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
496
lib/alloca.c
496
lib/alloca.c
@@ -1,37 +1,42 @@
|
||||
/*
|
||||
alloca -- (mostly) portable public-domain implementation -- D A Gwyn
|
||||
/* alloca.c -- allocate automatically reclaimed memory
|
||||
(Mostly) portable public-domain implementation -- D A Gwyn
|
||||
|
||||
last edit: 86/05/30 rms
|
||||
include config.h, since on VMS it renames some symbols.
|
||||
Use xmalloc instead of malloc.
|
||||
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.
|
||||
|
||||
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.
|
||||
There are some preprocessor constants that can
|
||||
be defined when compiling for your specific system, for
|
||||
improved efficiency; however, the defaults should be okay.
|
||||
|
||||
It should work under any C implementation that uses an
|
||||
actual procedure stack (as opposed to a linked list of
|
||||
frames). 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.
|
||||
|
||||
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. */
|
||||
|
||||
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.
|
||||
*/
|
||||
#ifndef lint
|
||||
static char SCCSid[] = "@(#)alloca.c 1.1"; /* for the "what" utility */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef emacs
|
||||
#include "config.h"
|
||||
#include "blockinput.h"
|
||||
#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
|
||||
@@ -45,72 +50,90 @@ lose
|
||||
#endif /* static */
|
||||
#endif /* emacs */
|
||||
|
||||
#ifndef alloca /* If compiling with GCC, this file's not needed. */
|
||||
/* If your stack is a linked list of frames, you have to
|
||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||
|
||||
#ifdef __STDC__
|
||||
typedef void *pointer; /* generic pointer type */
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
long i00afunc ();
|
||||
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
#else
|
||||
typedef char *pointer; /* generic pointer type */
|
||||
#define ADDRESS_FUNCTION(arg) &(arg)
|
||||
#endif
|
||||
|
||||
#define NULL 0 /* null pointer constant */
|
||||
#if __STDC__
|
||||
typedef void *pointer;
|
||||
#else
|
||||
typedef char *pointer;
|
||||
#endif
|
||||
|
||||
extern void free();
|
||||
extern pointer xmalloc();
|
||||
#define NULL 0
|
||||
|
||||
/*
|
||||
Define STACK_DIRECTION if you know the direction of stack
|
||||
growth for your system; otherwise it will be automatically
|
||||
deduced at run-time.
|
||||
/* Different portions of Emacs need to call different versions of
|
||||
malloc. The Emacs executable needs alloca to call xmalloc, because
|
||||
ordinary malloc isn't protected from input signals. On the other
|
||||
hand, the utilities in lib-src need alloca to call malloc; some of
|
||||
them are very simple, and don't have an xmalloc routine.
|
||||
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
Non-Emacs programs expect this to call xmalloc.
|
||||
|
||||
Callers below should use malloc. */
|
||||
|
||||
#ifndef emacs
|
||||
#define malloc xmalloc
|
||||
#endif
|
||||
extern pointer malloc ();
|
||||
|
||||
/* 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 */
|
||||
#define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
#endif
|
||||
|
||||
#if STACK_DIRECTION != 0
|
||||
|
||||
#define STACK_DIR STACK_DIRECTION /* known at compile-time */
|
||||
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
|
||||
#else /* STACK_DIRECTION == 0; need run-time code */
|
||||
#else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
|
||||
static int stack_dir; /* 1 or -1 once known */
|
||||
static int stack_dir; /* 1 or -1 once known. */
|
||||
#define STACK_DIR stack_dir
|
||||
|
||||
static void
|
||||
find_stack_direction (/* void */)
|
||||
find_stack_direction ()
|
||||
{
|
||||
static char *addr = NULL; /* address of first
|
||||
`dummy', once known */
|
||||
auto char dummy; /* to get stack address */
|
||||
static char *addr = NULL; /* Address of first `dummy', once known. */
|
||||
auto char dummy; /* To get stack address. */
|
||||
|
||||
if (addr == NULL)
|
||||
{ /* initial entry */
|
||||
addr = &dummy;
|
||||
{ /* Initial entry. */
|
||||
addr = ADDRESS_FUNCTION (dummy);
|
||||
|
||||
find_stack_direction (); /* recurse once */
|
||||
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. */
|
||||
}
|
||||
else /* second entry */
|
||||
if (&dummy > addr)
|
||||
stack_dir = 1; /* stack grew upward */
|
||||
else
|
||||
stack_dir = -1; /* stack grew downward */
|
||||
}
|
||||
|
||||
#endif /* STACK_DIRECTION == 0 */
|
||||
#endif /* STACK_DIRECTION == 0 */
|
||||
|
||||
/*
|
||||
An "alloca header" is used to:
|
||||
(a) chain together all alloca()ed blocks;
|
||||
(b) keep track of stack depth.
|
||||
/* 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.
|
||||
*/
|
||||
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)
|
||||
@@ -118,77 +141,352 @@ find_stack_direction (/* void */)
|
||||
|
||||
typedef union hdr
|
||||
{
|
||||
char align[ALIGN_SIZE]; /* to force sizeof(header) */
|
||||
char align[ALIGN_SIZE]; /* To force sizeof(header). */
|
||||
struct
|
||||
{
|
||||
union hdr *next; /* for chaining headers */
|
||||
char *deep; /* for stack depth measure */
|
||||
union hdr *next; /* For chaining headers. */
|
||||
char *deep; /* For stack depth measure. */
|
||||
} h;
|
||||
} header;
|
||||
|
||||
/*
|
||||
alloca( size ) returns 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.
|
||||
*/
|
||||
static header *last_alloca_header = NULL; /* -> last alloca 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. */
|
||||
|
||||
pointer
|
||||
alloca (size) /* returns pointer to storage */
|
||||
unsigned size; /* # bytes to allocate */
|
||||
alloca (size)
|
||||
unsigned size;
|
||||
{
|
||||
auto char probe; /* probes stack depth: */
|
||||
register char *depth = &probe;
|
||||
auto char probe; /* Probes stack depth: */
|
||||
register char *depth = ADDRESS_FUNCTION (probe);
|
||||
|
||||
#if STACK_DIRECTION == 0
|
||||
if (STACK_DIR == 0) /* unknown growth direction */
|
||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||
find_stack_direction ();
|
||||
#endif
|
||||
|
||||
/* Reclaim garbage, defined as all alloca()ed storage that
|
||||
was allocated from deeper in the stack than currently. */
|
||||
/* Reclaim garbage, defined as all alloca'd storage that
|
||||
was allocated from deeper in the stack than currently. */
|
||||
|
||||
{
|
||||
register header *hp; /* traverses linked list */
|
||||
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;
|
||||
register header *np = hp->h.next;
|
||||
|
||||
free ((pointer) hp); /* collect garbage */
|
||||
free ((pointer) hp); /* Collect garbage. */
|
||||
|
||||
hp = np; /* -> next header */
|
||||
hp = np; /* -> next header. */
|
||||
}
|
||||
else
|
||||
break; /* rest are not deeper */
|
||||
break; /* Rest are not deeper. */
|
||||
|
||||
last_alloca_header = hp; /* -> last valid storage */
|
||||
last_alloca_header = hp; /* -> last valid storage. */
|
||||
|
||||
#ifdef emacs
|
||||
UNBLOCK_INPUT;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
return NULL; /* no allocation required */
|
||||
return NULL; /* No allocation required. */
|
||||
|
||||
/* Allocate combined header + user data storage. */
|
||||
/* Allocate combined header + user data storage. */
|
||||
|
||||
{
|
||||
register pointer new = xmalloc (sizeof (header) + size);
|
||||
/* address of header */
|
||||
register pointer new = malloc (sizeof (header) + size);
|
||||
/* Address of header. */
|
||||
|
||||
((header *)new)->h.next = last_alloca_header;
|
||||
((header *)new)->h.deep = depth;
|
||||
((header *) new)->h.next = last_alloca_header;
|
||||
((header *) new)->h.deep = depth;
|
||||
|
||||
last_alloca_header = (header *)new;
|
||||
last_alloca_header = (header *) new;
|
||||
|
||||
/* User storage begins just after header. */
|
||||
/* User storage begins just after header. */
|
||||
|
||||
return (pointer)((char *)new + sizeof(header));
|
||||
return (pointer) ((char *) new + sizeof (header));
|
||||
}
|
||||
}
|
||||
|
||||
#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 2 */
|
||||
|
||||
@@ -12,14 +12,20 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@ai.mit.edu> */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef STDC_HEADERS
|
||||
#include <string.h>
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
extern char *program_name;
|
||||
@@ -31,16 +37,16 @@ extern char *program_name;
|
||||
|
||||
int
|
||||
argmatch (arg, optlist)
|
||||
char *arg;
|
||||
char **optlist;
|
||||
const char *arg;
|
||||
const char *const *optlist;
|
||||
{
|
||||
int i; /* Temporary index in OPTLIST. */
|
||||
int arglen; /* Length of ARG. */
|
||||
size_t arglen; /* Length of ARG. */
|
||||
int matchind = -1; /* Index of first nonexact match. */
|
||||
int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */
|
||||
|
||||
|
||||
arglen = strlen (arg);
|
||||
|
||||
|
||||
/* Test all elements for either exact match or abbreviated matches. */
|
||||
for (i = 0; optlist[i]; i++)
|
||||
{
|
||||
@@ -70,8 +76,8 @@ argmatch (arg, optlist)
|
||||
|
||||
void
|
||||
invalid_arg (kind, value, problem)
|
||||
char *kind;
|
||||
char *value;
|
||||
const char *kind;
|
||||
const char *value;
|
||||
int problem;
|
||||
{
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
|
||||
18
lib/argmatch.h
Normal file
18
lib/argmatch.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef ARGMATCH_H
|
||||
#define ARGMATCH_H 1
|
||||
|
||||
#ifndef __P
|
||||
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
# define __P(args) args
|
||||
# else
|
||||
# define __P(args) ()
|
||||
# endif /* GCC. */
|
||||
#endif /* Not __P. */
|
||||
|
||||
int
|
||||
argmatch __P ((const char *arg, const char *const *optlist));
|
||||
|
||||
void
|
||||
invalid_arg __P ((const char *kind, const char *value, int problem));
|
||||
|
||||
#endif /* ARGMATCH_H */
|
||||
113
lib/backupfile.c
113
lib/backupfile.c
@@ -12,63 +12,74 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* David MacKenzie <djm@ai.mit.edu>.
|
||||
/* David MacKenzie <djm@gnu.ai.mit.edu>.
|
||||
Some algorithms adapted from GNU Emacs. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include "backupfile.h"
|
||||
#if defined(USG) || defined(STDC_HEADERS)
|
||||
#include <string.h>
|
||||
#define index strchr
|
||||
#define rindex strrchr
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifdef DIRENT
|
||||
#include <dirent.h>
|
||||
#ifdef direct
|
||||
#undef direct
|
||||
#endif
|
||||
#define direct dirent
|
||||
#define NLENGTH(direct) (strlen((direct)->d_name))
|
||||
#else /* !DIRENT */
|
||||
#define NLENGTH(direct) ((direct)->d_namlen)
|
||||
#ifdef USG
|
||||
#ifdef SYSNDIR
|
||||
#include <sys/ndir.h>
|
||||
#else /* !SYSNDIR */
|
||||
#include <ndir.h>
|
||||
#endif /* !SYSNDIR */
|
||||
#else /* !USG */
|
||||
#include <sys/dir.h>
|
||||
#endif /* !USG */
|
||||
#endif /* !DIRENT */
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
# define NLENGTH(direct) (strlen((direct)->d_name))
|
||||
#else /* not HAVE_DIRENT_H */
|
||||
# define dirent direct
|
||||
# define NLENGTH(direct) ((direct)->d_namlen)
|
||||
# ifdef HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif /* HAVE_SYS_NDIR_H */
|
||||
# ifdef HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif /* HAVE_SYS_DIR_H */
|
||||
# ifdef HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif /* HAVE_NDIR_H */
|
||||
#endif /* HAVE_DIRENT_H */
|
||||
|
||||
#ifdef VOID_CLOSEDIR
|
||||
#ifdef CLOSEDIR_VOID
|
||||
/* Fake a return value. */
|
||||
#define CLOSEDIR(d) (closedir (d), 0)
|
||||
# define CLOSEDIR(d) (closedir (d), 0)
|
||||
#else
|
||||
#define CLOSEDIR(d) closedir (d)
|
||||
# define CLOSEDIR(d) closedir (d)
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
char *malloc ();
|
||||
#endif
|
||||
|
||||
#ifndef isascii
|
||||
#define ISDIGIT(c) (isdigit ((unsigned char) (c)))
|
||||
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
|
||||
# define IN_CTYPE_DOMAIN(c) 1
|
||||
#else
|
||||
#define ISDIGIT(c) (isascii (c) && isdigit (c))
|
||||
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||
#endif
|
||||
|
||||
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
||||
|
||||
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
|
||||
- Its arg may be any int or unsigned int; it need not be an unsigned char.
|
||||
- It's guaranteed to evaluate its argument exactly once.
|
||||
- It's typically faster.
|
||||
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
|
||||
only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
|
||||
it's important to use the locale's definition of `digit' even when the
|
||||
host does not conform to Posix. */
|
||||
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -76,9 +87,9 @@ char *malloc ();
|
||||
#if defined (_POSIX_VERSION)
|
||||
/* POSIX does not require that the d_ino field be present, and some
|
||||
systems do not provide it. */
|
||||
#define REAL_DIR_ENTRY(dp) 1
|
||||
# define REAL_DIR_ENTRY(dp) 1
|
||||
#else
|
||||
#define REAL_DIR_ENTRY(dp) ((dp)->d_ino != 0)
|
||||
# define REAL_DIR_ENTRY(dp) ((dp)->d_ino != 0)
|
||||
#endif
|
||||
|
||||
/* Which type of backup file names are generated. */
|
||||
@@ -103,7 +114,7 @@ static int version_number ();
|
||||
|
||||
char *
|
||||
find_backup_file_name (file)
|
||||
char *file;
|
||||
const char *file;
|
||||
{
|
||||
char *dir;
|
||||
char *base_versions;
|
||||
@@ -135,18 +146,19 @@ find_backup_file_name (file)
|
||||
|
||||
static int
|
||||
max_backup_version (file, dir)
|
||||
char *file, *dir;
|
||||
const char *file;
|
||||
const char *dir;
|
||||
{
|
||||
DIR *dirp;
|
||||
struct direct *dp;
|
||||
struct dirent *dp;
|
||||
int highest_version;
|
||||
int this_version;
|
||||
int file_name_length;
|
||||
|
||||
size_t file_name_length;
|
||||
|
||||
dirp = opendir (dir);
|
||||
if (!dirp)
|
||||
return 0;
|
||||
|
||||
|
||||
highest_version = 0;
|
||||
file_name_length = strlen (file);
|
||||
|
||||
@@ -154,7 +166,7 @@ max_backup_version (file, dir)
|
||||
{
|
||||
if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) <= file_name_length)
|
||||
continue;
|
||||
|
||||
|
||||
this_version = version_number (file, dp->d_name, file_name_length);
|
||||
if (this_version > highest_version)
|
||||
highest_version = this_version;
|
||||
@@ -169,7 +181,7 @@ max_backup_version (file, dir)
|
||||
|
||||
static char *
|
||||
make_version_name (file, version)
|
||||
char *file;
|
||||
const char *file;
|
||||
int version;
|
||||
{
|
||||
char *backup_name;
|
||||
@@ -187,13 +199,13 @@ make_version_name (file, version)
|
||||
|
||||
static int
|
||||
version_number (base, backup, base_length)
|
||||
char *base;
|
||||
char *backup;
|
||||
const char *base;
|
||||
const char *backup;
|
||||
int base_length;
|
||||
{
|
||||
int version;
|
||||
char *p;
|
||||
|
||||
const char *p;
|
||||
|
||||
version = 0;
|
||||
if (!strncmp (base, backup, base_length) && ISDIGIT (backup[base_length]))
|
||||
{
|
||||
@@ -210,10 +222,11 @@ version_number (base, backup, base_length)
|
||||
|
||||
static char *
|
||||
concat (str1, str2)
|
||||
char *str1, *str2;
|
||||
const char *str1;
|
||||
const char *str2;
|
||||
{
|
||||
char *newstr;
|
||||
char str1_length = strlen (str1);
|
||||
int str1_length = strlen (str1);
|
||||
|
||||
newstr = malloc (str1_length + strlen (str2) + 1);
|
||||
if (newstr == 0)
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* When to make backup files. */
|
||||
enum backup_type
|
||||
@@ -36,7 +36,7 @@ extern enum backup_type backup_type;
|
||||
extern char *simple_backup_suffix;
|
||||
|
||||
#ifdef __STDC__
|
||||
char *find_backup_file_name (char *file);
|
||||
char *find_backup_file_name (const char *file);
|
||||
#else
|
||||
char *find_backup_file_name ();
|
||||
#endif
|
||||
|
||||
@@ -12,24 +12,27 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if defined(USG) || defined(STDC_HEADERS)
|
||||
#include <string.h>
|
||||
#define rindex strrchr
|
||||
#else
|
||||
#include <strings.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Return NAME with any leading path stripped off. */
|
||||
/* Return NAME with any leading path stripped off.
|
||||
Don't use strrchr/rindex. */
|
||||
|
||||
char *
|
||||
basename (name)
|
||||
char *name;
|
||||
const char *name;
|
||||
{
|
||||
char *base;
|
||||
const char *base = name;
|
||||
|
||||
base = rindex (name, '/');
|
||||
return base ? base + 1 : name;
|
||||
while (*name)
|
||||
{
|
||||
if (*name == '/')
|
||||
base = name + 1;
|
||||
++name;
|
||||
}
|
||||
return (char *) base;
|
||||
}
|
||||
|
||||
81
lib/canon-host.c
Normal file
81
lib/canon-host.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/* Host name canonicalization
|
||||
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
/* Returns the canonical hostname associated with HOST (allocated in a static
|
||||
buffer), or 0 if it can't be determined. */
|
||||
char *
|
||||
canon_host (host)
|
||||
char *host;
|
||||
{
|
||||
#ifdef HAVE_GETHOSTBYNAME
|
||||
struct hostent *he = gethostbyname (host);
|
||||
|
||||
if (he)
|
||||
{
|
||||
# ifdef HAVE_GETHOSTBYADDR
|
||||
char *addr = 0;
|
||||
|
||||
/* Try and get an ascii version of the numeric host address. */
|
||||
switch (he->h_addrtype)
|
||||
{
|
||||
# ifdef HAVE_INET_NTOA
|
||||
case AF_INET:
|
||||
addr = inet_ntoa (*(struct in_addr *) he->h_addr);
|
||||
break;
|
||||
# endif /* HAVE_INET_NTOA */
|
||||
}
|
||||
|
||||
if (addr && strcmp (he->h_name, addr) == 0)
|
||||
/* gethostbyname() cheated! Lookup the host name via the address
|
||||
this time to get the actual host name. */
|
||||
he = gethostbyaddr (he->h_addr, he->h_length, he->h_addrtype);
|
||||
# endif /* HAVE_GETHOSTBYADDR */
|
||||
|
||||
if (he)
|
||||
return (char *) (he->h_name);
|
||||
}
|
||||
#endif /* HAVE_GETHOSTBYNAME */
|
||||
return 0;
|
||||
}
|
||||
@@ -12,19 +12,25 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
char *malloc ();
|
||||
#endif
|
||||
#if defined(USG) || defined(STDC_HEADERS)
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
#include <string.h>
|
||||
#define rindex strrchr
|
||||
#else
|
||||
#include <strings.h>
|
||||
#ifndef strrchr
|
||||
#define strrchr rindex
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Return the leading directories part of PATH,
|
||||
@@ -40,7 +46,7 @@ dirname (path)
|
||||
char *slash;
|
||||
int length; /* Length of result, not including NUL. */
|
||||
|
||||
slash = rindex (path, '/');
|
||||
slash = strrchr (path, '/');
|
||||
if (slash == 0)
|
||||
{
|
||||
/* File is in the current directory. */
|
||||
@@ -55,7 +61,7 @@ dirname (path)
|
||||
|
||||
length = slash - path + 1;
|
||||
}
|
||||
newpath = malloc (length + 1);
|
||||
newpath = (char *) malloc (length + 1);
|
||||
if (newpath == 0)
|
||||
return 0;
|
||||
strncpy (newpath, path, length);
|
||||
|
||||
206
lib/error.c
206
lib/error.c
@@ -1,5 +1,5 @@
|
||||
/* error.c -- error handler for noninteractive utilities
|
||||
Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96 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
|
||||
@@ -12,43 +12,73 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie. */
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_VPRINTF
|
||||
#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
|
||||
# if __STDC__
|
||||
# include <stdarg.h>
|
||||
# define VA_START(args, lastarg) va_start(args, lastarg)
|
||||
# else
|
||||
# include <varargs.h>
|
||||
# define VA_START(args, lastarg) va_start(args)
|
||||
# endif
|
||||
#else
|
||||
# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
|
||||
# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
|
||||
#endif
|
||||
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#define VA_START(args, lastarg) va_start(args, lastarg)
|
||||
#else /* !__STDC__ */
|
||||
#include <varargs.h>
|
||||
#define VA_START(args, lastarg) va_start(args)
|
||||
#endif /* !__STDC__ */
|
||||
|
||||
#else /* !HAVE_VPRINTF */
|
||||
|
||||
#ifdef HAVE_DOPRNT
|
||||
#define va_alist args
|
||||
#define va_dcl int args;
|
||||
#else /* !HAVE_DOPRNT */
|
||||
#define va_alist a1, a2, a3, a4, a5, a6, a7, a8
|
||||
#define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
|
||||
#endif /* !HAVE_DOPRNT */
|
||||
|
||||
#endif /* !HAVE_VPRINTF */
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#else /* !STDC_HEADERS */
|
||||
#if STDC_HEADERS || _LIBC
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#else
|
||||
void exit ();
|
||||
#endif /* !STDC_HEADERS */
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
#ifndef _
|
||||
# define _(String) String
|
||||
#endif
|
||||
|
||||
/* Get prototypes for the functions defined here. */
|
||||
#include <error.h>
|
||||
|
||||
/* If NULL, error will flush stdout, then print on stderr the program
|
||||
name, a colon and a space. Otherwise, error will call this
|
||||
function without parameters instead. */
|
||||
void (*error_print_progname) (
|
||||
#if __STDC__ - 0
|
||||
void
|
||||
#endif
|
||||
);
|
||||
|
||||
/* 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>
|
||||
|
||||
#else /* not _LIBC */
|
||||
|
||||
/* The calling program should define program_name and set it to the
|
||||
name of the executing program. */
|
||||
extern char *program_name;
|
||||
|
||||
# if HAVE_STRERROR
|
||||
# ifndef strerror /* On some systems, strerror is a macro */
|
||||
char *strerror ();
|
||||
# endif
|
||||
# else
|
||||
static char *
|
||||
private_strerror (errnum)
|
||||
int errnum;
|
||||
@@ -58,44 +88,122 @@ private_strerror (errnum)
|
||||
|
||||
if (errnum > 0 && errnum <= sys_nerr)
|
||||
return sys_errlist[errnum];
|
||||
return "Unknown system error";
|
||||
return _("Unknown system error");
|
||||
}
|
||||
#define strerror private_strerror
|
||||
#endif /* !HAVE_STRERROR */
|
||||
# define strerror private_strerror
|
||||
# endif /* HAVE_STRERROR */
|
||||
#endif /* not _LIBC */
|
||||
|
||||
/* Print the program name and error message MESSAGE, which is a printf-style
|
||||
format string with optional args.
|
||||
If ERRNUM is nonzero, print its corresponding system error message.
|
||||
Exit with status STATUS if it is nonzero. */
|
||||
/* VARARGS */
|
||||
|
||||
void
|
||||
#if defined (HAVE_VPRINTF) && __STDC__
|
||||
error (int status, int errnum, char *message, ...)
|
||||
#else /* !HAVE_VPRINTF or !__STDC__ */
|
||||
#if defined(VA_START) && __STDC__
|
||||
error (int status, int errnum, const char *message, ...)
|
||||
#else
|
||||
error (status, errnum, message, va_alist)
|
||||
int status;
|
||||
int errnum;
|
||||
char *message;
|
||||
va_dcl
|
||||
#endif /* !HAVE_VPRINTF or !__STDC__ */
|
||||
#endif
|
||||
{
|
||||
extern char *program_name;
|
||||
#ifdef HAVE_VPRINTF
|
||||
#ifdef VA_START
|
||||
va_list args;
|
||||
#endif /* HAVE_VPRINTF */
|
||||
#endif
|
||||
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
#ifdef HAVE_VPRINTF
|
||||
if (error_print_progname)
|
||||
(*error_print_progname) ();
|
||||
else
|
||||
{
|
||||
fflush (stdout);
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
}
|
||||
|
||||
#ifdef VA_START
|
||||
VA_START (args, message);
|
||||
# if HAVE_VPRINTF || _LIBC
|
||||
vfprintf (stderr, message, args);
|
||||
# else
|
||||
_doprnt (message, args, stderr);
|
||||
# endif
|
||||
va_end (args);
|
||||
#else /* !HAVE_VPRINTF */
|
||||
#ifdef HAVE_DOPRNT
|
||||
_doprnt (message, &args, stderr);
|
||||
#else /* !HAVE_DOPRNT */
|
||||
#else
|
||||
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
#endif /* !HAVE_DOPRNT */
|
||||
#endif /* !HAVE_VPRINTF */
|
||||
#endif
|
||||
|
||||
++error_message_count;
|
||||
if (errnum)
|
||||
fprintf (stderr, ": %s", strerror (errnum));
|
||||
putc ('\n', stderr);
|
||||
fflush (stderr);
|
||||
if (status)
|
||||
exit (status);
|
||||
}
|
||||
|
||||
/* 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
|
||||
#if defined(VA_START) && __STDC__
|
||||
error_at_line (int status, int errnum, const char *file_name,
|
||||
unsigned int line_number, const char *message, ...)
|
||||
#else
|
||||
error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
||||
int status;
|
||||
int errnum;
|
||||
const char *file_name;
|
||||
unsigned int line_number;
|
||||
char *message;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
#ifdef VA_START
|
||||
va_list args;
|
||||
#endif
|
||||
|
||||
if (error_one_per_line)
|
||||
{
|
||||
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)))
|
||||
/* Simply return and print nothing. */
|
||||
return;
|
||||
|
||||
old_file_name = file_name;
|
||||
old_line_number = line_number;
|
||||
}
|
||||
|
||||
if (error_print_progname)
|
||||
(*error_print_progname) ();
|
||||
else
|
||||
{
|
||||
fflush (stdout);
|
||||
fprintf (stderr, "%s:", program_name);
|
||||
}
|
||||
|
||||
if (file_name != NULL)
|
||||
fprintf (stderr, "%s:%d: ", file_name, line_number);
|
||||
|
||||
#ifdef VA_START
|
||||
VA_START (args, message);
|
||||
# if HAVE_VPRINTF || _LIBC
|
||||
vfprintf (stderr, message, args);
|
||||
# else
|
||||
_doprnt (message, args, stderr);
|
||||
# endif
|
||||
va_end (args);
|
||||
#else
|
||||
fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
#endif
|
||||
|
||||
++error_message_count;
|
||||
if (errnum)
|
||||
fprintf (stderr, ": %s", strerror (errnum));
|
||||
putc ('\n', stderr);
|
||||
|
||||
65
lib/error.h
Normal file
65
lib/error.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* error.h -- declaration for error-reporting function
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef ERROR_H_
|
||||
# define ERROR_H_
|
||||
|
||||
# ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
||||
# 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
|
||||
|
||||
# if defined (__STDC__) && __STDC__
|
||||
|
||||
/* Print a message with `fprintf (stderr, FORMAT, ...)';
|
||||
if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
|
||||
If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
|
||||
|
||||
extern void error (int status, int errnum, const char *format, ...)
|
||||
__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);
|
||||
|
||||
# else
|
||||
void error ();
|
||||
void error_at_line ();
|
||||
extern void (*error_print_progname) ();
|
||||
# endif
|
||||
|
||||
/* This variable is incremented each time `error' is called. */
|
||||
extern unsigned int error_message_count;
|
||||
|
||||
/* 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;
|
||||
|
||||
#endif /* not ERROR_H_ */
|
||||
182
lib/euidaccess.c
Normal file
182
lib/euidaccess.c
Normal file
@@ -0,0 +1,182 @@
|
||||
/* euidaccess -- check if effective user id can access file
|
||||
Copyright (C) 1990, 1991, 1995 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 59 Temple Place -
|
||||
Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie and Torbjorn Granlund.
|
||||
Adapted for GNU C library by Roland McGrath. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef S_IEXEC
|
||||
# ifndef S_IXUSR
|
||||
# define S_IXUSR S_IEXEC
|
||||
# endif
|
||||
# ifndef S_IXGRP
|
||||
# define S_IXGRP (S_IEXEC >> 3)
|
||||
# endif
|
||||
# ifndef S_IXOTH
|
||||
# define S_IXOTH (S_IEXEC >> 6)
|
||||
# endif
|
||||
#endif /* S_IEXEC */
|
||||
|
||||
#if defined (HAVE_UNISTD_H) || defined (_LIBC)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
# include <limits.h>
|
||||
# if !defined(NGROUPS_MAX) || NGROUPS_MAX < 1
|
||||
# undef NGROUPS_MAX
|
||||
# define NGROUPS_MAX sysconf (_SC_NGROUPS_MAX)
|
||||
# endif /* NGROUPS_MAX */
|
||||
|
||||
#else /* not _POSIX_VERSION */
|
||||
uid_t getuid ();
|
||||
gid_t getgid ();
|
||||
uid_t geteuid ();
|
||||
gid_t getegid ();
|
||||
# include <sys/param.h>
|
||||
# if !defined(NGROUPS_MAX) && defined(NGROUPS)
|
||||
# define NGROUPS_MAX NGROUPS
|
||||
# endif /* not NGROUPS_MAX and NGROUPS */
|
||||
#endif /* not POSIX_VERSION */
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if defined(EACCES) && !defined(EACCESS)
|
||||
# define EACCESS EACCES
|
||||
#endif
|
||||
|
||||
#ifndef F_OK
|
||||
# define F_OK 0
|
||||
# define X_OK 1
|
||||
# define W_OK 2
|
||||
# define R_OK 4
|
||||
#endif
|
||||
|
||||
#if !defined (S_IROTH) && defined (R_OK)
|
||||
# define S_IROTH R_OK
|
||||
#endif
|
||||
|
||||
#if !defined (S_IWOTH) && defined (W_OK)
|
||||
# define S_IWOTH W_OK
|
||||
#endif
|
||||
|
||||
#if !defined (S_IXOTH) && defined (X_OK)
|
||||
# define S_IXOTH X_OK
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
|
||||
# define group_member __group_member
|
||||
|
||||
#else
|
||||
|
||||
/* The user's real user id. */
|
||||
static uid_t uid;
|
||||
|
||||
/* The user's real group id. */
|
||||
static gid_t gid;
|
||||
|
||||
/* The user's effective user id. */
|
||||
static uid_t euid;
|
||||
|
||||
/* The user's effective group id. */
|
||||
static gid_t egid;
|
||||
|
||||
/* Nonzero if UID, GID, EUID, and EGID have valid values. */
|
||||
static int have_ids = 0;
|
||||
|
||||
# ifdef HAVE_GETGROUPS
|
||||
int group_member ();
|
||||
# else
|
||||
# define group_member(gid) 0
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Return 0 if the user has permission of type MODE on file PATH;
|
||||
otherwise, return -1 and set `errno' to EACCESS.
|
||||
Like access, except that it uses the effective user and group
|
||||
id's instead of the real ones, and it does not check for read-only
|
||||
filesystem, text busy, etc. */
|
||||
|
||||
int
|
||||
euidaccess (path, mode)
|
||||
const char *path;
|
||||
int mode;
|
||||
{
|
||||
struct stat stats;
|
||||
int granted;
|
||||
|
||||
#ifdef _LIBC
|
||||
uid_t uid = getuid (), euid = geteuid ();
|
||||
gid_t gid = getgid (), egid = getegid ();
|
||||
#else
|
||||
if (have_ids == 0)
|
||||
{
|
||||
have_ids = 1;
|
||||
uid = getuid ();
|
||||
gid = getgid ();
|
||||
euid = geteuid ();
|
||||
egid = getegid ();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (uid == euid && gid == egid)
|
||||
/* If we are not set-uid or set-gid, access does the same. */
|
||||
return access (path, mode);
|
||||
|
||||
if (stat (path, &stats))
|
||||
return -1;
|
||||
|
||||
mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */
|
||||
#if R_OK != S_IROTH || W_OK != S_IWOTH || X_OK != S_IXOTH
|
||||
?error Oops, portability assumptions incorrect.
|
||||
#endif
|
||||
|
||||
if (mode == F_OK)
|
||||
return 0; /* The file exists. */
|
||||
|
||||
/* The super-user can read and write any file, and execute any file
|
||||
that anyone can execute. */
|
||||
if (euid == 0 && ((mode & X_OK) == 0
|
||||
|| (stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))))
|
||||
return 0;
|
||||
|
||||
if (euid == stats.st_uid)
|
||||
granted = (unsigned) (stats.st_mode & (mode << 6)) >> 6;
|
||||
else if (egid == stats.st_gid || group_member (stats.st_gid))
|
||||
granted = (unsigned) (stats.st_mode & (mode << 3)) >> 3;
|
||||
else
|
||||
granted = (stats.st_mode & mode);
|
||||
if (granted == mode)
|
||||
return 0;
|
||||
errno = EACCESS;
|
||||
return -1;
|
||||
}
|
||||
@@ -12,26 +12,32 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Brian L. Matthews, blm@6sceng.UUCP. */
|
||||
|
||||
#if !defined (HAVE_ST_BLOCKS) && !defined(_POSIX_SOURCE)
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef NINDIR
|
||||
#if !defined (HAVE_ST_BLOCKS) && !defined(_POSIX_VERSION)
|
||||
# include <sys/types.h>
|
||||
# include <sys/param.h>
|
||||
|
||||
# ifndef NINDIR
|
||||
/* Some SysV's, like Irix, seem to lack these. Hope they're correct. */
|
||||
/* Size of a indirect block, in bytes. */
|
||||
#define BSIZE 1024
|
||||
# ifndef BSIZE
|
||||
# define BSIZE 1024
|
||||
# endif
|
||||
|
||||
/* Number of inode pointers per indirect block. */
|
||||
#define NINDIR (BSIZE/sizeof(daddr_t))
|
||||
#endif /* !NINDIR */
|
||||
# define NINDIR (BSIZE/sizeof(daddr_t))
|
||||
# endif /* !NINDIR */
|
||||
|
||||
/* Number of direct block addresses in an inode. */
|
||||
#define NDIR 10
|
||||
# define NDIR 10
|
||||
|
||||
/* Return the number of 512-byte blocks in a file of SIZE bytes. */
|
||||
|
||||
@@ -57,4 +63,8 @@ st_blocks (size)
|
||||
|
||||
return datablks + indrblks;
|
||||
}
|
||||
#else
|
||||
/* This declaration is solely to ensure that after preprocessing
|
||||
this file is never empty. */
|
||||
extern int textutils_fileblocks_unused;
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* filemode.c -- make a string describing file modes
|
||||
Copyright (C) 1985, 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1985, 1990, 1993 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
|
||||
@@ -12,39 +12,73 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef S_IREAD
|
||||
#define S_IREAD S_IRUSR
|
||||
#define S_IWRITE S_IWUSR
|
||||
#define S_IEXEC S_IXUSR
|
||||
|
||||
#if !S_IRUSR
|
||||
# if S_IREAD
|
||||
# define S_IRUSR S_IREAD
|
||||
# else
|
||||
# define S_IRUSR 00400
|
||||
# endif
|
||||
#endif
|
||||
#ifndef S_ISREG /* Doesn't have POSIX.1 stat stuff. */
|
||||
#define mode_t unsigned short
|
||||
|
||||
#if !S_IWUSR
|
||||
# if S_IWRITE
|
||||
# define S_IWUSR S_IWRITE
|
||||
# else
|
||||
# define S_IWUSR 00200
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !S_IXUSR
|
||||
# if S_IEXEC
|
||||
# define S_IXUSR S_IEXEC
|
||||
# else
|
||||
# define S_IXUSR 00100
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef STAT_MACROS_BROKEN
|
||||
#undef S_ISBLK
|
||||
#undef S_ISCHR
|
||||
#undef S_ISDIR
|
||||
#undef S_ISFIFO
|
||||
#undef S_ISLNK
|
||||
#undef S_ISMPB
|
||||
#undef S_ISMPC
|
||||
#undef S_ISNWK
|
||||
#undef S_ISREG
|
||||
#undef S_ISSOCK
|
||||
#endif /* STAT_MACROS_BROKEN. */
|
||||
|
||||
#if !defined(S_ISBLK) && defined(S_IFBLK)
|
||||
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
#endif
|
||||
#if !defined(S_ISCHR) && defined(S_IFCHR)
|
||||
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
||||
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
||||
#endif
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
#if !defined(S_ISREG) && defined(S_IFREG)
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
#if !defined(S_ISFIFO) && defined(S_IFIFO)
|
||||
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
||||
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
||||
#endif
|
||||
#if !defined(S_ISLNK) && defined(S_IFLNK)
|
||||
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
|
||||
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
||||
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
||||
#endif
|
||||
#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
|
||||
#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
|
||||
@@ -111,7 +145,7 @@ mode_string (mode, str)
|
||||
unsigned short mode;
|
||||
char *str;
|
||||
{
|
||||
str[0] = ftypelet (mode);
|
||||
str[0] = ftypelet ((long) mode);
|
||||
rwx ((mode & 0700) << 0, &str[1]);
|
||||
rwx ((mode & 0070) << 3, &str[4]);
|
||||
rwx ((mode & 0007) << 6, &str[7]);
|
||||
@@ -132,7 +166,7 @@ mode_string (mode, str)
|
||||
|
||||
static char
|
||||
ftypelet (bits)
|
||||
mode_t bits;
|
||||
long bits;
|
||||
{
|
||||
#ifdef S_ISBLK
|
||||
if (S_ISBLK (bits))
|
||||
@@ -164,6 +198,17 @@ ftypelet (bits)
|
||||
if (S_ISNWK (bits))
|
||||
return 'n';
|
||||
#endif
|
||||
|
||||
#ifdef S_ISOFD
|
||||
/* Cray migrated dmf file. */
|
||||
if (S_ISOFD (bits))
|
||||
return 'M';
|
||||
#endif
|
||||
#ifdef S_ISOFL
|
||||
/* Cray migrated dmf file. */
|
||||
if (S_ISOFL (bits))
|
||||
return 'M';
|
||||
#endif
|
||||
return '?';
|
||||
}
|
||||
|
||||
@@ -175,9 +220,9 @@ rwx (bits, chars)
|
||||
unsigned short bits;
|
||||
char *chars;
|
||||
{
|
||||
chars[0] = (bits & S_IREAD) ? 'r' : '-';
|
||||
chars[1] = (bits & S_IWRITE) ? 'w' : '-';
|
||||
chars[2] = (bits & S_IEXEC) ? 'x' : '-';
|
||||
chars[0] = (bits & S_IRUSR) ? 'r' : '-';
|
||||
chars[1] = (bits & S_IWUSR) ? 'w' : '-';
|
||||
chars[2] = (bits & S_IXUSR) ? 'x' : '-';
|
||||
}
|
||||
|
||||
/* Set the 's' and 't' flags in file attributes string CHARS,
|
||||
|
||||
115
lib/fnmatch.c
115
lib/fnmatch.c
@@ -1,30 +1,53 @@
|
||||
/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
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 library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include "fnmatch.h"
|
||||
#include <fnmatch.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
|
||||
#if defined (STDC_HEADERS) || !defined (isascii)
|
||||
# define ISASCII(c) 1
|
||||
#else
|
||||
# define ISASCII(c) isascii(c)
|
||||
#endif
|
||||
|
||||
#define ISUPPER(c) (ISASCII (c) && isupper (c))
|
||||
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
|
||||
|
||||
|
||||
# ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if !__STDC__
|
||||
#define const
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* Match STRING against the filename pattern PATTERN, returning zero if
|
||||
it matches, nonzero if not. */
|
||||
@@ -37,40 +60,42 @@ fnmatch (pattern, string, flags)
|
||||
register const char *p = pattern, *n = string;
|
||||
register char c;
|
||||
|
||||
if ((flags & ~__FNM_FLAGS) != 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
/* Note that this evalutes C many times. */
|
||||
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
|
||||
|
||||
while ((c = *p++) != '\0')
|
||||
{
|
||||
c = FOLD (c);
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '?':
|
||||
if (*n == '\0')
|
||||
return FNM_NOMATCH;
|
||||
else if ((flags & FNM_PATHNAME) && *n == '/')
|
||||
else if ((flags & FNM_FILE_NAME) && *n == '/')
|
||||
return FNM_NOMATCH;
|
||||
else if ((flags & FNM_PERIOD) && *n == '.' &&
|
||||
(n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
|
||||
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
|
||||
return FNM_NOMATCH;
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
if (!(flags & FNM_NOESCAPE))
|
||||
c = *p++;
|
||||
if (*n != c)
|
||||
{
|
||||
c = *p++;
|
||||
c = FOLD (c);
|
||||
}
|
||||
if (FOLD (*n) != c)
|
||||
return FNM_NOMATCH;
|
||||
break;
|
||||
|
||||
case '*':
|
||||
if ((flags & FNM_PERIOD) && *n == '.' &&
|
||||
(n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
|
||||
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
|
||||
if (((flags & FNM_PATHNAME) && *n == '/') ||
|
||||
if (((flags & FNM_FILE_NAME) && *n == '/') ||
|
||||
(c == '?' && *n == '\0'))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
@@ -79,8 +104,9 @@ fnmatch (pattern, string, flags)
|
||||
|
||||
{
|
||||
char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
|
||||
c1 = FOLD (c1);
|
||||
for (--p; *n != '\0'; ++n)
|
||||
if ((c == '[' || *n == c1) &&
|
||||
if ((c == '[' || FOLD (*n) == c1) &&
|
||||
fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
|
||||
return 0;
|
||||
return FNM_NOMATCH;
|
||||
@@ -95,7 +121,7 @@ fnmatch (pattern, string, flags)
|
||||
return FNM_NOMATCH;
|
||||
|
||||
if ((flags & FNM_PERIOD) && *n == '.' &&
|
||||
(n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
|
||||
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
not = (*p == '!' || *p == '^');
|
||||
@@ -110,13 +136,16 @@ fnmatch (pattern, string, flags)
|
||||
if (!(flags & FNM_NOESCAPE) && c == '\\')
|
||||
cstart = cend = *p++;
|
||||
|
||||
cstart = cend = FOLD (cstart);
|
||||
|
||||
if (c == '\0')
|
||||
/* [ (unterminated) loses. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
c = *p++;
|
||||
c = FOLD (c);
|
||||
|
||||
if ((flags & FNM_PATHNAME) && c == '/')
|
||||
if ((flags & FNM_FILE_NAME) && c == '/')
|
||||
/* [/] can never match. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
@@ -127,10 +156,12 @@ fnmatch (pattern, string, flags)
|
||||
cend = *p++;
|
||||
if (cend == '\0')
|
||||
return FNM_NOMATCH;
|
||||
cend = FOLD (cend);
|
||||
|
||||
c = *p++;
|
||||
}
|
||||
|
||||
if (*n >= cstart && *n <= cend)
|
||||
if (FOLD (*n) >= cstart && FOLD (*n) <= cend)
|
||||
goto matched;
|
||||
|
||||
if (c == ']')
|
||||
@@ -150,7 +181,7 @@ fnmatch (pattern, string, flags)
|
||||
|
||||
c = *p++;
|
||||
if (!(flags & FNM_NOESCAPE) && c == '\\')
|
||||
/* 1003.2d11 is unclear if this is right. %%% */
|
||||
/* XXX 1003.2d11 is unclear if this is right. */
|
||||
++p;
|
||||
}
|
||||
if (not)
|
||||
@@ -159,15 +190,23 @@ fnmatch (pattern, string, flags)
|
||||
break;
|
||||
|
||||
default:
|
||||
if (c != *n)
|
||||
if (c != FOLD (*n))
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
|
||||
++n;
|
||||
}
|
||||
|
||||
if (*n == '\0' || ((flags & FNM_TARPATH) && *n == '/'))
|
||||
if (*n == '\0')
|
||||
return 0;
|
||||
|
||||
if ((flags & FNM_LEADING_DIR) && *n == '/')
|
||||
/* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */
|
||||
return 0;
|
||||
|
||||
return FNM_NOMATCH;
|
||||
|
||||
# undef FOLD
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
|
||||
@@ -1,48 +1,57 @@
|
||||
/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
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 library is distributed in the hope that it will be useful,
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _FNMATCH_H
|
||||
|
||||
#define _FNMATCH_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
||||
#undef __P
|
||||
#define __P(args) args
|
||||
#define __P(protos) protos
|
||||
#else /* Not C++ or ANSI C. */
|
||||
#undef __P
|
||||
#define __P(args) ()
|
||||
#undef const
|
||||
#define const
|
||||
#define __P(protos) ()
|
||||
/* We can get away without defining `const' here only because in this file
|
||||
it is used only inside the prototype for `fnmatch', which is elided in
|
||||
non-ANSI C where `const' is problematical. */
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
/* Bits set in the FLAGS argument to `fnmatch'. */
|
||||
#define FNM_PATHNAME (1 << 0)/* No wildcard can ever match `/'. */
|
||||
#define FNM_NOESCAPE (1 << 1)/* Backslashes don't quote special chars. */
|
||||
#define FNM_PERIOD (1 << 2)/* Leading `.' is matched only explicitly. */
|
||||
#define FNM_TARPATH (1 << 4)/* Ignore `/...' after a match. */
|
||||
#define __FNM_FLAGS (FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD|FNM_TARPATH)
|
||||
|
||||
#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_BSD_SOURCE)
|
||||
#define FNM_FILE_NAME FNM_PATHNAME
|
||||
/* We #undef these before defining them because some losing systems
|
||||
(HP-UX A.08.07 for example) define these in <unistd.h>. */
|
||||
#undef FNM_PATHNAME
|
||||
#undef FNM_NOESCAPE
|
||||
#undef FNM_PERIOD
|
||||
|
||||
/* Bits set in the FLAGS argument to `fnmatch'. */
|
||||
#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
|
||||
#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
|
||||
#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
|
||||
|
||||
#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
|
||||
#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
|
||||
#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
|
||||
#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
|
||||
#endif
|
||||
|
||||
/* Value returned by `fnmatch' if STRING does not match PATTERN. */
|
||||
@@ -50,12 +59,11 @@ extern "C"
|
||||
|
||||
/* Match STRING against the filename pattern PATTERN,
|
||||
returning zero if it matches, FNM_NOMATCH if not. */
|
||||
extern int fnmatch __P ((const char *__pattern, const char *__string,
|
||||
int __flags));
|
||||
extern int fnmatch __P ((const char *__pattern, const char *__string,
|
||||
int __flags));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* fnmatch.h */
|
||||
|
||||
222
lib/fsusage.c
222
lib/fsusage.c
@@ -1,5 +1,5 @@
|
||||
/* fsusage.c -- return space usage of mounted filesystems
|
||||
Copyright (C) 1991, 1992 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 1992, 1996 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
|
||||
@@ -12,125 +12,202 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "fsusage.h"
|
||||
|
||||
int statfs ();
|
||||
|
||||
#if defined(STAT_STATFS2_BSIZE) && !defined(_IBMR2) /* 4.3BSD, SunOS 4, HP-UX, AIX PS/2. */
|
||||
#include <sys/vfs.h>
|
||||
#if HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#ifdef STAT_STATFS2_FSIZE /* 4.4BSD. */
|
||||
#include <sys/mount.h>
|
||||
#if HAVE_SYS_MOUNT_H
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#ifdef STAT_STATFS2_FS_DATA /* Ultrix. */
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#if HAVE_SYS_VFS_H
|
||||
# include <sys/vfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef STAT_READ /* SVR2. */
|
||||
#include <sys/param.h>
|
||||
#include <sys/filsys.h>
|
||||
#include <fcntl.h>
|
||||
#if HAVE_SYS_FS_S5PARAM_H /* Fujitsu UXP/V */
|
||||
# include <sys/fs/s5param.h>
|
||||
#endif
|
||||
|
||||
#if defined(STAT_STATFS4) || (defined(_AIX) && defined(_IBMR2)) /* SVR3, Dynix, Irix, AIX RS6000. */
|
||||
#include <sys/statfs.h>
|
||||
#if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
|
||||
# include <sys/filsys.h> /* SVR2 */
|
||||
#endif
|
||||
|
||||
#if defined(_AIX) && defined(_I386) /* AIX PS/2. */
|
||||
#include <sys/stat.h>
|
||||
#include <sys/dustat.h>
|
||||
#if HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef STAT_STATVFS /* SVR4. */
|
||||
#include <sys/statvfs.h>
|
||||
#if HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_DUSTAT_H /* AIX PS/2 */
|
||||
# include <sys/dustat.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_STATVFS_H /* SVR4 */
|
||||
# include <sys/statvfs.h>
|
||||
int statvfs ();
|
||||
#endif
|
||||
|
||||
/* Return the number of TOSIZE-byte blocks used by
|
||||
BLOCKS FROMSIZE-byte blocks, rounding up. */
|
||||
int safe_read ();
|
||||
|
||||
#define adjust_blocks(blocks, fromsize, tosize) \
|
||||
(((fromsize) == (tosize)) \
|
||||
? (blocks) /* E.g., from 512 to 512. */ \
|
||||
: (((fromsize) > (tosize)) \
|
||||
/* E.g., from 2048 to 512. */ \
|
||||
? (blocks) * ((fromsize) / (tosize)) \
|
||||
/* E.g., from 256 to 512. */ \
|
||||
: ((blocks) + 1) / ((tosize) / (fromsize))))
|
||||
/* Return the number of TOSIZE-byte blocks used by
|
||||
BLOCKS FROMSIZE-byte blocks, rounding away from zero.
|
||||
TOSIZE must be positive. Return -1 if FROMSIZE is not positive. */
|
||||
|
||||
static long
|
||||
adjust_blocks (blocks, fromsize, tosize)
|
||||
long blocks;
|
||||
int fromsize, tosize;
|
||||
{
|
||||
if (tosize <= 0)
|
||||
abort ();
|
||||
if (fromsize <= 0)
|
||||
return -1;
|
||||
|
||||
if (fromsize == tosize) /* e.g., from 512 to 512 */
|
||||
return blocks;
|
||||
else if (fromsize > tosize) /* e.g., from 2048 to 512 */
|
||||
return blocks * (fromsize / tosize);
|
||||
else /* e.g., from 256 to 512 */
|
||||
return (blocks + (blocks < 0 ? -1 : 1)) / (tosize / fromsize);
|
||||
}
|
||||
|
||||
/* Fill in the fields of FSP with information about space usage for
|
||||
the filesystem on which PATH resides.
|
||||
DISK is the device on which PATH is mounted, for space-getting
|
||||
methods that need to know it.
|
||||
Return 0 if successful, -1 if not. */
|
||||
|
||||
Return 0 if successful, -1 if not. When returning -1, ensure that
|
||||
ERRNO is either a system error value, or zero if DISK is NULL
|
||||
on a system that requires a non-NULL value. */
|
||||
int
|
||||
get_fs_usage (path, disk, fsp)
|
||||
char *path, *disk;
|
||||
const char *path;
|
||||
const char *disk;
|
||||
struct fs_usage *fsp;
|
||||
{
|
||||
#ifdef STAT_STATFS2_FS_DATA /* Ultrix. */
|
||||
#ifdef STAT_STATFS3_OSF1
|
||||
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
|
||||
|
||||
struct statfs fsd;
|
||||
|
||||
if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
|
||||
return -1;
|
||||
|
||||
#endif /* STAT_STATFS3_OSF1 */
|
||||
|
||||
#ifdef STAT_STATFS2_FS_DATA /* Ultrix */
|
||||
# define CONVERT_BLOCKS(B) adjust_blocks ((B), 1024, 512)
|
||||
|
||||
struct fs_data fsd;
|
||||
|
||||
if (statfs (path, &fsd) != 1)
|
||||
return -1;
|
||||
#define convert_blocks(b) adjust_blocks ((b), 1024, 512)
|
||||
fsp->fsu_blocks = convert_blocks (fsd.fd_req.btot);
|
||||
fsp->fsu_bfree = convert_blocks (fsd.fd_req.bfree);
|
||||
fsp->fsu_bavail = convert_blocks (fsd.fd_req.bfreen);
|
||||
fsp->fsu_blocks = CONVERT_BLOCKS (fsd.fd_req.btot);
|
||||
fsp->fsu_bfree = CONVERT_BLOCKS (fsd.fd_req.bfree);
|
||||
fsp->fsu_bavail = CONVERT_BLOCKS (fsd.fd_req.bfreen);
|
||||
fsp->fsu_files = fsd.fd_req.gtot;
|
||||
fsp->fsu_ffree = fsd.fd_req.gfree;
|
||||
#endif
|
||||
|
||||
#ifdef STAT_READ /* SVR2. */
|
||||
#ifndef SUPERBOFF
|
||||
#define SUPERBOFF (SUPERB * 512)
|
||||
#endif
|
||||
#endif /* STAT_STATFS2_FS_DATA */
|
||||
|
||||
#ifdef STAT_READ_FILSYS /* SVR2 */
|
||||
# ifndef SUPERBOFF
|
||||
# define SUPERBOFF (SUPERB * 512)
|
||||
# endif
|
||||
# define CONVERT_BLOCKS(B) \
|
||||
adjust_blocks ((B), (fsd.s_type == Fs2b ? 1024 : 512), 512)
|
||||
|
||||
struct filsys fsd;
|
||||
int fd;
|
||||
|
||||
if (! disk)
|
||||
{
|
||||
errno = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fd = open (disk, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
lseek (fd, (long) SUPERBOFF, 0);
|
||||
if (read (fd, (char *) &fsd, sizeof fsd) != sizeof fsd)
|
||||
if (safe_read (fd, (char *) &fsd, sizeof fsd) != sizeof fsd)
|
||||
{
|
||||
close (fd);
|
||||
return -1;
|
||||
}
|
||||
close (fd);
|
||||
#define convert_blocks(b) adjust_blocks ((b), (fsd.s_type == Fs2b ? 1024 : 512), 512)
|
||||
fsp->fsu_blocks = convert_blocks (fsd.s_fsize);
|
||||
fsp->fsu_bfree = convert_blocks (fsd.s_tfree);
|
||||
fsp->fsu_bavail = convert_blocks (fsd.s_tfree);
|
||||
fsp->fsu_blocks = CONVERT_BLOCKS (fsd.s_fsize);
|
||||
fsp->fsu_bfree = CONVERT_BLOCKS (fsd.s_tfree);
|
||||
fsp->fsu_bavail = CONVERT_BLOCKS (fsd.s_tfree);
|
||||
fsp->fsu_files = (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 1);
|
||||
fsp->fsu_ffree = fsd.s_tinode;
|
||||
#endif
|
||||
|
||||
#ifdef STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX. */
|
||||
#endif /* STAT_READ_FILSYS */
|
||||
|
||||
#ifdef STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX */
|
||||
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_bsize, 512)
|
||||
|
||||
struct statfs fsd;
|
||||
|
||||
if (statfs (path, &fsd) < 0)
|
||||
return -1;
|
||||
#define convert_blocks(b) adjust_blocks ((b), fsd.f_bsize, 512)
|
||||
#endif
|
||||
|
||||
#ifdef STAT_STATFS2_FSIZE /* 4.4BSD. */
|
||||
# ifdef STATFS_TRUNCATES_BLOCK_COUNTS
|
||||
|
||||
/* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the
|
||||
struct statfs are truncated to 2GB. These conditions detect that
|
||||
truncation, presumably without botching the 4.1.1 case, in which
|
||||
the values are not truncated. The correct counts are stored in
|
||||
undocumented spare fields. */
|
||||
if (fsd.f_blocks == 0x1fffff && fsd.f_spare[0] > 0)
|
||||
{
|
||||
fsd.f_blocks = fsd.f_spare[0];
|
||||
fsd.f_bfree = fsd.f_spare[1];
|
||||
fsd.f_bavail = fsd.f_spare[2];
|
||||
}
|
||||
# endif /* STATFS_TRUNCATES_BLOCK_COUNTS */
|
||||
|
||||
#endif /* STAT_STATFS2_BSIZE */
|
||||
|
||||
#ifdef STAT_STATFS2_FSIZE /* 4.4BSD */
|
||||
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
|
||||
|
||||
struct statfs fsd;
|
||||
|
||||
if (statfs (path, &fsd) < 0)
|
||||
return -1;
|
||||
#define convert_blocks(b) adjust_blocks ((b), fsd.f_fsize, 512)
|
||||
#endif
|
||||
|
||||
#ifdef STAT_STATFS4 /* SVR3, Dynix, Irix. */
|
||||
#endif /* STAT_STATFS2_FSIZE */
|
||||
|
||||
#ifdef STAT_STATFS4 /* SVR3, Dynix, Irix, AIX */
|
||||
# if _AIX || defined(_CRAY)
|
||||
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_bsize, 512)
|
||||
# ifdef _CRAY
|
||||
# define f_bavail f_bfree
|
||||
# endif
|
||||
# else
|
||||
# define CONVERT_BLOCKS(B) (B)
|
||||
# ifndef _SEQUENT_ /* _SEQUENT_ is DYNIX/ptx */
|
||||
# ifndef DOLPHIN /* DOLPHIN 3.8.alfa/7.18 has f_bavail */
|
||||
# define f_bavail f_bfree
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
struct statfs fsd;
|
||||
|
||||
if (statfs (path, &fsd, sizeof fsd, 0) < 0)
|
||||
@@ -138,29 +215,31 @@ get_fs_usage (path, disk, fsp)
|
||||
/* Empirically, the block counts on most SVR3 and SVR3-derived
|
||||
systems seem to always be in terms of 512-byte blocks,
|
||||
no matter what value f_bsize has. */
|
||||
#define convert_blocks(b) (b)
|
||||
#ifndef _SEQUENT_ /* _SEQUENT_ is DYNIX/ptx. */
|
||||
#define f_bavail f_bfree
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef STAT_STATVFS /* SVR4. */
|
||||
#endif /* STAT_STATFS4 */
|
||||
|
||||
#ifdef STAT_STATVFS /* SVR4 */
|
||||
# define CONVERT_BLOCKS(B) \
|
||||
adjust_blocks ((B), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512)
|
||||
|
||||
struct statvfs fsd;
|
||||
|
||||
if (statvfs (path, &fsd) < 0)
|
||||
return -1;
|
||||
/* f_frsize isn't guaranteed to be supported. */
|
||||
#define convert_blocks(b) \
|
||||
adjust_blocks ((b), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512)
|
||||
#endif
|
||||
|
||||
#if !defined(STAT_STATFS2_FS_DATA) && !defined(STAT_READ) /* !Ultrix && !SVR2. */
|
||||
fsp->fsu_blocks = convert_blocks (fsd.f_blocks);
|
||||
fsp->fsu_bfree = convert_blocks (fsd.f_bfree);
|
||||
fsp->fsu_bavail = convert_blocks (fsd.f_bavail);
|
||||
#endif /* STAT_STATVFS */
|
||||
|
||||
#if !defined(STAT_STATFS2_FS_DATA) && !defined(STAT_READ_FILSYS)
|
||||
/* !Ultrix && !SVR2 */
|
||||
|
||||
fsp->fsu_blocks = CONVERT_BLOCKS (fsd.f_blocks);
|
||||
fsp->fsu_bfree = CONVERT_BLOCKS (fsd.f_bfree);
|
||||
fsp->fsu_bavail = CONVERT_BLOCKS (fsd.f_bavail);
|
||||
fsp->fsu_files = fsd.f_files;
|
||||
fsp->fsu_ffree = fsd.f_ffree;
|
||||
#endif
|
||||
|
||||
#endif /* not STAT_STATFS2_FS_DATA && not STAT_READ_FILSYS */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -191,4 +270,5 @@ statfs (path, fsb)
|
||||
fsb->f_fsid.val[1] = fsd.du_pckno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _AIX && _I386 */
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Space usage statistics for a filesystem. Blocks are 512-byte. */
|
||||
struct fs_usage
|
||||
@@ -25,8 +25,13 @@ struct fs_usage
|
||||
long fsu_ffree; /* Free file nodes. */
|
||||
};
|
||||
|
||||
#if __STDC__
|
||||
int get_fs_usage (char *path, char *disk, struct fs_usage *fsp);
|
||||
#ifndef __P
|
||||
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
#define __P(args) args
|
||||
#else
|
||||
int get_fs_usage ();
|
||||
#endif
|
||||
#define __P(args) ()
|
||||
#endif /* GCC. */
|
||||
#endif /* Not __P. */
|
||||
|
||||
int get_fs_usage __P ((const char *path, const char *disk,
|
||||
struct fs_usage *fsp));
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
/* ftruncate emulations that work on some System V's.
|
||||
This file is in the public domain. */
|
||||
This file is in the public domain. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef F_CHSIZE
|
||||
|
||||
int
|
||||
ftruncate (fd, length)
|
||||
int fd;
|
||||
@@ -12,14 +17,17 @@ ftruncate (fd, length)
|
||||
{
|
||||
return fcntl (fd, F_CHSIZE, length);
|
||||
}
|
||||
#else
|
||||
|
||||
#else /* not F_CHSIZE */
|
||||
#ifdef F_FREESP
|
||||
/* The following function was written by
|
||||
kucharsk@Solbourne.com (William Kucharski) */
|
||||
|
||||
/* By William Kucharski <kucharsk@netcom.com>. */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
ftruncate (fd, length)
|
||||
@@ -44,23 +52,28 @@ ftruncate (fd, length)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Truncate length. */
|
||||
|
||||
fl.l_whence = 0;
|
||||
fl.l_len = 0;
|
||||
fl.l_start = length;
|
||||
fl.l_type = F_WRLCK; /* Write lock on file space. */
|
||||
fl.l_type = F_WRLCK; /* write lock on file space */
|
||||
|
||||
/* This relies on the *undocumented* F_FREESP argument to fcntl,
|
||||
which truncates the file so that it ends at the position
|
||||
indicated by fl.l_start. Will minor miracles never cease? */
|
||||
|
||||
/* This relies on the UNDOCUMENTED F_FREESP argument to
|
||||
fcntl, which truncates the file so that it ends at the
|
||||
position indicated by fl.l_start.
|
||||
Will minor miracles never cease? */
|
||||
if (fcntl (fd, F_FREESP, &fl) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
||||
#else /* not F_CHSIZE nor F_FREESP */
|
||||
#ifdef HAVE_CHSIZE
|
||||
|
||||
int
|
||||
ftruncate (fd, length)
|
||||
int fd;
|
||||
@@ -68,5 +81,23 @@ ftruncate (fd, length)
|
||||
{
|
||||
return chsize (fd, length);
|
||||
}
|
||||
|
||||
#else /* not F_CHSIZE nor F_FREESP nor HAVE_CHSIZE */
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int
|
||||
ftruncate (fd, length)
|
||||
int fd;
|
||||
off_t length;
|
||||
{
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* not HAVE_CHSIZE */
|
||||
#endif /* not F_FREESP */
|
||||
#endif /* not F_CHSIZE */
|
||||
|
||||
64
lib/full-write.c
Normal file
64
lib/full-write.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/* full-write.c -- an interface to write that retries after interrupts
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Copied largely from GNU C's cccp.c.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
/* Write LEN bytes at PTR to descriptor DESC, retrying if interrupted.
|
||||
Return LEN upon success, write's (negative) error code otherwise. */
|
||||
|
||||
int
|
||||
full_write (desc, ptr, len)
|
||||
int desc;
|
||||
char *ptr;
|
||||
size_t len;
|
||||
{
|
||||
int total_written;
|
||||
|
||||
total_written = 0;
|
||||
while (len > 0)
|
||||
{
|
||||
int written = write (desc, ptr, len);
|
||||
if (written < 0)
|
||||
{
|
||||
#ifdef EINTR
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
#endif
|
||||
return written;
|
||||
}
|
||||
total_written += written;
|
||||
ptr += written;
|
||||
len -= written;
|
||||
}
|
||||
return total_written;
|
||||
}
|
||||
1032
lib/getdate.y
1032
lib/getdate.y
File diff suppressed because it is too large
Load Diff
59
lib/getgroups.c
Normal file
59
lib/getgroups.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* provide consistent interface to getgroups for systems that don't allow N==0
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* written by Jim Meyering */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
char *xmalloc ();
|
||||
|
||||
/* On at least Ultrix 4.3 and NextStep 3.2, getgroups (0, 0) always fails.
|
||||
On other systems, it returns the number of supplemental groups for the
|
||||
process is returned.
|
||||
This function handles that special case and lets the system-
|
||||
provided function handle all others. */
|
||||
|
||||
int
|
||||
getgroups (n, group)
|
||||
size_t n;
|
||||
GETGROUPS_T *group;
|
||||
{
|
||||
int n_groups;
|
||||
GETGROUPS_T *gbuf;
|
||||
|
||||
#undef getgroups
|
||||
|
||||
if (n != 0)
|
||||
return getgroups (n, group);
|
||||
|
||||
n = 20;
|
||||
gbuf = NULL;
|
||||
while (1)
|
||||
{
|
||||
gbuf = (GETGROUPS_T *) xrealloc (gbuf, n * sizeof (GETGROUPS_T));
|
||||
n_groups = getgroups (n, gbuf);
|
||||
if (n_groups < n)
|
||||
break;
|
||||
n += 10;
|
||||
}
|
||||
|
||||
free (gbuf);
|
||||
|
||||
return n_groups;
|
||||
}
|
||||
@@ -12,13 +12,17 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNAME
|
||||
#include <sys/utsname.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
/* Put up to LEN chars of the host name into NAME.
|
||||
|
||||
155
lib/getline.c
Normal file
155
lib/getline.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/* getline.c -- Replacement for GNU C library function getline
|
||||
|
||||
Copyright (C) 1993, 1996 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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* The `getdelim' function is only declared if the following symbol
|
||||
is defined. */
|
||||
#define _GNU_SOURCE 1
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined __GNU_LIBRARY__ && HAVE_GETDELIM
|
||||
|
||||
int
|
||||
getline (lineptr, n, stream)
|
||||
char **lineptr;
|
||||
size_t *n;
|
||||
FILE *stream;
|
||||
{
|
||||
return getdelim (lineptr, n, '\n', stream);
|
||||
}
|
||||
|
||||
|
||||
#else /* ! have getdelim */
|
||||
|
||||
# define NDEBUG
|
||||
# include <assert.h>
|
||||
|
||||
# if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
# else
|
||||
char *malloc (), *realloc ();
|
||||
# endif
|
||||
|
||||
/* Always add at least this many bytes when extending the buffer. */
|
||||
# define MIN_CHUNK 64
|
||||
|
||||
/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR
|
||||
+ OFFSET (and null-terminate it). *LINEPTR is a pointer returned from
|
||||
malloc (or NULL), pointing to *N characters of space. It is realloc'd
|
||||
as necessary. Return the number of characters read (not including the
|
||||
null terminator), or -1 on error or EOF. */
|
||||
|
||||
int
|
||||
getstr (lineptr, n, stream, terminator, offset)
|
||||
char **lineptr;
|
||||
size_t *n;
|
||||
FILE *stream;
|
||||
char terminator;
|
||||
size_t offset;
|
||||
{
|
||||
int nchars_avail; /* Allocated but unused chars in *LINEPTR. */
|
||||
char *read_pos; /* Where we're reading into *LINEPTR. */
|
||||
int ret;
|
||||
|
||||
if (!lineptr || !n || !stream)
|
||||
return -1;
|
||||
|
||||
if (!*lineptr)
|
||||
{
|
||||
*n = MIN_CHUNK;
|
||||
*lineptr = malloc (*n);
|
||||
if (!*lineptr)
|
||||
return -1;
|
||||
}
|
||||
|
||||
nchars_avail = *n - offset;
|
||||
read_pos = *lineptr + offset;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
register int c = getc (stream);
|
||||
|
||||
/* We always want at least one char left in the buffer, since we
|
||||
always (unless we get an error while reading the first char)
|
||||
NUL-terminate the line buffer. */
|
||||
|
||||
assert(*n - nchars_avail == read_pos - *lineptr);
|
||||
if (nchars_avail < 2)
|
||||
{
|
||||
if (*n > MIN_CHUNK)
|
||||
*n *= 2;
|
||||
else
|
||||
*n += MIN_CHUNK;
|
||||
|
||||
nchars_avail = *n + *lineptr - read_pos;
|
||||
*lineptr = realloc (*lineptr, *n);
|
||||
if (!*lineptr)
|
||||
return -1;
|
||||
read_pos = *n - nchars_avail + *lineptr;
|
||||
assert(*n - nchars_avail == read_pos - *lineptr);
|
||||
}
|
||||
|
||||
if (c == EOF || ferror (stream))
|
||||
{
|
||||
/* Return partial line, if any. */
|
||||
if (read_pos == *lineptr)
|
||||
return -1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
*read_pos++ = c;
|
||||
nchars_avail--;
|
||||
|
||||
if (c == terminator)
|
||||
/* Return the line. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Done - NUL terminate and return the number of chars read. */
|
||||
*read_pos = '\0';
|
||||
|
||||
ret = read_pos - (*lineptr + offset);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
getline (lineptr, n, stream)
|
||||
char **lineptr;
|
||||
size_t *n;
|
||||
FILE *stream;
|
||||
{
|
||||
return getstr (lineptr, n, stream, '\n', 0);
|
||||
}
|
||||
|
||||
int
|
||||
getdelim (lineptr, n, delimiter, stream)
|
||||
char **lineptr;
|
||||
size_t *n;
|
||||
int delimiter;
|
||||
FILE *stream;
|
||||
{
|
||||
return getstr (lineptr, n, stream, delimiter, 0);
|
||||
}
|
||||
#endif
|
||||
36
lib/getline.h
Normal file
36
lib/getline.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef GETLINE_H_
|
||||
# define GETLINE_H_ 1
|
||||
|
||||
# include <stdio.h>
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined (__GNUC__) || __STDC__
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
# endif
|
||||
# endif
|
||||
|
||||
int
|
||||
getline PARAMS ((char **_lineptr, size_t *_n, FILE *_stream));
|
||||
|
||||
int
|
||||
getdelim PARAMS ((char **_lineptr, size_t *_n, int _delimiter, FILE *_stream));
|
||||
|
||||
#endif /* not GETLINE_H_ */
|
||||
1028
lib/getloadavg.c
Normal file
1028
lib/getloadavg.c
Normal file
File diff suppressed because it is too large
Load Diff
442
lib/getopt.c
442
lib/getopt.c
@@ -3,58 +3,88 @@
|
||||
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
|
||||
before changing it!
|
||||
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 1992 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996
|
||||
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, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* AIX requires this to be the first thing in the file. */
|
||||
#ifdef __GNUC__
|
||||
#define alloca __builtin_alloca
|
||||
#else /* not __GNUC__ */
|
||||
#if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__))))
|
||||
#include <alloca.h>
|
||||
#else
|
||||
#ifdef _AIX
|
||||
#pragma alloca
|
||||
#else
|
||||
char *alloca ();
|
||||
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
|
||||
Ditto for AIX 3.2 and <stdlib.h>. */
|
||||
#ifndef _NO_PROTO
|
||||
#define _NO_PROTO
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#if !defined (__STDC__) || !__STDC__
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
#endif /* alloca.h */
|
||||
#endif /* not __GNUC__ */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#undef alloca
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* Don't include stdlib.h for non-GNU C libraries because some of them
|
||||
contain conflicting prototypes for getopt. */
|
||||
#include <stdlib.h>
|
||||
#else /* Not GNU C library. */
|
||||
#define __alloca alloca
|
||||
#if defined (_LIBC) || defined (HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif /* GNU C library. */
|
||||
|
||||
#if !__STDC__
|
||||
#define const
|
||||
#ifdef VMS
|
||||
#include <unixlib.h>
|
||||
#if HAVE_STRING_H - 0
|
||||
#include <string.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
|
||||
long-named option. Because this is not POSIX.2 compliant, it is
|
||||
being phased out. */
|
||||
#define GETOPT_COMPAT
|
||||
#ifdef WIN32
|
||||
/* It's not Unix, really. See? Capital letters. */
|
||||
#include <windows.h>
|
||||
#define getpid() GetCurrentProcessId()
|
||||
#endif
|
||||
|
||||
#ifndef _
|
||||
/* This is for other GNU distributions with internationalized messages.
|
||||
When compiling libc, the _ macro is predefined. */
|
||||
#ifdef HAVE_LIBINTL_H
|
||||
# include <libintl.h>
|
||||
# define _(msgid) gettext (msgid)
|
||||
#else
|
||||
# define _(msgid) (msgid)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* This version of `getopt' appears to the caller like standard Unix `getopt'
|
||||
but it behaves differently for the user, since it allows the user
|
||||
@@ -78,7 +108,7 @@ char *alloca ();
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
char *optarg = 0;
|
||||
char *optarg = NULL;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
@@ -92,6 +122,7 @@ char *optarg = 0;
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
/* XXX 1003.2 says this must be 1 before any call. */
|
||||
int optind = 0;
|
||||
|
||||
/* The next char to be scanned in the option-element
|
||||
@@ -108,6 +139,12 @@ static char *nextchar;
|
||||
|
||||
int opterr = 1;
|
||||
|
||||
/* Set to an option character which was unrecognized.
|
||||
This must be initialized on some systems to avoid linking in the
|
||||
system's own getopt implementation. */
|
||||
|
||||
int optopt = '?';
|
||||
|
||||
/* Describe how to deal with options that follow non-option ARGV-elements.
|
||||
|
||||
If the caller did not specify anything,
|
||||
@@ -141,15 +178,17 @@ static enum
|
||||
{
|
||||
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
|
||||
} ordering;
|
||||
|
||||
/* Value of POSIXLY_CORRECT environment variable. */
|
||||
static char *posixly_correct;
|
||||
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* We want to avoid inclusion of string.h with non-GNU libraries
|
||||
because there are many ways it can cause trouble.
|
||||
On some systems, it contains special magic macros that don't work
|
||||
in GCC. */
|
||||
#include <string.h>
|
||||
#define my_index strchr
|
||||
#define my_bcopy(src, dst, n) memcpy ((dst), (src), (n))
|
||||
#else
|
||||
|
||||
/* Avoid depending on library functions or files
|
||||
@@ -158,29 +197,32 @@ static enum
|
||||
char *getenv ();
|
||||
|
||||
static char *
|
||||
my_index (string, chr)
|
||||
char *string;
|
||||
my_index (str, chr)
|
||||
const char *str;
|
||||
int chr;
|
||||
{
|
||||
while (*string)
|
||||
while (*str)
|
||||
{
|
||||
if (*string == chr)
|
||||
return string;
|
||||
string++;
|
||||
if (*str == chr)
|
||||
return (char *) str;
|
||||
str++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
my_bcopy (from, to, size)
|
||||
char *from, *to;
|
||||
int size;
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < size; i++)
|
||||
to[i] = from[i];
|
||||
}
|
||||
#endif /* GNU C library. */
|
||||
/* If using GCC, we can safely declare strlen this way.
|
||||
If not using GCC, it is ok not to declare it. */
|
||||
#ifdef __GNUC__
|
||||
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
|
||||
That was relevant to code that was here before. */
|
||||
#if !defined (__STDC__) || !__STDC__
|
||||
/* gcc with -traditional declares the built-in strlen to return int,
|
||||
and has done so at least since version 2.4.5. -- rms. */
|
||||
extern int strlen (const char *);
|
||||
#endif /* not __STDC__ */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#endif /* not __GNU_LIBRARY__ */
|
||||
|
||||
/* Handle permutation of arguments. */
|
||||
|
||||
@@ -191,6 +233,12 @@ my_bcopy (from, to, size)
|
||||
static int first_nonopt;
|
||||
static int last_nonopt;
|
||||
|
||||
/* Bash 2.0 gives us an environment variable containing flags
|
||||
indicating ARGV elements that should not be considered arguments. */
|
||||
|
||||
static const char *nonoption_flags;
|
||||
static int nonoption_flags_len;
|
||||
|
||||
/* Exchange two adjacent subsequences of ARGV.
|
||||
One subsequence is elements [first_nonopt,last_nonopt)
|
||||
which contains all the non-options that have been skipped so far.
|
||||
@@ -200,27 +248,119 @@ static int last_nonopt;
|
||||
`first_nonopt' and `last_nonopt' are relocated so that they describe
|
||||
the new indices of the non-options in ARGV after they are moved. */
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
static void exchange (char **);
|
||||
#endif
|
||||
|
||||
static void
|
||||
exchange (argv)
|
||||
char **argv;
|
||||
{
|
||||
int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *);
|
||||
char **temp = (char **) __alloca (nonopts_size);
|
||||
int bottom = first_nonopt;
|
||||
int middle = last_nonopt;
|
||||
int top = optind;
|
||||
char *tem;
|
||||
|
||||
/* Interchange the two blocks of data in ARGV. */
|
||||
/* Exchange the shorter segment with the far end of the longer segment.
|
||||
That puts the shorter segment into the right place.
|
||||
It leaves the longer segment in the right place overall,
|
||||
but it consists of two parts that need to be swapped next. */
|
||||
|
||||
my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size);
|
||||
my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt],
|
||||
(optind - last_nonopt) * sizeof (char *));
|
||||
my_bcopy ((char *) temp,
|
||||
(char *) &argv[first_nonopt + optind - last_nonopt],
|
||||
nonopts_size);
|
||||
while (top > middle && middle > bottom)
|
||||
{
|
||||
if (top - middle > middle - bottom)
|
||||
{
|
||||
/* Bottom segment is the short one. */
|
||||
int len = middle - bottom;
|
||||
register int i;
|
||||
|
||||
/* Swap it with the top part of the top segment. */
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[top - (middle - bottom) + i];
|
||||
argv[top - (middle - bottom) + i] = tem;
|
||||
}
|
||||
/* Exclude the moved bottom segment from further swapping. */
|
||||
top -= len;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Top segment is the short one. */
|
||||
int len = top - middle;
|
||||
register int i;
|
||||
|
||||
/* Swap it with the bottom part of the bottom segment. */
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[middle + i];
|
||||
argv[middle + i] = tem;
|
||||
}
|
||||
/* Exclude the moved top segment from further swapping. */
|
||||
bottom += len;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update records for the slots the non-options now occupy. */
|
||||
|
||||
first_nonopt += (optind - last_nonopt);
|
||||
last_nonopt = optind;
|
||||
}
|
||||
|
||||
/* Initialize the internal data when the first call is made. */
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
static const char *_getopt_initialize (const char *);
|
||||
#endif
|
||||
static const char *
|
||||
_getopt_initialize (optstring)
|
||||
const char *optstring;
|
||||
{
|
||||
/* Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||
is the program name); the sequence of previously skipped
|
||||
non-option ARGV-elements is empty. */
|
||||
|
||||
first_nonopt = last_nonopt = optind = 1;
|
||||
|
||||
nextchar = NULL;
|
||||
|
||||
posixly_correct = getenv ("POSIXLY_CORRECT");
|
||||
|
||||
/* Determine how to handle the ordering of options and nonoptions. */
|
||||
|
||||
if (optstring[0] == '-')
|
||||
{
|
||||
ordering = RETURN_IN_ORDER;
|
||||
++optstring;
|
||||
}
|
||||
else if (optstring[0] == '+')
|
||||
{
|
||||
ordering = REQUIRE_ORDER;
|
||||
++optstring;
|
||||
}
|
||||
else if (posixly_correct != NULL)
|
||||
ordering = REQUIRE_ORDER;
|
||||
else
|
||||
ordering = PERMUTE;
|
||||
|
||||
if (posixly_correct == NULL)
|
||||
{
|
||||
/* Bash 2.0 puts a special variable in the environment for each
|
||||
command it runs, specifying which ARGV elements are the results of
|
||||
file name wildcard expansion and therefore should not be
|
||||
considered as options. */
|
||||
char var[100];
|
||||
sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
|
||||
nonoption_flags = getenv (var);
|
||||
if (nonoption_flags == NULL)
|
||||
nonoption_flags_len = 0;
|
||||
else
|
||||
nonoption_flags_len = strlen (nonoption_flags);
|
||||
}
|
||||
|
||||
return optstring;
|
||||
}
|
||||
|
||||
/* Scan elements of ARGV (whose length is ARGC) for option characters
|
||||
given in OPTSTRING.
|
||||
@@ -287,41 +427,32 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
int *longind;
|
||||
int long_only;
|
||||
{
|
||||
int option_index;
|
||||
|
||||
optarg = 0;
|
||||
|
||||
/* Initialize the internal data when the first call is made.
|
||||
Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||
is the program name); the sequence of previously skipped
|
||||
non-option ARGV-elements is empty. */
|
||||
optarg = NULL;
|
||||
|
||||
if (optind == 0)
|
||||
{
|
||||
first_nonopt = last_nonopt = optind = 1;
|
||||
|
||||
nextchar = NULL;
|
||||
|
||||
/* Determine how to handle the ordering of options and nonoptions. */
|
||||
|
||||
if (optstring[0] == '-')
|
||||
{
|
||||
ordering = RETURN_IN_ORDER;
|
||||
++optstring;
|
||||
}
|
||||
else if (optstring[0] == '+')
|
||||
{
|
||||
ordering = REQUIRE_ORDER;
|
||||
++optstring;
|
||||
}
|
||||
else if (getenv ("POSIXLY_CORRECT") != NULL)
|
||||
ordering = REQUIRE_ORDER;
|
||||
else
|
||||
ordering = PERMUTE;
|
||||
optstring = _getopt_initialize (optstring);
|
||||
optind = 1; /* Don't scan ARGV[0], the program name. */
|
||||
}
|
||||
|
||||
/* Test whether ARGV[optind] points to a non-option argument.
|
||||
Either it does not have option syntax, or there is an environment flag
|
||||
from the shell indicating it is not an option. */
|
||||
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|
||||
|| (optind < nonoption_flags_len \
|
||||
&& nonoption_flags[optind] == '1'))
|
||||
|
||||
if (nextchar == NULL || *nextchar == '\0')
|
||||
{
|
||||
/* Advance to the next ARGV-element. */
|
||||
|
||||
/* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
|
||||
moved back by the user (who may also have changed the arguments). */
|
||||
if (last_nonopt > optind)
|
||||
last_nonopt = optind;
|
||||
if (first_nonopt > optind)
|
||||
first_nonopt = optind;
|
||||
|
||||
if (ordering == PERMUTE)
|
||||
{
|
||||
/* If we have just processed some options following some non-options,
|
||||
@@ -332,21 +463,15 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
else if (last_nonopt != optind)
|
||||
first_nonopt = optind;
|
||||
|
||||
/* Now skip any additional non-options
|
||||
/* Skip any additional non-options
|
||||
and extend the range of non-options previously skipped. */
|
||||
|
||||
while (optind < argc
|
||||
&& (argv[optind][0] != '-' || argv[optind][1] == '\0')
|
||||
#ifdef GETOPT_COMPAT
|
||||
&& (longopts == NULL
|
||||
|| argv[optind][0] != '+' || argv[optind][1] == '\0')
|
||||
#endif /* GETOPT_COMPAT */
|
||||
)
|
||||
while (optind < argc && NONOPTION_P)
|
||||
optind++;
|
||||
last_nonopt = optind;
|
||||
}
|
||||
|
||||
/* Special ARGV-element `--' means premature end of options.
|
||||
/* The special ARGV-element `--' means premature end of options.
|
||||
Skip it like a null option,
|
||||
then exchange with previous non-options as if it were an option,
|
||||
then skip everything else like a non-option. */
|
||||
@@ -379,12 +504,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
/* If we have come to a non-option and did not permute it,
|
||||
either stop the scan or describe it to the caller and pass it by. */
|
||||
|
||||
if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
|
||||
#ifdef GETOPT_COMPAT
|
||||
&& (longopts == NULL
|
||||
|| argv[optind][0] != '+' || argv[optind][1] == '\0')
|
||||
#endif /* GETOPT_COMPAT */
|
||||
)
|
||||
if (NONOPTION_P)
|
||||
{
|
||||
if (ordering == REQUIRE_ORDER)
|
||||
return EOF;
|
||||
@@ -393,36 +513,52 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
}
|
||||
|
||||
/* We have found another option-ARGV-element.
|
||||
Start decoding its characters. */
|
||||
Skip the initial punctuation. */
|
||||
|
||||
nextchar = (argv[optind] + 1
|
||||
+ (longopts != NULL && argv[optind][1] == '-'));
|
||||
}
|
||||
|
||||
/* Decode the current option-ARGV-element. */
|
||||
|
||||
/* Check whether the ARGV-element is a long option.
|
||||
|
||||
If long_only and the ARGV-element has the form "-f", where f is
|
||||
a valid short option, don't consider it an abbreviated form of
|
||||
a long option that starts with f. Otherwise there would be no
|
||||
way to give the -f short option.
|
||||
|
||||
On the other hand, if there's a long option "fubar" and
|
||||
the ARGV-element is "-fu", do consider that an abbreviation of
|
||||
the long option, just like "--fu", and not "-f" with arg "u".
|
||||
|
||||
This distinction seems to be the most useful approach. */
|
||||
|
||||
if (longopts != NULL
|
||||
&& ((argv[optind][0] == '-'
|
||||
&& (argv[optind][1] == '-' || long_only))
|
||||
#ifdef GETOPT_COMPAT
|
||||
|| argv[optind][0] == '+'
|
||||
#endif /* GETOPT_COMPAT */
|
||||
))
|
||||
&& (argv[optind][1] == '-'
|
||||
|| (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
|
||||
{
|
||||
char *nameend;
|
||||
const struct option *p;
|
||||
char *s = nextchar;
|
||||
const struct option *pfound = NULL;
|
||||
int exact = 0;
|
||||
int ambig = 0;
|
||||
const struct option *pfound = NULL;
|
||||
int indfound;
|
||||
int option_index;
|
||||
|
||||
while (*s && *s != '=')
|
||||
s++;
|
||||
for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
|
||||
/* Do nothing. */ ;
|
||||
|
||||
/* Test all options for either exact match or abbreviated matches. */
|
||||
for (p = longopts, option_index = 0; p->name;
|
||||
p++, option_index++)
|
||||
if (!strncmp (p->name, nextchar, s - nextchar))
|
||||
#ifdef lint /* Suppress `used before initialized' warning. */
|
||||
indfound = 0;
|
||||
#endif
|
||||
|
||||
/* Test all long options for either exact match
|
||||
or abbreviated matches. */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp (p->name, nextchar, nameend - nextchar))
|
||||
{
|
||||
if (s - nextchar == strlen (p->name))
|
||||
if (nameend - nextchar == strlen (p->name))
|
||||
{
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
@@ -437,17 +573,18 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
indfound = option_index;
|
||||
}
|
||||
else
|
||||
/* Second nonexact match found. */
|
||||
/* Second or later nonexact match found. */
|
||||
ambig = 1;
|
||||
}
|
||||
|
||||
if (ambig && !exact)
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr, "%s: option `%s' is ambiguous\n",
|
||||
fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
|
||||
argv[0], argv[optind]);
|
||||
nextchar += strlen (nextchar);
|
||||
optind++;
|
||||
optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
|
||||
@@ -455,28 +592,29 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
{
|
||||
option_index = indfound;
|
||||
optind++;
|
||||
if (*s)
|
||||
if (*nameend)
|
||||
{
|
||||
/* Don't test has_arg with >, because some C compilers don't
|
||||
allow it to be used on enums. */
|
||||
if (pfound->has_arg)
|
||||
optarg = s + 1;
|
||||
optarg = nameend + 1;
|
||||
else
|
||||
{
|
||||
if (opterr)
|
||||
{
|
||||
if (argv[optind - 1][1] == '-')
|
||||
/* --option */
|
||||
fprintf (stderr,
|
||||
"%s: option `--%s' doesn't allow an argument\n",
|
||||
argv[0], pfound->name);
|
||||
else
|
||||
/* +option or -option */
|
||||
fprintf (stderr,
|
||||
"%s: option `%c%s' doesn't allow an argument\n",
|
||||
argv[0], argv[optind - 1][0], pfound->name);
|
||||
}
|
||||
if (argv[optind - 1][1] == '-')
|
||||
/* --option */
|
||||
fprintf (stderr,
|
||||
_("%s: option `--%s' doesn't allow an argument\n"),
|
||||
argv[0], pfound->name);
|
||||
else
|
||||
/* +option or -option */
|
||||
fprintf (stderr,
|
||||
_("%s: option `%c%s' doesn't allow an argument\n"),
|
||||
argv[0], argv[optind - 1][0], pfound->name);
|
||||
|
||||
nextchar += strlen (nextchar);
|
||||
|
||||
optopt = pfound->val;
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
@@ -487,10 +625,12 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
else
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr, "%s: option `%s' requires an argument\n",
|
||||
fprintf (stderr,
|
||||
_("%s: option `%s' requires an argument\n"),
|
||||
argv[0], argv[optind - 1]);
|
||||
nextchar += strlen (nextchar);
|
||||
return '?';
|
||||
optopt = pfound->val;
|
||||
return optstring[0] == ':' ? ':' : '?';
|
||||
}
|
||||
}
|
||||
nextchar += strlen (nextchar);
|
||||
@@ -503,34 +643,33 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
}
|
||||
return pfound->val;
|
||||
}
|
||||
|
||||
/* Can't find it as a long option. If this is not getopt_long_only,
|
||||
or the option starts with '--' or is not a valid short
|
||||
option, then it's an error.
|
||||
Otherwise interpret it as a short option. */
|
||||
if (!long_only || argv[optind][1] == '-'
|
||||
#ifdef GETOPT_COMPAT
|
||||
|| argv[optind][0] == '+'
|
||||
#endif /* GETOPT_COMPAT */
|
||||
|| my_index (optstring, *nextchar) == NULL)
|
||||
{
|
||||
if (opterr)
|
||||
{
|
||||
if (argv[optind][1] == '-')
|
||||
/* --option */
|
||||
fprintf (stderr, "%s: unrecognized option `--%s'\n",
|
||||
fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
|
||||
argv[0], nextchar);
|
||||
else
|
||||
/* +option or -option */
|
||||
fprintf (stderr, "%s: unrecognized option `%c%s'\n",
|
||||
fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
|
||||
argv[0], argv[optind][0], nextchar);
|
||||
}
|
||||
nextchar = (char *) "";
|
||||
optind++;
|
||||
optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
|
||||
/* Look at and handle the next option-character. */
|
||||
/* Look at and handle the next short option-character. */
|
||||
|
||||
{
|
||||
char c = *nextchar++;
|
||||
@@ -544,12 +683,15 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
{
|
||||
if (opterr)
|
||||
{
|
||||
if (c < 040 || c >= 0177)
|
||||
fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
|
||||
if (posixly_correct)
|
||||
/* 1003.2 specifies the format of this message. */
|
||||
fprintf (stderr, _("%s: illegal option -- %c\n"),
|
||||
argv[0], c);
|
||||
else
|
||||
fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
|
||||
fprintf (stderr, _("%s: invalid option -- %c\n"),
|
||||
argv[0], c);
|
||||
}
|
||||
optopt = c;
|
||||
return '?';
|
||||
}
|
||||
if (temp[1] == ':')
|
||||
@@ -563,7 +705,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
optind++;
|
||||
}
|
||||
else
|
||||
optarg = 0;
|
||||
optarg = NULL;
|
||||
nextchar = NULL;
|
||||
}
|
||||
else
|
||||
@@ -579,9 +721,17 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
else if (optind == argc)
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr, "%s: option `-%c' requires an argument\n",
|
||||
argv[0], c);
|
||||
c = '?';
|
||||
{
|
||||
/* 1003.2 specifies the format of this message. */
|
||||
fprintf (stderr,
|
||||
_("%s: option requires an argument -- %c\n"),
|
||||
argv[0], c);
|
||||
}
|
||||
optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
c = ':';
|
||||
else
|
||||
c = '?';
|
||||
}
|
||||
else
|
||||
/* We already incremented `optind' once;
|
||||
@@ -605,6 +755,8 @@ getopt (argc, argv, optstring)
|
||||
(int *) 0,
|
||||
0);
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
|
||||
24
lib/getopt.h
24
lib/getopt.h
@@ -1,19 +1,19 @@
|
||||
/* Declarations for getopt.
|
||||
Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989, 90, 91, 92, 93, 94 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
#define _GETOPT_H 1
|
||||
@@ -49,6 +49,10 @@ extern int optind;
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
extern int optopt;
|
||||
|
||||
/* 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
|
||||
@@ -72,7 +76,7 @@ extern int opterr;
|
||||
|
||||
struct option
|
||||
{
|
||||
#if __STDC__
|
||||
#if defined (__STDC__) && __STDC__
|
||||
const char *name;
|
||||
#else
|
||||
char *name;
|
||||
@@ -90,15 +94,15 @@ struct option
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
#if __STDC__
|
||||
#if defined(__GNU_LIBRARY__)
|
||||
#if defined (__STDC__) && __STDC__
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* Many other libraries have conflicting prototypes for getopt, with
|
||||
differences in the consts, in stdlib.h. To avoid compilation
|
||||
errors, only prototype getopt for the GNU C library. */
|
||||
extern int getopt (int argc, char *const *argv, const char *shortopts);
|
||||
#else /* not __GNU_LIBRARY__ */
|
||||
extern int getopt ();
|
||||
#endif /* not __GNU_LIBRARY__ */
|
||||
#endif /* __GNU_LIBRARY__ */
|
||||
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
|
||||
const struct option *longopts, int *longind);
|
||||
extern int getopt_long_only (int argc, char *const *argv,
|
||||
@@ -116,7 +120,7 @@ extern int getopt_long ();
|
||||
extern int getopt_long_only ();
|
||||
|
||||
extern int _getopt_internal ();
|
||||
#endif /* not __STDC__ */
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,31 +1,55 @@
|
||||
/* Getopt for GNU.
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 1992 Free Software Foundation, Inc.
|
||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994
|
||||
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, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#ifndef __STDC__
|
||||
#define const
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined(STDC_HEADERS) || defined(__GNU_LIBRARY__) || defined (LIBC)
|
||||
#include "getopt.h"
|
||||
|
||||
#if !defined (__STDC__) || !__STDC__
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#include <stdlib.h>
|
||||
#else /* STDC_HEADERS or __GNU_LIBRARY__ */
|
||||
#else
|
||||
char *getenv ();
|
||||
#endif /* STDC_HEADERS or __GNU_LIBRARY__ */
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
@@ -47,7 +71,7 @@ getopt_long (argc, argv, options, long_options, opt_index)
|
||||
but does match a short option, it is parsed as a short option
|
||||
instead. */
|
||||
|
||||
int
|
||||
int
|
||||
getopt_long_only (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
@@ -57,6 +81,9 @@ getopt_long_only (argc, argv, options, long_options, opt_index)
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
||||
}
|
||||
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
|
||||
@@ -12,44 +12,33 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h> /* grp.h on alpha OSF1 V2.0 uses "FILE *". */
|
||||
#include <grp.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Even though SunOS 4, Ultrix 4, and 386BSD are mostly POSIX.1 compliant,
|
||||
their getgroups system call (except in the `System V' environment, which
|
||||
is troublesome in other ways) fills in an array of int, not gid_t
|
||||
(which is `short' on those systems). We do the same, for consistency.
|
||||
Kludge, kludge. */
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
#if !defined(sun) && !defined(ultrix) && !defined(__386BSD__)
|
||||
#define GETGROUPS_T gid_t
|
||||
#else /* sun or ultrix or 386BSD */
|
||||
#define GETGROUPS_T int
|
||||
#endif /* sun or ultrix or 386BSD */
|
||||
#else /* not _POSIX_VERSION */
|
||||
#define GETGROUPS_T int
|
||||
#endif /* not _POSIX_VERSION */
|
||||
|
||||
/* setgrent, getgrent, and endgrent are not specified by POSIX.1,
|
||||
so header files might not declare them.
|
||||
If you don't have them at all, we can't implement this function.
|
||||
You lose! */
|
||||
struct group *getgrent ();
|
||||
|
||||
#if defined(USG) || defined(STDC_HEADERS)
|
||||
#include <string.h>
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
/* Like `getgroups', but for user USERNAME instead of for
|
||||
|
||||
@@ -12,26 +12,32 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef SHELLS_FILE
|
||||
/* File containing a list of nonrestricted shells, one per line. */
|
||||
#define SHELLS_FILE "/etc/shells"
|
||||
# define SHELLS_FILE "/etc/shells"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
char *malloc ();
|
||||
char *realloc ();
|
||||
#endif
|
||||
|
||||
char *xstrdup ();
|
||||
|
||||
static int readname ();
|
||||
|
||||
/* List of shells to use if the shells file is missing. */
|
||||
@@ -54,6 +60,8 @@ static char *line = NULL;
|
||||
static int line_size = 0;
|
||||
|
||||
/* Return an entry from the shells file, ignoring comment lines.
|
||||
If the file doesn't exist, use the list in DEFAULT_SHELLS (above).
|
||||
In any case, the returned string is in memory allocated through malloc.
|
||||
Return NULL if there are no more entries. */
|
||||
|
||||
char *
|
||||
@@ -63,7 +71,7 @@ getusershell ()
|
||||
{
|
||||
if (default_shells[default_index])
|
||||
/* Not at the end of the list yet. */
|
||||
return default_shells[default_index++];
|
||||
return xstrdup (default_shells[default_index++]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -74,7 +82,7 @@ getusershell ()
|
||||
{
|
||||
/* No shells file. Use the default list. */
|
||||
default_index = 1;
|
||||
return default_shells[0];
|
||||
return xstrdup (default_shells[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +177,7 @@ readname (name, size, stream)
|
||||
/* Skip blank space. */
|
||||
while ((c = getc (stream)) != EOF && isspace (c))
|
||||
/* Do nothing. */ ;
|
||||
|
||||
|
||||
while (c != EOF && !isspace (c))
|
||||
{
|
||||
(*name)[name_index++] = c;
|
||||
|
||||
@@ -12,15 +12,19 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "backupfile.h"
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
int argmatch ();
|
||||
@@ -28,12 +32,12 @@ void invalid_arg ();
|
||||
|
||||
extern char *program_name;
|
||||
|
||||
static char *backup_args[] =
|
||||
static const char *const backup_args[] =
|
||||
{
|
||||
"never", "simple", "nil", "existing", "t", "numbered", 0
|
||||
};
|
||||
|
||||
static enum backup_type backup_types[] =
|
||||
static const enum backup_type backup_types[] =
|
||||
{
|
||||
simple, simple, numbered_existing, numbered_existing, numbered, numbered
|
||||
};
|
||||
|
||||
151
lib/group-member.c
Normal file
151
lib/group-member.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/* group-member.c -- determine whether group id is in calling user's group list
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "group-member.h"
|
||||
|
||||
char *xmalloc ();
|
||||
char *xrealloc ();
|
||||
|
||||
struct group_info
|
||||
{
|
||||
int n_groups;
|
||||
GETGROUPS_T *group;
|
||||
};
|
||||
|
||||
#ifdef HAVE_GETGROUPS
|
||||
|
||||
static void
|
||||
free_group_info (g)
|
||||
struct group_info *g;
|
||||
{
|
||||
free (g->group);
|
||||
free (g);
|
||||
}
|
||||
|
||||
static struct group_info *
|
||||
get_group_info ()
|
||||
{
|
||||
int n_groups;
|
||||
int n_group_slots;
|
||||
struct group_info *gi;
|
||||
GETGROUPS_T *group;
|
||||
|
||||
/* getgroups () returns the number of elements that it was able to
|
||||
place into the array. We simply continue to call getgroups ()
|
||||
until the number of elements placed into the array is smaller than
|
||||
the physical size of the array. */
|
||||
|
||||
group = NULL;
|
||||
n_groups = 0;
|
||||
n_group_slots = 0;
|
||||
while (n_groups == n_group_slots)
|
||||
{
|
||||
n_group_slots += 64;
|
||||
group = (GETGROUPS_T *) xrealloc (group,
|
||||
n_group_slots * sizeof (GETGROUPS_T));
|
||||
n_groups = getgroups (n_group_slots, group);
|
||||
}
|
||||
|
||||
/* In case of error, the user loses. */
|
||||
if (n_groups < 0)
|
||||
{
|
||||
free (group);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gi = (struct group_info *) xmalloc (sizeof (*gi));
|
||||
gi->n_groups = n_groups;
|
||||
gi->group = group;
|
||||
|
||||
return gi;
|
||||
}
|
||||
|
||||
#endif /* not HAVE_GETGROUPS */
|
||||
|
||||
/* Return non-zero if GID is one that we have in our groups list.
|
||||
If there is no getgroups function, return non-zero if GID matches
|
||||
either of the current or effective group IDs. */
|
||||
|
||||
int
|
||||
group_member (gid)
|
||||
gid_t gid;
|
||||
{
|
||||
#ifndef HAVE_GETGROUPS
|
||||
return ((gid == getgid ()) || (gid == getegid ()));
|
||||
#else
|
||||
int i;
|
||||
int found;
|
||||
struct group_info *gi;
|
||||
|
||||
gi = get_group_info ();
|
||||
if (gi == NULL)
|
||||
return 0;
|
||||
|
||||
/* Search through the list looking for GID. */
|
||||
found = 0;
|
||||
for (i = 0; i < gi->n_groups; i++)
|
||||
{
|
||||
if (gid == gi->group[i])
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free_group_info (gi);
|
||||
|
||||
return found;
|
||||
#endif /* HAVE_GETGROUPS */
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
char *program_name;
|
||||
|
||||
int
|
||||
main (int argc, char** argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
program_name = argv[0];
|
||||
|
||||
for (i=1; i<argc; i++)
|
||||
{
|
||||
gid_t gid;
|
||||
|
||||
gid = atoi (argv[i]);
|
||||
printf ("%d: %s\n", gid, group_member (gid) ? "yes" : "no");
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
||||
7
lib/group-member.h
Normal file
7
lib/group-member.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef GROUP_MEMBER_H_
|
||||
# define GROUP_MEMBER_H_ 1
|
||||
|
||||
int
|
||||
group_member ();
|
||||
|
||||
#endif /* GROUP_MEMBER_H_ */
|
||||
@@ -12,15 +12,19 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
|
||||
#if defined(USG) || defined(STDC_HEADERS)
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
@@ -199,7 +203,7 @@ getgidbyname (group)
|
||||
group_alist = tail;
|
||||
return &tail->id.g;
|
||||
}
|
||||
|
||||
|
||||
tail->next = nogroup_alist;
|
||||
nogroup_alist = tail;
|
||||
return 0;
|
||||
|
||||
46
lib/interlock
Executable file
46
lib/interlock
Executable file
@@ -0,0 +1,46 @@
|
||||
#! /bin/sh
|
||||
|
||||
# interlock - wrap program invocation in lock to allow
|
||||
# parallel builds to work.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>, Aug 10 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Usage:
|
||||
# interlock lock-dir-name program args-to-program...
|
||||
|
||||
dirname="$1"
|
||||
program="$2"
|
||||
|
||||
shift
|
||||
shift
|
||||
|
||||
while (mkdir $dirname > /dev/null 2>&1 && exit 1 || exit 0); do
|
||||
# Wait a bit.
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Race condition here: if interrupted after the loop but before this
|
||||
# trap, the lock can be left around.
|
||||
trap "rmdir $dirname > /dev/null 2>&1" 1 2 3 15
|
||||
|
||||
# We have the lock, so run the program.
|
||||
$program ${1+"$@"}
|
||||
ret=$?
|
||||
|
||||
# Release the lock.
|
||||
rmdir $dirname > /dev/null 2>&1
|
||||
|
||||
exit $ret
|
||||
14
lib/isdir.c
14
lib/isdir.c
@@ -12,14 +12,22 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef STAT_MACROS_BROKEN
|
||||
#undef S_ISDIR
|
||||
#endif /* STAT_MACROS_BROKEN. */
|
||||
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
/* If PATH is an existing directory or symbolic link to a directory,
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* A `struct linebuffer' holds a line of text. */
|
||||
|
||||
@@ -24,19 +24,21 @@ struct linebuffer
|
||||
char *buffer;
|
||||
};
|
||||
|
||||
#ifdef __STDC__
|
||||
#undef PARAMS
|
||||
#if defined (__STDC__) && __STDC__
|
||||
# define PARAMS(Args) Args
|
||||
#else
|
||||
# define PARAMS(Args) ()
|
||||
#endif
|
||||
|
||||
/* Initialize linebuffer LINEBUFFER for use. */
|
||||
void initbuffer (struct linebuffer *linebuffer);
|
||||
void initbuffer PARAMS ((struct linebuffer *linebuffer));
|
||||
|
||||
/* Read an arbitrarily long line of text from STREAM into LINEBUFFER.
|
||||
Remove any newline. Does not null terminate.
|
||||
Return LINEBUFFER, except at end of file return 0. */
|
||||
struct linebuffer *readline (struct linebuffer *linebuffer, FILE *stream);
|
||||
struct linebuffer *readline PARAMS ((struct linebuffer *linebuffer,
|
||||
FILE *stream));
|
||||
|
||||
/* Free linebuffer LINEBUFFER and its data, all allocated with malloc. */
|
||||
void freebuffer (struct linebuffer *);
|
||||
#else
|
||||
void initbuffer ();
|
||||
struct linebuffer *readline ();
|
||||
void freebuffer ();
|
||||
#endif
|
||||
void freebuffer PARAMS ((struct linebuffer *));
|
||||
|
||||
80
lib/long-options.c
Normal file
80
lib/long-options.c
Normal file
@@ -0,0 +1,80 @@
|
||||
/* Utility to accept --help and --version options as unobtrusively as possible.
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include "long-options.h"
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'v'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* Process long options --help and --version, but only if argc == 2.
|
||||
Be careful not to gobble up `--'. */
|
||||
|
||||
void
|
||||
parse_long_options (argc, argv, command_name, package, version, usage)
|
||||
int argc;
|
||||
char **argv;
|
||||
const char *command_name;
|
||||
const char *package;
|
||||
const char *version;
|
||||
void (*usage)();
|
||||
{
|
||||
int c;
|
||||
int saved_opterr;
|
||||
int saved_optind;
|
||||
|
||||
saved_opterr = opterr;
|
||||
saved_optind = optind;
|
||||
|
||||
/* Don't print an error message for unrecognized options. */
|
||||
opterr = 0;
|
||||
|
||||
if (argc == 2
|
||||
&& (c = getopt_long (argc, argv, "+", long_options, (int *) 0)) != EOF)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'h':
|
||||
(*usage) (0);
|
||||
|
||||
case 'v':
|
||||
printf ("%s (%s) %s\n", command_name, package, version);
|
||||
exit (0);
|
||||
|
||||
default:
|
||||
/* Don't process any other long-named options. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Restore previous value. */
|
||||
opterr = saved_opterr;
|
||||
|
||||
/* Restore optind in case it has advanced past a leading `--'. */
|
||||
optind = saved_optind;
|
||||
}
|
||||
31
lib/long-options.h
Normal file
31
lib/long-options.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/* long-options.h -- declaration for --help- and --version-handling function.
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#undef PARAMS
|
||||
#if defined (__STDC__) && __STDC__
|
||||
# define PARAMS(Args) Args
|
||||
#else
|
||||
# define PARAMS(Args) ()
|
||||
#endif
|
||||
|
||||
void
|
||||
parse_long_options PARAMS ((int _argc, char **_argv,
|
||||
const char *_command_name,
|
||||
const char *_package,
|
||||
const char *_version, void (*_usage) (int)));
|
||||
152
lib/makepath.c
152
lib/makepath.c
@@ -12,48 +12,63 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu> and
|
||||
Jim Meyering <meyering@cs.utexas.edu>. */
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu> and Jim Meyering. */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define alloca __builtin_alloca
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if __GNUC__
|
||||
# define alloca __builtin_alloca
|
||||
#else
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#else
|
||||
#ifdef _AIX
|
||||
# if HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
#else
|
||||
# else
|
||||
char *alloca ();
|
||||
#endif
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#if STAT_MACROS_BROKEN
|
||||
# undef S_ISDIR
|
||||
#endif
|
||||
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ERRNO_H
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if defined(USG) || defined(STDC_HEADERS)
|
||||
#include <string.h>
|
||||
#define index strchr
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
# include <strings.h>
|
||||
# ifndef strchr
|
||||
# define strchr index
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __MSDOS__
|
||||
@@ -61,39 +76,58 @@ typedef int uid_t;
|
||||
typedef int gid_t;
|
||||
#endif
|
||||
|
||||
#include "makepath.h"
|
||||
|
||||
void error ();
|
||||
|
||||
/* Ensure that the directory ARGPATH exists.
|
||||
Remove any trailing slashes from ARGPATH before calling this function.
|
||||
|
||||
Make any leading directories that don't already exist, with
|
||||
Create any leading directories that don't already exist, with
|
||||
permissions PARENT_MODE.
|
||||
If the last element of ARGPATH does not exist, create it as
|
||||
a new directory with permissions MODE.
|
||||
If OWNER and GROUP are non-negative, make them the UID and GID of
|
||||
created directories.
|
||||
If OWNER and GROUP are non-negative, use them to set the UID and GID of
|
||||
any created directories.
|
||||
If VERBOSE_FMT_STRING is nonzero, use it as a printf format
|
||||
string for printing a message after successfully making a directory,
|
||||
with the name of the directory that was just made as an argument.
|
||||
If PRESERVE_EXISTING is non-zero and ARGPATH is an existing directory,
|
||||
then do not attempt to set its permissions and ownership.
|
||||
|
||||
Return 0 if ARGPATH exists as a directory with the proper
|
||||
ownership and permissions when done, otherwise 1. */
|
||||
|
||||
#if __STDC__
|
||||
int
|
||||
make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string)
|
||||
char *argpath;
|
||||
make_path (const char *argpath,
|
||||
int mode,
|
||||
int parent_mode,
|
||||
uid_t owner,
|
||||
gid_t group,
|
||||
int preserve_existing,
|
||||
const char *verbose_fmt_string)
|
||||
#else
|
||||
int
|
||||
make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
|
||||
verbose_fmt_string)
|
||||
const char *argpath;
|
||||
int mode;
|
||||
int parent_mode;
|
||||
uid_t owner;
|
||||
gid_t group;
|
||||
char *verbose_fmt_string;
|
||||
int preserve_existing;
|
||||
const char *verbose_fmt_string;
|
||||
#endif
|
||||
{
|
||||
char *dirpath; /* A copy we can scribble NULs on. */
|
||||
struct stat stats;
|
||||
int retval = 0;
|
||||
int oldmask = umask (0);
|
||||
|
||||
dirpath = alloca (strlen (argpath) + 1);
|
||||
/* FIXME: move this alloca and strcpy into the if-block.
|
||||
Set dirpath to argpath in the else-block. */
|
||||
dirpath = (char *) alloca (strlen (argpath) + 1);
|
||||
strcpy (dirpath, argpath);
|
||||
|
||||
if (stat (dirpath, &stats))
|
||||
@@ -127,14 +161,14 @@ make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string)
|
||||
slash = dirpath;
|
||||
while (*slash == '/')
|
||||
slash++;
|
||||
while ((slash = index (slash, '/')))
|
||||
while ((slash = strchr (slash, '/')))
|
||||
{
|
||||
*slash = '\0';
|
||||
if (stat (dirpath, &stats))
|
||||
{
|
||||
if (mkdir (dirpath, tmp_mode))
|
||||
{
|
||||
error (0, errno, "cannot make directory `%s'", dirpath);
|
||||
error (0, errno, "cannot create directory `%s'", dirpath);
|
||||
umask (oldmask);
|
||||
return 1;
|
||||
}
|
||||
@@ -145,7 +179,7 @@ make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string)
|
||||
|
||||
if (owner != (uid_t) -1 && group != (gid_t) -1
|
||||
&& chown (dirpath, owner, group)
|
||||
#ifdef AFS
|
||||
#if defined(AFS) && defined (EPERM)
|
||||
&& errno != EPERM
|
||||
#endif
|
||||
)
|
||||
@@ -179,11 +213,14 @@ make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string)
|
||||
}
|
||||
|
||||
/* We're done making leading directories.
|
||||
Make the final component of the path. */
|
||||
Create the final component of the path. */
|
||||
|
||||
if (mkdir (dirpath, mode))
|
||||
/* The path could end in "/." or contain "/..", so test
|
||||
if we really have to create the directory. */
|
||||
|
||||
if (stat (dirpath, &stats) && mkdir (dirpath, mode))
|
||||
{
|
||||
error (0, errno, "cannot make directory `%s'", dirpath);
|
||||
error (0, errno, "cannot create directory `%s'", dirpath);
|
||||
umask (oldmask);
|
||||
return 1;
|
||||
}
|
||||
@@ -233,26 +270,29 @@ make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* chown must precede chmod because on some systems,
|
||||
chown clears the set[ug]id bits for non-superusers,
|
||||
resulting in incorrect permissions.
|
||||
On System V, users can give away files with chown and then not
|
||||
be able to chmod them. So don't give files away. */
|
||||
if (!preserve_existing)
|
||||
{
|
||||
/* chown must precede chmod because on some systems,
|
||||
chown clears the set[ug]id bits for non-superusers,
|
||||
resulting in incorrect permissions.
|
||||
On System V, users can give away files with chown and then not
|
||||
be able to chmod them. So don't give files away. */
|
||||
|
||||
if (owner != (uid_t) -1 && group != (gid_t) -1
|
||||
&& chown (dirpath, owner, group)
|
||||
if (owner != (uid_t) -1 && group != (gid_t) -1
|
||||
&& chown (dirpath, owner, group)
|
||||
#ifdef AFS
|
||||
&& errno != EPERM
|
||||
&& errno != EPERM
|
||||
#endif
|
||||
)
|
||||
{
|
||||
error (0, errno, "%s", dirpath);
|
||||
retval = 1;
|
||||
}
|
||||
if (chmod (dirpath, mode))
|
||||
{
|
||||
error (0, errno, "%s", dirpath);
|
||||
retval = 1;
|
||||
)
|
||||
{
|
||||
error (0, errno, "%s", dirpath);
|
||||
retval = 1;
|
||||
}
|
||||
if (chmod (dirpath, mode))
|
||||
{
|
||||
error (0, errno, "%s", dirpath);
|
||||
retval = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
15
lib/makepath.h
Normal file
15
lib/makepath.h
Normal file
@@ -0,0 +1,15 @@
|
||||
# undef __P
|
||||
#if __STDC__
|
||||
# define __P(Args) Args
|
||||
#else
|
||||
# define __P(Args) ()
|
||||
#endif
|
||||
|
||||
int
|
||||
make_path __P ((const char *_argpath,
|
||||
int _mode,
|
||||
int _parent_mode,
|
||||
uid_t _owner,
|
||||
gid_t _group,
|
||||
int _preserve_existing,
|
||||
const char *_verbose_fmt_string));
|
||||
419
lib/md5.c
Normal file
419
lib/md5.c
Normal file
@@ -0,0 +1,419 @@
|
||||
/* md5.c - Functions to compute MD5 message digest of files or memory blocks
|
||||
according to the definition of MD5 in RFC 1321 from April 1992.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
NOTE: The canonical source of this file is maintained with the GNU C
|
||||
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#else
|
||||
# ifndef HAVE_MEMCPY
|
||||
# define memcpy(d, s, n) bcopy ((s), (d), (n))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "md5.h"
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define SWAP(n) \
|
||||
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
|
||||
#else
|
||||
# define SWAP(n) (n)
|
||||
#endif
|
||||
|
||||
|
||||
/* This array contains the bytes used to pad the buffer to the next
|
||||
64-byte boundary. (RFC 1321, 3.1: Step 1) */
|
||||
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
|
||||
|
||||
|
||||
/* Initialize structure containing state of computation.
|
||||
(RFC 1321, 3.3: Step 3) */
|
||||
void
|
||||
md5_init_ctx (ctx)
|
||||
struct md5_ctx *ctx;
|
||||
{
|
||||
ctx->A = 0x67452301;
|
||||
ctx->B = 0xefcdab89;
|
||||
ctx->C = 0x98badcfe;
|
||||
ctx->D = 0x10325476;
|
||||
|
||||
ctx->total[0] = ctx->total[1] = 0;
|
||||
ctx->buflen = 0;
|
||||
}
|
||||
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result
|
||||
must be in little endian byte order.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
void *
|
||||
md5_read_ctx (ctx, resbuf)
|
||||
const struct md5_ctx *ctx;
|
||||
void *resbuf;
|
||||
{
|
||||
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
|
||||
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
|
||||
((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
|
||||
((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
|
||||
|
||||
return resbuf;
|
||||
}
|
||||
|
||||
/* Process the remaining bytes in the internal buffer and the usual
|
||||
prolog according to the standard and write the result to RESBUF.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
void *
|
||||
md5_finish_ctx (ctx, resbuf)
|
||||
struct md5_ctx *ctx;
|
||||
void *resbuf;
|
||||
{
|
||||
/* Take yet unprocessed bytes into account. */
|
||||
md5_uint32 bytes = ctx->buflen;
|
||||
size_t pad;
|
||||
|
||||
/* Now count remaining bytes. */
|
||||
ctx->total[0] += bytes;
|
||||
if (ctx->total[0] < bytes)
|
||||
++ctx->total[1];
|
||||
|
||||
pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
|
||||
memcpy (&ctx->buffer[bytes], fillbuf, pad);
|
||||
|
||||
/* Put the 64-bit file length in *bits* at the end of the buffer. */
|
||||
*(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
|
||||
*(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
|
||||
(ctx->total[0] >> 29));
|
||||
|
||||
/* Process last bytes. */
|
||||
md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
|
||||
|
||||
return md5_read_ctx (ctx, resbuf);
|
||||
}
|
||||
|
||||
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 16 bytes
|
||||
beginning at RESBLOCK. */
|
||||
int
|
||||
md5_stream (stream, resblock)
|
||||
FILE *stream;
|
||||
void *resblock;
|
||||
{
|
||||
/* Important: BLOCKSIZE must be a multiple of 64. */
|
||||
#define BLOCKSIZE 4096
|
||||
struct md5_ctx ctx;
|
||||
char buffer[BLOCKSIZE + 72];
|
||||
size_t sum;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
md5_init_ctx (&ctx);
|
||||
|
||||
/* Iterate over full file contents. */
|
||||
while (1)
|
||||
{
|
||||
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
|
||||
computation function processes the whole buffer so that with the
|
||||
next round of the loop another block can be read. */
|
||||
size_t n;
|
||||
sum = 0;
|
||||
|
||||
/* Read block. Take care for partial reads. */
|
||||
do
|
||||
{
|
||||
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
|
||||
|
||||
sum += n;
|
||||
}
|
||||
while (sum < BLOCKSIZE && n != 0);
|
||||
if (n == 0 && ferror (stream))
|
||||
return 1;
|
||||
|
||||
/* If end of file is reached, end the loop. */
|
||||
if (n == 0)
|
||||
break;
|
||||
|
||||
/* Process buffer with BLOCKSIZE bytes. Note that
|
||||
BLOCKSIZE % 64 == 0
|
||||
*/
|
||||
md5_process_block (buffer, BLOCKSIZE, &ctx);
|
||||
}
|
||||
|
||||
/* Add the last bytes if necessary. */
|
||||
if (sum > 0)
|
||||
md5_process_bytes (buffer, sum, &ctx);
|
||||
|
||||
/* Construct result in desired memory. */
|
||||
md5_finish_ctx (&ctx, resblock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
void *
|
||||
md5_buffer (buffer, len, resblock)
|
||||
const char *buffer;
|
||||
size_t len;
|
||||
void *resblock;
|
||||
{
|
||||
struct md5_ctx ctx;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
md5_init_ctx (&ctx);
|
||||
|
||||
/* Process whole buffer but last len % 64 bytes. */
|
||||
md5_process_bytes (buffer, len, &ctx);
|
||||
|
||||
/* Put result in desired memory area. */
|
||||
return md5_finish_ctx (&ctx, resblock);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
md5_process_bytes (buffer, len, ctx)
|
||||
const void *buffer;
|
||||
size_t len;
|
||||
struct md5_ctx *ctx;
|
||||
{
|
||||
/* When we already have some bits in our internal buffer concatenate
|
||||
both inputs first. */
|
||||
if (ctx->buflen != 0)
|
||||
{
|
||||
size_t left_over = ctx->buflen;
|
||||
size_t add = 128 - left_over > len ? len : 128 - left_over;
|
||||
|
||||
memcpy (&ctx->buffer[left_over], buffer, add);
|
||||
ctx->buflen += add;
|
||||
|
||||
if (left_over + add > 64)
|
||||
{
|
||||
md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx);
|
||||
/* The regions in the following copy operation cannot overlap. */
|
||||
memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
|
||||
(left_over + add) & 63);
|
||||
ctx->buflen = (left_over + add) & 63;
|
||||
}
|
||||
|
||||
buffer = (const char *) buffer + add;
|
||||
len -= add;
|
||||
}
|
||||
|
||||
/* Process available complete blocks. */
|
||||
if (len > 64)
|
||||
{
|
||||
md5_process_block (buffer, len & ~63, ctx);
|
||||
buffer = (const char *) buffer + (len & ~63);
|
||||
len &= 63;
|
||||
}
|
||||
|
||||
/* Move remaining bytes in internal buffer. */
|
||||
if (len > 0)
|
||||
{
|
||||
memcpy (ctx->buffer, buffer, len);
|
||||
ctx->buflen = len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* These are the four functions used in the four steps of the MD5 algorithm
|
||||
and defined in the RFC 1321. The first function is a little bit optimized
|
||||
(as found in Colin Plumbs public domain implementation). */
|
||||
/* #define FF(b, c, d) ((b & c) | (~b & d)) */
|
||||
#define FF(b, c, d) (d ^ (b & (c ^ d)))
|
||||
#define FG(b, c, d) FF (d, b, c)
|
||||
#define FH(b, c, d) (b ^ c ^ d)
|
||||
#define FI(b, c, d) (c ^ (b | ~d))
|
||||
|
||||
/* Process LEN bytes of BUFFER, accumulating context into CTX.
|
||||
It is assumed that LEN % 64 == 0. */
|
||||
|
||||
void
|
||||
md5_process_block (buffer, len, ctx)
|
||||
const void *buffer;
|
||||
size_t len;
|
||||
struct md5_ctx *ctx;
|
||||
{
|
||||
md5_uint32 correct_words[16];
|
||||
const md5_uint32 *words = buffer;
|
||||
size_t nwords = len / sizeof (md5_uint32);
|
||||
const md5_uint32 *endp = words + nwords;
|
||||
md5_uint32 A = ctx->A;
|
||||
md5_uint32 B = ctx->B;
|
||||
md5_uint32 C = ctx->C;
|
||||
md5_uint32 D = ctx->D;
|
||||
|
||||
/* First increment the byte count. RFC 1321 specifies the possible
|
||||
length of the file up to 2^64 bits. Here we only compute the
|
||||
number of bytes. Do a double word increment. */
|
||||
ctx->total[0] += len;
|
||||
if (ctx->total[0] < len)
|
||||
++ctx->total[1];
|
||||
|
||||
/* Process all bytes in the buffer with 64 bytes in each round of
|
||||
the loop. */
|
||||
while (words < endp)
|
||||
{
|
||||
md5_uint32 *cwp = correct_words;
|
||||
md5_uint32 A_save = A;
|
||||
md5_uint32 B_save = B;
|
||||
md5_uint32 C_save = C;
|
||||
md5_uint32 D_save = D;
|
||||
|
||||
/* First round: using the given function, the context and a constant
|
||||
the next context is computed. Because the algorithms processing
|
||||
unit is a 32-bit word and it is determined to work on words in
|
||||
little endian byte order we perhaps have to change the byte order
|
||||
before the computation. To reduce the work for the next steps
|
||||
we store the swapped words in the array CORRECT_WORDS. */
|
||||
|
||||
#define OP(a, b, c, d, s, T) \
|
||||
do \
|
||||
{ \
|
||||
a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
|
||||
++words; \
|
||||
CYCLIC (a, s); \
|
||||
a += b; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* It is unfortunate that C does not provide an operator for
|
||||
cyclic rotation. Hope the C compiler is smart enough. */
|
||||
#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
|
||||
|
||||
/* Before we start, one word to the strange constants.
|
||||
They are defined in RFC 1321 as
|
||||
|
||||
T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
|
||||
*/
|
||||
|
||||
/* Round 1. */
|
||||
OP (A, B, C, D, 7, 0xd76aa478);
|
||||
OP (D, A, B, C, 12, 0xe8c7b756);
|
||||
OP (C, D, A, B, 17, 0x242070db);
|
||||
OP (B, C, D, A, 22, 0xc1bdceee);
|
||||
OP (A, B, C, D, 7, 0xf57c0faf);
|
||||
OP (D, A, B, C, 12, 0x4787c62a);
|
||||
OP (C, D, A, B, 17, 0xa8304613);
|
||||
OP (B, C, D, A, 22, 0xfd469501);
|
||||
OP (A, B, C, D, 7, 0x698098d8);
|
||||
OP (D, A, B, C, 12, 0x8b44f7af);
|
||||
OP (C, D, A, B, 17, 0xffff5bb1);
|
||||
OP (B, C, D, A, 22, 0x895cd7be);
|
||||
OP (A, B, C, D, 7, 0x6b901122);
|
||||
OP (D, A, B, C, 12, 0xfd987193);
|
||||
OP (C, D, A, B, 17, 0xa679438e);
|
||||
OP (B, C, D, A, 22, 0x49b40821);
|
||||
|
||||
/* For the second to fourth round we have the possibly swapped words
|
||||
in CORRECT_WORDS. Redefine the macro to take an additional first
|
||||
argument specifying the function to use. */
|
||||
#undef OP
|
||||
#define OP(f, a, b, c, d, k, s, T) \
|
||||
do \
|
||||
{ \
|
||||
a += f (b, c, d) + correct_words[k] + T; \
|
||||
CYCLIC (a, s); \
|
||||
a += b; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Round 2. */
|
||||
OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
|
||||
OP (FG, D, A, B, C, 6, 9, 0xc040b340);
|
||||
OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
|
||||
OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
|
||||
OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
|
||||
OP (FG, D, A, B, C, 10, 9, 0x02441453);
|
||||
OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
|
||||
OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
|
||||
OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
|
||||
OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
|
||||
OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
|
||||
OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
|
||||
OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
|
||||
OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
|
||||
OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
|
||||
OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
|
||||
|
||||
/* Round 3. */
|
||||
OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
|
||||
OP (FH, D, A, B, C, 8, 11, 0x8771f681);
|
||||
OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
|
||||
OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
|
||||
OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
|
||||
OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
|
||||
OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
|
||||
OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
|
||||
OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
|
||||
OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
|
||||
OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
|
||||
OP (FH, B, C, D, A, 6, 23, 0x04881d05);
|
||||
OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
|
||||
OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
|
||||
OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
|
||||
OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
|
||||
|
||||
/* Round 4. */
|
||||
OP (FI, A, B, C, D, 0, 6, 0xf4292244);
|
||||
OP (FI, D, A, B, C, 7, 10, 0x432aff97);
|
||||
OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
|
||||
OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
|
||||
OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
|
||||
OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
|
||||
OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
|
||||
OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
|
||||
OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
|
||||
OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
|
||||
OP (FI, C, D, A, B, 6, 15, 0xa3014314);
|
||||
OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
|
||||
OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
|
||||
OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
|
||||
OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
|
||||
OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
|
||||
|
||||
/* Add the starting values of the context. */
|
||||
A += A_save;
|
||||
B += B_save;
|
||||
C += C_save;
|
||||
D += D_save;
|
||||
}
|
||||
|
||||
/* Put checksum in context given as argument. */
|
||||
ctx->A = A;
|
||||
ctx->B = B;
|
||||
ctx->C = C;
|
||||
ctx->D = D;
|
||||
}
|
||||
146
lib/md5.h
Normal file
146
lib/md5.h
Normal file
@@ -0,0 +1,146 @@
|
||||
/* md5.h - Declaration of functions and data types used for MD5 sum
|
||||
computing library functions.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
NOTE: The canonical source of this file is maintained with the GNU C
|
||||
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _MD5_H
|
||||
#define _MD5_H 1
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined HAVE_LIMITS_H || _LIBC
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
/* The following contortions are an attempt to use the C preprocessor
|
||||
to determine an unsigned integral type that is 32 bits wide. An
|
||||
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
|
||||
doing that would require that the configure script compile and *run*
|
||||
the resulting executable. Locally running cross-compiled executables
|
||||
is usually not possible. */
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <sys/types.h>
|
||||
typedef u_int32_t md5_uint32;
|
||||
#else
|
||||
# if defined __STDC__ && __STDC__
|
||||
# define UINT_MAX_32_BITS 4294967295U
|
||||
# else
|
||||
# define UINT_MAX_32_BITS 0xFFFFFFFF
|
||||
# endif
|
||||
|
||||
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
|
||||
This should be valid for all systems GNU cares about because
|
||||
that doesn't include 16-bit systems, and only modern systems
|
||||
(that certainly have <limits.h>) have 64+-bit integral types. */
|
||||
|
||||
# ifndef UINT_MAX
|
||||
# define UINT_MAX UINT_MAX_32_BITS
|
||||
# endif
|
||||
|
||||
# if UINT_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned int md5_uint32;
|
||||
# else
|
||||
# if USHRT_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned short md5_uint32;
|
||||
# else
|
||||
# if ULONG_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned long md5_uint32;
|
||||
# else
|
||||
/* The following line is intended to evoke an error.
|
||||
Using #error is not portable enough. */
|
||||
"Cannot determine unsigned 32-bit data type."
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#undef __P
|
||||
#if defined (__STDC__) && __STDC__
|
||||
#define __P(x) x
|
||||
#else
|
||||
#define __P(x) ()
|
||||
#endif
|
||||
|
||||
/* Structure to save state of computation between the single steps. */
|
||||
struct md5_ctx
|
||||
{
|
||||
md5_uint32 A;
|
||||
md5_uint32 B;
|
||||
md5_uint32 C;
|
||||
md5_uint32 D;
|
||||
|
||||
md5_uint32 total[2];
|
||||
md5_uint32 buflen;
|
||||
char buffer[128];
|
||||
};
|
||||
|
||||
/*
|
||||
* The following three functions are build up the low level used in
|
||||
* the functions `md5_stream' and `md5_buffer'.
|
||||
*/
|
||||
|
||||
/* Initialize structure containing state of computation.
|
||||
(RFC 1321, 3.3: Step 3) */
|
||||
extern void md5_init_ctx __P ((struct md5_ctx *ctx));
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is necessary that LEN is a multiple of 64!!! */
|
||||
extern void md5_process_block __P ((const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx));
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is NOT required that LEN is a multiple of 64. */
|
||||
extern void md5_process_bytes __P ((const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx));
|
||||
|
||||
/* Process the remaining bytes in the buffer and put result from CTX
|
||||
in first 16 bytes following RESBUF. The result is always in little
|
||||
endian byte order, so that a byte-wise output yields to the wanted
|
||||
ASCII representation of the message digest.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
|
||||
|
||||
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result is
|
||||
always in little endian byte order, so that a byte-wise output yields
|
||||
to the wanted ASCII representation of the message digest.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
|
||||
|
||||
|
||||
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 16 bytes
|
||||
beginning at RESBLOCK. */
|
||||
extern int md5_stream __P ((FILE *stream, void *resblock));
|
||||
|
||||
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
|
||||
|
||||
#endif
|
||||
61
lib/memcasecmp.c
Normal file
61
lib/memcasecmp.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/* Case-insensitive buffer comparator.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Jim Meyering (meyering@na-net.ornl.gov) */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
|
||||
#define IN_CTYPE_DOMAIN(c) 1
|
||||
#else
|
||||
#define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||
#endif
|
||||
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
|
||||
|
||||
#if _LIBC || STDC_HEADERS
|
||||
# define TOLOWER(c) tolower (c)
|
||||
#else
|
||||
# define TOLOWER(c) (ISUPPER (c) ? tolower (c) : (c))
|
||||
#endif
|
||||
|
||||
#include "memcasecmp.h"
|
||||
|
||||
/* Like memcmp, but ignore differences in case. */
|
||||
|
||||
int
|
||||
memcasecmp (vs1, vs2, n)
|
||||
const void *vs1;
|
||||
const void *vs2;
|
||||
size_t n;
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned char *s1 = (unsigned char *) vs1;
|
||||
unsigned char *s2 = (unsigned char *) vs2;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
unsigned char u1 = *s1++;
|
||||
unsigned char u2 = *s2++;
|
||||
if (TOLOWER (u1) != TOLOWER (u2))
|
||||
return TOLOWER (u1) - TOLOWER (u2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
9
lib/memcasecmp.h
Normal file
9
lib/memcasecmp.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#undef PARAMS
|
||||
#if defined (__STDC__) && __STDC__
|
||||
# define PARAMS(Args) Args
|
||||
#else
|
||||
# define PARAMS(Args) ()
|
||||
#endif
|
||||
|
||||
int
|
||||
memcasecmp PARAMS ((const void *vs1, const void *vs2, size_t n));
|
||||
124
lib/memchr.c
124
lib/memchr.c
@@ -1,70 +1,114 @@
|
||||
/* Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
|
||||
Based on strlen implemention 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).
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#undef __ptr_t
|
||||
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
||||
# define __ptr_t void *
|
||||
#else /* Not C++ or ANSI C. */
|
||||
# define __ptr_t char *
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
#if defined (_LIBC)
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_LIMITS_H) || defined (_LIBC)
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#define LONG_MAX_32_BITS 2147483647
|
||||
|
||||
#ifndef LONG_MAX
|
||||
#define LONG_MAX LONG_MAX_32_BITS
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
/* Search no more than N bytes of S for C. */
|
||||
|
||||
char *
|
||||
memchr(s, c, n)
|
||||
unsigned char * s ;
|
||||
int c ;
|
||||
unsigned n;
|
||||
__ptr_t
|
||||
memchr (s, c, n)
|
||||
const __ptr_t s;
|
||||
int c;
|
||||
size_t n;
|
||||
{
|
||||
unsigned char *char_ptr;
|
||||
unsigned long int *longword_ptr;
|
||||
const unsigned char *char_ptr;
|
||||
const unsigned long int *longword_ptr;
|
||||
unsigned long int longword, magic_bits, charmask;
|
||||
|
||||
c = (unsigned char) c;
|
||||
|
||||
/* Handle the first few characters by reading one character at a time.
|
||||
Do this until CHAR_PTR is aligned on a 4-byte border. */
|
||||
for (char_ptr = s; n > 0 && ((unsigned long int) char_ptr & 3) != 0;
|
||||
Do this until CHAR_PTR is aligned on a longword boundary. */
|
||||
for (char_ptr = (const unsigned char *) s;
|
||||
n > 0 && ((unsigned long int) char_ptr
|
||||
& (sizeof (longword) - 1)) != 0;
|
||||
--n, ++char_ptr)
|
||||
if (*char_ptr == c)
|
||||
return (char *) char_ptr;
|
||||
return (__ptr_t) char_ptr;
|
||||
|
||||
/* All these elucidatory comments refer to 4-byte longwords,
|
||||
but the theory applies equally well to 8-byte longwords. */
|
||||
|
||||
longword_ptr = (unsigned long int *) char_ptr;
|
||||
|
||||
/* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
|
||||
the "holes." Note that there is a hole just to the left of
|
||||
each byte, with an extra at the end:
|
||||
|
||||
|
||||
bits: 01111110 11111110 11111110 11111111
|
||||
bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
|
||||
bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
|
||||
|
||||
The 1-bits make sure that carries propagate to the next 0-bit.
|
||||
The 0-bits provide holes for carries to fall into. */
|
||||
|
||||
if (sizeof (longword) != 4 && sizeof (longword) != 8)
|
||||
abort ();
|
||||
|
||||
#if LONG_MAX <= LONG_MAX_32_BITS
|
||||
magic_bits = 0x7efefeff;
|
||||
#else
|
||||
magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
|
||||
#endif
|
||||
|
||||
/* Set up a longword, each of whose bytes is C. */
|
||||
charmask = c | (c << 8);
|
||||
charmask |= charmask << 16;
|
||||
#if LONG_MAX > LONG_MAX_32_BITS
|
||||
charmask |= charmask << 32;
|
||||
#endif
|
||||
|
||||
/* Instead of the traditional loop which tests each character,
|
||||
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 zero. */
|
||||
while (n >= 4)
|
||||
while (n >= sizeof (longword))
|
||||
{
|
||||
/* We tentatively exit the loop if adding MAGIC_BITS to
|
||||
LONGWORD fails to change any of the hole bits of LONGWORD.
|
||||
@@ -104,10 +148,10 @@ memchr(s, c, n)
|
||||
|
||||
/* Add MAGIC_BITS to LONGWORD. */
|
||||
if ((((longword + magic_bits)
|
||||
|
||||
|
||||
/* Set those bits that were unchanged by the addition. */
|
||||
^ ~longword)
|
||||
|
||||
|
||||
/* Look at only the hole bits. If any of the hole bits
|
||||
are unchanged, most likely one of the bytes was a
|
||||
zero. */
|
||||
@@ -116,27 +160,37 @@ memchr(s, c, n)
|
||||
/* Which of the bytes was C? If none of them were, it was
|
||||
a misfire; continue the search. */
|
||||
|
||||
unsigned char *cp = ( unsigned char *) (longword_ptr - 1);
|
||||
const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
|
||||
|
||||
if (cp[0] == c)
|
||||
return (char *) cp;
|
||||
return (__ptr_t) cp;
|
||||
if (cp[1] == c)
|
||||
return (char *) &cp[1];
|
||||
return (__ptr_t) &cp[1];
|
||||
if (cp[2] == c)
|
||||
return (char *) &cp[2];
|
||||
return (__ptr_t) &cp[2];
|
||||
if (cp[3] == c)
|
||||
return (char *) &cp[3];
|
||||
return (__ptr_t) &cp[3];
|
||||
#if LONG_MAX > 2147483647
|
||||
if (cp[4] == c)
|
||||
return (__ptr_t) &cp[4];
|
||||
if (cp[5] == c)
|
||||
return (__ptr_t) &cp[5];
|
||||
if (cp[6] == c)
|
||||
return (__ptr_t) &cp[6];
|
||||
if (cp[7] == c)
|
||||
return (__ptr_t) &cp[7];
|
||||
#endif
|
||||
}
|
||||
|
||||
n -= 4;
|
||||
n -= sizeof (longword);
|
||||
}
|
||||
|
||||
char_ptr = ( unsigned char *) longword_ptr;
|
||||
char_ptr = (const unsigned char *) longword_ptr;
|
||||
|
||||
while (n-- > 0)
|
||||
{
|
||||
if (*char_ptr == c)
|
||||
return (char *) char_ptr;
|
||||
return (__ptr_t) char_ptr;
|
||||
else
|
||||
++char_ptr;
|
||||
}
|
||||
|
||||
373
lib/memcmp.c
Normal file
373
lib/memcmp.c
Normal file
@@ -0,0 +1,373 @@
|
||||
/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc.
|
||||
Contributed by Torbjorn Granlund (tege@sics.se).
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#undef __ptr_t
|
||||
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
||||
#define __ptr_t void *
|
||||
#else /* Not C++ or ANSI C. */
|
||||
#undef const
|
||||
#define const
|
||||
#define __ptr_t char *
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
#if defined (HAVE_STRING_H) || defined (_LIBC)
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
|
||||
#include <memcopy.h>
|
||||
|
||||
#else /* Not in the GNU C library. */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Type to use for aligned memory operations.
|
||||
This should normally be the biggest type supported by a single load
|
||||
and store. Must be an unsigned type. */
|
||||
#define op_t unsigned long int
|
||||
#define OPSIZ (sizeof(op_t))
|
||||
|
||||
/* Threshold value for when to enter the unrolled loops. */
|
||||
#define OP_T_THRES 16
|
||||
|
||||
/* Type to use for unaligned operations. */
|
||||
typedef unsigned char byte;
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
#define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
|
||||
#else
|
||||
#define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2)))
|
||||
#endif
|
||||
|
||||
#endif /* In the GNU C library. */
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1)
|
||||
#else
|
||||
#define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b))
|
||||
#endif
|
||||
|
||||
/* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */
|
||||
|
||||
/* The strategy of this memcmp is:
|
||||
|
||||
1. Compare bytes until one of the block pointers is aligned.
|
||||
|
||||
2. Compare using memcmp_common_alignment or
|
||||
memcmp_not_common_alignment, regarding the alignment of the other
|
||||
block after the initial byte operations. The maximum number of
|
||||
full words (of type op_t) are compared in this way.
|
||||
|
||||
3. Compare the few remaining bytes. */
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
/* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine.
|
||||
A and B are known to be different.
|
||||
This is needed only on little-endian machines. */
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static int
|
||||
memcmp_bytes (a, b)
|
||||
op_t a, b;
|
||||
{
|
||||
long int srcp1 = (long int) &a;
|
||||
long int srcp2 = (long int) &b;
|
||||
op_t a0, b0;
|
||||
|
||||
do
|
||||
{
|
||||
a0 = ((byte *) srcp1)[0];
|
||||
b0 = ((byte *) srcp2)[0];
|
||||
srcp1 += 1;
|
||||
srcp2 += 1;
|
||||
}
|
||||
while (a0 == b0);
|
||||
return a0 - b0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t'
|
||||
objects (not LEN bytes!). Both SRCP1 and SRCP2 should be aligned for
|
||||
memory operations on `op_t's. */
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static int
|
||||
memcmp_common_alignment (srcp1, srcp2, len)
|
||||
long int srcp1;
|
||||
long int srcp2;
|
||||
size_t len;
|
||||
{
|
||||
op_t a0, a1;
|
||||
op_t b0, b1;
|
||||
|
||||
switch (len % 4)
|
||||
{
|
||||
case 2:
|
||||
a0 = ((op_t *) srcp1)[0];
|
||||
b0 = ((op_t *) srcp2)[0];
|
||||
srcp1 -= 2 * OPSIZ;
|
||||
srcp2 -= 2 * OPSIZ;
|
||||
len += 2;
|
||||
goto do1;
|
||||
case 3:
|
||||
a1 = ((op_t *) srcp1)[0];
|
||||
b1 = ((op_t *) srcp2)[0];
|
||||
srcp1 -= OPSIZ;
|
||||
srcp2 -= OPSIZ;
|
||||
len += 1;
|
||||
goto do2;
|
||||
case 0:
|
||||
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
|
||||
return 0;
|
||||
a0 = ((op_t *) srcp1)[0];
|
||||
b0 = ((op_t *) srcp2)[0];
|
||||
goto do3;
|
||||
case 1:
|
||||
a1 = ((op_t *) srcp1)[0];
|
||||
b1 = ((op_t *) srcp2)[0];
|
||||
srcp1 += OPSIZ;
|
||||
srcp2 += OPSIZ;
|
||||
len -= 1;
|
||||
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
|
||||
goto do0;
|
||||
/* Fall through. */
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
a0 = ((op_t *) srcp1)[0];
|
||||
b0 = ((op_t *) srcp2)[0];
|
||||
if (a1 != b1)
|
||||
return CMP_LT_OR_GT (a1, b1);
|
||||
|
||||
do3:
|
||||
a1 = ((op_t *) srcp1)[1];
|
||||
b1 = ((op_t *) srcp2)[1];
|
||||
if (a0 != b0)
|
||||
return CMP_LT_OR_GT (a0, b0);
|
||||
|
||||
do2:
|
||||
a0 = ((op_t *) srcp1)[2];
|
||||
b0 = ((op_t *) srcp2)[2];
|
||||
if (a1 != b1)
|
||||
return CMP_LT_OR_GT (a1, b1);
|
||||
|
||||
do1:
|
||||
a1 = ((op_t *) srcp1)[3];
|
||||
b1 = ((op_t *) srcp2)[3];
|
||||
if (a0 != b0)
|
||||
return CMP_LT_OR_GT (a0, b0);
|
||||
|
||||
srcp1 += 4 * OPSIZ;
|
||||
srcp2 += 4 * OPSIZ;
|
||||
len -= 4;
|
||||
}
|
||||
while (len != 0);
|
||||
|
||||
/* This is the right position for do0. Please don't move
|
||||
it into the loop. */
|
||||
do0:
|
||||
if (a1 != b1)
|
||||
return CMP_LT_OR_GT (a1, b1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN
|
||||
`op_t' objects (not LEN bytes!). SRCP2 should be aligned for memory
|
||||
operations on `op_t', but SRCP1 *should be unaligned*. */
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static int
|
||||
memcmp_not_common_alignment (srcp1, srcp2, len)
|
||||
long int srcp1;
|
||||
long int srcp2;
|
||||
size_t len;
|
||||
{
|
||||
op_t a0, a1, a2, a3;
|
||||
op_t b0, b1, b2, b3;
|
||||
op_t x;
|
||||
int shl, shr;
|
||||
|
||||
/* Calculate how to shift a word read at the memory operation
|
||||
aligned srcp1 to make it aligned for comparison. */
|
||||
|
||||
shl = 8 * (srcp1 % OPSIZ);
|
||||
shr = 8 * OPSIZ - shl;
|
||||
|
||||
/* Make SRCP1 aligned by rounding it down to the beginning of the `op_t'
|
||||
it points in the middle of. */
|
||||
srcp1 &= -OPSIZ;
|
||||
|
||||
switch (len % 4)
|
||||
{
|
||||
case 2:
|
||||
a1 = ((op_t *) srcp1)[0];
|
||||
a2 = ((op_t *) srcp1)[1];
|
||||
b2 = ((op_t *) srcp2)[0];
|
||||
srcp1 -= 1 * OPSIZ;
|
||||
srcp2 -= 2 * OPSIZ;
|
||||
len += 2;
|
||||
goto do1;
|
||||
case 3:
|
||||
a0 = ((op_t *) srcp1)[0];
|
||||
a1 = ((op_t *) srcp1)[1];
|
||||
b1 = ((op_t *) srcp2)[0];
|
||||
srcp2 -= 1 * OPSIZ;
|
||||
len += 1;
|
||||
goto do2;
|
||||
case 0:
|
||||
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
|
||||
return 0;
|
||||
a3 = ((op_t *) srcp1)[0];
|
||||
a0 = ((op_t *) srcp1)[1];
|
||||
b0 = ((op_t *) srcp2)[0];
|
||||
srcp1 += 1 * OPSIZ;
|
||||
goto do3;
|
||||
case 1:
|
||||
a2 = ((op_t *) srcp1)[0];
|
||||
a3 = ((op_t *) srcp1)[1];
|
||||
b3 = ((op_t *) srcp2)[0];
|
||||
srcp1 += 2 * OPSIZ;
|
||||
srcp2 += 1 * OPSIZ;
|
||||
len -= 1;
|
||||
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
|
||||
goto do0;
|
||||
/* Fall through. */
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
a0 = ((op_t *) srcp1)[0];
|
||||
b0 = ((op_t *) srcp2)[0];
|
||||
x = MERGE(a2, shl, a3, shr);
|
||||
if (x != b3)
|
||||
return CMP_LT_OR_GT (x, b3);
|
||||
|
||||
do3:
|
||||
a1 = ((op_t *) srcp1)[1];
|
||||
b1 = ((op_t *) srcp2)[1];
|
||||
x = MERGE(a3, shl, a0, shr);
|
||||
if (x != b0)
|
||||
return CMP_LT_OR_GT (x, b0);
|
||||
|
||||
do2:
|
||||
a2 = ((op_t *) srcp1)[2];
|
||||
b2 = ((op_t *) srcp2)[2];
|
||||
x = MERGE(a0, shl, a1, shr);
|
||||
if (x != b1)
|
||||
return CMP_LT_OR_GT (x, b1);
|
||||
|
||||
do1:
|
||||
a3 = ((op_t *) srcp1)[3];
|
||||
b3 = ((op_t *) srcp2)[3];
|
||||
x = MERGE(a1, shl, a2, shr);
|
||||
if (x != b2)
|
||||
return CMP_LT_OR_GT (x, b2);
|
||||
|
||||
srcp1 += 4 * OPSIZ;
|
||||
srcp2 += 4 * OPSIZ;
|
||||
len -= 4;
|
||||
}
|
||||
while (len != 0);
|
||||
|
||||
/* This is the right position for do0. Please don't move
|
||||
it into the loop. */
|
||||
do0:
|
||||
x = MERGE(a2, shl, a3, shr);
|
||||
if (x != b3)
|
||||
return CMP_LT_OR_GT (x, b3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
memcmp (s1, s2, len)
|
||||
const __ptr_t s1;
|
||||
const __ptr_t s2;
|
||||
size_t len;
|
||||
{
|
||||
op_t a0;
|
||||
op_t b0;
|
||||
long int srcp1 = (long int) s1;
|
||||
long int srcp2 = (long int) s2;
|
||||
op_t res;
|
||||
|
||||
if (len >= OP_T_THRES)
|
||||
{
|
||||
/* There are at least some bytes to compare. No need to test
|
||||
for LEN == 0 in this alignment loop. */
|
||||
while (srcp2 % OPSIZ != 0)
|
||||
{
|
||||
a0 = ((byte *) srcp1)[0];
|
||||
b0 = ((byte *) srcp2)[0];
|
||||
srcp1 += 1;
|
||||
srcp2 += 1;
|
||||
res = a0 - b0;
|
||||
if (res != 0)
|
||||
return res;
|
||||
len -= 1;
|
||||
}
|
||||
|
||||
/* SRCP2 is now aligned for memory operations on `op_t'.
|
||||
SRCP1 alignment determines if we can do a simple,
|
||||
aligned compare or need to shuffle bits. */
|
||||
|
||||
if (srcp1 % OPSIZ == 0)
|
||||
res = memcmp_common_alignment (srcp1, srcp2, len / OPSIZ);
|
||||
else
|
||||
res = memcmp_not_common_alignment (srcp1, srcp2, len / OPSIZ);
|
||||
if (res != 0)
|
||||
return res;
|
||||
|
||||
/* Number of bytes remaining in the interval [0..OPSIZ-1]. */
|
||||
srcp1 += len & -OPSIZ;
|
||||
srcp2 += len & -OPSIZ;
|
||||
len %= OPSIZ;
|
||||
}
|
||||
|
||||
/* There are just a few bytes to compare. Use byte memory operations. */
|
||||
while (len != 0)
|
||||
{
|
||||
a0 = ((byte *) srcp1)[0];
|
||||
b0 = ((byte *) srcp2)[0];
|
||||
srcp1 += 1;
|
||||
srcp2 += 1;
|
||||
res = a0 - b0;
|
||||
if (res != 0)
|
||||
return res;
|
||||
len -= 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
#undef bcmp
|
||||
weak_alias (memcmp, bcmp)
|
||||
#endif
|
||||
|
||||
|
||||
20
lib/memcpy.c
Normal file
20
lib/memcpy.c
Normal file
@@ -0,0 +1,20 @@
|
||||
/* Copy LEN bytes starting at SRCADDR to DESTADDR. Result undefined
|
||||
if the source overlaps with the destination.
|
||||
Return DESTADDR. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
char *
|
||||
memcpy (destaddr, srcaddr, len)
|
||||
char *destaddr;
|
||||
const char *srcaddr;
|
||||
int len;
|
||||
{
|
||||
char *dest = destaddr;
|
||||
|
||||
while (len-- > 0)
|
||||
*destaddr++ = *srcaddr++;
|
||||
return dest;
|
||||
}
|
||||
28
lib/memmove.c
Normal file
28
lib/memmove.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/* memmove.c -- copy memory.
|
||||
Copy LENGTH bytes from SOURCE to DEST. Does not null-terminate.
|
||||
In the public domain.
|
||||
By David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
void *
|
||||
memmove (dest, source, length)
|
||||
char *dest;
|
||||
const char *source;
|
||||
unsigned length;
|
||||
{
|
||||
char *d0 = dest;
|
||||
if (source < dest)
|
||||
/* Moving from low mem to hi mem; start at end. */
|
||||
for (source += length, dest += length; length; --length)
|
||||
*--dest = *--source;
|
||||
else if (source != dest)
|
||||
{
|
||||
/* Moving from hi mem to low mem; start at beginning. */
|
||||
for (; length; --length)
|
||||
*dest++ = *source++;
|
||||
}
|
||||
return (void *) d0;
|
||||
}
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
char *
|
||||
memset (str, c, len)
|
||||
|
||||
72
lib/mkdir.c
72
lib/mkdir.c
@@ -1,4 +1,4 @@
|
||||
/* mkrmdir.c -- BSD compatible directory functions for System V
|
||||
/* BSD compatible make directory function for System V
|
||||
Copyright (C) 1988, 1990 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -12,17 +12,29 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#ifndef STDC_HEADERS
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
/* mkdir and rmdir adapted from GNU tar. */
|
||||
#if STAT_MACROS_BROKEN
|
||||
# undef S_ISDIR
|
||||
#endif
|
||||
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
/* mkdir adapted from GNU tar. */
|
||||
|
||||
/* Make directory DPATH, with permission mode DMODE.
|
||||
|
||||
@@ -57,7 +69,7 @@ mkdir (dpath, dmode)
|
||||
switch (cpid)
|
||||
{
|
||||
case -1: /* Cannot fork. */
|
||||
return -1; /* errno is set already. */
|
||||
return -1; /* errno is already set. */
|
||||
|
||||
case 0: /* Child process. */
|
||||
/* Cheap hack to set mode of new directory. Since this child
|
||||
@@ -70,56 +82,16 @@ mkdir (dpath, dmode)
|
||||
_exit (1);
|
||||
|
||||
default: /* Parent process. */
|
||||
while (wait (&status) != cpid) /* Wait for kid to finish. */
|
||||
/* Wait for kid to finish. */
|
||||
while (wait (&status) != cpid)
|
||||
/* Do nothing. */ ;
|
||||
|
||||
if (status & 0xFFFF)
|
||||
{
|
||||
errno = EIO; /* /bin/mkdir failed. */
|
||||
/* /bin/mkdir failed. */
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
return chmod (dpath, dmode);
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove directory DPATH.
|
||||
Return 0 if successful, -1 if not. */
|
||||
|
||||
int
|
||||
rmdir (dpath)
|
||||
char *dpath;
|
||||
{
|
||||
int cpid, status;
|
||||
struct stat statbuf;
|
||||
|
||||
if (stat (dpath, &statbuf) != 0)
|
||||
return -1; /* stat set errno. */
|
||||
|
||||
if ((statbuf.st_mode & S_IFMT) != S_IFDIR)
|
||||
{
|
||||
errno = ENOTDIR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
cpid = fork ();
|
||||
switch (cpid)
|
||||
{
|
||||
case -1: /* Cannot fork. */
|
||||
return -1; /* errno is set already. */
|
||||
|
||||
case 0: /* Child process. */
|
||||
execl ("/bin/rmdir", "rmdir", dpath, (char *) 0);
|
||||
_exit (1);
|
||||
|
||||
default: /* Parent process. */
|
||||
while (wait (&status) != cpid) /* Wait for kid to finish. */
|
||||
/* Do nothing. */ ;
|
||||
|
||||
if (status & 0xFFFF)
|
||||
{
|
||||
errno = EIO; /* /bin/rmdir failed. */
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
596
lib/mktime.c
596
lib/mktime.c
@@ -1,224 +1,408 @@
|
||||
/* Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
Contributed by Paul Eggert (eggert@twinsun.com).
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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.
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#ifndef STDC_HEADERS
|
||||
extern int errno;
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Define this to have a standalone program to test this implementation of
|
||||
mktime. */
|
||||
/* #define DEBUG 1 */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#ifdef TM_IN_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
|
||||
/* Assume that leap seconds are possible, unless told otherwise.
|
||||
If the host has a `zic' command with a `-L leapsecondfilename' option,
|
||||
then it supports leap seconds; otherwise it probably doesn't. */
|
||||
#ifndef LEAP_SECONDS_POSSIBLE
|
||||
#define LEAP_SECONDS_POSSIBLE 1
|
||||
#endif
|
||||
|
||||
#include <sys/types.h> /* Some systems define `time_t' here. */
|
||||
#include <time.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIMITS_H
|
||||
|
||||
#if __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS
|
||||
#include <limits.h>
|
||||
#else
|
||||
#define LONG_MAX (~(1 << (sizeof (long) * 8 - 1)))
|
||||
#define LONG_MIN (-LONG_MAX - 1)
|
||||
#define INT_MAX (~(1 << (sizeof (int) * 8 - 1)))
|
||||
#define INT_MIN (-INT_MAX - 1)
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#if __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
/* Make it work even if the system's libc has its own mktime routine. */
|
||||
#define mktime my_mktime
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef __P
|
||||
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
#define __P(args) args
|
||||
#else
|
||||
#define __P(args) ()
|
||||
#endif /* GCC. */
|
||||
#endif /* Not __P. */
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
#define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
#ifndef INT_MIN
|
||||
#define INT_MIN (~0 << (sizeof (int) * CHAR_BIT - 1))
|
||||
#endif
|
||||
#ifndef INT_MAX
|
||||
#define INT_MAX (~0 - INT_MIN)
|
||||
#endif
|
||||
|
||||
#ifndef TIME_T_MIN
|
||||
#define TIME_T_MIN (0 < (time_t) -1 ? (time_t) 0 \
|
||||
: ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))
|
||||
#endif
|
||||
#ifndef TIME_T_MAX
|
||||
#define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
|
||||
#endif
|
||||
|
||||
#define TM_YEAR_BASE 1900
|
||||
#define EPOCH_YEAR 1970
|
||||
|
||||
#ifndef __isleap
|
||||
/* Nonzero if YEAR is a leap year (every 4 years,
|
||||
except every 100th isn't, and every 1000th is). */
|
||||
except every 100th isn't, and every 400th is). */
|
||||
#define __isleap(year) \
|
||||
((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 1000 == 0))
|
||||
((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
|
||||
#endif
|
||||
|
||||
/* How many days are in each month. */
|
||||
static unsigned short int __mon_lengths[2][12] =
|
||||
/* How many days come before each month (0-12). */
|
||||
const unsigned short int __mon_yday[2][13] =
|
||||
{
|
||||
/* Normal years. */
|
||||
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
|
||||
/* Leap years. */
|
||||
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
|
||||
};
|
||||
|
||||
static time_t ydhms_tm_diff __P ((int, int, int, int, int, const struct tm *));
|
||||
time_t __mktime_internal __P ((struct tm *,
|
||||
struct tm *(*) (const time_t *, struct tm *),
|
||||
time_t *));
|
||||
|
||||
|
||||
#if ! HAVE_LOCALTIME_R && ! defined (localtime_r)
|
||||
#ifdef _LIBC
|
||||
#define localtime_r __localtime_r
|
||||
#else
|
||||
/* Approximate localtime_r as best we can in its absence. */
|
||||
#define localtime_r my_localtime_r
|
||||
static struct tm *localtime_r __P ((const time_t *, struct tm *));
|
||||
static struct tm *
|
||||
localtime_r (t, tp)
|
||||
const time_t *t;
|
||||
struct tm *tp;
|
||||
{
|
||||
/* Normal years. */
|
||||
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
|
||||
/* Leap years. */
|
||||
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
||||
};
|
||||
|
||||
#define invalid() return (time_t) -1
|
||||
|
||||
/* Return the `time_t' representation of TP and normalizes TP.
|
||||
Return (time_t) -1 if TP is not representable as a `time_t'.
|
||||
Note that 31 Dec 1969 23:59:59 is not representable
|
||||
because it is represented as (time_t) -1. */
|
||||
time_t
|
||||
mktime(tp)
|
||||
register struct tm *tp;
|
||||
{
|
||||
static struct tm min, max;
|
||||
static char init = 0;
|
||||
|
||||
register time_t result;
|
||||
register time_t t;
|
||||
register int i;
|
||||
register unsigned short *l;
|
||||
register struct tm *new;
|
||||
time_t end;
|
||||
|
||||
if (tp == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
invalid();
|
||||
}
|
||||
|
||||
if (!init)
|
||||
{
|
||||
init = 1;
|
||||
end = (time_t) LONG_MIN;
|
||||
new = gmtime(&end);
|
||||
if (new != NULL)
|
||||
min = *new;
|
||||
else
|
||||
min.tm_sec = min.tm_min = min.tm_hour =
|
||||
min.tm_mday = min.tm_mon = min.tm_year = INT_MIN;
|
||||
|
||||
end = (time_t) LONG_MAX;
|
||||
new = gmtime(&end);
|
||||
if (new != NULL)
|
||||
max = *new;
|
||||
else
|
||||
max.tm_sec = max.tm_min = max.tm_hour =
|
||||
max.tm_mday = max.tm_mon = max.tm_year = INT_MAX;
|
||||
}
|
||||
|
||||
/* Make all the elements of TP that we pay attention to
|
||||
be within the ranges of reasonable values for those things. */
|
||||
#define normalize(elt, min, max, nextelt) \
|
||||
while (tp->elt < min) \
|
||||
{ \
|
||||
--tp->nextelt; \
|
||||
tp->elt += max + 1; \
|
||||
} \
|
||||
while (tp->elt > max) \
|
||||
{ \
|
||||
++tp->nextelt; \
|
||||
tp->elt -= max + 1; \
|
||||
}
|
||||
|
||||
normalize (tm_sec, 0, 59, tm_min);
|
||||
normalize (tm_min, 0, 59, tm_hour);
|
||||
normalize (tm_hour, 0, 24, tm_mday);
|
||||
|
||||
/* Normalize the month first so we can use
|
||||
it to figure the range for the day. */
|
||||
normalize (tm_mon, 0, 11, tm_year);
|
||||
normalize (tm_mday, 1, __mon_lengths[__isleap (tp->tm_year)][tp->tm_mon],
|
||||
tm_mon);
|
||||
|
||||
/* Normalize the month again, since normalizing
|
||||
the day may have pushed it out of range. */
|
||||
normalize (tm_mon, 0, 11, tm_year);
|
||||
|
||||
/* Normalize the day again, because normalizing
|
||||
the month may have changed the range. */
|
||||
normalize (tm_mday, 1, __mon_lengths[__isleap (tp->tm_year)][tp->tm_mon],
|
||||
tm_mon);
|
||||
|
||||
/* Check for out-of-range values. */
|
||||
#define lowhigh(field, minmax, cmp) (tp->field cmp minmax.field)
|
||||
#define low(field) lowhigh(field, min, <)
|
||||
#define high(field) lowhigh(field, max, >)
|
||||
#define oor(field) (low(field) || high(field))
|
||||
#define lowbound(field) (tp->field == min.field)
|
||||
#define highbound(field) (tp->field == max.field)
|
||||
if (oor(tm_year))
|
||||
invalid();
|
||||
else if (lowbound(tm_year))
|
||||
{
|
||||
if (low(tm_mon))
|
||||
invalid();
|
||||
else if (lowbound(tm_mon))
|
||||
{
|
||||
if (low(tm_mday))
|
||||
invalid();
|
||||
else if (lowbound(tm_mday))
|
||||
{
|
||||
if (low(tm_hour))
|
||||
invalid();
|
||||
else if (lowbound(tm_hour))
|
||||
{
|
||||
if (low(tm_min))
|
||||
invalid();
|
||||
else if (lowbound(tm_min))
|
||||
{
|
||||
if (low(tm_sec))
|
||||
invalid();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (highbound(tm_year))
|
||||
{
|
||||
if (high(tm_mon))
|
||||
invalid();
|
||||
else if (highbound(tm_mon))
|
||||
{
|
||||
if (high(tm_mday))
|
||||
invalid();
|
||||
else if (highbound(tm_mday))
|
||||
{
|
||||
if (high(tm_hour))
|
||||
invalid();
|
||||
else if (highbound(tm_hour))
|
||||
{
|
||||
if (high(tm_min))
|
||||
invalid();
|
||||
else if (highbound(tm_min))
|
||||
{
|
||||
if (high(tm_sec))
|
||||
invalid();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
t = 0;
|
||||
for (i = 1970; i > 1900 + tp->tm_year; --i)
|
||||
t -= __isleap(i) ? 366 : 365;
|
||||
for (i = 1970; i < 1900 + tp->tm_year; ++i)
|
||||
t += __isleap(i) ? 366 : 365;
|
||||
l = __mon_lengths[__isleap(1900 + tp->tm_year)];
|
||||
for (i = 0; i < tp->tm_mon; ++i)
|
||||
t += l[i];
|
||||
t += tp->tm_mday - 1;
|
||||
result = ((t * 60 * 60 * 24) +
|
||||
(tp->tm_hour * 60 * 60) +
|
||||
(tp->tm_min * 60) +
|
||||
tp->tm_sec);
|
||||
|
||||
end = result;
|
||||
#if 0 /* This code breaks it, on SunOS anyway. */
|
||||
if (tp->tm_isdst < 0)
|
||||
new = localtime(&end);
|
||||
else
|
||||
#endif
|
||||
new = gmtime(&end);
|
||||
if (new == NULL)
|
||||
invalid();
|
||||
new->tm_isdst = tp->tm_isdst;
|
||||
*tp = *new;
|
||||
|
||||
return result;
|
||||
struct tm *l = localtime (t);
|
||||
if (! l)
|
||||
return 0;
|
||||
*tp = *l;
|
||||
return tp;
|
||||
}
|
||||
#endif /* ! _LIBC */
|
||||
#endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
|
||||
|
||||
|
||||
/* Yield the difference between (YEAR-YDAY HOUR:MIN:SEC) and (*TP),
|
||||
measured in seconds, ignoring leap seconds.
|
||||
YEAR uses the same numbering as TM->tm_year.
|
||||
All values are in range, except possibly YEAR.
|
||||
If overflow occurs, yield the low order bits of the correct answer. */
|
||||
static time_t
|
||||
ydhms_tm_diff (year, yday, hour, min, sec, tp)
|
||||
int year, yday, hour, min, sec;
|
||||
const struct tm *tp;
|
||||
{
|
||||
time_t ay = year + (time_t) (TM_YEAR_BASE - 1);
|
||||
time_t by = tp->tm_year + (time_t) (TM_YEAR_BASE - 1);
|
||||
time_t intervening_leap_days =
|
||||
(ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400);
|
||||
time_t years = ay - by;
|
||||
time_t days = (365 * years + intervening_leap_days
|
||||
+ (yday - tp->tm_yday));
|
||||
return (60 * (60 * (24 * days + (hour - tp->tm_hour))
|
||||
+ (min - tp->tm_min))
|
||||
+ (sec - tp->tm_sec));
|
||||
}
|
||||
|
||||
|
||||
/* Convert *TP to a time_t value. */
|
||||
time_t
|
||||
mktime (tp)
|
||||
struct tm *tp;
|
||||
{
|
||||
static time_t localtime_offset;
|
||||
return __mktime_internal (tp, localtime_r, &localtime_offset);
|
||||
}
|
||||
|
||||
/* Convert *TP to a time_t value, inverting
|
||||
the monotonic and mostly-unit-linear conversion function CONVERT.
|
||||
Use *OFFSET to keep track of a guess at the offset of the result,
|
||||
compared to what the result would be for UTC without leap seconds.
|
||||
If *OFFSET's guess is correct, only one CONVERT call is needed. */
|
||||
time_t
|
||||
__mktime_internal (tp, convert, offset)
|
||||
struct tm *tp;
|
||||
struct tm *(*convert) __P ((const time_t *, struct tm *));
|
||||
time_t *offset;
|
||||
{
|
||||
time_t t, dt, t0;
|
||||
struct tm tm;
|
||||
|
||||
/* The maximum number of probes (calls to CONVERT) should be enough
|
||||
to handle any combinations of time zone rule changes, solar time,
|
||||
and leap seconds. Posix.1 prohibits leap seconds, but some hosts
|
||||
have them anyway. */
|
||||
int remaining_probes = 4;
|
||||
|
||||
/* Time requested. Copy it in case CONVERT modifies *TP; this can
|
||||
occur if TP is localtime's returned value and CONVERT is localtime. */
|
||||
int sec = tp->tm_sec;
|
||||
int min = tp->tm_min;
|
||||
int hour = tp->tm_hour;
|
||||
int mday = tp->tm_mday;
|
||||
int mon = tp->tm_mon;
|
||||
int year_requested = tp->tm_year;
|
||||
int isdst = tp->tm_isdst;
|
||||
|
||||
/* Ensure that mon is in range, and set year accordingly. */
|
||||
int mon_remainder = mon % 12;
|
||||
int negative_mon_remainder = mon_remainder < 0;
|
||||
int mon_years = mon / 12 - negative_mon_remainder;
|
||||
int year = year_requested + mon_years;
|
||||
|
||||
/* The other values need not be in range:
|
||||
the remaining code handles minor overflows correctly,
|
||||
assuming int and time_t arithmetic wraps around.
|
||||
Major overflows are caught at the end. */
|
||||
|
||||
/* Calculate day of year from year, month, and day of month.
|
||||
The result need not be in range. */
|
||||
int yday = ((__mon_yday[__isleap (year + TM_YEAR_BASE)]
|
||||
[mon_remainder + 12 * negative_mon_remainder])
|
||||
+ mday - 1);
|
||||
|
||||
#if LEAP_SECONDS_POSSIBLE
|
||||
/* Handle out-of-range seconds specially,
|
||||
since ydhms_tm_diff assumes every minute has 60 seconds. */
|
||||
int sec_requested = sec;
|
||||
if (sec < 0)
|
||||
sec = 0;
|
||||
if (59 < sec)
|
||||
sec = 59;
|
||||
#endif
|
||||
|
||||
/* Invert CONVERT by probing. First assume the same offset as last time.
|
||||
Then repeatedly use the error to improve the guess. */
|
||||
|
||||
tm.tm_year = EPOCH_YEAR - TM_YEAR_BASE;
|
||||
tm.tm_yday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
|
||||
t0 = ydhms_tm_diff (year, yday, hour, min, sec, &tm);
|
||||
|
||||
for (t = t0 + *offset;
|
||||
(dt = ydhms_tm_diff (year, yday, hour, min, sec, (*convert) (&t, &tm)));
|
||||
t += dt)
|
||||
if (--remaining_probes == 0)
|
||||
return -1;
|
||||
|
||||
/* Check whether tm.tm_isdst has the requested value, if any. */
|
||||
if (0 <= isdst && 0 <= tm.tm_isdst)
|
||||
{
|
||||
int dst_diff = (isdst != 0) - (tm.tm_isdst != 0);
|
||||
if (dst_diff)
|
||||
{
|
||||
/* Move two hours in the direction indicated by the disagreement,
|
||||
probe some more, and switch to a new time if found.
|
||||
The largest known fallback due to daylight savings is two hours:
|
||||
once, in Newfoundland, 1988-10-30 02:00 -> 00:00. */
|
||||
time_t ot = t - 2 * 60 * 60 * dst_diff;
|
||||
while (--remaining_probes != 0)
|
||||
{
|
||||
struct tm otm;
|
||||
if (! (dt = ydhms_tm_diff (year, yday, hour, min, sec,
|
||||
(*convert) (&ot, &otm))))
|
||||
{
|
||||
t = ot;
|
||||
tm = otm;
|
||||
break;
|
||||
}
|
||||
if ((ot += dt) == t)
|
||||
break; /* Avoid a redundant probe. */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*offset = t - t0;
|
||||
|
||||
#if LEAP_SECONDS_POSSIBLE
|
||||
if (sec_requested != tm.tm_sec)
|
||||
{
|
||||
/* Adjust time to reflect the tm_sec requested, not the normalized value.
|
||||
Also, repair any damage from a false match due to a leap second. */
|
||||
t += sec_requested - sec + (sec == 0 && tm.tm_sec == 60);
|
||||
(*convert) (&t, &tm);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (TIME_T_MAX / INT_MAX / 366 / 24 / 60 / 60 < 3)
|
||||
{
|
||||
/* time_t isn't large enough to rule out overflows in ydhms_tm_diff,
|
||||
so check for major overflows. A gross check suffices,
|
||||
since if t has overflowed, it is off by a multiple of
|
||||
TIME_T_MAX - TIME_T_MIN + 1. So ignore any component of
|
||||
the difference that is bounded by a small value. */
|
||||
|
||||
double dyear = (double) year_requested + mon_years - tm.tm_year;
|
||||
double dday = 366 * dyear + mday;
|
||||
double dsec = 60 * (60 * (24 * dday + hour) + min) + sec_requested;
|
||||
|
||||
if (TIME_T_MAX / 3 - TIME_T_MIN / 3 < (dsec < 0 ? - dsec : dsec))
|
||||
return -1;
|
||||
}
|
||||
|
||||
*tp = tm;
|
||||
return t;
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
weak_alias (mktime, timelocal)
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
|
||||
static int
|
||||
not_equal_tm (a, b)
|
||||
struct tm *a;
|
||||
struct tm *b;
|
||||
{
|
||||
return ((a->tm_sec ^ b->tm_sec)
|
||||
| (a->tm_min ^ b->tm_min)
|
||||
| (a->tm_hour ^ b->tm_hour)
|
||||
| (a->tm_mday ^ b->tm_mday)
|
||||
| (a->tm_mon ^ b->tm_mon)
|
||||
| (a->tm_year ^ b->tm_year)
|
||||
| (a->tm_mday ^ b->tm_mday)
|
||||
| (a->tm_yday ^ b->tm_yday)
|
||||
| (a->tm_isdst ^ b->tm_isdst));
|
||||
}
|
||||
|
||||
static void
|
||||
print_tm (tp)
|
||||
struct tm *tp;
|
||||
{
|
||||
printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
|
||||
tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
|
||||
tp->tm_hour, tp->tm_min, tp->tm_sec,
|
||||
tp->tm_yday, tp->tm_wday, tp->tm_isdst);
|
||||
}
|
||||
|
||||
static int
|
||||
check_result (tk, tmk, tl, tml)
|
||||
time_t tk;
|
||||
struct tm tmk;
|
||||
time_t tl;
|
||||
struct tm tml;
|
||||
{
|
||||
if (tk != tl || not_equal_tm (&tmk, &tml))
|
||||
{
|
||||
printf ("mktime (");
|
||||
print_tm (&tmk);
|
||||
printf (")\nyields (");
|
||||
print_tm (&tml);
|
||||
printf (") == %ld, should be %ld\n", (long) tl, (long) tk);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int status = 0;
|
||||
struct tm tm, tmk, tml;
|
||||
time_t tk, tl;
|
||||
char trailer;
|
||||
|
||||
if ((argc == 3 || argc == 4)
|
||||
&& (sscanf (argv[1], "%d-%d-%d%c",
|
||||
&tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
|
||||
== 3)
|
||||
&& (sscanf (argv[2], "%d:%d:%d%c",
|
||||
&tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
|
||||
== 3))
|
||||
{
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
tm.tm_mon--;
|
||||
tm.tm_isdst = argc == 3 ? -1 : atoi (argv[3]);
|
||||
tmk = tm;
|
||||
tl = mktime (&tmk);
|
||||
tml = *localtime (&tl);
|
||||
printf ("mktime returns %ld == ", (long) tl);
|
||||
print_tm (&tmk);
|
||||
printf ("\n");
|
||||
status = check_result (tl, tmk, tl, tml);
|
||||
}
|
||||
else if (argc == 4 || (argc == 5 && strcmp (argv[4], "-") == 0))
|
||||
{
|
||||
time_t from = atol (argv[1]);
|
||||
time_t by = atol (argv[2]);
|
||||
time_t to = atol (argv[3]);
|
||||
|
||||
if (argc == 4)
|
||||
for (tl = from; tl <= to; tl += by)
|
||||
{
|
||||
tml = *localtime (&tl);
|
||||
tmk = tml;
|
||||
tk = mktime (&tmk);
|
||||
status |= check_result (tk, tmk, tl, tml);
|
||||
}
|
||||
else
|
||||
for (tl = from; tl <= to; tl += by)
|
||||
{
|
||||
/* Null benchmark. */
|
||||
tml = *localtime (&tl);
|
||||
tmk = tml;
|
||||
tk = tl;
|
||||
status |= check_result (tk, tmk, tl, tml);
|
||||
}
|
||||
}
|
||||
else
|
||||
printf ("Usage:\
|
||||
\t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\
|
||||
\t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\
|
||||
\t%s FROM BY TO - # Do not test those values (for benchmark).\n",
|
||||
argv[0], argv[0], argv[0]);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
compile-command: "gcc -DDEBUG=1 -Wall -O -g mktime.c -o mktime"
|
||||
End:
|
||||
*/
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@ai.mit.edu> */
|
||||
|
||||
@@ -24,22 +24,30 @@
|
||||
changing the mode of many files, this probably results in a
|
||||
performance gain. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "modechange.h"
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
char *malloc ();
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
# define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#if STAT_MACROS_BROKEN
|
||||
# undef S_ISDIR
|
||||
#endif
|
||||
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
/* Return newly allocated memory to hold one element of type TYPE. */
|
||||
@@ -64,7 +72,7 @@ static int oatoi ();
|
||||
|
||||
struct mode_change *
|
||||
mode_compile (mode_string, masked_ops)
|
||||
register char *mode_string;
|
||||
const char *mode_string;
|
||||
unsigned masked_ops;
|
||||
{
|
||||
struct mode_change *head; /* First element of the linked list. */
|
||||
@@ -95,6 +103,9 @@ mode_compile (mode_string, masked_ops)
|
||||
umask (umask_value); /* Restore the old value. */
|
||||
|
||||
head = NULL;
|
||||
#ifdef lint
|
||||
change = NULL;
|
||||
#endif
|
||||
--mode_string;
|
||||
|
||||
/* One loop iteration for each "ugoa...=+-rwxXstugo...[=+-rwxXstugo...]". */
|
||||
@@ -233,7 +244,7 @@ invalid:
|
||||
unsigned short
|
||||
mode_adjust (oldmode, changes)
|
||||
unsigned oldmode;
|
||||
register struct mode_change *changes;
|
||||
const struct mode_change *changes;
|
||||
{
|
||||
unsigned short newmode; /* The adjusted mode and one operand. */
|
||||
unsigned short value; /* The other operand. */
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Masks for the `flags' field in a `struct mode_change'. */
|
||||
|
||||
@@ -44,12 +44,14 @@ struct mode_change
|
||||
#define MODE_INVALID (struct mode_change *) 0
|
||||
#define MODE_MEMORY_EXHAUSTED (struct mode_change *) 1
|
||||
|
||||
#ifdef __STDC__
|
||||
struct mode_change *mode_compile (char *, unsigned);
|
||||
unsigned short mode_adjust (unsigned, struct mode_change *);
|
||||
void mode_free (struct mode_change *);
|
||||
#else
|
||||
struct mode_change *mode_compile ();
|
||||
unsigned short mode_adjust ();
|
||||
void mode_free ();
|
||||
#ifndef __P
|
||||
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
# define __P(Args) Args
|
||||
# else
|
||||
# define __P(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
struct mode_change *mode_compile __P ((const char *, unsigned));
|
||||
unsigned short mode_adjust __P ((unsigned, const struct mode_change *));
|
||||
void mode_free __P ((struct mode_change *));
|
||||
|
||||
207
lib/mountlist.c
207
lib/mountlist.c
@@ -12,8 +12,12 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
@@ -24,7 +28,7 @@
|
||||
#else
|
||||
void free ();
|
||||
#endif
|
||||
#if defined(USG) || defined(STDC_HEADERS)
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
@@ -36,6 +40,15 @@ char *xrealloc ();
|
||||
char *xstrdup ();
|
||||
void error ();
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if defined (MOUNTED_GETFSSTAT) /* __alpha running OSF_1 */
|
||||
# include <sys/mount.h>
|
||||
# include <sys/fs_types.h>
|
||||
#endif /* MOUNTED_GETFSSTAT */
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
|
||||
#include <mntent.h>
|
||||
#if !defined(MOUNTED)
|
||||
@@ -53,7 +66,6 @@ void error ();
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNT /* Ultrix. */
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/fs_types.h>
|
||||
#endif
|
||||
@@ -68,6 +80,10 @@ void error ();
|
||||
#include <sys/statfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_LISTMNTENT
|
||||
#include <mntent.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
|
||||
#include <sys/mnttab.h>
|
||||
#endif
|
||||
@@ -77,6 +93,12 @@ void error ();
|
||||
#include <sys/vfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef DOLPHIN
|
||||
/* So special that it's not worth putting this in autoconf. */
|
||||
#undef MOUNTED_FREAD_FSTYP
|
||||
#define MOUNTED_GETMNTTBL
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
|
||||
/* Return the value of the hexadecimal number represented by CP.
|
||||
No prefix (like '0x') or suffix (like 'h') is expected to be
|
||||
@@ -87,7 +109,7 @@ xatoi (cp)
|
||||
char *cp;
|
||||
{
|
||||
int val;
|
||||
|
||||
|
||||
val = 0;
|
||||
while (*cp)
|
||||
{
|
||||
@@ -105,19 +127,17 @@ xatoi (cp)
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTENT1. */
|
||||
|
||||
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
|
||||
#if defined (MOUNTED_GETMNTINFO) && !defined (__NetBSD__)
|
||||
static char *
|
||||
fstype_to_string (t)
|
||||
short t;
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
case MOUNT_UFS:
|
||||
return "ufs";
|
||||
case MOUNT_NFS:
|
||||
return "nfs";
|
||||
#ifdef MOUNT_PC
|
||||
case MOUNT_PC:
|
||||
return "pc";
|
||||
#endif
|
||||
#ifdef MOUNT_MFS
|
||||
case MOUNT_MFS:
|
||||
return "mfs";
|
||||
@@ -133,6 +153,70 @@ fstype_to_string (t)
|
||||
#ifdef MOUNT_TMP
|
||||
case MOUNT_TMP:
|
||||
return "tmp";
|
||||
#endif
|
||||
#ifdef MOUNT_UFS
|
||||
case MOUNT_UFS:
|
||||
return "ufs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_NFS
|
||||
case MOUNT_NFS:
|
||||
return "nfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_MSDOS
|
||||
case MOUNT_MSDOS:
|
||||
return "msdos" ;
|
||||
#endif
|
||||
#ifdef MOUNT_LFS
|
||||
case MOUNT_LFS:
|
||||
return "lfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_LOFS
|
||||
case MOUNT_LOFS:
|
||||
return "lofs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_FDESC
|
||||
case MOUNT_FDESC:
|
||||
return "fdesc" ;
|
||||
#endif
|
||||
#ifdef MOUNT_PORTAL
|
||||
case MOUNT_PORTAL:
|
||||
return "portal" ;
|
||||
#endif
|
||||
#ifdef MOUNT_NULL
|
||||
case MOUNT_NULL:
|
||||
return "null" ;
|
||||
#endif
|
||||
#ifdef MOUNT_UMAP
|
||||
case MOUNT_UMAP:
|
||||
return "umap" ;
|
||||
#endif
|
||||
#ifdef MOUNT_KERNFS
|
||||
case MOUNT_KERNFS:
|
||||
return "kernfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_PROCFS
|
||||
case MOUNT_PROCFS:
|
||||
return "procfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_AFS
|
||||
case MOUNT_AFS:
|
||||
return "afs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_CD9660
|
||||
case MOUNT_CD9660:
|
||||
return "cd9660" ;
|
||||
#endif
|
||||
#ifdef MOUNT_UNION
|
||||
case MOUNT_UNION:
|
||||
return "union" ;
|
||||
#endif
|
||||
#ifdef MOUNT_DEVFS
|
||||
case MOUNT_DEVFS:
|
||||
return "devfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_EXT2FS
|
||||
case MOUNT_EXT2FS:
|
||||
return "ext2fs" ;
|
||||
#endif
|
||||
default:
|
||||
return "?";
|
||||
@@ -175,6 +259,36 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
me->me_next = NULL;
|
||||
mount_list = mtail = me;
|
||||
|
||||
#ifdef MOUNTED_LISTMNTENT
|
||||
{
|
||||
struct tabmntent *mntlist, *p;
|
||||
struct mntent *mnt;
|
||||
struct mount_entry *me;
|
||||
|
||||
/* the third and fourth arguments could be used to filter mounts,
|
||||
but Crays doesn't seem to have any mounts that we want to
|
||||
remove. Specifically, automount create normal NFS mounts.
|
||||
*/
|
||||
|
||||
if(listmntent(&mntlist, KMTAB, NULL, NULL) < 0)
|
||||
return NULL;
|
||||
p = mntlist;
|
||||
while(p){
|
||||
mnt = p->ment;
|
||||
me = (struct mount_entry*) xmalloc(sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup(mnt->mnt_fsname);
|
||||
me->me_mountdir = xstrdup(mnt->mnt_dir);
|
||||
me->me_type = xstrdup(mnt->mnt_type);
|
||||
me->me_dev = -1;
|
||||
me->me_next = NULL;
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
p = p->next;
|
||||
}
|
||||
freemntlist(mntlist);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
|
||||
{
|
||||
struct mntent *mnt;
|
||||
@@ -205,7 +319,7 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
me->me_dev = xatoi (devopt + 4);
|
||||
}
|
||||
else
|
||||
me->me_dev = -1; /* Magic; means not known yet. */
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
@@ -231,8 +345,12 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup (fsp->f_mntfromname);
|
||||
me->me_mountdir = xstrdup (fsp->f_mntonname);
|
||||
#ifdef __NetBSD__
|
||||
me->me_type = xstrdup (fsp->f_fstypename);
|
||||
#else
|
||||
me->me_type = fstype_to_string (fsp->f_type);
|
||||
me->me_dev = -1; /* Magic; means not known yet. */
|
||||
#endif
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
@@ -268,6 +386,43 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
}
|
||||
#endif /* MOUNTED_GETMNT. */
|
||||
|
||||
#if defined (MOUNTED_GETFSSTAT) /* __alpha running OSF_1 */
|
||||
{
|
||||
int numsys, counter, bufsize;
|
||||
struct statfs *stats;
|
||||
|
||||
numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
|
||||
if (numsys < 0)
|
||||
return (NULL);
|
||||
|
||||
bufsize = (1 + numsys) * sizeof (struct statfs);
|
||||
stats = (struct statfs *)xmalloc (bufsize);
|
||||
numsys = getfsstat (stats, bufsize, MNT_WAIT);
|
||||
|
||||
if (numsys < 0)
|
||||
{
|
||||
free (stats);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
for (counter = 0; counter < numsys; counter++)
|
||||
{
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup (stats[counter].f_mntfromname);
|
||||
me->me_mountdir = xstrdup (stats[counter].f_mntonname);
|
||||
me->me_type = mnt_names[stats[counter].f_type];
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
}
|
||||
|
||||
free (stats);
|
||||
}
|
||||
#endif /* MOUNTED_GETFSSTAT */
|
||||
|
||||
#if defined (MOUNTED_FREAD) || defined (MOUNTED_FREAD_FSTYP) /* SVR[23]. */
|
||||
{
|
||||
struct mnttab mnt;
|
||||
@@ -289,7 +444,7 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
strcpy (me->me_devname + 5, mnt.mt_dev);
|
||||
#endif
|
||||
me->me_mountdir = xstrdup (mnt.mt_filsys);
|
||||
me->me_dev = -1; /* Magic; means not known yet. */
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_type = "";
|
||||
#ifdef GETFSTYP /* SVR3. */
|
||||
if (need_fs_type)
|
||||
@@ -314,6 +469,26 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
}
|
||||
#endif /* MOUNTED_FREAD || MOUNTED_FREAD_FSTYP. */
|
||||
|
||||
#ifdef MOUNTED_GETMNTTBL /* DolphinOS goes it's own way */
|
||||
{
|
||||
struct mntent **mnttbl=getmnttbl(),**ent;
|
||||
for (ent=mnttbl;*ent;ent++)
|
||||
{
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup ( (*ent)->mt_resource);
|
||||
me->me_mountdir = xstrdup( (*ent)->mt_directory);
|
||||
me->me_type = xstrdup ((*ent)->mt_fstype);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
}
|
||||
endmnttbl();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
|
||||
{
|
||||
struct mnttab mnt;
|
||||
@@ -331,7 +506,7 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
me->me_devname = xstrdup (mnt.mnt_special);
|
||||
me->me_mountdir = xstrdup (mnt.mnt_mountp);
|
||||
me->me_type = xstrdup (mnt.mnt_fstype);
|
||||
me->me_dev = -1; /* Magic; means not known yet. */
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
@@ -378,12 +553,12 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
}
|
||||
else
|
||||
{
|
||||
me->me_devname = xstrdup (thisent +
|
||||
me->me_devname = xstrdup (thisent +
|
||||
vmp->vmt_data[VMT_OBJECT].vmt_off);
|
||||
}
|
||||
me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
|
||||
me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype));
|
||||
me->me_dev = -1; /* vmt_fsid might be the info we want. */
|
||||
me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* A mount table entry. */
|
||||
struct mount_entry
|
||||
|
||||
497
lib/obstack.c
Normal file
497
lib/obstack.c
Normal file
@@ -0,0 +1,497 @@
|
||||
/* obstack.c - subroutines used implicitly by object stack macros
|
||||
Copyright (C) 1988,89,90,91,92,93,94,96 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "obstack.h"
|
||||
|
||||
/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
|
||||
incremented whenever callers compiled using an old obstack.h can no
|
||||
longer properly call the functions in this obstack.c. */
|
||||
#define OBSTACK_INTERFACE_VERSION 1
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself, and the installed library
|
||||
supports the same library interface we do. This code is part of the GNU
|
||||
C Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object
|
||||
files, it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#include <stdio.h> /* Random thing to get __GNU_LIBRARY__. */
|
||||
#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
|
||||
#include <gnu-versions.h>
|
||||
#if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
|
||||
#define ELIDE_CODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
#define POINTER void *
|
||||
#else
|
||||
#define POINTER char *
|
||||
#endif
|
||||
|
||||
/* Determine default alignment. */
|
||||
struct fooalign {char x; double d;};
|
||||
#define DEFAULT_ALIGNMENT \
|
||||
((PTR_INT_TYPE) ((char *)&((struct fooalign *) 0)->d - (char *)0))
|
||||
/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
|
||||
But in fact it might be less smart and round addresses to as much as
|
||||
DEFAULT_ROUNDING. So we prepare for it to do that. */
|
||||
union fooround {long x; double d;};
|
||||
#define DEFAULT_ROUNDING (sizeof (union fooround))
|
||||
|
||||
/* When we copy a long block of data, this is the unit to do it with.
|
||||
On some machines, copying successive ints does not work;
|
||||
in such a case, redefine COPYING_UNIT to `long' (if that works)
|
||||
or `char' as a last resort. */
|
||||
#ifndef COPYING_UNIT
|
||||
#define COPYING_UNIT int
|
||||
#endif
|
||||
|
||||
/* The non-GNU-C macros copy the obstack into this global variable
|
||||
to avoid multiple evaluation. */
|
||||
|
||||
struct obstack *_obstack;
|
||||
|
||||
/* Define a macro that either calls functions with the traditional malloc/free
|
||||
calling interface, or calls functions with the mmalloc/mfree interface
|
||||
(that adds an extra first argument), based on the state of use_extra_arg.
|
||||
For free, do not use ?:, since some compilers, like the MIPS compilers,
|
||||
do not allow (expr) ? void : void. */
|
||||
|
||||
#define CALL_CHUNKFUN(h, size) \
|
||||
(((h) -> use_extra_arg) \
|
||||
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
|
||||
: (*(struct _obstack_chunk *(*) ()) (h)->chunkfun) ((size)))
|
||||
|
||||
#define CALL_FREEFUN(h, old_chunk) \
|
||||
do { \
|
||||
if ((h) -> use_extra_arg) \
|
||||
(*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
|
||||
else \
|
||||
(*(void (*) ()) (h)->freefun) ((old_chunk)); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
|
||||
Objects start on multiples of ALIGNMENT (0 means use default).
|
||||
CHUNKFUN is the function to use to allocate chunks,
|
||||
and FREEFUN the function to free them.
|
||||
|
||||
Return nonzero if successful, zero if out of memory.
|
||||
To recover from an out of memory error,
|
||||
free up some memory, then call this again. */
|
||||
|
||||
int
|
||||
_obstack_begin (h, size, alignment, chunkfun, freefun)
|
||||
struct obstack *h;
|
||||
int size;
|
||||
int alignment;
|
||||
POINTER (*chunkfun) ();
|
||||
void (*freefun) ();
|
||||
{
|
||||
register struct _obstack_chunk* chunk; /* points to new chunk */
|
||||
|
||||
if (alignment == 0)
|
||||
alignment = DEFAULT_ALIGNMENT;
|
||||
if (size == 0)
|
||||
/* Default size is what GNU malloc can fit in a 4096-byte block. */
|
||||
{
|
||||
/* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
|
||||
Use the values for range checking, because if range checking is off,
|
||||
the extra bytes won't be missed terribly, but if range checking is on
|
||||
and we used a larger request, a whole extra 4096 bytes would be
|
||||
allocated.
|
||||
|
||||
These number are irrelevant to the new GNU malloc. I suspect it is
|
||||
less sensitive to the size of the request. */
|
||||
int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
|
||||
+ 4 + DEFAULT_ROUNDING - 1)
|
||||
& ~(DEFAULT_ROUNDING - 1));
|
||||
size = 4096 - extra;
|
||||
}
|
||||
|
||||
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
|
||||
h->freefun = freefun;
|
||||
h->chunk_size = size;
|
||||
h->alignment_mask = alignment - 1;
|
||||
h->use_extra_arg = 0;
|
||||
|
||||
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
|
||||
if (!chunk)
|
||||
{
|
||||
h->alloc_failed = 1;
|
||||
return 0;
|
||||
}
|
||||
h->alloc_failed = 0;
|
||||
h->next_free = h->object_base = chunk->contents;
|
||||
h->chunk_limit = chunk->limit
|
||||
= (char *) chunk + h->chunk_size;
|
||||
chunk->prev = 0;
|
||||
/* The initial chunk now contains no empty object. */
|
||||
h->maybe_empty_object = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
_obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
|
||||
struct obstack *h;
|
||||
int size;
|
||||
int alignment;
|
||||
POINTER (*chunkfun) ();
|
||||
void (*freefun) ();
|
||||
POINTER arg;
|
||||
{
|
||||
register struct _obstack_chunk* chunk; /* points to new chunk */
|
||||
|
||||
if (alignment == 0)
|
||||
alignment = DEFAULT_ALIGNMENT;
|
||||
if (size == 0)
|
||||
/* Default size is what GNU malloc can fit in a 4096-byte block. */
|
||||
{
|
||||
/* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
|
||||
Use the values for range checking, because if range checking is off,
|
||||
the extra bytes won't be missed terribly, but if range checking is on
|
||||
and we used a larger request, a whole extra 4096 bytes would be
|
||||
allocated.
|
||||
|
||||
These number are irrelevant to the new GNU malloc. I suspect it is
|
||||
less sensitive to the size of the request. */
|
||||
int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
|
||||
+ 4 + DEFAULT_ROUNDING - 1)
|
||||
& ~(DEFAULT_ROUNDING - 1));
|
||||
size = 4096 - extra;
|
||||
}
|
||||
|
||||
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
|
||||
h->freefun = freefun;
|
||||
h->chunk_size = size;
|
||||
h->alignment_mask = alignment - 1;
|
||||
h->extra_arg = arg;
|
||||
h->use_extra_arg = 1;
|
||||
|
||||
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
|
||||
if (!chunk)
|
||||
{
|
||||
h->alloc_failed = 1;
|
||||
return 0;
|
||||
}
|
||||
h->alloc_failed = 0;
|
||||
h->next_free = h->object_base = chunk->contents;
|
||||
h->chunk_limit = chunk->limit
|
||||
= (char *) chunk + h->chunk_size;
|
||||
chunk->prev = 0;
|
||||
/* The initial chunk now contains no empty object. */
|
||||
h->maybe_empty_object = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Allocate a new current chunk for the obstack *H
|
||||
on the assumption that LENGTH bytes need to be added
|
||||
to the current object, or a new object of length LENGTH allocated.
|
||||
Copies any partial object from the end of the old chunk
|
||||
to the beginning of the new one. */
|
||||
|
||||
void
|
||||
_obstack_newchunk (h, length)
|
||||
struct obstack *h;
|
||||
int length;
|
||||
{
|
||||
register struct _obstack_chunk* old_chunk = h->chunk;
|
||||
register struct _obstack_chunk* new_chunk;
|
||||
register long new_size;
|
||||
register int obj_size = h->next_free - h->object_base;
|
||||
register int i;
|
||||
int already;
|
||||
|
||||
/* Compute size for new chunk. */
|
||||
new_size = (obj_size + length) + (obj_size >> 3) + 100;
|
||||
if (new_size < h->chunk_size)
|
||||
new_size = h->chunk_size;
|
||||
|
||||
/* Allocate and initialize the new chunk. */
|
||||
new_chunk = CALL_CHUNKFUN (h, new_size);
|
||||
if (!new_chunk)
|
||||
{
|
||||
h->alloc_failed = 1;
|
||||
return;
|
||||
}
|
||||
h->alloc_failed = 0;
|
||||
h->chunk = new_chunk;
|
||||
new_chunk->prev = old_chunk;
|
||||
new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
|
||||
|
||||
/* Move the existing object to the new chunk.
|
||||
Word at a time is fast and is safe if the object
|
||||
is sufficiently aligned. */
|
||||
if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT)
|
||||
{
|
||||
for (i = obj_size / sizeof (COPYING_UNIT) - 1;
|
||||
i >= 0; i--)
|
||||
((COPYING_UNIT *)new_chunk->contents)[i]
|
||||
= ((COPYING_UNIT *)h->object_base)[i];
|
||||
/* We used to copy the odd few remaining bytes as one extra COPYING_UNIT,
|
||||
but that can cross a page boundary on a machine
|
||||
which does not do strict alignment for COPYING_UNITS. */
|
||||
already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT);
|
||||
}
|
||||
else
|
||||
already = 0;
|
||||
/* Copy remaining bytes one by one. */
|
||||
for (i = already; i < obj_size; i++)
|
||||
new_chunk->contents[i] = h->object_base[i];
|
||||
|
||||
/* If the object just copied was the only data in OLD_CHUNK,
|
||||
free that chunk and remove it from the chain.
|
||||
But not if that chunk might contain an empty object. */
|
||||
if (h->object_base == old_chunk->contents && ! h->maybe_empty_object)
|
||||
{
|
||||
new_chunk->prev = old_chunk->prev;
|
||||
CALL_FREEFUN (h, old_chunk);
|
||||
}
|
||||
|
||||
h->object_base = new_chunk->contents;
|
||||
h->next_free = h->object_base + obj_size;
|
||||
/* The new chunk certainly contains no empty object yet. */
|
||||
h->maybe_empty_object = 0;
|
||||
}
|
||||
|
||||
/* Return nonzero if object OBJ has been allocated from obstack H.
|
||||
This is here for debugging.
|
||||
If you use it in a program, you are probably losing. */
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
/* Suppress -Wmissing-prototypes warning. We don't want to declare this in
|
||||
obstack.h because it is just for debugging. */
|
||||
int _obstack_allocated_p (struct obstack *h, POINTER obj);
|
||||
#endif
|
||||
|
||||
int
|
||||
_obstack_allocated_p (h, obj)
|
||||
struct obstack *h;
|
||||
POINTER obj;
|
||||
{
|
||||
register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
|
||||
register struct _obstack_chunk* plp; /* point to previous chunk if any */
|
||||
|
||||
lp = (h)->chunk;
|
||||
/* We use >= rather than > since the object cannot be exactly at
|
||||
the beginning of the chunk but might be an empty object exactly
|
||||
at the end of an adjacent chunk. */
|
||||
while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj))
|
||||
{
|
||||
plp = lp->prev;
|
||||
lp = plp;
|
||||
}
|
||||
return lp != 0;
|
||||
}
|
||||
|
||||
/* Free objects in obstack H, including OBJ and everything allocate
|
||||
more recently than OBJ. If OBJ is zero, free everything in H. */
|
||||
|
||||
#undef obstack_free
|
||||
|
||||
/* This function has two names with identical definitions.
|
||||
This is the first one, called from non-ANSI code. */
|
||||
|
||||
void
|
||||
_obstack_free (h, obj)
|
||||
struct obstack *h;
|
||||
POINTER obj;
|
||||
{
|
||||
register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
|
||||
register struct _obstack_chunk* plp; /* point to previous chunk if any */
|
||||
|
||||
lp = h->chunk;
|
||||
/* We use >= because there cannot be an object at the beginning of a chunk.
|
||||
But there can be an empty object at that address
|
||||
at the end of another chunk. */
|
||||
while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj))
|
||||
{
|
||||
plp = lp->prev;
|
||||
CALL_FREEFUN (h, lp);
|
||||
lp = plp;
|
||||
/* If we switch chunks, we can't tell whether the new current
|
||||
chunk contains an empty object, so assume that it may. */
|
||||
h->maybe_empty_object = 1;
|
||||
}
|
||||
if (lp)
|
||||
{
|
||||
h->object_base = h->next_free = (char *)(obj);
|
||||
h->chunk_limit = lp->limit;
|
||||
h->chunk = lp;
|
||||
}
|
||||
else if (obj != 0)
|
||||
/* obj is not in any of the chunks! */
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* This function is used from ANSI code. */
|
||||
|
||||
void
|
||||
obstack_free (h, obj)
|
||||
struct obstack *h;
|
||||
POINTER obj;
|
||||
{
|
||||
register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
|
||||
register struct _obstack_chunk* plp; /* point to previous chunk if any */
|
||||
|
||||
lp = h->chunk;
|
||||
/* We use >= because there cannot be an object at the beginning of a chunk.
|
||||
But there can be an empty object at that address
|
||||
at the end of another chunk. */
|
||||
while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj))
|
||||
{
|
||||
plp = lp->prev;
|
||||
CALL_FREEFUN (h, lp);
|
||||
lp = plp;
|
||||
/* If we switch chunks, we can't tell whether the new current
|
||||
chunk contains an empty object, so assume that it may. */
|
||||
h->maybe_empty_object = 1;
|
||||
}
|
||||
if (lp)
|
||||
{
|
||||
h->object_base = h->next_free = (char *)(obj);
|
||||
h->chunk_limit = lp->limit;
|
||||
h->chunk = lp;
|
||||
}
|
||||
else if (obj != 0)
|
||||
/* obj is not in any of the chunks! */
|
||||
abort ();
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* These are now turned off because the applications do not use it
|
||||
and it uses bcopy via obstack_grow, which causes trouble on sysV. */
|
||||
|
||||
/* Now define the functional versions of the obstack macros.
|
||||
Define them to simply use the corresponding macros to do the job. */
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
/* These function definitions do not work with non-ANSI preprocessors;
|
||||
they won't pass through the macro names in parentheses. */
|
||||
|
||||
/* The function names appear in parentheses in order to prevent
|
||||
the macro-definitions of the names from being expanded there. */
|
||||
|
||||
POINTER (obstack_base) (obstack)
|
||||
struct obstack *obstack;
|
||||
{
|
||||
return obstack_base (obstack);
|
||||
}
|
||||
|
||||
POINTER (obstack_next_free) (obstack)
|
||||
struct obstack *obstack;
|
||||
{
|
||||
return obstack_next_free (obstack);
|
||||
}
|
||||
|
||||
int (obstack_object_size) (obstack)
|
||||
struct obstack *obstack;
|
||||
{
|
||||
return obstack_object_size (obstack);
|
||||
}
|
||||
|
||||
int (obstack_room) (obstack)
|
||||
struct obstack *obstack;
|
||||
{
|
||||
return obstack_room (obstack);
|
||||
}
|
||||
|
||||
void (obstack_grow) (obstack, pointer, length)
|
||||
struct obstack *obstack;
|
||||
POINTER pointer;
|
||||
int length;
|
||||
{
|
||||
obstack_grow (obstack, pointer, length);
|
||||
}
|
||||
|
||||
void (obstack_grow0) (obstack, pointer, length)
|
||||
struct obstack *obstack;
|
||||
POINTER pointer;
|
||||
int length;
|
||||
{
|
||||
obstack_grow0 (obstack, pointer, length);
|
||||
}
|
||||
|
||||
void (obstack_1grow) (obstack, character)
|
||||
struct obstack *obstack;
|
||||
int character;
|
||||
{
|
||||
obstack_1grow (obstack, character);
|
||||
}
|
||||
|
||||
void (obstack_blank) (obstack, length)
|
||||
struct obstack *obstack;
|
||||
int length;
|
||||
{
|
||||
obstack_blank (obstack, length);
|
||||
}
|
||||
|
||||
void (obstack_1grow_fast) (obstack, character)
|
||||
struct obstack *obstack;
|
||||
int character;
|
||||
{
|
||||
obstack_1grow_fast (obstack, character);
|
||||
}
|
||||
|
||||
void (obstack_blank_fast) (obstack, length)
|
||||
struct obstack *obstack;
|
||||
int length;
|
||||
{
|
||||
obstack_blank_fast (obstack, length);
|
||||
}
|
||||
|
||||
POINTER (obstack_finish) (obstack)
|
||||
struct obstack *obstack;
|
||||
{
|
||||
return obstack_finish (obstack);
|
||||
}
|
||||
|
||||
POINTER (obstack_alloc) (obstack, length)
|
||||
struct obstack *obstack;
|
||||
int length;
|
||||
{
|
||||
return obstack_alloc (obstack, length);
|
||||
}
|
||||
|
||||
POINTER (obstack_copy) (obstack, pointer, length)
|
||||
struct obstack *obstack;
|
||||
POINTER pointer;
|
||||
int length;
|
||||
{
|
||||
return obstack_copy (obstack, pointer, length);
|
||||
}
|
||||
|
||||
POINTER (obstack_copy0) (obstack, pointer, length)
|
||||
struct obstack *obstack;
|
||||
POINTER pointer;
|
||||
int length;
|
||||
{
|
||||
return obstack_copy0 (obstack, pointer, length);
|
||||
}
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
#endif /* !ELIDE_CODE */
|
||||
571
lib/obstack.h
Normal file
571
lib/obstack.h
Normal file
@@ -0,0 +1,571 @@
|
||||
/* obstack.h - object stack macros
|
||||
Copyright (C) 1988,89,90,91,92,93,94,96 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Summary:
|
||||
|
||||
All the apparent functions defined here are macros. The idea
|
||||
is that you would use these pre-tested macros to solve a
|
||||
very specific set of problems, and they would run fast.
|
||||
Caution: no side-effects in arguments please!! They may be
|
||||
evaluated MANY times!!
|
||||
|
||||
These macros operate a stack of objects. Each object starts life
|
||||
small, and may grow to maturity. (Consider building a word syllable
|
||||
by syllable.) An object can move while it is growing. Once it has
|
||||
been "finished" it never changes address again. So the "top of the
|
||||
stack" is typically an immature growing object, while the rest of the
|
||||
stack is of mature, fixed size and fixed address objects.
|
||||
|
||||
These routines grab large chunks of memory, using a function you
|
||||
supply, called `obstack_chunk_alloc'. On occasion, they free chunks,
|
||||
by calling `obstack_chunk_free'. You must define them and declare
|
||||
them before using any obstack macros.
|
||||
|
||||
Each independent stack is represented by a `struct obstack'.
|
||||
Each of the obstack macros expects a pointer to such a structure
|
||||
as the first argument.
|
||||
|
||||
One motivation for this package is the problem of growing char strings
|
||||
in symbol tables. Unless you are "fascist pig with a read-only mind"
|
||||
--Gosper's immortal quote from HAKMEM item 154, out of context--you
|
||||
would not like to put any arbitrary upper limit on the length of your
|
||||
symbols.
|
||||
|
||||
In practice this often means you will build many short symbols and a
|
||||
few long symbols. At the time you are reading a symbol you don't know
|
||||
how long it is. One traditional method is to read a symbol into a
|
||||
buffer, realloc()ating the buffer every time you try to read a symbol
|
||||
that is longer than the buffer. This is beaut, but you still will
|
||||
want to copy the symbol from the buffer to a more permanent
|
||||
symbol-table entry say about half the time.
|
||||
|
||||
With obstacks, you can work differently. Use one obstack for all symbol
|
||||
names. As you read a symbol, grow the name in the obstack gradually.
|
||||
When the name is complete, finalize it. Then, if the symbol exists already,
|
||||
free the newly read name.
|
||||
|
||||
The way we do this is to take a large chunk, allocating memory from
|
||||
low addresses. When you want to build a symbol in the chunk you just
|
||||
add chars above the current "high water mark" in the chunk. When you
|
||||
have finished adding chars, because you got to the end of the symbol,
|
||||
you know how long the chars are, and you can create a new object.
|
||||
Mostly the chars will not burst over the highest address of the chunk,
|
||||
because you would typically expect a chunk to be (say) 100 times as
|
||||
long as an average object.
|
||||
|
||||
In case that isn't clear, when we have enough chars to make up
|
||||
the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
|
||||
so we just point to it where it lies. No moving of chars is
|
||||
needed and this is the second win: potentially long strings need
|
||||
never be explicitly shuffled. Once an object is formed, it does not
|
||||
change its address during its lifetime.
|
||||
|
||||
When the chars burst over a chunk boundary, we allocate a larger
|
||||
chunk, and then copy the partly formed object from the end of the old
|
||||
chunk to the beginning of the new larger chunk. We then carry on
|
||||
accreting characters to the end of the object as we normally would.
|
||||
|
||||
A special macro is provided to add a single char at a time to a
|
||||
growing object. This allows the use of register variables, which
|
||||
break the ordinary 'growth' macro.
|
||||
|
||||
Summary:
|
||||
We allocate large chunks.
|
||||
We carve out one object at a time from the current chunk.
|
||||
Once carved, an object never moves.
|
||||
We are free to append data of any size to the currently
|
||||
growing object.
|
||||
Exactly one object is growing in an obstack at any one time.
|
||||
You can run one obstack per control block.
|
||||
You may have as many control blocks as you dare.
|
||||
Because of the way we do it, you can `unwind' an obstack
|
||||
back to a previous state. (You may remove objects much
|
||||
as you would with a stack.)
|
||||
*/
|
||||
|
||||
|
||||
/* Don't do the contents of this file more than once. */
|
||||
|
||||
#ifndef __OBSTACK_H__
|
||||
#define __OBSTACK_H__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
|
||||
# define bcopy(from, to, len) memcpy ((to), (from), (len))
|
||||
#endif
|
||||
|
||||
|
||||
/* We use subtraction of (char *)0 instead of casting to int
|
||||
because on word-addressable machines a simple cast to int
|
||||
may ignore the byte-within-word field of the pointer. */
|
||||
|
||||
#ifndef __PTR_TO_INT
|
||||
#define __PTR_TO_INT(P) ((P) - (char *)0)
|
||||
#endif
|
||||
|
||||
#ifndef __INT_TO_PTR
|
||||
#define __INT_TO_PTR(P) ((P) + (char *)0)
|
||||
#endif
|
||||
|
||||
/* We need the type of the resulting object. In ANSI C it is ptrdiff_t
|
||||
but in traditional C it is usually long. If we are in ANSI C and
|
||||
don't already have ptrdiff_t get it. */
|
||||
|
||||
#if defined (__STDC__) && __STDC__ && ! defined (offsetof)
|
||||
#if defined (__GNUC__) && defined (IN_GCC)
|
||||
/* On Next machine, the system's stddef.h screws up if included
|
||||
after we have defined just ptrdiff_t, so include all of stddef.h.
|
||||
Otherwise, define just ptrdiff_t, which is all we need. */
|
||||
#ifndef __NeXT__
|
||||
#define __need_ptrdiff_t
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef HAVE_PTRDIFF_T
|
||||
# define ptrdiff_t off_t
|
||||
#endif
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
#define PTR_INT_TYPE ptrdiff_t
|
||||
#else
|
||||
#define PTR_INT_TYPE long
|
||||
#endif
|
||||
|
||||
struct _obstack_chunk /* Lives at front of each chunk. */
|
||||
{
|
||||
char *limit; /* 1 past end of this chunk */
|
||||
struct _obstack_chunk *prev; /* address of prior chunk or NULL */
|
||||
char contents[4]; /* objects begin here */
|
||||
};
|
||||
|
||||
struct obstack /* control current object in current chunk */
|
||||
{
|
||||
long chunk_size; /* preferred size to allocate chunks in */
|
||||
struct _obstack_chunk* chunk; /* address of current struct obstack_chunk */
|
||||
char *object_base; /* address of object we are building */
|
||||
char *next_free; /* where to add next char to current object */
|
||||
char *chunk_limit; /* address of char after current chunk */
|
||||
PTR_INT_TYPE temp; /* Temporary for some macros. */
|
||||
int alignment_mask; /* Mask of alignment for each object. */
|
||||
#if defined (__STDC__) && __STDC__
|
||||
/* These prototypes vary based on `use_extra_arg', and we use
|
||||
casts to the prototypeless function type in all assignments,
|
||||
but having prototypes here quiets -Wstrict-prototypes. */
|
||||
struct _obstack_chunk *(*chunkfun) (void *, long);
|
||||
void (*freefun) (void *, struct _obstack_chunk *);
|
||||
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
|
||||
#else
|
||||
struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
|
||||
void (*freefun) (); /* User's function to free a chunk. */
|
||||
char *extra_arg; /* first arg for chunk alloc/dealloc funcs */
|
||||
#endif
|
||||
unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
|
||||
unsigned maybe_empty_object:1;/* There is a possibility that the current
|
||||
chunk contains a zero-length object. This
|
||||
prevents freeing the chunk if we allocate
|
||||
a bigger chunk to replace it. */
|
||||
unsigned alloc_failed:1; /* chunk alloc func returned 0 */
|
||||
};
|
||||
|
||||
/* Declare the external functions we use; they are in obstack.c. */
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
extern void _obstack_newchunk (struct obstack *, int);
|
||||
extern void _obstack_free (struct obstack *, void *);
|
||||
extern int _obstack_begin (struct obstack *, int, int,
|
||||
void *(*) (long), void (*) (void *));
|
||||
extern int _obstack_begin_1 (struct obstack *, int, int,
|
||||
void *(*) (void *, long),
|
||||
void (*) (void *, void *), void *);
|
||||
#else
|
||||
extern void _obstack_newchunk ();
|
||||
extern void _obstack_free ();
|
||||
extern int _obstack_begin ();
|
||||
extern int _obstack_begin_1 ();
|
||||
#endif
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
|
||||
/* Do the function-declarations after the structs
|
||||
but before defining the macros. */
|
||||
|
||||
void obstack_init (struct obstack *obstack);
|
||||
|
||||
void * obstack_alloc (struct obstack *obstack, int size);
|
||||
|
||||
void * obstack_copy (struct obstack *obstack, void *address, int size);
|
||||
void * obstack_copy0 (struct obstack *obstack, void *address, int size);
|
||||
|
||||
void obstack_free (struct obstack *obstack, void *block);
|
||||
|
||||
void obstack_blank (struct obstack *obstack, int size);
|
||||
|
||||
void obstack_grow (struct obstack *obstack, void *data, int size);
|
||||
void obstack_grow0 (struct obstack *obstack, void *data, int size);
|
||||
|
||||
void obstack_1grow (struct obstack *obstack, int data_char);
|
||||
void obstack_ptr_grow (struct obstack *obstack, void *data);
|
||||
void obstack_int_grow (struct obstack *obstack, int data);
|
||||
|
||||
void * obstack_finish (struct obstack *obstack);
|
||||
|
||||
int obstack_object_size (struct obstack *obstack);
|
||||
|
||||
int obstack_room (struct obstack *obstack);
|
||||
void obstack_1grow_fast (struct obstack *obstack, int data_char);
|
||||
void obstack_ptr_grow_fast (struct obstack *obstack, void *data);
|
||||
void obstack_int_grow_fast (struct obstack *obstack, int data);
|
||||
void obstack_blank_fast (struct obstack *obstack, int size);
|
||||
|
||||
void * obstack_base (struct obstack *obstack);
|
||||
void * obstack_next_free (struct obstack *obstack);
|
||||
int obstack_alignment_mask (struct obstack *obstack);
|
||||
int obstack_chunk_size (struct obstack *obstack);
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
/* Non-ANSI C cannot really support alternative functions for these macros,
|
||||
so we do not declare them. */
|
||||
|
||||
/* Pointer to beginning of object being allocated or to be allocated next.
|
||||
Note that this might not be the final address of the object
|
||||
because a new chunk might be needed to hold the final size. */
|
||||
|
||||
#define obstack_base(h) ((h)->alloc_failed ? 0 : (h)->object_base)
|
||||
|
||||
/* Size for allocating ordinary chunks. */
|
||||
|
||||
#define obstack_chunk_size(h) ((h)->chunk_size)
|
||||
|
||||
/* Pointer to next byte not yet allocated in current chunk. */
|
||||
|
||||
#define obstack_next_free(h) ((h)->alloc_failed ? 0 : (h)->next_free)
|
||||
|
||||
/* Mask specifying low bits that should be clear in address of an object. */
|
||||
|
||||
#define obstack_alignment_mask(h) ((h)->alignment_mask)
|
||||
|
||||
/* To prevent prototype warnings provide complete argument list in
|
||||
standard C version. */
|
||||
#if defined (__STDC__) && __STDC__
|
||||
|
||||
#define obstack_init(h) \
|
||||
_obstack_begin ((h), 0, 0, \
|
||||
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
|
||||
|
||||
#define obstack_begin(h, size) \
|
||||
_obstack_begin ((h), (size), 0, \
|
||||
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
|
||||
|
||||
#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
|
||||
_obstack_begin ((h), (size), (alignment), \
|
||||
(void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun))
|
||||
|
||||
#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
|
||||
_obstack_begin_1 ((h), (size), (alignment), \
|
||||
(void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun), (arg))
|
||||
|
||||
#define obstack_chunkfun(h, newchunkfun) \
|
||||
((h) -> chunkfun = (struct _obstack_chunk *(*)(long)) (newchunkfun))
|
||||
|
||||
#define obstack_freefun(h, newfreefun) \
|
||||
((h) -> freefun = (void (*)(void *)) (newfreefun))
|
||||
|
||||
#else
|
||||
|
||||
#define obstack_init(h) \
|
||||
_obstack_begin ((h), 0, 0, \
|
||||
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
|
||||
|
||||
#define obstack_begin(h, size) \
|
||||
_obstack_begin ((h), (size), 0, \
|
||||
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
|
||||
|
||||
#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
|
||||
_obstack_begin ((h), (size), (alignment), \
|
||||
(void *(*) ()) (chunkfun), (void (*) ()) (freefun))
|
||||
|
||||
#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
|
||||
_obstack_begin_1 ((h), (size), (alignment), \
|
||||
(void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg))
|
||||
|
||||
#define obstack_chunkfun(h, newchunkfun) \
|
||||
((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun))
|
||||
|
||||
#define obstack_freefun(h, newfreefun) \
|
||||
((h) -> freefun = (void (*)()) (newfreefun))
|
||||
|
||||
#endif
|
||||
|
||||
#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)
|
||||
|
||||
#define obstack_blank_fast(h,n) ((h)->next_free += (n))
|
||||
|
||||
#if defined (__GNUC__) && defined (__STDC__) && __STDC__
|
||||
/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
|
||||
does not implement __extension__. But that compiler doesn't define
|
||||
__GNUC_MINOR__. */
|
||||
#if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
|
||||
#define __extension__
|
||||
#endif
|
||||
|
||||
/* For GNU C, if not -traditional,
|
||||
we can define these macros to compute all args only once
|
||||
without using a global variable.
|
||||
Also, we can avoid using the `temp' slot, to make faster code. */
|
||||
|
||||
#define obstack_object_size(OBSTACK) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
__o->alloc_failed ? 0 : \
|
||||
(unsigned) (__o->next_free - __o->object_base); })
|
||||
|
||||
#define obstack_room(OBSTACK) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
(unsigned) (__o->chunk_limit - __o->next_free); })
|
||||
|
||||
#define obstack_grow(OBSTACK,where,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
int __len = (length); \
|
||||
if (__o->next_free + __len > __o->chunk_limit) \
|
||||
_obstack_newchunk (__o, __len); \
|
||||
if (!__o->alloc_failed) \
|
||||
{ \
|
||||
bcopy ((char *) (where), __o->next_free, __len); \
|
||||
__o->next_free += __len; \
|
||||
} \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_grow0(OBSTACK,where,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
int __len = (length); \
|
||||
if (__o->next_free + __len + 1 > __o->chunk_limit) \
|
||||
_obstack_newchunk (__o, __len + 1); \
|
||||
if (!__o->alloc_failed) \
|
||||
{ \
|
||||
bcopy ((char *) (where), __o->next_free, __len); \
|
||||
__o->next_free += __len; \
|
||||
*(__o->next_free)++ = 0; \
|
||||
} \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_1grow(OBSTACK,datum) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
if (__o->next_free + 1 > __o->chunk_limit) \
|
||||
_obstack_newchunk (__o, 1); \
|
||||
if (!__o->alloc_failed) \
|
||||
*(__o->next_free)++ = (datum); \
|
||||
(void) 0; })
|
||||
|
||||
/* These assume that the obstack alignment is good enough for pointers or ints,
|
||||
and that the data added so far to the current object
|
||||
shares that much alignment. */
|
||||
|
||||
#define obstack_ptr_grow(OBSTACK,datum) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
|
||||
_obstack_newchunk (__o, sizeof (void *)); \
|
||||
if (!__o->alloc_failed) \
|
||||
*((void **)__o->next_free)++ = ((void *)datum); \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_int_grow(OBSTACK,datum) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
if (__o->next_free + sizeof (int) > __o->chunk_limit) \
|
||||
_obstack_newchunk (__o, sizeof (int)); \
|
||||
if (!__o->alloc_failed) \
|
||||
*((int *)__o->next_free)++ = ((int)datum); \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_ptr_grow_fast(h,aptr) (*((void **)(h)->next_free)++ = (void *)aptr)
|
||||
#define obstack_int_grow_fast(h,aint) (*((int *)(h)->next_free)++ = (int)aint)
|
||||
|
||||
#define obstack_blank(OBSTACK,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
int __len = (length); \
|
||||
if (__o->chunk_limit - __o->next_free < __len) \
|
||||
_obstack_newchunk (__o, __len); \
|
||||
if (!__o->alloc_failed) \
|
||||
__o->next_free += __len; \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_alloc(OBSTACK,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__h = (OBSTACK); \
|
||||
obstack_blank (__h, (length)); \
|
||||
obstack_finish (__h); })
|
||||
|
||||
#define obstack_copy(OBSTACK,where,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__h = (OBSTACK); \
|
||||
obstack_grow (__h, (where), (length)); \
|
||||
obstack_finish (__h); })
|
||||
|
||||
#define obstack_copy0(OBSTACK,where,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__h = (OBSTACK); \
|
||||
obstack_grow0 (__h, (where), (length)); \
|
||||
obstack_finish (__h); })
|
||||
|
||||
/* The local variable is named __o1 to avoid a name conflict
|
||||
when obstack_blank is called. */
|
||||
#define obstack_finish(OBSTACK) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o1 = (OBSTACK); \
|
||||
void *value; \
|
||||
if (__o1->alloc_failed) \
|
||||
value = 0; \
|
||||
else \
|
||||
{ \
|
||||
value = (void *) __o1->object_base; \
|
||||
if (__o1->next_free == value) \
|
||||
__o1->maybe_empty_object = 1; \
|
||||
__o1->next_free \
|
||||
= __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\
|
||||
& ~ (__o1->alignment_mask)); \
|
||||
if (__o1->next_free - (char *)__o1->chunk \
|
||||
> __o1->chunk_limit - (char *)__o1->chunk) \
|
||||
__o1->next_free = __o1->chunk_limit; \
|
||||
__o1->object_base = __o1->next_free; \
|
||||
} \
|
||||
value; })
|
||||
|
||||
#define obstack_free(OBSTACK, OBJ) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
void *__obj = (OBJ); \
|
||||
if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \
|
||||
__o->next_free = __o->object_base = __obj; \
|
||||
else (obstack_free) (__o, __obj); })
|
||||
|
||||
#else /* not __GNUC__ or not __STDC__ */
|
||||
|
||||
#define obstack_object_size(h) \
|
||||
(unsigned) ((h)->alloc_failed ? 0 : (h)->next_free - (h)->object_base)
|
||||
|
||||
#define obstack_room(h) \
|
||||
(unsigned) ((h)->chunk_limit - (h)->next_free)
|
||||
|
||||
/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
|
||||
so that we can avoid having void expressions
|
||||
in the arms of the conditional expression.
|
||||
Casting the third operand to void was tried before,
|
||||
but some compilers won't accept it. */
|
||||
|
||||
#define obstack_grow(h,where,length) \
|
||||
( (h)->temp = (length), \
|
||||
(((h)->next_free + (h)->temp > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
|
||||
((h)->alloc_failed ? 0 : \
|
||||
(bcopy ((char *) (where), (h)->next_free, (h)->temp), \
|
||||
(h)->next_free += (h)->temp)))
|
||||
|
||||
#define obstack_grow0(h,where,length) \
|
||||
( (h)->temp = (length), \
|
||||
(((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \
|
||||
((h)->alloc_failed ? 0 : \
|
||||
(bcopy ((char *) (where), (h)->next_free, (h)->temp), \
|
||||
(h)->next_free += (h)->temp, \
|
||||
*((h)->next_free)++ = 0)))
|
||||
|
||||
#define obstack_1grow(h,datum) \
|
||||
( (((h)->next_free + 1 > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), 1), 0) : 0), \
|
||||
((h)->alloc_failed ? 0 : \
|
||||
(*((h)->next_free)++ = (datum))))
|
||||
|
||||
#define obstack_ptr_grow(h,datum) \
|
||||
( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
|
||||
((h)->alloc_failed ? 0 : \
|
||||
(*((char **)(((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *)datum))))
|
||||
|
||||
#define obstack_int_grow(h,datum) \
|
||||
( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
|
||||
((h)->alloc_failed ? 0 : \
|
||||
(*((int *)(((h)->next_free+=sizeof(int))-sizeof(int))) = ((int)datum))))
|
||||
|
||||
#define obstack_ptr_grow_fast(h,aptr) (*((char **)(h)->next_free)++ = (char *)aptr)
|
||||
#define obstack_int_grow_fast(h,aint) (*((int *)(h)->next_free)++ = (int)aint)
|
||||
|
||||
#define obstack_blank(h,length) \
|
||||
( (h)->temp = (length), \
|
||||
(((h)->chunk_limit - (h)->next_free < (h)->temp) \
|
||||
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
|
||||
((h)->alloc_failed ? 0 : \
|
||||
((h)->next_free += (h)->temp)))
|
||||
|
||||
#define obstack_alloc(h,length) \
|
||||
(obstack_blank ((h), (length)), obstack_finish ((h)))
|
||||
|
||||
#define obstack_copy(h,where,length) \
|
||||
(obstack_grow ((h), (where), (length)), obstack_finish ((h)))
|
||||
|
||||
#define obstack_copy0(h,where,length) \
|
||||
(obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
|
||||
|
||||
#define obstack_finish(h) \
|
||||
( (h)->alloc_failed ? 0 : \
|
||||
(((h)->next_free == (h)->object_base \
|
||||
? (((h)->maybe_empty_object = 1), 0) \
|
||||
: 0), \
|
||||
(h)->temp = __PTR_TO_INT ((h)->object_base), \
|
||||
(h)->next_free \
|
||||
= __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
|
||||
& ~ ((h)->alignment_mask)), \
|
||||
(((h)->next_free - (char *)(h)->chunk \
|
||||
> (h)->chunk_limit - (char *)(h)->chunk) \
|
||||
? ((h)->next_free = (h)->chunk_limit) : 0), \
|
||||
(h)->object_base = (h)->next_free, \
|
||||
__INT_TO_PTR ((h)->temp)))
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
#define obstack_free(h,obj) \
|
||||
( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
|
||||
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
|
||||
? (int) ((h)->next_free = (h)->object_base \
|
||||
= (h)->temp + (char *) (h)->chunk) \
|
||||
: (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
|
||||
#else
|
||||
#define obstack_free(h,obj) \
|
||||
( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
|
||||
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
|
||||
? (int) ((h)->next_free = (h)->object_base \
|
||||
= (h)->temp + (char *) (h)->chunk) \
|
||||
: (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0)))
|
||||
#endif
|
||||
|
||||
#endif /* not __GNUC__ or not __STDC__ */
|
||||
|
||||
#endif /* not __OBSTACK_H__ */
|
||||
61
lib/path-concat.c
Normal file
61
lib/path-concat.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/* path-concat.c -- concatenate two arbitrary pathnames
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
char *malloc ();
|
||||
char *stpcpy ();
|
||||
|
||||
/* Concatenate two pathname components, DIR and BASE, in newly-allocated
|
||||
storage and return the result. Return 0 if out of memory. Add a slash
|
||||
between DIR and BASE in the result if neither would contribute one.
|
||||
If each would contribute at least one, elide one from the end of DIR.
|
||||
Otherwise, simply concatenate DIR and BASE. In any case, if
|
||||
BASE_IN_RESULT is non-NULL, set *BASE_IN_RESULT to point to the copy of
|
||||
BASE in the returned concatenation. */
|
||||
|
||||
char *
|
||||
path_concat (dir, base, base_in_result)
|
||||
const char *dir;
|
||||
const char *base;
|
||||
char **base_in_result;
|
||||
{
|
||||
char *p;
|
||||
char *p_concat;
|
||||
|
||||
p_concat = malloc (strlen (dir) + strlen (base) + 2);
|
||||
if (!p_concat)
|
||||
return 0;
|
||||
|
||||
p = stpcpy (p_concat, dir);
|
||||
|
||||
if (*(p - 1) == '/' && *base == '/')
|
||||
--p;
|
||||
else if (*(p - 1) != '/' && *base != '/')
|
||||
p = stpcpy (p, "/");
|
||||
|
||||
if (base_in_result)
|
||||
*base_in_result = p;
|
||||
|
||||
stpcpy (p, base);
|
||||
|
||||
return p_concat;
|
||||
}
|
||||
9
lib/path-concat.h
Normal file
9
lib/path-concat.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if __STDC__
|
||||
# undef __P
|
||||
# define __P(args) args
|
||||
#else
|
||||
# define __P(args) ()
|
||||
#endif
|
||||
|
||||
char *
|
||||
path_concat __P ((const char *dir, const char *base, char **base_in_result));
|
||||
53
lib/pathmax.h
Normal file
53
lib/pathmax.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* Define PATH_MAX somehow. Requires sys/types.h.
|
||||
Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _PATHMAX_H
|
||||
#define _PATHMAX_H
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
|
||||
PATH_MAX but might cause redefinition warnings when sys/param.h is
|
||||
later included (as on MORE/BSD 4.3). */
|
||||
#if defined(_POSIX_VERSION) || (defined(HAVE_LIMITS_H) && !defined(__GNUC__))
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef _POSIX_PATH_MAX
|
||||
#define _POSIX_PATH_MAX 255
|
||||
#endif
|
||||
|
||||
#if !defined(PATH_MAX) && defined(_PC_PATH_MAX)
|
||||
#define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
|
||||
#endif
|
||||
|
||||
/* Don't include sys/param.h if it already has been. */
|
||||
#if defined(HAVE_SYS_PARAM_H) && !defined(PATH_MAX) && !defined(MAXPATHLEN)
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if !defined(PATH_MAX) && defined(MAXPATHLEN)
|
||||
#define PATH_MAX MAXPATHLEN
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX _POSIX_PATH_MAX
|
||||
#endif
|
||||
|
||||
#endif /* _PATHMAX_H */
|
||||
978
lib/posixtm.c
Normal file
978
lib/posixtm.c
Normal file
@@ -0,0 +1,978 @@
|
||||
|
||||
/* A Bison parser, made from ./posixtm.y with Bison version GNU Bison version 1.22
|
||||
*/
|
||||
|
||||
#define YYBISON 1 /* Identify Bison output. */
|
||||
|
||||
#define DIGIT 258
|
||||
|
||||
#line 19 "./posixtm.y"
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
/* The following block of alloca-related preprocessor directives is here
|
||||
solely to allow compilation by non GNU-C compilers of the C parser
|
||||
produced from this file by old versions of bison. Newer versions of
|
||||
bison include a block similar to this one in bison.simple. */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define alloca __builtin_alloca
|
||||
#else
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#else
|
||||
#ifdef _AIX
|
||||
#pragma alloca
|
||||
#else
|
||||
void *alloca ();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef TM_IN_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
/* Some old versions of bison generate parsers that use bcopy.
|
||||
That loses on systems that don't provide the function, so we have
|
||||
to redefine it here. */
|
||||
#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
|
||||
#define bcopy(from, to, len) memcpy ((to), (from), (len))
|
||||
#endif
|
||||
|
||||
#define YYDEBUG 1
|
||||
|
||||
/* Lexical analyzer's current scan position in the input string. */
|
||||
static char *curpos;
|
||||
|
||||
/* The return value. */
|
||||
static struct tm t;
|
||||
|
||||
time_t mktime ();
|
||||
|
||||
#define zzparse posixtime_zzparse
|
||||
static int zzlex ();
|
||||
static int zzerror ();
|
||||
|
||||
#ifndef YYLTYPE
|
||||
typedef
|
||||
struct zzltype
|
||||
{
|
||||
int timestamp;
|
||||
int first_line;
|
||||
int first_column;
|
||||
int last_line;
|
||||
int last_column;
|
||||
char *text;
|
||||
}
|
||||
zzltype;
|
||||
|
||||
#define YYLTYPE zzltype
|
||||
#endif
|
||||
|
||||
#ifndef YYSTYPE
|
||||
#define YYSTYPE int
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifndef __STDC__
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define YYFINAL 15
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 5
|
||||
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 258 ? zztranslate[x] : 9)
|
||||
|
||||
static const char zztranslate[] = { 0,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 4, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 1, 2, 3
|
||||
};
|
||||
|
||||
#if YYDEBUG != 0
|
||||
static const short zzprhs[] = { 0,
|
||||
0, 7, 9, 12, 13, 14, 17
|
||||
};
|
||||
|
||||
static const short zzrhs[] = { 8,
|
||||
8, 8, 8, 6, 7, 0, 8, 0, 8, 8,
|
||||
0, 0, 0, 4, 8, 0, 3, 3, 0
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if YYDEBUG != 0
|
||||
static const short zzrline[] = { 0,
|
||||
78, 107, 114, 121, 132, 135, 144
|
||||
};
|
||||
|
||||
static const char * const zztname[] = { "$","error","$illegal.","DIGIT","'.'",
|
||||
"date","year","seconds","digitpair",""
|
||||
};
|
||||
#endif
|
||||
|
||||
static const short zzr1[] = { 0,
|
||||
5, 6, 6, 6, 7, 7, 8
|
||||
};
|
||||
|
||||
static const short zzr2[] = { 0,
|
||||
6, 1, 2, 0, 0, 2, 2
|
||||
};
|
||||
|
||||
static const short zzdefact[] = { 0,
|
||||
0, 0, 7, 0, 0, 4, 5, 2, 0, 1,
|
||||
3, 6, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short zzdefgoto[] = { 13,
|
||||
7, 10, 2
|
||||
};
|
||||
|
||||
static const short zzpact[] = { 2,
|
||||
5, 2,-32768, 2, 2, 2, -3, 2, 2,-32768,
|
||||
-32768,-32768, 9, 10,-32768
|
||||
};
|
||||
|
||||
static const short zzpgoto[] = {-32768,
|
||||
-32768,-32768, -2
|
||||
};
|
||||
|
||||
|
||||
#define YYLAST 10
|
||||
|
||||
|
||||
static const short zztable[] = { 4,
|
||||
9, 5, 6, 8, 1, 11, 12, 3, 14, 15
|
||||
};
|
||||
|
||||
static const short zzcheck[] = { 2,
|
||||
4, 4, 5, 6, 3, 8, 9, 3, 0, 0
|
||||
};
|
||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||
#line 3 "/usr/local/lib/bison.simple"
|
||||
|
||||
/* Skeleton output parser for bison,
|
||||
Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
|
||||
|
||||
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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
|
||||
#ifndef alloca
|
||||
#ifdef __GNUC__
|
||||
#define alloca __builtin_alloca
|
||||
#else /* not GNU C. */
|
||||
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
|
||||
#include <alloca.h>
|
||||
#else /* not sparc */
|
||||
#if defined (MSDOS) && !defined (__TURBOC__)
|
||||
#include <malloc.h>
|
||||
#else /* not MSDOS, or __TURBOC__ */
|
||||
#if defined(_AIX)
|
||||
#include <malloc.h>
|
||||
#pragma alloca
|
||||
#else /* not MSDOS, __TURBOC__, or _AIX */
|
||||
#ifdef __hpux
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
void *alloca (unsigned int);
|
||||
};
|
||||
#else /* not __cplusplus */
|
||||
void *alloca ();
|
||||
#endif /* not __cplusplus */
|
||||
#endif /* __hpux */
|
||||
#endif /* not _AIX */
|
||||
#endif /* not MSDOS, or __TURBOC__ */
|
||||
#endif /* not sparc. */
|
||||
#endif /* not GNU C. */
|
||||
#endif /* alloca not defined. */
|
||||
|
||||
/* This is the parser code that is written into each bison parser
|
||||
when the %semantic_parser declaration is not specified in the grammar.
|
||||
It was written by Richard Stallman by simplifying the hairy parser
|
||||
used when %semantic_parser is specified. */
|
||||
|
||||
/* Note: there must be only one dollar sign in this file.
|
||||
It is replaced by the list of actions, each action
|
||||
as one case of the switch. */
|
||||
|
||||
#define zzerrok (zzerrstatus = 0)
|
||||
#define zzclearin (zzchar = YYEMPTY)
|
||||
#define YYEMPTY -2
|
||||
#define YYEOF 0
|
||||
#define YYACCEPT return(0)
|
||||
#define YYABORT return(1)
|
||||
#define YYERROR goto zzerrlab1
|
||||
/* Like YYERROR except do call zzerror.
|
||||
This remains here temporarily to ease the
|
||||
transition to the new meaning of YYERROR, for GCC.
|
||||
Once GCC version 2 has supplanted version 1, this can go. */
|
||||
#define YYFAIL goto zzerrlab
|
||||
#define YYRECOVERING() (!!zzerrstatus)
|
||||
#define YYBACKUP(token, value) \
|
||||
do \
|
||||
if (zzchar == YYEMPTY && zzlen == 1) \
|
||||
{ zzchar = (token), zzlval = (value); \
|
||||
zzchar1 = YYTRANSLATE (zzchar); \
|
||||
YYPOPSTACK; \
|
||||
goto zzbackup; \
|
||||
} \
|
||||
else \
|
||||
{ zzerror ("syntax error: cannot back up"); YYERROR; } \
|
||||
while (0)
|
||||
|
||||
#define YYTERROR 1
|
||||
#define YYERRCODE 256
|
||||
|
||||
#ifndef YYPURE
|
||||
#define YYLEX zzlex()
|
||||
#endif
|
||||
|
||||
#ifdef YYPURE
|
||||
#ifdef YYLSP_NEEDED
|
||||
#define YYLEX zzlex(&zzlval, &zzlloc)
|
||||
#else
|
||||
#define YYLEX zzlex(&zzlval)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If nonreentrant, generate the variables here */
|
||||
|
||||
#ifndef YYPURE
|
||||
|
||||
int zzchar; /* the lookahead symbol */
|
||||
YYSTYPE zzlval; /* the semantic value of the */
|
||||
/* lookahead symbol */
|
||||
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE zzlloc; /* location data for the lookahead */
|
||||
/* symbol */
|
||||
#endif
|
||||
|
||||
int zznerrs; /* number of parse errors so far */
|
||||
#endif /* not YYPURE */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
int zzdebug; /* nonzero means print parse trace */
|
||||
/* Since this is uninitialized, it does not stop multiple parsers
|
||||
from coexisting. */
|
||||
#endif
|
||||
|
||||
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
||||
|
||||
#ifndef YYINITDEPTH
|
||||
#define YYINITDEPTH 200
|
||||
#endif
|
||||
|
||||
/* YYMAXDEPTH is the maximum size the stacks can grow to
|
||||
(effective only if the built-in stack extension method is used). */
|
||||
|
||||
#if YYMAXDEPTH == 0
|
||||
#undef YYMAXDEPTH
|
||||
#endif
|
||||
|
||||
#ifndef YYMAXDEPTH
|
||||
#define YYMAXDEPTH 10000
|
||||
#endif
|
||||
|
||||
/* Prevent warning if -Wstrict-prototypes. */
|
||||
#ifdef __GNUC__
|
||||
int zzparse (void);
|
||||
#endif
|
||||
|
||||
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||
#define __zz_bcopy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
||||
#else /* not GNU C or C++ */
|
||||
#ifndef __cplusplus
|
||||
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
in available built-in functions on various systems. */
|
||||
static void
|
||||
__zz_bcopy (from, to, count)
|
||||
char *from;
|
||||
char *to;
|
||||
int count;
|
||||
{
|
||||
register char *f = from;
|
||||
register char *t = to;
|
||||
register int i = count;
|
||||
|
||||
while (i-- > 0)
|
||||
*t++ = *f++;
|
||||
}
|
||||
|
||||
#else /* __cplusplus */
|
||||
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
in available built-in functions on various systems. */
|
||||
static void
|
||||
__zz_bcopy (char *from, char *to, int count)
|
||||
{
|
||||
register char *f = from;
|
||||
register char *t = to;
|
||||
register int i = count;
|
||||
|
||||
while (i-- > 0)
|
||||
*t++ = *f++;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#line 184 "/usr/local/lib/bison.simple"
|
||||
int
|
||||
zzparse()
|
||||
{
|
||||
register int zzstate;
|
||||
register int zzn;
|
||||
register short *zzssp;
|
||||
register YYSTYPE *zzvsp;
|
||||
int zzerrstatus; /* number of tokens to shift before error messages enabled */
|
||||
int zzchar1 = 0; /* lookahead token as an internal (translated) token number */
|
||||
|
||||
short zzssa[YYINITDEPTH]; /* the state stack */
|
||||
YYSTYPE zzvsa[YYINITDEPTH]; /* the semantic value stack */
|
||||
|
||||
short *zzss = zzssa; /* refer to the stacks thru separate pointers */
|
||||
YYSTYPE *zzvs = zzvsa; /* to allow zzoverflow to reallocate them elsewhere */
|
||||
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE zzlsa[YYINITDEPTH]; /* the location stack */
|
||||
YYLTYPE *zzls = zzlsa;
|
||||
YYLTYPE *zzlsp;
|
||||
|
||||
#define YYPOPSTACK (zzvsp--, zzssp--, zzlsp--)
|
||||
#else
|
||||
#define YYPOPSTACK (zzvsp--, zzssp--)
|
||||
#endif
|
||||
|
||||
int zzstacksize = YYINITDEPTH;
|
||||
|
||||
#ifdef YYPURE
|
||||
int zzchar;
|
||||
YYSTYPE zzlval;
|
||||
int zznerrs;
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE zzlloc;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
YYSTYPE zzval; /* the variable used to return */
|
||||
/* semantic values from the action */
|
||||
/* routines */
|
||||
|
||||
int zzlen;
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
fprintf(stderr, "Starting parse\n");
|
||||
#endif
|
||||
|
||||
zzstate = 0;
|
||||
zzerrstatus = 0;
|
||||
zznerrs = 0;
|
||||
zzchar = YYEMPTY; /* Cause a token to be read. */
|
||||
|
||||
/* Initialize stack pointers.
|
||||
Waste one element of value and location stack
|
||||
so that they stay on the same level as the state stack.
|
||||
The wasted elements are never initialized. */
|
||||
|
||||
zzssp = zzss - 1;
|
||||
zzvsp = zzvs;
|
||||
#ifdef YYLSP_NEEDED
|
||||
zzlsp = zzls;
|
||||
#endif
|
||||
|
||||
/* Push a new state, which is found in zzstate . */
|
||||
/* In all cases, when you get here, the value and location stacks
|
||||
have just been pushed. so pushing a state here evens the stacks. */
|
||||
zznewstate:
|
||||
|
||||
*++zzssp = zzstate;
|
||||
|
||||
if (zzssp >= zzss + zzstacksize - 1)
|
||||
{
|
||||
/* Give user a chance to reallocate the stack */
|
||||
/* Use copies of these so that the &'s don't force the real ones into memory. */
|
||||
YYSTYPE *zzvs1 = zzvs;
|
||||
short *zzss1 = zzss;
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE *zzls1 = zzls;
|
||||
#endif
|
||||
|
||||
/* Get the current used size of the three stacks, in elements. */
|
||||
int size = zzssp - zzss + 1;
|
||||
|
||||
#ifdef zzoverflow
|
||||
/* Each stack pointer address is followed by the size of
|
||||
the data in use in that stack, in bytes. */
|
||||
#ifdef YYLSP_NEEDED
|
||||
/* This used to be a conditional around just the two extra args,
|
||||
but that might be undefined if zzoverflow is a macro. */
|
||||
zzoverflow("parser stack overflow",
|
||||
&zzss1, size * sizeof (*zzssp),
|
||||
&zzvs1, size * sizeof (*zzvsp),
|
||||
&zzls1, size * sizeof (*zzlsp),
|
||||
&zzstacksize);
|
||||
#else
|
||||
zzoverflow("parser stack overflow",
|
||||
&zzss1, size * sizeof (*zzssp),
|
||||
&zzvs1, size * sizeof (*zzvsp),
|
||||
&zzstacksize);
|
||||
#endif
|
||||
|
||||
zzss = zzss1; zzvs = zzvs1;
|
||||
#ifdef YYLSP_NEEDED
|
||||
zzls = zzls1;
|
||||
#endif
|
||||
#else /* no zzoverflow */
|
||||
/* Extend the stack our own way. */
|
||||
if (zzstacksize >= YYMAXDEPTH)
|
||||
{
|
||||
zzerror("parser stack overflow");
|
||||
return 2;
|
||||
}
|
||||
zzstacksize *= 2;
|
||||
if (zzstacksize > YYMAXDEPTH)
|
||||
zzstacksize = YYMAXDEPTH;
|
||||
zzss = (short *) alloca (zzstacksize * sizeof (*zzssp));
|
||||
__zz_bcopy ((char *)zzss1, (char *)zzss, size * sizeof (*zzssp));
|
||||
zzvs = (YYSTYPE *) alloca (zzstacksize * sizeof (*zzvsp));
|
||||
__zz_bcopy ((char *)zzvs1, (char *)zzvs, size * sizeof (*zzvsp));
|
||||
#ifdef YYLSP_NEEDED
|
||||
zzls = (YYLTYPE *) alloca (zzstacksize * sizeof (*zzlsp));
|
||||
__zz_bcopy ((char *)zzls1, (char *)zzls, size * sizeof (*zzlsp));
|
||||
#endif
|
||||
#endif /* no zzoverflow */
|
||||
|
||||
zzssp = zzss + size - 1;
|
||||
zzvsp = zzvs + size - 1;
|
||||
#ifdef YYLSP_NEEDED
|
||||
zzlsp = zzls + size - 1;
|
||||
#endif
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
fprintf(stderr, "Stack size increased to %d\n", zzstacksize);
|
||||
#endif
|
||||
|
||||
if (zzssp >= zzss + zzstacksize - 1)
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
fprintf(stderr, "Entering state %d\n", zzstate);
|
||||
#endif
|
||||
|
||||
goto zzbackup;
|
||||
zzbackup:
|
||||
|
||||
/* Do appropriate processing given the current state. */
|
||||
/* Read a lookahead token if we need one and don't already have one. */
|
||||
/* zzresume: */
|
||||
|
||||
/* First try to decide what to do without reference to lookahead token. */
|
||||
|
||||
zzn = zzpact[zzstate];
|
||||
if (zzn == YYFLAG)
|
||||
goto zzdefault;
|
||||
|
||||
/* Not known => get a lookahead token if don't already have one. */
|
||||
|
||||
/* zzchar is either YYEMPTY or YYEOF
|
||||
or a valid token in external form. */
|
||||
|
||||
if (zzchar == YYEMPTY)
|
||||
{
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
fprintf(stderr, "Reading a token: ");
|
||||
#endif
|
||||
zzchar = YYLEX;
|
||||
}
|
||||
|
||||
/* Convert token to internal form (in zzchar1) for indexing tables with */
|
||||
|
||||
if (zzchar <= 0) /* This means end of input. */
|
||||
{
|
||||
zzchar1 = 0;
|
||||
zzchar = YYEOF; /* Don't call YYLEX any more */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
fprintf(stderr, "Now at end of input.\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
zzchar1 = YYTRANSLATE(zzchar);
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
{
|
||||
fprintf (stderr, "Next token is %d (%s", zzchar, zztname[zzchar1]);
|
||||
/* Give the individual parser a way to print the precise meaning
|
||||
of a token, for further debugging info. */
|
||||
#ifdef YYPRINT
|
||||
YYPRINT (stderr, zzchar, zzlval);
|
||||
#endif
|
||||
fprintf (stderr, ")\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
zzn += zzchar1;
|
||||
if (zzn < 0 || zzn > YYLAST || zzcheck[zzn] != zzchar1)
|
||||
goto zzdefault;
|
||||
|
||||
zzn = zztable[zzn];
|
||||
|
||||
/* zzn is what to do for this token type in this state.
|
||||
Negative => reduce, -zzn is rule number.
|
||||
Positive => shift, zzn is new state.
|
||||
New state is final state => don't bother to shift,
|
||||
just return success.
|
||||
0, or most negative number => error. */
|
||||
|
||||
if (zzn < 0)
|
||||
{
|
||||
if (zzn == YYFLAG)
|
||||
goto zzerrlab;
|
||||
zzn = -zzn;
|
||||
goto zzreduce;
|
||||
}
|
||||
else if (zzn == 0)
|
||||
goto zzerrlab;
|
||||
|
||||
if (zzn == YYFINAL)
|
||||
YYACCEPT;
|
||||
|
||||
/* Shift the lookahead token. */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
fprintf(stderr, "Shifting token %d (%s), ", zzchar, zztname[zzchar1]);
|
||||
#endif
|
||||
|
||||
/* Discard the token being shifted unless it is eof. */
|
||||
if (zzchar != YYEOF)
|
||||
zzchar = YYEMPTY;
|
||||
|
||||
*++zzvsp = zzlval;
|
||||
#ifdef YYLSP_NEEDED
|
||||
*++zzlsp = zzlloc;
|
||||
#endif
|
||||
|
||||
/* count tokens shifted since error; after three, turn off error status. */
|
||||
if (zzerrstatus) zzerrstatus--;
|
||||
|
||||
zzstate = zzn;
|
||||
goto zznewstate;
|
||||
|
||||
/* Do the default action for the current state. */
|
||||
zzdefault:
|
||||
|
||||
zzn = zzdefact[zzstate];
|
||||
if (zzn == 0)
|
||||
goto zzerrlab;
|
||||
|
||||
/* Do a reduction. zzn is the number of a rule to reduce with. */
|
||||
zzreduce:
|
||||
zzlen = zzr2[zzn];
|
||||
if (zzlen > 0)
|
||||
zzval = zzvsp[1-zzlen]; /* implement default value of the action */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf (stderr, "Reducing via rule %d (line %d), ",
|
||||
zzn, zzrline[zzn]);
|
||||
|
||||
/* Print the symbols being reduced, and their result. */
|
||||
for (i = zzprhs[zzn]; zzrhs[i] > 0; i++)
|
||||
fprintf (stderr, "%s ", zztname[zzrhs[i]]);
|
||||
fprintf (stderr, " -> %s\n", zztname[zzr1[zzn]]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
switch (zzn) {
|
||||
|
||||
case 1:
|
||||
#line 84 "./posixtm.y"
|
||||
{
|
||||
if (zzvsp[-5] >= 1 && zzvsp[-5] <= 12)
|
||||
t.tm_mon = zzvsp[-5] - 1;
|
||||
else {
|
||||
YYABORT;
|
||||
}
|
||||
if (zzvsp[-4] >= 1 && zzvsp[-4] <= 31)
|
||||
t.tm_mday = zzvsp[-4];
|
||||
else {
|
||||
YYABORT;
|
||||
}
|
||||
if (zzvsp[-3] >= 0 && zzvsp[-3] <= 23)
|
||||
t.tm_hour = zzvsp[-3];
|
||||
else {
|
||||
YYABORT;
|
||||
}
|
||||
if (zzvsp[-2] >= 0 && zzvsp[-2] <= 59)
|
||||
t.tm_min = zzvsp[-2];
|
||||
else {
|
||||
YYABORT;
|
||||
}
|
||||
;
|
||||
break;}
|
||||
case 2:
|
||||
#line 107 "./posixtm.y"
|
||||
{
|
||||
t.tm_year = zzvsp[0];
|
||||
/* Deduce the century based on the year.
|
||||
See POSIX.2 section 4.63.3. */
|
||||
if (zzvsp[0] <= 68)
|
||||
t.tm_year += 100;
|
||||
;
|
||||
break;}
|
||||
case 3:
|
||||
#line 114 "./posixtm.y"
|
||||
{
|
||||
t.tm_year = zzvsp[-1] * 100 + zzvsp[0];
|
||||
if (t.tm_year < 1900) {
|
||||
YYABORT;
|
||||
} else
|
||||
t.tm_year -= 1900;
|
||||
;
|
||||
break;}
|
||||
case 4:
|
||||
#line 121 "./posixtm.y"
|
||||
{
|
||||
time_t now;
|
||||
struct tm *tmp;
|
||||
|
||||
/* Use current year. */
|
||||
time (&now);
|
||||
tmp = localtime (&now);
|
||||
t.tm_year = tmp->tm_year;
|
||||
;
|
||||
break;}
|
||||
case 5:
|
||||
#line 132 "./posixtm.y"
|
||||
{
|
||||
t.tm_sec = 0;
|
||||
;
|
||||
break;}
|
||||
case 6:
|
||||
#line 135 "./posixtm.y"
|
||||
{
|
||||
if (zzvsp[0] >= 0 && zzvsp[0] <= 61)
|
||||
t.tm_sec = zzvsp[0];
|
||||
else {
|
||||
YYABORT;
|
||||
}
|
||||
;
|
||||
break;}
|
||||
case 7:
|
||||
#line 144 "./posixtm.y"
|
||||
{
|
||||
zzval = zzvsp[-1] * 10 + zzvsp[0];
|
||||
;
|
||||
break;}
|
||||
}
|
||||
/* the action file gets copied in in place of this dollarsign */
|
||||
#line 465 "/usr/local/lib/bison.simple"
|
||||
|
||||
zzvsp -= zzlen;
|
||||
zzssp -= zzlen;
|
||||
#ifdef YYLSP_NEEDED
|
||||
zzlsp -= zzlen;
|
||||
#endif
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
{
|
||||
short *ssp1 = zzss - 1;
|
||||
fprintf (stderr, "state stack now");
|
||||
while (ssp1 != zzssp)
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
*++zzvsp = zzval;
|
||||
|
||||
#ifdef YYLSP_NEEDED
|
||||
zzlsp++;
|
||||
if (zzlen == 0)
|
||||
{
|
||||
zzlsp->first_line = zzlloc.first_line;
|
||||
zzlsp->first_column = zzlloc.first_column;
|
||||
zzlsp->last_line = (zzlsp-1)->last_line;
|
||||
zzlsp->last_column = (zzlsp-1)->last_column;
|
||||
zzlsp->text = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
zzlsp->last_line = (zzlsp+zzlen-1)->last_line;
|
||||
zzlsp->last_column = (zzlsp+zzlen-1)->last_column;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now "shift" the result of the reduction.
|
||||
Determine what state that goes to,
|
||||
based on the state we popped back to
|
||||
and the rule number reduced by. */
|
||||
|
||||
zzn = zzr1[zzn];
|
||||
|
||||
zzstate = zzpgoto[zzn - YYNTBASE] + *zzssp;
|
||||
if (zzstate >= 0 && zzstate <= YYLAST && zzcheck[zzstate] == *zzssp)
|
||||
zzstate = zztable[zzstate];
|
||||
else
|
||||
zzstate = zzdefgoto[zzn - YYNTBASE];
|
||||
|
||||
goto zznewstate;
|
||||
|
||||
zzerrlab: /* here on detecting error */
|
||||
|
||||
if (! zzerrstatus)
|
||||
/* If not already recovering from an error, report this error. */
|
||||
{
|
||||
++zznerrs;
|
||||
|
||||
#ifdef YYERROR_VERBOSE
|
||||
zzn = zzpact[zzstate];
|
||||
|
||||
if (zzn > YYFLAG && zzn < YYLAST)
|
||||
{
|
||||
int size = 0;
|
||||
char *msg;
|
||||
int x, count;
|
||||
|
||||
count = 0;
|
||||
/* Start X at -zzn if nec to avoid negative indexes in zzcheck. */
|
||||
for (x = (zzn < 0 ? -zzn : 0);
|
||||
x < (sizeof(zztname) / sizeof(char *)); x++)
|
||||
if (zzcheck[x + zzn] == x)
|
||||
size += strlen(zztname[x]) + 15, count++;
|
||||
msg = (char *) malloc(size + 15);
|
||||
if (msg != 0)
|
||||
{
|
||||
strcpy(msg, "parse error");
|
||||
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (x = (zzn < 0 ? -zzn : 0);
|
||||
x < (sizeof(zztname) / sizeof(char *)); x++)
|
||||
if (zzcheck[x + zzn] == x)
|
||||
{
|
||||
strcat(msg, count == 0 ? ", expecting `" : " or `");
|
||||
strcat(msg, zztname[x]);
|
||||
strcat(msg, "'");
|
||||
count++;
|
||||
}
|
||||
}
|
||||
zzerror(msg);
|
||||
free(msg);
|
||||
}
|
||||
else
|
||||
zzerror ("parse error; also virtual memory exceeded");
|
||||
}
|
||||
else
|
||||
#endif /* YYERROR_VERBOSE */
|
||||
zzerror("parse error");
|
||||
}
|
||||
|
||||
goto zzerrlab1;
|
||||
zzerrlab1: /* here on error raised explicitly by an action */
|
||||
|
||||
if (zzerrstatus == 3)
|
||||
{
|
||||
/* if just tried and failed to reuse lookahead token after an error, discard it. */
|
||||
|
||||
/* return failure if at end of input */
|
||||
if (zzchar == YYEOF)
|
||||
YYABORT;
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
fprintf(stderr, "Discarding token %d (%s).\n", zzchar, zztname[zzchar1]);
|
||||
#endif
|
||||
|
||||
zzchar = YYEMPTY;
|
||||
}
|
||||
|
||||
/* Else will try to reuse lookahead token
|
||||
after shifting the error token. */
|
||||
|
||||
zzerrstatus = 3; /* Each real token shifted decrements this */
|
||||
|
||||
goto zzerrhandle;
|
||||
|
||||
zzerrdefault: /* current state does not do anything special for the error token. */
|
||||
|
||||
#if 0
|
||||
/* This is wrong; only states that explicitly want error tokens
|
||||
should shift them. */
|
||||
zzn = zzdefact[zzstate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
|
||||
if (zzn) goto zzdefault;
|
||||
#endif
|
||||
|
||||
zzerrpop: /* pop the current state because it cannot handle the error token */
|
||||
|
||||
if (zzssp == zzss) YYABORT;
|
||||
zzvsp--;
|
||||
zzstate = *--zzssp;
|
||||
#ifdef YYLSP_NEEDED
|
||||
zzlsp--;
|
||||
#endif
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
{
|
||||
short *ssp1 = zzss - 1;
|
||||
fprintf (stderr, "Error: state stack now");
|
||||
while (ssp1 != zzssp)
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
zzerrhandle:
|
||||
|
||||
zzn = zzpact[zzstate];
|
||||
if (zzn == YYFLAG)
|
||||
goto zzerrdefault;
|
||||
|
||||
zzn += YYTERROR;
|
||||
if (zzn < 0 || zzn > YYLAST || zzcheck[zzn] != YYTERROR)
|
||||
goto zzerrdefault;
|
||||
|
||||
zzn = zztable[zzn];
|
||||
if (zzn < 0)
|
||||
{
|
||||
if (zzn == YYFLAG)
|
||||
goto zzerrpop;
|
||||
zzn = -zzn;
|
||||
goto zzreduce;
|
||||
}
|
||||
else if (zzn == 0)
|
||||
goto zzerrpop;
|
||||
|
||||
if (zzn == YYFINAL)
|
||||
YYACCEPT;
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (zzdebug)
|
||||
fprintf(stderr, "Shifting error token, ");
|
||||
#endif
|
||||
|
||||
*++zzvsp = zzlval;
|
||||
#ifdef YYLSP_NEEDED
|
||||
*++zzlsp = zzlloc;
|
||||
#endif
|
||||
|
||||
zzstate = zzn;
|
||||
goto zznewstate;
|
||||
}
|
||||
#line 148 "./posixtm.y"
|
||||
|
||||
static int
|
||||
zzlex ()
|
||||
{
|
||||
char ch = *curpos++;
|
||||
|
||||
if (ch >= '0' && ch <= '9')
|
||||
{
|
||||
zzlval = ch - '0';
|
||||
return DIGIT;
|
||||
}
|
||||
else if (ch == '.' || ch == 0)
|
||||
return ch;
|
||||
else
|
||||
return '?'; /* Cause an error. */
|
||||
}
|
||||
|
||||
static int
|
||||
zzerror ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Parse a POSIX-style date and return it, or (time_t)-1 for an error. */
|
||||
|
||||
time_t
|
||||
posixtime (s)
|
||||
char *s;
|
||||
{
|
||||
curpos = s;
|
||||
/* Let mktime decide whether it is daylight savings time. */
|
||||
t.tm_isdst = -1;
|
||||
if (zzparse ())
|
||||
return (time_t)-1;
|
||||
else
|
||||
return mktime (&t);
|
||||
}
|
||||
|
||||
/* Parse a POSIX-style date and return it, or NULL for an error. */
|
||||
|
||||
struct tm *
|
||||
posixtm (s)
|
||||
char *s;
|
||||
{
|
||||
if (posixtime (s) == -1)
|
||||
return NULL;
|
||||
return &t;
|
||||
}
|
||||
@@ -12,28 +12,50 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Jim Kingdon and David MacKenzie. */
|
||||
%{
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
/* The following block of alloca-related preprocessor directives is here
|
||||
solely to allow compilation by non GNU-C compilers of the C parser
|
||||
produced from this file by old versions of bison. Newer versions of
|
||||
bison include a block similar to this one in bison.simple. */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define alloca __builtin_alloca
|
||||
#else
|
||||
#ifdef sparc
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#else
|
||||
#ifdef _AIX
|
||||
#pragma alloca
|
||||
#else
|
||||
char *alloca ();
|
||||
void *alloca ();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef TM_IN_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
/* Some old versions of bison generate parsers that use bcopy.
|
||||
That loses on systems that don't provide the function, so we have
|
||||
to redefine it here. */
|
||||
#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
|
||||
#define bcopy(from, to, len) memcpy ((to), (from), (len))
|
||||
#endif
|
||||
|
||||
#define YYDEBUG 1
|
||||
|
||||
@@ -45,9 +67,56 @@ static struct tm t;
|
||||
|
||||
time_t mktime ();
|
||||
|
||||
#define yyparse posixtime_yyparse
|
||||
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
||||
as well as gratuitiously global symbol names, so we can have multiple
|
||||
yacc generated parsers in the same program. Note that these are only
|
||||
the variables produced by yacc. If other parser generators (bison,
|
||||
byacc, etc) produce additional global names that conflict at link time,
|
||||
then those parser generators need to be fixed instead of adding those
|
||||
names to this list. */
|
||||
|
||||
#define yymaxdepth pt_maxdepth
|
||||
#define yyparse pt_parse
|
||||
#define yylex pt_lex
|
||||
#define yyerror pt_error
|
||||
#define yylval pt_lval
|
||||
#define yychar pt_char
|
||||
#define yydebug pt_debug
|
||||
#define yypact pt_pact
|
||||
#define yyr1 pt_r1
|
||||
#define yyr2 pt_r2
|
||||
#define yydef pt_def
|
||||
#define yychk pt_chk
|
||||
#define yypgo pt_pgo
|
||||
#define yyact pt_act
|
||||
#define yyexca pt_exca
|
||||
#define yyerrflag pt_errflag
|
||||
#define yynerrs pt_nerrs
|
||||
#define yyps pt_ps
|
||||
#define yypv pt_pv
|
||||
#define yys pt_s
|
||||
#define yy_yys pt_yys
|
||||
#define yystate pt_state
|
||||
#define yytmp pt_tmp
|
||||
#define yyv pt_v
|
||||
#define yy_yyv pt_yyv
|
||||
#define yyval pt_val
|
||||
#define yylloc pt_lloc
|
||||
#define yyreds pt_reds /* With YYDEBUG defined */
|
||||
#define yytoks pt_toks /* With YYDEBUG defined */
|
||||
#define yylhs pt_yylhs
|
||||
#define yylen pt_yylen
|
||||
#define yydefred pt_yydefred
|
||||
#define yydgoto pt_yydgoto
|
||||
#define yysindex pt_yysindex
|
||||
#define yyrindex pt_yyrindex
|
||||
#define yygindex pt_yygindex
|
||||
#define yytable pt_yytable
|
||||
#define yycheck pt_yycheck
|
||||
|
||||
static int yylex ();
|
||||
static int yyerror ();
|
||||
|
||||
%}
|
||||
|
||||
%token DIGIT
|
||||
|
||||
93
lib/putenv.c
93
lib/putenv.c
@@ -1,57 +1,65 @@
|
||||
/* Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1991, 1994 Free Software Foundation, Inc.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Define-away any (possibly conflicting) prototype of putenv.
|
||||
Many systems omit the `const' attribute on the argument. */
|
||||
#define putenv _sys_putenv
|
||||
|
||||
#if defined (__GNU_LIBRARY__) || defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#if defined (__GNU_LIBRARY__) || defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#endif
|
||||
#if defined (__GNU_LIBRARY__) || defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#undef putenv
|
||||
|
||||
#if !defined (__GNU_LIBRARY__) && !defined (HAVE_STRCHR)
|
||||
# define strchr index
|
||||
#endif
|
||||
#if !defined (__GNU_LIBRARY__) && !defined (HAVE_MEMCPY)
|
||||
# define memcpy(d,s,n) bcopy ((s), (d), (n))
|
||||
#endif
|
||||
|
||||
#if HAVE_GNU_LD
|
||||
# define environ __environ
|
||||
#else
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if defined(STDC_HEADERS) || defined(USG)
|
||||
#include <string.h>
|
||||
#define index strchr
|
||||
#define bcopy(s, d, n) memcpy((d), (s), (n))
|
||||
#else /* not (STDC_HEADERS or USG) */
|
||||
#include <strings.h>
|
||||
#endif /* STDC_HEADERS or USG */
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#if !__STDC__
|
||||
#define const
|
||||
#endif
|
||||
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
|
||||
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
|
||||
int
|
||||
putenv (string)
|
||||
const char *string;
|
||||
{
|
||||
char *name_end = index (string, '=');
|
||||
const char *const name_end = strchr (string, '=');
|
||||
register size_t size;
|
||||
register char **ep;
|
||||
|
||||
@@ -86,11 +94,12 @@ putenv (string)
|
||||
char **new_environ = (char **) malloc ((size + 2) * sizeof (char *));
|
||||
if (new_environ == NULL)
|
||||
return -1;
|
||||
(void) bcopy ((char *) environ, (char *) new_environ, size * sizeof (char *));
|
||||
(void) memcpy ((void *) new_environ, (void *) environ,
|
||||
size * sizeof (char *));
|
||||
new_environ[size] = (char *) string;
|
||||
new_environ[size + 1] = NULL;
|
||||
if (last_environ != NULL)
|
||||
free ((char *) last_environ);
|
||||
free ((void *) last_environ);
|
||||
last_environ = new_environ;
|
||||
environ = new_environ;
|
||||
}
|
||||
|
||||
223
lib/readtokens.c
Normal file
223
lib/readtokens.c
Normal file
@@ -0,0 +1,223 @@
|
||||
/* readtokens.c -- Functions for reading tokens from an input stream.
|
||||
Copyright (C) 1990-1991 Jim Meyering.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Jim Meyering. */
|
||||
|
||||
/* This almost supercedes xreadline stuff -- using delim="\n"
|
||||
gives the same functionality, except that these functions
|
||||
would never return empty lines.
|
||||
|
||||
To Do:
|
||||
- To allow '\0' as a delimiter, I will have to change
|
||||
interfaces to permit specification of delimiter-string
|
||||
length.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if defined (STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
/* An ANSI string.h and pre-ANSI memory.h might conflict. */
|
||||
# if !defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
|
||||
# include <memory.h>
|
||||
# endif /* not STDC_HEADERS and HAVE_MEMORY_H */
|
||||
#else /* not STDC_HEADERS and not HAVE_STRING_H */
|
||||
# include <strings.h>
|
||||
/* memory.h and strings.h conflict on some systems. */
|
||||
#endif /* not STDC_HEADERS and not HAVE_STRING_H */
|
||||
|
||||
#include "readtokens.h"
|
||||
void *xmalloc ();
|
||||
void *xrealloc ();
|
||||
|
||||
#define STREQ(a,b) ((a) == (b) || ((a) && (b) && *(a) == *(b) \
|
||||
&& strcmp(a, b) == 0))
|
||||
|
||||
/* Initialize a tokenbuffer. */
|
||||
|
||||
void
|
||||
init_tokenbuffer (tokenbuffer)
|
||||
token_buffer *tokenbuffer;
|
||||
{
|
||||
tokenbuffer->size = INITIAL_TOKEN_LENGTH;
|
||||
tokenbuffer->buffer = ((char *) xmalloc (INITIAL_TOKEN_LENGTH));
|
||||
}
|
||||
|
||||
/* Read a token from `stream' into `tokenbuffer'.
|
||||
Upon return, the token is in tokenbuffer->buffer and
|
||||
has a trailing '\0' instead of the original delimiter.
|
||||
The function value is the length of the token not including
|
||||
the final '\0'. When EOF is reached (i.e. on the call
|
||||
after the last token is read), -1 is returned and tokenbuffer
|
||||
isn't modified.
|
||||
|
||||
This function will work properly on lines containing NUL bytes
|
||||
and on files that aren't newline-terminated. */
|
||||
|
||||
long
|
||||
readtoken (stream, delim, n_delim, tokenbuffer)
|
||||
FILE *stream;
|
||||
const char *delim;
|
||||
int n_delim;
|
||||
token_buffer *tokenbuffer;
|
||||
{
|
||||
char *p;
|
||||
int c, i, n;
|
||||
static const char *saved_delim = NULL;
|
||||
static char isdelim[256];
|
||||
int same_delimiters;
|
||||
|
||||
if (delim == NULL && saved_delim == NULL)
|
||||
abort ();
|
||||
|
||||
same_delimiters = 0;
|
||||
if (delim != saved_delim && saved_delim != NULL)
|
||||
{
|
||||
same_delimiters = 1;
|
||||
for (i = 0; i < n_delim; i++)
|
||||
{
|
||||
if (delim[i] != saved_delim[i])
|
||||
{
|
||||
same_delimiters = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!same_delimiters)
|
||||
{
|
||||
const char *t;
|
||||
saved_delim = delim;
|
||||
for (i = 0; i < sizeof (isdelim); i++)
|
||||
isdelim[i] = 0;
|
||||
for (t = delim; *t; t++)
|
||||
isdelim[(unsigned int) *t] = 1;
|
||||
}
|
||||
|
||||
p = tokenbuffer->buffer;
|
||||
n = tokenbuffer->size;
|
||||
i = 0;
|
||||
|
||||
/* FIXME: don't fool with this caching BS. Use strchr instead. */
|
||||
/* skip over any leading delimiters */
|
||||
for (c = getc (stream); c >= 0 && isdelim[c]; c = getc (stream))
|
||||
{
|
||||
/* empty */
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (i >= n)
|
||||
{
|
||||
n = 3 * (n / 2 + 1);
|
||||
p = xrealloc (p, (unsigned int) n);
|
||||
}
|
||||
if (c < 0)
|
||||
{
|
||||
if (i == 0)
|
||||
return (-1);
|
||||
p[i] = 0;
|
||||
break;
|
||||
}
|
||||
if (isdelim[c])
|
||||
{
|
||||
p[i] = 0;
|
||||
break;
|
||||
}
|
||||
p[i++] = c;
|
||||
c = getc (stream);
|
||||
}
|
||||
|
||||
tokenbuffer->buffer = p;
|
||||
tokenbuffer->size = n;
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Return a NULL-terminated array of pointers to tokens
|
||||
read from `stream.' The number of tokens is returned
|
||||
as the value of the function.
|
||||
All storage is obtained through calls to malloc();
|
||||
|
||||
%%% Question: is it worth it to do a single
|
||||
%%% realloc() of `tokens' just before returning? */
|
||||
|
||||
int
|
||||
readtokens (stream, projected_n_tokens, delim, n_delim,
|
||||
tokens_out, token_lengths)
|
||||
FILE *stream;
|
||||
int projected_n_tokens;
|
||||
const char *delim;
|
||||
int n_delim;
|
||||
char ***tokens_out;
|
||||
long **token_lengths;
|
||||
{
|
||||
token_buffer tb, *token = &tb;
|
||||
int token_length;
|
||||
char **tokens;
|
||||
long *lengths;
|
||||
int sz;
|
||||
int n_tokens;
|
||||
|
||||
n_tokens = 0;
|
||||
if (projected_n_tokens > 0)
|
||||
projected_n_tokens++; /* add one for trailing NULL pointer */
|
||||
else
|
||||
projected_n_tokens = 64;
|
||||
sz = projected_n_tokens;
|
||||
tokens = (char **) xmalloc (sz * sizeof (char *));
|
||||
lengths = (long *) xmalloc (sz * sizeof (long));
|
||||
|
||||
init_tokenbuffer (token);
|
||||
for (;;)
|
||||
{
|
||||
char *tmp;
|
||||
token_length = readtoken (stream, delim, n_delim, token);
|
||||
if (n_tokens >= sz)
|
||||
{
|
||||
sz *= 2;
|
||||
tokens = (char **) xrealloc (tokens, sz * sizeof (char *));
|
||||
lengths = (long *) xrealloc (lengths, sz * sizeof (long));
|
||||
}
|
||||
|
||||
if (token_length < 0)
|
||||
{
|
||||
/* don't increment n_tokens for NULL entry */
|
||||
tokens[n_tokens] = NULL;
|
||||
lengths[n_tokens] = -1;
|
||||
break;
|
||||
}
|
||||
tmp = (char *) xmalloc ((token_length + 1) * sizeof (char));
|
||||
lengths[n_tokens] = token_length;
|
||||
tokens[n_tokens] = strncpy (tmp, token->buffer,
|
||||
(unsigned) (token_length + 1));
|
||||
n_tokens++;
|
||||
}
|
||||
|
||||
free (token->buffer);
|
||||
*tokens_out = tokens;
|
||||
if (token_lengths != NULL)
|
||||
*token_lengths = lengths;
|
||||
return n_tokens;
|
||||
}
|
||||
36
lib/readtokens.h
Normal file
36
lib/readtokens.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef H_READTOKENS_H
|
||||
# define H_READTOKENS_H
|
||||
|
||||
# ifndef INITIAL_TOKEN_LENGTH
|
||||
# define INITIAL_TOKEN_LENGTH 20
|
||||
# endif
|
||||
|
||||
# ifndef TOKENBUFFER_DEFINED
|
||||
# define TOKENBUFFER_DEFINED
|
||||
struct tokenbuffer
|
||||
{
|
||||
long size;
|
||||
char *buffer;
|
||||
};
|
||||
typedef struct tokenbuffer token_buffer;
|
||||
|
||||
# endif /* not TOKENBUFFER_DEFINED */
|
||||
|
||||
# undef __P
|
||||
# if defined (__STDC__) && __STDC__
|
||||
# define __P(x) x
|
||||
# else
|
||||
# define __P(x) ()
|
||||
# endif
|
||||
|
||||
void init_tokenbuffer __P ((token_buffer *tokenbuffer));
|
||||
|
||||
long
|
||||
readtoken __P ((FILE *stream, const char *delim, int n_delim,
|
||||
token_buffer *tokenbuffer));
|
||||
int
|
||||
readtokens __P ((FILE *stream, int projected_n_tokens,
|
||||
const char *delim, int n_delim,
|
||||
char ***tokens_out, long **token_lengths));
|
||||
|
||||
#endif /* not H_READTOKENS_H */
|
||||
5476
lib/regex.c
5476
lib/regex.c
File diff suppressed because it is too large
Load Diff
88
lib/regex.h
88
lib/regex.h
@@ -1,7 +1,7 @@
|
||||
/* Definitions for data structures and routines for the regular
|
||||
expression library, version 0.11.
|
||||
expression library, version 0.12.
|
||||
|
||||
Copyright (C) 1985, 89, 90, 91, 92 Free Software Foundation, Inc.
|
||||
Copyright (C) 1985, 89, 90, 91, 92, 93, 95 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
|
||||
@@ -14,13 +14,21 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef __REGEXP_LIBRARY_H__
|
||||
#define __REGEXP_LIBRARY_H__
|
||||
|
||||
/* POSIX says that <sys/types.h> must be included before <regex.h>. */
|
||||
/* POSIX says that <sys/types.h> must be included (by the caller) before
|
||||
<regex.h>. */
|
||||
|
||||
#if !defined (_POSIX_C_SOURCE) && !defined (_POSIX_SOURCE) && defined (VMS)
|
||||
/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
|
||||
should be there. */
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* The following bits are used to determine the regexp syntax we
|
||||
recognize. The set/not-set meanings are chosen so that Emacs syntax
|
||||
@@ -34,7 +42,7 @@ typedef unsigned reg_syntax_t;
|
||||
#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
|
||||
|
||||
/* If this bit is not set, then + and ? are operators, and \+ and \? are
|
||||
literals.
|
||||
literals.
|
||||
If set, then \+ and \? are operators and + and ? are literals. */
|
||||
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
|
||||
|
||||
@@ -50,7 +58,7 @@ typedef unsigned reg_syntax_t;
|
||||
^ is an anchor if it is at the beginning of a regular
|
||||
expression or after an open-group or an alternation operator;
|
||||
$ is an anchor if it is at the end of a regular expression, or
|
||||
before a close-group or an alternation operator.
|
||||
before a close-group or an alternation operator.
|
||||
|
||||
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
|
||||
POSIX draft 11.2 says that * etc. in leading positions is undefined.
|
||||
@@ -61,7 +69,7 @@ typedef unsigned reg_syntax_t;
|
||||
/* If this bit is set, then special characters are always special
|
||||
regardless of where they are in the pattern.
|
||||
If this bit is not set, then special characters are special only in
|
||||
some contexts; otherwise they are ordinary. Specifically,
|
||||
some contexts; otherwise they are ordinary. Specifically,
|
||||
* + ? and intervals are only special when not after the beginning,
|
||||
open-group, or alternation operator. */
|
||||
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
|
||||
@@ -83,7 +91,7 @@ typedef unsigned reg_syntax_t;
|
||||
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
|
||||
|
||||
/* If this bit is set, either \{...\} or {...} defines an
|
||||
interval, depending on RE_NO_BK_BRACES.
|
||||
interval, depending on RE_NO_BK_BRACES.
|
||||
If not set, \{, \}, {, and } are literals. */
|
||||
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
|
||||
|
||||
@@ -108,7 +116,7 @@ typedef unsigned reg_syntax_t;
|
||||
If not set, then \<digit> is a back-reference. */
|
||||
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
|
||||
|
||||
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
||||
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
||||
If not set, then \| is an alternation operator, and | is literal. */
|
||||
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
|
||||
|
||||
@@ -122,6 +130,10 @@ typedef unsigned reg_syntax_t;
|
||||
If not set, then an unmatched ) is invalid. */
|
||||
#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
|
||||
|
||||
/* If this bit is set, succeed as soon as we match the whole pattern,
|
||||
without further backtracking. */
|
||||
#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
|
||||
|
||||
/* This global variable defines the particular regexp syntax to use (for
|
||||
some interfaces). When a regexp is compiled, the syntax used is
|
||||
stored in the pattern buffer, so changing this does not affect
|
||||
@@ -130,14 +142,14 @@ extern reg_syntax_t re_syntax_options;
|
||||
|
||||
/* Define combinations of the above bits for the standard possibilities.
|
||||
(The [[[ comments delimit what gets put into the Texinfo file, so
|
||||
don't delete them!) */
|
||||
don't delete them!) */
|
||||
/* [[[begin syntaxes]]] */
|
||||
#define RE_SYNTAX_EMACS 0
|
||||
|
||||
#define RE_SYNTAX_AWK \
|
||||
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VAR | RE_NO_EMPTY_RANGES \
|
||||
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
|
||||
| RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
|
||||
#define RE_SYNTAX_POSIX_AWK \
|
||||
@@ -157,6 +169,9 @@ extern reg_syntax_t re_syntax_options;
|
||||
#define RE_SYNTAX_POSIX_EGREP \
|
||||
(RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
|
||||
|
||||
/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
|
||||
#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
|
||||
|
||||
#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
|
||||
|
||||
/* Syntax bits common to both basic and extended POSIX regex syntax. */
|
||||
@@ -194,7 +209,7 @@ extern reg_syntax_t re_syntax_options;
|
||||
#ifdef RE_DUP_MAX
|
||||
#undef RE_DUP_MAX
|
||||
#endif
|
||||
#define RE_DUP_MAX ((1 << 15) - 1)
|
||||
#define RE_DUP_MAX ((1 << 15) - 1)
|
||||
|
||||
|
||||
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
|
||||
@@ -206,7 +221,7 @@ extern reg_syntax_t re_syntax_options;
|
||||
/* If this bit is set, then ignore case when matching.
|
||||
If not set, then case is significant. */
|
||||
#define REG_ICASE (REG_EXTENDED << 1)
|
||||
|
||||
|
||||
/* If this bit is set, then anchors do not match at newline
|
||||
characters in the string.
|
||||
If not set, then anchors do match at newlines. */
|
||||
@@ -245,7 +260,7 @@ typedef enum
|
||||
REG_EESCAPE, /* Trailing backslash. */
|
||||
REG_ESUBREG, /* Invalid back reference. */
|
||||
REG_EBRACK, /* Unmatched left bracket. */
|
||||
REG_EPAREN, /* Parenthesis imbalance. */
|
||||
REG_EPAREN, /* Parenthesis imbalance. */
|
||||
REG_EBRACE, /* Unmatched \{. */
|
||||
REG_BADBR, /* Invalid contents of \{\}. */
|
||||
REG_ERANGE, /* Invalid range end. */
|
||||
@@ -264,6 +279,10 @@ typedef enum
|
||||
compiled, the `re_nsub' field is available. All other fields are
|
||||
private to the regex routines. */
|
||||
|
||||
#ifndef RE_TRANSLATE_TYPE
|
||||
#define RE_TRANSLATE_TYPE char *
|
||||
#endif
|
||||
|
||||
struct re_pattern_buffer
|
||||
{
|
||||
/* [[[begin pattern_buffer]]] */
|
||||
@@ -276,7 +295,7 @@ struct re_pattern_buffer
|
||||
unsigned long allocated;
|
||||
|
||||
/* Number of bytes actually used in `buffer'. */
|
||||
unsigned long used;
|
||||
unsigned long used;
|
||||
|
||||
/* Syntax setting with which the pattern was compiled. */
|
||||
reg_syntax_t syntax;
|
||||
@@ -290,7 +309,7 @@ struct re_pattern_buffer
|
||||
comparing them, or zero for no translation. The translation
|
||||
is applied to a pattern when it is compiled and to a string
|
||||
when it is matched. */
|
||||
char *translate;
|
||||
RE_TRANSLATE_TYPE translate;
|
||||
|
||||
/* Number of subexpressions found by the compiler. */
|
||||
size_t re_nsub;
|
||||
@@ -311,16 +330,16 @@ struct re_pattern_buffer
|
||||
#define REGS_FIXED 2
|
||||
unsigned regs_allocated : 2;
|
||||
|
||||
/* Set to zero when regex_compile compiles a pattern; set to one
|
||||
by re_compile_fastmap when it updates the fastmap, if any. */
|
||||
/* Set to zero when `regex_compile' compiles a pattern; set to one
|
||||
by `re_compile_fastmap' if it updates the fastmap. */
|
||||
unsigned fastmap_accurate : 1;
|
||||
|
||||
/* If set, regexec reports only success or failure and does not
|
||||
return anything in pmatch. */
|
||||
/* If set, `re_match_2' does not return information about
|
||||
subexpressions. */
|
||||
unsigned no_sub : 1;
|
||||
|
||||
/* If set, a beginning-of-line anchor doesn't match at the
|
||||
beginning of the string. */
|
||||
beginning of the string. */
|
||||
unsigned not_bol : 1;
|
||||
|
||||
/* Similarly for an end-of-line anchor. */
|
||||
@@ -333,11 +352,6 @@ struct re_pattern_buffer
|
||||
};
|
||||
|
||||
typedef struct re_pattern_buffer regex_t;
|
||||
|
||||
|
||||
/* search.c (search_buffer) in Emacs needs this one opcode value. It is
|
||||
defined both in `regex.c' and here. */
|
||||
#define RE_EXACTN_VALUE 1
|
||||
|
||||
/* Type for byte offsets within the string. POSIX mandates this. */
|
||||
typedef int regoff_t;
|
||||
@@ -376,19 +390,17 @@ typedef struct
|
||||
prototype (if we are ANSI), and once without (if we aren't) -- we
|
||||
use the following macro to declare argument types. This
|
||||
unfortunately clutters up the declarations a bit, but I think it's
|
||||
worth it.
|
||||
|
||||
We also have to undo `const' if we are not ANSI and if it hasn't
|
||||
previously being taken care of. */
|
||||
worth it. */
|
||||
|
||||
#if __STDC__
|
||||
|
||||
#define _RE_ARGS(args) args
|
||||
#else
|
||||
|
||||
#else /* not __STDC__ */
|
||||
|
||||
#define _RE_ARGS(args) ()
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/* Sets the current default syntax to SYNTAX, and return the old syntax.
|
||||
You can also simply assign to the `re_syntax_options' variable. */
|
||||
@@ -434,7 +446,7 @@ extern int re_match
|
||||
|
||||
|
||||
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
|
||||
extern int re_match_2
|
||||
extern int re_match_2
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||
int length1, const char *string2, int length2,
|
||||
int start, struct re_registers *regs, int stop));
|
||||
@@ -456,9 +468,11 @@ extern void re_set_registers
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
|
||||
unsigned num_regs, regoff_t *starts, regoff_t *ends));
|
||||
|
||||
#ifdef _REGEX_RE_COMP
|
||||
/* 4.2 bsd compatibility. */
|
||||
extern char *re_comp _RE_ARGS ((const char *));
|
||||
extern int re_exec _RE_ARGS ((const char *));
|
||||
#endif
|
||||
|
||||
/* POSIX compatibility. */
|
||||
extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
|
||||
|
||||
49
lib/rename.c
49
lib/rename.c
@@ -1,4 +1,4 @@
|
||||
/* rename.c -- BSD compatible directory function for System V
|
||||
/* BSD compatible rename and directory rename function for System V.
|
||||
Copyright (C) 1988, 1990 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -12,18 +12,26 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#ifndef STDC_HEADERS
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if STAT_MACROS_BROKEN
|
||||
# undef S_ISDIR
|
||||
#endif
|
||||
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
/* Rename file FROM to file TO.
|
||||
@@ -34,14 +42,36 @@ rename (from, to)
|
||||
char *from;
|
||||
char *to;
|
||||
{
|
||||
struct stat from_stats;
|
||||
struct stat from_stats, to_stats;
|
||||
int pid, status;
|
||||
|
||||
if (stat (from, &from_stats))
|
||||
return -1;
|
||||
|
||||
if (unlink (to) && errno != ENOENT)
|
||||
return -1;
|
||||
/* Be careful not to unlink `from' if it happens to be equal to `to' or
|
||||
(on filesystems that silently truncate filenames after 14 characters)
|
||||
if `from' and `to' share the significant characters. */
|
||||
if (stat (to, &to_stats))
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((from_stats.st_dev == to_stats.st_dev)
|
||||
&& (from_stats.st_ino == to_stats.st_ino))
|
||||
/* `from' and `to' designate the same file on that filesystem. */
|
||||
return 0;
|
||||
|
||||
if (unlink (to) && errno != ENOENT)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef MVDIR
|
||||
|
||||
/* If MVDIR is defined, it should be the full filename of a setuid root
|
||||
program able to link and unlink directories. If MVDIR is not defined,
|
||||
then the capability of renaming directories may be missing. */
|
||||
|
||||
if (S_ISDIR (from_stats.st_mode))
|
||||
{
|
||||
@@ -66,6 +96,9 @@ rename (from, to)
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
#endif /* MVDIR */
|
||||
|
||||
{
|
||||
if (link (from, to))
|
||||
return -1;
|
||||
|
||||
86
lib/rmdir.c
Normal file
86
lib/rmdir.c
Normal file
@@ -0,0 +1,86 @@
|
||||
/* BSD compatible remove directory function for System V
|
||||
Copyright (C) 1988, 1990 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if STAT_MACROS_BROKEN
|
||||
# undef S_ISDIR
|
||||
#endif
|
||||
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
/* rmdir adapted from GNU tar. */
|
||||
|
||||
/* Remove directory DPATH.
|
||||
Return 0 if successful, -1 if not. */
|
||||
|
||||
int
|
||||
rmdir (dpath)
|
||||
char *dpath;
|
||||
{
|
||||
int cpid, status;
|
||||
struct stat statbuf;
|
||||
|
||||
if (stat (dpath, &statbuf) != 0)
|
||||
return -1; /* errno already set */
|
||||
|
||||
if (!S_ISDIR (statbuf.st_mode))
|
||||
{
|
||||
errno = ENOTDIR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
cpid = fork ();
|
||||
switch (cpid)
|
||||
{
|
||||
case -1: /* cannot fork */
|
||||
return -1; /* errno already set */
|
||||
|
||||
case 0: /* child process */
|
||||
execl ("/bin/rmdir", "rmdir", dpath, (char *) 0);
|
||||
_exit (1);
|
||||
|
||||
default: /* parent process */
|
||||
|
||||
/* Wait for kid to finish. */
|
||||
|
||||
while (wait (&status) != cpid)
|
||||
/* Do nothing. */ ;
|
||||
|
||||
if (status & 0xFFFF)
|
||||
{
|
||||
|
||||
/* /bin/rmdir failed. */
|
||||
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
91
lib/rpmatch.c
Normal file
91
lib/rpmatch.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/* rpmatch - determine whether string value is affirmation or negative
|
||||
response according to current locale's data
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS || _LIBC
|
||||
# include <stddef.h>
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# ifndef NULL
|
||||
# define NULL 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef WITH_REGEX
|
||||
# include <regex.h>
|
||||
#else
|
||||
# include <rx.h>
|
||||
#endif
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
|
||||
static int
|
||||
try (response, pattern, match, nomatch, lastp, re)
|
||||
const char *response;
|
||||
const char *pattern;
|
||||
const int match;
|
||||
const int nomatch;
|
||||
const char **lastp;
|
||||
regex_t *re;
|
||||
{
|
||||
if (pattern != *lastp)
|
||||
{
|
||||
/* The pattern has changed. */
|
||||
if (*lastp)
|
||||
{
|
||||
/* Free the old compiled pattern. */
|
||||
regfree (re);
|
||||
*lastp = NULL;
|
||||
}
|
||||
/* Compile the pattern and cache it for future runs. */
|
||||
if (regcomp (re, pattern, REG_EXTENDED) != 0)
|
||||
return -1;
|
||||
*lastp = pattern;
|
||||
}
|
||||
|
||||
/* See if the regular expression matches RESPONSE. */
|
||||
return regexec (re, response, 0, NULL, 0) == 0 ? match : nomatch;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rpmatch (response)
|
||||
const char *response;
|
||||
{
|
||||
/* Match against one of the response patterns, compiling the pattern
|
||||
first if necessary. */
|
||||
|
||||
/* We cache the response patterns and compiled regexps here. */
|
||||
static const char *yesexpr, *noexpr;
|
||||
static regex_t yesre, nore;
|
||||
int result;
|
||||
|
||||
return ((result = try (response, _("^[yY]"), 1, 0,
|
||||
&yesexpr, &yesre))
|
||||
? result
|
||||
: try (response, _("^[nN]"), 0, -1, &noexpr, &nore));
|
||||
}
|
||||
60
lib/safe-read.c
Normal file
60
lib/safe-read.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/* safe-read.c -- an interface to read that retries after interrupts
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
/* Read LEN bytes at PTR from descriptor DESC, retrying if interrupted.
|
||||
Return the actual number of bytes read, zero for EOF, or negative
|
||||
for an error. */
|
||||
|
||||
int
|
||||
safe_read (desc, ptr, len)
|
||||
int desc;
|
||||
char *ptr;
|
||||
int len;
|
||||
{
|
||||
int n_chars;
|
||||
|
||||
if (len <= 0)
|
||||
return len;
|
||||
|
||||
#ifdef EINTR
|
||||
do
|
||||
{
|
||||
n_chars = read (desc, ptr, len);
|
||||
}
|
||||
while (n_chars < 0 && errno == EINTR);
|
||||
#else
|
||||
n_chars = read (desc, ptr, len);
|
||||
#endif
|
||||
|
||||
return n_chars;
|
||||
}
|
||||
155
lib/save-cwd.c
Normal file
155
lib/save-cwd.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/* save-cwd.c -- Save and restore current working directory.
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Jim Meyering <meyering@na-net.ornl.gov>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#else
|
||||
# include <sys/file.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
# ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#include "save-cwd.h"
|
||||
#include "error.h"
|
||||
|
||||
char *xgetcwd __P((void));
|
||||
|
||||
/* Record the location of the current working directory in CWD so that
|
||||
the program may change to other directories and later use restore_cwd
|
||||
to return to the recorded location. This function may allocate
|
||||
space using malloc (via xgetcwd) or leave a file descriptor open;
|
||||
use free_cwd to perform the necessary free or close. Upon failure,
|
||||
no memory is allocated, any locally opened file descriptors are
|
||||
closed; return non-zero -- in that case, free_cwd need not be
|
||||
called, but doing so is ok. Otherwise, return zero. */
|
||||
|
||||
int
|
||||
save_cwd (cwd)
|
||||
struct saved_cwd *cwd;
|
||||
{
|
||||
static int have_working_fchdir = 1;
|
||||
|
||||
cwd->desc = -1;
|
||||
cwd->name = NULL;
|
||||
|
||||
if (have_working_fchdir)
|
||||
{
|
||||
#ifdef HAVE_FCHDIR
|
||||
cwd->desc = open (".", O_RDONLY);
|
||||
if (cwd->desc < 0)
|
||||
{
|
||||
error (0, errno, "cannot open current directory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
# if __sun__ || sun
|
||||
/* On SunOS 4, fchdir returns EINVAL if accounting is enabled,
|
||||
so we have to fall back to chdir. */
|
||||
if (fchdir (cwd->desc))
|
||||
{
|
||||
if (errno == EINVAL)
|
||||
{
|
||||
close (cwd->desc);
|
||||
cwd->desc = -1;
|
||||
have_working_fchdir = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
error (0, errno, "current directory");
|
||||
close (cwd->desc);
|
||||
cwd->desc = -1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
# endif /* __sun__ || sun */
|
||||
#else
|
||||
#define fchdir(x) (abort (), 0)
|
||||
have_working_fchdir = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!have_working_fchdir)
|
||||
{
|
||||
cwd->name = xgetcwd ();
|
||||
if (cwd->name == NULL)
|
||||
{
|
||||
error (0, errno, "cannot get current directory");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Change to recorded location, CWD, in directory hierarchy.
|
||||
If "saved working directory", NULL))
|
||||
*/
|
||||
|
||||
int
|
||||
restore_cwd (cwd, dest, from)
|
||||
const struct saved_cwd *cwd;
|
||||
const char *dest;
|
||||
const char *from;
|
||||
{
|
||||
int fail = 0;
|
||||
if (cwd->desc >= 0)
|
||||
{
|
||||
if (fchdir (cwd->desc))
|
||||
{
|
||||
error (0, errno, "cannot return to %s%s%s",
|
||||
(dest ? dest : "saved working directory"),
|
||||
(from ? " from " : ""),
|
||||
(from ? from : ""));
|
||||
fail = 1;
|
||||
}
|
||||
}
|
||||
else if (chdir (cwd->name) < 0)
|
||||
{
|
||||
error (0, errno, "%s", cwd->name);
|
||||
fail = 1;
|
||||
}
|
||||
return fail;
|
||||
}
|
||||
|
||||
void
|
||||
free_cwd (cwd)
|
||||
struct saved_cwd *cwd;
|
||||
{
|
||||
if (cwd->desc >= 0)
|
||||
close (cwd->desc);
|
||||
if (cwd->name)
|
||||
free (cwd->name);
|
||||
}
|
||||
|
||||
23
lib/save-cwd.h
Normal file
23
lib/save-cwd.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef SAVE_CWD_H
|
||||
#define SAVE_CWD_H 1
|
||||
|
||||
struct saved_cwd
|
||||
{
|
||||
int desc;
|
||||
char *name;
|
||||
};
|
||||
|
||||
#ifndef __P
|
||||
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
#define __P(args) args
|
||||
#else
|
||||
#define __P(args) ()
|
||||
#endif /* GCC. */
|
||||
#endif /* Not __P. */
|
||||
|
||||
int save_cwd __P((struct saved_cwd *cwd));
|
||||
int restore_cwd __P((const struct saved_cwd *cwd, const char *dest,
|
||||
const char *from));
|
||||
void free_cwd __P((struct saved_cwd *cwd));
|
||||
|
||||
#endif /* SAVE_CWD_H */
|
||||
@@ -12,33 +12,39 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@ai.mit.edu>. */
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef DIRENT
|
||||
#include <dirent.h>
|
||||
#ifdef direct
|
||||
#undef direct
|
||||
#endif
|
||||
#define direct dirent
|
||||
#define NLENGTH(direct) (strlen((direct)->d_name))
|
||||
#else
|
||||
#define NLENGTH(direct) ((direct)->d_namlen)
|
||||
#ifdef USG
|
||||
#ifdef SYSNDIR
|
||||
#include <sys/ndir.h>
|
||||
#else
|
||||
#include <ndir.h>
|
||||
#endif
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef VOID_CLOSEDIR
|
||||
#if HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
#else
|
||||
# define dirent direct
|
||||
# define NAMLEN(dirent) (dirent)->d_namlen
|
||||
# if HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
# if HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# if HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef CLOSEDIR_VOID
|
||||
/* Fake a return value. */
|
||||
#define CLOSEDIR(d) (closedir (d), 0)
|
||||
#else
|
||||
@@ -51,10 +57,10 @@
|
||||
#else
|
||||
char *malloc ();
|
||||
char *realloc ();
|
||||
#endif
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
char *stpcpy ();
|
||||
|
||||
@@ -71,7 +77,7 @@ savedir (dir, name_size)
|
||||
unsigned name_size;
|
||||
{
|
||||
DIR *dirp;
|
||||
struct direct *dp;
|
||||
struct dirent *dp;
|
||||
char *name_space;
|
||||
char *namep;
|
||||
|
||||
@@ -94,7 +100,7 @@ savedir (dir, name_size)
|
||||
|| (dp->d_name[1] != '\0'
|
||||
&& (dp->d_name[1] != '.' || dp->d_name[2] != '\0')))
|
||||
{
|
||||
unsigned size_needed = (namep - name_space) + NLENGTH (dp) + 2;
|
||||
unsigned size_needed = (namep - name_space) + NAMLEN (dp) + 2;
|
||||
|
||||
if (size_needed > name_size)
|
||||
{
|
||||
|
||||
129
lib/setenv.c
Normal file
129
lib/setenv.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/* Copyright (C) 1992, 1995 Free Software Foundation, Inc.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if _LIBC || HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#if _LIBC || HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#if _LIBC || HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GNU_LD
|
||||
# define __environ environ
|
||||
#endif
|
||||
|
||||
int
|
||||
setenv (name, value, replace)
|
||||
const char *name;
|
||||
const char *value;
|
||||
int replace;
|
||||
{
|
||||
register char **ep;
|
||||
register size_t size;
|
||||
const size_t namelen = strlen (name);
|
||||
const size_t vallen = strlen (value) + 1;
|
||||
|
||||
size = 0;
|
||||
for (ep = __environ; *ep != NULL; ++ep)
|
||||
if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
|
||||
break;
|
||||
else
|
||||
++size;
|
||||
|
||||
if (*ep == NULL)
|
||||
{
|
||||
static char **last_environ;
|
||||
char **new_environ;
|
||||
if (__environ == last_environ)
|
||||
/* We allocated this space; we can extend it. */
|
||||
new_environ = (char **) realloc (last_environ,
|
||||
(size + 2) * sizeof (char *));
|
||||
else
|
||||
new_environ = (char **) malloc ((size + 2) * sizeof (char *));
|
||||
|
||||
if (new_environ == NULL)
|
||||
return -1;
|
||||
|
||||
new_environ[size] = malloc (namelen + 1 + vallen);
|
||||
if (new_environ[size] == NULL)
|
||||
{
|
||||
free ((char *) new_environ);
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (__environ != last_environ)
|
||||
memcpy ((char *) new_environ, (char *) __environ,
|
||||
size * sizeof (char *));
|
||||
|
||||
memcpy (new_environ[size], name, namelen);
|
||||
new_environ[size][namelen] = '=';
|
||||
memcpy (&new_environ[size][namelen + 1], value, vallen);
|
||||
|
||||
new_environ[size + 1] = NULL;
|
||||
|
||||
last_environ = __environ = new_environ;
|
||||
}
|
||||
else if (replace)
|
||||
{
|
||||
size_t len = strlen (*ep);
|
||||
if (len + 1 < namelen + 1 + vallen)
|
||||
{
|
||||
/* The existing string is too short; malloc a new one. */
|
||||
char *new = malloc (namelen + 1 + vallen);
|
||||
if (new == NULL)
|
||||
return -1;
|
||||
*ep = new;
|
||||
}
|
||||
memcpy (*ep, name, namelen);
|
||||
(*ep)[namelen] = '=';
|
||||
memcpy (&(*ep)[namelen + 1], value, vallen);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
unsetenv (name)
|
||||
const char *name;
|
||||
{
|
||||
const size_t len = strlen (name);
|
||||
char **ep;
|
||||
|
||||
for (ep = __environ; *ep; ++ep)
|
||||
if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
|
||||
{
|
||||
/* Found it. Remove this pointer by moving later ones back. */
|
||||
char **dp = ep;
|
||||
do
|
||||
dp[0] = dp[1];
|
||||
while (*dp++);
|
||||
/* Continue the loop in case NAME appears again. */
|
||||
}
|
||||
}
|
||||
17
lib/setenv.h
Normal file
17
lib/setenv.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef SETENV_H
|
||||
# define SETENV_H 1
|
||||
|
||||
# undef __P
|
||||
# if defined (__STDC__) && __STDC__
|
||||
# define __P(x) x
|
||||
# else
|
||||
# define __P(x) ()
|
||||
# endif
|
||||
|
||||
int
|
||||
setenv __P ((const char *name, const char *value, int replace));
|
||||
|
||||
void
|
||||
unsetenv __P ((const char *name));
|
||||
|
||||
#endif /* SETENV_H */
|
||||
@@ -12,11 +12,15 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* David MacKenzie <djm@ai.mit.edu> */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
18
lib/stpcpy.c
18
lib/stpcpy.c
@@ -12,19 +12,21 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Copy SOURCE into DEST, stopping after copying the first '\0', and
|
||||
return a pointer to the '\0' at the end of DEST;
|
||||
in other words, return DEST + strlen (SOURCE). */
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
|
||||
|
||||
char *
|
||||
stpcpy (dest, source)
|
||||
stpcpy (dest, src)
|
||||
char *dest;
|
||||
char *source;
|
||||
const char *src;
|
||||
{
|
||||
while ((*dest++ = *source++) != '\0')
|
||||
while ((*dest++ = *src++) != '\0')
|
||||
/* Do nothing. */ ;
|
||||
return dest - 1;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,31 @@
|
||||
/* Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
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 Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
char *index ();
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
# ifndef strchr
|
||||
# define strchr index
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Return the length of the maximum inital segment of S
|
||||
which contains no characters from REJECT. */
|
||||
@@ -28,7 +37,7 @@ strcspn (s, reject)
|
||||
register int count = 0;
|
||||
|
||||
while (*s != '\0')
|
||||
if (index (reject, *s++) == 0)
|
||||
if (strchr (reject, *s++) == 0)
|
||||
++count;
|
||||
else
|
||||
return count;
|
||||
|
||||
12
lib/strdup.c
12
lib/strdup.c
@@ -12,8 +12,12 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <string.h>
|
||||
@@ -23,10 +27,6 @@ char *malloc ();
|
||||
char *strcpy ();
|
||||
#endif
|
||||
|
||||
#if !__STDC__
|
||||
#define const
|
||||
#endif
|
||||
|
||||
/* Return a newly allocated copy of STR,
|
||||
or 0 if out of memory. */
|
||||
|
||||
|
||||
1361
lib/strftime.c
1361
lib/strftime.c
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user