mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
504 Commits
FILEUTILS-
...
SH-UTILS-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f110142bb | ||
|
|
23497d87b7 | ||
|
|
73f3647fe2 | ||
|
|
a305c4a189 | ||
|
|
b05ff2249b | ||
|
|
7fe4db1451 | ||
|
|
393e4a8c36 | ||
|
|
aba02b5978 | ||
|
|
708d4a74de | ||
|
|
6e1340462e | ||
|
|
aeea923e99 | ||
|
|
d461077920 | ||
|
|
d0c515b45c | ||
|
|
4b84ea8745 | ||
|
|
51a0fa60c8 | ||
|
|
2d8c67c7d5 | ||
|
|
ad0f8c9b71 | ||
|
|
67fe78f11c | ||
|
|
b18c5abf1c | ||
|
|
59f66af0f4 | ||
|
|
4cf5b77561 | ||
|
|
65738c9162 | ||
|
|
6341f011d7 | ||
|
|
558f0fa3ea | ||
|
|
7673378e0a | ||
|
|
97fca9a840 | ||
|
|
f124c131af | ||
|
|
ee81a6190f | ||
|
|
d1a07e1ad2 | ||
|
|
3dcfda7bda | ||
|
|
3f275a59a5 | ||
|
|
67132b480f | ||
|
|
d9921abba7 | ||
|
|
626e48dcca | ||
|
|
f1994a3f6e | ||
|
|
b6a57ff354 | ||
|
|
0e6b6d4c5c | ||
|
|
309b8c57fb | ||
|
|
a3294a01b0 | ||
|
|
204f6064e5 | ||
|
|
17ca5d8c74 | ||
|
|
4a2df8ccf5 | ||
|
|
2d1baaeb31 | ||
|
|
1a2964b988 | ||
|
|
4170f6416d | ||
|
|
735847657b | ||
|
|
8d6318c532 | ||
|
|
36df273199 | ||
|
|
1db47deedb | ||
|
|
d6bdaed4c0 | ||
|
|
1481657ca1 | ||
|
|
99f8939150 | ||
|
|
45eb103e4c | ||
|
|
990c0d0fad | ||
|
|
9295c4fdca | ||
|
|
41c1791ddd | ||
|
|
c8fbd48706 | ||
|
|
ccd911b026 | ||
|
|
deb5b314a5 | ||
|
|
c23aa46af6 | ||
|
|
8dfdbd327c | ||
|
|
49ec273bd5 | ||
|
|
b09226e1b4 | ||
|
|
d68871bdec | ||
|
|
6b544d3d8a | ||
|
|
2624654a78 | ||
|
|
2d3d80a3f2 | ||
|
|
f6ffa56bc6 | ||
|
|
8d71f2bb2d | ||
|
|
a9309ad872 | ||
|
|
bc1634bc1a | ||
|
|
6da5f51d3a | ||
|
|
a8068a365d | ||
|
|
29e0df8652 | ||
|
|
f9f695018a | ||
|
|
64320d0470 | ||
|
|
5e0ce74b1d | ||
|
|
47489a5b27 | ||
|
|
a5d528d3d7 | ||
|
|
3358aeb5d3 | ||
|
|
bc16e65a8e | ||
|
|
6bb8c4e904 | ||
|
|
89743fce5c | ||
|
|
8f19e15873 | ||
|
|
c2f3a114a8 | ||
|
|
ba6af15f00 | ||
|
|
0c073269a5 | ||
|
|
4e9441a1e7 | ||
|
|
c2b8fe4acf | ||
|
|
f3a329069e | ||
|
|
244fb561f8 | ||
|
|
2cd9474cb6 | ||
|
|
abd1bad4b6 | ||
|
|
f066a3acfe | ||
|
|
83c3f08048 | ||
|
|
d0caad54ae | ||
|
|
f873ad6e6c | ||
|
|
0c5e6d93cd | ||
|
|
2b0ecc7fa5 | ||
|
|
afe6283539 | ||
|
|
0735c835a9 | ||
|
|
a1cf1abf4d | ||
|
|
1fca2b262a | ||
|
|
08f38fd930 | ||
|
|
573588283f | ||
|
|
8e14d7accc | ||
|
|
77ef7e08a7 | ||
|
|
ac0ee614d6 | ||
|
|
8e04be3e8d | ||
|
|
4369606f15 | ||
|
|
f014f4f60f | ||
|
|
581b1540f5 | ||
|
|
a7da25a2bb | ||
|
|
14608042dd | ||
|
|
f8bedd0047 | ||
|
|
4d8f9c4929 | ||
|
|
1e80216861 | ||
|
|
b541bff3de | ||
|
|
bea4748f5c | ||
|
|
19d151cbbd | ||
|
|
d61ab3fc24 | ||
|
|
70cfca742f | ||
|
|
677ddac432 | ||
|
|
93b02c5289 | ||
|
|
22ff29fe3e | ||
|
|
ab171ee6b5 | ||
|
|
c86d0a7a45 | ||
|
|
4396edc12e | ||
|
|
442d670b3a | ||
|
|
7a280a0fda | ||
|
|
df05506016 | ||
|
|
b3580d0a75 | ||
|
|
2499628bff | ||
|
|
b5e0f033a6 | ||
|
|
059ccb6ac7 | ||
|
|
5f14bb768e | ||
|
|
7f490dad0e | ||
|
|
3e81211212 | ||
|
|
3f0b15ac80 | ||
|
|
41faa55aed | ||
|
|
04c0cd59a5 | ||
|
|
6ad0d51107 | ||
|
|
bc8c5033e3 | ||
|
|
dc404c4107 | ||
|
|
e44678aac2 | ||
|
|
42a63be148 | ||
|
|
1226259896 | ||
|
|
cabc10b909 | ||
|
|
90e9fd9c77 | ||
|
|
0935e2ce3f | ||
|
|
611cf8e97b | ||
|
|
3d9239c750 | ||
|
|
551c02f7b6 | ||
|
|
90c131fa21 | ||
|
|
a6b6c95b83 | ||
|
|
25c1d1dccd | ||
|
|
d9741142c8 | ||
|
|
a84d2bada4 | ||
|
|
9654920c40 | ||
|
|
a13135d09e | ||
|
|
f657d65570 | ||
|
|
9bcfe15afe | ||
|
|
4378dcecdf | ||
|
|
fa4894b30c | ||
|
|
6700c89ac7 | ||
|
|
d18dc59619 | ||
|
|
973f13ccb2 | ||
|
|
e148f6d293 | ||
|
|
3841b591c1 | ||
|
|
e8b0678fed | ||
|
|
08f074fb34 | ||
|
|
2f91f08a79 | ||
|
|
9bf8c1c229 | ||
|
|
504b9fe47a | ||
|
|
57f7889059 | ||
|
|
8b4d49fc79 | ||
|
|
a6526f2171 | ||
|
|
bfc9115ee5 | ||
|
|
5e3188fba4 | ||
|
|
57c0f5cfff | ||
|
|
19342feca7 | ||
|
|
7b097c0e37 | ||
|
|
952a76e506 | ||
|
|
0dcca900cc | ||
|
|
ab029fd3e5 | ||
|
|
acdc74dbf5 | ||
|
|
1830d29be9 | ||
|
|
3b4748d124 | ||
|
|
50e65a424c | ||
|
|
aca4091fae | ||
|
|
2add756624 | ||
|
|
2f1768f676 | ||
|
|
4f0bef5377 | ||
|
|
4dc1f7070b | ||
|
|
63ca47adfc | ||
|
|
c8460daf24 | ||
|
|
a6062bfb05 | ||
|
|
83461932b5 | ||
|
|
23c6ab8674 | ||
|
|
25f6a4a7c0 | ||
|
|
8eebff2029 | ||
|
|
6ecad0839e | ||
|
|
9fb965dfd8 | ||
|
|
bcdaf2c1a5 | ||
|
|
e737958ebb | ||
|
|
44df08ee55 | ||
|
|
8406b91aba | ||
|
|
2078f2391e | ||
|
|
f442eb2941 | ||
|
|
f1390de4c3 | ||
|
|
93ede2c8e1 | ||
|
|
ae7a2a007a | ||
|
|
1f107588fa | ||
|
|
a45a7e3819 | ||
|
|
5f0bf654a4 | ||
|
|
985bd80461 | ||
|
|
8bb2bf5d28 | ||
|
|
cc167bce98 | ||
|
|
f5291be83e | ||
|
|
2c0e561933 | ||
|
|
a488983890 | ||
|
|
94468e0921 | ||
|
|
4377246ee3 | ||
|
|
6edc738156 | ||
|
|
4f690a51e3 | ||
|
|
7eaf75e3b1 | ||
|
|
4354caa2d4 | ||
|
|
106775512b | ||
|
|
72559c0e30 | ||
|
|
437b98461e | ||
|
|
074c7edade | ||
|
|
e4f25ca7b1 | ||
|
|
dd547a84bf | ||
|
|
bc50ceb474 | ||
|
|
4c2adcbd56 | ||
|
|
f0c27dac9e | ||
|
|
93e9fef09f | ||
|
|
187f712b73 | ||
|
|
aa8b6cf83c | ||
|
|
46a9863033 | ||
|
|
c213bae308 | ||
|
|
ca55ba3715 | ||
|
|
168eb7758e | ||
|
|
96c4c01019 | ||
|
|
926c6c3301 | ||
|
|
8805ede31b | ||
|
|
cd29ba84ab | ||
|
|
a65a081656 | ||
|
|
8b36f9cbcd | ||
|
|
0cc1681a5b | ||
|
|
e3e8f658c4 | ||
|
|
07876bcb5d | ||
|
|
11080b7544 | ||
|
|
1b71b3372e | ||
|
|
1bfb2c3ec7 | ||
|
|
1ba34180d7 | ||
|
|
54a61c3cf6 | ||
|
|
f735e157e9 | ||
|
|
5708e7bba8 | ||
|
|
6919955eb1 | ||
|
|
4f99d359c8 | ||
|
|
6fd92cf72b | ||
|
|
2ebfd210cd | ||
|
|
d5659aa5e1 | ||
|
|
9add219c87 | ||
|
|
4d347c9e1f | ||
|
|
90721ff4a4 | ||
|
|
1024238089 | ||
|
|
b0f8e63615 | ||
|
|
c8062f789d | ||
|
|
3dc7a93409 | ||
|
|
59ed92cdcf | ||
|
|
d0a506b84b | ||
|
|
ccb48f46d6 | ||
|
|
9080de09fc | ||
|
|
44848c0887 | ||
|
|
f6a1207cf9 | ||
|
|
6c04dfc1e1 | ||
|
|
795d254715 | ||
|
|
e5ce0d8b3e | ||
|
|
9778fd673b | ||
|
|
3a46eb9695 | ||
|
|
3a84136d8c | ||
|
|
a77bf7510f | ||
|
|
afdfd95be8 | ||
|
|
3f9d8ee21b | ||
|
|
480a5db227 | ||
|
|
9874f0eedf | ||
|
|
39361c9d6e | ||
|
|
7f74dcb1a6 | ||
|
|
738818ee66 | ||
|
|
90e1281e8e | ||
|
|
907f15c7d6 | ||
|
|
258186e1ce | ||
|
|
2e1059b400 | ||
|
|
58a9554b17 | ||
|
|
ca70b66b72 | ||
|
|
b3f0804efd | ||
|
|
ebce57b0e6 | ||
|
|
3426e7ca7a | ||
|
|
39b444e420 | ||
|
|
00ea088ccd | ||
|
|
cd45cc7335 | ||
|
|
7ecf5ed43b | ||
|
|
6d648c45ed | ||
|
|
cc093a9945 | ||
|
|
3416bdb6e1 | ||
|
|
a37da82c38 | ||
|
|
f101a9b57f | ||
|
|
c7b5fd2423 | ||
|
|
f1c111d469 | ||
|
|
24ffa56fd0 | ||
|
|
e269fcdb28 | ||
|
|
61ac269c6e | ||
|
|
e71f8cf087 | ||
|
|
b524db4e87 | ||
|
|
37e05875d5 | ||
|
|
fcc31060fa | ||
|
|
e328e25bd1 | ||
|
|
bf435650e1 | ||
|
|
cd0aba1c14 | ||
|
|
a1e46876c6 | ||
|
|
66c246fc17 | ||
|
|
fbe78f2ef6 | ||
|
|
33da7dcdda | ||
|
|
3f2ded808d | ||
|
|
bcdeccb6a3 | ||
|
|
808a6a2308 | ||
|
|
29e56fa096 | ||
|
|
f02b837782 | ||
|
|
294ea6ffc2 | ||
|
|
c127695e96 | ||
|
|
d713508802 | ||
|
|
c42ed1e1fb | ||
|
|
e64db863dd | ||
|
|
40b667e0e9 | ||
|
|
effc683cfc | ||
|
|
898fd10ec0 | ||
|
|
7017b8f67f | ||
|
|
c230f7db00 | ||
|
|
5ed7bf6069 | ||
|
|
a7cbdd04cd | ||
|
|
4e81181981 | ||
|
|
1dc27001d5 | ||
|
|
9034e099da | ||
|
|
78f4331cab | ||
|
|
a9616d4982 | ||
|
|
f1fbec95d5 | ||
|
|
dd2f783492 | ||
|
|
fac7cfba06 | ||
|
|
613357b0ab | ||
|
|
de397548a8 | ||
|
|
8a3180c8f0 | ||
|
|
73e03453df | ||
|
|
ea805db369 | ||
|
|
d358cd813b | ||
|
|
571f4f4fde | ||
|
|
8c93627ccb | ||
|
|
80409f292d | ||
|
|
8b2b45e172 | ||
|
|
94cab36432 | ||
|
|
e1b834211b | ||
|
|
a0400ec19b | ||
|
|
27237bfb10 | ||
|
|
df86f458a2 | ||
|
|
88c3a362e9 | ||
|
|
a4ccff96f9 | ||
|
|
6df1efb30c | ||
|
|
75bc50c6fc | ||
|
|
5cb0201730 | ||
|
|
db78b4797a | ||
|
|
9de7f6a024 | ||
|
|
4b0e6d0a33 | ||
|
|
a6ebe05733 | ||
|
|
e16668553e | ||
|
|
3b459d46bc | ||
|
|
2e31651a02 | ||
|
|
9e2c86c67a | ||
|
|
4af2c36dfa | ||
|
|
5234813a09 | ||
|
|
3b8313838c | ||
|
|
9b47c04ac1 | ||
|
|
11332e0c26 | ||
|
|
785168be90 | ||
|
|
91eb812c61 | ||
|
|
2be08dd6d3 | ||
|
|
6d09ea7b0d | ||
|
|
7bb258353f | ||
|
|
35ec0a08b5 | ||
|
|
1b1bca8a63 | ||
|
|
11e498679b | ||
|
|
30979f06d8 | ||
|
|
c321e5b51a | ||
|
|
bf8b53e78b | ||
|
|
1ee3e32c80 | ||
|
|
668010de9e | ||
|
|
24f79bb72c | ||
|
|
1bdee95e06 | ||
|
|
90bdeb65ca | ||
|
|
522f1f2f27 | ||
|
|
0d457a8063 | ||
|
|
5db942f46c | ||
|
|
80cccededc | ||
|
|
dd77d0602a | ||
|
|
4722a74bcf | ||
|
|
16632f72fc | ||
|
|
be855de208 | ||
|
|
feb2f918b3 | ||
|
|
6bdbdae68c | ||
|
|
59f891e8b8 | ||
|
|
2be25646bd | ||
|
|
4ee12115f0 | ||
|
|
7eb03c4372 | ||
|
|
b7ffe8cdaf | ||
|
|
dbc538f92b | ||
|
|
562488ee9c | ||
|
|
3e9c9be49e | ||
|
|
9e2ad11286 | ||
|
|
5d159ca17a | ||
|
|
b7a12bb110 | ||
|
|
155fa29f27 | ||
|
|
8257531353 | ||
|
|
49e3c8fee2 | ||
|
|
7a5980964b | ||
|
|
c1e4806502 | ||
|
|
84ed9c3db9 | ||
|
|
3c97cf0102 | ||
|
|
9e61c5f51a | ||
|
|
a0aa288531 | ||
|
|
1235c944d2 | ||
|
|
05ff9c82a6 | ||
|
|
e4af7abbde | ||
|
|
e8bcfd934a | ||
|
|
1b5a74d1a7 | ||
|
|
a2ffd5db02 | ||
|
|
704a69781e | ||
|
|
5f24ab538f | ||
|
|
6a203a2347 | ||
|
|
16e150496f | ||
|
|
44a82a9eb6 | ||
|
|
a15366696c | ||
|
|
c64a391bb2 | ||
|
|
1d286acd9a | ||
|
|
b63df62ce1 | ||
|
|
ff323743c5 | ||
|
|
50d2bb5b7b | ||
|
|
1a375e421b | ||
|
|
09e2cc2fdf | ||
|
|
d262a3cc82 | ||
|
|
badb35bdb7 | ||
|
|
3cca84e543 | ||
|
|
4ea19e3b31 | ||
|
|
118cbe89db | ||
|
|
f13f9c1936 | ||
|
|
0bda501d01 | ||
|
|
8e6d4e2d3e | ||
|
|
c859133450 | ||
|
|
1b4dfdc778 | ||
|
|
620317a6bf | ||
|
|
c1c6d5fa1f | ||
|
|
576b49f9f0 | ||
|
|
f18a2cdcd6 | ||
|
|
b6aa3e6c17 | ||
|
|
2e2fe82afe | ||
|
|
67c5175138 | ||
|
|
bece4592b4 | ||
|
|
0081aea9e1 | ||
|
|
fec37a7211 | ||
|
|
5d3c42ac61 | ||
|
|
cd0b33c839 | ||
|
|
a7dbd3f5e4 | ||
|
|
e077b7593b | ||
|
|
a882d55b52 | ||
|
|
899a90bfd9 | ||
|
|
09f70cf63b | ||
|
|
d4efcf477e | ||
|
|
0e291b59ed | ||
|
|
b8c82a8e39 | ||
|
|
4f51b86bfb | ||
|
|
c2d2dec516 | ||
|
|
1e40423be8 | ||
|
|
0c5ab92b59 | ||
|
|
b9278db095 | ||
|
|
944b08f293 | ||
|
|
307b54a273 | ||
|
|
795162649b | ||
|
|
3181551ddd | ||
|
|
4cbcb32a53 | ||
|
|
13a5e426f3 | ||
|
|
56557d787a | ||
|
|
6b1d2c4de1 | ||
|
|
bca3705ac5 | ||
|
|
9fcda065b6 | ||
|
|
188edf1546 | ||
|
|
22922b8765 | ||
|
|
e16812dea8 | ||
|
|
20580c3f25 | ||
|
|
a6871ebbce | ||
|
|
0ce61713d5 | ||
|
|
d705b6c469 | ||
|
|
771ab6e1bf | ||
|
|
b103723acc | ||
|
|
03ebea3ec6 | ||
|
|
5f011471a3 |
26
ABOUT-NLS
26
ABOUT-NLS
@@ -134,8 +134,8 @@ 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:
|
||||
in ISO 3166. The following translation teams exist, as of February
|
||||
1997:
|
||||
|
||||
Arabic `ar', Chinese `zh', Czech `cs', Danish `da', Dutch `nl',
|
||||
English `en', Esperanto `eo', Finnish `fi', French `fr', German
|
||||
@@ -173,7 +173,7 @@ 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
|
||||
as of February 1997. The matrix shows, in regard of each package, for
|
||||
which languages PO files have been submitted to translation
|
||||
coordination.
|
||||
|
||||
@@ -182,33 +182,33 @@ coordination.
|
||||
bash | [] [] [] | 3
|
||||
bison | [] [] [] | 3
|
||||
clisp | [] [] [] | 3
|
||||
cpio | [] [] [] [] | 4
|
||||
cpio | [] [] [] [] [] | 5
|
||||
diffutils | [] [] [] [] | 4
|
||||
enscript | [] [] [] [] [] | 5
|
||||
fileutils | [] [] [] [] [] [] [] [] | 8
|
||||
findutils | [] [] [] [] [] [] | 6
|
||||
flex | [] [] | 2
|
||||
findutils | [] [] [] [] [] [] [] | 7
|
||||
flex | [] [] [] | 3
|
||||
gcal | [] [] [] | 3
|
||||
gettext | [] [] [] [] [] [] [] [] [] [] | 11
|
||||
grep | [] [] [] [] [] [] [] [] | 8
|
||||
hello | [] [] [] [] [] [] [] [] [] [] | 10
|
||||
id-utils | [] [] | 2
|
||||
indent | | 0
|
||||
libc | [] [] [] [] [] [] | 6
|
||||
indent | [] [] | 2
|
||||
libc | [] [] [] [] [] [] [] | 7
|
||||
m4 | [] [] [] [] [] | 5
|
||||
make | [] [] [] [] [] | 5
|
||||
make | [] [] [] [] [] [] | 6
|
||||
music | [] | 1
|
||||
ptx | [] [] [] [] [] [] [] [] | 8
|
||||
recode | [] [] [] [] [] [] [] | 7
|
||||
recode | [] [] [] [] [] [] [] [] | 8
|
||||
sh-utils | [] [] [] [] [] | 5
|
||||
sharutils | [] [] [] [] | 4
|
||||
sharutils | [] [] [] [] [] | 5
|
||||
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
|
||||
27 packages 1 22 1 14 1 25 1 10 20 7 14 7 7 15 145
|
||||
|
||||
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
|
||||
@@ -221,6 +221,6 @@ 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
|
||||
If February 1997 seems to be old, you may fetch a more recent copy
|
||||
of this `ABOUT-NLS' file on most GNU archive sites.
|
||||
|
||||
|
||||
9
COPYING
9
COPYING
@@ -2,7 +2,7 @@
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, 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.
|
||||
|
||||
@@ -279,7 +279,7 @@ POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
@@ -304,8 +304,9 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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.
|
||||
|
||||
|
||||
7
INSTALL
7
INSTALL
@@ -31,7 +31,7 @@ The simplest way to compile this package is:
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes a while. While running, it prints some
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
@@ -167,7 +167,9 @@ operates.
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made.
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
@@ -178,4 +180,3 @@ operates.
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
||||
|
||||
13
THANKS
13
THANKS
@@ -1,21 +1,32 @@
|
||||
This is just a start at listing e-mail addresses of contributors.
|
||||
The rest of the addresses are still in the ChangeLog.
|
||||
|
||||
Arne Henrik Juul arnej@imf.unit.no
|
||||
Andreas Schwab: schwab@issan.informatik.uni-dortmund.de
|
||||
Arne Henrik Juul: arnej@imf.unit.no
|
||||
Bauke Jan Douma: bjdouma@xs4all.nl
|
||||
Bengt Martensson: bengt@mathematik.uni-Bremen.de
|
||||
Charles Karney: karney@pppl.gov
|
||||
Eirik Fuller: eirik@netcom.com
|
||||
Emile LeBlanc: leblanc@math.toronto.edu
|
||||
Galen Hazelwood: galenh@micron.net
|
||||
Greg McGary: gkm@eng.ascend.com
|
||||
Hugh Daniel: hugh@xanadu.com
|
||||
James: james@albion.glarp.com
|
||||
James Antill: jmanti%essex.ac.uk@seralph21.essex.ac.uk
|
||||
Jesse Thilo: jgt2@eecs.lehigh.edu
|
||||
Joakim Rosqvist: dvljrt@cs.umu.se
|
||||
John Gatewood Ham: zappaman@alphabox.compsci.buu.ac.th
|
||||
Marcus Daniels: marcus@sysc.pdx.edu
|
||||
Mark A. Thomas: thommark@access.digex.net
|
||||
Mark Harris: mark@monitor.designacc.com
|
||||
Matthew S. Levine: mslevine@theory.lcs.mit.edu
|
||||
Miles Bader: miles@gnu.ai.mit.edu
|
||||
Peter Eriksson: peter@ifm.liu.se
|
||||
Ross Ridge: rridge@calum.csclub.uwaterloo.ca
|
||||
Santiago Vila Doncel: sanvila@ctv.es
|
||||
Stuart Kemp: skemp@peter.bmc.com
|
||||
Thomas Bushnell, n/BSG: thomas@gnu.ai.mit.edu
|
||||
Torbjorn Lindgren: tl@funcom.no
|
||||
Tony Leneis: tony@plaza.ds.adp.com
|
||||
Wayne Stewart: wstewa@atl.com
|
||||
|
||||
|
||||
166
doc/Makefile.in
166
doc/Makefile.in
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.1l from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
@@ -32,20 +32,54 @@ pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
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@
|
||||
|
||||
NORMAL_INSTALL = true
|
||||
PRE_INSTALL = true
|
||||
POST_INSTALL = true
|
||||
NORMAL_UNINSTALL = true
|
||||
PRE_UNINSTALL = true
|
||||
POST_UNINSTALL = true
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DF_PROG = @DF_PROG@
|
||||
GENCAT = @GENCAT@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
MVDIR_PROG = @MVDIR_PROG@
|
||||
PACKAGE = @PACKAGE@
|
||||
PERL = @PERL@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
LN = @LN@
|
||||
RM = @RM@
|
||||
U = @U@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
l = @l@
|
||||
|
||||
info_TEXINFOS = fileutils.texi
|
||||
|
||||
@@ -62,6 +96,7 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
TEXI2DVI = texi2dvi
|
||||
TEXINFO_TEX = $(srcdir)/texinfo.tex
|
||||
INFO_DEPS = fileutils.info
|
||||
DVIS = fileutils.dvi
|
||||
TEXINFOS = fileutils.texi
|
||||
@@ -69,19 +104,16 @@ 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)
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
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
|
||||
.SUFFIXES: .dvi .info .ps .texi .texinfo
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits doc/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
@@ -89,15 +121,17 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
|
||||
|
||||
version.texi: @MAINT@stamp-vti
|
||||
cp $(srcdir)/stamp-vti $(srcdir)/version.texi
|
||||
|
||||
stamp-vti: fileutils.texi $(top_srcdir)/configure.in
|
||||
echo "@set UPDATED `cd $(srcdir) \
|
||||
@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
|
||||
@echo "@set EDITION $(VERSION)" >> vti.tmp
|
||||
@echo "@set VERSION $(VERSION)" >> vti.tmp
|
||||
@cmp -s vti.tmp $(srcdir)/stamp-vti \
|
||||
|| (echo "Updating $(srcdir)/stamp-vti"; \
|
||||
cp vti.tmp $(srcdir)/stamp-vti)
|
||||
@rm -f vti.tmp
|
||||
|
||||
mostlyclean-vti:
|
||||
rm -f vti.tmp
|
||||
@@ -116,6 +150,7 @@ fileutils.dvi: fileutils.texi version.texi
|
||||
DVIPS = dvips
|
||||
|
||||
.texi.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
@@ -123,42 +158,59 @@ DVIPS = dvips
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.texi:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS $(TEXI2DVI) $<
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
.dvi.ps:
|
||||
$(DVIPS) $< -o $@
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
$(NORMAL_INSTALL)
|
||||
@$(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; \
|
||||
d=$(srcdir); \
|
||||
for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
|
||||
if test -f $$d/$$ifile; then \
|
||||
echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done
|
||||
$(POST_INSTALL)
|
||||
@if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
|
||||
@$(POST_INSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/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; :;\
|
||||
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 \
|
||||
$(PRE_UNINSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/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
|
||||
$(NORMAL_UNINSTALL)
|
||||
for file in $(INFO_DEPS); do \
|
||||
(cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
for base in $(INFO_DEPS); do \
|
||||
@@ -170,17 +222,18 @@ dist-info: $(INFO_DEPS)
|
||||
done; \
|
||||
done
|
||||
|
||||
mostlyclean-info:
|
||||
mostlyclean-aminfo:
|
||||
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
|
||||
fileutils.pg fileutils.toc fileutils.tp fileutils.tps \
|
||||
fileutils.vr fileutils.vrs fileutils.op fileutils.tr \
|
||||
fileutils.cv
|
||||
|
||||
clean-info:
|
||||
clean-aminfo:
|
||||
|
||||
distclean-info:
|
||||
distclean-aminfo:
|
||||
|
||||
maintainer-clean-info:
|
||||
maintainer-clean-aminfo:
|
||||
for i in $(INFO_DEPS); do rm -f `eval echo $$i*`; done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
@@ -189,34 +242,39 @@ TAGS:
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = doc
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits doc/Makefile
|
||||
@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
|
||||
$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
|
||||
info: $(INFO_DEPS)
|
||||
dvi: $(DVIS)
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
$(NORMAL_INSTALL)
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-info-am
|
||||
$(NORMAL_INSTALL)
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-info
|
||||
|
||||
all: $(INFO_DEPS) Makefile
|
||||
all: Makefile $(INFO_DEPS)
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(infodir)
|
||||
|
||||
@@ -229,28 +287,28 @@ clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
rm -f Makefile $(DISTCLEANFILES)
|
||||
rm -f config.cache config.log stamp-h
|
||||
rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
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
|
||||
mostlyclean: mostlyclean-vti mostlyclean-aminfo mostlyclean-generic
|
||||
|
||||
clean: clean-vti clean-info clean-generic mostlyclean
|
||||
clean: clean-vti clean-aminfo clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-vti distclean-info distclean-generic clean
|
||||
distclean: distclean-vti distclean-aminfo distclean-generic clean
|
||||
rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-vti maintainer-clean-info \
|
||||
maintainer-clean: maintainer-clean-vti maintainer-clean-aminfo \
|
||||
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 \
|
||||
maintainer-clean-vti install-info-am uninstall-info mostlyclean-aminfo \
|
||||
distclean-aminfo clean-aminfo maintainer-clean-aminfo 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
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ midnight, 1 January 1970 UCT.
|
||||
* General date syntax:: Common rules.
|
||||
* Calendar date item:: 19 Dec 1994.
|
||||
* Time of day item:: 9:20pm.
|
||||
* Timezone item:: EST, DST, BST, UCT, AHST, ...
|
||||
* Timezone item:: EST, DST, BST, UCT, HAST, ...
|
||||
* Day of week item:: Monday and others.
|
||||
* Relative item in date strings:: next tuesday, 2 years ago.
|
||||
* Pure numbers in date strings:: 19931219, 1440.
|
||||
@@ -272,7 +272,7 @@ militaries.
|
||||
@cindex Alaska-Hawaii Time
|
||||
@cindex Central Alaska Time
|
||||
@cindex Hawaii Standard Time
|
||||
@samp{AHST} for Alaska-Hawaii Standard, @samp{CAT} for Central Alaska,
|
||||
@samp{HAST} for Hawaii-Aleutian Standard, @samp{CAT} for Central Alaska,
|
||||
@samp{HST} for Hawaii Standard and @samp{K} for militaries.
|
||||
@item +1100
|
||||
@cindex Nome Standard Time
|
||||
@@ -348,8 +348,6 @@ may be specified.
|
||||
@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.
|
||||
|
||||
21
doc/mdate-sh
21
doc/mdate-sh
@@ -1,7 +1,7 @@
|
||||
#!/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
|
||||
# Get modification time of a file or directory and pretty-print it.
|
||||
# Copyright (C) 1995, 1996, 1997 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
|
||||
@@ -14,8 +14,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# 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
|
||||
@@ -25,14 +25,15 @@ export LC_ALL
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
|
||||
# Get the extended ls output of the file.
|
||||
# Get the extended ls output of the file or directory.
|
||||
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
|
||||
if ls -L /dev/null 1>/dev/null 2>&1; then
|
||||
set - `ls -L -l $1`
|
||||
set - x`ls -L -l -d $1`
|
||||
else
|
||||
set - `ls -l $1`
|
||||
set - x`ls -l -d $1`
|
||||
fi
|
||||
# The month is at least the fourth argument.
|
||||
# (3 shifts here, the next inside the loop)
|
||||
# The month is at least the fourth argument
|
||||
# (3 shifts here, the next inside the loop).
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
|
||||
@@ -120,8 +120,7 @@ by the Foundation.
|
||||
@cindex shell utilities
|
||||
@cindex utilities for shell programming
|
||||
|
||||
This manual minimally documents version @value{VERSION} of the GNU shell
|
||||
utilities.
|
||||
This manual documents version @value{VERSION} of the GNU shell utilities.
|
||||
|
||||
@menu
|
||||
* Introduction:: Caveats, overview, and authors.
|
||||
@@ -182,8 +181,10 @@ sometimes difficult to infer. @xref{Bugs, , , gcc, GNU CC}.
|
||||
@cindex Pinard, @value{Francois}
|
||||
@cindex Berry, Karl
|
||||
@cindex Stallman, Richard
|
||||
This manual is based on the Unix man pages in the distribution, which
|
||||
were originally written by David MacKenzie and updated by Jim Meyering.
|
||||
This manual was originally derived from the Unix man pages in the
|
||||
distribution, which were written by David MacKenzie and updated by Jim
|
||||
Meyering. What you are reading now is the authoritative documentation
|
||||
for these utilities; the man pages are no longer being maintained.
|
||||
@value{Francois} Pinard did the initial conversion to Texinfo format.
|
||||
Karl Berry did the indexing, some reorganization, and editing of the results.
|
||||
Richard Stallman contributed his usual invaluable insights to the
|
||||
@@ -719,7 +720,7 @@ Exit status:
|
||||
@menu
|
||||
* Relations for expr:: | & < <= = == != >= >
|
||||
* Numeric expressions:: + - * / %
|
||||
* String expressions:: <colon> match substr index length
|
||||
* String expressions:: <colon> match substr index length quote
|
||||
* Examples of expr:: Examples.
|
||||
@end menu
|
||||
|
||||
@@ -840,9 +841,9 @@ An alternative way to do pattern matching. This is the same as
|
||||
@findex substr
|
||||
Returns the substring of @var{string} beginning at @var{position}
|
||||
with length at most @var{length}. If either @var{position} or
|
||||
@var{length} is negative or non-numeric, returns the null string.
|
||||
@var{length} is negative, zero, or non-numeric, returns the null string.
|
||||
|
||||
@item index @var{string} @var{character-class}
|
||||
@item index @var{string} @var{charset}
|
||||
@findex index
|
||||
Returns the first position in @var{string} where the first character in
|
||||
@var{charset} was found. If no character in @var{charset} is found in
|
||||
@@ -852,9 +853,20 @@ Returns the first position in @var{string} where the first character in
|
||||
@findex length
|
||||
Returns the length of @var{string}.
|
||||
|
||||
@item quote @var{token}
|
||||
@findex quote
|
||||
Interpret @var{token} as a string, even if it is a keyword like @var{match}
|
||||
or an operator like @code{/}.
|
||||
This makes it possible to test @code{expr length quote "$x"} or
|
||||
@code{expr quote "$x" : '.*/\(.\)'} and have it do the right thing even if
|
||||
the value of @var{$x} happens to be (for example) @code{/} or @code{index}.
|
||||
This operator is a GNU extension. It is disabled when
|
||||
the environment variable @var{POSIXLY_CORRECT} is set.
|
||||
|
||||
@end table
|
||||
|
||||
The keywords cannot be used as strings.
|
||||
To make @code{expr} interpret keywords as strings, you must use the
|
||||
@code{quote} operator.
|
||||
|
||||
|
||||
@node Examples of expr
|
||||
@@ -881,6 +893,8 @@ expr index abcdef cz
|
||||
@result{} 3
|
||||
expr index index a
|
||||
@error{} expr: syntax error
|
||||
expr index quote index a
|
||||
@result{} 0
|
||||
|
||||
@end example
|
||||
|
||||
@@ -2439,6 +2453,46 @@ use @samp{date --rfc}. I just did and saw this:
|
||||
Mon, 25 Mar 1996 23:34:17 -0600
|
||||
@end example
|
||||
|
||||
@item
|
||||
To convert a date string to the number of seconds since 1970-01-01 00:00:00,
|
||||
use the @samp{--date} option with the @samp{%s} format.
|
||||
That can be useful in sorting and graphing data by date.
|
||||
The command in the following example prints the number of seconds that
|
||||
elapsed between the epoch and the specified date: one second after midnight
|
||||
on 1970-01-01.
|
||||
But it is important to note that the date string is interpreted relative
|
||||
to the local time zone, UTC+2, so it is two hours and one second
|
||||
or @samp{7201} seconds after the @code{epoch}.
|
||||
|
||||
@example
|
||||
% env TZ=UTC+2 date --date='1970-01-01 00:00:01' +%s
|
||||
7201
|
||||
@end example
|
||||
|
||||
@item
|
||||
If you're sorting or graphing dated data, your raw date values may be
|
||||
represented as seconds since the epoch. But few people can look at
|
||||
the date @samp{946684800} and casually note ``Oh, that's the first second
|
||||
of the third millenium.''
|
||||
|
||||
@example
|
||||
% env TZ=UTC date --date='2000-01-01' +%s
|
||||
946684800
|
||||
@end example
|
||||
|
||||
To convert such an unwieldy number of seconds back to
|
||||
a more readable form, use a command like this:
|
||||
|
||||
@smallexample
|
||||
% env TZ=UTC date -d '1970-01-01 UTC 946684800 sec' +"%Y-%m-%d %T %z"
|
||||
2000-01-01 00:00:00 +0000
|
||||
@end smallexample
|
||||
|
||||
Note that in the few preceding examples, the timezone was set to
|
||||
a specific value through the @samp{TZ} environment variable.
|
||||
If you do not set @samp{TZ}, you must remember that @samp{--date}
|
||||
strings are converted relative to the local time zone.
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
% This automatically updates the version number based on RCS.
|
||||
\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
|
||||
\deftexinfoversion$Revision: 1.12 $
|
||||
\deftexinfoversion$Revision: 1.14 $
|
||||
\message{Loading texinfo package [Version \texinfoversion]:}
|
||||
|
||||
% If in a .fmt file, print the version number
|
||||
|
||||
@@ -108,8 +108,7 @@ by the Foundation.
|
||||
@cindex text utilities
|
||||
@cindex utilities for text handling
|
||||
|
||||
This manual minimally documents version @value{VERSION} of the GNU text
|
||||
utilities.
|
||||
This manual documents version @value{VERSION} of the GNU text utilities.
|
||||
|
||||
@menu
|
||||
* Introduction:: Caveats, overview, and authors.
|
||||
@@ -150,8 +149,10 @@ expected, what you got, and why it is wrong. Diffs are welcome, but
|
||||
please include a description of the problem as well, since this is
|
||||
sometimes difficult to infer. @xref{Bugs, , , gcc, GNU CC}.
|
||||
|
||||
This manual is based on the Unix man pages in the distribution, which
|
||||
were originally written by David MacKenzie and updated by Jim Meyering.
|
||||
This manual was originally derived from the Unix man pages in the
|
||||
distribution, which were written by David MacKenzie and updated by Jim
|
||||
Meyering. What you are reading now is the authoritative documentation
|
||||
for these utilities; the man pages are no longer being maintained.
|
||||
The original @code{fmt} man page was written by Ross Paterson.
|
||||
Fran@,{c}ois Pinard did the initial conversion to Texinfo format.
|
||||
Karl Berry did the indexing, some reorganization, and editing of the results.
|
||||
@@ -996,10 +997,10 @@ opened. (The exit status will still be nonzero, however.)
|
||||
@opindex -s
|
||||
Separate columns by a string @var{separator}. Don't use
|
||||
@samp{-s @var{separator}}, no space between flag and argument. If this
|
||||
option is omitted altogether, the default is a space, same as
|
||||
@samp{-s" "}. With @samp{-s} only, no separator is used, same as
|
||||
@samp{-s""}. @samp{-s} does not affect line truncation or column
|
||||
alignment.
|
||||
option is omitted altogether, the default is @key{TAB} together with
|
||||
@samp{-j} option and space otherwise (same as @samp{-s" "}). With
|
||||
@samp{-s} only, no separator is used (same as @samp{-s""}). @samp{-s}
|
||||
does not affect line truncation or column alignment.
|
||||
|
||||
@item -t
|
||||
@opindex -t
|
||||
@@ -1630,7 +1631,7 @@ options}.
|
||||
If a @var{file} is specified as @samp{-} or if no files are given
|
||||
@code{md5sum} computes the checksum for the standard input.
|
||||
@code{md5sum} can also determine whether a file and checksum are
|
||||
consistent. Synopsis:
|
||||
consistent. Synopses:
|
||||
|
||||
@example
|
||||
md5sum [@var{option}]@dots{} [@var{file}]@dots{}
|
||||
@@ -1704,7 +1705,7 @@ Treat all input files as text files. This is the reverse of
|
||||
@opindex -w
|
||||
@opindex --warn
|
||||
@cindex verifying MD5 checksums
|
||||
When verifying checksums, warn about improperly formated MD5 checksum lines.
|
||||
When verifying checksums, warn about improperly formatted MD5 checksum lines.
|
||||
This option is useful only if all but a few lines in the checked input
|
||||
are valid.
|
||||
|
||||
@@ -2167,6 +2168,11 @@ Columns are separated by @key{TAB}.
|
||||
The options @samp{-1}, @samp{-2}, and @samp{-3} suppress printing of
|
||||
the corresponding columns. Also see @ref{Common options}.
|
||||
|
||||
Unlike some other comparison utilities, @code{comm} has an exit
|
||||
status that does not depend on the result of the comparison.
|
||||
Upon normal completion @code{comm} produces an exit code of zero.
|
||||
If there is an error it exits with nonzero status.
|
||||
|
||||
|
||||
@node Operating on fields within a line
|
||||
@chapter Operating on fields within a line
|
||||
@@ -2453,7 +2459,7 @@ used only in @var{set1} or @var{set2}, as noted below.
|
||||
|
||||
@table @asis
|
||||
|
||||
@item Backslash escapes.
|
||||
@item Backslash escapes
|
||||
@cindex backslash escapes
|
||||
|
||||
A backslash followed by a character not listed below causes an error
|
||||
@@ -2461,19 +2467,19 @@ message.
|
||||
|
||||
@table @samp
|
||||
@item \a
|
||||
Control-G,
|
||||
Control-G.
|
||||
@item \b
|
||||
Control-H,
|
||||
Control-H.
|
||||
@item \f
|
||||
Control-L,
|
||||
Control-L.
|
||||
@item \n
|
||||
Control-J,
|
||||
Control-J.
|
||||
@item \r
|
||||
Control-M,
|
||||
Control-M.
|
||||
@item \t
|
||||
Control-I,
|
||||
Control-I.
|
||||
@item \v
|
||||
Control-K,
|
||||
Control-K.
|
||||
@item \@var{ooo}
|
||||
The character with the value given by @var{ooo}, which is 1 to 3
|
||||
octal digits,
|
||||
@@ -2481,7 +2487,7 @@ octal digits,
|
||||
A backslash.
|
||||
@end table
|
||||
|
||||
@item Ranges.
|
||||
@item Ranges
|
||||
@cindex ranges
|
||||
|
||||
The notation @samp{@var{m}-@var{n}} expands to all of the characters
|
||||
@@ -2493,7 +2499,7 @@ enclose ranges, translations specified in that format will still work as
|
||||
long as the brackets in @var{string1} correspond to identical brackets
|
||||
in @var{string2}.
|
||||
|
||||
@item Repeated characters.
|
||||
@item Repeated characters
|
||||
@cindex repeated characters
|
||||
|
||||
The notation @samp{[@var{c}*@var{n}]} in @var{set2} expands to @var{n}
|
||||
@@ -2503,7 +2509,7 @@ to as many copies of @var{c} as are needed to make @var{set2} as long as
|
||||
@var{set1}. If @var{n} begins with @samp{0}, it is interpreted in
|
||||
octal, otherwise in decimal.
|
||||
|
||||
@item Character classes.
|
||||
@item Character classes
|
||||
@cindex characters classes
|
||||
|
||||
The notation @samp{[:@var{class}:]} expands to all of the characters in
|
||||
@@ -2558,7 +2564,7 @@ Uppercase letters.
|
||||
Hexadecimal digits.
|
||||
@end table
|
||||
|
||||
@item Equivalence classes.
|
||||
@item Equivalence classes
|
||||
@cindex equivalence classes
|
||||
|
||||
The syntax @samp{[=@var{c}=]} expands to all of the characters that are
|
||||
|
||||
@@ -3,13 +3,13 @@ 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
|
||||
EXTRA_DIST = chown.c 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 \
|
||||
addext.c argmatch.c backupfile.c basename.c dirname.c filemode.c \
|
||||
full-write.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
|
||||
@@ -20,6 +20,6 @@ libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
|
||||
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
|
||||
getdate.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
|
||||
save-cwd.h xstrtol.h xstrtoul.h strverscmp.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
|
||||
162
lib/Makefile.in
162
lib/Makefile.in
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.1l from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
@@ -32,30 +32,65 @@ pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
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@
|
||||
|
||||
NORMAL_INSTALL = true
|
||||
PRE_INSTALL = true
|
||||
POST_INSTALL = true
|
||||
NORMAL_UNINSTALL = true
|
||||
PRE_UNINSTALL = true
|
||||
POST_UNINSTALL = true
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DF_PROG = @DF_PROG@
|
||||
GENCAT = @GENCAT@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
MVDIR_PROG = @MVDIR_PROG@
|
||||
PACKAGE = @PACKAGE@
|
||||
PERL = @PERL@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
LN = @LN@
|
||||
RM = @RM@
|
||||
U = @U@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
l = @l@
|
||||
|
||||
noinst_LIBRARIES = libfu.a
|
||||
|
||||
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c getgroups.c
|
||||
EXTRA_DIST = chown.c 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 \
|
||||
addext.c argmatch.c backupfile.c basename.c dirname.c filemode.c \
|
||||
full-write.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
|
||||
@@ -66,7 +101,7 @@ libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
|
||||
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
|
||||
getdate.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
|
||||
save-cwd.h xstrtol.h xstrtoul.h strverscmp.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
@@ -79,59 +114,54 @@ 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 \
|
||||
libfu_a_OBJECTS = getdate.o posixtm.o getopt.o getopt1.o addext.o \
|
||||
argmatch.o backupfile.o basename.o dirname.o filemode.o full-write.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
|
||||
YLWRAP = $(srcdir)/ylwrap
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK = $(CC) $(LDFLAGS) -o $@
|
||||
LINK = $(CC) $(CFLAGS) $(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 strftime.c strndup.c strstr.c strtol.c strtoul.c \
|
||||
ylwrap
|
||||
DIST_COMMON = Makefile.am Makefile.in alloca.c chown.c error.c error.h \
|
||||
euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c getdate.c \
|
||||
getgroups.c getline.c group-member.c 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 \
|
||||
strftime.c strndup.c strstr.c strtol.c strtoul.c strverscmp.c ylwrap
|
||||
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \
|
||||
$(TEXINFOS) $(MANS) $(EXTRA_DIST)
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(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 \
|
||||
GZIP = --best
|
||||
DEP_FILES = .deps/addext.P .deps/alloca.P .deps/argmatch.P \
|
||||
.deps/backupfile.P .deps/basename.P .deps/chown.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/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/strftime.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
|
||||
.deps/strverscmp.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
|
||||
.SUFFIXES: .c .h .o .y
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits lib/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
@@ -159,14 +189,15 @@ distclean-compile:
|
||||
rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
$(libfu_a_OBJECTS): ../config.h
|
||||
|
||||
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) $<
|
||||
$(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS)
|
||||
.y.h:
|
||||
$(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
@@ -176,11 +207,8 @@ ID: $(HEADERS) $(SOURCES)
|
||||
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
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
@@ -194,7 +222,12 @@ maintainer-clean-tags:
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = lib
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits lib/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
@@ -204,13 +237,12 @@ distdir: $(DISTFILES)
|
||||
|
||||
MKDEP = gcc -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
-include .deps/.P
|
||||
.deps/.P:
|
||||
test -d .deps || mkdir .deps
|
||||
.deps/.P: $(BUILT_SOURCES)
|
||||
echo > $@
|
||||
|
||||
-include $(DEP_FILES)
|
||||
$(DEP_FILES): .deps/.P
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
@@ -221,31 +253,33 @@ distclean-depend:
|
||||
maintainer-clean-depend:
|
||||
rm -rf .deps
|
||||
|
||||
.deps/%.P: $(srcdir)/%.c
|
||||
.deps/%.P: %.c
|
||||
@echo "Computing dependencies for $<..."
|
||||
@o='o'; \
|
||||
test -n "$o" && o='$$o'; \
|
||||
$(MKDEP) $< | sed "s/^\(.*\)\.o:/\1.$$o \1.l$$o:/" > $@
|
||||
@o='o'; \
|
||||
test -n "$o" && o='$$o'; \
|
||||
$(MKDEP) $< >$@.tmp \
|
||||
&& sed "s,^\(.*\)\.o:,\1.$$o \1.l$$o $@:," < $@.tmp > $@ \
|
||||
&& rm -f $@.tmp
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
$(NORMAL_INSTALL)
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
$(NORMAL_INSTALL)
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall:
|
||||
|
||||
all: $(LIBRARIES) $(BUILT_SOURCES) $(HEADERS) Makefile
|
||||
all: Makefile $(LIBRARIES) $(HEADERS)
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
@@ -257,7 +291,7 @@ clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
rm -f Makefile $(DISTCLEANFILES)
|
||||
rm -f config.cache config.log stamp-h
|
||||
rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
|
||||
106
lib/addext.c
Normal file
106
lib/addext.c
Normal file
@@ -0,0 +1,106 @@
|
||||
/* addext.c -- add an extension to a file name
|
||||
Copyright (C) 1990, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu> and Paul Eggert */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DOS_FILE_NAMES
|
||||
#define HAVE_DOS_FILE_NAMES 0
|
||||
#endif
|
||||
#ifndef HAVE_LONG_FILE_NAMES
|
||||
#define HAVE_LONG_FILE_NAMES 0
|
||||
#endif
|
||||
|
||||
#include <backupfile.h>
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
#ifndef _POSIX_NAME_MAX
|
||||
#define _POSIX_NAME_MAX 14
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Append to FILENAME the extension EXT, unless the result would be too long,
|
||||
in which case just append the character E. */
|
||||
|
||||
void
|
||||
addext (filename, ext, e)
|
||||
char *filename;
|
||||
char const *ext;
|
||||
int e;
|
||||
{
|
||||
char *s = base_name (filename);
|
||||
size_t slen = strlen (s), extlen = strlen (ext);
|
||||
long slen_max = -1;
|
||||
|
||||
#if HAVE_PATHCONF && defined _PC_NAME_MAX
|
||||
if (slen + extlen <= _POSIX_NAME_MAX && ! HAVE_DOS_FILE_NAMES)
|
||||
/* The file name is so short there's no need to call pathconf. */
|
||||
slen_max = _POSIX_NAME_MAX;
|
||||
else if (s == filename)
|
||||
slen_max = pathconf (".", _PC_NAME_MAX);
|
||||
else
|
||||
{
|
||||
char c = *s;
|
||||
*s = 0;
|
||||
slen_max = pathconf (filename, _PC_NAME_MAX);
|
||||
*s = c;
|
||||
}
|
||||
#endif
|
||||
if (slen_max < 0)
|
||||
slen_max = HAVE_LONG_FILE_NAMES ? 255 : 14;
|
||||
|
||||
if (HAVE_DOS_FILE_NAMES && slen_max <= 12)
|
||||
{
|
||||
/* Live within DOS's 8.3 limit. */
|
||||
char *dot = strchr (s, '.');
|
||||
if (dot)
|
||||
{
|
||||
slen -= dot + 1 - s;
|
||||
s = dot + 1;
|
||||
slen_max = 3;
|
||||
}
|
||||
else
|
||||
slen_max = 8;
|
||||
extlen = 9; /* Don't use EXT. */
|
||||
}
|
||||
|
||||
if (slen + extlen <= slen_max)
|
||||
strcpy (s + slen, ext);
|
||||
else
|
||||
{
|
||||
if (slen_max <= slen)
|
||||
slen = slen_max - 1;
|
||||
s[slen] = e;
|
||||
s[slen + 1] = 0;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* argmatch.c -- find a match for a string in an array
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1997 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,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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
along with this program; see the file COPYING.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@ai.mit.edu> */
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <argmatch.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef STDC_HEADERS
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
extern char *program_name;
|
||||
|
||||
/* If ARG is an unambiguous match for an element of the
|
||||
null-terminated array OPTLIST, return the index in OPTLIST
|
||||
of the matched element, else -1 if it does not match any element
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
#ifndef ARGMATCH_H
|
||||
#define ARGMATCH_H 1
|
||||
/* argmatch.h -- declarations for matching arguments against option lists */
|
||||
|
||||
#ifndef __P
|
||||
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
# define __P(args) args
|
||||
# else
|
||||
# define __P(args) ()
|
||||
# endif /* GCC. */
|
||||
#endif /* Not __P. */
|
||||
#if defined __STDC__ || __GNUC__
|
||||
# define __ARGMATCH_P(args) args
|
||||
#else
|
||||
# define __ARGMATCH_P(args) ()
|
||||
#endif
|
||||
|
||||
int
|
||||
argmatch __P ((const char *arg, const char *const *optlist));
|
||||
int argmatch __ARGMATCH_P ((const char *, const char * const *));
|
||||
void invalid_arg __ARGMATCH_P ((const char *, const char *, int));
|
||||
|
||||
void
|
||||
invalid_arg __P ((const char *kind, const char *value, int problem));
|
||||
|
||||
#endif /* ARGMATCH_H */
|
||||
extern char *program_name;
|
||||
|
||||
215
lib/backupfile.c
215
lib/backupfile.c
@@ -1,5 +1,5 @@
|
||||
/* backupfile.c -- make Emacs style backup file names
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990,1991,1992,1993,1995,1997 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,84 +12,89 @@
|
||||
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. */
|
||||
along with this program; see the file COPYING.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* David MacKenzie <djm@gnu.ai.mit.edu>.
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>.
|
||||
Some algorithms adapted from GNU Emacs. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <argmatch.h>
|
||||
#include <backupfile.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include "backupfile.h"
|
||||
#ifdef HAVE_STRING_H
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#if HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
# define NLENGTH(direct) (strlen((direct)->d_name))
|
||||
#else /* not HAVE_DIRENT_H */
|
||||
# define NLENGTH(direct) strlen ((direct)->d_name)
|
||||
#else
|
||||
# define dirent direct
|
||||
# define NLENGTH(direct) ((direct)->d_namlen)
|
||||
# ifdef HAVE_SYS_NDIR_H
|
||||
# define NLENGTH(direct) ((size_t) (direct)->d_namlen)
|
||||
# if HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif /* HAVE_SYS_NDIR_H */
|
||||
# ifdef HAVE_SYS_DIR_H
|
||||
# endif
|
||||
# if HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif /* HAVE_SYS_DIR_H */
|
||||
# ifdef HAVE_NDIR_H
|
||||
# endif
|
||||
# if HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif /* HAVE_NDIR_H */
|
||||
#endif /* HAVE_DIRENT_H */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef CLOSEDIR_VOID
|
||||
#if CLOSEDIR_VOID
|
||||
/* Fake a return value. */
|
||||
# define CLOSEDIR(d) (closedir (d), 0)
|
||||
#else
|
||||
# define CLOSEDIR(d) closedir (d)
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
char *malloc ();
|
||||
#endif
|
||||
|
||||
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
|
||||
# define IN_CTYPE_DOMAIN(c) 1
|
||||
#if HAVE_DIRENT_H || HAVE_NDIR_H || HAVE_SYS_DIR_H || HAVE_SYS_NDIR_H
|
||||
# define HAVE_DIR 1
|
||||
#else
|
||||
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||
# define HAVE_DIR 0
|
||||
#endif
|
||||
|
||||
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
||||
#if HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
#ifndef CHAR_BIT
|
||||
#define CHAR_BIT 8
|
||||
#endif
|
||||
/* Upper bound on the string length of an integer converted to string.
|
||||
302 / 1000 is ceil (log10 (2.0)). Subtract 1 for the sign bit;
|
||||
add 1 for integer division truncation; add 1 more for a minus sign. */
|
||||
#define INT_STRLEN_BOUND(t) ((sizeof (t) * CHAR_BIT - 1) * 302 / 1000 + 2)
|
||||
|
||||
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
|
||||
/* ISDIGIT differs from isdigit, 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
|
||||
only '0' through '9' are digits. Prefer ISDIGIT to isdigit 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
|
||||
|
||||
#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
|
||||
#else
|
||||
#if D_INO_IN_DIRENT
|
||||
# define REAL_DIR_ENTRY(dp) ((dp)->d_ino != 0)
|
||||
#else
|
||||
# define REAL_DIR_ENTRY(dp) 1
|
||||
#endif
|
||||
|
||||
/* Which type of backup file names are generated. */
|
||||
@@ -97,15 +102,10 @@ enum backup_type backup_type = none;
|
||||
|
||||
/* The extension added to file names to produce a simple (as opposed
|
||||
to numbered) backup file name. */
|
||||
char *simple_backup_suffix = "~";
|
||||
const char *simple_backup_suffix = ".orig";
|
||||
|
||||
char *basename ();
|
||||
char *dirname ();
|
||||
static char *concat ();
|
||||
char *find_backup_file_name ();
|
||||
static char *make_version_name ();
|
||||
static int max_backup_version ();
|
||||
static int version_number ();
|
||||
static int max_backup_version __BACKUPFILE_P ((const char *, const char *));
|
||||
static int version_number __BACKUPFILE_P ((const char *, const char *, size_t));
|
||||
|
||||
/* Return the name of the new backup file for file FILE,
|
||||
allocated with malloc. Return 0 if out of memory.
|
||||
@@ -116,33 +116,51 @@ char *
|
||||
find_backup_file_name (file)
|
||||
const char *file;
|
||||
{
|
||||
char *dir;
|
||||
char *base_versions;
|
||||
int highest_backup;
|
||||
size_t backup_suffix_size_max;
|
||||
size_t file_len = strlen (file);
|
||||
size_t numbered_suffix_size_max = INT_STRLEN_BOUND (int) + 4;
|
||||
char *s;
|
||||
const char *suffix = simple_backup_suffix;
|
||||
|
||||
if (backup_type == simple)
|
||||
return concat (file, simple_backup_suffix);
|
||||
base_versions = concat (basename (file), ".~");
|
||||
if (base_versions == 0)
|
||||
return 0;
|
||||
dir = dirname (file);
|
||||
if (dir == 0)
|
||||
/* Allow room for simple or `.~N~' backups. */
|
||||
backup_suffix_size_max = strlen (simple_backup_suffix) + 1;
|
||||
if (HAVE_DIR && backup_suffix_size_max < numbered_suffix_size_max)
|
||||
backup_suffix_size_max = numbered_suffix_size_max;
|
||||
|
||||
s = malloc (file_len + backup_suffix_size_max + numbered_suffix_size_max);
|
||||
if (s)
|
||||
{
|
||||
free (base_versions);
|
||||
return 0;
|
||||
strcpy (s, file);
|
||||
|
||||
#if HAVE_DIR
|
||||
if (backup_type != simple)
|
||||
{
|
||||
int highest_backup;
|
||||
size_t dir_len = base_name (s) - s;
|
||||
|
||||
strcpy (s + dir_len, ".");
|
||||
highest_backup = max_backup_version (file + dir_len, s);
|
||||
if (! (backup_type == numbered_existing && highest_backup == 0))
|
||||
{
|
||||
char *numbered_suffix = s + (file_len + backup_suffix_size_max);
|
||||
sprintf (numbered_suffix, ".~%d~", highest_backup + 1);
|
||||
suffix = numbered_suffix;
|
||||
}
|
||||
strcpy (s, file);
|
||||
}
|
||||
#endif /* HAVE_DIR */
|
||||
|
||||
addext (s, suffix, '~');
|
||||
}
|
||||
highest_backup = max_backup_version (base_versions, dir);
|
||||
free (base_versions);
|
||||
free (dir);
|
||||
if (backup_type == numbered_existing && highest_backup == 0)
|
||||
return concat (file, simple_backup_suffix);
|
||||
return make_version_name (file, highest_backup + 1);
|
||||
return s;
|
||||
}
|
||||
|
||||
#if HAVE_DIR
|
||||
|
||||
/* Return the number of the highest-numbered backup file for file
|
||||
FILE in directory DIR. If there are no numbered backups
|
||||
of FILE in DIR, or an error occurs reading DIR, return 0.
|
||||
FILE should already have ".~" appended to it. */
|
||||
*/
|
||||
|
||||
static int
|
||||
max_backup_version (file, dir)
|
||||
@@ -164,7 +182,7 @@ max_backup_version (file, dir)
|
||||
|
||||
while ((dp = readdir (dirp)) != 0)
|
||||
{
|
||||
if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) <= file_name_length)
|
||||
if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) < file_name_length + 4)
|
||||
continue;
|
||||
|
||||
this_version = version_number (file, dp->d_name, file_name_length);
|
||||
@@ -176,62 +194,59 @@ max_backup_version (file, dir)
|
||||
return highest_version;
|
||||
}
|
||||
|
||||
/* Return a string, allocated with malloc, containing
|
||||
"FILE.~VERSION~". Return 0 if out of memory. */
|
||||
|
||||
static char *
|
||||
make_version_name (file, version)
|
||||
const char *file;
|
||||
int version;
|
||||
{
|
||||
char *backup_name;
|
||||
|
||||
backup_name = malloc (strlen (file) + 16);
|
||||
if (backup_name == 0)
|
||||
return 0;
|
||||
sprintf (backup_name, "%s.~%d~", file, version);
|
||||
return backup_name;
|
||||
}
|
||||
|
||||
/* If BACKUP is a numbered backup of BASE, return its version number;
|
||||
otherwise return 0. BASE_LENGTH is the length of BASE.
|
||||
BASE should already have ".~" appended to it. */
|
||||
*/
|
||||
|
||||
static int
|
||||
version_number (base, backup, base_length)
|
||||
const char *base;
|
||||
const char *backup;
|
||||
int base_length;
|
||||
size_t base_length;
|
||||
{
|
||||
int version;
|
||||
const char *p;
|
||||
|
||||
version = 0;
|
||||
if (!strncmp (base, backup, base_length) && ISDIGIT (backup[base_length]))
|
||||
if (strncmp (base, backup, base_length) == 0
|
||||
&& backup[base_length] == '.'
|
||||
&& backup[base_length + 1] == '~')
|
||||
{
|
||||
for (p = &backup[base_length]; ISDIGIT (*p); ++p)
|
||||
for (p = &backup[base_length + 2]; ISDIGIT (*p); ++p)
|
||||
version = version * 10 + *p - '0';
|
||||
if (p[0] != '~' || p[1])
|
||||
version = 0;
|
||||
}
|
||||
return version;
|
||||
}
|
||||
#endif /* HAVE_DIR */
|
||||
|
||||
/* Return the newly-allocated concatenation of STR1 and STR2.
|
||||
If out of memory, return 0. */
|
||||
|
||||
static char *
|
||||
concat (str1, str2)
|
||||
const char *str1;
|
||||
const char *str2;
|
||||
static const char * const backup_args[] =
|
||||
{
|
||||
char *newstr;
|
||||
int str1_length = strlen (str1);
|
||||
"never", "simple", "nil", "existing", "t", "numbered", 0
|
||||
};
|
||||
|
||||
newstr = malloc (str1_length + strlen (str2) + 1);
|
||||
if (newstr == 0)
|
||||
return 0;
|
||||
strcpy (newstr, str1);
|
||||
strcpy (newstr + str1_length, str2);
|
||||
return newstr;
|
||||
static const enum backup_type backup_types[] =
|
||||
{
|
||||
simple, simple, numbered_existing, numbered_existing, numbered, numbered
|
||||
};
|
||||
|
||||
/* Return the type of backup indicated by VERSION.
|
||||
Unique abbreviations are accepted. */
|
||||
|
||||
enum backup_type
|
||||
get_version (version)
|
||||
const char *version;
|
||||
{
|
||||
int i;
|
||||
|
||||
if (version == 0 || *version == 0)
|
||||
return numbered_existing;
|
||||
i = argmatch (version, backup_args);
|
||||
if (i < 0)
|
||||
{
|
||||
invalid_arg ("version control type", version, i);
|
||||
exit (2);
|
||||
}
|
||||
return backup_types[i];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* backupfile.h -- declarations for making Emacs style backup file names
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1991, 1992, 1997 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,8 +12,9 @@
|
||||
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. */
|
||||
along with this program; see the file COPYING.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* When to make backup files. */
|
||||
enum backup_type
|
||||
@@ -33,10 +34,17 @@ enum backup_type
|
||||
};
|
||||
|
||||
extern enum backup_type backup_type;
|
||||
extern char *simple_backup_suffix;
|
||||
extern char const *simple_backup_suffix;
|
||||
|
||||
#ifdef __STDC__
|
||||
char *find_backup_file_name (const char *file);
|
||||
#else
|
||||
char *find_backup_file_name ();
|
||||
#ifndef __BACKUPFILE_P
|
||||
# if defined __STDC__ || __GNUC__
|
||||
# define __BACKUPFILE_P(args) args
|
||||
# else
|
||||
# define __BACKUPFILE_P(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
char *base_name __BACKUPFILE_P ((char const *));
|
||||
char *find_backup_file_name __BACKUPFILE_P ((char const *));
|
||||
enum backup_type get_version __BACKUPFILE_P ((char const *));
|
||||
void addext __BACKUPFILE_P ((char *, char const *, int));
|
||||
|
||||
@@ -1,38 +1,30 @@
|
||||
/* basename.c -- return the last element in a path
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
/* basename.c -- return the last element in a path */
|
||||
|
||||
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
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Return NAME with any leading path stripped off.
|
||||
Don't use strrchr/rindex. */
|
||||
#ifndef FILESYSTEM_PREFIX_LEN
|
||||
# define FILESYSTEM_PREFIX_LEN(f) 0
|
||||
#endif
|
||||
|
||||
#ifndef ISSLASH
|
||||
# define ISSLASH(c) ((c) == '/')
|
||||
#endif
|
||||
|
||||
/* In general, we can't use the builtin `basename' function if available,
|
||||
since it has different meanings in different environments.
|
||||
In some environments the builtin `basename' modifies its argument. */
|
||||
|
||||
char *
|
||||
basename (name)
|
||||
const char *name;
|
||||
base_name (name)
|
||||
char const *name;
|
||||
{
|
||||
const char *base = name;
|
||||
char const *base = name += FILESYSTEM_PREFIX_LEN (name);
|
||||
|
||||
for (; *name; name++)
|
||||
if (ISSLASH (*name))
|
||||
base = name + 1;
|
||||
|
||||
while (*name)
|
||||
{
|
||||
if (*name == '/')
|
||||
base = name + 1;
|
||||
++name;
|
||||
}
|
||||
return (char *) base;
|
||||
}
|
||||
|
||||
53
lib/chown.c
Normal file
53
lib/chown.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/* provide consistent interface to chown for systems that don't interpret
|
||||
an ID of -1 as meaning `don't change the corresponding ID'.
|
||||
Copyright (C) 1997 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 <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* FIXME: describe. */
|
||||
|
||||
int
|
||||
chown (file, gid, uid)
|
||||
const char *file;
|
||||
gid_t git;
|
||||
uid_t uit;
|
||||
{
|
||||
if (gid == (gid_t) -1 || uid == (uid_t) -1)
|
||||
{
|
||||
struct stat file_stats;
|
||||
|
||||
/* Stat file to get id(s) that should remain unchanged. */
|
||||
if (stat (file, &file_stats))
|
||||
return 1;
|
||||
|
||||
if (gid == (gid_t) -1)
|
||||
gid = file_stats.st_gid;
|
||||
|
||||
if (uid == (uid_t) -1)
|
||||
uid = file_stats.st_uid;
|
||||
}
|
||||
|
||||
#undef chown
|
||||
|
||||
return chown (file, gid, uid);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ unsigned int error_message_count;
|
||||
# define program_name program_invocation_name
|
||||
# include <errno.h>
|
||||
|
||||
#else /* not _LIBC */
|
||||
#else /* not _LIBC */
|
||||
|
||||
/* The calling program should define program_name and set it to the
|
||||
name of the executing program. */
|
||||
@@ -92,6 +92,7 @@ private_strerror (errnum)
|
||||
}
|
||||
# define strerror private_strerror
|
||||
# endif /* HAVE_STRERROR */
|
||||
|
||||
#endif /* not _LIBC */
|
||||
|
||||
/* Print the program name and error message MESSAGE, which is a printf-style
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Convert file size to number of blocks on System V-like machines.
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -25,6 +25,10 @@
|
||||
# include <sys/types.h>
|
||||
# include <sys/param.h>
|
||||
|
||||
# if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
|
||||
# ifndef NINDIR
|
||||
/* Some SysV's, like Irix, seem to lack these. Hope they're correct. */
|
||||
/* Size of a indirect block, in bytes. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1992, 1993, 1997 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.
|
||||
@@ -33,18 +33,6 @@
|
||||
|
||||
#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
|
||||
@@ -60,7 +48,7 @@ fnmatch (pattern, string, flags)
|
||||
register const char *p = pattern, *n = string;
|
||||
register char c;
|
||||
|
||||
/* Note that this evalutes C many times. */
|
||||
/* Note that this evaluates C many times. */
|
||||
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
|
||||
|
||||
while ((c = *p++) != '\0')
|
||||
@@ -208,5 +196,3 @@ fnmatch (pattern, string, flags)
|
||||
|
||||
# undef FOLD
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* full-write.c -- an interface to write that retries after interrupts
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1994, 1997 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
|
||||
@@ -48,6 +48,10 @@ full_write (desc, ptr, len)
|
||||
while (len > 0)
|
||||
{
|
||||
int written = write (desc, ptr, len);
|
||||
/* FIXME: write on my slackware Linux 1.2.13 returns zero when
|
||||
I try to write more data than there is room on a floppy disk.
|
||||
This puts dd into an infinite loop. Reproduce with
|
||||
dd if=/dev/zero of=/dev/fd0. */
|
||||
if (written < 0)
|
||||
{
|
||||
#ifdef EINTR
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
** Originally written by Steven M. Bellovin <smb@research.att.com> while
|
||||
** at the University of North Carolina at Chapel Hill. Later tweaked by
|
||||
** a couple of people on Usenet. Completely overhauled by Rich $alz
|
||||
** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
|
||||
** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
|
||||
**
|
||||
** This grammar has 13 shift/reduce conflicts.
|
||||
**
|
||||
@@ -347,7 +347,7 @@ relunit : tUNUMBER tYEAR_UNIT {
|
||||
yyRelYear += $1 * $2;
|
||||
}
|
||||
| tYEAR_UNIT {
|
||||
yyRelYear++;
|
||||
yyRelYear += $1;
|
||||
}
|
||||
| tUNUMBER tMONTH_UNIT {
|
||||
yyRelMonth += $1 * $2;
|
||||
@@ -356,7 +356,7 @@ relunit : tUNUMBER tYEAR_UNIT {
|
||||
yyRelMonth += $1 * $2;
|
||||
}
|
||||
| tMONTH_UNIT {
|
||||
yyRelMonth++;
|
||||
yyRelMonth += $1;
|
||||
}
|
||||
| tUNUMBER tDAY_UNIT {
|
||||
yyRelDay += $1 * $2;
|
||||
@@ -365,7 +365,7 @@ relunit : tUNUMBER tYEAR_UNIT {
|
||||
yyRelDay += $1 * $2;
|
||||
}
|
||||
| tDAY_UNIT {
|
||||
yyRelDay++;
|
||||
yyRelDay += $1;
|
||||
}
|
||||
| tUNUMBER tHOUR_UNIT {
|
||||
yyRelHour += $1 * $2;
|
||||
@@ -374,7 +374,7 @@ relunit : tUNUMBER tYEAR_UNIT {
|
||||
yyRelHour += $1 * $2;
|
||||
}
|
||||
| tHOUR_UNIT {
|
||||
yyRelHour++;
|
||||
yyRelHour += $1;
|
||||
}
|
||||
| tUNUMBER tMINUTE_UNIT {
|
||||
yyRelMinutes += $1 * $2;
|
||||
@@ -383,7 +383,7 @@ relunit : tUNUMBER tYEAR_UNIT {
|
||||
yyRelMinutes += $1 * $2;
|
||||
}
|
||||
| tMINUTE_UNIT {
|
||||
yyRelMinutes++;
|
||||
yyRelMinutes += $1;
|
||||
}
|
||||
| tUNUMBER tSEC_UNIT {
|
||||
yyRelSeconds += $1 * $2;
|
||||
@@ -392,7 +392,7 @@ relunit : tUNUMBER tYEAR_UNIT {
|
||||
yyRelSeconds += $1 * $2;
|
||||
}
|
||||
| tSEC_UNIT {
|
||||
yyRelSeconds++;
|
||||
yyRelSeconds += $1;
|
||||
}
|
||||
;
|
||||
|
||||
@@ -493,7 +493,7 @@ static TABLE const OtherTable[] = {
|
||||
{ "now", tMINUTE_UNIT, 0 },
|
||||
{ "last", tUNUMBER, -1 },
|
||||
{ "this", tMINUTE_UNIT, 0 },
|
||||
{ "next", tUNUMBER, 2 },
|
||||
{ "next", tUNUMBER, 1 },
|
||||
{ "first", tUNUMBER, 1 },
|
||||
/* { "second", tUNUMBER, 2 }, */
|
||||
{ "third", tUNUMBER, 3 },
|
||||
|
||||
123
lib/getopt.c
123
lib/getopt.c
@@ -4,25 +4,27 @@
|
||||
before changing it!
|
||||
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97
|
||||
Free Software Foundation, Inc.
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
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., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, 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. */
|
||||
|
||||
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
|
||||
Ditto for AIX 3.2 and <stdlib.h>. */
|
||||
@@ -253,26 +255,41 @@ 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;
|
||||
/* Defined in getopt_init.c */
|
||||
extern char *__getopt_nonoption_flags;
|
||||
|
||||
static int nonoption_flags_max_len;
|
||||
static int nonoption_flags_len;
|
||||
|
||||
static int original_argc;
|
||||
static char *const *original_argv;
|
||||
|
||||
extern pid_t __libc_pid;
|
||||
|
||||
/* Make sure the environment variable bash 2.0 puts in the environment
|
||||
is valid for the getopt call we must make sure that the ARGV passed
|
||||
to getopt is that one passed to the process. */
|
||||
static void store_args (int argc, char *const *argv) __attribute__ ((unused));
|
||||
static void
|
||||
store_args (int argc, char *const *argv)
|
||||
__attribute__ ((unused))
|
||||
store_args_and_env (int argc, char *const *argv)
|
||||
{
|
||||
/* XXX This is no good solution. We should rather copy the args so
|
||||
that we can compare them later. But we must not use malloc(3). */
|
||||
original_argc = argc;
|
||||
original_argv = argv;
|
||||
}
|
||||
text_set_element (__libc_subinit, store_args);
|
||||
#endif
|
||||
text_set_element (__libc_subinit, store_args_and_env);
|
||||
|
||||
# define SWAP_FLAGS(ch1, ch2) \
|
||||
if (nonoption_flags_len > 0) \
|
||||
{ \
|
||||
char __tmp = __getopt_nonoption_flags[ch1]; \
|
||||
__getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
|
||||
__getopt_nonoption_flags[ch2] = __tmp; \
|
||||
}
|
||||
#else /* !_LIBC */
|
||||
# define SWAP_FLAGS(ch1, ch2)
|
||||
#endif /* _LIBC */
|
||||
|
||||
/* Exchange two adjacent subsequences of ARGV.
|
||||
One subsequence is elements [first_nonopt,last_nonopt)
|
||||
@@ -301,6 +318,28 @@ exchange (argv)
|
||||
It leaves the longer segment in the right place overall,
|
||||
but it consists of two parts that need to be swapped next. */
|
||||
|
||||
#ifdef _LIBC
|
||||
/* First make sure the handling of the `__getopt_nonoption_flags'
|
||||
string can work normally. Our top argument must be in the range
|
||||
of the string. */
|
||||
if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
|
||||
{
|
||||
/* We must extend the array. The user plays games with us and
|
||||
presents new arguments. */
|
||||
char *new_str = malloc (top + 1);
|
||||
if (new_str == NULL)
|
||||
nonoption_flags_len = nonoption_flags_max_len = 0;
|
||||
else
|
||||
{
|
||||
memcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len);
|
||||
memset (&new_str[nonoption_flags_max_len], '\0',
|
||||
top + 1 - nonoption_flags_max_len);
|
||||
nonoption_flags_max_len = top + 1;
|
||||
__getopt_nonoption_flags = new_str;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (top > middle && middle > bottom)
|
||||
{
|
||||
if (top - middle > middle - bottom)
|
||||
@@ -315,6 +354,7 @@ exchange (argv)
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[top - (middle - bottom) + i];
|
||||
argv[top - (middle - bottom) + i] = tem;
|
||||
SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
|
||||
}
|
||||
/* Exclude the moved bottom segment from further swapping. */
|
||||
top -= len;
|
||||
@@ -331,6 +371,7 @@ exchange (argv)
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[middle + i];
|
||||
argv[middle + i] = tem;
|
||||
SWAP_FLAGS (bottom + i, middle + i);
|
||||
}
|
||||
/* Exclude the moved top segment from further swapping. */
|
||||
bottom += len;
|
||||
@@ -358,7 +399,7 @@ _getopt_initialize (argc, argv, optstring)
|
||||
is the program name); the sequence of previously skipped
|
||||
non-option ARGV-elements is empty. */
|
||||
|
||||
first_nonopt = last_nonopt = optind = 1;
|
||||
first_nonopt = last_nonopt = optind;
|
||||
|
||||
nextchar = NULL;
|
||||
|
||||
@@ -385,17 +426,30 @@ _getopt_initialize (argc, argv, optstring)
|
||||
if (posixly_correct == NULL
|
||||
&& argc == original_argc && argv == original_argv)
|
||||
{
|
||||
/* 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);
|
||||
if (nonoption_flags_max_len == 0)
|
||||
{
|
||||
if (__getopt_nonoption_flags == NULL
|
||||
|| __getopt_nonoption_flags[0] == '\0')
|
||||
nonoption_flags_max_len = -1;
|
||||
else
|
||||
{
|
||||
const char *orig_str = __getopt_nonoption_flags;
|
||||
int len = nonoption_flags_max_len = strlen (orig_str);
|
||||
if (nonoption_flags_max_len < argc)
|
||||
nonoption_flags_max_len = argc;
|
||||
__getopt_nonoption_flags =
|
||||
(char *) malloc (nonoption_flags_max_len);
|
||||
if (__getopt_nonoption_flags == NULL)
|
||||
nonoption_flags_max_len = -1;
|
||||
else
|
||||
{
|
||||
memcpy (__getopt_nonoption_flags, orig_str, len);
|
||||
memset (&__getopt_nonoption_flags[len], '\0',
|
||||
nonoption_flags_max_len - len);
|
||||
}
|
||||
}
|
||||
}
|
||||
nonoption_flags_len = nonoption_flags_max_len;
|
||||
}
|
||||
else
|
||||
nonoption_flags_len = 0;
|
||||
@@ -471,10 +525,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
{
|
||||
optarg = NULL;
|
||||
|
||||
if (!__getopt_initialized || optind == 0)
|
||||
if (optind == 0 || !__getopt_initialized)
|
||||
{
|
||||
if (optind == 0)
|
||||
optind = 1; /* Don't scan ARGV[0], the program name. */
|
||||
optstring = _getopt_initialize (argc, argv, optstring);
|
||||
optind = 1; /* Don't scan ARGV[0], the program name. */
|
||||
__getopt_initialized = 1;
|
||||
}
|
||||
|
||||
@@ -485,7 +540,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
#ifdef _LIBC
|
||||
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|
||||
|| (optind < nonoption_flags_len \
|
||||
&& nonoption_flags[optind] == '1'))
|
||||
&& __getopt_nonoption_flags[optind] == '1'))
|
||||
#else
|
||||
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
|
||||
#endif
|
||||
|
||||
28
lib/getopt.h
28
lib/getopt.h
@@ -1,23 +1,25 @@
|
||||
/* Declarations for getopt.
|
||||
Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
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., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, 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. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
#define _GETOPT_H 1
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
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., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, 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. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* idcache.c -- map user and group IDs, cached for speed
|
||||
Copyright (C) 1985, 1988, 1989, 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1985, 1988, 1989, 1990, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,8 +15,8 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -25,14 +25,15 @@
|
||||
#include <grp.h>
|
||||
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
#include <string.h>
|
||||
# include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef _POSIX_VERSION
|
||||
struct passwd *getpwuid ();
|
||||
struct passwd *getpwnam ();
|
||||
@@ -56,11 +57,14 @@ struct userid
|
||||
|
||||
static struct userid *user_alist;
|
||||
|
||||
#ifdef NOT_USED
|
||||
/* The members of this list have names not in the local passwd file. */
|
||||
static struct userid *nouser_alist;
|
||||
#endif /* NOT_USED */
|
||||
|
||||
/* Translate UID to a login name or a stringified number,
|
||||
with cache. */
|
||||
/* Translate UID to a login name, with cache.
|
||||
If UID cannot be resolved, return NULL.
|
||||
Cache lookup failures, too. */
|
||||
|
||||
char *
|
||||
getuser (uid)
|
||||
@@ -68,7 +72,6 @@ getuser (uid)
|
||||
{
|
||||
register struct userid *tail;
|
||||
struct passwd *pwent;
|
||||
char usernum_string[20];
|
||||
|
||||
for (tail = user_alist; tail; tail = tail->next)
|
||||
if (tail->id.u == uid)
|
||||
@@ -77,13 +80,7 @@ getuser (uid)
|
||||
pwent = getpwuid (uid);
|
||||
tail = (struct userid *) xmalloc (sizeof (struct userid));
|
||||
tail->id.u = uid;
|
||||
if (pwent == 0)
|
||||
{
|
||||
sprintf (usernum_string, "%u", (unsigned) uid);
|
||||
tail->name = xstrdup (usernum_string);
|
||||
}
|
||||
else
|
||||
tail->name = xstrdup (pwent->pw_name);
|
||||
tail->name = (pwent ? xstrdup (pwent->pw_name) : NULL);
|
||||
|
||||
/* Add to the head of the list, so most recently used is first. */
|
||||
tail->next = user_alist;
|
||||
@@ -91,6 +88,8 @@ getuser (uid)
|
||||
return tail->name;
|
||||
}
|
||||
|
||||
#ifdef NOT_USED
|
||||
|
||||
/* Translate USER to a UID, with cache.
|
||||
Return NULL if there is no such user.
|
||||
(We also cache which user names have no passwd entry,
|
||||
@@ -98,7 +97,7 @@ getuser (uid)
|
||||
|
||||
uid_t *
|
||||
getuidbyname (user)
|
||||
char *user;
|
||||
const char *user;
|
||||
{
|
||||
register struct userid *tail;
|
||||
struct passwd *pwent;
|
||||
@@ -132,6 +131,8 @@ getuidbyname (user)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* NOT_USED */
|
||||
|
||||
/* Use the same struct as for userids. */
|
||||
static struct userid *group_alist;
|
||||
static struct userid *nogroup_alist;
|
||||
@@ -145,7 +146,6 @@ getgroup (gid)
|
||||
{
|
||||
register struct userid *tail;
|
||||
struct group *grent;
|
||||
char groupnum_string[20];
|
||||
|
||||
for (tail = group_alist; tail; tail = tail->next)
|
||||
if (tail->id.g == gid)
|
||||
@@ -154,13 +154,7 @@ getgroup (gid)
|
||||
grent = getgrgid (gid);
|
||||
tail = (struct userid *) xmalloc (sizeof (struct userid));
|
||||
tail->id.g = gid;
|
||||
if (grent == 0)
|
||||
{
|
||||
sprintf (groupnum_string, "%u", (unsigned int) gid);
|
||||
tail->name = xstrdup (groupnum_string);
|
||||
}
|
||||
else
|
||||
tail->name = xstrdup (grent->gr_name);
|
||||
tail->name = (grent ? xstrdup (grent->gr_name) : NULL);
|
||||
|
||||
/* Add to the head of the list, so most recently used is first. */
|
||||
tail->next = group_alist;
|
||||
@@ -168,14 +162,16 @@ getgroup (gid)
|
||||
return tail->name;
|
||||
}
|
||||
|
||||
/* Translate GROUP to a UID, with cache.
|
||||
#ifdef NOT_USED
|
||||
|
||||
/* Translate GROUP to a GID, with cache.
|
||||
Return NULL if there is no such group.
|
||||
(We also cache which group names have no group entry,
|
||||
so we don't keep looking them up.) */
|
||||
|
||||
gid_t *
|
||||
getgidbyname (group)
|
||||
char *group;
|
||||
const char *group;
|
||||
{
|
||||
register struct userid *tail;
|
||||
struct group *grent;
|
||||
@@ -208,3 +204,5 @@ getgidbyname (group)
|
||||
nogroup_alist = tail;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* NOT_USED */
|
||||
|
||||
@@ -53,7 +53,7 @@ parse_long_options (argc, argv, command_name, package, version, usage)
|
||||
opterr = 0;
|
||||
|
||||
if (argc == 2
|
||||
&& (c = getopt_long (argc, argv, "+", long_options, (int *) 0)) != EOF)
|
||||
&& (c = getopt_long (argc, argv, "+", long_options, NULL)) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
|
||||
173
lib/makepath.c
173
lib/makepath.c
@@ -1,5 +1,5 @@
|
||||
/* makepath.c -- Ensure that a directory path exists.
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -28,7 +28,7 @@
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# pragma alloca
|
||||
# else
|
||||
char *alloca ();
|
||||
# endif
|
||||
@@ -76,9 +76,34 @@ typedef int uid_t;
|
||||
typedef int gid_t;
|
||||
#endif
|
||||
|
||||
#include "save-cwd.h"
|
||||
#include "makepath.h"
|
||||
#include "error.h"
|
||||
|
||||
void error ();
|
||||
void strip_trailing_slashes ();
|
||||
|
||||
#define CLEANUP_CWD \
|
||||
do \
|
||||
{ \
|
||||
/* We're done operating on basename_dir. \
|
||||
Restore working directory. */ \
|
||||
if (do_chdir) \
|
||||
{ \
|
||||
int fail = restore_cwd (&cwd, NULL, NULL); \
|
||||
free_cwd (&cwd); \
|
||||
if (fail) \
|
||||
return 1; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define CLEANUP \
|
||||
do \
|
||||
{ \
|
||||
umask (oldmask); \
|
||||
CLEANUP_CWD; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Ensure that the directory ARGPATH exists.
|
||||
Remove any trailing slashes from ARGPATH before calling this function.
|
||||
@@ -120,17 +145,10 @@ make_path (argpath, mode, parent_mode, owner, group, 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);
|
||||
|
||||
/* 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))
|
||||
if (stat (argpath, &stats))
|
||||
{
|
||||
char *slash;
|
||||
int tmp_mode; /* Initial perms for leading dirs. */
|
||||
@@ -141,6 +159,18 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
|
||||
struct ptr_list *next;
|
||||
};
|
||||
struct ptr_list *p, *leading_dirs = NULL;
|
||||
int do_chdir; /* Whether to chdir before each mkdir. */
|
||||
struct saved_cwd cwd;
|
||||
char *basename_dir;
|
||||
char *dirpath;
|
||||
|
||||
/* Temporarily relax umask in case it's overly restrictive. */
|
||||
int oldmask = umask (0);
|
||||
|
||||
/* Make a copy of ARGPATH that we can scribble NULs on. */
|
||||
dirpath = (char *) alloca (strlen (argpath) + 1);
|
||||
strcpy (dirpath, argpath);
|
||||
strip_trailing_slashes (dirpath);
|
||||
|
||||
/* If leading directories shouldn't be writable or executable,
|
||||
or should have set[ug]id or sticky bits set and we are setting
|
||||
@@ -158,49 +188,89 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
|
||||
re_protect = 0;
|
||||
}
|
||||
|
||||
/* If we can record the current working directory, we may be able
|
||||
to do the chdir optimization. */
|
||||
do_chdir = !save_cwd (&cwd);
|
||||
|
||||
/* If we've saved the cwd and DIRPATH is an absolute pathname,
|
||||
we must chdir to `/' in order to enable the chdir optimization.
|
||||
So if chdir ("/") fails, turn off the optimization. */
|
||||
if (do_chdir && *dirpath == '/' && chdir ("/") < 0)
|
||||
do_chdir = 0;
|
||||
|
||||
slash = dirpath;
|
||||
|
||||
/* Skip over leading slashes. */
|
||||
while (*slash == '/')
|
||||
slash++;
|
||||
while ((slash = strchr (slash, '/')))
|
||||
|
||||
while (1)
|
||||
{
|
||||
/* slash points to the leftmost unprocessed component of dirpath. */
|
||||
basename_dir = slash;
|
||||
|
||||
slash = strchr (slash, '/');
|
||||
if (slash == NULL)
|
||||
break;
|
||||
|
||||
/* If we're *not* doing chdir before each mkdir, then we have to refer
|
||||
to the target using the full (multi-component) directory name. */
|
||||
if (!do_chdir)
|
||||
basename_dir = dirpath;
|
||||
|
||||
*slash = '\0';
|
||||
if (stat (dirpath, &stats))
|
||||
if (mkdir (basename_dir, tmp_mode))
|
||||
{
|
||||
if (mkdir (dirpath, tmp_mode))
|
||||
if (stat (basename_dir, &stats))
|
||||
{
|
||||
error (0, errno, "cannot create directory `%s'", dirpath);
|
||||
umask (oldmask);
|
||||
CLEANUP;
|
||||
return 1;
|
||||
}
|
||||
else if (!S_ISDIR (stats.st_mode))
|
||||
{
|
||||
error (0, 0, "`%s' exists but is not a directory", dirpath);
|
||||
CLEANUP;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose_fmt_string != NULL)
|
||||
error (0, 0, verbose_fmt_string, dirpath);
|
||||
|
||||
if (owner != (uid_t) -1 && group != (gid_t) -1
|
||||
&& chown (dirpath, owner, group)
|
||||
#if defined(AFS) && defined (EPERM)
|
||||
&& errno != EPERM
|
||||
#endif
|
||||
)
|
||||
{
|
||||
error (0, errno, "%s", dirpath);
|
||||
retval = 1;
|
||||
}
|
||||
if (re_protect)
|
||||
{
|
||||
struct ptr_list *new = (struct ptr_list *)
|
||||
alloca (sizeof (struct ptr_list));
|
||||
new->dirname_end = slash;
|
||||
new->next = leading_dirs;
|
||||
leading_dirs = new;
|
||||
}
|
||||
/* DIRPATH already exists and is a directory. */
|
||||
}
|
||||
}
|
||||
else if (!S_ISDIR (stats.st_mode))
|
||||
|
||||
if (verbose_fmt_string != NULL)
|
||||
error (0, 0, verbose_fmt_string, dirpath);
|
||||
|
||||
if (owner != (uid_t) -1 && group != (gid_t) -1
|
||||
&& chown (basename_dir, owner, group)
|
||||
#if defined(AFS) && defined (EPERM)
|
||||
&& errno != EPERM
|
||||
#endif
|
||||
)
|
||||
{
|
||||
error (0, 0, "`%s' exists but is not a directory", dirpath);
|
||||
umask (oldmask);
|
||||
error (0, errno, "%s", dirpath);
|
||||
CLEANUP;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (re_protect)
|
||||
{
|
||||
struct ptr_list *new = (struct ptr_list *)
|
||||
alloca (sizeof (struct ptr_list));
|
||||
new->dirname_end = slash;
|
||||
new->next = leading_dirs;
|
||||
leading_dirs = new;
|
||||
}
|
||||
|
||||
/* If we were able to save the initial working directory,
|
||||
then we can use chdir to change into each directory before
|
||||
creating an entry in that directory. This avoids making
|
||||
stat and mkdir process O(n^2) file name components. */
|
||||
if (do_chdir && chdir (basename_dir) < 0)
|
||||
{
|
||||
error (0, errno, "cannot chdir to directory, %s", dirpath);
|
||||
CLEANUP;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -212,40 +282,49 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
|
||||
slash++;
|
||||
}
|
||||
|
||||
if (!do_chdir)
|
||||
basename_dir = dirpath;
|
||||
|
||||
/* We're done making leading directories.
|
||||
Create the final component of the path. */
|
||||
|
||||
/* The path could end in "/." or contain "/..", so test
|
||||
if we really have to create the directory. */
|
||||
|
||||
if (stat (dirpath, &stats) && mkdir (dirpath, mode))
|
||||
if (stat (basename_dir, &stats) && mkdir (basename_dir, mode))
|
||||
{
|
||||
error (0, errno, "cannot create directory `%s'", dirpath);
|
||||
umask (oldmask);
|
||||
CLEANUP;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Done creating directories. Restore original umask. */
|
||||
umask (oldmask);
|
||||
|
||||
if (verbose_fmt_string != NULL)
|
||||
error (0, 0, verbose_fmt_string, dirpath);
|
||||
|
||||
if (owner != (uid_t) -1 && group != (gid_t) -1)
|
||||
{
|
||||
if (chown (dirpath, owner, group)
|
||||
if (chown (basename_dir, owner, group)
|
||||
#ifdef AFS
|
||||
&& errno != EPERM
|
||||
#endif
|
||||
)
|
||||
{
|
||||
error (0, errno, "%s", dirpath);
|
||||
error (0, errno, "cannot chown %s", dirpath);
|
||||
retval = 1;
|
||||
}
|
||||
/* chown may have turned off some permission bits we wanted. */
|
||||
if ((mode & 07000) != 0 && chmod (dirpath, mode))
|
||||
if ((mode & 07000) != 0 && chmod (basename_dir, mode))
|
||||
{
|
||||
error (0, errno, "%s", dirpath);
|
||||
error (0, errno, "cannot chmod %s", dirpath);
|
||||
retval = 1;
|
||||
}
|
||||
}
|
||||
|
||||
CLEANUP_CWD;
|
||||
|
||||
/* If the mode for leading directories didn't include owner "wx"
|
||||
privileges, we have to reset their protections to the correct
|
||||
value. */
|
||||
@@ -263,10 +342,11 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
|
||||
{
|
||||
/* We get here if the entire path already exists. */
|
||||
|
||||
const char *dirpath = argpath;
|
||||
|
||||
if (!S_ISDIR (stats.st_mode))
|
||||
{
|
||||
error (0, 0, "`%s' exists but is not a directory", dirpath);
|
||||
umask (oldmask);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -296,6 +376,5 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
|
||||
}
|
||||
}
|
||||
|
||||
umask (oldmask);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
|
||||
Based on strlen implemention by Torbjorn Granlund (tege@sics.se),
|
||||
/* Copyright (C) 1991, 1993, 1997 Free Software Foundation, Inc.
|
||||
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
|
||||
with help from Dan Sahlin (dan@sics.se) and
|
||||
commentary by Jim Blandy (jimb@ai.mit.edu);
|
||||
adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
|
||||
|
||||
@@ -369,5 +369,3 @@ memcmp (s1, s2, len)
|
||||
#undef bcmp
|
||||
weak_alias (memcmp, bcmp)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
24
lib/memcpy.c
24
lib/memcpy.c
@@ -1,11 +1,29 @@
|
||||
/* Copy LEN bytes starting at SRCADDR to DESTADDR. Result undefined
|
||||
if the source overlaps with the destination.
|
||||
Return DESTADDR. */
|
||||
/* Copyright (C) 1995, 1997 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>. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Copy LEN bytes starting at SRCADDR to DESTADDR. Result undefined
|
||||
if the source overlaps with the destination.
|
||||
Return DESTADDR. */
|
||||
|
||||
char *
|
||||
memcpy (destaddr, srcaddr, len)
|
||||
char *destaddr;
|
||||
|
||||
50
lib/mktime.c
50
lib/mktime.c
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Contributed by Paul Eggert (eggert@twinsun.com).
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C
|
||||
@@ -26,6 +26,12 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# define HAVE_LIMITS_H 1
|
||||
# define HAVE_LOCALTIME_R 1
|
||||
# define STDC_HEADERS 1
|
||||
#endif
|
||||
|
||||
/* 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. */
|
||||
@@ -36,13 +42,13 @@
|
||||
#include <sys/types.h> /* Some systems define `time_t' here. */
|
||||
#include <time.h>
|
||||
|
||||
#if __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#if __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS
|
||||
#if STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
/* Make it work even if the system's libc has its own mktime routine. */
|
||||
@@ -69,8 +75,10 @@
|
||||
#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))
|
||||
/* The outer cast to time_t works around a bug in Cray C 5.0.3.0. */
|
||||
#define TIME_T_MIN ((time_t) \
|
||||
(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)
|
||||
@@ -101,10 +109,10 @@ time_t __mktime_internal __P ((struct tm *,
|
||||
time_t *));
|
||||
|
||||
|
||||
#if ! HAVE_LOCALTIME_R && ! defined (localtime_r)
|
||||
#ifdef _LIBC
|
||||
#define localtime_r __localtime_r
|
||||
#else
|
||||
#if ! HAVE_LOCALTIME_R && ! defined (localtime_r)
|
||||
/* 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 *));
|
||||
@@ -119,8 +127,8 @@ localtime_r (t, tp)
|
||||
*tp = *l;
|
||||
return tp;
|
||||
}
|
||||
#endif /* ! _LIBC */
|
||||
#endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
|
||||
#endif /* ! _LIBC */
|
||||
|
||||
|
||||
/* Yield the difference between (YEAR-YDAY HOUR:MIN:SEC) and (*TP),
|
||||
@@ -133,11 +141,19 @@ 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;
|
||||
/* Compute intervening leap days correctly even if year is negative.
|
||||
Take care to avoid int overflow. time_t overflow is OK, since
|
||||
only the low order bits of the correct time_t answer are needed.
|
||||
Don't convert to time_t until after all divisions are done, since
|
||||
time_t might be unsigned. */
|
||||
int a4 = (year >> 2) + (TM_YEAR_BASE >> 2) - ! (year & 3);
|
||||
int b4 = (tp->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (tp->tm_year & 3);
|
||||
int a100 = a4 / 25 - (a4 % 25 < 0);
|
||||
int b100 = b4 / 25 - (b4 % 25 < 0);
|
||||
int a400 = a100 >> 2;
|
||||
int b400 = b100 >> 2;
|
||||
int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
|
||||
time_t years = year - (time_t) tp->tm_year;
|
||||
time_t days = (365 * years + intervening_leap_days
|
||||
+ (yday - tp->tm_yday));
|
||||
return (60 * (60 * (24 * days + (hour - tp->tm_hour))
|
||||
@@ -146,12 +162,20 @@ ydhms_tm_diff (year, yday, hour, min, sec, tp)
|
||||
}
|
||||
|
||||
|
||||
static time_t localtime_offset;
|
||||
|
||||
/* Convert *TP to a time_t value. */
|
||||
time_t
|
||||
mktime (tp)
|
||||
struct tm *tp;
|
||||
{
|
||||
static time_t localtime_offset;
|
||||
#ifdef _LIBC
|
||||
/* POSIX.1 8.1.1 requires that whenever mktime() is called, the
|
||||
time zone names contained in the external variable `tzname' shall
|
||||
be set as if the tzset() function had been called. */
|
||||
__tzset ();
|
||||
#endif
|
||||
|
||||
return __mktime_internal (tp, localtime_r, &localtime_offset);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* modechange.c -- file mode manipulation
|
||||
Copyright (C) 1989, 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989, 1990, 1997 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
|
||||
@@ -236,6 +236,41 @@ invalid:
|
||||
return MODE_INVALID;
|
||||
}
|
||||
|
||||
/* Return a file mode change operation created from the reference REF_FILE
|
||||
Don't affect special permissions, use umask, affect 'x' if any 'x', for
|
||||
maximum security
|
||||
|
||||
Return MODE_BAD_REFERENCE if REF_FILE can't be accessed */
|
||||
|
||||
struct mode_change *
|
||||
mode_create_from_ref (ref_file)
|
||||
const char *ref_file;
|
||||
{
|
||||
struct mode_change *change; /* the only change element */
|
||||
struct stat ref_stats;
|
||||
int i;
|
||||
int umask_value;
|
||||
|
||||
if (stat (ref_file, &ref_stats))
|
||||
return MODE_BAD_REFERENCE;
|
||||
|
||||
change = talloc (struct mode_change);
|
||||
|
||||
if (change == NULL)
|
||||
return MODE_MEMORY_EXHAUSTED;
|
||||
|
||||
umask_value = umask (0);
|
||||
umask (umask_value);
|
||||
|
||||
change->op = '=';
|
||||
change->flags = MODE_X_IF_ANY_X;
|
||||
change->affected = 0777 & ~umask_value;
|
||||
change->value = ref_stats.st_mode;
|
||||
change->next = NULL;
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
/* Return file mode OLDMODE, adjusted as indicated by the list of change
|
||||
operations CHANGES. If OLDMODE is a directory, the type `X'
|
||||
change affects it even if no execute bits were set in OLDMODE.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* modechange.h -- definitions for file mode manipulation
|
||||
Copyright (C) 1989, 1990 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989, 1990, 1997 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
|
||||
@@ -39,10 +39,12 @@ struct mode_change
|
||||
#define MODE_MASK_EQUALS 1
|
||||
#define MODE_MASK_PLUS 2
|
||||
#define MODE_MASK_MINUS 4
|
||||
#define MODE_MASK_ALL (MODE_MASK_EQUALS | MODE_MASK_PLUS | MODE_MASK_MINUS)
|
||||
|
||||
/* Error return values for mode_compile. */
|
||||
#define MODE_INVALID (struct mode_change *) 0
|
||||
#define MODE_MEMORY_EXHAUSTED (struct mode_change *) 1
|
||||
#define MODE_BAD_REFERENCE (struct mode_change *) 2
|
||||
|
||||
#ifndef __P
|
||||
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
@@ -53,5 +55,6 @@ struct mode_change
|
||||
#endif
|
||||
|
||||
struct mode_change *mode_compile __P ((const char *, unsigned));
|
||||
struct mode_change *mode_create_from_ref __P ((const char *));
|
||||
unsigned short mode_adjust __P ((unsigned, const struct mode_change *));
|
||||
void mode_free __P ((struct mode_change *));
|
||||
|
||||
169
lib/mountlist.c
169
lib/mountlist.c
@@ -1,5 +1,5 @@
|
||||
/* mountlist.c -- return a list of mounted filesystems
|
||||
Copyright (C) 1991, 1992 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 1992, 1997 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
|
||||
@@ -16,7 +16,7 @@
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -24,14 +24,14 @@
|
||||
#include "mountlist.h"
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
void free ();
|
||||
#endif
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
#include <string.h>
|
||||
# include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
char *strstr ();
|
||||
@@ -41,62 +41,73 @@ char *xstrdup ();
|
||||
void error ();
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <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>
|
||||
# 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)
|
||||
# include <mntent.h>
|
||||
# if !defined(MOUNTED)
|
||||
# if defined(MNT_MNTTAB) /* HP-UX. */
|
||||
# define MOUNTED MNT_MNTTAB
|
||||
# define MOUNTED MNT_MNTTAB
|
||||
# endif
|
||||
# if defined(MNTTABNAME) /* Dynix. */
|
||||
# define MOUNTED MNTTABNAME
|
||||
# define MOUNTED MNTTABNAME
|
||||
# endif
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
|
||||
#include <sys/mount.h>
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNT /* Ultrix. */
|
||||
#include <sys/mount.h>
|
||||
#include <sys/fs_types.h>
|
||||
# include <sys/mount.h>
|
||||
# include <sys/fs_types.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_FREAD /* SVR2. */
|
||||
#include <mnttab.h>
|
||||
# include <mnttab.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_FREAD_FSTYP /* SVR3. */
|
||||
#include <mnttab.h>
|
||||
#include <sys/fstyp.h>
|
||||
#include <sys/statfs.h>
|
||||
# include <mnttab.h>
|
||||
# include <sys/fstyp.h>
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_LISTMNTENT
|
||||
#include <mntent.h>
|
||||
# include <mntent.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
|
||||
#include <sys/mnttab.h>
|
||||
# include <sys/mnttab.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_VMOUNT /* AIX. */
|
||||
#include <fshelp.h>
|
||||
#include <sys/vfs.h>
|
||||
# include <fshelp.h>
|
||||
# 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
|
||||
# undef MOUNTED_FREAD_FSTYP
|
||||
# define MOUNTED_GETMNTTBL
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MNTENT_H
|
||||
/* This is to get MNTOPT_IGNORE on e.g. SVR4. */
|
||||
# include <sys/mntent.h>
|
||||
#endif
|
||||
|
||||
#if defined (MNTOPT_IGNORE) && defined (HAVE_HASMNTOPT)
|
||||
# define MNT_IGNORE(M) hasmntopt ((M), MNTOPT_IGNORE)
|
||||
#else
|
||||
# define MNT_IGNORE(M) 0
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
|
||||
@@ -127,97 +138,97 @@ xatoi (cp)
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTENT1. */
|
||||
|
||||
#if defined (MOUNTED_GETMNTINFO) && !defined (__NetBSD__)
|
||||
#if defined (MOUNTED_GETMNTINFO) && !defined (__NetBSD__) && !defined (__OpenBSD__)
|
||||
static char *
|
||||
fstype_to_string (t)
|
||||
short t;
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
#ifdef MOUNT_PC
|
||||
# ifdef MOUNT_PC
|
||||
case MOUNT_PC:
|
||||
return "pc";
|
||||
#endif
|
||||
#ifdef MOUNT_MFS
|
||||
# endif
|
||||
# ifdef MOUNT_MFS
|
||||
case MOUNT_MFS:
|
||||
return "mfs";
|
||||
#endif
|
||||
#ifdef MOUNT_LO
|
||||
# endif
|
||||
# ifdef MOUNT_LO
|
||||
case MOUNT_LO:
|
||||
return "lo";
|
||||
#endif
|
||||
#ifdef MOUNT_TFS
|
||||
# endif
|
||||
# ifdef MOUNT_TFS
|
||||
case MOUNT_TFS:
|
||||
return "tfs";
|
||||
#endif
|
||||
#ifdef MOUNT_TMP
|
||||
# endif
|
||||
# ifdef MOUNT_TMP
|
||||
case MOUNT_TMP:
|
||||
return "tmp";
|
||||
#endif
|
||||
#ifdef MOUNT_UFS
|
||||
# endif
|
||||
# ifdef MOUNT_UFS
|
||||
case MOUNT_UFS:
|
||||
return "ufs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_NFS
|
||||
# endif
|
||||
# ifdef MOUNT_NFS
|
||||
case MOUNT_NFS:
|
||||
return "nfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_MSDOS
|
||||
# endif
|
||||
# ifdef MOUNT_MSDOS
|
||||
case MOUNT_MSDOS:
|
||||
return "msdos" ;
|
||||
#endif
|
||||
#ifdef MOUNT_LFS
|
||||
# endif
|
||||
# ifdef MOUNT_LFS
|
||||
case MOUNT_LFS:
|
||||
return "lfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_LOFS
|
||||
# endif
|
||||
# ifdef MOUNT_LOFS
|
||||
case MOUNT_LOFS:
|
||||
return "lofs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_FDESC
|
||||
# endif
|
||||
# ifdef MOUNT_FDESC
|
||||
case MOUNT_FDESC:
|
||||
return "fdesc" ;
|
||||
#endif
|
||||
#ifdef MOUNT_PORTAL
|
||||
# endif
|
||||
# ifdef MOUNT_PORTAL
|
||||
case MOUNT_PORTAL:
|
||||
return "portal" ;
|
||||
#endif
|
||||
#ifdef MOUNT_NULL
|
||||
# endif
|
||||
# ifdef MOUNT_NULL
|
||||
case MOUNT_NULL:
|
||||
return "null" ;
|
||||
#endif
|
||||
#ifdef MOUNT_UMAP
|
||||
# endif
|
||||
# ifdef MOUNT_UMAP
|
||||
case MOUNT_UMAP:
|
||||
return "umap" ;
|
||||
#endif
|
||||
#ifdef MOUNT_KERNFS
|
||||
# endif
|
||||
# ifdef MOUNT_KERNFS
|
||||
case MOUNT_KERNFS:
|
||||
return "kernfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_PROCFS
|
||||
# endif
|
||||
# ifdef MOUNT_PROCFS
|
||||
case MOUNT_PROCFS:
|
||||
return "procfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_AFS
|
||||
# endif
|
||||
# ifdef MOUNT_AFS
|
||||
case MOUNT_AFS:
|
||||
return "afs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_CD9660
|
||||
# endif
|
||||
# ifdef MOUNT_CD9660
|
||||
case MOUNT_CD9660:
|
||||
return "cd9660" ;
|
||||
#endif
|
||||
#ifdef MOUNT_UNION
|
||||
# endif
|
||||
# ifdef MOUNT_UNION
|
||||
case MOUNT_UNION:
|
||||
return "union" ;
|
||||
#endif
|
||||
#ifdef MOUNT_DEVFS
|
||||
# endif
|
||||
# ifdef MOUNT_DEVFS
|
||||
case MOUNT_DEVFS:
|
||||
return "devfs" ;
|
||||
#endif
|
||||
#ifdef MOUNT_EXT2FS
|
||||
# endif
|
||||
# ifdef MOUNT_EXT2FS
|
||||
case MOUNT_EXT2FS:
|
||||
return "ext2fs" ;
|
||||
#endif
|
||||
# endif
|
||||
default:
|
||||
return "?";
|
||||
}
|
||||
@@ -345,11 +356,11 @@ 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__
|
||||
# if defined (__NetBSD__) || defined (__OpenBSD__)
|
||||
me->me_type = xstrdup (fsp->f_fstypename);
|
||||
#else
|
||||
# else
|
||||
me->me_type = fstype_to_string (fsp->f_type);
|
||||
#endif
|
||||
# endif
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
@@ -436,17 +447,17 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
while (fread (&mnt, sizeof mnt, 1, fp) > 0)
|
||||
{
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
#ifdef GETFSTYP /* SVR3. */
|
||||
# ifdef GETFSTYP /* SVR3. */
|
||||
me->me_devname = xstrdup (mnt.mt_dev);
|
||||
#else
|
||||
# else
|
||||
me->me_devname = xmalloc (strlen (mnt.mt_dev) + 6);
|
||||
strcpy (me->me_devname, "/dev/");
|
||||
strcpy (me->me_devname + 5, mnt.mt_dev);
|
||||
#endif
|
||||
# endif
|
||||
me->me_mountdir = xstrdup (mnt.mt_filsys);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_type = "";
|
||||
#ifdef GETFSTYP /* SVR3. */
|
||||
# ifdef GETFSTYP /* SVR3. */
|
||||
if (need_fs_type)
|
||||
{
|
||||
struct statfs fsd;
|
||||
@@ -456,7 +467,7 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
|
||||
me->me_type = xstrdup (typebuf);
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
@@ -502,6 +513,10 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
|
||||
while ((ret = getmntent (fp, &mnt)) == 0)
|
||||
{
|
||||
/* Don't show automounted filesystems twice on e.g., Solaris. */
|
||||
if (!all_fs && MNT_IGNORE (&mnt))
|
||||
continue;
|
||||
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup (mnt.mnt_special);
|
||||
me->me_mountdir = xstrdup (mnt.mnt_mountp);
|
||||
|
||||
177
lib/obstack.c
177
lib/obstack.c
@@ -1,19 +1,23 @@
|
||||
/* 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 file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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. */
|
||||
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. */
|
||||
|
||||
#include "obstack.h"
|
||||
|
||||
@@ -52,7 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
/* Determine default alignment. */
|
||||
struct fooalign {char x; double d;};
|
||||
#define DEFAULT_ALIGNMENT \
|
||||
((PTR_INT_TYPE) ((char *)&((struct fooalign *) 0)->d - (char *)0))
|
||||
((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. */
|
||||
@@ -67,6 +71,28 @@ union fooround {long x; double d;};
|
||||
#define COPYING_UNIT int
|
||||
#endif
|
||||
|
||||
|
||||
/* The functions allocating more room by calling `obstack_chunk_alloc'
|
||||
jump to the handler pointed to by `obstack_alloc_failed_handler'.
|
||||
This variable by default points to the internal function
|
||||
`print_and_abort'. */
|
||||
#if defined (__STDC__) && __STDC__
|
||||
static void print_and_abort (void);
|
||||
void (*obstack_alloc_failed_handler) (void) = print_and_abort;
|
||||
#else
|
||||
static void print_and_abort ();
|
||||
void (*obstack_alloc_failed_handler) () = print_and_abort;
|
||||
#endif
|
||||
|
||||
/* Exit value used when `print_and_abort' is used. */
|
||||
#if defined (__STDC__) && __STDC__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifndef EXIT_FAILURE
|
||||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
int obstack_exit_failure = EXIT_FAILURE;
|
||||
|
||||
/* The non-GNU-C macros copy the obstack into this global variable
|
||||
to avoid multiple evaluation. */
|
||||
|
||||
@@ -78,6 +104,20 @@ struct obstack *_obstack;
|
||||
For free, do not use ?:, since some compilers, like the MIPS compilers,
|
||||
do not allow (expr) ? void : void. */
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
#define CALL_CHUNKFUN(h, size) \
|
||||
(((h) -> use_extra_arg) \
|
||||
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
|
||||
: (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size)))
|
||||
|
||||
#define CALL_FREEFUN(h, old_chunk) \
|
||||
do { \
|
||||
if ((h) -> use_extra_arg) \
|
||||
(*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
|
||||
else \
|
||||
(*(void (*) (void *)) (h)->freefun) ((old_chunk)); \
|
||||
} while (0)
|
||||
#else
|
||||
#define CALL_CHUNKFUN(h, size) \
|
||||
(((h) -> use_extra_arg) \
|
||||
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
|
||||
@@ -90,6 +130,7 @@ struct obstack *_obstack;
|
||||
else \
|
||||
(*(void (*) ()) (h)->freefun) ((old_chunk)); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
|
||||
@@ -106,10 +147,15 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
|
||||
struct obstack *h;
|
||||
int size;
|
||||
int alignment;
|
||||
#if defined (__STDC__) && __STDC__
|
||||
POINTER (*chunkfun) (long);
|
||||
void (*freefun) (void *);
|
||||
#else
|
||||
POINTER (*chunkfun) ();
|
||||
void (*freefun) ();
|
||||
#endif
|
||||
{
|
||||
register struct _obstack_chunk* chunk; /* points to new chunk */
|
||||
register struct _obstack_chunk *chunk; /* points to new chunk */
|
||||
|
||||
if (alignment == 0)
|
||||
alignment = DEFAULT_ALIGNMENT;
|
||||
@@ -130,25 +176,27 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
|
||||
size = 4096 - extra;
|
||||
}
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
|
||||
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
|
||||
#else
|
||||
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
|
||||
h->freefun = freefun;
|
||||
#endif
|
||||
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;
|
||||
(*obstack_alloc_failed_handler) ();
|
||||
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;
|
||||
h->alloc_failed = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -157,11 +205,16 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
|
||||
struct obstack *h;
|
||||
int size;
|
||||
int alignment;
|
||||
#if defined (__STDC__) && __STDC__
|
||||
POINTER (*chunkfun) (POINTER, long);
|
||||
void (*freefun) (POINTER, POINTER);
|
||||
#else
|
||||
POINTER (*chunkfun) ();
|
||||
void (*freefun) ();
|
||||
#endif
|
||||
POINTER arg;
|
||||
{
|
||||
register struct _obstack_chunk* chunk; /* points to new chunk */
|
||||
register struct _obstack_chunk *chunk; /* points to new chunk */
|
||||
|
||||
if (alignment == 0)
|
||||
alignment = DEFAULT_ALIGNMENT;
|
||||
@@ -182,8 +235,13 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
|
||||
size = 4096 - extra;
|
||||
}
|
||||
|
||||
#if defined(__STDC__) && __STDC__
|
||||
h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
|
||||
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
|
||||
#else
|
||||
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
|
||||
h->freefun = freefun;
|
||||
#endif
|
||||
h->chunk_size = size;
|
||||
h->alignment_mask = alignment - 1;
|
||||
h->extra_arg = arg;
|
||||
@@ -191,17 +249,14 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
|
||||
|
||||
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
|
||||
if (!chunk)
|
||||
{
|
||||
h->alloc_failed = 1;
|
||||
return 0;
|
||||
}
|
||||
h->alloc_failed = 0;
|
||||
(*obstack_alloc_failed_handler) ();
|
||||
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;
|
||||
h->alloc_failed = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -216,8 +271,8 @@ _obstack_newchunk (h, length)
|
||||
struct obstack *h;
|
||||
int length;
|
||||
{
|
||||
register struct _obstack_chunk* old_chunk = h->chunk;
|
||||
register struct _obstack_chunk* new_chunk;
|
||||
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;
|
||||
@@ -231,11 +286,7 @@ _obstack_newchunk (h, length)
|
||||
/* 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;
|
||||
(*obstack_alloc_failed_handler) ();
|
||||
h->chunk = new_chunk;
|
||||
new_chunk->prev = old_chunk;
|
||||
new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
|
||||
@@ -290,14 +341,14 @@ _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 */
|
||||
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))
|
||||
at the end of an adjacent chunk. */
|
||||
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
|
||||
{
|
||||
plp = lp->prev;
|
||||
lp = plp;
|
||||
@@ -318,14 +369,14 @@ _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 */
|
||||
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))
|
||||
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
|
||||
{
|
||||
plp = lp->prev;
|
||||
CALL_FREEFUN (h, lp);
|
||||
@@ -336,7 +387,7 @@ _obstack_free (h, obj)
|
||||
}
|
||||
if (lp)
|
||||
{
|
||||
h->object_base = h->next_free = (char *)(obj);
|
||||
h->object_base = h->next_free = (char *) (obj);
|
||||
h->chunk_limit = lp->limit;
|
||||
h->chunk = lp;
|
||||
}
|
||||
@@ -352,14 +403,14 @@ 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 */
|
||||
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))
|
||||
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
|
||||
{
|
||||
plp = lp->prev;
|
||||
CALL_FREEFUN (h, lp);
|
||||
@@ -370,7 +421,7 @@ obstack_free (h, obj)
|
||||
}
|
||||
if (lp)
|
||||
{
|
||||
h->object_base = h->next_free = (char *)(obj);
|
||||
h->object_base = h->next_free = (char *) (obj);
|
||||
h->chunk_limit = lp->limit;
|
||||
h->chunk = lp;
|
||||
}
|
||||
@@ -379,6 +430,39 @@ obstack_free (h, obj)
|
||||
abort ();
|
||||
}
|
||||
|
||||
int
|
||||
_obstack_memory_used (h)
|
||||
struct obstack *h;
|
||||
{
|
||||
register struct _obstack_chunk* lp;
|
||||
register int nbytes = 0;
|
||||
|
||||
for (lp = h->chunk; lp != 0; lp = lp->prev)
|
||||
{
|
||||
nbytes += lp->limit - (char *) lp;
|
||||
}
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/* Define the error handler. */
|
||||
#ifndef _
|
||||
# ifdef HAVE_LIBINTL_H
|
||||
# include <libintl.h>
|
||||
# ifndef _
|
||||
# define _(Str) gettext (Str)
|
||||
# endif
|
||||
# else
|
||||
# define _(Str) (Str)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static void
|
||||
print_and_abort ()
|
||||
{
|
||||
fputs (_("memory exhausted\n"), stderr);
|
||||
exit (obstack_exit_failure);
|
||||
}
|
||||
|
||||
#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. */
|
||||
@@ -417,6 +501,13 @@ int (obstack_room) (obstack)
|
||||
return obstack_room (obstack);
|
||||
}
|
||||
|
||||
int (obstack_make_room) (obstack, length)
|
||||
struct obstack *obstack;
|
||||
int length;
|
||||
{
|
||||
return obstack_make_room (obstack, length);
|
||||
}
|
||||
|
||||
void (obstack_grow) (obstack, pointer, length)
|
||||
struct obstack *obstack;
|
||||
POINTER pointer;
|
||||
|
||||
210
lib/obstack.h
210
lib/obstack.h
@@ -1,19 +1,23 @@
|
||||
/* obstack.h - object stack macros
|
||||
Copyright (C) 1988,89,90,91,92,93,94,96 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988,89,90,91,92,93,94,96,97 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 file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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. */
|
||||
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. */
|
||||
|
||||
/* Summary:
|
||||
|
||||
@@ -102,26 +106,17 @@ Summary:
|
||||
|
||||
#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
|
||||
/* 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)
|
||||
#define __PTR_TO_INT(P) ((P) - (char *) 0)
|
||||
#endif
|
||||
|
||||
#ifndef __INT_TO_PTR
|
||||
#define __INT_TO_PTR(P) ((P) + (char *)0)
|
||||
#define __INT_TO_PTR(P) ((P) + (char *) 0)
|
||||
#endif
|
||||
|
||||
/* We need the type of the resulting object. In ANSI C it is ptrdiff_t
|
||||
@@ -141,18 +136,23 @@ Summary:
|
||||
#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
|
||||
|
||||
#if defined (_LIBC) || defined (HAVE_STRING_H)
|
||||
#include <string.h>
|
||||
#define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
|
||||
#else
|
||||
#ifdef memcpy
|
||||
#define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
|
||||
#else
|
||||
#define _obstack_memcpy(To, From, N) bcopy ((From), (To), (N))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct _obstack_chunk /* Lives at front of each chunk. */
|
||||
{
|
||||
char *limit; /* 1 past end of this chunk */
|
||||
@@ -163,7 +163,7 @@ struct _obstack_chunk /* Lives at front of each chunk. */
|
||||
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 */
|
||||
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 */
|
||||
@@ -175,7 +175,7 @@ struct obstack /* control current object in current chunk */
|
||||
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 */
|
||||
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. */
|
||||
@@ -186,7 +186,9 @@ struct obstack /* control current object in current chunk */
|
||||
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 */
|
||||
unsigned alloc_failed:1; /* No longer used, as we now call the failed
|
||||
handler on error, but retained for binary
|
||||
compatibility. */
|
||||
};
|
||||
|
||||
/* Declare the external functions we use; they are in obstack.c. */
|
||||
@@ -199,11 +201,13 @@ extern int _obstack_begin (struct obstack *, int, int,
|
||||
extern int _obstack_begin_1 (struct obstack *, int, int,
|
||||
void *(*) (void *, long),
|
||||
void (*) (void *, void *), void *);
|
||||
extern int _obstack_memory_used (struct obstack *);
|
||||
#else
|
||||
extern void _obstack_newchunk ();
|
||||
extern void _obstack_free ();
|
||||
extern int _obstack_begin ();
|
||||
extern int _obstack_begin_1 ();
|
||||
extern int _obstack_memory_used ();
|
||||
#endif
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
@@ -234,6 +238,7 @@ void * obstack_finish (struct obstack *obstack);
|
||||
int obstack_object_size (struct obstack *obstack);
|
||||
|
||||
int obstack_room (struct obstack *obstack);
|
||||
void obstack_make_room (struct obstack *obstack, int size);
|
||||
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);
|
||||
@@ -243,17 +248,30 @@ 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);
|
||||
int obstack_memory_used (struct obstack *obstack);
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
/* Non-ANSI C cannot really support alternative functions for these macros,
|
||||
so we do not declare them. */
|
||||
|
||||
/* Error handler called when `obstack_chunk_alloc' failed to allocate
|
||||
more memory. This can be set to a user defined function. The
|
||||
default action is to print a message and abort. */
|
||||
#if defined (__STDC__) && __STDC__
|
||||
extern void (*obstack_alloc_failed_handler) (void);
|
||||
#else
|
||||
extern void (*obstack_alloc_failed_handler) ();
|
||||
#endif
|
||||
|
||||
/* Exit value used when `print_and_abort' is used. */
|
||||
extern int obstack_exit_failure;
|
||||
|
||||
/* 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)
|
||||
#define obstack_base(h) ((h)->object_base)
|
||||
|
||||
/* Size for allocating ordinary chunks. */
|
||||
|
||||
@@ -261,7 +279,7 @@ int obstack_chunk_size (struct obstack *obstack);
|
||||
|
||||
/* Pointer to next byte not yet allocated in current chunk. */
|
||||
|
||||
#define obstack_next_free(h) ((h)->alloc_failed ? 0 : (h)->next_free)
|
||||
#define obstack_next_free(h) ((h)->next_free)
|
||||
|
||||
/* Mask specifying low bits that should be clear in address of an object. */
|
||||
|
||||
@@ -273,19 +291,19 @@ int obstack_chunk_size (struct obstack *obstack);
|
||||
|
||||
#define obstack_init(h) \
|
||||
_obstack_begin ((h), 0, 0, \
|
||||
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
|
||||
(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)
|
||||
(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))
|
||||
(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))
|
||||
(void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun), (arg))
|
||||
|
||||
#define obstack_chunkfun(h, newchunkfun) \
|
||||
((h) -> chunkfun = (struct _obstack_chunk *(*)(long)) (newchunkfun))
|
||||
@@ -322,6 +340,8 @@ int obstack_chunk_size (struct obstack *obstack);
|
||||
#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)
|
||||
|
||||
#define obstack_blank_fast(h,n) ((h)->next_free += (n))
|
||||
|
||||
#define obstack_memory_used(h) _obstack_memory_used (h)
|
||||
|
||||
#if defined (__GNUC__) && defined (__STDC__) && __STDC__
|
||||
/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
|
||||
@@ -339,7 +359,6 @@ int obstack_chunk_size (struct obstack *obstack);
|
||||
#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) \
|
||||
@@ -347,17 +366,22 @@ int obstack_chunk_size (struct obstack *obstack);
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
(unsigned) (__o->chunk_limit - __o->next_free); })
|
||||
|
||||
#define obstack_make_room(OBSTACK,length) \
|
||||
__extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
int __len = (length); \
|
||||
if (__o->chunk_limit - __o->next_free < __len) \
|
||||
_obstack_newchunk (__o, __len); \
|
||||
(void) 0; })
|
||||
|
||||
#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; \
|
||||
} \
|
||||
_obstack_memcpy (__o->next_free, (char *) (where), __len); \
|
||||
__o->next_free += __len; \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_grow0(OBSTACK,where,length) \
|
||||
@@ -366,12 +390,9 @@ __extension__ \
|
||||
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; \
|
||||
} \
|
||||
_obstack_memcpy (__o->next_free, (char *) (where), __len); \
|
||||
__o->next_free += __len; \
|
||||
*(__o->next_free)++ = 0; \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_1grow(OBSTACK,datum) \
|
||||
@@ -379,8 +400,7 @@ __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); \
|
||||
*(__o->next_free)++ = (datum); \
|
||||
(void) 0; })
|
||||
|
||||
/* These assume that the obstack alignment is good enough for pointers or ints,
|
||||
@@ -392,8 +412,7 @@ __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 **)__o->next_free)++ = ((void *)datum); \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_int_grow(OBSTACK,datum) \
|
||||
@@ -401,12 +420,11 @@ __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); \
|
||||
*((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_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__ \
|
||||
@@ -414,8 +432,7 @@ __extension__ \
|
||||
int __len = (length); \
|
||||
if (__o->chunk_limit - __o->next_free < __len) \
|
||||
_obstack_newchunk (__o, __len); \
|
||||
if (!__o->alloc_failed) \
|
||||
__o->next_free += __len; \
|
||||
__o->next_free += __len; \
|
||||
(void) 0; })
|
||||
|
||||
#define obstack_alloc(OBSTACK,length) \
|
||||
@@ -442,21 +459,16 @@ __extension__ \
|
||||
__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 = (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) \
|
||||
@@ -470,7 +482,7 @@ __extension__ \
|
||||
#else /* not __GNUC__ or not __STDC__ */
|
||||
|
||||
#define obstack_object_size(h) \
|
||||
(unsigned) ((h)->alloc_failed ? 0 : (h)->next_free - (h)->object_base)
|
||||
(unsigned) ((h)->next_free - (h)->object_base)
|
||||
|
||||
#define obstack_room(h) \
|
||||
(unsigned) ((h)->chunk_limit - (h)->next_free)
|
||||
@@ -481,50 +493,49 @@ __extension__ \
|
||||
Casting the third operand to void was tried before,
|
||||
but some compilers won't accept it. */
|
||||
|
||||
#define obstack_make_room(h,length) \
|
||||
( (h)->temp = (length), \
|
||||
(((h)->next_free + (h)->temp > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), (h)->temp), 0) : 0))
|
||||
|
||||
#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)))
|
||||
_obstack_memcpy ((h)->next_free, (char *) (where), (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), \
|
||||
_obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \
|
||||
(h)->next_free += (h)->temp, \
|
||||
*((h)->next_free)++ = 0)))
|
||||
*((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))))
|
||||
(*((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))))
|
||||
(*((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))))
|
||||
(*((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_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)))
|
||||
((h)->next_free += (h)->temp))
|
||||
|
||||
#define obstack_alloc(h,length) \
|
||||
(obstack_blank ((h), (length)), obstack_finish ((h)))
|
||||
@@ -536,30 +547,29 @@ __extension__ \
|
||||
(obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
|
||||
|
||||
#define obstack_finish(h) \
|
||||
( (h)->alloc_failed ? 0 : \
|
||||
(((h)->next_free == (h)->object_base \
|
||||
( ((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 - (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)))
|
||||
__INT_TO_PTR ((h)->temp))
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
#define obstack_free(h,obj) \
|
||||
( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
|
||||
( (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 = (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) \
|
||||
|
||||
42
lib/putenv.c
42
lib/putenv.c
@@ -1,32 +1,32 @@
|
||||
/* Copyright (C) 1991, 1994 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1994, 1997 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.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if 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
|
||||
/* Disable the definition of putenv to rpl_putenv (from config.h) in this
|
||||
file. Otherwise, we'd get conflicting prototypes for rpl_putenv on
|
||||
systems like Irix 5.3. */
|
||||
#undef putenv
|
||||
|
||||
#if defined (__GNU_LIBRARY__) || defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
@@ -38,8 +38,6 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#undef putenv
|
||||
|
||||
#if !defined (__GNU_LIBRARY__) && !defined (HAVE_STRCHR)
|
||||
# define strchr index
|
||||
#endif
|
||||
@@ -56,7 +54,7 @@ extern char **environ;
|
||||
|
||||
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
|
||||
int
|
||||
putenv (string)
|
||||
rpl_putenv (string)
|
||||
const char *string;
|
||||
{
|
||||
const char *const name_end = strchr (string, '=');
|
||||
|
||||
94
lib/readutmp.c
Normal file
94
lib/readutmp.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* GNU's read utmp module.
|
||||
Copyright (C) 92, 93, 94, 95, 96, 1997 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 jla; revised by djm */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif /* STDC_HEADERS || HAVE_STRING_H */
|
||||
|
||||
#include "readutmp.h"
|
||||
#include "error.h"
|
||||
|
||||
char *xmalloc ();
|
||||
|
||||
/* Copy UT->ut_name into storage obtained from malloc. Then remove any
|
||||
trailing spaces from the copy, NUL terminate it, and return the copy. */
|
||||
|
||||
char *
|
||||
extract_trimmed_name (ut)
|
||||
const STRUCT_UTMP *ut;
|
||||
{
|
||||
char *p, *trimmed_name;
|
||||
|
||||
trimmed_name = xmalloc (sizeof (ut->ut_name) + 1);
|
||||
strncpy (trimmed_name, ut->ut_name, sizeof (ut->ut_name));
|
||||
/* Append a trailing space character. Some systems pad names shorter than
|
||||
the maximum with spaces, others pad with NULs. Remove any spaces. */
|
||||
trimmed_name[sizeof (ut->ut_name)] = ' ';
|
||||
p = strchr (trimmed_name, ' ');
|
||||
if (p != NULL)
|
||||
*p = '\0';
|
||||
return trimmed_name;
|
||||
}
|
||||
|
||||
/* Read the utmp file FILENAME into *UTMP_BUF, set *N_ENTRIES to the
|
||||
number of entries read, and return zero. If there is any error,
|
||||
return non-zero and don't modify the parameters. */
|
||||
|
||||
int
|
||||
read_utmp (filename, n_entries, utmp_buf)
|
||||
const char *filename;
|
||||
int *n_entries;
|
||||
STRUCT_UTMP **utmp_buf;
|
||||
{
|
||||
FILE *utmp;
|
||||
struct stat file_stats;
|
||||
size_t n_read;
|
||||
size_t size;
|
||||
STRUCT_UTMP *buf;
|
||||
|
||||
utmp = fopen (filename, "r");
|
||||
if (utmp == NULL)
|
||||
return 1;
|
||||
|
||||
fstat (fileno (utmp), &file_stats);
|
||||
size = file_stats.st_size;
|
||||
if (size > 0)
|
||||
buf = (STRUCT_UTMP *) xmalloc (size);
|
||||
else
|
||||
{
|
||||
fclose (utmp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Use < instead of != in case the utmp just grew. */
|
||||
n_read = fread (buf, 1, size, utmp);
|
||||
if (ferror (utmp) || fclose (utmp) == EOF
|
||||
|| n_read < size)
|
||||
return 1;
|
||||
|
||||
*n_entries = size / sizeof (STRUCT_UTMP);
|
||||
*utmp_buf = buf;
|
||||
|
||||
return 0;
|
||||
}
|
||||
85
lib/readutmp.h
Normal file
85
lib/readutmp.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/* Declarations for GNU's read utmp module.
|
||||
Copyright (C) 92, 93, 94, 95, 96, 1997 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 jla; revised by djm */
|
||||
|
||||
#ifndef __READUTMP_H__
|
||||
# define __READUTMP_H__
|
||||
|
||||
# include <stdio.h>
|
||||
# include <sys/types.h>
|
||||
|
||||
# ifdef HAVE_UTMPX_H
|
||||
# include <utmpx.h>
|
||||
# define UTMP_STRUCT_NAME utmpx
|
||||
# define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_tv.tv_sec)
|
||||
# else
|
||||
# include <utmp.h>
|
||||
# define UTMP_STRUCT_NAME utmp
|
||||
# define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_time)
|
||||
# endif
|
||||
|
||||
typedef struct UTMP_STRUCT_NAME STRUCT_UTMP;
|
||||
|
||||
# include <time.h>
|
||||
# ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
# endif
|
||||
|
||||
# include <errno.h>
|
||||
# ifndef errno
|
||||
extern int errno;
|
||||
# endif
|
||||
|
||||
# if !defined (UTMP_FILE) && defined (_PATH_UTMP)
|
||||
# define UTMP_FILE _PATH_UTMP
|
||||
# endif
|
||||
|
||||
# if !defined (WTMP_FILE) && defined (_PATH_WTMP)
|
||||
# define WTMP_FILE _PATH_WTMP
|
||||
# endif
|
||||
|
||||
# ifdef UTMPX_FILE /* Solaris, SysVr4 */
|
||||
# undef UTMP_FILE
|
||||
# define UTMP_FILE UTMPX_FILE
|
||||
# endif
|
||||
|
||||
# ifdef WTMPX_FILE /* Solaris, SysVr4 */
|
||||
# undef WTMP_FILE
|
||||
# define WTMP_FILE WTMPX_FILE
|
||||
# endif
|
||||
|
||||
# ifndef UTMP_FILE
|
||||
# define UTMP_FILE "/etc/utmp"
|
||||
# endif
|
||||
|
||||
# ifndef WTMP_FILE
|
||||
# define WTMP_FILE "/etc/wtmp"
|
||||
# endif
|
||||
|
||||
# undef PARAMS
|
||||
# if defined (__STDC__) && __STDC__
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
|
||||
extern char *extract_trimmed_name PARAMS ((const STRUCT_UTMP *ut));
|
||||
extern int read_utmp PARAMS ((const char *filename,
|
||||
int *n_entries, STRUCT_UTMP **utmp_buf));
|
||||
|
||||
#endif /* __READUTMP_H__ */
|
||||
@@ -1,22 +1,22 @@
|
||||
/* rpmatch - determine whether string value is affirmation or negative
|
||||
response according to current locale's data
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* 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 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.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef WITH_REGEX
|
||||
#if WITH_REGEX
|
||||
# include <regex.h>
|
||||
#else
|
||||
# include <rx.h>
|
||||
|
||||
4
lib/rx.c
4
lib/rx.c
@@ -14,8 +14,8 @@ for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this software; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA
|
||||
02139, USA. */
|
||||
write to the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* NOTE!!! AIX is so losing it requires this to be the first thing in the
|
||||
* file.
|
||||
|
||||
4
lib/rx.h
4
lib/rx.h
@@ -17,8 +17,8 @@ for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this software; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA
|
||||
02139, USA. */
|
||||
write to the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
/* t. lord Wed Sep 23 18:20:57 1992 */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* save-cwd.c -- Save and restore current working directory.
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -38,7 +38,7 @@
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
# ifndef errno
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
@@ -96,7 +96,7 @@ save_cwd (cwd)
|
||||
}
|
||||
# endif /* __sun__ || sun */
|
||||
#else
|
||||
#define fchdir(x) (abort (), 0)
|
||||
# define fchdir(x) (abort (), 0)
|
||||
have_working_fchdir = 0;
|
||||
#endif
|
||||
}
|
||||
@@ -152,4 +152,3 @@ free_cwd (cwd)
|
||||
if (cwd->name)
|
||||
free (cwd->name);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1994, 1996, 1997 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,11 +14,11 @@
|
||||
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
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
@@ -27,7 +27,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Return the length of the maximum inital segment of S
|
||||
/* Return the length of the maximum initial segment of S
|
||||
which contains no characters from REJECT. */
|
||||
int
|
||||
strcspn (s, reject)
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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.
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
@@ -139,7 +140,7 @@ extern int __tz_compute __P ((time_t timer, const struct tm *tm));
|
||||
# if ! HAVE_LOCALTIME_R
|
||||
# if ! HAVE_TM_GMTOFF
|
||||
/* Approximate gmtime_r as best we can in its absence. */
|
||||
# define gmtime_r my_gmtime_r
|
||||
# define gmtime_r my_gmtime_r
|
||||
static struct tm *gmtime_r __P ((const time_t *, struct tm *));
|
||||
static struct tm *
|
||||
gmtime_r (t, tp)
|
||||
@@ -176,11 +177,12 @@ localtime_r (t, tp)
|
||||
/* Some systems lack the `memset' function and we don't want to
|
||||
introduce additional dependencies. */
|
||||
static const char spaces[16] = " ";
|
||||
static const char zeroes[16] = "0000000000000000";
|
||||
|
||||
# define memset_space(P, Len) \
|
||||
do { \
|
||||
int _len = (Len); \
|
||||
\
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
int _this = _len > 16 ? 16 : _len; \
|
||||
@@ -190,11 +192,26 @@ static const char spaces[16] = " ";
|
||||
} \
|
||||
while (_len > 0); \
|
||||
} while (0)
|
||||
|
||||
# define memset_zero(P, Len) \
|
||||
do { \
|
||||
int _len = (Len); \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
int _this = _len > 16 ? 16 : _len; \
|
||||
memcpy ((P), zeroes, _this); \
|
||||
(P) += _this; \
|
||||
_len -= _this; \
|
||||
} \
|
||||
while (_len > 0); \
|
||||
} while (0)
|
||||
#else
|
||||
# define memset_space(P, Len) memset ((P), ' ', (Len))
|
||||
# define memset_space(P, Len) (memset ((P), ' ', (Len)), (P) += (Len))
|
||||
# define memset_zero(P, Len) (memset ((P), '0', (Len)), (P) += (Len))
|
||||
#endif
|
||||
|
||||
#define add(n, f) \
|
||||
#define add(n, f) \
|
||||
do \
|
||||
{ \
|
||||
int _n = (n); \
|
||||
@@ -205,14 +222,19 @@ static const char spaces[16] = " ";
|
||||
if (p) \
|
||||
{ \
|
||||
if (_delta > 0) \
|
||||
memset_space (p, _delta); \
|
||||
{ \
|
||||
if (pad == '0') \
|
||||
memset_zero (p, _delta); \
|
||||
else \
|
||||
memset_space (p, _delta); \
|
||||
} \
|
||||
f; \
|
||||
p += _n; \
|
||||
} \
|
||||
i += _incr; \
|
||||
} while (0)
|
||||
|
||||
#define cpy(n, s) \
|
||||
#define cpy(n, s) \
|
||||
add ((n), \
|
||||
if (to_lowcase) \
|
||||
memcpy_lowcase (p, (s), _n); \
|
||||
@@ -349,11 +371,11 @@ static char const month_name[][10] =
|
||||
# ifdef strftime
|
||||
# undef strftime
|
||||
# endif
|
||||
# define strftime _strftime_copytm
|
||||
# define strftime(S, Maxsize, Format, Tp) \
|
||||
_strftime_copytm (S, Maxsize, Format, Tp)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Write information from TP into S according to the format
|
||||
string FORMAT, writing no more that MAXSIZE characters
|
||||
(including the terminating '\0') and returning number of
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* strtol - Convert string representation of a number into an integer value.
|
||||
Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 92, 94, 95, 96, 97 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.
|
||||
|
||||
@@ -201,7 +201,10 @@ INTERNAL (strtol) (nptr, endptr, base, group)
|
||||
#endif
|
||||
|
||||
if (base < 0 || base == 1 || base > 36)
|
||||
base = 10;
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
save = s = nptr;
|
||||
|
||||
@@ -309,6 +312,8 @@ INTERNAL (strtol) (nptr, endptr, base, group)
|
||||
? -((unsigned LONG int) (LONG_MIN + 1)) + 1
|
||||
: (unsigned LONG int) LONG_MAX))
|
||||
overflow = 1;
|
||||
#else
|
||||
overflow |= negative;
|
||||
#endif
|
||||
|
||||
if (overflow)
|
||||
|
||||
111
lib/strverscmp.c
Normal file
111
lib/strverscmp.c
Normal file
@@ -0,0 +1,111 @@
|
||||
/* Compare strings while treating digits characters numerically.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Jean-Francois Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
|
||||
|
||||
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. */
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
|
||||
Fractional parts, S_Z: idem but with leading Zeroes only */
|
||||
#define S_N 0x0
|
||||
#define S_I 0x4
|
||||
#define S_F 0x8
|
||||
#define S_Z 0xC
|
||||
|
||||
/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
|
||||
#define CMP 2
|
||||
#define LEN 3
|
||||
|
||||
|
||||
/* Compare S1 and S2 as strings holding indices/version numbers,
|
||||
returning less than, equal to or greater than zero if S1 is less than,
|
||||
equal to or greater than S2 (for more info, see the texinfo doc).
|
||||
*/
|
||||
|
||||
int
|
||||
strverscmp (s1, s2)
|
||||
const char *s1;
|
||||
const char *s2;
|
||||
{
|
||||
const unsigned char *p1 = (const unsigned char *) s1;
|
||||
const unsigned char *p2 = (const unsigned char *) s2;
|
||||
unsigned char c1, c2;
|
||||
int state;
|
||||
int diff;
|
||||
|
||||
/* Symbol(s) 0 [1-9] others (padding)
|
||||
Transition (10) 0 (01) d (00) x (11) - */
|
||||
static const unsigned int next_state[] =
|
||||
{
|
||||
/* state x d 0 - */
|
||||
/* S_N */ S_N, S_I, S_Z, S_N,
|
||||
/* S_I */ S_N, S_I, S_I, S_I,
|
||||
/* S_F */ S_N, S_F, S_F, S_F,
|
||||
/* S_Z */ S_N, S_F, S_Z, S_Z
|
||||
};
|
||||
|
||||
static const int result_type[] =
|
||||
{
|
||||
/* state x/x x/d x/0 x/- d/x d/d d/0 d/-
|
||||
0/x 0/d 0/0 0/- -/x -/d -/0 -/- */
|
||||
|
||||
/* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
|
||||
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
|
||||
/* S_I */ CMP, -1, -1, CMP, +1, LEN, LEN, CMP,
|
||||
+1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
|
||||
/* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
|
||||
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
|
||||
/* S_Z */ CMP, +1, +1, CMP, -1, CMP, CMP, CMP,
|
||||
-1, CMP, CMP, CMP
|
||||
};
|
||||
|
||||
if (p1 == p2)
|
||||
return 0;
|
||||
|
||||
c1 = *p1++;
|
||||
c2 = *p2++;
|
||||
/* Hint: '0' is a digit too. */
|
||||
state = S_N | ((c1 == '0') + (isdigit (c1) != 0));
|
||||
|
||||
while ((diff = c1 - c2) == 0 && c1 != '\0')
|
||||
{
|
||||
state = next_state[state];
|
||||
c1 = *p1++;
|
||||
c2 = *p2++;
|
||||
state |= (c1 == '0') + (isdigit (c1) != 0);
|
||||
}
|
||||
|
||||
state = result_type[state << 2 | ((c2 == '0') + (isdigit (c2) != 0))];
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case CMP:
|
||||
return diff;
|
||||
|
||||
case LEN:
|
||||
while (isdigit (*p1++))
|
||||
if (!isdigit (*p2++))
|
||||
return 1;
|
||||
|
||||
return isdigit (*p2) ? -1 : diff;
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
8
lib/strverscmp.h
Normal file
8
lib/strverscmp.h
Normal file
@@ -0,0 +1,8 @@
|
||||
/* strverscmp.h -- compare strings holding indices/version numbers */
|
||||
|
||||
#ifndef STRVERSCMP_H_
|
||||
# define STRVERSCMP_H_
|
||||
|
||||
int strverscmp (const char*, const char*);
|
||||
|
||||
#endif /* not STRVERSCMP_H_ */
|
||||
@@ -1,5 +1,5 @@
|
||||
/* userspec.c -- Parse a user and group string.
|
||||
Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989, 1990, 1991, 1992, 1997 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
|
||||
@@ -16,9 +16,9 @@
|
||||
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>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
@@ -28,7 +28,7 @@
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# pragma alloca
|
||||
# else
|
||||
char *alloca ();
|
||||
# endif
|
||||
@@ -40,7 +40,7 @@ char *alloca ();
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
@@ -49,11 +49,11 @@ char *alloca ();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
@@ -247,7 +247,7 @@ parse_user_spec (spec_arg, uid, gid, username_arg, groupname_arg)
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#define NULL_CHECK(s) ((s) == NULL ? "(null)" : (s))
|
||||
# define NULL_CHECK(s) ((s) == NULL ? "(null)" : (s))
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
|
||||
85
lib/ylwrap
85
lib/ylwrap
@@ -1,6 +1,7 @@
|
||||
#! /bin/sh
|
||||
# ylwrap - wrapper for lex/yacc invocations.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>, Aug 11 1996
|
||||
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,8 +18,9 @@
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Usage:
|
||||
# ylwrap PROG [OUTPUT DESIRED]... -- [ARGS]...
|
||||
# * PROG is program to run.
|
||||
# ylwrap PROGRAM INPUT [OUTPUT DESIRED]... -- [ARGS]...
|
||||
# * PROGRAM is program to run.
|
||||
# * INPUT is the input file
|
||||
# * OUTPUT is file PROG generates
|
||||
# * DESIRED is file we actually want
|
||||
# * ARGS are passed to PROG
|
||||
@@ -28,6 +30,21 @@
|
||||
prog="$1"
|
||||
shift
|
||||
|
||||
# The input.
|
||||
input="$1"
|
||||
shift
|
||||
case "$input" in
|
||||
/*)
|
||||
# Absolute path; do nothing.
|
||||
;;
|
||||
*)
|
||||
# Relative path. Make it absolute. Why? Because otherwise any
|
||||
# debugging info in the generated file will point to the wrong
|
||||
# place. This is really gross.
|
||||
input="`pwd`/$input"
|
||||
;;
|
||||
esac
|
||||
|
||||
pairlist=
|
||||
while test "$#" -ne 0; do
|
||||
if test "$1" = "--"; then
|
||||
@@ -37,26 +54,48 @@ while test "$#" -ne 0; do
|
||||
shift
|
||||
done
|
||||
|
||||
$prog ${1+"$@"} || exit $?
|
||||
# FIXME: add hostname here for parallel makes that run commands on
|
||||
# other machines. But that might take us over the 14-char limit.
|
||||
dirname=ylwrap$$
|
||||
trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
|
||||
mkdir $dirname || exit 1
|
||||
|
||||
set X $pairlist
|
||||
shift
|
||||
status=0
|
||||
first=yes
|
||||
while test "$#" -ne 0; do
|
||||
if test -f "$1"; then
|
||||
mv "$1" "$2" || status=$?
|
||||
else
|
||||
# A missing file is only an error for the first file. This is a
|
||||
# blatant hack to let us support using "yacc -d". If -d is not
|
||||
# specified, we don't want an error when the header file is
|
||||
# "missing".
|
||||
if test $first = yes; then
|
||||
status=1
|
||||
cd $dirname
|
||||
$prog ${1+"$@"} "$input"
|
||||
status=$?
|
||||
|
||||
if test $status -eq 0; then
|
||||
set X $pairlist
|
||||
shift
|
||||
first=yes
|
||||
while test "$#" -ne 0; do
|
||||
if test -f "$1"; then
|
||||
# If $2 is an absolute path name, then just use that,
|
||||
# otherwise prepend `../'.
|
||||
case "$2" in
|
||||
/*) target="$2";;
|
||||
*) target="../$2";;
|
||||
esac
|
||||
mv "$1" "$target" || status=$?
|
||||
else
|
||||
# A missing file is only an error for the first file. This
|
||||
# is a blatant hack to let us support using "yacc -d". If -d
|
||||
# is not specified, we don't want an error when the header
|
||||
# file is "missing".
|
||||
if test $first = yes; then
|
||||
status=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
shift
|
||||
shift
|
||||
first=no
|
||||
done
|
||||
shift
|
||||
shift
|
||||
first=no
|
||||
done
|
||||
else
|
||||
status=$?
|
||||
fi
|
||||
|
||||
# Remove the directory.
|
||||
cd ..
|
||||
rm -rf $dirname
|
||||
|
||||
exit $status
|
||||
|
||||
@@ -4,8 +4,5 @@
|
||||
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
|
||||
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
|
||||
EXTRA_DIST = README \
|
||||
ccstdc.m4 dmalloc.m4 error.m4 getgroups.m4 getline.m4 getloadavg.m4 \
|
||||
gettext.m4 header.m4 init.m4 install.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 lcmessage.m4 lispdir.m4 maintainer.m4 memcmp.m4 mktime.m4 \
|
||||
obstack.m4 progtest.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strftime.m4 \
|
||||
strtod.m4 termios.m4 uptime.m4 winsz.m4
|
||||
chown.m4 getgroups.m4 getline.m4 getloadavg.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 memcmp.m4 putenv.m4 strftime.m4 uptime.m4
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.1l from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.2 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
@@ -36,45 +36,74 @@ pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
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@
|
||||
|
||||
NORMAL_INSTALL = true
|
||||
PRE_INSTALL = true
|
||||
POST_INSTALL = true
|
||||
NORMAL_UNINSTALL = true
|
||||
PRE_UNINSTALL = true
|
||||
POST_UNINSTALL = true
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DF_PROG = @DF_PROG@
|
||||
GENCAT = @GENCAT@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
MVDIR_PROG = @MVDIR_PROG@
|
||||
PACKAGE = @PACKAGE@
|
||||
PERL = @PERL@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
LN = @LN@
|
||||
RM = @RM@
|
||||
U = @U@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
l = @l@
|
||||
|
||||
EXTRA_DIST = README \
|
||||
ccstdc.m4 dmalloc.m4 error.m4 getgroups.m4 getline.m4 getloadavg.m4 \
|
||||
gettext.m4 header.m4 init.m4 install.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 lcmessage.m4 lispdir.m4 maintainer.m4 memcmp.m4 mktime.m4 \
|
||||
obstack.m4 progtest.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strftime.m4 \
|
||||
strtod.m4 termios.m4 uptime.m4 winsz.m4
|
||||
chown.m4 getgroups.m4 getline.m4 getloadavg.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 memcmp.m4 putenv.m4 strftime.m4 uptime.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = README Makefile.am Makefile.in README
|
||||
DIST_COMMON = README Makefile.am Makefile.in
|
||||
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \
|
||||
$(TEXINFOS) $(MANS) $(EXTRA_DIST)
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL)
|
||||
cd $(top_srcdir) && automake --gnu m4/Makefile
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits m4/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
@@ -87,7 +116,12 @@ TAGS:
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = m4
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits m4/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
@@ -100,10 +134,10 @@ check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
$(NORMAL_INSTALL)
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
$(NORMAL_INSTALL)
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
@@ -113,7 +147,7 @@ uninstall:
|
||||
all: Makefile
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
@@ -125,7 +159,7 @@ clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
rm -f Makefile $(DISTCLEANFILES)
|
||||
rm -f config.cache config.log stamp-h
|
||||
rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
|
||||
61
m4/ccstdc.m4
61
m4/ccstdc.m4
@@ -1,61 +0,0 @@
|
||||
## ----------------------------------------- ##
|
||||
## ANSIfy the C compiler whenever possible. ##
|
||||
## From Franc,ois Pinard ##
|
||||
## ----------------------------------------- ##
|
||||
|
||||
# serial 1
|
||||
|
||||
# @defmac AC_PROG_CC_STDC
|
||||
# @maindex PROG_CC_STDC
|
||||
# @ovindex CC
|
||||
# If the C compiler in not in ANSI C mode by default, try to add an option
|
||||
# to output variable @code{CC} to make it so. This macro tries various
|
||||
# options that select ANSI C on some system or another. It considers the
|
||||
# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
|
||||
# handles function prototypes correctly.
|
||||
#
|
||||
# If you use this macro, you should check after calling it whether the C
|
||||
# compiler has been set to accept ANSI C; if not, the shell variable
|
||||
# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
|
||||
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
|
||||
# program @code{ansi2knr}, which comes with Ghostscript.
|
||||
# @end defmac
|
||||
|
||||
AC_DEFUN(AM_PROG_CC_STDC,
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
|
||||
AC_CACHE_VAL(am_cv_prog_cc_stdc,
|
||||
[am_cv_prog_cc_stdc=no
|
||||
ac_save_CC="$CC"
|
||||
# Don't try gcc -ansi; that turns off useful extensions and
|
||||
# breaks some systems' header files.
|
||||
# AIX -qlanglvl=ansi
|
||||
# Ultrix and OSF/1 -std1
|
||||
# HP-UX -Aa -D_HPUX_SOURCE
|
||||
# SVR4 -Xc -D__EXTENSIONS__
|
||||
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
|
||||
do
|
||||
CC="$ac_save_CC $ac_arg"
|
||||
AC_TRY_COMPILE(
|
||||
[#if !defined(__STDC__) || __STDC__ != 1
|
||||
choke me
|
||||
#endif
|
||||
/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
], [
|
||||
int test (int i, double x);
|
||||
struct s1 {int (*f) (int a);};
|
||||
struct s2 {int (*f) (double a);};],
|
||||
[am_cv_prog_cc_stdc="$ac_arg"; break])
|
||||
done
|
||||
CC="$ac_save_CC"
|
||||
])
|
||||
AC_MSG_RESULT($am_cv_prog_cc_stdc)
|
||||
case "x$am_cv_prog_cc_stdc" in
|
||||
x|xno) ;;
|
||||
*) CC="$CC $am_cv_prog_cc_stdc" ;;
|
||||
esac
|
||||
])
|
||||
40
m4/chown.m4
Normal file
40
m4/chown.m4
Normal file
@@ -0,0 +1,40 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl If you use this macro in a package, you should
|
||||
dnl add the following two lines to acconfig.h:
|
||||
dnl /* Define to rpl_chown if the replacement function should be used. */
|
||||
dnl #undef chown
|
||||
dnl
|
||||
|
||||
AC_DEFUN(jm_FUNC_CHOWN,
|
||||
[AC_REQUIRE([AC_TYPE_UID_T])dnl
|
||||
test -z "$ac_cv_header_unistd_h" \
|
||||
&& AC_CHECK_HEADERS(unistd.h)
|
||||
AC_CACHE_CHECK([for working chown], jm_cv_func_working_chown,
|
||||
[AC_TRY_RUN([
|
||||
# include <sys/types.h>
|
||||
# include <fcntl.h>
|
||||
# ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char *f = "conftestchown";
|
||||
if (creat (f, 0600) < 0)
|
||||
exit (1);
|
||||
exit (chown (f, (gid_t) -1, (uid_t) -1) == -1 ? 1 : 0);
|
||||
}
|
||||
],
|
||||
jm_cv_func_working_chown=yes,
|
||||
jm_cv_func_working_chown=no,
|
||||
dnl When crosscompiling, assume chown is broken.
|
||||
jm_cv_func_working_chown=no)
|
||||
])
|
||||
if test $jm_cv_func_working_chown = no; then
|
||||
LIBOBJS="$LIBOBJS chown.o"
|
||||
AC_DEFINE_UNQUOTED(chown, rpl_chown)
|
||||
fi
|
||||
])
|
||||
@@ -1,21 +0,0 @@
|
||||
## ----------------------------------- ##
|
||||
## Check if --with-dmalloc was given. ##
|
||||
## From Franc,ois Pinard ##
|
||||
## ----------------------------------- ##
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_WITH_DMALLOC,
|
||||
[AC_MSG_CHECKING(if malloc debugging is wanted)
|
||||
AC_ARG_WITH(dmalloc,
|
||||
[ --with-dmalloc use dmalloc, as in
|
||||
ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
|
||||
[if test "$withval" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(WITH_DMALLOC)
|
||||
LIBS="$LIBS -ldmalloc"
|
||||
LDFLAGS="$LDFLAGS -g"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi], [AC_MSG_RESULT(no)])
|
||||
])
|
||||
13
m4/error.m4
13
m4/error.m4
@@ -1,13 +0,0 @@
|
||||
dnl From Jim Meyering. Use this if you use the GNU error.[ch].
|
||||
dnl FIXME: Migrate into libit
|
||||
|
||||
AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
|
||||
[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
|
||||
[AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
|
||||
am_cv_lib_error_at_line=yes,
|
||||
am_cv_lib_error_at_line=no)])
|
||||
if test $am_cv_lib_error_at_line = no; then
|
||||
LIBOBJS="$LIBOBJS error.o"
|
||||
fi
|
||||
AC_SUBST(LIBOBJS)dnl
|
||||
])
|
||||
286
m4/gettext.m4
286
m4/gettext.m4
@@ -1,286 +0,0 @@
|
||||
# Macro to add for using GNU gettext.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_WITH_NLS,
|
||||
[AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
[ --disable-nls do not use Native Language Support],
|
||||
USE_NLS=$enableval, USE_NLS=yes)
|
||||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS)
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
nls_cv_force_use_gnu_gettext=$withval,
|
||||
nls_cv_force_use_gnu_gettext=no)
|
||||
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
||||
|
||||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||
dnl User does not insist on using GNU NLS library. Figure out what
|
||||
dnl to use. If gettext or catgets are available (in this order) we
|
||||
dnl use this. Else we have to fall back to GNU NLS library.
|
||||
dnl catgets is only used if permitted by option --with-catgets.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
CATOBJEXT=NONE
|
||||
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CACHE_CHECK([for gettext in libintl],
|
||||
gt_cv_func_gettext_libintl,
|
||||
[AC_TRY_LINK([], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libintl=yes,
|
||||
gt_cv_func_gettext_libintl=no)])])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT)
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
if test "$MSGFMT" != "no"; then
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
|
||||
return _nl_msg_cat_cntr],
|
||||
[CATOBJEXT=.gmo
|
||||
DATADIRNAME=share],
|
||||
[CATOBJEXT=.mo
|
||||
DATADIRNAME=lib])
|
||||
INSTOBJEXT=.mo
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
AC_MSG_CHECKING([whether catgets can be used])
|
||||
AC_ARG_WITH(catgets,
|
||||
[ --with-catgets use catgets functions if available],
|
||||
nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
|
||||
AC_MSG_RESULT($nls_cv_use_catgets)
|
||||
|
||||
if test "$nls_cv_use_catgets" = "yes"; then
|
||||
dnl No gettext in C library. Try catgets next.
|
||||
AC_CHECK_LIB(i, main)
|
||||
AC_CHECK_FUNC(catgets,
|
||||
[AC_DEFINE(HAVE_CATGETS)
|
||||
INTLOBJS="\$(CATOBJS)"
|
||||
AC_PATH_PROG(GENCAT, gencat, no)dnl
|
||||
if test "$GENCAT" != "no"; then
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
|
||||
if test "$GMSGFMT" = "no"; then
|
||||
AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
|
||||
fi
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.cat
|
||||
INSTOBJEXT=.cat
|
||||
DATADIRNAME=lib
|
||||
INTLDEPS="../intl/libintl.a"
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
dnl Neither gettext nor catgets in included in the C library.
|
||||
dnl Fall back on GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Mark actions used to generate GNU NLS library.
|
||||
INTLOBJS="\$(GETTOBJS)"
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_SUBST(MSGFMT)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.gmo
|
||||
INSTOBJEXT=.mo
|
||||
DATADIRNAME=share
|
||||
INTLDEPS="../intl/libintl.a"
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi
|
||||
|
||||
dnl Test whether we really found GNU xgettext.
|
||||
if test "$XGETTEXT" != ":"; then
|
||||
dnl If it is no GNU xgettext we define it as : so that the
|
||||
dnl Makefiles still can work.
|
||||
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
|
||||
: ;
|
||||
else
|
||||
AC_MSG_RESULT(
|
||||
[found xgettext programs is not GNU xgettext; ignore it])
|
||||
XGETTEXT=":"
|
||||
fi
|
||||
fi
|
||||
|
||||
# We need to process the po/ directory.
|
||||
POSUB=po
|
||||
else
|
||||
DATADIRNAME=share
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi
|
||||
|
||||
# If this is used in GNU gettext we have to set USE_NLS to `yes'
|
||||
# because some of the sources are only built for this goal.
|
||||
if test "$PACKAGE" = gettext; then
|
||||
USE_NLS=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl These rules are solely for the distribution goal. While doing this
|
||||
dnl we only have to keep exactly one list of the available catalogs
|
||||
dnl in configure.in.
|
||||
for lang in $ALL_LINGUAS; do
|
||||
GMOFILES="$GMOFILES $lang.gmo"
|
||||
POFILES="$POFILES $lang.po"
|
||||
done
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||
AC_SUBST(CATALOGS)
|
||||
AC_SUBST(CATOBJEXT)
|
||||
AC_SUBST(DATADIRNAME)
|
||||
AC_SUBST(GMOFILES)
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
AC_SUBST(INTLDEPS)
|
||||
AC_SUBST(INTLLIBS)
|
||||
AC_SUBST(INTLOBJS)
|
||||
AC_SUBST(POFILES)
|
||||
AC_SUBST(POSUB)
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_GNU_GETTEXT,
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_C_CONST])dnl
|
||||
AC_REQUIRE([AC_C_INLINE])dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
|
||||
unistd.h values.h])
|
||||
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
|
||||
__argz_count __argz_stringify __argz_next])
|
||||
|
||||
if test "${ac_cv_func_stpcpy+set}" != "set"; then
|
||||
AC_CHECK_FUNCS(stpcpy)
|
||||
fi
|
||||
if test "${ac_cv_func_stpcpy}" = "yes"; then
|
||||
AC_DEFINE(HAVE_STPCPY)
|
||||
fi
|
||||
|
||||
AM_LC_MESSAGES
|
||||
AM_WITH_NLS
|
||||
|
||||
if test "x$CATOBJEXT" != "x"; then
|
||||
if test "x$ALL_LINGUAS" = "x"; then
|
||||
LINGUAS=
|
||||
else
|
||||
AC_MSG_CHECKING(for catalogs to be installed)
|
||||
NEW_LINGUAS=
|
||||
for lang in ${LINGUAS=$ALL_LINGUAS}; do
|
||||
case "$ALL_LINGUAS" in
|
||||
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
|
||||
esac
|
||||
done
|
||||
LINGUAS=$NEW_LINGUAS
|
||||
AC_MSG_RESULT($LINGUAS)
|
||||
fi
|
||||
|
||||
dnl Construct list of names of catalog files to be constructed.
|
||||
if test -n "$LINGUAS"; then
|
||||
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Determine which catalog format we have (if any is needed)
|
||||
dnl For now we know about two different formats:
|
||||
dnl Linux libc-5 and the normal X/Open format
|
||||
test -d intl || mkdir intl
|
||||
if test "$CATOBJEXT" = ".cat"; then
|
||||
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
|
||||
|
||||
dnl Transform the SED scripts while copying because some dumb SEDs
|
||||
dnl cannot handle comments.
|
||||
sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
|
||||
fi
|
||||
dnl po2tbl.sed is always needed.
|
||||
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
|
||||
$srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
|
||||
|
||||
dnl In the intl/Makefile.in we have a special dependency which makes
|
||||
dnl only sense for gettext. We comment this out for non-gettext
|
||||
dnl packages.
|
||||
if test "$PACKAGE" = "gettext"; then
|
||||
GT_NO="#NO#"
|
||||
GT_YES=
|
||||
else
|
||||
GT_NO=
|
||||
GT_YES="#YES#"
|
||||
fi
|
||||
AC_SUBST(GT_NO)
|
||||
AC_SUBST(GT_YES)
|
||||
|
||||
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
|
||||
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
|
||||
dnl Try to locate is.
|
||||
MKINSTALLDIRS=
|
||||
if test $ac_aux_dir; then
|
||||
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
|
||||
fi
|
||||
if test -z $MKINSTALLDIRS; then
|
||||
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
|
||||
fi
|
||||
AC_SUBST(MKINSTALLDIRS)
|
||||
|
||||
dnl Generate list of files to be processed by xgettext which will
|
||||
dnl be included in po/Makefile.
|
||||
test -d po || mkdir po
|
||||
if test "x$srcdir" != "x."; then
|
||||
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
|
||||
posrcprefix="$srcdir/"
|
||||
else
|
||||
posrcprefix="../$srcdir/"
|
||||
fi
|
||||
else
|
||||
posrcprefix="../"
|
||||
fi
|
||||
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||
])
|
||||
12
m4/header.m4
12
m4/header.m4
@@ -1,12 +0,0 @@
|
||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
||||
|
||||
AC_DEFUN(AM_CONFIG_HEADER,
|
||||
[AC_PREREQ([2.12])
|
||||
AC_CONFIG_HEADER([$1])
|
||||
dnl When config.status generates a header, we must update the stamp-h file.
|
||||
dnl This file resides in the same directory as the config header
|
||||
dnl that is generated. We must strip everything past the first ":",
|
||||
dnl and everything past the last "/".
|
||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
||||
test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl
|
||||
changequote([,]))])
|
||||
20
m4/init.m4
20
m4/init.m4
@@ -1,20 +0,0 @@
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
# some checks are only needed if your package does certain things.
|
||||
# But this isn't really a big deal.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version)
|
||||
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AM_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||
VERSION=[$2]
|
||||
AC_SUBST(VERSION)
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
|
||||
AM_SANITY_CHECK
|
||||
AC_ARG_PROGRAM
|
||||
AC_PROG_MAKE_SET])
|
||||
@@ -1,13 +0,0 @@
|
||||
## --------------------------------------------------------- ##
|
||||
## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
|
||||
## substitution. ##
|
||||
## From Franc,ois Pinard ##
|
||||
## --------------------------------------------------------- ##
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_PROG_INSTALL,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||
AC_SUBST(INSTALL_SCRIPT)dnl
|
||||
])
|
||||
@@ -1,14 +0,0 @@
|
||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_LC_MESSAGES,
|
||||
[if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||
AC_DEFINE(HAVE_LC_MESSAGES)
|
||||
fi
|
||||
fi])
|
||||
@@ -1,38 +0,0 @@
|
||||
## ------------------------
|
||||
## Emacs LISP file handling
|
||||
## From Ulrich Drepper
|
||||
## ------------------------
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_PATH_LISPDIR,
|
||||
[# If set to t, that means we are running in a shell under Emacs.
|
||||
# If you have an Emacs named "t", then use the full path.
|
||||
test "$EMACS" = t && EMACS=
|
||||
AC_PATH_PROG(EMACS, emacs xemacs, no)
|
||||
if test $EMACS != "no"; then
|
||||
AC_MSG_CHECKING([where .elc files should go])
|
||||
dnl Set default value
|
||||
lispdir="\$(datadir)/emacs/site-lisp"
|
||||
if test "x$prefix" = "xNONE"; then
|
||||
if test -d $ac_default_prefix/share/emacs/site-lisp; then
|
||||
lispdir="\$(prefix)/share/emacs/site-lisp"
|
||||
else
|
||||
if test -d $ac_default_prefix/lib/emacs/site-lisp; then
|
||||
lispdir="\$(prefix)/lib/emacs/site-lisp"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if test -d $prefix/share/emacs/site-lisp; then
|
||||
lispdir="\$(prefix)/share/emacs/site-lisp"
|
||||
else
|
||||
if test -d $prefix/lib/emacs/site-lisp; then
|
||||
lispdir="\$(prefix)/lib/emacs/site-lisp"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT($lispdir)
|
||||
ELCFILES="\$(ELCFILES)"
|
||||
fi
|
||||
AC_SUBST(lispdir)
|
||||
AC_SUBST(ELCFILES)])
|
||||
@@ -1,22 +0,0 @@
|
||||
# Add --enable-maintainer-mode option to configure.
|
||||
# From Jim Meyering
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_MAINTAINER_MODE,
|
||||
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode is disabled by default
|
||||
AC_ARG_ENABLE(maintainer-mode,
|
||||
[ --enable-maintainer-mode enable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer],
|
||||
USE_MAINTAINER_MODE=$enableval,
|
||||
USE_MAINTAINER_MODE=no)
|
||||
AC_MSG_RESULT($USE_MAINTAINER_MODE)
|
||||
if test $USE_MAINTAINER_MODE = yes; then
|
||||
MAINT=
|
||||
else
|
||||
MAINT='#M#'
|
||||
fi
|
||||
AC_SUBST(MAINT)dnl
|
||||
]
|
||||
)
|
||||
75
m4/mktime.m4
75
m4/mktime.m4
@@ -1,75 +0,0 @@
|
||||
#serial 2
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl FIXME: this should migrate into libit.
|
||||
|
||||
AC_DEFUN(AM_FUNC_MKTIME,
|
||||
[AC_REQUIRE([AC_HEADER_TIME])dnl
|
||||
AC_CHECK_HEADERS(sys/time.h)
|
||||
AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
|
||||
[AC_TRY_RUN(
|
||||
changequote(<<, >>)dnl
|
||||
<</* Test program from Paul Eggert (eggert@twinsun.com)
|
||||
and Tony Leneis (tony@plaza.ds.adp.com). */
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# if HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static time_t time_t_max;
|
||||
|
||||
/* Values we'll use to set the TZ environment variable. */
|
||||
static const char *const tz_strings[] = {
|
||||
NULL, "GMT0", "JST-9", "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
|
||||
};
|
||||
#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
|
||||
|
||||
static void
|
||||
mktime_test (now)
|
||||
time_t now;
|
||||
{
|
||||
if (mktime (localtime (&now)) != now)
|
||||
exit (1);
|
||||
now = time_t_max - now;
|
||||
if (mktime (localtime (&now)) != now)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
time_t t, delta;
|
||||
int i;
|
||||
|
||||
for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
|
||||
continue;
|
||||
time_t_max--;
|
||||
delta = time_t_max / 997; /* a suitable prime number */
|
||||
for (i = 0; i < N_STRINGS; i++)
|
||||
{
|
||||
if (tz_strings[i])
|
||||
putenv (tz_strings[i]);
|
||||
|
||||
for (t = 0; t <= time_t_max - delta; t += delta)
|
||||
mktime_test (t);
|
||||
mktime_test ((time_t) 60 * 60);
|
||||
mktime_test ((time_t) 60 * 60 * 24);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
>>,
|
||||
changequote([, ])dnl
|
||||
am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
|
||||
dnl When crosscompiling, assume mktime is missing or broken.
|
||||
am_cv_func_working_mktime=no)
|
||||
])
|
||||
if test $am_cv_func_working_mktime = no; then
|
||||
LIBOBJS="$LIBOBJS mktime.o"
|
||||
fi
|
||||
])
|
||||
@@ -1,15 +0,0 @@
|
||||
dnl From Jim Meyering.
|
||||
dnl FIXME: migrate into libit.
|
||||
|
||||
AC_DEFUN(AM_FUNC_OBSTACK,
|
||||
[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
|
||||
[AC_TRY_LINK([#include "obstack.h"],
|
||||
[struct obstack *mem;obstack_free(mem,(char *) 0)],
|
||||
am_cv_func_obstack=yes,
|
||||
am_cv_func_obstack=no)])
|
||||
if test $am_cv_func_obstack = yes; then
|
||||
AC_DEFINE(HAVE_OBSTACK)
|
||||
else
|
||||
LIBOBJS="$LIBOBJS obstack.o"
|
||||
fi
|
||||
])
|
||||
@@ -1,42 +0,0 @@
|
||||
# Search path for a program which passes the given test.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
/*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test -n "[$]$1"; then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
25
m4/protos.m4
25
m4/protos.m4
@@ -1,25 +0,0 @@
|
||||
## ------------------------------- ##
|
||||
## Check for function prototypes. ##
|
||||
## From Franc,ois Pinard ##
|
||||
## ------------------------------- ##
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_C_PROTOTYPES,
|
||||
[AC_REQUIRE([AM_PROG_CC_STDC])
|
||||
AC_BEFORE([$0], [AC_C_INLINE])
|
||||
AC_MSG_CHECKING([for function prototypes])
|
||||
if test "$am_cv_prog_cc_stdc" != no; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(PROTOTYPES)
|
||||
U= ANSI2KNR=
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
U=_ ANSI2KNR=./ansi2knr
|
||||
# Ensure some checks needed by ansi2knr itself.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(string.h)
|
||||
fi
|
||||
AC_SUBST(U)dnl
|
||||
AC_SUBST(ANSI2KNR)dnl
|
||||
])
|
||||
@@ -1,12 +0,0 @@
|
||||
# From Ulrich Drepper.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_TYPE_PTRDIFF_T,
|
||||
[AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
|
||||
[AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
|
||||
am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
|
||||
if test $am_cv_type_ptrdiff_t = yes; then
|
||||
AC_DEFINE(HAVE_PTRDIFF_T)
|
||||
fi
|
||||
])
|
||||
44
m4/putenv.m4
Normal file
44
m4/putenv.m4
Normal file
@@ -0,0 +1,44 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl
|
||||
dnl Check whether putenv ("FOO") removes FOO from the environment.
|
||||
dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that.
|
||||
dnl
|
||||
dnl If you use this macro in a package, you should
|
||||
dnl add the following two lines to acconfig.h:
|
||||
dnl /* Define to rpl_putenv if the replacement function should be used. */
|
||||
dnl #undef putenv
|
||||
dnl
|
||||
|
||||
AC_DEFUN(jm_FUNC_PUTENV,
|
||||
[AC_CACHE_CHECK([for SVID conformant putenv], jm_cv_func_svid_putenv,
|
||||
[AC_TRY_RUN([
|
||||
int
|
||||
main ()
|
||||
{
|
||||
/* Put it in env. */
|
||||
if (putenv ("CONFTEST_putenv=val"))
|
||||
exit (1);
|
||||
|
||||
/* Try to remove it. */
|
||||
if (putenv ("CONFTEST_putenv"))
|
||||
exit (1);
|
||||
|
||||
/* Make sure it was deleted. */
|
||||
if (getenv ("CONFTEST_putenv") != 0)
|
||||
exit (1);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
],
|
||||
jm_cv_func_svid_putenv=yes,
|
||||
jm_cv_func_svid_putenv=no,
|
||||
dnl When crosscompiling, assume putenv is broken.
|
||||
jm_cv_func_svid_putenv=no)
|
||||
])
|
||||
if test $jm_cv_func_svid_putenv = no; then
|
||||
LIBOBJS="$LIBOBJS putenv.o"
|
||||
AC_DEFINE_UNQUOTED(putenv, rpl_putenv)
|
||||
fi
|
||||
])
|
||||
37
m4/regex.m4
37
m4/regex.m4
@@ -1,37 +0,0 @@
|
||||
## --------------------------------- ##
|
||||
## Check if --with-regex was given. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# serial 1
|
||||
|
||||
# The idea is to distribute rx.[hc] and regex.[hc] together, for a while.
|
||||
# The WITH_REGEX symbol (which should also be documented in acconfig.h)
|
||||
# is used to decide which of regex.h or rx.h should be included in the
|
||||
# application. If `./configure --with-regex' is given (the default), the
|
||||
# package will use gawk's regex. If `./configure --without-regex', a
|
||||
# check is made to see if rx is already installed, as with newer Linux'es.
|
||||
# If not found, the package will use the rx from the distribution.
|
||||
# If found, the package will use the system's rx which, on Linux at least,
|
||||
# will result in a smaller executable file.
|
||||
|
||||
AC_DEFUN(AM_WITH_REGEX,
|
||||
[AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted)
|
||||
AC_ARG_WITH(regex,
|
||||
[ --without-regex use GNU rx in lieu of gawk's regex for matching],
|
||||
[test "$withval" = yes && am_with_regex=1],
|
||||
[am_with_regex=1])
|
||||
if test -n "$am_with_regex"; then
|
||||
AC_MSG_RESULT(regex)
|
||||
AC_DEFINE(WITH_REGEX)
|
||||
AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
|
||||
AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1],
|
||||
am_cv_gnu_regex=yes, am_cv_gnu_regex=no))
|
||||
if test $am_cv_gnu_regex = no; then
|
||||
LIBOBJS="$LIBOBJS regex.o"
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(rx)
|
||||
AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
|
||||
fi
|
||||
AC_SUBST(LIBOBJS)dnl
|
||||
])
|
||||
19
m4/sanity.m4
19
m4/sanity.m4
@@ -1,19 +0,0 @@
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
AC_DEFUN(AM_SANITY_CHECK,
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
echo timestamp > conftestfile
|
||||
# Do this in a subshell so we don't clobber the current shell's
|
||||
# arguments. FIXME: maybe try `-L' hack like GETLOADAVG test?
|
||||
if (set X `ls -t $srcdir/configure conftestfile`; test "[$]2" = conftestfile)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
rm -f conftest*
|
||||
AC_MSG_RESULT(yes)])
|
||||
69
m4/strtod.m4
69
m4/strtod.m4
@@ -1,69 +0,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.
|
||||
|
||||
## From Jim Meyering.
|
||||
|
||||
## serial 1
|
||||
|
||||
## @defmac AC_FUNC_STRTOD
|
||||
## @maindex FUNC_STRTOD
|
||||
## @ovindex LIBOBJS
|
||||
## If the @code{strtod} function is not available, or does not work
|
||||
## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
|
||||
## variable @code{LIBOBJS}.
|
||||
## @end defmac
|
||||
|
||||
AC_DEFUN(AM_FUNC_STRTOD,
|
||||
[AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
|
||||
[AC_TRY_RUN([
|
||||
double strtod ();
|
||||
int
|
||||
main()
|
||||
{
|
||||
{
|
||||
/* Some versions of Linux strtod mis-parse strings with leading '+'. */
|
||||
char *string = " +69";
|
||||
char *term;
|
||||
double value;
|
||||
value = strtod (string, &term);
|
||||
if (value != 69 || term != (string + 4))
|
||||
exit (1);
|
||||
}
|
||||
|
||||
{
|
||||
/* Under Solaris 2.4, strtod returns the wrong value for the
|
||||
terminating character under some conditions. */
|
||||
char *string = "NaN";
|
||||
char *term;
|
||||
strtod (string, &term);
|
||||
if (term != string && *(term - 1) == 0)
|
||||
exit (1);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)])
|
||||
test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
|
||||
AC_SUBST(LIBOBJS)dnl
|
||||
am_cv_func_strtod_needs_libm=no
|
||||
if test $am_cv_func_strtod = no; then
|
||||
AC_CHECK_FUNCS(pow)
|
||||
if test $ac_cv_func_pow = no; then
|
||||
AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes],
|
||||
[AC_MSG_WARN(can't find library containing definition of pow)])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
@@ -1,14 +0,0 @@
|
||||
dnl From Jim Meyering.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_SYS_POSIX_TERMIOS,
|
||||
[AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
|
||||
[AC_TRY_LINK([#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>],
|
||||
[/* SunOS 4.0.3 has termios.h but not the library calls. */
|
||||
tcgetattr(0, 0);],
|
||||
am_cv_sys_posix_termios=yes,
|
||||
am_cv_sys_posix_termios=no)])
|
||||
])
|
||||
35
m4/winsz.m4
35
m4/winsz.m4
@@ -1,35 +0,0 @@
|
||||
dnl From Jim Meyering.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
|
||||
[AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
|
||||
AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
|
||||
am_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
|
||||
[am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
|
||||
|
||||
gwinsz_in_termios_h=no
|
||||
if test $am_cv_sys_posix_termios = yes; then
|
||||
AC_EGREP_CPP([yes],
|
||||
[#include <sys/types.h>
|
||||
# include <termios.h>
|
||||
# ifdef TIOCGWINSZ
|
||||
yes
|
||||
# endif
|
||||
], gwinsz_in_termios_h=yes)
|
||||
fi
|
||||
|
||||
if test $gwinsz_in_termios_h = no; then
|
||||
AC_EGREP_CPP([yes],
|
||||
[#include <sys/types.h>
|
||||
# include <sys/ioctl.h>
|
||||
# ifdef TIOCGWINSZ
|
||||
yes
|
||||
# endif
|
||||
], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
|
||||
fi
|
||||
])
|
||||
if test $am_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
|
||||
AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
|
||||
fi
|
||||
])
|
||||
@@ -1,3 +1,354 @@
|
||||
1997-07-09 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/makepath.c (make_path): Chdir to `/' before starting if necessary.
|
||||
Call save_cwd before while loop rather than from first iteration
|
||||
inside it.
|
||||
|
||||
* lib/strverscmp.c (strverscmp): Add `parenentheses around arithmetic
|
||||
in operand of |' as suggested by gcc -Wall.
|
||||
|
||||
1997-07-06 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/idcache.c (getuidbyname): Declare parameter to be const.
|
||||
(getgidbyname): Declare parameter to be const.
|
||||
|
||||
* lib/modechange.h (mode_create_from_ref): Add prototype.
|
||||
(MODE_MASK_ALL): New define.
|
||||
(MODE_BAD_REFERENCE): New define.
|
||||
* lib/modechange.c (mode_create_from_ref): New function.
|
||||
* lib/strverscmp.c: New file.
|
||||
* lib/strverscmp.h: New file.
|
||||
* lib/Makefile.am (noinst_HEADERS): Add strverscmp.h.
|
||||
|
||||
* configure.in (AC_REPLACE_FUNCS): Add strverscmp.
|
||||
|
||||
1997-05-30 Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>
|
||||
* src/ls.c: Add new option: --sort=version (-v).
|
||||
* src/chgrp.c: Add new option: --reference=FILE.
|
||||
* src/chown.c: Add new option: --reference=FILE.
|
||||
* src/chmod.c: Add new option: --reference=FILE.
|
||||
|
||||
1997-07-06 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/idcache.c (getuser): Return NULL (rather than stringified uid)
|
||||
upon lookup failure.
|
||||
(getgroup): Likewise.
|
||||
(getuidbyname) [NOT_USED]: #ifdef-out unused function.
|
||||
(getgidbyname) [NOT_USED]: #ifdef-out unused function.
|
||||
Suggested by François Pinard.
|
||||
* src/ls.c (print_long_format): Reflect changes in semantics of
|
||||
getuser, getgroup.
|
||||
|
||||
1997-07-04 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Makefile.am (aclocal-files): Look in source directory, not build dir.
|
||||
From Andreas Schwab.
|
||||
|
||||
1997-07-03 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/mv.c (apply_attributes): New function.
|
||||
(copy_reg): Use apply_attributes instead of open-coding the pieces.
|
||||
Now, failure to preserve file attributes does not cause mv to change
|
||||
its exit status, and such failures elicit warning diagnostics. This
|
||||
behavior is required by POSIX. Before, failure to preserve ownership
|
||||
due to insufficient access was diagnosed only for root.
|
||||
Prompted by a report from Bengt Martensson.
|
||||
|
||||
Tue Jul 1 06:42:17 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/makepath.c (make_path): Reorder stat-then-mkdir-if-missing
|
||||
calls so that mkdir is called first. Before make_path would first
|
||||
`stat' a directory, then call mkdir if it didn't exist. But if
|
||||
some other process created the directory between the stat & mkdir,
|
||||
the mkdir would fail with EEXIST. Diagnosis and suggestion from
|
||||
Greg McGary.
|
||||
|
||||
Sun Jun 29 17:19:30 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/dd.c (copy): Add FIXME comment.
|
||||
|
||||
* src/mv.c (copy_reg): New parameter, SOURCE_STATS.
|
||||
(do_move): Update caller.
|
||||
|
||||
Sun Jun 22 08:32:46 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
Use variable width columns when printing in multi-column mode.
|
||||
* src/ls.c: (init_col_info): New function.
|
||||
(print_current_files): Call init_col_info if format is
|
||||
`many_per_line' or `horizontal'.
|
||||
(print_many_per_line): Calculate and apply optimum column widths.
|
||||
(print_horizontal): Likewise.
|
||||
From Ulrich Drepper.
|
||||
|
||||
* src/mv.c (movefile): Take new boolean parameter, DEST_IS_DIR,
|
||||
to save a stat per moved file when the destination is a directory.
|
||||
(main): Call movefile with additional argument.
|
||||
(strip_trailing_slashes_2): New function.
|
||||
(movefile): Remove trailing slashes from dest. Otherwise, stat ("b/")
|
||||
fails with ENOTDIR on systems including Linux w/libc 2.0.30.
|
||||
Reproduce with `rm -rf a b; mkdir a; touch b; ./mv a b/'.
|
||||
(do_move): Fix misleading comment.
|
||||
|
||||
Sat Jun 21 21:26:57 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* configure.in: Remove now-unused definitions of LN, MV, RM.
|
||||
|
||||
Sun Jun 15 07:04:29 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/full-write.c (full_write): Add comment regarding failure due
|
||||
to bug in Linux Slackware 1.2.13 kernel.
|
||||
|
||||
* lib/makepath.c: Rewrite using save-cwd.c and chdir to remove
|
||||
quadratic component of complexity. Before, it processed O(n^2)
|
||||
directory name components via stat and mkdir. Now it's O(n).
|
||||
This makes mkdir -p a lot more efficient when creating directories
|
||||
with very many components. On a Linux 2.0.30 ext2fs filesystem
|
||||
this command: mkdir -p `perl -e 'print "a/" x 500'` now runs in
|
||||
0.77 seconds (user+sys). Contrast that with the 9.5(!) seconds
|
||||
it took before.
|
||||
|
||||
Sat Jun 14 11:40:17 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* man/Makefile.am: (EXTRA_DIST): Put man_MANS here so they are
|
||||
distributed. This is necessary for automake-1.1p.
|
||||
|
||||
Tue Jun 3 15:00:00 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/fileblocks.c [HAVE_UNISTD_H]: Include unistd.h.
|
||||
John Gatewood Ham reported that this is necessary for DJGPP/Win95.
|
||||
|
||||
Wed May 28 06:35:56 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/mountlist.c (read_filesystem_list): Add `|| defined (__OpenBSD__)'
|
||||
to the NetBSD #if so OpenBSD also uses the f_fstypename member.
|
||||
(fstype_to_string): Add `&& !defined (__OpenBSD__)' to the NetBSD #if
|
||||
expression to exclude this function definition. OpenBSD 2.1 beta
|
||||
doesn't need it. Patch from Hugh Daniel <hugh@ecotone.xanadu.com>
|
||||
|
||||
Tue May 27 04:35:17 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/cp.c: Use base_name, not basename.
|
||||
* src/dircolors.c: Likewise.
|
||||
* src/install.c: Likewise.
|
||||
* src/ln.c: Likewise.
|
||||
* src/mv.c: Likewise.
|
||||
* src/mvdir.c: Likewise.
|
||||
* src/rm.c: Likewise.
|
||||
|
||||
* configure.in: Add AC_SYS_LONG_FILE_NAMES.
|
||||
Check for pathconf.
|
||||
Don't replace basename. Now we use only base_name.
|
||||
Clean up kludge that worked around a bug (now-fixed) in automake.
|
||||
|
||||
* lib/argmatch.h Change dcl of program_name so it doesn't conflict
|
||||
with the ubiquitous char* one.
|
||||
|
||||
* lib/addext.c: New file.
|
||||
* lib/Makefile.am (libfu_a_SOURCES): Add addext.c.
|
||||
Remove getversion.c; get_version is now in backupfile.c.
|
||||
Add basename.c since it's no longer replacible.
|
||||
|
||||
* lib/getopt.c: Update from glibc via patch-2.2.93.
|
||||
* lib/getopt1.c: Likewise.
|
||||
* lib/getopt.h: Likewise.
|
||||
* lib/argmatch.h: Update from FSF via patch-2.2.93.
|
||||
* lib/argmatch.c: Likewise.
|
||||
* lib/backupfile.c: Likewise.
|
||||
* lib/backupfile.h: Likewise.
|
||||
* lib/basename.c: Likewise.
|
||||
|
||||
Sun May 25 09:21:01 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/copy.c (copy_internal): When preserving symlinks
|
||||
(--no-dereference) and the destination file is a symlink,
|
||||
use stat (not xstat) to see if it points back to the source.
|
||||
Reported by James <james@albion.glarp.com>.
|
||||
|
||||
* src/du.c: Remove global variable opt_human_readable.
|
||||
(enum Output_units): Rename from output_size.
|
||||
Rename size_* to Unit_*.
|
||||
Add Unit_variable to correspond to --human-readable.
|
||||
(convert_blocks): Remove now-unused definition.
|
||||
(human_readable): Rename paramater n_bytes to n_blocks.
|
||||
Adjust conversions to reflect fact that input is now number of
|
||||
512-byte blocks, not bytes.
|
||||
(print_size): New function.
|
||||
(du_files): Use print_size instead of open coding it.
|
||||
(count_entry): Always count in units of 512-byte blocks to delay.
|
||||
This lets du accumulate totals corresponding to a terabyte before
|
||||
overflowing 32-bit long int.
|
||||
Use print_size instead of open coding it.
|
||||
|
||||
Tue Feb 4 11:58:49 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* src/du.c (convert_blocks): Remove now-unnecessary #undef.
|
||||
(du_files): Pass output_size unchanged to convert_blocks. No need
|
||||
to test output_size for size_bytes, convert_blocks handles that
|
||||
correctly.
|
||||
(count_entry): Likewise.
|
||||
|
||||
* src/system.h (convert_blocks): Remove definition.
|
||||
* src/ls.c (convert_blocks): Add definition.
|
||||
|
||||
Sun May 25 09:11:17 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/du.c [AIX]: Remove unused #pragma alloca.
|
||||
|
||||
Sat May 24 09:20:12 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/rmdir.c: New options: --ignore-fail-on-non-empty and --verbose.
|
||||
(remove_parents): Implement new options.
|
||||
(main): Likewise.
|
||||
|
||||
* lib/mountlist.c (read_filesystem_list): Show automount-related
|
||||
duplicate filesystems only when --all specified. With suggestions
|
||||
from Stuart Kemp. Also indent cpp directives.
|
||||
|
||||
* configure.in (AC_CHECK_FUNCS): Add hasmntopt.
|
||||
(AC_CHECK_HEADERS): Add sys/mntent.h.
|
||||
(ALL_LINGUAS): Add Czech (cs).
|
||||
|
||||
Wed Mar 26 23:43:57 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/du.c (main): Implement new --max-depth=N option.
|
||||
Based on the idea and a patch from Torbjorn Lindgren.
|
||||
(du_files): Likewise.
|
||||
(count_entry): Likewise.
|
||||
|
||||
Sat Mar 22 20:29:10 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* missing: New file -- from the automake-1.1m distribution.
|
||||
|
||||
Fri Mar 21 23:58:12 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Makefile.am (AUTOMAKE_OPTIONS): Require automake-1.1l.
|
||||
(aclocal.m4): Use aclocal's new -I option.
|
||||
|
||||
Thu Mar 13 21:27:36 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/mktime.c: (TIME_T_MIN): Work around a bug in Cray C 5.0.3.0.
|
||||
|
||||
Wed Mar 12 23:11:11 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/chgrp.c (change_file_group): Use uid of -1 to indicate
|
||||
we don't want to change the file's user ID.
|
||||
|
||||
* m4/gettext.m4: Update from gettext-0.10.27.
|
||||
|
||||
* acconfig.h (chown): Add #undef.
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add ko.
|
||||
Use jm_FUNC_CHOWN.
|
||||
* m4/chown.m4: New file.
|
||||
* m4/Makefile.am (EXTRA_DIST): Add chown.m4.
|
||||
* lib/chown.c: New file.
|
||||
* lib/Makefile.am (EXTRA_DIST): Add chown.c.
|
||||
|
||||
Sun Mar 9 22:46:41 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/ls.c (decode_switches): Ignore value of COLUMNS envionment
|
||||
variable when it is the empty string. Suggestion from Ulrich Drepper.
|
||||
This makes it easier on people using shells (which?) with which it
|
||||
is not easy to unset environment variables.
|
||||
|
||||
Wed Feb 26 23:46:39 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getdate.y: (tYEAR_UNIT): Increase yyRelYear by $1, not just by 1.
|
||||
From Andreas Schwab.
|
||||
|
||||
* src/copy.c (copy_internal): When there is any potential for
|
||||
ambiguity in a diagnostic, give explanatory diagnostic in addition
|
||||
to file name.
|
||||
* src/cp.c (re_protect): Likewise.
|
||||
|
||||
Sat Feb 22 14:10:25 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getdate.y
|
||||
(tMONTH_UNIT): Increase yyRelMonth by $1, not just by 1.
|
||||
(tDAY_UNIT): Likewise for yyRelDay.
|
||||
(tHOUR_UNIT): Likewise for yyRelHour.
|
||||
(tMINUTE_UNIT): Likewise for yyRelMinutes.
|
||||
(tSEC_UNIT): Likewise for yyRelSeconds.
|
||||
Matthew S. Levine reported that touch -d yesterday didn't work.
|
||||
|
||||
Thu Feb 20 20:16:59 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/mktime.c: Update from libc.
|
||||
* lib/strtol.c: Update from libc.
|
||||
|
||||
Wed Feb 19 22:06:32 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/ls.c (main): Remove trailing slashes from command line arguments.
|
||||
Otherwise, running `mkdir x; chmod 644 x; ls -d x/' (note the trailing
|
||||
slash) makes ls fail with permission denied on at least Linux 1.2.13
|
||||
and 2.0.14 systems.
|
||||
|
||||
Wed Feb 5 21:54:17 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/ls.c (quote_filename): Allocate two more bytes (for quotes)
|
||||
when using --quote-name (-Q).
|
||||
Feb 2 change wasn't complete. Patch from Mark Harris.
|
||||
|
||||
Mon Feb 3 21:49:55 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* po/POTFILES.in: Add copy.c and cp-hash.c. Remove cp-aux.c.
|
||||
|
||||
Sun Feb 2 09:40:37 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/system.h [__GNUC__]: Don't define alloca to __builtin_alloca.
|
||||
|
||||
* Makefile.am (SUBDIRS): Add tests.
|
||||
|
||||
* configure.in (AC_OUTPUT): Add tests/Makefile and tests/ls/Makefile.
|
||||
* tests: New directory.
|
||||
* tests/ls: New directory.
|
||||
|
||||
* src/ls.c (quote_filename): Don't backslash-escape double quotes.
|
||||
This fixes a problem whereby columns weren't aligned when some files
|
||||
contained double quote characters and ls's --escape (-b) option was
|
||||
used. Reported by Mark Harris.
|
||||
|
||||
* src/cp-hash.c (struct entry): Move dcl to this file from cp.h.
|
||||
(struct htab): Likewise.
|
||||
No longer include cp.h. Instead, include the things it used to
|
||||
include.
|
||||
(hash_insert2): Make function static. Move this function to precede
|
||||
the sole function from which it is called.
|
||||
|
||||
* src/Makefile.am (noinst_HEADERS): Add copy.h, cp-hash.h.
|
||||
Remove cp.h.
|
||||
(EXTRA_DIST): Remove cp-aux.c and cp-hash.c.
|
||||
(cp_SOURCES): Remove cp-aux.c. Add cp-hash.c.
|
||||
* src/cp-aux.c: Remove file.
|
||||
* src/cp.h: Remove file.
|
||||
|
||||
* src/du.c (hash_insert2): Rename local HTAB to HT to avoid shadowing
|
||||
global.
|
||||
|
||||
* src/dircolors.c [obstack_chunk_alloc]: Define to malloc, not xmalloc
|
||||
to work better with new obstack functions.
|
||||
* src/ls.c (obstack_chunk_alloc): Likewise.
|
||||
|
||||
* src/df.c (main): Rename local I to C to avoid shadowing and to
|
||||
be more consistent. Declare I in inner scopes.
|
||||
|
||||
* po/Makefile.in.in (POTFILES): Redirect to an intermediate file
|
||||
and write-protect POTFILES.
|
||||
|
||||
Fri Jan 31 21:13:04 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/chown.c (usage): Make the parenthetical note on --no-dereference
|
||||
a little more general.
|
||||
|
||||
* src/*.c: Compare getopt_long return value against -1, not EOF.
|
||||
Use NULL, not `(int *) 0' as last parameter in getopt_long call.
|
||||
(usage): Bracket bug-reporting address with <> and append a period.
|
||||
|
||||
1997-01-27 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/ls.c (print_long_format): Fix off-by-one problem in size
|
||||
being passed to strftime.
|
||||
|
||||
Sun Jan 26 20:17:50 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Version 3.16.
|
||||
@@ -5043,7 +5394,5 @@ Mon Feb 5 17:29:20 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
|
||||
* Version 1.0 released.
|
||||
|
||||
Local Variables:
|
||||
mode: indented-text
|
||||
left-margin: 8
|
||||
version-control: never
|
||||
End:
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
Changes in release 3.17:
|
||||
* du --megabytes --total now shows total in megabytes
|
||||
* touch -d DATE now works on Unicos
|
||||
* du accepts new option --max-depth=N
|
||||
* rmdir accepts new options: --ignore-fail-on-non-empty and --verbose
|
||||
* du now overflows its accumulator for 1 terabyte directories, not 2GB.
|
||||
* df now works with OpenBSD 2.1 beta
|
||||
* cp -d FILE SYMLINK-TO-FILE doesn't erase FILE. Now it gives an error.
|
||||
|
||||
Changes in release 3.16:
|
||||
[3.15a]
|
||||
* du --megabytes (-m) works
|
||||
* ls -l works even on systems with non-POSIX strftime in their C library
|
||||
|
||||
|
||||
@@ -1,3 +1,288 @@
|
||||
1997-07-12 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* po/Makefile.in.in (DISTFILES): Remove ChangeLog.
|
||||
* po/POTFILES.in: Add who.c, users.c, uptime.c.
|
||||
Remove who-users.c.
|
||||
|
||||
* src/who.c: Rename lots of `this' locals.
|
||||
Make some parameters `const'.
|
||||
(who): Update read_utmp caller.
|
||||
(search_entries): Take additional param: utmp_buf.
|
||||
Update read_utmp caller.
|
||||
(who_am_i): Update read_utmp caller.
|
||||
|
||||
* src/users.c (users): Update read_utmp caller.
|
||||
* src/uptime.c (uptime): Update read_utmp caller.
|
||||
|
||||
* lib/readutmp.h (PARAMS): Update prototype.
|
||||
(utmp_contents): Remove dcl.
|
||||
|
||||
* lib/readutmp.c (read_utmp): Take new params: count and buffer.
|
||||
Return boolean indicating failure.
|
||||
Now, caller must give diagnostic upon.
|
||||
|
||||
1997-07-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* lib/readutmp.c, lib/readutmp.h: New files implementing shared
|
||||
functionality from src/who-users.c.
|
||||
|
||||
* lib/Makefile.am (libsu_a_SOURCES): Add readutmp.c.
|
||||
(noinst_HEADERS): Add readutmp.h.
|
||||
|
||||
* src/who.c, src/users.c, src/uptime.c: Split these so they no
|
||||
longer derive from the template source file who-users.c. Use
|
||||
shared functionality from lib/readutmp.c instead.
|
||||
|
||||
* src/Makefile.am: Remove rules to build who.c, users.c and
|
||||
uptime.c from template source file who-users.c. Handle these
|
||||
files as stand-alone sources.
|
||||
|
||||
* src/who-users.c: Remove file. It is no longer used.
|
||||
|
||||
1997-07-12 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/date.c (MAYBE_SET_TZ_UTC0): New macro.
|
||||
(set_tz): New function.
|
||||
(batch_convert): If necessary, save the initial value of TZ and
|
||||
for each date in the file, restore it before each call to get_date,
|
||||
then set it to UTC0 before each show_date call.
|
||||
(main): Don't set TZ before calling get_date.
|
||||
Set TZ after get_date call and before show_date call.
|
||||
Reported by Matthew Braun.
|
||||
* tests/date/Test.pm: Add new tests for this bug.
|
||||
Add tests based on new examples in documentation.
|
||||
|
||||
* stpcpy.c: New file.
|
||||
* configure.in (AC_REPLACE_FUNCS): Add stpcpy.c
|
||||
|
||||
1997-07-05 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/Makefile.am (EXTRA_PROGRAMS): Add su here.
|
||||
(bin_PROGRAMS): Remove su here.
|
||||
(install-exec-local): Rewrite rule so that su is installed only if
|
||||
it can be made setuid root. Before it was always installed and then
|
||||
removed if it could *not* be made setuid root. That had the potential
|
||||
undesirable side effect of removing (and not replacing) a working
|
||||
version of su.
|
||||
(all_local): New target. Dependend on su. Required now that su is
|
||||
no longer in bin_PROGRAMS.
|
||||
(uninstall-local): Remove su only if it comes from the GNU sh-utils.
|
||||
|
||||
* src/su.c: Redefine/undef getusershell around inclusion of <unistd.h>
|
||||
(via system.h) so Cray's int-returning prototype doesn't conflict
|
||||
with our char*-returning one. Reported by Johan Danielsson.
|
||||
|
||||
1997-07-04 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/Makefile.am.in (Makefile.am): Clean up and enable rule to
|
||||
generate tests/*/Makefile.am.
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add Norwegian (no).
|
||||
|
||||
* tests/date/mk-script.pl (validate): Create test files in $(srcdir),
|
||||
not in build dir.
|
||||
* tests/Makefile.am.in ($x-tests): Create $x-tests in $(srcdir),
|
||||
not in build dir.
|
||||
* Makefile.am (aclocal-files): Look in source directory, not build dir.
|
||||
From Andreas Schwab.
|
||||
|
||||
1997-07-03 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/date/Test.pm (test_vector): Remove bogus TZ=GMT environment
|
||||
setting.
|
||||
|
||||
Wed Jul 2 11:05:09 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/printf.c (STRTOX): Convert function header in macro definition
|
||||
to K&R-style. Otherwise, ansi2knr would fail to convert the function
|
||||
definitions to K&R for old style compilers. From Kaveh Ghazi.
|
||||
|
||||
Tue Jul 1 06:28:00 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/putenv.c [putenv]: Undefine before including system headers.
|
||||
Otherwise, the declaration of *rpl_putenv* conflicts with the system
|
||||
prototype on at least Irix5.3. From Marcus Daniels.
|
||||
|
||||
Sun Jun 29 07:18:25 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/putenv.c (rpl_putenv): Renamed from putenv.
|
||||
[putenv]: Remove definition and subsequent #undef hack that avoided
|
||||
conflicts with system prototypes. That didn't let the definition of
|
||||
putenv to rpl_putenv from config.h get through.
|
||||
Suggestion from Marcus Daniels.
|
||||
|
||||
* configure.in (LIB_CRYPT): AC_SUBST new variable. Use it to add
|
||||
crypt-related library (-lufc or -lcrypt) only for the program that
|
||||
needs it (su), rather than to all executables.
|
||||
* src/Makefile.am (su_LDADD): Set to `$(LDADD) @LIB_CRYPT@'.
|
||||
Suggestion from Ulrich Drepper.
|
||||
|
||||
* tests/date/mk-script.pl: Set and export LANGUAGE, LC_ALL, and LANG
|
||||
so tests get english strings. From Ulrich Drepper.
|
||||
|
||||
Mon Jun 16 11:06:57 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* m4/putenv.m4 (jm_FUNC_PUTENV): New file and macro.
|
||||
* configure.in (jm_FUNC_PUTENV): Use it.
|
||||
* acconfig.h (putenv): Add #undef.
|
||||
* lib/Makefile.am (EXTRA_DIST): Add putenv.c.
|
||||
(libsu_a_SOURCES): Remove putenv.c.
|
||||
* m4/Makefile.am (EXTRA_DIST): Add putenv.m4.
|
||||
|
||||
Thu Jun 12 06:48:23 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/expr.c (eval6): Accept new unary operator, quote.
|
||||
From Karl Heuer.
|
||||
|
||||
Wed Jun 11 15:13:56 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/expr.c (docolon): Test (re_buffer.re_nsub > 0) rather than
|
||||
searching for `\(' to determine whether to return 0 or the empty
|
||||
string. Before it would improperly return '' if the pattern
|
||||
contained a substring like this: `\\('. From Karl Heuer.
|
||||
For example, running expr c : '\\(' should print `0'.
|
||||
|
||||
Sun Jun 1 12:00:10 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getdate.y (OtherTable): Interpret `next' as 1 (not 2) units.
|
||||
Patch from Richard Sharman <rsharman@magmacom.com>.
|
||||
* tests/date/Test.pm: Add tests using `next'.
|
||||
|
||||
Tue May 27 06:08:06 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/basename.c: Don't include backupfile.h.
|
||||
|
||||
* lib/Makefile.am (noinst_HEADERS): Add backupfile.h.
|
||||
|
||||
* src/basename.c: Use base_name, not basename.
|
||||
* src/su.c: Use base_name, not basename.
|
||||
|
||||
* configure.in: Don't replace basename. Now it's always required.
|
||||
|
||||
* lib/Makefile.am (libsu_a_SOURCES): Add basename.c.
|
||||
|
||||
* lib/getopt.c: Update from glibc via patch-2.2.93.
|
||||
* lib/getopt1.c: Likewise.
|
||||
* lib/getopt.h: Likewise.
|
||||
* lib/basename.c: Likewise.
|
||||
|
||||
Sat May 24 13:26:04 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* man/Makefile.am (EXTRA_DIST): Put man_MANS here so they are
|
||||
distributed. This seems to be necessary for automake-1.1p.
|
||||
|
||||
Thu May 1 00:10:11 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* ansi2knr.c echo.c factor.c hostname.c id.c nice.c pathchk.c
|
||||
spline.c test.c uname.c: Indent cpp-directives.
|
||||
|
||||
* src/system.h (N_): Define.
|
||||
|
||||
Sun Apr 27 18:30:53 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/printf.c: (cfcc_msg): File-scope constant.
|
||||
(STRTOX): Use new constant as error message format string in macro.
|
||||
Suggestion from Andreas Schwab.
|
||||
(STRTOX): Don't fail because of extra character(s) following a
|
||||
character constant. Give the *warning* only if !POSIXLY_CORRECT.
|
||||
|
||||
Sun Apr 6 14:29:14 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/printf.c: Reorder functions to obviate forward decls.
|
||||
Change most char* dcls to const char*.
|
||||
(STRTOX): New macro to eliminate code duplication.
|
||||
(xstrtod, xstrtol, xstrtoul): Remove functions.
|
||||
Use the STRTOX instead.
|
||||
|
||||
* src/printf.c: (STRTOX): Interpret arguments like 'a and "a
|
||||
as POSIX requires. Derived from a patch by Dennis Henriksen.
|
||||
|
||||
Sun Mar 23 15:20:17 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add polish (pl).
|
||||
|
||||
Sat Mar 22 00:03:02 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Makefile.am (AUTOMAKE_OPTIONS): Require automake-1.1l.
|
||||
(aclocal.m4): Use aclocal's new -I option.
|
||||
|
||||
* missing: New file -- from the automake-1.1m distribution.
|
||||
|
||||
Thu Mar 20 21:10:44 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* m4/ccstdc.m4: Remove file.
|
||||
* m4/init.m4: Likewise.
|
||||
* m4/sanity.m: Likewise.
|
||||
* m4/protos.m: Likewise.
|
||||
* m4/dmalloc.m4: Likewise.
|
||||
* m4/error.m4: Likewise.
|
||||
* m4/header.m4: Likewise.
|
||||
* m4/install.m4: Likewise.
|
||||
* m4/lispdir.m4: Likewise.
|
||||
* m4/maintainer.m4: Likewise.
|
||||
* m4/obstack.m4: Likewise.
|
||||
* m4/ptrdiff.m4: Likewise.
|
||||
* m4/regex.m4: Likewise.
|
||||
* m4/strtod.m4: Likewise.
|
||||
* m4/termios.m4: Likewise.
|
||||
* m4/winsz.m4: Likewise.
|
||||
|
||||
Tue Mar 18 06:46:54 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/su.c: Indent cpp-directives to reflect nesting.
|
||||
Change a few #ifdef to #if.
|
||||
Remove 3 spurious #ifdef that were guarding an #undef each.
|
||||
|
||||
* src/seq.c (check_format): Rename local, FORMAT_STRING, to avoid
|
||||
shadowing global.
|
||||
(print_numbers): Likewise.
|
||||
|
||||
* src/who-users.c (idle_string): Rename local, IDLE, to avoid
|
||||
shadowing global.
|
||||
|
||||
* src/su.c (log_su): Resort to getpwuid if getlogin fails.
|
||||
If no tty name is found, use `none' in the log message.
|
||||
Based on a patch from Galen Hazelwood.
|
||||
|
||||
Thu Mar 13 21:27:36 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/mktime.c: (TIME_T_MIN): Work around a bug in Cray C 5.0.3.0.
|
||||
|
||||
Wed Feb 19 23:06:46 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/factor.c (factor): Rewrite inner loop to be more efficient.
|
||||
Patch from Torbjorn Granlund.
|
||||
|
||||
Tue Feb 18 21:18:04 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/date/Test.pm: Add tests for %U, %V, and %W and for a bug
|
||||
fixed on 1996-03-05.
|
||||
Remove misleading `-' from leap-1 test.
|
||||
|
||||
* tests/Makefile.am (SUBDIRS): Add factor.
|
||||
* tests/factor: New directory.
|
||||
* configure.in (AC_OUTPUT): Add tests/factor/Makefile.
|
||||
|
||||
Tue Feb 4 22:03:13 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/stty.c: Bracket inclusion of termios.h with #if HAVE_TERMIOS_H.
|
||||
Masami Takikawa reported that NeXTStep 3.0 doesn't have termios.h.
|
||||
* configure.in (AC_CHECK_HEADERS): Add termios.h.
|
||||
|
||||
Fri Jan 31 21:13:13 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/*.c (usage): Bracket bug-reporting address with <> and append
|
||||
a period.
|
||||
* src/*.sh: Likewise.
|
||||
|
||||
* src/*.c: Compare getopt_long return value against -1, not EOF.
|
||||
Use NULL, not `(int *) 0' as last parameter in getopt_long call.
|
||||
|
||||
Mon Jan 27 21:43:50 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/chroot.c (usage): Remove one space in message to make
|
||||
colons line up.
|
||||
|
||||
Sun Jan 26 12:51:05 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Version 1.16.
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
Changes in release 1.17
|
||||
[1.16c]
|
||||
* date -u -d DATE now prints the correct date
|
||||
* don't remove already-installed su unless it is possible to install the
|
||||
new one setuid root.
|
||||
[1.16b]
|
||||
[1.16a]
|
||||
* expr accepts new unary operator, quote.
|
||||
* expr now returns 0 for failed matches where pattern contained e.g., `\\('
|
||||
* date -d DATE now works on Unicos systems
|
||||
* add tests for factor and more for date.
|
||||
* factor runs a lot faster for large 64-bit inputs
|
||||
* date works with relative offsets involving the `next' keyword
|
||||
|
||||
Changes in release 1.16
|
||||
1.15a
|
||||
* stty -tabs works properly
|
||||
* add tests for date
|
||||
* date --date "02/29/1996 - 1 year" now works properly
|
||||
|
||||
Changes in release 1.15
|
||||
* nice works with very recently-changed GNU libc getopt
|
||||
|
||||
@@ -1,3 +1,153 @@
|
||||
1997-07-05 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/tail.c (parse_obsolescent_option): If POSIXLY_CORRECT is set, give
|
||||
a diagnostic and fail when there are two or more non-option arguments.
|
||||
|
||||
1997-07-04 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/tac/mk-script.pl: Redirect output of cmp to /dev/null.
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add Norwegian (no).
|
||||
|
||||
* Makefile.am (aclocal-files): Look in source directory, not build dir.
|
||||
From Andreas Schwab.
|
||||
|
||||
Sun Jun 15 06:36:41 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/pr.c (init_header) [T_BUF_FMT]: Output the 4-digit year (not the
|
||||
2-digit abbreviation) in each page header. Reported by Noah Friedman.
|
||||
|
||||
Sat Jun 14 12:29:12 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/cut.c (cut_fields): Detect when the input is empty and handle
|
||||
that special case. Before `cut -f1 < /dev/null' would improperly
|
||||
output a single newline. Reported by Phil Richards.
|
||||
|
||||
Sun Apr 27 15:10:58 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* man/Makefile.am (DISTFILES): Add $(man_MANS).
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add Czech (cs) and Swedish (sv).
|
||||
|
||||
Thu Apr 3 21:14:02 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* m4/Makefile.am (EXTRA_DIST): Update file list.
|
||||
|
||||
* tests/cut-test/Test.pm: Add test from Phil Richards.
|
||||
|
||||
Sat Mar 22 20:29:10 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* missing: New file -- from the automake-1.1m distribution.
|
||||
|
||||
Fri Mar 21 23:56:41 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Makefile.am (AUTOMAKE_OPTIONS): Require automake-1.1l.
|
||||
(aclocal.m4): Use aclocal's new -I option.
|
||||
|
||||
Thu Mar 13 21:46:04 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/tr.c (main): Make sure c1 is not -1 before using it as an
|
||||
array index. Patch from Greg McGary. Although this is truly a
|
||||
bug, I believe it would not cause tr to misbehave on most systems.
|
||||
I could not construct a test case with which this bug causes tr
|
||||
to generate invalid output.
|
||||
|
||||
* tests/pr-test/Test.pm: Add test that -o 0 works.
|
||||
|
||||
* src/pr.c (main): Allow use of 0 (zero) as the margin offset
|
||||
argument to the -o option. Patch from Gary Anderson.
|
||||
|
||||
Fri Feb 28 22:32:51 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/uniq.c (usage): Fix typo in --help output. From Andreas Schwab.
|
||||
|
||||
Tue Feb 25 20:34:51 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/Makefile.am (noinst_HEADERS): Add obstack.h.
|
||||
(libtu_a_SOURCES): Add obstack.c.
|
||||
|
||||
Sun Feb 16 08:30:29 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/Makefile.am (SUBDIRS): Add tac.
|
||||
* tests/tac: New directory.
|
||||
* configure.in (AC_OUTPUT): Add tests/tac/Makefile.
|
||||
|
||||
* tests/pr-test/{tt-0FF, tt-bl, tta3-0FF, ttb3-0FF, tt-FF, tt-t,
|
||||
tta3-FF, ttb3-FF}: New files. Renamed (s/T/tt/) to avoid name clashes
|
||||
on case-independent filesystems.
|
||||
* tests/pr-test/Test.pm (Tests '7.*'): Reflect file-renaming.
|
||||
|
||||
* src/tail.c (parse_obsolescent_option): Reverse order of args in
|
||||
diagnostic. Remove `' quotes in diagnostic.
|
||||
(parse_options): Remove `' quotes in diagnostic.
|
||||
|
||||
Sat Feb 8 22:43:45 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/tail.c (parse_obsolescent_option): Give warning diagnostic for
|
||||
(but now accept) obsolescent usage with more than one file argument.
|
||||
|
||||
Sun Feb 2 23:06:59 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/join.c: Move alloca-related preprocessor code into system.h.
|
||||
* src/od.c: Remove alloca-related preprocessor code.
|
||||
* src/system.h: Add alloca-related preprocessor code.
|
||||
|
||||
Sat Feb 1 07:21:43 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/pr-test/*: Rename files to avoid exceeding 14-character limit.
|
||||
* tests/pr-test/Test.pm: Reflect renamings.
|
||||
|
||||
* tests/pr-test/mk-script.pl (spec_to_list): Warn about all filenames
|
||||
that exceed max-length before dying.
|
||||
|
||||
* src/pr.c (init_parameters): For compatibility: use default
|
||||
separator `TAB' with full length lines. From Roland Huebner.
|
||||
|
||||
Fri Jan 31 19:53:54 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/tac.c: Rename globals buffer and buffer_size to have G_ prefix
|
||||
to avoid shadowing local variables.
|
||||
|
||||
* lib/long-options.c (parse_long_options): Compare getopt_long return
|
||||
value against -1, not EOF. Use NULL, not `(int *) 0' as last parameter
|
||||
in getopt_long call.
|
||||
|
||||
* src/pr.c (add_line_number): Rename from `number' to avoid shadowing
|
||||
local variables.
|
||||
|
||||
* src/*.c: Compare getopt_long return value against -1, not EOF.
|
||||
Use NULL, not `(int *) 0' as last parameter in getopt_long call.
|
||||
(usage): Bracket bug-reporting address with <> and append a period.
|
||||
|
||||
Wed Jan 29 20:54:24 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/tr-test/Test.pm: Do each test twice: get input via REDIR
|
||||
and PIPE.
|
||||
|
||||
* tests/tail/Test.pm (test_vector): Do each (non-stdin-requiring)
|
||||
test three times.
|
||||
|
||||
* tests/pr-test/Test.pm: Remove common_option_prefix flag.
|
||||
(test_vector): Prepend the common option here instead.
|
||||
|
||||
* tests/md5sum-test/Test.pm: Remove input_via_stdin flag.
|
||||
Do each test twice: get input via REDIR and PIPE.
|
||||
|
||||
* tests/cut-test/Test.pm: Do each test three times.
|
||||
|
||||
* tests/cut-test/mk-script.pl: Allow each test to be run any or all
|
||||
of three different ways. Program input may be specified via a file
|
||||
or files listed on the command line, via input redirection (if there's
|
||||
only one file), or via a pipe.
|
||||
|
||||
Tue Jan 28 20:54:06 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* tests/cut-test/mk-script.pl: Remove `t' prefix on all generated
|
||||
test file names.
|
||||
Change suffixes from (.in, .exp, .out, .err) to (.I, .X, .O, .E).
|
||||
Ensure that no test file (generated or maintainer-supplied) has a
|
||||
name longer than 14 characters.
|
||||
|
||||
Sun Jan 26 12:49:50 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Version 1.22.
|
||||
@@ -3994,7 +4144,5 @@ Sat Dec 16 15:15:50 1989 David J. MacKenzie (djm at hobbes.ai.mit.edu)
|
||||
|
||||
|
||||
Local Variables:
|
||||
mode: indented-text
|
||||
left-margin: 8
|
||||
version-control: never
|
||||
End:
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
Changes in release 1.23
|
||||
* pr: For compatibility (also more POSIX compliant): Include default
|
||||
separator `TAB' when merging lines of full length.
|
||||
* tail -N file1 file2 works like head -N file1 file2, except when
|
||||
POSIXLY_CORRECT is set, in which case it gets an error.
|
||||
|
||||
Changes in release 1.22
|
||||
[1.21a]
|
||||
* Fix a bug in tail when invoked with an argument like `+NUMBERc'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Makefile for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995, 1996, 1997 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
|
||||
@@ -55,7 +55,7 @@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
||||
SOURCES = cat-id-tbl.c
|
||||
POFILES = @POFILES@
|
||||
GMOFILES = @GMOFILES@
|
||||
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
|
||||
DISTFILES = Makefile.in.in POTFILES.in $(PACKAGE).pot \
|
||||
stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
|
||||
|
||||
POTFILES = \
|
||||
@@ -207,6 +207,7 @@ distclean: clean
|
||||
maintainer-clean: distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
rm -f $(GMOFILES)
|
||||
|
||||
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist distdir: update-po $(DISTFILES)
|
||||
@@ -240,9 +241,12 @@ POTFILES: POTFILES.in
|
||||
else \
|
||||
posrcprefix="../"; \
|
||||
fi; \
|
||||
sed -e '/^#/d' -e '/^[ ]*$$/d' \
|
||||
rm -f $@-t $@ \
|
||||
&& sed -e '/^#/d' -e '/^[ ]*$$/d' \
|
||||
-e "s@.*@ $$posrcprefix& \\\\@" \
|
||||
-e '$$s/\(.*\) \\/\1/' < $(srcdir)/POTFILES.in > POTFILES )
|
||||
-e '$$s/\(.*\) \\/\1/' < $(srcdir)/$@.in > $@-t \
|
||||
&& chmod a-w $@-t \
|
||||
&& mv $@-t $@ )
|
||||
|
||||
Makefile: Makefile.in.in ../config.status POTFILES
|
||||
cd .. \
|
||||
|
||||
@@ -1,19 +1,36 @@
|
||||
.TH ANSI2KNR 1 "31 December 1990"
|
||||
.TH ANSI2KNR 1 "19 Jan 1996"
|
||||
.SH NAME
|
||||
ansi2knr \- convert ANSI C to Kernighan & Ritchie C
|
||||
.SH SYNOPSIS
|
||||
.I ansi2knr
|
||||
input_file output_file
|
||||
[--varargs] input_file [output_file]
|
||||
.SH DESCRIPTION
|
||||
If no output_file is supplied, output goes to stdout.
|
||||
.br
|
||||
There are no error messages.
|
||||
.sp
|
||||
.I ansi2knr
|
||||
recognizes functions by seeing a non-keyword identifier at the left margin, followed by a left parenthesis, with a right parenthesis as the last character on the line. It will recognize a multi-line header if the last character on each line but the last is a left parenthesis or comma. These algorithms ignore whitespace and comments, except that the function name must be the first thing on the line.
|
||||
recognizes function definitions by seeing a non-keyword identifier at the left
|
||||
margin, followed by a left parenthesis, with a right parenthesis as the last
|
||||
character on the line, and with a left brace as the first token on the
|
||||
following line (ignoring possible intervening comments). It will recognize a
|
||||
multi-line header provided that no intervening line ends with a left or right
|
||||
brace or a semicolon. These algorithms ignore whitespace and comments, except
|
||||
that the function name must be the first thing on the line.
|
||||
.sp
|
||||
The following constructs will confuse it:
|
||||
.br
|
||||
- Any other construct that starts at the left margin and follows the above syntax (such as a macro or function call).
|
||||
- Any other construct that starts at the left margin and follows the
|
||||
above syntax (such as a macro or function call).
|
||||
.br
|
||||
- Macros that tinker with the syntax of the function header.
|
||||
- Some macros that tinker with the syntax of the function header.
|
||||
.sp
|
||||
The --varargs switch is obsolete, and is recognized only for
|
||||
backwards compatibility. The present version of
|
||||
.I ansi2knr
|
||||
will always attempt to convert a ... argument to va_alist and va_dcl.
|
||||
.SH AUTHOR
|
||||
L. Peter Deutsch <ghost@aladdin.com> wrote the original ansi2knr and
|
||||
continues to maintain the current version; most of the code in the current
|
||||
version is his work. ansi2knr also includes contributions by Francois
|
||||
Pinard <pinard@iro.umontreal.ca> and Jim Avera <jima@netcom.com>.
|
||||
|
||||
195
src/ansi2knr.c
195
src/ansi2knr.c
@@ -1,5 +1,3 @@
|
||||
/* Copyright (C) 1989, 1991, 1993, 1994, 1995 Aladdin Enterprises. All rights reserved. */
|
||||
|
||||
/* ansi2knr.c */
|
||||
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
|
||||
|
||||
@@ -34,22 +32,30 @@ program under the GPL.
|
||||
*
|
||||
* ansi2knr recognizes function definitions by seeing a non-keyword
|
||||
* identifier at the left margin, followed by a left parenthesis,
|
||||
* with a right parenthesis as the last character on the line.
|
||||
* It will recognize a multi-line header provided that the last character
|
||||
* of the last line of the header is a right parenthesis,
|
||||
* and no intervening line ends with a left or right brace or a semicolon.
|
||||
* with a right parenthesis as the last character on the line,
|
||||
* and with a left brace as the first token on the following line
|
||||
* (ignoring possible intervening comments).
|
||||
* It will recognize a multi-line header provided that no intervening
|
||||
* line ends with a left or right brace or a semicolon.
|
||||
* These algorithms ignore whitespace and comments, except that
|
||||
* the function name must be the first thing on the line.
|
||||
* The following constructs will confuse it:
|
||||
* - Any other construct that starts at the left margin and
|
||||
* follows the above syntax (such as a macro or function call).
|
||||
* - Macros that tinker with the syntax of the function header.
|
||||
* - Some macros that tinker with the syntax of the function header.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The original and principal author of ansi2knr is L. Peter Deutsch
|
||||
* <ghost@aladdin.com>. Other authors are noted in the change history
|
||||
* that follows (in reverse chronological order):
|
||||
lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with
|
||||
compilers that don't understand void, as suggested by
|
||||
Tom Lane
|
||||
lpd 96-01-15 changed to require that the first non-comment token
|
||||
on the line following a function header be a left brace,
|
||||
to reduce sensitivity to macros, as suggested by Tom Lane
|
||||
<tgl@sss.pgh.pa.us>
|
||||
lpd 95-06-22 removed #ifndefs whose sole purpose was to define
|
||||
undefined preprocessor symbols as 0; changed all #ifdefs
|
||||
for configuration symbols to #ifs
|
||||
@@ -70,7 +76,7 @@ program under the GPL.
|
||||
*/
|
||||
|
||||
/* Most of the conditionals here are to make ansi2knr work with */
|
||||
/* the GNU configure machinery. */
|
||||
/* or without the GNU configure machinery. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
@@ -94,12 +100,17 @@ program under the GPL.
|
||||
|
||||
#else /* not HAVE_CONFIG_H */
|
||||
|
||||
/*
|
||||
Without AC_CONFIG_HEADER, merely use <string.h> as in the original
|
||||
Ghostscript distribution. This loses on older BSD systems.
|
||||
*/
|
||||
/* Otherwise do it the hard way */
|
||||
|
||||
# include <string.h>
|
||||
# ifdef BSD
|
||||
# include <strings.h>
|
||||
# else
|
||||
# ifdef VMS
|
||||
extern int strlen(), strncmp();
|
||||
# else
|
||||
# include <string.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif /* not HAVE_CONFIG_H */
|
||||
|
||||
@@ -110,8 +121,18 @@ program under the GPL.
|
||||
malloc and free should be declared in stdlib.h,
|
||||
but if you've got a K&R compiler, they probably aren't.
|
||||
*/
|
||||
char *malloc();
|
||||
void free();
|
||||
# ifdef MSDOS
|
||||
# include <malloc.h>
|
||||
# else
|
||||
# ifdef VMS
|
||||
extern char *malloc();
|
||||
extern void free();
|
||||
# else
|
||||
extern char *malloc();
|
||||
extern int free();
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -139,7 +160,7 @@ void free();
|
||||
|
||||
/* Forward references */
|
||||
char *skipspace();
|
||||
void writeblanks();
|
||||
int writeblanks();
|
||||
int test1();
|
||||
int convert1();
|
||||
|
||||
@@ -152,6 +173,7 @@ main(argc, argv)
|
||||
#define bufsize 5000 /* arbitrary size */
|
||||
char *buf;
|
||||
char *line;
|
||||
char *more;
|
||||
/*
|
||||
* In previous versions, ansi2knr recognized a --varargs switch.
|
||||
* If this switch was supplied, ansi2knr would attempt to convert
|
||||
@@ -173,50 +195,81 @@ main(argc, argv)
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
switch ( argc )
|
||||
if (argc < 2 || argc > 3)
|
||||
{
|
||||
default:
|
||||
printf("Usage: ansi2knr input_file [output_file]\n");
|
||||
exit(0);
|
||||
case 2:
|
||||
out = stdout;
|
||||
break;
|
||||
case 3:
|
||||
out = fopen(argv[2], "w");
|
||||
if ( out == NULL )
|
||||
{ fprintf(stderr, "Cannot open output file %s\n", argv[2]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
in = fopen(argv[1], "r");
|
||||
if ( in == NULL )
|
||||
{ fprintf(stderr, "Cannot open input file %s\n", argv[1]);
|
||||
{
|
||||
fprintf(stderr, "Cannot open input file %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
if (argc == 3)
|
||||
{
|
||||
out = fopen(argv[2], "w");
|
||||
if ( out == NULL )
|
||||
{
|
||||
fprintf(stderr, "Cannot open output file %s\n", argv[2]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out = stdout;
|
||||
}
|
||||
fprintf(out, "#line 1 \"%s\"\n", argv[1]);
|
||||
buf = malloc(bufsize);
|
||||
line = buf;
|
||||
while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
|
||||
{ switch ( test1(buf) )
|
||||
{
|
||||
test: line += strlen(line);
|
||||
switch ( test1(buf) )
|
||||
{
|
||||
case 2: /* a function header */
|
||||
convert1(buf, out, 1, convert_varargs);
|
||||
break;
|
||||
case 1: /* a function */
|
||||
convert1(buf, out, 0, convert_varargs);
|
||||
/* Check for a { at the start of the next line. */
|
||||
more = ++line;
|
||||
f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
|
||||
goto wl;
|
||||
if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
|
||||
goto wl;
|
||||
switch ( *skipspace(more, 1) )
|
||||
{
|
||||
case '{':
|
||||
/* Definitely a function header. */
|
||||
convert1(buf, out, 0, convert_varargs);
|
||||
fputs(more, out);
|
||||
break;
|
||||
case 0:
|
||||
/* The next line was blank or a comment: */
|
||||
/* keep scanning for a non-comment. */
|
||||
line += strlen(line);
|
||||
goto f;
|
||||
default:
|
||||
/* buf isn't a function header, but */
|
||||
/* more might be. */
|
||||
fputs(buf, out);
|
||||
strcpy(buf, more);
|
||||
line = buf;
|
||||
goto test;
|
||||
}
|
||||
break;
|
||||
case -1: /* maybe the start of a function */
|
||||
line = buf + strlen(buf);
|
||||
if ( line != buf + (bufsize - 1) ) /* overflow check */
|
||||
continue;
|
||||
continue;
|
||||
/* falls through */
|
||||
default: /* not a function */
|
||||
fputs(buf, out);
|
||||
wl: fputs(buf, out);
|
||||
break;
|
||||
}
|
||||
line = buf;
|
||||
}
|
||||
if ( line != buf ) fputs(buf, out);
|
||||
if ( line != buf )
|
||||
fputs(buf, out);
|
||||
free(buf);
|
||||
fclose(out);
|
||||
fclose(in);
|
||||
@@ -229,11 +282,14 @@ skipspace(p, dir)
|
||||
register char *p;
|
||||
register int dir; /* 1 for forward, -1 for backward */
|
||||
{ for ( ; ; )
|
||||
{ while ( is_space(*p) ) p += dir;
|
||||
if ( !(*p == '/' && p[dir] == '*') ) break;
|
||||
{ while ( is_space(*p) )
|
||||
p += dir;
|
||||
if ( !(*p == '/' && p[dir] == '*') )
|
||||
break;
|
||||
p += dir; p += dir;
|
||||
while ( !(*p == '*' && p[dir] == '/') )
|
||||
{ if ( *p == 0 ) return p; /* multi-line comment?? */
|
||||
{ if ( *p == 0 )
|
||||
return p; /* multi-line comment?? */
|
||||
p += dir;
|
||||
}
|
||||
p += dir; p += dir;
|
||||
@@ -245,13 +301,15 @@ skipspace(p, dir)
|
||||
* Write blanks over part of a string.
|
||||
* Don't overwrite end-of-line characters.
|
||||
*/
|
||||
void
|
||||
int
|
||||
writeblanks(start, end)
|
||||
char *start;
|
||||
char *end;
|
||||
{ char *p;
|
||||
for ( p = start; p < end; p++ )
|
||||
if ( *p != '\r' && *p != '\n' ) *p = ' ';
|
||||
if ( *p != '\r' && *p != '\n' )
|
||||
*p = ' ';
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -274,25 +332,27 @@ test1(buf)
|
||||
char *bend;
|
||||
char *endfn;
|
||||
int contin;
|
||||
|
||||
if ( !isidfirstchar(*p) )
|
||||
return 0; /* no name at left margin */
|
||||
return 0; /* no name at left margin */
|
||||
bend = skipspace(buf + strlen(buf) - 1, -1);
|
||||
switch ( *bend )
|
||||
{
|
||||
case ';': contin = 0 /*2*/; break;
|
||||
case ')': contin = 1; break;
|
||||
case '{': return 0; /* not a function */
|
||||
case '}': return 0; /* not a function */
|
||||
default: contin = -1;
|
||||
case ';': contin = 0 /*2*/; break;
|
||||
case ')': contin = 1; break;
|
||||
case '{': return 0; /* not a function */
|
||||
case '}': return 0; /* not a function */
|
||||
default: contin = -1;
|
||||
}
|
||||
while ( isidchar(*p) ) p++;
|
||||
while ( isidchar(*p) )
|
||||
p++;
|
||||
endfn = p;
|
||||
p = skipspace(p, 1);
|
||||
if ( *p++ != '(' )
|
||||
return 0; /* not a function */
|
||||
return 0; /* not a function */
|
||||
p = skipspace(p, 1);
|
||||
if ( *p == ')' )
|
||||
return 0; /* no parameters */
|
||||
return 0; /* no parameters */
|
||||
/* Check that the apparent function name isn't a keyword. */
|
||||
/* We only need to check for keywords that could be followed */
|
||||
/* by a left parenthesis (which, unfortunately, is most of them). */
|
||||
@@ -306,9 +366,10 @@ test1(buf)
|
||||
char **key = words;
|
||||
char *kp;
|
||||
int len = endfn - buf;
|
||||
|
||||
while ( (kp = *key) != 0 )
|
||||
{ if ( strlen(kp) == len && !strncmp(kp, buf, len) )
|
||||
return 0; /* name is a keyword */
|
||||
return 0; /* name is a keyword */
|
||||
key++;
|
||||
}
|
||||
}
|
||||
@@ -324,15 +385,21 @@ convert1(buf, out, header, convert_varargs)
|
||||
int convert_varargs; /* Boolean */
|
||||
{ char *endfn;
|
||||
register char *p;
|
||||
/*
|
||||
* The breaks table contains pointers to the beginning and end
|
||||
* of each argument.
|
||||
*/
|
||||
char **breaks;
|
||||
unsigned num_breaks = 2; /* for testing */
|
||||
char **btop;
|
||||
char **bp;
|
||||
char **ap;
|
||||
char *vararg = 0;
|
||||
|
||||
/* Pre-ANSI implementations don't agree on whether strchr */
|
||||
/* is called strchr or index, so we open-code it here. */
|
||||
for ( endfn = buf; *(endfn++) != '('; ) ;
|
||||
for ( endfn = buf; *(endfn++) != '('; )
|
||||
;
|
||||
top: p = endfn;
|
||||
breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
|
||||
if ( breaks == 0 )
|
||||
@@ -349,6 +416,7 @@ top: p = endfn;
|
||||
char *lp = NULL;
|
||||
char *rp;
|
||||
char *end = NULL;
|
||||
|
||||
if ( bp >= btop )
|
||||
{ /* Filled up break table. */
|
||||
/* Allocate a bigger one and start over. */
|
||||
@@ -361,21 +429,21 @@ top: p = endfn;
|
||||
for ( ; end == NULL; p++ )
|
||||
{ switch(*p)
|
||||
{
|
||||
case ',':
|
||||
case ',':
|
||||
if ( !level ) end = p;
|
||||
break;
|
||||
case '(':
|
||||
case '(':
|
||||
if ( !level ) lp = p;
|
||||
level++;
|
||||
break;
|
||||
case ')':
|
||||
case ')':
|
||||
if ( --level < 0 ) end = p;
|
||||
else rp = p;
|
||||
break;
|
||||
case '/':
|
||||
case '/':
|
||||
p = skipspace(p, 1) - 1;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -390,26 +458,27 @@ top: p = endfn;
|
||||
{ p = skipspace(p - 1, -1);
|
||||
switch ( *p )
|
||||
{
|
||||
case ']': /* skip array dimension(s) */
|
||||
case ')': /* skip procedure args OR name */
|
||||
case ']': /* skip array dimension(s) */
|
||||
case ')': /* skip procedure args OR name */
|
||||
{ int level = 1;
|
||||
while ( level )
|
||||
switch ( *--p )
|
||||
{
|
||||
case ']': case ')': level++; break;
|
||||
case '[': case '(': level--; break;
|
||||
case '/': p = skipspace(p, -1) + 1; break;
|
||||
default: ;
|
||||
case ']': case ')': level++; break;
|
||||
case '[': case '(': level--; break;
|
||||
case '/': p = skipspace(p, -1) + 1; break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
|
||||
{ /* We found the name being declared */
|
||||
while ( !isidfirstchar(*p) )
|
||||
p = skipspace(p, 1) + 1;
|
||||
p = skipspace(p, 1) + 1;
|
||||
goto found;
|
||||
}
|
||||
break;
|
||||
default: goto found;
|
||||
default:
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* basename -- strip directory and suffix from filenames
|
||||
Copyright (C) 90, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 90,91,92,93,94,95,96,1997 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
|
||||
@@ -33,8 +33,8 @@
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
|
||||
extern char *basename ();
|
||||
extern void strip_trailing_slashes ();
|
||||
char *base_name ();
|
||||
void strip_trailing_slashes ();
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
@@ -59,7 +59,7 @@ If specified, also remove a trailing SUFFIX.\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to sh-utils-bugs@gnu.ai.mit.edu"));
|
||||
puts (_("\nReport bugs to <sh-utils-bugs@gnu.ai.mit.edu>."));
|
||||
}
|
||||
exit (status);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ main (int argc, char **argv)
|
||||
|
||||
strip_trailing_slashes (argv[1]);
|
||||
|
||||
name = basename (argv[1]);
|
||||
name = base_name (argv[1]);
|
||||
|
||||
if (argc == 3)
|
||||
remove_suffix (name, argv[2]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* cat -- concatenate files and print on the standard output.
|
||||
Copyright (C) 88, 90, 91, 95, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 88, 90, 91, 95, 96, 1997 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
|
||||
@@ -104,7 +104,7 @@ Concatenate FILE(s), or standard input, to standard output.\n\
|
||||
\n\
|
||||
With no FILE, or when FILE is -, read standard input.\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to textutils-bugs@gnu.ai.mit.edu"));
|
||||
puts (_("\nReport bugs to <textutils-bugs@gnu.ai.mit.edu>."));
|
||||
}
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
@@ -512,8 +512,7 @@ main (int argc, char **argv)
|
||||
|
||||
/* Parse command line options. */
|
||||
|
||||
while ((c = getopt_long (argc, argv, "benstuvAET", long_options, (int *) 0))
|
||||
!= EOF)
|
||||
while ((c = getopt_long (argc, argv, "benstuvAET", long_options, NULL)) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
|
||||
16
src/chgrp.c
16
src/chgrp.c
@@ -1,5 +1,5 @@
|
||||
/* chgrp -- change group ownership of files
|
||||
Copyright (C) 89, 90, 91, 95, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 95, 96, 1997 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
|
||||
@@ -178,9 +178,9 @@ change_file_group (const char *file, int group)
|
||||
describe_change (file, 1);
|
||||
|
||||
if (change_symlinks)
|
||||
fail = LCHOWN (file, file_stats.st_uid, group);
|
||||
fail = LCHOWN (file, (uid_t) -1, group);
|
||||
else
|
||||
fail = chown (file, file_stats.st_uid, group);
|
||||
fail = chown (file, (uid_t) -1, group);
|
||||
|
||||
if (fail)
|
||||
{
|
||||
@@ -207,10 +207,13 @@ change_file_group (const char *file, int group)
|
||||
}
|
||||
}
|
||||
else if (verbose && changes_only == 0)
|
||||
describe_change (file, 0);
|
||||
{
|
||||
describe_change (file, 0);
|
||||
}
|
||||
|
||||
if (recurse && S_ISDIR (file_stats.st_mode))
|
||||
errors |= change_dir_group (file, group, &file_stats);
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
@@ -287,7 +290,7 @@ Change the group membership of each FILE to GROUP.\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to fileutils-bugs@gnu.ai.mit.edu"));
|
||||
puts (_("\nReport bugs to <fileutils-bugs@gnu.ai.mit.edu>."));
|
||||
}
|
||||
exit (status);
|
||||
}
|
||||
@@ -306,8 +309,7 @@ main (int argc, char **argv)
|
||||
|
||||
recurse = force_silent = verbose = changes_only = 0;
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, (int *) 0))
|
||||
!= EOF)
|
||||
while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, NULL)) != -1)
|
||||
{
|
||||
switch (optc)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* chmod -- change permission modes of files
|
||||
Copyright (C) 89, 90, 91, 95, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 95, 96, 1997 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
|
||||
@@ -231,7 +231,7 @@ Usage: %s [OPTION]... MODE[,MODE]... FILE...\n\
|
||||
Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n\
|
||||
one or more of the letters rwxXstugo.\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to fileutils-bugs@gnu.ai.mit.edu"));
|
||||
puts (_("\nReport bugs to <fileutils-bugs@gnu.ai.mit.edu>."));
|
||||
}
|
||||
exit (status);
|
||||
}
|
||||
|
||||
10
src/chown.c
10
src/chown.c
@@ -1,5 +1,5 @@
|
||||
/* chown -- change user and group ownership of files
|
||||
Copyright (C) 89, 90, 91, 95, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 95, 96, 1997 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
|
||||
@@ -241,7 +241,8 @@ Change the owner and/or group of each FILE to OWNER and/or GROUP.\n\
|
||||
\n\
|
||||
-c, --changes be verbose whenever change occurs\n\
|
||||
-h, --no-dereference affect symbolic links instead of any referenced file\n\
|
||||
(available only on systems with lchown system call)\n\
|
||||
(available only on systems that can change the\n\
|
||||
ownership of a symlink)\n\
|
||||
-f, --silent, --quiet suppress most error messages\n\
|
||||
-R, --recursive operate on files and directories recursively\n\
|
||||
-v, --verbose explain what is being done\n\
|
||||
@@ -251,7 +252,7 @@ Change the owner and/or group of each FILE to OWNER and/or GROUP.\n\
|
||||
Owner is unchanged if missing. Group is unchanged if missing, but changed\n\
|
||||
to login group if implied by a period. A colon may replace the period.\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to fileutils-bugs@gnu.ai.mit.edu"));
|
||||
puts (_("\nReport bugs to <fileutils-bugs@gnu.ai.mit.edu>."));
|
||||
}
|
||||
exit (status);
|
||||
}
|
||||
@@ -272,8 +273,7 @@ main (int argc, char **argv)
|
||||
|
||||
recurse = force_silent = verbose = changes_only = 0;
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, (int *) 0))
|
||||
!= EOF)
|
||||
while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, NULL)) != -1)
|
||||
{
|
||||
switch (optc)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* chroot -- run command or shell with special root directory
|
||||
Copyright (C) 1995, 96 Free Software Foundation, Inc.
|
||||
Copyright (C) 95, 96, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -38,7 +38,7 @@ usage (int status)
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s [OPTION] NEWROOT [COMMAND...]\n\
|
||||
or: %s OPTION\n\
|
||||
or: %s OPTION\n\
|
||||
"), program_name, program_name);
|
||||
printf (_("\
|
||||
Run COMMAND with root directory set to NEWROOT.\n\
|
||||
@@ -48,7 +48,7 @@ Run COMMAND with root directory set to NEWROOT.\n\
|
||||
\n\
|
||||
If no command is given, run ``${SHELL} -i'' (default: /bin/sh).\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to sh-utils-bugs@gnu.ai.mit.edu"));
|
||||
puts (_("\nReport bugs to <sh-utils-bugs@gnu.ai.mit.edu>."));
|
||||
}
|
||||
exit (status);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* cksum -- calculate and print POSIX.2 checksums and sizes of files
|
||||
Copyright (C) 92, 95, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 92, 95, 96, 1997 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
|
||||
@@ -275,7 +275,7 @@ Print CRC checksum and byte counts of each FILE.\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to textutils-bugs@gnu.ai.mit.edu"));
|
||||
puts (_("\nReport bugs to <textutils-bugs@gnu.ai.mit.edu>."));
|
||||
}
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
@@ -293,7 +293,7 @@ main (int argc, char **argv)
|
||||
|
||||
have_read_stdin = 0;
|
||||
|
||||
while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF)
|
||||
while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* comm -- compare two sorted files line by line.
|
||||
Copyright (C) 1986, 1990, 1991, 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 86, 90, 91, 95, 96, 1997 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
|
||||
@@ -78,7 +78,7 @@ Compare sorted files LEFT_FILE and RIGHT_FILE line by line.\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to textutils-bugs@gnu.ai.mit.edu"));
|
||||
puts (_("\nReport bugs to <textutils-bugs@gnu.ai.mit.edu>."));
|
||||
}
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
@@ -226,7 +226,7 @@ main (int argc, char **argv)
|
||||
only_file_2 = 1;
|
||||
both = 1;
|
||||
|
||||
while ((c = getopt_long (argc, argv, "123", long_options, (int *) 0)) != EOF)
|
||||
while ((c = getopt_long (argc, argv, "123", long_options, NULL)) != -1)
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
|
||||
174
src/copy.c
174
src/copy.c
@@ -4,10 +4,14 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "cp.h"
|
||||
#include "copy.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "backupfile.h"
|
||||
#include "copy.h"
|
||||
#include "cp-hash.h"
|
||||
|
||||
/* On Linux (from slackware-1.2.13 to 2.0.2?) there is no lchown function.
|
||||
To change ownership of symlinks, you must run chown with an effective
|
||||
@@ -22,82 +26,6 @@
|
||||
But root probably wants to know, e.g. if NFS disallows it. */ \
|
||||
&& (errno != EPERM || x->myeuid == 0))
|
||||
|
||||
/* Control creation of sparse files (files with holes). */
|
||||
enum Sparse_type
|
||||
{
|
||||
/* Never create holes in DEST. */
|
||||
SPARSE_NEVER,
|
||||
|
||||
/* This is the default. Use a crude (and sometimes inaccurate)
|
||||
heuristic to determine if SOURCE has holes. If so, try to create
|
||||
holes in DEST. */
|
||||
SPARSE_AUTO,
|
||||
|
||||
/* For every sufficiently long sequence of bytes in SOURCE, try to
|
||||
create a corresponding hole in DEST. There is a performance penalty
|
||||
here because CP has to search for holes in SRC. But if the holes are
|
||||
big enough, that penalty can be offset by the decrease in the amount
|
||||
of data written to disk. */
|
||||
SPARSE_ALWAYS
|
||||
};
|
||||
|
||||
struct flag
|
||||
{
|
||||
/* If nonzero, copy all files except (directories and, if not dereferencing
|
||||
them, symbolic links,) as if they were regular files. */
|
||||
int copy_as_regular;
|
||||
|
||||
/* If nonzero, dereference symbolic links (copy the files they point to). */
|
||||
int dereference;
|
||||
|
||||
/* If nonzero, remove existing destination nondirectories. */
|
||||
int force;
|
||||
|
||||
/* If nonzero, create hard links instead of copying files.
|
||||
Create destination directories as usual. */
|
||||
int hard_link;
|
||||
|
||||
/* If nonzero, query before overwriting existing destinations
|
||||
with regular files. */
|
||||
int interactive;
|
||||
|
||||
/* If nonzero, when copying recursively, skip any subdirectories that are
|
||||
on different filesystems from the one we started on. */
|
||||
int one_file_system;
|
||||
|
||||
/* If nonzero, give the copies the original files' permissions,
|
||||
ownership, and timestamps. */
|
||||
int preserve;
|
||||
|
||||
/* If nonzero, copy directories recursively and copy special files
|
||||
as themselves rather than copying their contents. */
|
||||
int recursive;
|
||||
|
||||
/* Control creation of sparse files. */
|
||||
enum Sparse_type sparse_mode;
|
||||
|
||||
/* If nonzero, create symbolic links instead of copying files.
|
||||
Create destination directories as usual. */
|
||||
int symbolic_link;
|
||||
|
||||
/* The bits to preserve in created files' modes. */
|
||||
int umask_kill;
|
||||
|
||||
/* If nonzero, do not copy a nondirectory that has an existing destination
|
||||
with the same or newer modification time. */
|
||||
int update;
|
||||
|
||||
/* If nonzero, display the names of the files before copying them. */
|
||||
int verbose;
|
||||
|
||||
/* This process's effective user ID. */
|
||||
uid_t myeuid;
|
||||
|
||||
/* A pointer to either lstat or stat, depending on
|
||||
whether dereferencing of symlinks is done. */
|
||||
int (*xstat) ();
|
||||
};
|
||||
|
||||
struct dir_list
|
||||
{
|
||||
struct dir_list *parent;
|
||||
@@ -107,6 +35,15 @@ struct dir_list
|
||||
|
||||
int full_write ();
|
||||
int euidaccess ();
|
||||
char *savedir ();
|
||||
char *stpcpy ();
|
||||
char *xmalloc ();
|
||||
int yesno ();
|
||||
|
||||
static int copy_internal __P ((const char *src_path, const char *dst_path,
|
||||
int new_dst, dev_t device,
|
||||
struct dir_list *ancestors,
|
||||
const struct cp_options *x));
|
||||
|
||||
/* The invocation name of this program. */
|
||||
extern char *program_name;
|
||||
@@ -132,7 +69,7 @@ is_ancestor (const struct stat *sb, const struct dir_list *ancestors)
|
||||
static int
|
||||
copy_dir (const char *src_path_in, const char *dst_path_in, int new_dst,
|
||||
const struct stat *src_sb, struct dir_list *ancestors,
|
||||
const struct flag *x)
|
||||
const struct cp_options *x)
|
||||
{
|
||||
char *name_space;
|
||||
char *namep;
|
||||
@@ -164,7 +101,8 @@ copy_dir (const char *src_path_in, const char *dst_path_in, int new_dst,
|
||||
stpcpy (stpcpy (stpcpy (src_path, src_path_in), "/"), namep);
|
||||
stpcpy (stpcpy (stpcpy (dst_path, dst_path_in), "/"), namep);
|
||||
|
||||
ret |= copy (src_path, dst_path, new_dst, src_sb->st_dev, ancestors, x);
|
||||
ret |= copy_internal (src_path, dst_path, new_dst, src_sb->st_dev,
|
||||
ancestors, x);
|
||||
|
||||
/* Free the memory for `src_path'. The memory for `dst_path'
|
||||
cannot be deallocated, since it is used to create multiple
|
||||
@@ -371,7 +309,7 @@ ret2:
|
||||
static int
|
||||
copy_internal (const char *src_path, const char *dst_path,
|
||||
int new_dst, dev_t device, struct dir_list *ancestors,
|
||||
const struct flag *x)
|
||||
const struct cp_options *x)
|
||||
{
|
||||
struct stat src_sb;
|
||||
struct stat dst_sb;
|
||||
@@ -425,9 +363,26 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The file exists already. */
|
||||
int same;
|
||||
|
||||
if (src_sb.st_ino == dst_sb.st_ino && src_sb.st_dev == dst_sb.st_dev)
|
||||
/* The destination file exists already. */
|
||||
|
||||
same = (src_sb.st_ino == dst_sb.st_ino
|
||||
&& src_sb.st_dev == dst_sb.st_dev);
|
||||
|
||||
/* If we're preserving symlinks (--no-dereference) and the
|
||||
destination file is a symlink, use stat (not xstat) to
|
||||
see if it points back to the source. */
|
||||
if (!same && !x->dereference && S_ISLNK (dst_sb.st_mode))
|
||||
{
|
||||
struct stat dst2_sb;
|
||||
if (stat (dst_path, &dst2_sb) == 0
|
||||
&& (src_sb.st_ino == dst2_sb.st_ino &&
|
||||
src_sb.st_dev == dst2_sb.st_dev))
|
||||
same = 1;
|
||||
}
|
||||
|
||||
if (same)
|
||||
{
|
||||
if (x->hard_link)
|
||||
return 0;
|
||||
@@ -693,19 +648,19 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
{
|
||||
/* Preserve the owner and group of the just-`copied'
|
||||
symbolic link, if possible. */
|
||||
#ifdef HAVE_LCHOWN
|
||||
# ifdef HAVE_LCHOWN
|
||||
if (DO_CHOWN (lchown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
error (0, errno, _("preserving ownership for %s"), dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
#else
|
||||
# ifdef ROOT_CHOWN_AFFECTS_SYMLINKS
|
||||
# else
|
||||
# ifdef ROOT_CHOWN_AFFECTS_SYMLINKS
|
||||
if (x->myeuid == 0)
|
||||
{
|
||||
if (DO_CHOWN (chown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
error (0, errno, _("preserving ownership for %s"), dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
}
|
||||
@@ -714,13 +669,13 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
/* FIXME: maybe give a diagnostic: you must be root
|
||||
to preserve ownership and group of symlinks. */
|
||||
}
|
||||
# else
|
||||
# else
|
||||
/* Can't preserve ownership of symlinks.
|
||||
FIXME: maybe give a warning or even error for symlinks
|
||||
in directories with the sticky bit set -- there, not
|
||||
preserving owner/group is a potential security problem. */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -745,13 +700,13 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
|
||||
if (utime (dst_path, &utb))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
error (0, errno, _("preserving times for %s"), dst_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (DO_CHOWN (chown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
error (0, errno, _("preserving ownership for %s"), dst_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -761,7 +716,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
{
|
||||
if (chmod (dst_path, src_mode & x->umask_kill))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
error (0, errno, _("preserving permissions for %s"), dst_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -770,7 +725,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
/* Reset the temporarily changed mode. */
|
||||
if (chmod (dst_path, dst_sb.st_mode))
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
error (0, errno, _("restoring permissions of %s"), dst_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -786,18 +741,31 @@ un_backup:
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
valid_options (const struct cp_options *co)
|
||||
{
|
||||
assert (co != NULL);
|
||||
|
||||
/* FIXME: make sure xstat and dereference are consistent. */
|
||||
assert (co->xstat);
|
||||
|
||||
assert (co->sparse_mode != SPARSE_UNUSED);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Copy the file SRC_PATH to the file DST_PATH. The files may be of
|
||||
any type. NONEXISTENT_DST should be nonzero if the file DST_PATH is
|
||||
not to exist (e.g., because its parent directory was just created);
|
||||
NONEXISTENT_DST should be zero if DST_PATH might already exist.
|
||||
DEVICE is the device number of the parent directory, or 0 if the
|
||||
parent of this file is not known. ANCESTORS points to a linked, null
|
||||
terminated list of devices and inodes of parent directories of SRC_PATH.
|
||||
any type. NONEXISTENT_DST should be nonzero if the file DST_PATH
|
||||
is known not to exist (e.g., because its parent directory was just
|
||||
created); NONEXISTENT_DST should be zero if DST_PATH might already
|
||||
exist. DEVICE is the device number of the parent directory of
|
||||
DST_PATH, or 0 if the parent of this file is not known.
|
||||
OPTIONS is ... FIXME-describe
|
||||
Return 0 if successful, 1 if an error occurs. */
|
||||
|
||||
int
|
||||
copy (const char *src_path, const char *dst_path, int nonexistent_dst,
|
||||
const struct flag *x)
|
||||
copy (const char *src_path, const char *dst_path,
|
||||
int nonexistent_dst, const struct cp_options *options)
|
||||
{
|
||||
copy_internal (src_path, dst_path, ... , x);
|
||||
assert (valid_options (options));
|
||||
return copy_internal (src_path, dst_path, nonexistent_dst, 0, NULL, options);
|
||||
}
|
||||
|
||||
86
src/copy.h
Normal file
86
src/copy.h
Normal file
@@ -0,0 +1,86 @@
|
||||
#ifndef COPY_H
|
||||
# define COPY_H
|
||||
|
||||
/* Control creation of sparse files (files with holes). */
|
||||
enum Sparse_type
|
||||
{
|
||||
SPARSE_UNUSED,
|
||||
|
||||
/* Never create holes in DEST. */
|
||||
SPARSE_NEVER,
|
||||
|
||||
/* This is the default. Use a crude (and sometimes inaccurate)
|
||||
heuristic to determine if SOURCE has holes. If so, try to create
|
||||
holes in DEST. */
|
||||
SPARSE_AUTO,
|
||||
|
||||
/* For every sufficiently long sequence of bytes in SOURCE, try to
|
||||
create a corresponding hole in DEST. There is a performance penalty
|
||||
here because CP has to search for holes in SRC. But if the holes are
|
||||
big enough, that penalty can be offset by the decrease in the amount
|
||||
of data written to disk. */
|
||||
SPARSE_ALWAYS
|
||||
};
|
||||
|
||||
struct cp_options
|
||||
{
|
||||
/* If nonzero, copy all files except (directories and, if not dereferencing
|
||||
them, symbolic links,) as if they were regular files. */
|
||||
int copy_as_regular;
|
||||
|
||||
/* If nonzero, dereference symbolic links (copy the files they point to). */
|
||||
int dereference;
|
||||
|
||||
/* If nonzero, remove existing destination nondirectories. */
|
||||
int force;
|
||||
|
||||
/* If nonzero, create hard links instead of copying files.
|
||||
Create destination directories as usual. */
|
||||
int hard_link;
|
||||
|
||||
/* If nonzero, query before overwriting existing destinations
|
||||
with regular files. */
|
||||
int interactive;
|
||||
|
||||
/* This process's effective user ID. */
|
||||
uid_t myeuid;
|
||||
|
||||
/* If nonzero, when copying recursively, skip any subdirectories that are
|
||||
on different filesystems from the one we started on. */
|
||||
int one_file_system;
|
||||
|
||||
/* If nonzero, give the copies the original files' permissions,
|
||||
ownership, and timestamps. */
|
||||
int preserve;
|
||||
|
||||
/* If nonzero, copy directories recursively and copy special files
|
||||
as themselves rather than copying their contents. */
|
||||
int recursive;
|
||||
|
||||
/* Control creation of sparse files. */
|
||||
enum Sparse_type sparse_mode;
|
||||
|
||||
/* If nonzero, create symbolic links instead of copying files.
|
||||
Create destination directories as usual. */
|
||||
int symbolic_link;
|
||||
|
||||
/* The bits to preserve in created files' modes. */
|
||||
unsigned int umask_kill;
|
||||
|
||||
/* If nonzero, do not copy a nondirectory that has an existing destination
|
||||
with the same or newer modification time. */
|
||||
int update;
|
||||
|
||||
/* If nonzero, display the names of the files before copying them. */
|
||||
int verbose;
|
||||
|
||||
/* A pointer to either lstat or stat, depending on
|
||||
whether the copy should dereference symlinks. */
|
||||
int (*xstat) ();
|
||||
};
|
||||
|
||||
int
|
||||
copy __P ((const char *src_path, const char *dst_path,
|
||||
int nonexistent_dst, const struct cp_options *options));
|
||||
|
||||
#endif
|
||||
107
src/cp-hash.c
107
src/cp-hash.c
@@ -19,7 +19,30 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include "cp.h"
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "cp-hash.h"
|
||||
|
||||
struct entry
|
||||
{
|
||||
ino_t ino;
|
||||
dev_t dev;
|
||||
char *node; /* Path name, or &new_file for new inodes. */
|
||||
struct entry *coll_link; /* 0 = entry not occupied. */
|
||||
};
|
||||
|
||||
struct htab
|
||||
{
|
||||
unsigned modulus; /* Size of the `hash' pointer vector. */
|
||||
struct entry *entry_tab; /* Pointer to dynamically growing vector. */
|
||||
unsigned entry_tab_size; /* Size of current `entry_tab' allocation. */
|
||||
unsigned first_free_entry; /* Index in `entry_tab'. */
|
||||
struct entry *hash[1]; /* Vector of pointers in `entry_tab'. */
|
||||
};
|
||||
|
||||
char *xmalloc ();
|
||||
char *xrealloc ();
|
||||
|
||||
struct htab *htab;
|
||||
char new_file;
|
||||
@@ -92,7 +115,47 @@ forget_all (void)
|
||||
for (i = htab->modulus; i > 0; i--)
|
||||
*p++ = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Insert path NODE, copied from inode number INO and device number DEV,
|
||||
into the hash structure HTAB, if not already present.
|
||||
Return NULL if inserted, otherwise non-NULL. */
|
||||
|
||||
static char *
|
||||
hash_insert2 (struct htab *ht, ino_t ino, dev_t dev, const char *node)
|
||||
{
|
||||
struct entry **hp, *ep2, *ep;
|
||||
hp = &ht->hash[ino % ht->modulus];
|
||||
ep2 = *hp;
|
||||
|
||||
/* Collision? */
|
||||
|
||||
if (ep2 != NULL)
|
||||
{
|
||||
ep = ep2;
|
||||
|
||||
/* Search for an entry with the same data. */
|
||||
|
||||
do
|
||||
{
|
||||
if (ep->ino == ino && ep->dev == dev)
|
||||
return ep->node; /* Found an entry with the same data. */
|
||||
ep = ep->coll_link;
|
||||
}
|
||||
while (ep != NULL);
|
||||
|
||||
/* Did not find it. */
|
||||
|
||||
}
|
||||
|
||||
ep = *hp = &ht->entry_tab[ht->first_free_entry++];
|
||||
ep->ino = ino;
|
||||
ep->dev = dev;
|
||||
ep->node = (char *) node;
|
||||
ep->coll_link = ep2; /* ep2 is NULL if not collision. */
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Insert path NODE, copied from inode number INO and device number DEV,
|
||||
into the hash structure in the global variable `htab', if an entry with
|
||||
the same inode and device was not found already.
|
||||
@@ -160,43 +223,3 @@ hash_insert (ino_t ino, dev_t dev, const char *node)
|
||||
|
||||
return hash_insert2 (htab_r, ino, dev, node);
|
||||
}
|
||||
|
||||
/* Insert path NODE, copied from inode number INO and device number DEV,
|
||||
into the hash structure HTAB, if not already present.
|
||||
Return NULL if inserted, otherwise non-NULL. */
|
||||
|
||||
char *
|
||||
hash_insert2 (struct htab *htab, ino_t ino, dev_t dev, const char *node)
|
||||
{
|
||||
struct entry **hp, *ep2, *ep;
|
||||
hp = &htab->hash[ino % htab->modulus];
|
||||
ep2 = *hp;
|
||||
|
||||
/* Collision? */
|
||||
|
||||
if (ep2 != NULL)
|
||||
{
|
||||
ep = ep2;
|
||||
|
||||
/* Search for an entry with the same data. */
|
||||
|
||||
do
|
||||
{
|
||||
if (ep->ino == ino && ep->dev == dev)
|
||||
return ep->node; /* Found an entry with the same data. */
|
||||
ep = ep->coll_link;
|
||||
}
|
||||
while (ep != NULL);
|
||||
|
||||
/* Did not find it. */
|
||||
|
||||
}
|
||||
|
||||
ep = *hp = &htab->entry_tab[htab->first_free_entry++];
|
||||
ep->ino = ino;
|
||||
ep->dev = dev;
|
||||
ep->node = (char *) node;
|
||||
ep->coll_link = ep2; /* ep2 is NULL if not collision. */
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
9
src/cp-hash.h
Normal file
9
src/cp-hash.h
Normal file
@@ -0,0 +1,9 @@
|
||||
/* For created inodes, a pointer in the search structure to this
|
||||
character identifies the inode as being new. */
|
||||
extern char new_file;
|
||||
|
||||
void hash_init __P ((unsigned int modulus, unsigned int entry_tab_size));
|
||||
void forget_all __P ((void));
|
||||
char *hash_insert __P ((ino_t ino, dev_t dev, const char *node));
|
||||
char *remember_copied __P ((const char *node, ino_t ino, dev_t dev));
|
||||
int remember_created __P ((const char *path));
|
||||
@@ -1,5 +1,5 @@
|
||||
/* csplit - split a file into sections determined by context lines
|
||||
Copyright (C) 91, 95, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 91, 95, 96, 1997 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
|
||||
@@ -1476,8 +1476,7 @@ main (int argc, char **argv)
|
||||
signal (SIGTERM, interrupt_handler);
|
||||
#endif /* not SA_INTERRUPT */
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "f:b:kn:sqz", longopts, (int *) 0))
|
||||
!= EOF)
|
||||
while ((optc = getopt_long (argc, argv, "f:b:kn:sqz", longopts, NULL)) != -1)
|
||||
switch (optc)
|
||||
{
|
||||
case 0:
|
||||
@@ -1585,7 +1584,7 @@ Read standard input if FILE is -. Each PATTERN may be:\n\
|
||||
\n\
|
||||
A line OFFSET is a required `+' or `-' followed by a positive integer.\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to textutils-bugs@gnu.ai.mit.edu"));
|
||||
puts (_("\nReport bugs to <textutils-bugs@gnu.ai.mit.edu>."));
|
||||
}
|
||||
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user