mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
573 Commits
FILEUTILS-
...
CPPI-1_8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0654f3206d | ||
|
|
67cf94a857 | ||
|
|
69ed54e544 | ||
|
|
3dabe6b533 | ||
|
|
2845214164 | ||
|
|
6b8102a180 | ||
|
|
570074d6d1 | ||
|
|
72a6d74ab2 | ||
|
|
cd6f0af0ea | ||
|
|
2746cd50c3 | ||
|
|
8a4261c7a5 | ||
|
|
90799b6c68 | ||
|
|
1c6320fe7c | ||
|
|
fecdd2bd2b | ||
|
|
15691fb64f | ||
|
|
cb366955f3 | ||
|
|
82a6fbda1c | ||
|
|
177b2553e2 | ||
|
|
814e63e371 | ||
|
|
2eed25f2ed | ||
|
|
1be9e19c7d | ||
|
|
b7895d0d10 | ||
|
|
8461820956 | ||
|
|
86960ce221 | ||
|
|
6670163eee | ||
|
|
437f8becaa | ||
|
|
5233121102 | ||
|
|
25c2989d30 | ||
|
|
4f96dfa43e | ||
|
|
f559a4afa3 | ||
|
|
b5d4b2c555 | ||
|
|
d8a157a00e | ||
|
|
85a75d3a16 | ||
|
|
d183ecddcd | ||
|
|
e30c09b4cb | ||
|
|
9d5d7f0d50 | ||
|
|
caae4ed5a7 | ||
|
|
a1ca60f4e5 | ||
|
|
ce861b2cb3 | ||
|
|
67ec78d188 | ||
|
|
d661be38ed | ||
|
|
69e30c7f2a | ||
|
|
8973e2b38c | ||
|
|
df52f23ebf | ||
|
|
5edc91fc05 | ||
|
|
8b4ac20908 | ||
|
|
1a0d9ea086 | ||
|
|
e49511faef | ||
|
|
e05c32a868 | ||
|
|
c2f898236f | ||
|
|
501ebc1cba | ||
|
|
77182607c0 | ||
|
|
6769657fa3 | ||
|
|
dab453378b | ||
|
|
aa266c29eb | ||
|
|
6b94589fa4 | ||
|
|
0d849addb3 | ||
|
|
1698b85090 | ||
|
|
a538ba0149 | ||
|
|
41f20fd38f | ||
|
|
1c8189de61 | ||
|
|
525e76fce0 | ||
|
|
d91624bd99 | ||
|
|
1c71127370 | ||
|
|
4f1553c89f | ||
|
|
1b9cb7ea23 | ||
|
|
479aba180c | ||
|
|
8eeae63a74 | ||
|
|
07584e33ec | ||
|
|
33ba435db5 | ||
|
|
73fe66c783 | ||
|
|
cc27b86c60 | ||
|
|
9db47bb808 | ||
|
|
8bf3961df0 | ||
|
|
df7d583cc2 | ||
|
|
271e41850b | ||
|
|
97b58344c5 | ||
|
|
627dac6c07 | ||
|
|
0742bc284e | ||
|
|
acca4638b8 | ||
|
|
05aabec021 | ||
|
|
e996c1bd77 | ||
|
|
b529a77be8 | ||
|
|
4faf0a9a17 | ||
|
|
3e50cea2f5 | ||
|
|
339738f351 | ||
|
|
a48a4d5c63 | ||
|
|
57a0382b5f | ||
|
|
835a8fa634 | ||
|
|
4ff7ab63ab | ||
|
|
d92f4ac85e | ||
|
|
21b8c52ae9 | ||
|
|
7303ca25db | ||
|
|
060fb58f86 | ||
|
|
d185a442b9 | ||
|
|
86046cb32f | ||
|
|
1500316caf | ||
|
|
72454050bb | ||
|
|
b0b9c6fee7 | ||
|
|
4a9feba665 | ||
|
|
afed66de3b | ||
|
|
d33f54f74f | ||
|
|
6d43eca61a | ||
|
|
59a56f4172 | ||
|
|
8cd774b0a3 | ||
|
|
7484a08597 | ||
|
|
3083c30362 | ||
|
|
81ae3684cc | ||
|
|
f8674300d4 | ||
|
|
b65d5875b7 | ||
|
|
7c85357876 | ||
|
|
913052e751 | ||
|
|
5536541dbb | ||
|
|
6fbae8149f | ||
|
|
be56f8286f | ||
|
|
b04a174558 | ||
|
|
1040389220 | ||
|
|
459b44b03d | ||
|
|
297c469d6f | ||
|
|
022f9b7d19 | ||
|
|
de2cfc1a5f | ||
|
|
005c4244f9 | ||
|
|
9b45312c35 | ||
|
|
bd3afcc718 | ||
|
|
d47e7953ba | ||
|
|
9860ca9f9b | ||
|
|
8f9f95b5ec | ||
|
|
2d354c5a2e | ||
|
|
7f5ed2b586 | ||
|
|
8ee842a15b | ||
|
|
7a16e5e6ff | ||
|
|
6cfcd41e1a | ||
|
|
89499f2124 | ||
|
|
e3db837339 | ||
|
|
b499483abd | ||
|
|
944f878a72 | ||
|
|
a1e9a949b4 | ||
|
|
d1680f86e1 | ||
|
|
019bdadfc9 | ||
|
|
7d57b34196 | ||
|
|
c8a0eec3f6 | ||
|
|
3d6852f7fa | ||
|
|
dd82647d0c | ||
|
|
b95b1e3c9a | ||
|
|
1d250b6098 | ||
|
|
b35b7e0553 | ||
|
|
d1703ad194 | ||
|
|
17800b0300 | ||
|
|
c9dcdd0fc5 | ||
|
|
b21c6f8e1e | ||
|
|
846b539b4e | ||
|
|
9a4e9f426c | ||
|
|
4e07d471cc | ||
|
|
5afa8c022e | ||
|
|
6202e79712 | ||
|
|
bd320fe27b | ||
|
|
bf319d9d88 | ||
|
|
1e9f7512fe | ||
|
|
75e63ae6cd | ||
|
|
d6dabd6cbb | ||
|
|
d5b2ff2b99 | ||
|
|
a3e608b76a | ||
|
|
d97f90581b | ||
|
|
5f90e3be67 | ||
|
|
f2f5e30bc2 | ||
|
|
6c1ee8402c | ||
|
|
ff9d584dcc | ||
|
|
aba2a0fd6d | ||
|
|
5baa94d136 | ||
|
|
6447e5b997 | ||
|
|
49d5578b0b | ||
|
|
ed757a3e9d | ||
|
|
e5aacbc6ea | ||
|
|
909f49e651 | ||
|
|
54f2cba1b5 | ||
|
|
880e67d643 | ||
|
|
166bbecf0b | ||
|
|
f94fab125e | ||
|
|
8bbc00b147 | ||
|
|
9ca70467e9 | ||
|
|
16f1ca4c35 | ||
|
|
c7087747a4 | ||
|
|
cdc8ee798f | ||
|
|
caf54306a3 | ||
|
|
cde06a54ea | ||
|
|
40af3c54b6 | ||
|
|
bb56dec673 | ||
|
|
1234569e43 | ||
|
|
82db55924e | ||
|
|
9a99175c0e | ||
|
|
88754c060d | ||
|
|
d3a2ca48d4 | ||
|
|
6adb4780b5 | ||
|
|
6e3bd39c14 | ||
|
|
cf59735d7b | ||
|
|
ff0e0181c9 | ||
|
|
138e17c26e | ||
|
|
2c7002e529 | ||
|
|
88b47ac69f | ||
|
|
f15c4ee154 | ||
|
|
9a25583ef1 | ||
|
|
d32d63e211 | ||
|
|
7daa83a149 | ||
|
|
b73eb2433d | ||
|
|
73ee461623 | ||
|
|
00fba41266 | ||
|
|
7822d5fe7f | ||
|
|
395dc1f7ff | ||
|
|
1f789a22a2 | ||
|
|
0354ab509e | ||
|
|
5b85894325 | ||
|
|
b77cb25935 | ||
|
|
ea9a4e4755 | ||
|
|
69c750af36 | ||
|
|
f2e553b126 | ||
|
|
8a93bbce06 | ||
|
|
965cb80669 | ||
|
|
0e397f0460 | ||
|
|
0ebd6b45a8 | ||
|
|
a8fab3b2eb | ||
|
|
2e9fdf49c5 | ||
|
|
0743fbb426 | ||
|
|
2c6fbbea7a | ||
|
|
3f6da994c0 | ||
|
|
adcacc9417 | ||
|
|
7e2f836a49 | ||
|
|
1bac92811e | ||
|
|
8fc17df678 | ||
|
|
1ff67f6c5c | ||
|
|
eabc99b8a4 | ||
|
|
b3f23e14d2 | ||
|
|
abe849cb76 | ||
|
|
4f9389cf1e | ||
|
|
3ac192dc18 | ||
|
|
39d746aace | ||
|
|
a4aa31ab26 | ||
|
|
fc27d7356d | ||
|
|
427694451d | ||
|
|
81655756c2 | ||
|
|
2cd2cfc95c | ||
|
|
dd55ac2967 | ||
|
|
0a8f8a7f96 | ||
|
|
8fdb4073cb | ||
|
|
6a3804bceb | ||
|
|
7a23da6e17 | ||
|
|
403470bdfb | ||
|
|
565c193a23 | ||
|
|
cd7e157b45 | ||
|
|
bac81b8dd0 | ||
|
|
6e92f27548 | ||
|
|
b3324ca196 | ||
|
|
c90aa4af6c | ||
|
|
2dcd72c77e | ||
|
|
4aba36bd9a | ||
|
|
2ee35792a0 | ||
|
|
782e6319e5 | ||
|
|
95bbe7a4e1 | ||
|
|
5631658518 | ||
|
|
64e75882f4 | ||
|
|
151c87c3df | ||
|
|
0e12cbe0e2 | ||
|
|
6165d7114f | ||
|
|
2edf3e95db | ||
|
|
b2a6e3f614 | ||
|
|
be1e26b2e5 | ||
|
|
185ee08979 | ||
|
|
020235e167 | ||
|
|
445485d9b8 | ||
|
|
0fd7aaf38c | ||
|
|
48a83af35c | ||
|
|
bb73f9b20e | ||
|
|
611fadd9e8 | ||
|
|
f95b33a519 | ||
|
|
73771cb380 | ||
|
|
48da137f84 | ||
|
|
4e378387d0 | ||
|
|
830edd4985 | ||
|
|
770c39a710 | ||
|
|
4e2bc789ab | ||
|
|
da0732da37 | ||
|
|
b3edfeaeee | ||
|
|
e1d09fbef3 | ||
|
|
4d73de7228 | ||
|
|
97a165c61f | ||
|
|
57ebb8d808 | ||
|
|
0aa5a0d85e | ||
|
|
c49c23e608 | ||
|
|
1a6f58ae67 | ||
|
|
49a11aa4d4 | ||
|
|
ebecb3f230 | ||
|
|
be34aaaa35 | ||
|
|
939977073e | ||
|
|
17d7e0206d | ||
|
|
c968981077 | ||
|
|
23357a490e | ||
|
|
c08ca675ac | ||
|
|
25353ae5a7 | ||
|
|
0e4c958fb8 | ||
|
|
8b6603f085 | ||
|
|
a3dcaf6a83 | ||
|
|
f00f8f6a9c | ||
|
|
f472159d99 | ||
|
|
0e1b0b2ea2 | ||
|
|
a46e9f0919 | ||
|
|
22438d75ce | ||
|
|
9b18c35ac9 | ||
|
|
33f1edc571 | ||
|
|
e9e376d85f | ||
|
|
81f10fbd43 | ||
|
|
a44e5341bb | ||
|
|
08b1c573cd | ||
|
|
d858c3c433 | ||
|
|
39b53154ca | ||
|
|
214a8623eb | ||
|
|
e1356e7fe7 | ||
|
|
0760dc7412 | ||
|
|
f3a6e69b4e | ||
|
|
6d722e99e2 | ||
|
|
2cac22f76f | ||
|
|
983cd11143 | ||
|
|
aea44f3fa0 | ||
|
|
f8038b425a | ||
|
|
ff6e48f61e | ||
|
|
a5565c08a3 | ||
|
|
b510774dbb | ||
|
|
e10f361193 | ||
|
|
dfe9af3d61 | ||
|
|
49d7e8c71f | ||
|
|
eb53331d93 | ||
|
|
4d3c9a170d | ||
|
|
ee2d8446f4 | ||
|
|
1021e06a20 | ||
|
|
8dc1b2caf4 | ||
|
|
d19f921653 | ||
|
|
cf83af7c10 | ||
|
|
4bdc0991b0 | ||
|
|
fc1e3ad166 | ||
|
|
901ef41f7f | ||
|
|
50326157d9 | ||
|
|
9e9f0846f8 | ||
|
|
09917b2b9a | ||
|
|
02080dd37e | ||
|
|
039653dde5 | ||
|
|
144bbe26ac | ||
|
|
933e0997e2 | ||
|
|
8f90ed0f42 | ||
|
|
96380f703c | ||
|
|
40709c446a | ||
|
|
c8da0cbba6 | ||
|
|
575f5c2f24 | ||
|
|
662a4f705c | ||
|
|
ae53a3e4da | ||
|
|
a5385f0a5f | ||
|
|
b8e83dda2b | ||
|
|
577627b257 | ||
|
|
7e7943c979 | ||
|
|
1734d51c53 | ||
|
|
8686e2bf77 | ||
|
|
5a6effff70 | ||
|
|
a5810cd3de | ||
|
|
3a1f0aa8d5 | ||
|
|
462d532cd5 | ||
|
|
3adf8ab9c6 | ||
|
|
16b7a20d01 | ||
|
|
f32a1186bc | ||
|
|
2689e0a07c | ||
|
|
9d7b428daa | ||
|
|
f177ed1332 | ||
|
|
ad3a1fbb82 | ||
|
|
82cd6af9bc | ||
|
|
971d190dc4 | ||
|
|
05fc0219ad | ||
|
|
aeb6f5e5f3 | ||
|
|
f055dbe669 | ||
|
|
55408e0307 | ||
|
|
0dd327c851 | ||
|
|
1f60246c8b | ||
|
|
76be42eef0 | ||
|
|
018d1056e0 | ||
|
|
17b6fd61c3 | ||
|
|
03e6d30ae7 | ||
|
|
78abfe5da3 | ||
|
|
ffb5b5a2ad | ||
|
|
12eea70d7d | ||
|
|
9ffd4ae3df | ||
|
|
c487c2b929 | ||
|
|
fe62a85366 | ||
|
|
4b4c8534e6 | ||
|
|
e716f459a5 | ||
|
|
013d63bb67 | ||
|
|
f604c52243 | ||
|
|
e321b0bd06 | ||
|
|
007b5b4ba8 | ||
|
|
c58f8e0f80 | ||
|
|
328bfd1fb7 | ||
|
|
a3f0f65334 | ||
|
|
0a2ef3619c | ||
|
|
5854bc4e0c | ||
|
|
429ea1bad3 | ||
|
|
efde89cc27 | ||
|
|
d4d8f86b15 | ||
|
|
69254ed7d2 | ||
|
|
7b86692737 | ||
|
|
c82dbabbea | ||
|
|
3bd2a88618 | ||
|
|
4c5cf8b144 | ||
|
|
d1033dc2b9 | ||
|
|
a36e91c826 | ||
|
|
e9bcabbf05 | ||
|
|
20d893e3e2 | ||
|
|
3610481c97 | ||
|
|
b4c60a84e1 | ||
|
|
a67cbceb5a | ||
|
|
71a47cd7bb | ||
|
|
8f945ecf3a | ||
|
|
d7bb6bd985 | ||
|
|
37c05b6267 | ||
|
|
37bcdce62a | ||
|
|
52a97ad805 | ||
|
|
cc785dc620 | ||
|
|
0f44320b83 | ||
|
|
3032dfa4ef | ||
|
|
f199ae5181 | ||
|
|
c2c9db2056 | ||
|
|
13a9a251d8 | ||
|
|
f0da6c980d | ||
|
|
6673e992d4 | ||
|
|
141a1086a2 | ||
|
|
f74e9bb483 | ||
|
|
a2bbbeb38f | ||
|
|
f3e058b838 | ||
|
|
9ed4fe029a | ||
|
|
49ac3c60d0 | ||
|
|
d9ef180ae5 | ||
|
|
9d29159931 | ||
|
|
342d5997cc | ||
|
|
e63e45a195 | ||
|
|
6b4ccb9ba3 | ||
|
|
22e86fcb3c | ||
|
|
faf5915f7d | ||
|
|
d538aba94d | ||
|
|
26f187aa36 | ||
|
|
7e87cd0d6e | ||
|
|
a20eb902b8 | ||
|
|
da66e2e769 | ||
|
|
963388111d | ||
|
|
7499ea8154 | ||
|
|
79f359ff8a | ||
|
|
6a19cbc61b | ||
|
|
9e546891f1 | ||
|
|
171aba014f | ||
|
|
ed3d57b572 | ||
|
|
81e231a46d | ||
|
|
0622127ac6 | ||
|
|
a76f632427 | ||
|
|
bf660d1331 | ||
|
|
7bb9c7382f | ||
|
|
6e955cb84a | ||
|
|
f08ced6c34 | ||
|
|
c66278dffc | ||
|
|
ed2d4df754 | ||
|
|
1bc1a37f86 | ||
|
|
674233fb72 | ||
|
|
1f2219cabf | ||
|
|
f0d9306c78 | ||
|
|
28c6609c86 | ||
|
|
43c38af6a1 | ||
|
|
7cbb85937a | ||
|
|
8c61ed9ff1 | ||
|
|
6ba06cf611 | ||
|
|
957f363d1d | ||
|
|
38856139ea | ||
|
|
206ffe5898 | ||
|
|
34b462a936 | ||
|
|
82495b5d26 | ||
|
|
cf806f5d2d | ||
|
|
148e5d1b4d | ||
|
|
8a149d2242 | ||
|
|
b84871a279 | ||
|
|
807e464dec | ||
|
|
1f3a6e1eb8 | ||
|
|
a48426382d | ||
|
|
77ad7205cb | ||
|
|
c599760ff1 | ||
|
|
e563a1a5b5 | ||
|
|
4e329a1473 | ||
|
|
fd717e8d45 | ||
|
|
13e80acf07 | ||
|
|
51e2ffc524 | ||
|
|
379688e35d | ||
|
|
4d2231d02c | ||
|
|
c344de8d9b | ||
|
|
fb5e934c73 | ||
|
|
09ad98374b | ||
|
|
6864ceca11 | ||
|
|
ef43db1c4b | ||
|
|
b9dbd94712 | ||
|
|
9ff69c8035 | ||
|
|
c03498f2e7 | ||
|
|
e45c3dba07 | ||
|
|
bc6477ff72 | ||
|
|
e46f105350 | ||
|
|
6ab7032952 | ||
|
|
a5301cb3e2 | ||
|
|
9bab244d20 | ||
|
|
3b5b337246 | ||
|
|
3b60294bd9 | ||
|
|
7243403b27 | ||
|
|
d478d6efec | ||
|
|
dbfbb93424 | ||
|
|
29a4bf90d3 | ||
|
|
fe5cad6b29 | ||
|
|
39520407ef | ||
|
|
2e4b629e21 | ||
|
|
eaca68c289 | ||
|
|
7e02b6c989 | ||
|
|
32dfed954f | ||
|
|
55f43f7915 | ||
|
|
6cca23cec4 | ||
|
|
0be2660d96 | ||
|
|
a8bf544803 | ||
|
|
c841079462 | ||
|
|
ad06715030 | ||
|
|
66a4baa8a6 | ||
|
|
ae2b7961cf | ||
|
|
6f84766d19 | ||
|
|
fd00df9c4d | ||
|
|
d15557db96 | ||
|
|
b31c11e46b | ||
|
|
bdb5516fdd | ||
|
|
c8c93cfefa | ||
|
|
640221896f | ||
|
|
d73ea5f65a | ||
|
|
d72623052b | ||
|
|
a5b38192d0 | ||
|
|
5681a0705f | ||
|
|
04f6bb2648 | ||
|
|
ad09410b04 | ||
|
|
cc4722e802 | ||
|
|
f8e66794d9 | ||
|
|
e2b45cb9fe | ||
|
|
2170a48956 | ||
|
|
beebc69168 | ||
|
|
daf9d41918 | ||
|
|
105cbe3ea3 | ||
|
|
f14dbb1710 | ||
|
|
ec8df1d330 | ||
|
|
d7232f8ca7 | ||
|
|
c217428f39 | ||
|
|
41939d7bfe | ||
|
|
e7f9f83fa1 | ||
|
|
77eb8604f1 | ||
|
|
f8d8ad4e94 | ||
|
|
52e7fcc46c | ||
|
|
96cde75480 | ||
|
|
55b181511c | ||
|
|
6ce74d5d36 | ||
|
|
588d70c624 | ||
|
|
6a8e993550 | ||
|
|
087520e781 | ||
|
|
8879e63dee | ||
|
|
1a37445686 | ||
|
|
d6ce71fb68 | ||
|
|
65e65dbf30 | ||
|
|
ec00767a8e | ||
|
|
f443264116 | ||
|
|
6292a2bb96 | ||
|
|
2371d8faaf | ||
|
|
2dc45ff0c8 | ||
|
|
d2a170a785 | ||
|
|
2da0b15537 | ||
|
|
9191f089b9 | ||
|
|
5f201a38b6 |
@@ -25,3 +25,8 @@ all:
|
||||
@exit 1
|
||||
|
||||
endif
|
||||
|
||||
# Tell version 3.79 and up of GNU make to not build goals in this
|
||||
# directory in parallel. This is necessary in case someone tries to
|
||||
# build multiple targets on one command line.
|
||||
.NOTPARALLEL:
|
||||
|
||||
@@ -11,10 +11,15 @@ maintainer-check:
|
||||
$(MAKE) distcheck
|
||||
$(MAKE) my-distcheck
|
||||
|
||||
prev-version := $(shell echo $(VERSION)|tr a-z Xa-y)
|
||||
prev_version_file = .prev-version
|
||||
|
||||
THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||
PREV_VERSION := $(shell cat $(prev_version_file))
|
||||
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
|
||||
|
||||
tag-package = $(shell echo "$(PACKAGE)" | tr a-z A-Z)
|
||||
tag-this-version = $(subst .,_,$(VERSION))
|
||||
tag-prev-version = $(subst .,_,$(prev-version))
|
||||
tag-prev-version = $(subst .,_,$(PREV_VERSION))
|
||||
this-cvs-tag = $(tag-package)-$(tag-this-version)
|
||||
prev-cvs-tag = $(tag-package)-$(tag-prev-version)
|
||||
|
||||
@@ -25,6 +30,9 @@ po-check:
|
||||
diff -u $@-1 $@-2
|
||||
rm -f $@-1 $@-2
|
||||
|
||||
# Do not save the original name or timestamp in the .tar.gz file.
|
||||
GZIP_ENV = --no-name
|
||||
|
||||
# Tag before making distribution. Also, don't make a distribution if
|
||||
# checks fail. Also, make sure the NEWS file is up-to-date.
|
||||
# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
|
||||
@@ -70,12 +78,6 @@ my-distcheck: writable-files po-check
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "========================"
|
||||
|
||||
THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||
# FIXME: this works only for Gnits-style test releases.
|
||||
PREV_VERSION := $(shell echo $(VERSION)|tr b-z a-y|sed 's/a$$//')
|
||||
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
|
||||
v = Version
|
||||
|
||||
a_host = alpha.gnu.org
|
||||
b_host = freefriends.org
|
||||
|
||||
@@ -84,11 +86,12 @@ a_url_dir = $(alpha_subdir)
|
||||
b_url_dir = $(alpha_subdir)
|
||||
|
||||
a_real_dir = /fs/share/ftp/$(alpha_subdir)
|
||||
b_real_dir = /home/ftp/$(alpha_subdir)
|
||||
b_real_dir = fetish-ftp
|
||||
|
||||
url_dir_list = $(foreach x,a b,ftp://$($(x)_host)/$($(x)_url_dir))
|
||||
|
||||
md5 = $(shell md5sum < $(distdir).tar.gz|sed 's/ -//')
|
||||
sha1 = $(shell sha1sum < $(distdir).tar.gz|sed 's/ -//')
|
||||
|
||||
rel-check:
|
||||
tarz=/tmp/rel-check-tarz-$$$$; \
|
||||
@@ -119,17 +122,20 @@ announcement: NEWS ChangeLog $(distdir).tar.gz
|
||||
echo " $$url/$(xd-delta)"; \
|
||||
done; \
|
||||
echo; \
|
||||
echo "Here are the MD5 and SHA1 signatures for the .tar.gz file"; \
|
||||
echo; \
|
||||
echo "$(md5) $(distdir).tar.gz"; \
|
||||
echo "$(sha1) $(distdir).tar.gz"; \
|
||||
echo; \
|
||||
echo NEWS:; \
|
||||
sed -n "/$(THIS_VERSION_REGEXP)/,/^\[$(PREV_VERSION_REGEXP)/p" NEWS \
|
||||
| grep -v '^\['; \
|
||||
echo; \
|
||||
echo ChangeLog entries:; \
|
||||
find . -name ChangeLog \
|
||||
find . -name ChangeLog -maxdepth 2 \
|
||||
| xargs cvs diff -up -r$(prev-cvs-tag) -rHEAD \
|
||||
| sed -n 's/^+//p' \
|
||||
| perl -ne 'm!^\+\+ (\./)?! or print,next;' \
|
||||
| perl -ne 'm!^\+\+ (\./)?! or print,next;' \
|
||||
-e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
|
||||
)
|
||||
|
||||
@@ -162,9 +168,11 @@ alpha: writable-files po-check
|
||||
&& xdelta delta -9 $(prev-tgz) $(distdir).tar.gz $(xd-delta) || :
|
||||
ln $(release-archive-dir)/$(xd-delta) .
|
||||
chmod a-w $(release-archive-dir)/$(xd-delta)
|
||||
echo $(VERSION) > $(prev_version_file)
|
||||
cvs ci -m. $(prev_version_file)
|
||||
@echo =====================================
|
||||
@echo =====================================
|
||||
@echo 'scp $(xd-delta) $(distdir).tar.gz \'
|
||||
@echo 'rsync -e ssh --pro -av $(xd-delta) $(distdir).tar.gz \'
|
||||
@echo ' $(b_host):$(b_real_dir)'
|
||||
@echo '# send the /tmp/announcement e-mail'
|
||||
@echo =====================================
|
||||
|
||||
23
THANKS
23
THANKS
@@ -14,8 +14,10 @@ Alan Iwi iwi@atm.ox.ac.uk
|
||||
Alberto Accomazzi alberto@cfa0.harvard.edu
|
||||
aldomel aldomel@ix.netcom.com
|
||||
Alen Muzinic zveki@fly.cc.fer.hr
|
||||
Alexandre Duret-Lutz duret_g@epita.fr
|
||||
Alexey Solovyov alekso@math.uu.se
|
||||
Andre Novaes Cunha Andre.Cunha@br.global-one.net
|
||||
Andreas Gruenbacher ag@bestbits.at
|
||||
Andreas Jaeger jaeger@gnu.org
|
||||
Andreas Luik luik@isa.de
|
||||
Andreas Schwab schwab@suse.de
|
||||
@@ -26,6 +28,7 @@ Andrew Dalke dalke@bioreason.com
|
||||
Andrew Tridgell tridge@samba.org
|
||||
Andries Brouwer Andries.Brouwer@cwi.nl
|
||||
Andy Longton alongton@metamark.com
|
||||
Antonio Rendas ajrendas@yahoo.com
|
||||
Ariel Faigon ariel@cthulhu.engr.sgi.com
|
||||
Arne H. Juul arnej@solan.unit.no
|
||||
Arne Henrik Juul arnej@imf.unit.no
|
||||
@@ -50,9 +53,11 @@ Carlos Canau Carlos.Canau@relay.puug.pt
|
||||
Charles Karney karney@pppl.gov
|
||||
Charles Randall crandall@matchlogic.com
|
||||
Chip Salzenberg chip@valinux.com
|
||||
Chris Sylvain csylvain@umm.edu
|
||||
Chris Yeo cyeo@biking.org
|
||||
Christi Alice Scarborough christi@chiark.greenend.org.uk
|
||||
Christian Krackowizer kra1@technodat.co.at
|
||||
Christian Krackowizer ckrackowiz@std.schuler-ag.com
|
||||
Christian Rose menthos@menthos.com
|
||||
Christian von Roques roques@pond.sub.org
|
||||
Chuck Hedrick hedrick@klinzhai.rutgers.edu
|
||||
Clark Morgan cmorgan@aracnet.com
|
||||
@@ -74,7 +79,7 @@ Doug McLaren dougmc@comco.com
|
||||
Dragos Harabor dharabor@us.oracle.com
|
||||
Ed Avis epa98@doc.ic.ac.uk
|
||||
Edzer Pebesma Edzer.Pebesma@rivm.nl
|
||||
Eirik Fuller eirik@netcom.com
|
||||
Eirik Fuller eirik@hackrat.com
|
||||
Eivind eivindt@multinet.no
|
||||
Eli Zaretskii eliz@is.elta.co.il
|
||||
Emile LeBlanc leblanc@math.toronto.edu
|
||||
@@ -119,6 +124,8 @@ James Sneeringer jvs@ocslink.com
|
||||
James Tanis jtt@soscorp.com
|
||||
James Youngman james+usenet@free-lunch.demon.co.uk
|
||||
Jamie Lokier jamie@imbolc.ucc.ie
|
||||
Jan Fedak J.Fedak@sh.cvut.cz
|
||||
Jan Nieuwenhuizen janneke@gnu.org
|
||||
Janos Farkas chexum@shadow.banki.hu
|
||||
Jarkko Hietaniemi jhi@epsilon.hut.fi
|
||||
Jeff Moore jbm@mordor.com
|
||||
@@ -145,13 +152,16 @@ John Salmon johns@mullet.anu.edu.au
|
||||
John Summerfield summer@OS2.ami.com.au
|
||||
Joost van Baal joostvb@xs4all.nl
|
||||
Joseph S. Myers jsm28@cam.ac.uk
|
||||
jvogel jvogel@linkny.com
|
||||
Jungshik Shin jshin@pantheon.yale.edu
|
||||
Jürgen Fluk louis@dachau.marco.de
|
||||
jvogel jvogel@linkny.com
|
||||
Kai-Uwe Rommel rommel@informatik.tu-muenchen.de
|
||||
Kai Henningsen kai@debian.org
|
||||
Kalle Olavi Niemitalo tosi@stekt.oulu.fi
|
||||
Kamal Paul Nigam Kamal_Paul_Nigam@gs35.sp.cs.cmu.edu
|
||||
Karl Eichwalder keichwa@gmx.net
|
||||
Karl Heuer kwzh@gnu.org
|
||||
Karl-Michael Schneider schneide@phil.uni-passau.de
|
||||
Karsten Thygesen karthy@kom.auc.dk
|
||||
Kaveh R. Ghazi ghazi@caip.rutgers.edu
|
||||
Keith Owens kaos@audio.apana.org.au
|
||||
@@ -163,6 +173,7 @@ Lars Hecking lhecking@nmrc.ucc.ie
|
||||
Lehti Rami rammer@cs.tut.fi
|
||||
Leonard N. Zubkoff lnz@dandelion.com
|
||||
Lorne Baker lbaker@nitro.avint.net
|
||||
M. P. Suzuki mpsuzuki@hiroshima-u.ac.jp
|
||||
Maciej Kwapulinski pikpok@univ.gda.pl
|
||||
Manas Garg manas@cygsoft.com
|
||||
Manfred Hollstein manfred@s-direktnet.de
|
||||
@@ -175,6 +186,7 @@ Mark D. Roth roth@uiuc.edu
|
||||
Mark Harris mark@monitor.designacc.com
|
||||
Mark Hewitt mhewitt@armature.com
|
||||
Mark Kettenis kettenis@phys.uva.nl
|
||||
Mark Nudelman marknu@flash.net
|
||||
Mark W. Eichin eichin@cygnus.com
|
||||
Markus Demleitner msdemlei@auriga.ari.uni-heidelberg.de
|
||||
Martin martin@dresden.nacamar.de
|
||||
@@ -190,6 +202,7 @@ Matthew Braun matthew@ans.net
|
||||
Matthew Clarke Matthew_Clarke@mindlink.bc.ca
|
||||
Matthew S. Levine mslevine@theory.lcs.mit.edu
|
||||
Matthew Swift swift@alum.mit.edu
|
||||
Mattias Wadenstein maswan@acc.umu.se
|
||||
Matthias Urlichs smurf@noris.de
|
||||
Meelis Roos mroos@tartu.cyber.ee
|
||||
Michael ??? michael@roka.net
|
||||
@@ -268,13 +281,17 @@ Torbjorn Lindgren tl@funcom.no
|
||||
Torsten Landschoff torsten@pclab.ifg.uni-kiel.de
|
||||
Ulrich Drepper drepper@gnu.org
|
||||
Urs Thuermann urs@isnogud.escape.de
|
||||
Vesselin Atanasov vesselin@bgnet.bg
|
||||
Vin Shelton acs@alumni.princeton.edu
|
||||
Volker Borchert bt@teknon.de
|
||||
Wayne Stewart wstewa@atl.com
|
||||
Wenjun Zheng zwj@yahoo.com
|
||||
Werner Almesberger Werner.Almesberger@epfl.ch
|
||||
Wichert Akkerman wichert@cistron.nl
|
||||
Will Edgington wedgingt@acm.org
|
||||
William Bader william@nscs.fast.net
|
||||
William Dowling will@franklin.com
|
||||
William Lewis wiml@omnigroup.com
|
||||
Wolfram Kleff kleff@cs.uni-bonn.de
|
||||
Won-kyu Park wkpark@chem.skku.ac.kr
|
||||
Zvi Har'El rl@math.technion.ac.il
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
188
doc/getdate.texi
188
doc/getdate.texi
@@ -30,27 +30,32 @@ or a week from Sunday, with feelings of helpless confusion. @dots{}
|
||||
--- Robert Grudin, @cite{Time and the Art of Living}.
|
||||
@end quotation
|
||||
|
||||
This section describes the textual date representations that GNU
|
||||
This section describes the textual date representations that @sc{gnu}
|
||||
programs accept. These are the strings you, as a user, can supply as
|
||||
arguments to the various programs. The C interface (via the
|
||||
@code{getdate} function) is not described here.
|
||||
|
||||
@cindex beginning of time, for Unix
|
||||
@cindex epoch, for Unix
|
||||
Although the date syntax here can represent any possible time since zero
|
||||
A.D., computer integers are not big enough for such a (comparatively)
|
||||
long time. The earliest date semantically allowed on Unix systems is
|
||||
midnight, 1 January 1970 UCT.
|
||||
@cindex beginning of time, for @sc{posix}
|
||||
@cindex epoch, for @sc{posix}
|
||||
Although the date syntax here can represent any possible time since the
|
||||
year zero, computer integers often cannot represent such a wide range of
|
||||
time. On @sc{posix} systems, the clock starts at 1970-01-01 00:00:00
|
||||
@sc{utc}: @sc{posix} does not require support for times before the
|
||||
@sc{posix} Epoch and times far in the future. Traditional Unix systems
|
||||
have 32-bit signed @code{time_t} and can represent times from 1901-12-13
|
||||
20:45:52 through 2038-01-19 03:14:07 @sc{utc}. Systems with 64-bit
|
||||
signed @code{time_t} can represent all the times in the known
|
||||
lifetime of the universe.
|
||||
|
||||
@menu
|
||||
* General date syntax:: Common rules.
|
||||
* Calendar date items:: 19 Dec 1994.
|
||||
* Time of day items:: 9:20pm.
|
||||
* Time zone items:: EST, DST, BST, UTC, ...
|
||||
* Day of week items:: Monday and others.
|
||||
* Relative items in date strings:: next tuesday, 2 years ago.
|
||||
* Calendar date items:: 19 Dec 1994.
|
||||
* Time of day items:: 9:20pm.
|
||||
* Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt}, ...
|
||||
* Day of week items:: Monday and others.
|
||||
* Relative items in date strings:: next tuesday, 2 years ago.
|
||||
* Pure numbers in date strings:: 19931219, 1440.
|
||||
* Authors of getdate:: Bellovin, Salz, Berets, et al.
|
||||
* Authors of getdate:: Bellovin, Eggert, Salz, Berets, et al.
|
||||
@end menu
|
||||
|
||||
|
||||
@@ -113,7 +118,7 @@ specified differently, depending on whether the month is specified
|
||||
numerically or literally. All these strings specify the same calendar date:
|
||||
|
||||
@example
|
||||
1972-09-24 # ISO 8601.
|
||||
1972-09-24 # @sc{iso} 8601.
|
||||
72-9-24 # Assume 19xx for 69 through 99,
|
||||
# 20xx for 00 through 68.
|
||||
72-09-24 # Leading zeros are ignored.
|
||||
@@ -136,9 +141,9 @@ sep 24
|
||||
|
||||
Here are the rules.
|
||||
|
||||
@cindex ISO 8601 date format
|
||||
@cindex date format, ISO 8601
|
||||
For numeric months, the ISO 8601 format
|
||||
@cindex @sc{iso} 8601 date format
|
||||
@cindex date format, @sc{iso} 8601
|
||||
For numeric months, the @sc{iso} 8601 format
|
||||
@samp{@var{year}-@var{month}-@var{day}} is allowed, where @var{year} is
|
||||
any positive number, @var{month} is a number between 01 and 12, and
|
||||
@var{day} is a number between 01 and 31. A leading zero must be present
|
||||
@@ -186,7 +191,7 @@ day. Here are some examples, all of which represent the same time:
|
||||
20:02:0
|
||||
20:02
|
||||
8:02pm
|
||||
20:02-0500 # In EST (Eastern U.S. Standard Time).
|
||||
20:02-0500 # In @sc{est} (U.S. Eastern Standard Time).
|
||||
@end example
|
||||
|
||||
More generally, the time of the day may be given as
|
||||
@@ -206,6 +211,9 @@ or @samp{p.m.}), @var{hour} is restricted to run from 1 to 12, and
|
||||
indicates the first half of the day, @samp{pm} indicates the second
|
||||
half of the day. In this notation, 12 is the predecessor of 1:
|
||||
midnight is @samp{12am} while noon is @samp{12pm}.
|
||||
(This is the zero-oriented interpretation of @samp{12am} and @samp{12pm},
|
||||
as opposed to the old tradition derived from Latin
|
||||
which uses @samp{12m} for noon and @samp{12pm} for midnight.)
|
||||
|
||||
@cindex time zone correction
|
||||
@cindex minutes, time zone correction by
|
||||
@@ -214,10 +222,10 @@ expressed as @samp{@var{s}@var{hh}@var{mm}}, where @var{s} is @samp{+}
|
||||
or @samp{-}, @var{hh} is a number of zone hours and @var{mm} is a number
|
||||
of zone minutes. When a time zone correction is given this way, it
|
||||
forces interpretation of the time relative to
|
||||
Coordinated Universal Time (UTC), overriding any previous
|
||||
Coordinated Universal Time (@sc{utc}), overriding any previous
|
||||
specification for the time zone or the local time zone. The @var{minute}
|
||||
part of the time of the day may not be elided when a time zone correction
|
||||
is used. This is the only way to specify a time zone correction by
|
||||
is used. This is the best way to specify a time zone correction by
|
||||
fractional parts of an hour.
|
||||
|
||||
Either @samp{am}/@samp{pm} or a time zone correction may be specified,
|
||||
@@ -229,119 +237,18 @@ but not both.
|
||||
|
||||
@cindex time zone item
|
||||
|
||||
A @dfn{time zone item} specifies an international time zone, indicated by
|
||||
a small set of letters. They are supported for backward compatibility reasons,
|
||||
but they are not recommended because they are ambiguous in practice:
|
||||
for example, the abbreviation @samp{EST} has different meanings in
|
||||
Australia and the United States. Any included period is ignored. Military
|
||||
time zone designations use a single letter. Currently, only integral
|
||||
zone hours may be represented in a time zone item. See the previous
|
||||
section for a finer control over the time zone correction.
|
||||
A @dfn{time zone item} specifies an international time zone, indicated
|
||||
by a small set of letters, e.g., @samp{UTC} for Coordinated Universal
|
||||
Time. Any included periods are ignored. By following a
|
||||
non-daylight-saving time zone by the string @samp{DST} in a separate
|
||||
word (that is, separated by some white space), the corresponding
|
||||
daylight saving time zone may be specified.
|
||||
|
||||
Here are many non-daylight-saving-time time zones, indexed by the zone
|
||||
hour value.
|
||||
|
||||
@table @asis
|
||||
@item -1200
|
||||
@samp{Y} for militaries.
|
||||
@item -1100
|
||||
@samp{X} for militaries.
|
||||
@item -1000
|
||||
@samp{W} for militaries.
|
||||
@item -0900
|
||||
@samp{V} for militaries.
|
||||
@item -0800
|
||||
@samp{PST} for Pacific Standard, and
|
||||
@samp{U} for militaries.
|
||||
@item -0700
|
||||
@samp{MST} for Mountain Standard, and
|
||||
@samp{T} for militaries.
|
||||
@item -0600
|
||||
@samp{CST} for Central Standard, and
|
||||
@samp{S} for militaries.
|
||||
@item -0500
|
||||
@samp{EST} for Eastern Standard, and
|
||||
@samp{R} for militaries.
|
||||
@item -0400
|
||||
@samp{AST} for Atlantic Standard, and
|
||||
@samp{Q} for militaries.
|
||||
@item -0300
|
||||
@samp{P} for militaries.
|
||||
@item -0200
|
||||
@samp{O} for militaries.
|
||||
@item -0100
|
||||
@samp{N} for militaries.
|
||||
@item +0000
|
||||
@cindex Greenwich Mean Time
|
||||
@cindex Coordinated Universal Time
|
||||
@cindex Universal Coordinated Time
|
||||
@cindex Universal Time (Coordinated)
|
||||
@samp{GMT} for Greenwich Mean,
|
||||
@samp{UT} for Universal,
|
||||
@samp{UTC} for Coordinated Universal,
|
||||
@samp{WET} for Western European, and
|
||||
@samp{Z} for ISO 8601 and militaries.
|
||||
@item +0100
|
||||
@samp{A} for militaries,
|
||||
@samp{CET} for Central European,
|
||||
@samp{MET} for Midden Europesche Tijd (Dutch), and
|
||||
@samp{MEZ} for Mittel-Europ@"aische Zeit (German).
|
||||
@item +0200
|
||||
@samp{B} for militaries, and
|
||||
@samp{EET} for Eastern European.
|
||||
@item +0300
|
||||
@samp{C} for militaries.
|
||||
@item +0400
|
||||
@samp{D} for militaries.
|
||||
@item +0500
|
||||
@samp{E} for militaries.
|
||||
@item +0600
|
||||
@samp{F} for militaries.
|
||||
@item +0700
|
||||
@samp{G} for militaries.
|
||||
@item +0800
|
||||
@samp{H} for militaries.
|
||||
@item +0900
|
||||
@samp{I} for militaries, and
|
||||
@samp{JST} for Japan Standard.
|
||||
@item +1000
|
||||
@samp{GST} for Guam Standard, and
|
||||
@samp{K} for militaries.
|
||||
@item +1100
|
||||
@samp{L} for militaries.
|
||||
@item +1200
|
||||
@samp{M} for militaries, and
|
||||
@samp{NZST} for New Zealand Standard.
|
||||
@end table
|
||||
|
||||
@cindex daylight-saving time
|
||||
Here are many daylight-saving time (DST) time zones,
|
||||
indexed by the zone hour value. Also, by
|
||||
following a non-DST time zone by the string @samp{DST} in a separate word
|
||||
(that is, separated by some whitespace), the corresponding DST time zone
|
||||
may be specified.
|
||||
|
||||
@table @asis
|
||||
@item -0700
|
||||
@samp{PDT} for Pacific Daylight.
|
||||
@item -0600
|
||||
@samp{MDT} for Mountain Daylight.
|
||||
@item -0500
|
||||
@samp{CDT} for Central Daylight.
|
||||
@item -0400
|
||||
@samp{EDT} for Eastern Daylight.
|
||||
@item -0300
|
||||
@samp{ADT} for Atlantic Daylight.
|
||||
@item +0100
|
||||
@samp{BST} for British Summer, and
|
||||
@samp{WEST} for Western European Summer.
|
||||
@item +0200
|
||||
@samp{CEST} for Central European Summer,
|
||||
@samp{MEST} for Midden Europesche S. Tijd (Dutch), and
|
||||
@samp{MESZ} for Mittel-Europ@"aische Sommerzeit (German).
|
||||
@item +1300
|
||||
@samp{NZDT} for New Zealand Daylight.
|
||||
@end table
|
||||
Time zone items are obsolescent and are not recommended, because they
|
||||
are ambiguous; for example, @samp{EST} has a different meaning in
|
||||
Australia than in the United States. Instead, it's better to use
|
||||
unambiguous numeric time zone corrections like @samp{-0500}, as
|
||||
described in the previous section.
|
||||
|
||||
|
||||
@node Day of week items
|
||||
@@ -409,7 +316,7 @@ The unit of time may be preceded by a multiplier, given as an optionally
|
||||
signed number. Unsigned numbers are taken as positively signed. No
|
||||
number at all implies 1 for a multiplier. Following a relative item by
|
||||
the string @samp{ago} is equivalent to preceding the unit by a
|
||||
multiplicator with value @math{-1}.
|
||||
multiplier with value @math{-1}.
|
||||
|
||||
@findex day @r{in date strings}
|
||||
@findex tomorrow @r{in date strings}
|
||||
@@ -429,9 +336,9 @@ items, like in @samp{12:00 today}. The string @samp{this} also has
|
||||
the meaning of a zero-valued time displacement, but is preferred in
|
||||
date strings like @samp{this thursday}.
|
||||
|
||||
When a relative item causes the resulting date to cross the boundary
|
||||
between DST and non-DST (or vice-versa), the hour is adjusted according
|
||||
to the local time.
|
||||
When a relative item causes the resulting date to cross a boundary
|
||||
where the clocks were adjusted, typically for daylight-saving time,
|
||||
the resulting date and time are adjusted accordingly.
|
||||
|
||||
|
||||
@node Pure numbers in date strings
|
||||
@@ -439,8 +346,8 @@ to the local time.
|
||||
|
||||
@cindex pure numbers in date strings
|
||||
|
||||
The precise intepretation of a pure decimal number depends
|
||||
the context in the date string.
|
||||
The precise interpretation of a pure decimal number depends
|
||||
on the context in the date string.
|
||||
|
||||
If the decimal number is of the form @var{yyyy}@var{mm}@var{dd} and no
|
||||
other calendar date item (@pxref{Calendar date items}) appears before it
|
||||
@@ -468,13 +375,14 @@ year.
|
||||
@cindex Berets, Jim
|
||||
@cindex MacKenzie, David
|
||||
@cindex Meyering, Jim
|
||||
@cindex Eggert, Paul
|
||||
@code{getdate} was originally implemented by Steven M. Bellovin
|
||||
(@email{smb@@research.att.com}) while at the University of North Carolina
|
||||
at Chapel Hill. The code was later tweaked by a couple of people on
|
||||
Usenet, then completely overhauled by Rich $alz (@email{rsalz@@bbn.com})
|
||||
and Jim Berets (@email{jberets@@bbn.com}) in August, 1990. Various
|
||||
revisions for the GNU system were made by David MacKenzie, Jim Meyering,
|
||||
and others.
|
||||
revisions for the @sc{gnu} system were made by David MacKenzie, Jim Meyering,
|
||||
Paul Eggert and others.
|
||||
|
||||
@cindex Pinard, F.
|
||||
@cindex Berry, K.
|
||||
|
||||
@@ -64,7 +64,7 @@ END-INFO-DIR-ENTRY
|
||||
@ifinfo
|
||||
This file documents the GNU shell utilities.
|
||||
|
||||
Copyright (C) 1994, 95, 96 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994, 1995, 1996, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
@@ -96,7 +96,7 @@ by the Foundation.
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1994, 95, 96 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1994, 1995, 1996, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
@@ -350,6 +350,7 @@ independent way. For example, a string containing the Euro currency symbol
|
||||
$ /usr/local/bin/printf '\u20AC 14.95'
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
will be output correctly in all locales supporting the Euro symbol
|
||||
(ISO-8859-15, UTF-8, and others). Similarly, a Chinese string
|
||||
|
||||
@@ -357,18 +358,19 @@ will be output correctly in all locales supporting the Euro symbol
|
||||
$ /usr/local/bin/printf '\u4e2d\u6587'
|
||||
@end example
|
||||
|
||||
will be output correctly in all chinese locales (GB2312, BIG5, UTF-8, etc).
|
||||
@noindent
|
||||
will be output correctly in all Chinese locales (GB2312, BIG5, UTF-8, etc).
|
||||
|
||||
Note that in these examples, the full pathname of @code{printf} has been
|
||||
given, to distinguish it from the GNU @code{bash} builtin function
|
||||
@code{printf}.
|
||||
|
||||
For larger strings, you don't need to look up the hexadecimal code values of
|
||||
each character one by one. ASCII characters mixed with \u escape sequences
|
||||
is also known as the JAVA source file encoding. You can use GNU recode 3.5c
|
||||
(or newer) to convert strings to this encoding. Here is how to convert a
|
||||
piece of text into a shell script which will output this text in a locale-
|
||||
independent way:
|
||||
For larger strings, you don't need to look up the hexadecimal code
|
||||
values of each character one by one. ASCII characters mixed with \u
|
||||
escape sequences is also known as the JAVA source file encoding. You can
|
||||
use GNU recode 3.5c (or newer) to convert strings to this encoding. Here
|
||||
is how to convert a piece of text into a shell script which will output
|
||||
this text in a locale-independent way:
|
||||
|
||||
@smallexample
|
||||
$ LC_CTYPE=zh_CN.big5 /usr/local/bin/printf \
|
||||
@@ -2258,7 +2260,7 @@ Note that this value is the number of seconds between the epoch
|
||||
and the current date as defined by the localtime system call.
|
||||
It isn't changed by the @samp{--date} option.
|
||||
@item %S
|
||||
second (00@dots{}61)
|
||||
second (00@dots{}60)
|
||||
@item %T
|
||||
time, 24-hour (hh:mm:ss)
|
||||
@item %X
|
||||
@@ -2479,16 +2481,14 @@ Append the hours, minutes, and seconds.
|
||||
@end table
|
||||
|
||||
If showing any time terms, then include the time zone using the format
|
||||
@samp{%z}. If @samp{--utc} is also specified, use @samp{%Z} in place of
|
||||
@samp{%z}.
|
||||
|
||||
@item -R
|
||||
@itemx --rfc-822
|
||||
@opindex -R
|
||||
@opindex --rfc-822
|
||||
Display the time and date using the RFC-822-specified
|
||||
Display the time and date using the RFC-822-conforming
|
||||
format, @samp{%a, %_d %b %Y %H:%M:%S %z}.
|
||||
If @samp{--utc} is also specified, use @samp{GMT} in place of @samp{%z}.
|
||||
|
||||
@item -r @var{file}
|
||||
@itemx --reference=@var{file}
|
||||
@@ -2501,7 +2501,7 @@ time of @var{file}, instead of the current time and date.
|
||||
@itemx --set=@var{datestr}
|
||||
@opindex -s
|
||||
@opindex --set
|
||||
Set the time and date to @var{datestr}, See @samp{-d} above.
|
||||
Set the time and date to @var{datestr}. See @samp{-d} above.
|
||||
|
||||
@item -u
|
||||
@itemx --utc
|
||||
@@ -2509,11 +2509,16 @@ Set the time and date to @var{datestr}, See @samp{-d} above.
|
||||
@opindex -u
|
||||
@opindex --utc
|
||||
@opindex --universal
|
||||
@cindex coordinated universal time
|
||||
@cindex Coordinated Universal Time
|
||||
@cindex UTC
|
||||
@cindex Greenwich Mean Time
|
||||
Print or set the time and date in Universal Coordinated Time instead of
|
||||
in local (wall clock) time.
|
||||
|
||||
@cindex GMT
|
||||
Use Coordinated Universal Time (@sc{utc}) by operating as if the
|
||||
@env{TZ} environment variable was set to the string @samp{UTC0}.
|
||||
Normally, @command{date} operates in the time zone indicated by
|
||||
@env{TZ}, or the system default if @env{TZ} is not set. Coordinated
|
||||
Universal Time is often called ``Greenwich Mean Time'' (@sc{gmt}) for
|
||||
historical reasons.
|
||||
@end table
|
||||
|
||||
|
||||
@@ -2591,7 +2596,7 @@ To convert a date string to the number of seconds since the epoch
|
||||
the @samp{%s} format. That can be useful in sorting and/or graphing
|
||||
and/or comparing data by date. The following command outputs the
|
||||
number of the seconds since the epoch for the time one second later
|
||||
than the epoch, but in time zone five hours later (Cambridge, Massachusetts),
|
||||
than the epoch, but in a time zone five hours later (Cambridge, Massachusetts),
|
||||
thus a total of five hours and one second after the epoch:
|
||||
|
||||
@example
|
||||
@@ -2956,7 +2961,7 @@ nohup @var{command} [@var{arg}]@dots{}
|
||||
|
||||
@flindex nohup.out
|
||||
@code{nohup} increases the scheduling priority of @var{command} by 5, so
|
||||
it has a slightly smaller change to run. If standard output is a terminal,
|
||||
it has a slightly smaller chance to run. If standard output is a terminal,
|
||||
it and standard error are redirected so that they are appended to the
|
||||
file @file{nohup.out}; if that cannot be written to, they are appended
|
||||
to the file @file{$HOME/nohup.out}. If that cannot be written to, the
|
||||
@@ -3335,11 +3340,11 @@ $ seq -s' ' 0 .1 .3
|
||||
0 0.1 0.2
|
||||
@end example
|
||||
|
||||
But doesn't happen on most systems because @code{seq} is implemented using
|
||||
binary floating point arithmetic (via the C @code{double} type) -- which
|
||||
means some decimal numbers like @code{.1} cannot be represented exactly.
|
||||
That in turn means some nonintuitive conditions like @code{.1 * 3 > .3}
|
||||
will end up being true.
|
||||
But that doesn't happen on most systems because @code{seq} is
|
||||
implemented using binary floating point arithmetic (via the C
|
||||
@code{double} type) -- which means some decimal numbers like @code{.1}
|
||||
cannot be represented exactly. That in turn means some nonintuitive
|
||||
conditions like @code{.1 * 3 > .3} will end up being true.
|
||||
|
||||
To work around that in the above example, use a slightly larger number as
|
||||
the @var{last} value:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
% Load plain if necessary, i.e., if running under initex.
|
||||
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
|
||||
%
|
||||
\def\texinfoversion{2000-09-06.09}
|
||||
\def\texinfoversion{2000-11-09.08}
|
||||
%
|
||||
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
% Free Software Foundation, Inc.
|
||||
@@ -688,16 +688,39 @@ where each line of input produces a line of output.}
|
||||
\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
|
||||
\leftline{\hskip\leftskip{\rm#1}}}}
|
||||
|
||||
% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
|
||||
|
||||
\def\inmargin#1{%
|
||||
\strut\vadjust{\nobreak\kern-\strutdepth
|
||||
\vtop to \strutdepth{\baselineskip\strutdepth\vss
|
||||
\llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
|
||||
% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
|
||||
% paragraph. For more general purposes, use the \margin insertion
|
||||
% class. WHICH is `l' or `r'.
|
||||
%
|
||||
\newskip\inmarginspacing \inmarginspacing=1cm
|
||||
\def\strutdepth{\dp\strutbox}
|
||||
|
||||
%\hbox{{\rm#1}}\hfil\break}}
|
||||
%
|
||||
\def\doinmargin#1#2{\strut\vadjust{%
|
||||
\nobreak
|
||||
\kern-\strutdepth
|
||||
\vtop to \strutdepth{%
|
||||
\baselineskip=\strutdepth
|
||||
\vss
|
||||
% if you have multiple lines of stuff to put here, you'll need to
|
||||
% make the vbox yourself of the appropriate size.
|
||||
\ifx#1l%
|
||||
\llap{#2\hskip\inmarginspacing}%
|
||||
\else
|
||||
\rlap{\hskip\hsize\hskip\inmarginspacing#2}%
|
||||
\fi
|
||||
\null
|
||||
}%
|
||||
}}
|
||||
\def\inleftmargin{\doinmargin l}
|
||||
\def\inrightmargin{\doinmargin r}
|
||||
\def\inmargin{% not perfect, but better than nothing.
|
||||
\ifodd\pageno
|
||||
\let\temp=\inleftmargin
|
||||
\else
|
||||
\let\temp=\inrightmargin
|
||||
\fi
|
||||
\temp
|
||||
}
|
||||
|
||||
% @include file insert text of that file as input.
|
||||
% Allow normal characters that we make active in the argument (a file name).
|
||||
@@ -2593,42 +2616,48 @@ width0pt\relax} \fi
|
||||
}
|
||||
|
||||
% @defindex foo == \newindex{foo}
|
||||
|
||||
%
|
||||
\def\defindex{\parsearg\newindex}
|
||||
|
||||
% Define @defcodeindex, like @defindex except put all entries in @code.
|
||||
|
||||
%
|
||||
\def\defcodeindex{\parsearg\newcodeindex}
|
||||
%
|
||||
\def\newcodeindex#1{%
|
||||
\iflinks
|
||||
\expandafter\newwrite \csname#1indfile\endcsname
|
||||
\openout \csname#1indfile\endcsname \jobname.#1
|
||||
\fi
|
||||
\expandafter\xdef\csname#1index\endcsname{%
|
||||
\noexpand\docodeindex{#1}}
|
||||
\noexpand\docodeindex{#1}}%
|
||||
}
|
||||
|
||||
\def\defcodeindex{\parsearg\newcodeindex}
|
||||
|
||||
% @synindex foo bar makes index foo feed into index bar.
|
||||
% Do this instead of @defindex foo if you don't want it as a separate index.
|
||||
% The \closeout helps reduce unnecessary open files; the limit on the
|
||||
% Acorn RISC OS is a mere 16 files.
|
||||
\def\synindex#1 #2 {%
|
||||
\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
|
||||
\expandafter\closeout\csname#1indfile\endcsname
|
||||
\expandafter\let\csname#1indfile\endcsname=\synindexfoo
|
||||
\expandafter\xdef\csname#1index\endcsname{% define \xxxindex
|
||||
\noexpand\doindex{#2}}%
|
||||
}
|
||||
|
||||
%
|
||||
% @syncodeindex foo bar similar, but put all entries made for index foo
|
||||
% inside @code.
|
||||
\def\syncodeindex#1 #2 {%
|
||||
\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
|
||||
\expandafter\closeout\csname#1indfile\endcsname
|
||||
\expandafter\let\csname#1indfile\endcsname=\synindexfoo
|
||||
\expandafter\xdef\csname#1index\endcsname{% define \xxxindex
|
||||
\noexpand\docodeindex{#2}}%
|
||||
%
|
||||
\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
|
||||
\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
|
||||
|
||||
% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
|
||||
% #3 the target index (bar).
|
||||
\def\dosynindex#1#2#3{%
|
||||
% Only do \closeout if we haven't already done it, else we'll end up
|
||||
% closing the target index.
|
||||
\expandafter \ifx\csname donesynindex#2\endcsname \undefined
|
||||
% The \closeout helps reduce unnecessary open files; the limit on the
|
||||
% Acorn RISC OS is a mere 16 files.
|
||||
\expandafter\closeout\csname#2indfile\endcsname
|
||||
\expandafter\let\csname\donesynindex#2\endcsname = 1
|
||||
\fi
|
||||
% redefine \fooindfile:
|
||||
\expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
|
||||
\expandafter\let\csname#2indfile\endcsname=\temp
|
||||
% redefine \fooindex:
|
||||
\expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
|
||||
}
|
||||
|
||||
% Define \doindex, the driver for all \fooindex macros.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
\input texinfo
|
||||
@c %**start of header
|
||||
@setfilename textutils.info
|
||||
@settitle GNU text utilities
|
||||
@settitle @sc{gnu} text utilities
|
||||
@c %**end of header
|
||||
|
||||
@include version.texi
|
||||
@@ -20,7 +20,7 @@
|
||||
@ifinfo
|
||||
@format
|
||||
START-INFO-DIR-ENTRY
|
||||
* Text utilities: (textutils). GNU text utilities.
|
||||
* Text utilities: (textutils). GNU text utilities.
|
||||
* cat: (textutils)cat invocation. Concatenate and write files.
|
||||
* cksum: (textutils)cksum invocation. Print @sc{posix} CRC checksum.
|
||||
* comm: (textutils)comm invocation. Compare sorted files by line.
|
||||
@@ -56,30 +56,18 @@ This file documents the GNU text utilities.
|
||||
|
||||
Copyright (C) 1994, 95, 96 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, with no
|
||||
Front-Cover Texts, and with no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled ``GNU
|
||||
Free Documentation License''.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through TeX and print the
|
||||
results, provided the printed document carries copying permission
|
||||
notice identical to this one except for the removal of this paragraph
|
||||
(this paragraph not being relevant to the printed manual).
|
||||
|
||||
@end ignore
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the entire
|
||||
resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation approved
|
||||
by the Foundation.
|
||||
@end ifinfo
|
||||
|
||||
@titlepage
|
||||
@title GNU @code{textutils}
|
||||
@title @sc{gnu} @code{textutils}
|
||||
@subtitle A set of text utilities
|
||||
@subtitle for version @value{VERSION}, @value{UPDATED}
|
||||
@author David MacKenzie et al.
|
||||
@@ -88,19 +76,13 @@ by the Foundation.
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1994, 95, 96 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the entire
|
||||
resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation approved
|
||||
by the Foundation.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, with no
|
||||
Front-Cover Texts, and with no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled ``GNU
|
||||
Free Documentation License''.
|
||||
@end titlepage
|
||||
|
||||
|
||||
@@ -114,7 +96,7 @@ by the Foundation.
|
||||
@cindex text utilities
|
||||
@cindex utilities for text handling
|
||||
|
||||
This manual documents version @value{VERSION} of the GNU text utilities.
|
||||
This manual documents version @value{VERSION} of the @sc{gnu} text utilities.
|
||||
|
||||
@menu
|
||||
* Introduction:: Caveats, overview, and authors.
|
||||
@@ -217,11 +199,12 @@ Opening the software toolbox
|
||||
|
||||
This manual is incomplete: No attempt is made to explain basic concepts
|
||||
in a way suitable for novices. Thus, if you are interested, please get
|
||||
involved in improving this manual. The entire GNU community will
|
||||
involved in improving this manual. The entire @sc{gnu} community will
|
||||
benefit.
|
||||
|
||||
@cindex POSIX.2
|
||||
The GNU text utilities are mostly compatible with the @sc{posix.2} standard.
|
||||
The @sc{gnu} text utilities are mostly compatible with the @sc{posix.2}
|
||||
standard.
|
||||
|
||||
@c This paragraph appears in all of fileutils.texi, textutils.texi, and
|
||||
@c sh-utils.texi too -- so be sure to keep them consistent.
|
||||
@@ -251,7 +234,7 @@ overall process.
|
||||
|
||||
Certain options are available in all of these programs. Rather than
|
||||
writing identical descriptions for each of the programs, they are
|
||||
described here. (In fact, every GNU program accepts (or should accept)
|
||||
described here. (In fact, every @sc{gnu} program accepts (or should accept)
|
||||
these options.)
|
||||
|
||||
Some of these programs recognize the @samp{--help} and @samp{--version}
|
||||
@@ -692,19 +675,19 @@ to the output line generated by the type specification.
|
||||
|
||||
@table @samp
|
||||
@item a
|
||||
named character,
|
||||
named character
|
||||
@item c
|
||||
@sc{ascii} character or backslash escape,
|
||||
@item d
|
||||
signed decimal,
|
||||
signed decimal
|
||||
@item f
|
||||
floating point,
|
||||
floating point
|
||||
@item o
|
||||
octal,
|
||||
octal
|
||||
@item u
|
||||
unsigned decimal,
|
||||
unsigned decimal
|
||||
@item x
|
||||
hexadecimal.
|
||||
hexadecimal
|
||||
@end table
|
||||
|
||||
The type @code{a} outputs things like @samp{sp} for space, @samp{nl} for
|
||||
@@ -722,24 +705,24 @@ one of the following characters. For integers (@samp{d}, @samp{o},
|
||||
|
||||
@table @samp
|
||||
@item C
|
||||
char,
|
||||
char
|
||||
@item S
|
||||
short,
|
||||
short
|
||||
@item I
|
||||
int,
|
||||
int
|
||||
@item L
|
||||
long.
|
||||
long
|
||||
@end table
|
||||
|
||||
For floating point (@code{f}):
|
||||
|
||||
@table @asis
|
||||
@item F
|
||||
float,
|
||||
float
|
||||
@item D
|
||||
double,
|
||||
double
|
||||
@item L
|
||||
long double.
|
||||
long double
|
||||
@end table
|
||||
|
||||
@item -v
|
||||
@@ -763,7 +746,8 @@ is not given at all, the default is 16.
|
||||
@end table
|
||||
|
||||
The next several options map the old, pre-@sc{posix} format specification
|
||||
options to the corresponding @sc{posix} format specs. GNU @code{od} accepts
|
||||
options to the corresponding @sc{posix} format specs.
|
||||
@sc{gnu} @code{od} accepts
|
||||
any combination of old- and new-style options. Format specification
|
||||
options accumulate.
|
||||
|
||||
@@ -983,27 +967,35 @@ is @samp{space}). For multicolumn output, lines will always be truncated to
|
||||
column output no line truncation occurs by default. Use @samp{-W} option to
|
||||
truncate lines in that case.
|
||||
|
||||
@c FIXME:??? Should this be something like "Starting with version 1.22i,..."
|
||||
Including version 1.22i:
|
||||
|
||||
The following changes were made in version 1.22i and apply to later
|
||||
versions of @command{pr}:
|
||||
@c FIXME: this whole section here sounds very awkward to me. I
|
||||
@c made a few small changes, but really it all needs to be redone. - Brian
|
||||
Some small @var{letter options} (@samp{-s}, @samp{-w}) have been redefined
|
||||
with the object of a better @sc{posix} compliance. The output of some
|
||||
further cases has been adapted to other Unix systems. These changes are
|
||||
not compatible with earlier versions of the program.
|
||||
@c OK, I fixed another sentence or two, but some of it I just don't understand.
|
||||
@ - Brian
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
Some small @var{letter options} (@samp{-s}, @samp{-w}) have been
|
||||
redefined for better @sc{posix} compliance. The output of some further
|
||||
cases has been adapted to other Unix systems. These changes are not
|
||||
compatible with earlier versions of the program.
|
||||
|
||||
@item
|
||||
Some @var{new capital letter} options (@samp{-J}, @samp{-S}, @samp{-W})
|
||||
have been introduced to turn off unexpected interferences of small letter
|
||||
options. The @samp{-N} option and the second argument @var{last_page}
|
||||
of @samp{+FIRST_PAGE} offer more flexibility. The detailed handling of
|
||||
form feeds set in the input files requires the @samp{-T} option.
|
||||
|
||||
@item
|
||||
Capital letter options override small letter ones.
|
||||
|
||||
@item
|
||||
Some of the option-arguments (compare @samp{-s}, @samp{-S}, @samp{-e},
|
||||
@samp{-i}, @samp{-n}) cannot be specified as separate arguments from the
|
||||
preceding option letter (already stated in the @sc{posix} specification).
|
||||
@end itemize
|
||||
|
||||
The program accepts the following options. Also see @ref{Common options}.
|
||||
|
||||
@@ -1194,12 +1186,12 @@ opened. (The exit status will still be nonzero, however.)
|
||||
@itemx --separator[=@var{char}]
|
||||
@opindex -s
|
||||
@opindex --separator
|
||||
Separate columns by a single character @var{char}. Default for @var{char}
|
||||
is the TAB character without @samp{-w} and @samp{no character} with
|
||||
@samp{-w}. Without @samp{-s} default separator @samp{space} is set.
|
||||
@samp{-s[char]} turns off line truncation of all three column options
|
||||
(@samp{-COLUMN}|@samp{-a -COLUMN}|@samp{-m}) except @samp{-w} is set.
|
||||
That is a @sc{posix}-compliant formulation.
|
||||
Separate columns by a single character @var{char}. The default for
|
||||
@var{char} is the TAB character without @samp{-w} and @samp{no
|
||||
character} with @samp{-w}. Without @samp{-s} the default separator
|
||||
@samp{space} is set. @samp{-s[char]} turns off line truncation of all
|
||||
three column options (@samp{-COLUMN}|@samp{-a -COLUMN}|@samp{-m}) unless
|
||||
@samp{-w} is set. This is a @sc{posix}-compliant formulation.
|
||||
|
||||
|
||||
@item -S[@var{string}]
|
||||
@@ -1437,13 +1429,13 @@ one-line header consisting of
|
||||
before the output for each @var{file}.
|
||||
|
||||
@cindex BSD @code{tail}
|
||||
GNU @code{tail} can output any amount of data (some other versions of
|
||||
@sc{gnu} @code{tail} can output any amount of data (some other versions of
|
||||
@code{tail} cannot). It also has no @samp{-r} option (print in
|
||||
reverse), since reversing a file is really a different job from printing
|
||||
the end of a file; BSD @code{tail} (which is the one with @code{-r}) can
|
||||
only reverse files that are at most as large as its buffer, which is
|
||||
typically 32k. A more reliable and versatile way to reverse files is
|
||||
the GNU @code{tac} command.
|
||||
the @sc{gnu} @code{tac} command.
|
||||
|
||||
@code{tail} accepts two option formats: the new one, in which numbers
|
||||
are arguments to the options (@samp{-n 1}), and the old one, in which
|
||||
@@ -1702,9 +1694,9 @@ exhausted.
|
||||
|
||||
The output files' names consist of a prefix (@samp{xx} by default)
|
||||
followed by a suffix. By default, the suffix is an ascending sequence
|
||||
of two-digit decimal numbers from @samp{00} and up to @samp{99}. In any
|
||||
case, concatenating the output files in sorted order by filename
|
||||
produces the original input file.
|
||||
of two-digit decimal numbers from @samp{00} to @samp{99}. In any case,
|
||||
concatenating the output files in sorted order by filename produces the
|
||||
original input file.
|
||||
|
||||
By default, if @code{csplit} encounters an error or receives a hangup,
|
||||
interrupt, quit, or terminate signal, it removes any output files
|
||||
@@ -1821,9 +1813,9 @@ in columns. However, @sc{posix} requires that there be exactly one space
|
||||
separating columns. You can make @code{wc} use the @sc{posix}-mandated
|
||||
output format by setting the @env{POSIXLY_CORRECT} environment variable.
|
||||
|
||||
By default, @code{wc} prints three counts: the newline, words, byte counts.
|
||||
Options can specify that only certain counts be printed. Options do not
|
||||
undo others previously given, so
|
||||
By default, @code{wc} prints three counts: the newline, words, and byte
|
||||
counts. Options can specify that only certain counts be printed.
|
||||
Options do not undo others previously given, so
|
||||
|
||||
@example
|
||||
wc --bytes --words
|
||||
@@ -1890,10 +1882,10 @@ sum [@var{option}]@dots{} [@var{file}]@dots{}
|
||||
@code{sum} prints the checksum for each @var{file} followed by the
|
||||
number of blocks in the file (rounded up). If more than one @var{file}
|
||||
is given, file names are also printed (by default). (With the
|
||||
@samp{--sysv} option, corresponding file name are printed when there is
|
||||
@samp{--sysv} option, corresponding file names are printed when there is
|
||||
at least one file argument.)
|
||||
|
||||
By default, GNU @code{sum} computes checksums using an algorithm
|
||||
By default, @sc{gnu} @code{sum} computes checksums using an algorithm
|
||||
compatible with BSD @code{sum} and prints file sizes in units of
|
||||
1024-byte blocks.
|
||||
|
||||
@@ -2125,9 +2117,9 @@ disables this last-resort comparison so that lines in which all fields
|
||||
compare equal are left in their original relative order. If no fields
|
||||
or global options are specified, @samp{-s} has no effect.
|
||||
|
||||
GNU @code{sort} (as specified for all GNU utilities) has no limits on
|
||||
@sc{gnu} @code{sort} (as specified for all @sc{gnu} utilities) has no limits on
|
||||
input line length or restrictions on bytes allowed within lines. In
|
||||
addition, if the final byte of an input file is not a newline, GNU
|
||||
addition, if the final byte of an input file is not a newline, @sc{gnu}
|
||||
@code{sort} silently supplies one. A line's trailing newline is not
|
||||
part of the line for comparison purposes.@footnote{@sc{posix}.2-1992
|
||||
requires that the trailing newline be part of the comparison, and some
|
||||
@@ -2277,7 +2269,9 @@ string between a non-whitespace character and a whitespace character.
|
||||
That is, given the input line @w{@samp{ foo bar}}, @code{sort} breaks it
|
||||
into fields @w{@samp{ foo}} and @w{@samp{ bar}}. The field separator is
|
||||
not considered to be part of either the field preceding or the field
|
||||
following.
|
||||
following. But note that sort fields that extend to the end of the line,
|
||||
as @samp{-k 2}, or sort fields consisting of a range, as @samp{-k 2,3},
|
||||
retain the field separators present between the endpoints of the range.
|
||||
|
||||
@item -T @var{tempdir}
|
||||
@opindex -T
|
||||
@@ -2325,13 +2319,13 @@ and character positions are numbered starting with 0. See below.
|
||||
|
||||
@end table
|
||||
|
||||
In addition, when GNU @code{sort} is invoked with exactly one argument,
|
||||
In addition, when @sc{gnu} @code{sort} is invoked with exactly one argument,
|
||||
options @samp{--help} and @samp{--version} are recognized. @xref{Common
|
||||
options}.
|
||||
|
||||
Historical (BSD and System V) implementations of @code{sort} have
|
||||
differed in their interpretation of some options, particularly
|
||||
@samp{-b}, @samp{-f}, and @samp{-n}. GNU sort follows the @sc{posix}
|
||||
@samp{-b}, @samp{-f}, and @samp{-n}. @sc{gnu} sort follows the @sc{posix}
|
||||
behavior, which is usually (but not always!) like the System V behavior.
|
||||
According to @sc{posix}, @samp{-n} no longer implies @samp{-b}. For
|
||||
consistency, @samp{-M} has been changed in the same way. This may
|
||||
@@ -2389,7 +2383,7 @@ sort -t : -k 2,2n -k 5.3,5.4
|
||||
@end example
|
||||
|
||||
Note that if you had written @samp{-k 2} instead of @samp{-k 2,2}
|
||||
@samp{sort} would have used all characters beginning in the second field
|
||||
@command{sort} would have used all characters beginning in the second field
|
||||
and extending to the end of the line as the primary @emph{numeric}
|
||||
key. For the large majority of applications, treating keys spanning
|
||||
more than one field as numeric will not do what you expect.
|
||||
@@ -2530,7 +2524,7 @@ Print only duplicate lines.
|
||||
Print all duplicate lines and only duplicate lines.
|
||||
This option is useful mainly in conjunction with other options e.g.,
|
||||
to ignore case or to compare only selected fields.
|
||||
This is a GNU extension.
|
||||
This is a @sc{gnu} extension.
|
||||
@c FIXME: give an example showing *how* it's useful
|
||||
|
||||
@item -u
|
||||
@@ -2659,15 +2653,15 @@ ptx -G [@var{option} @dots{}] [@var{input} [@var{output}]]
|
||||
@end example
|
||||
|
||||
The @samp{-G} (or its equivalent: @samp{--traditional}) option disables
|
||||
all GNU extensions and reverts to traditional mode, thus introducing some
|
||||
all @sc{gnu} extensions and reverts to traditional mode, thus introducing some
|
||||
limitations and changing several of the program's default option values.
|
||||
When @samp{-G} is not specified, GNU extensions are always enabled. GNU
|
||||
extensions to @code{ptx} are documented wherever appropriate in this
|
||||
When @samp{-G} is not specified, @sc{gnu} extensions are always enabled.
|
||||
@sc{gnu} extensions to @code{ptx} are documented wherever appropriate in this
|
||||
document. For the full list, see @xref{Compatibility in ptx}.
|
||||
|
||||
Individual options are explained in the following sections.
|
||||
|
||||
When GNU extensions are enabled, there may be zero, one or several
|
||||
When @sc{gnu} extensions are enabled, there may be zero, one or several
|
||||
@var{file}s after the options. If there is no @var{file}, the program
|
||||
reads the standard input. If there is one or several @var{file}s, they
|
||||
give the name of input files which are all read in turn, as if all the
|
||||
@@ -2677,7 +2671,7 @@ file names and line numbers refer to individual text input files. In
|
||||
all cases, the program outputs the permuted index to the standard
|
||||
output.
|
||||
|
||||
When GNU extensions are @emph{not} enabled, that is, when the program
|
||||
When @sc{gnu} extensions are @emph{not} enabled, that is, when the program
|
||||
operates in traditional mode, there may be zero, one or two parameters
|
||||
besides the options. If there are no parameters, the program reads the
|
||||
standard input and outputs the permuted index to the standard output.
|
||||
@@ -2687,7 +2681,7 @@ respectively the name of the @var{input} file to read and the name of
|
||||
the @var{output} file to produce. @emph{Be very careful} to note that,
|
||||
in this case, the contents of file given by the second parameter is
|
||||
destroyed. This behavior is dictated by System V @code{ptx}
|
||||
compatibility; GNU Standards normally discourage output parameters not
|
||||
compatibility; @sc{gnu} Standards normally discourage output parameters not
|
||||
introduced by an option.
|
||||
|
||||
Note that for @emph{any} file named as the value of an option or as an
|
||||
@@ -2716,7 +2710,7 @@ exit without further processing.
|
||||
|
||||
@item -G
|
||||
@itemx --traditional
|
||||
As already explained, this option disables all GNU extensions to
|
||||
As already explained, this option disables all @sc{gnu} extensions to
|
||||
@code{ptx} and switches to traditional mode.
|
||||
|
||||
@item --help
|
||||
@@ -2737,7 +2731,7 @@ processing.
|
||||
As it is set up now, the program assumes that the input file is coded
|
||||
using 8-bit ISO 8859-1 code, also known as Latin-1 character set,
|
||||
@emph{unless} it is compiled for MS-DOS, in which case it uses the
|
||||
character set of the IBM-PC. (GNU @code{ptx} is not known to work on
|
||||
character set of the IBM-PC. (@sc{gnu} @code{ptx} is not known to work on
|
||||
smaller MS-DOS machines anymore.) Compared to 7-bit @sc{ascii}, the set
|
||||
of characters which are letters is different; this alters the behavior
|
||||
of regular expression matching. Thus, the default regular expression
|
||||
@@ -2770,9 +2764,9 @@ is not part of the Break file is a word constituent. If both options
|
||||
@samp{-b} and @samp{-W} are specified, then @samp{-W} has precedence and
|
||||
@samp{-b} is ignored.
|
||||
|
||||
When GNU extensions are enabled, the only way to avoid newline as a
|
||||
When @sc{gnu} extensions are enabled, the only way to avoid newline as a
|
||||
break character is to write all the break characters in the file with no
|
||||
newline at all, not even at the end of the file. When GNU extensions
|
||||
newline at all, not even at the end of the file. When @sc{gnu} extensions
|
||||
are disabled, spaces, tabs and newlines are always considered as break
|
||||
characters even if not included in the Break file.
|
||||
|
||||
@@ -2799,9 +2793,9 @@ is ignored. The file is called the @dfn{Only file}. The file contains
|
||||
exactly one word in each line; the end of line separation of words is
|
||||
not subject to the value of the @samp{-S} option.
|
||||
|
||||
There is no default for the Only file. In the case there are both an
|
||||
Only file and an Ignore file, a word can be a keyword only if it is
|
||||
given in the Only file and not given in the Ignore file.
|
||||
There is no default for the Only file. When both an Only file and an
|
||||
Ignore file are specified, a word is considered a keyword only
|
||||
if it is listed in the Only file and not in the Ignore file.
|
||||
|
||||
@item -r
|
||||
@itemx --references
|
||||
@@ -2815,7 +2809,7 @@ Using this option changes the default value for option @samp{-S}.
|
||||
Using this option, the program does not try very hard to remove
|
||||
references from contexts in output, but it succeeds in doing so
|
||||
@emph{when} the context ends exactly at the newline. If option
|
||||
@samp{-r} is used with @samp{-S} default value, or when GNU extensions
|
||||
@samp{-r} is used with @samp{-S} default value, or when @sc{gnu} extensions
|
||||
are disabled, this condition is always met and references are completely
|
||||
excluded from the output contexts.
|
||||
|
||||
@@ -2826,15 +2820,15 @@ This option selects which regular expression will describe the end of a
|
||||
line or the end of a sentence. In fact, this regular expression is not
|
||||
the only distinction between end of lines or end of sentences, and input
|
||||
line boundaries have no special significance outside this option. By
|
||||
default, when GNU extensions are enabled and if @samp{-r} option is not
|
||||
default, when @sc{gnu} extensions are enabled and if @samp{-r} option is not
|
||||
used, end of sentences are used. In this case, this @var{regex} is
|
||||
imported from GNU Emacs:
|
||||
imported from @sc{gnu} Emacs:
|
||||
|
||||
@example
|
||||
[.?!][]\"')@}]*\\($\\|\t\\| \\)[ \t\n]*
|
||||
@end example
|
||||
|
||||
Whenever GNU extensions are disabled or if @samp{-r} option is used, end
|
||||
Whenever @sc{gnu} extensions are disabled or if @samp{-r} option is used, end
|
||||
of lines are used; in this case, the default @var{regexp} is just:
|
||||
|
||||
@example
|
||||
@@ -2866,8 +2860,8 @@ corresponding characters by @code{ptx} itself.
|
||||
@itemx --word-regexp=@var{regexp}
|
||||
|
||||
This option selects which regular expression will describe each keyword.
|
||||
By default, if GNU extensions are enabled, a word is a sequence of
|
||||
letters; the @var{regexp} used is @samp{\w+}. When GNU extensions are
|
||||
By default, if @sc{gnu} extensions are enabled, a word is a sequence of
|
||||
letters; the @var{regexp} used is @samp{\w+}. When @sc{gnu} extensions are
|
||||
disabled, a word is by default anything which ends with a space, a tab
|
||||
or a newline; the @var{regexp} used is @samp{[^ \t\n]+}.
|
||||
|
||||
@@ -2887,14 +2881,14 @@ the corresponding characters by @code{ptx} itself.
|
||||
|
||||
Output format is mainly controlled by the @samp{-O} and @samp{-T} options
|
||||
described in the table below. When neither @samp{-O} nor @samp{-T} are
|
||||
selected, and if GNU extensions are enabled, the program chooses an
|
||||
selected, and if @sc{gnu} extensions are enabled, the program chooses an
|
||||
output format suitable for a dumb terminal. Each keyword occurrence is
|
||||
output to the center of one line, surrounded by its left and right
|
||||
contexts. Each field is properly justified, so the concordance output
|
||||
can be readily observed. As a special feature, if automatic
|
||||
references are selected by option @samp{-A} and are output before the
|
||||
left context, that is, if option @samp{-R} is @emph{not} selected, then
|
||||
a colon is added after the reference; this nicely interfaces with GNU
|
||||
a colon is added after the reference; this nicely interfaces with @sc{gnu}
|
||||
Emacs @code{next-error} processing. In this default output format, each
|
||||
white space character, like newline and tab, is merely changed to
|
||||
exactly one space, with no special attempt to compress consecutive
|
||||
@@ -2915,13 +2909,13 @@ output line.
|
||||
@item -w @var{number}
|
||||
@itemx --width=@var{number}
|
||||
|
||||
Select the output maximum width of each final line. If references are
|
||||
used, they are included or excluded from the output maximum width
|
||||
Select the maximum output width of each final line. If references are
|
||||
used, they are included or excluded from the maximum output width
|
||||
depending on the value of option @samp{-R}. If this option is not
|
||||
selected, that is, when references are output before the left context,
|
||||
the output maximum width takes into account the maximum length of all
|
||||
the maximum output width takes into account the maximum length of all
|
||||
references. If this option is selected, that is, when references are
|
||||
output after the right context, the output maximum width does not take
|
||||
output after the right context, the maximum output width does not take
|
||||
into account the space taken by references, nor the gap that precedes
|
||||
them.
|
||||
|
||||
@@ -2938,17 +2932,16 @@ reference is used at output time, overriding the input reference.
|
||||
@item -R
|
||||
@itemx --right-side-refs
|
||||
|
||||
In default output format, when option @samp{-R} is not used, any
|
||||
reference produced by the effect of options @samp{-r} or @samp{-A} are
|
||||
given to the far right of output lines, after the right context. In
|
||||
default output format, when option @samp{-R} is specified, references
|
||||
are rather given to the beginning of each output line, before the left
|
||||
context. For any other output format, option @samp{-R} is almost
|
||||
ignored, except for the fact that the width of references is @emph{not}
|
||||
taken into account in total output width given by @samp{-w} whenever
|
||||
@samp{-R} is selected.
|
||||
In the default output format, when option @samp{-R} is not used, any
|
||||
references produced by the effect of options @samp{-r} or @samp{-A} are
|
||||
placed to the far right of output lines, after the right context. With
|
||||
default output format, when the @samp{-R} option is specified, references
|
||||
are rather placed at the beginning of each output line, before the left
|
||||
context. For any other output format, option @samp{-R} is
|
||||
ignored, with one exception: with @samp{-R} the width of references
|
||||
is @emph{not} taken into account in total output width given by @samp{-w}.
|
||||
|
||||
This option is automatically selected whenever GNU extensions are
|
||||
This option is automatically selected whenever @sc{gnu} extensions are
|
||||
disabled.
|
||||
|
||||
@item -F @var{string}
|
||||
@@ -2990,8 +2983,8 @@ processing. Each output line will look like:
|
||||
@end smallexample
|
||||
|
||||
so it will be possible to write a @samp{.xx} roff macro to take care of
|
||||
the output typesetting. This is the default output format when GNU
|
||||
extensions are disabled. Option @samp{-M} might be used to change
|
||||
the output typesetting. This is the default output format when @sc{gnu}
|
||||
extensions are disabled. Option @samp{-M} can be used to change
|
||||
@samp{xx} to another macro name.
|
||||
|
||||
In this output format, each non-graphical character, like newline and
|
||||
@@ -3014,48 +3007,48 @@ so it will be possible to write a @code{\xx} definition to take care of
|
||||
the output typesetting. Note that when references are not being
|
||||
produced, that is, neither option @samp{-A} nor option @samp{-r} is
|
||||
selected, the last parameter of each @code{\xx} call is inhibited.
|
||||
Option @samp{-M} might be used to change @samp{xx} to another macro
|
||||
Option @samp{-M} can be used to change @samp{xx} to another macro
|
||||
name.
|
||||
|
||||
In this output format, some special characters, like @kbd{$}, @kbd{%},
|
||||
@kbd{&}, @kbd{#} and @kbd{_} are automatically protected with a
|
||||
backslash. Curly brackets @kbd{@{}, @kbd{@}} are also protected with a
|
||||
backslash, but also enclosed in a pair of dollar signs to force
|
||||
mathematical mode. The backslash itself produces the sequence
|
||||
@code{\backslash@{@}}. Circumflex and tilde diacritics produce the
|
||||
sequence @code{^\@{ @}} and @code{~\@{ @}} respectively. Other
|
||||
diacriticized characters of the underlying character set produce an
|
||||
appropriate @TeX{} sequence as far as possible. The other non-graphical
|
||||
characters, like newline and tab, and all others characters which are
|
||||
not part of @sc{ascii}, are merely changed to exactly one space, with no
|
||||
special attempt to compress consecutive spaces. Let me know how to
|
||||
improve this special character processing for @TeX{}.
|
||||
backslash. Curly brackets @kbd{@{}, @kbd{@}} are protected with a
|
||||
backslash and a pair of dollar signs (to force mathematical mode). The
|
||||
backslash itself produces the sequence @code{\backslash@{@}}.
|
||||
Circumflex and tilde diacritics produce the sequence @code{^\@{ @}} and
|
||||
@code{~\@{ @}} respectively. Other diacriticized characters of the
|
||||
underlying character set produce an appropriate @TeX{} sequence as far
|
||||
as possible. The other non-graphical characters, like newline and tab,
|
||||
and all other characters which are not part of @sc{ascii}, are merely
|
||||
changed to exactly one space, with no special attempt to compress
|
||||
consecutive spaces. Let me know how to improve this special character
|
||||
processing for @TeX{}.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node Compatibility in ptx
|
||||
@subsection The GNU extensions to @code{ptx}
|
||||
@subsection The @sc{gnu} extensions to @code{ptx}
|
||||
|
||||
This version of @code{ptx} contains a few features which do not exist in
|
||||
System V @code{ptx}. These extra features are suppressed by using the
|
||||
@samp{-G} command line option, unless overridden by other command line
|
||||
options. Some GNU extensions cannot be recovered by overriding, so the
|
||||
simple rule is to avoid @samp{-G} if you care about GNU extensions.
|
||||
options. Some @sc{gnu} extensions cannot be recovered by overriding, so the
|
||||
simple rule is to avoid @samp{-G} if you care about @sc{gnu} extensions.
|
||||
Here are the differences between this program and System V @code{ptx}.
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
This program can read many input files at once, it always writes the
|
||||
resulting concordance on standard output. On the other end, System V
|
||||
@code{ptx} reads only one file and produce the result on standard output
|
||||
resulting concordance on standard output. On the other hand, System V
|
||||
@code{ptx} reads only one file and sends the result to standard output
|
||||
or, if a second @var{file} parameter is given on the command, to that
|
||||
@var{file}.
|
||||
|
||||
Having output parameters not introduced by options is a quite dangerous
|
||||
practice which GNU avoids as far as possible. So, for using @code{ptx}
|
||||
portably between GNU and System V, you should always use it with a
|
||||
Having output parameters not introduced by options is a dangerous
|
||||
practice which @sc{gnu} avoids as far as possible. So, for using @code{ptx}
|
||||
portably between @sc{gnu} and System V, you should always use it with a
|
||||
single input file, and always expect the result on standard output. You
|
||||
might also want to automatically configure in a @samp{-G} option to
|
||||
@code{ptx} calls in products using @code{ptx}, if the configurator finds
|
||||
@@ -3064,9 +3057,9 @@ that the installed @code{ptx} accepts @samp{-G}.
|
||||
@item
|
||||
The only options available in System V @code{ptx} are options @samp{-b},
|
||||
@samp{-f}, @samp{-g}, @samp{-i}, @samp{-o}, @samp{-r}, @samp{-t} and
|
||||
@samp{-w}. All other options are GNU extensions and are not repeated in
|
||||
@samp{-w}. All other options are @sc{gnu} extensions and are not repeated in
|
||||
this enumeration. Moreover, some options have a slightly different
|
||||
meaning when GNU extensions are enabled, as explained below.
|
||||
meaning when @sc{gnu} extensions are enabled, as explained below.
|
||||
|
||||
@item
|
||||
By default, concordance output is not formatted for @code{troff} or
|
||||
@@ -3075,29 +3068,29 @@ or @code{nroff} output may still be selected through option @samp{-O}.
|
||||
|
||||
@item
|
||||
Unless @samp{-R} option is used, the maximum reference width is
|
||||
subtracted from the total output line width. With GNU extensions
|
||||
subtracted from the total output line width. With @sc{gnu} extensions
|
||||
disabled, width of references is not taken into account in the output
|
||||
line width computations.
|
||||
|
||||
@item
|
||||
All 256 characters, even @kbd{NUL}s, are always read and processed from
|
||||
input file with no adverse effect, even if GNU extensions are disabled.
|
||||
input file with no adverse effect, even if @sc{gnu} extensions are disabled.
|
||||
However, System V @code{ptx} does not accept 8-bit characters, a few
|
||||
control characters are rejected, and the tilde @kbd{~} is also rejected.
|
||||
|
||||
@item
|
||||
Input line length is only limited by available memory, even if GNU
|
||||
Input line length is only limited by available memory, even if @sc{gnu}
|
||||
extensions are disabled. However, System V @code{ptx} processes only
|
||||
the first 200 characters in each line.
|
||||
|
||||
@item
|
||||
The break (non-word) characters default to be every character except all
|
||||
letters of the underlying character set, diacriticized or not. When GNU
|
||||
letters of the underlying character set, diacriticized or not. When @sc{gnu}
|
||||
extensions are disabled, the break characters default to space, tab and
|
||||
newline only.
|
||||
|
||||
@item
|
||||
The program makes better use of output line width. If GNU extensions
|
||||
The program makes better use of output line width. If @sc{gnu} extensions
|
||||
are disabled, the program rather tries to imitate System V @code{ptx},
|
||||
but still, there are some slight disposition glitches this program does
|
||||
not completely reproduce.
|
||||
@@ -3134,7 +3127,7 @@ cut [@var{option}]@dots{} [@var{file}]@dots{}
|
||||
In the table which follows, the @var{byte-list}, @var{character-list},
|
||||
and @var{field-list} are one or more numbers or ranges (two numbers
|
||||
separated by a dash) separated by commas. Bytes, characters, and
|
||||
fields are numbered from starting at 1. Incomplete ranges may be
|
||||
fields are numbered starting at 1. Incomplete ranges may be
|
||||
given: @samp{-@var{m}} means @samp{1-@var{m}}; @samp{@var{n}-} means
|
||||
@samp{@var{n}} through end of line or last field.
|
||||
|
||||
@@ -3332,7 +3325,7 @@ Print a line for each unpairable line in file @var{file-number}
|
||||
|
||||
@end table
|
||||
|
||||
In addition, when GNU @code{join} is invoked with exactly one argument,
|
||||
In addition, when @sc{gnu} @code{join} is invoked with exactly one argument,
|
||||
options @samp{--help} and @samp{--version} are recognized. @xref{Common
|
||||
options}.
|
||||
|
||||
@@ -3440,7 +3433,7 @@ from @var{m} through @var{n}, in ascending order. @var{m} should
|
||||
collate before @var{n}; if it doesn't, an error results. As an example,
|
||||
@samp{0-9} is the same as @samp{0123456789}.
|
||||
|
||||
GNU @code{tr} does not support the System V syntax that uses square
|
||||
@sc{gnu} @code{tr} does not support the System V syntax that uses square
|
||||
brackets to enclose ranges. Translations specified in that format
|
||||
sometimes work as expected, since the brackets are often transliterated
|
||||
to themselves. However, they should be avoided because they sometimes
|
||||
@@ -3528,7 +3521,7 @@ The syntax @samp{[=@var{c}=]} expands to all of the characters that are
|
||||
equivalent to @var{c}, in no particular order. Equivalence classes are
|
||||
a relatively recent invention intended to support non-English alphabets.
|
||||
But there seems to be no standard way to define them or determine their
|
||||
contents. Therefore, they are not fully implemented in GNU @code{tr};
|
||||
contents. Therefore, they are not fully implemented in @sc{gnu} @code{tr};
|
||||
each character's equivalence class consists only of that character,
|
||||
which is of no particular use.
|
||||
|
||||
@@ -3576,8 +3569,8 @@ BSD @code{tr} pads @var{set2} to the length of @var{set1} by repeating
|
||||
the last character of @var{set2} as many times as necessary. System V
|
||||
@code{tr} truncates @var{set1} to the length of @var{set2}.
|
||||
|
||||
By default, GNU @code{tr} handles this case like BSD @code{tr}. When
|
||||
the @samp{--truncate-set1} (@samp{-t}) option is given, GNU @code{tr}
|
||||
By default, @sc{gnu} @code{tr} handles this case like BSD @code{tr}. When
|
||||
the @samp{--truncate-set1} (@samp{-t}) option is given, @sc{gnu} @code{tr}
|
||||
handles this case like the System V @code{tr} instead. This option is
|
||||
ignored for operations other than translation.
|
||||
|
||||
@@ -3716,7 +3709,7 @@ following warning and error messages, for strict compliance with
|
||||
|
||||
@item
|
||||
When the @samp{--delete} option is given but @samp{--squeeze-repeats}
|
||||
is not, and @var{set2} is given, GNU @code{tr} by default prints
|
||||
is not, and @var{set2} is given, @sc{gnu} @code{tr} by default prints
|
||||
a usage message and exits, because @var{set2} would not be used.
|
||||
The @sc{posix} specification says that @var{set2} must be ignored in
|
||||
this case. Silently ignoring arguments is a bad idea.
|
||||
@@ -3728,9 +3721,9 @@ value 400 octal does not fit into a single byte.
|
||||
|
||||
@end enumerate
|
||||
|
||||
GNU @code{tr} does not provide complete BSD or System V compatibility.
|
||||
@sc{gnu} @code{tr} does not provide complete BSD or System V compatibility.
|
||||
For example, it is impossible to disable interpretation of the @sc{posix}
|
||||
constructs @samp{[:alpha:]}, @samp{[=c=]}, and @samp{[c*10]}. Also, GNU
|
||||
constructs @samp{[:alpha:]}, @samp{[=c=]}, and @samp{[c*10]}. Also, @sc{gnu}
|
||||
@code{tr} does not delete zero bytes automatically, unlike traditional
|
||||
Unix versions, which provide no way to preserve zero bytes.
|
||||
|
||||
@@ -3855,13 +3848,13 @@ Robbins.
|
||||
@node Toolbox introduction
|
||||
@unnumberedsec Toolbox introduction
|
||||
|
||||
This month's column is only peripherally related to the GNU Project, in
|
||||
that it describes a number of the GNU tools on your Linux system and how they
|
||||
might be used. What it's really about is the ``Software Tools'' philosophy
|
||||
This month's column is only peripherally related to the @sc{gnu} Project, in
|
||||
that it describes a number of the @sc{gnu} tools on your Linux system and how
|
||||
they might be used. What it's really about is the ``Software Tools'' philosophy
|
||||
of program development and usage.
|
||||
|
||||
The software tools philosophy was an important and integral concept
|
||||
in the initial design and development of Unix (of which Linux and GNU are
|
||||
in the initial design and development of Unix (of which Linux and @sc{gnu} are
|
||||
essentially clones). Unfortunately, in the modern day press of
|
||||
Internetworking and flashy GUIs, it seems to have fallen by the
|
||||
wayside. This is a shame, since it provides a powerful mental model
|
||||
@@ -4354,8 +4347,8 @@ appropriate tool, build one.
|
||||
As of this writing, all the programs we've discussed are available via
|
||||
anonymous @code{ftp} from @code{prep.ai.mit.edu} as
|
||||
@file{/pub/gnu/textutils-1.9.tar.gz}.@footnote{Version 1.9 was current
|
||||
when this column was written. Check the nearest GNU archive for the
|
||||
current version. The main GNU FTP site is now @code{ftp.gnu.org}.}
|
||||
when this column was written. Check the nearest @sc{gnu} archive for the
|
||||
current version. The main @sc{gnu} FTP site is now @code{ftp.gnu.org}.}
|
||||
|
||||
None of what I have presented in this column is new. The Software Tools
|
||||
philosophy was first introduced in the book @cite{Software Tools},
|
||||
@@ -4381,8 +4374,8 @@ whose members had ported the original @code{ratfor} programs to essentially
|
||||
every computer system with a FORTRAN compiler. The popularity of the
|
||||
group waned in the middle '80s as Unix began to spread beyond universities.
|
||||
|
||||
With the current proliferation of GNU code and other clones of Unix programs,
|
||||
these programs now receive little attention; modern C versions are
|
||||
With the current proliferation of @sc{gnu} code and other clones of Unix
|
||||
programs, these programs now receive little attention; modern C versions are
|
||||
much more efficient and do more than these programs do. Nevertheless, as
|
||||
exposition of good programming style, and evangelism for a still-valuable
|
||||
philosophy, these books are unparalleled, and I recommend them highly.
|
||||
|
||||
@@ -217,3 +217,13 @@ p delta
|
||||
n
|
||||
p Start
|
||||
q
|
||||
b dir_name
|
||||
r
|
||||
n
|
||||
p slash
|
||||
n
|
||||
n
|
||||
n
|
||||
p slash
|
||||
p slash - path + 1
|
||||
q
|
||||
|
||||
179
lib/ChangeLog
179
lib/ChangeLog
@@ -1,3 +1,182 @@
|
||||
2000-12-05 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* dirname.c (dir_name_r): Add `const' in a few local declarations.
|
||||
|
||||
2000-12-04 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* path-concat.c: [!HAVE_DECL_MALLOC]: Declare malloc.
|
||||
Also include memory.h, stdlib.h, unistd.h if appropriate.
|
||||
Reported by Andreas Jaeger (conflicting declaration of malloc).
|
||||
|
||||
2000-12-02 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* closeout.h: Make idempotent, to avoid some obscure warnings.
|
||||
|
||||
2000-12-01 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/memrchr.c: Include <config.h> before any system include file.
|
||||
|
||||
2000-11-29 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/dirname.c (dir_name_r): Fix typo: int -> size_t.
|
||||
|
||||
2000-11-26 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* memcoll.c: Include sys/types.h. From Werner Almesberger.
|
||||
|
||||
2000-11-22 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/strftime.c (my_strftime): Do not invoke mbrlen with a
|
||||
size of (size_t) -1; it's not portable.
|
||||
|
||||
2000-11-17 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* lib/obstack.h: Formatting changes.
|
||||
(obstack_grow, obstack_grow0): Don't cast WHERE at all: that would
|
||||
prevent type checking.
|
||||
(obstack_ptr_grow, obstack_ptr_grow_fast): When assigning, don't
|
||||
cast the value to (void *): assigning a `foo *' to a `void *'
|
||||
variable is valid.
|
||||
(obstack_int_grow, obstack_int_grow_fast): Don't cast AINT to int.
|
||||
|
||||
2000-11-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* strstr.c: Update from GNU libc.
|
||||
|
||||
2000-11-16 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* strverscmp.c: Incorporate weak-alias-related changes from glibc.
|
||||
|
||||
2000-11-11 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* error.c: Add a couple #includes, merging from GNU libc version.
|
||||
|
||||
2000-11-10 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* obstack.h: Update from GNU libc.
|
||||
* obstack.c: Likewise.
|
||||
|
||||
2000-11-06 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* getusershell.c (setusershell): Use rewind rather than
|
||||
fseek/fseeko, to avoid configuration hassles with fseeko.
|
||||
Don't bother opening SHELLS_FILE if shellstream is NULL;
|
||||
it's not necessary.
|
||||
|
||||
2000-11-05 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* makepath.h (make_dir): Declare.
|
||||
* makepath.c (make_dir): Remove `static' attribute.
|
||||
Tweak a comment.
|
||||
|
||||
2000-11-04 Alexandre Duret-Lutz <duret_g@epita.fr>
|
||||
|
||||
* hash.c (hash_get_next): Fix a thinko: when ENTRY is the
|
||||
last one in a bucket, advance to the next bucket.
|
||||
|
||||
2000-11-02 Vesselin Atanasov <vesselin@bgnet.bg>
|
||||
|
||||
* fnmatch.c: Do not comment out all the code if we are using
|
||||
the GNU C library, because in some cases we are replacing buggy
|
||||
code in the GNU C library itself.
|
||||
|
||||
2000-10-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* error.h, getline.h, modechange.h:
|
||||
Remove "2000" from Copyright line, as the file hasn't been
|
||||
changed this year other than in the copyright notice.
|
||||
|
||||
* xalloc.h: Add "2000" to Copyright line, as this file
|
||||
was changed this year.
|
||||
|
||||
2000-10-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* fnmatch.c (FOLD): Do not assume that characters are unsigned.
|
||||
(fnmatch): Fix some FNM_FILE_NAME and FNM_LEADING_DIR bugs,
|
||||
e.g. fnmatch("d*/*1", "d/s/1", FNM_FILE_NAME) incorrectly yielded zero.
|
||||
|
||||
2000-10-29 Greg Louis <glouis@dynamicro.on.ca>
|
||||
|
||||
* regex.h (__restrict_arr): Move definition out of #ifndef block.
|
||||
Required because egcs-2.91.66 (aka 1.1.2) defines __restrict, but
|
||||
doesn't define __restrict_arr.
|
||||
|
||||
2000-10-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* xstat.in: Fix grammar in comment.
|
||||
|
||||
2000-10-28 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* memchr.c: Update from libc.
|
||||
Adjust for portability:
|
||||
[HAVE_STDLIB_H]: Include stdlib.h.
|
||||
[HAVE_BP_SYM_H || _LIBC]: Guard inclusion of bp-sym.h.
|
||||
Undef __memchr, too.
|
||||
[!weak_alias]: Define __memchr to memchr.
|
||||
|
||||
* regex.c: Update from libc.
|
||||
* regex.h: Likewise.
|
||||
* getopt1.c: Likewise.
|
||||
* memcmp.c: Likewise.
|
||||
|
||||
* getusershell.c (setusershell) [HAVE_FSEEKO]: Use fseeko.
|
||||
Avoid using fseek, when possible -- it's broken by design.
|
||||
Patch by Ulrich Drepper.
|
||||
|
||||
2000-10-26 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* strftime.c: Update from libc.
|
||||
|
||||
2000-10-25 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* obstack.c: Update from libc.
|
||||
|
||||
2000-10-23 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* hard-locale.c (hard_locale): Revert last change -- it was simply
|
||||
wrong. That set_locale call must not have any side effects.
|
||||
From Paul Eggert.
|
||||
|
||||
2000-10-22 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* md5.c (md5_process_block) [OP]: Use `rol', not CYCLIC.
|
||||
[CYCLIC]: Remove now-unused definition.
|
||||
|
||||
* save-cwd.c (O_DIRECTORY): Define, if needed.
|
||||
(save_cwd) [HAVE_FCHDIR]: Use O_DIRECTORY when opening ".".
|
||||
Suggestion from Ulrich Drepper.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* dirname.c (dir_name_r): New function, factored out of dir_name.
|
||||
(dir_name): Use dir_name_r.
|
||||
* dirname.h (dir_name_r): Declare it.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* dirname.c (memrchr): Declare if necessary.
|
||||
(dir_name): Remove the restriction that there be no
|
||||
trailing slashes. Now, this code skips past them, effectively
|
||||
ignoring them.
|
||||
[TEST_DIRNAME] (main): New unit tests.
|
||||
|
||||
* memrchr.c: New file from GNU libc.
|
||||
Undef __memrchr, too.
|
||||
[!weak_alias]: Define __memrchr to memrchr.
|
||||
Guard weak_alias use with `#ifdef weak_alias'.
|
||||
|
||||
2000-10-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* quote.h (PARAMS): Define and use.
|
||||
Reported by Akim Demaille.
|
||||
|
||||
* getopt.c: Update from libc.
|
||||
|
||||
2000-10-16 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* hard-locale.c (hard_locale): Use "", not 0 as 2nd arg to setlocale.
|
||||
From Jan Fedak.
|
||||
|
||||
2000-09-25 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* md5.h (rol): Define (from GnuPG).
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -213,17 +214,17 @@ $(DEPDIR)/localcharset$U.Po $(DEPDIR)/long-options$U.Po \
|
||||
$(DEPDIR)/lstat.Po $(DEPDIR)/makepath$U.Po $(DEPDIR)/malloc.Po \
|
||||
$(DEPDIR)/mbswidth$U.Po $(DEPDIR)/md5$U.Po $(DEPDIR)/memcasecmp$U.Po \
|
||||
$(DEPDIR)/memchr.Po $(DEPDIR)/memcmp.Po $(DEPDIR)/memcoll$U.Po \
|
||||
$(DEPDIR)/memcpy.Po $(DEPDIR)/memmove.Po $(DEPDIR)/memset.Po \
|
||||
$(DEPDIR)/mktime.Po $(DEPDIR)/modechange$U.Po $(DEPDIR)/mountlist.Po \
|
||||
$(DEPDIR)/nanosleep.Po $(DEPDIR)/obstack.Po $(DEPDIR)/path-concat$U.Po \
|
||||
$(DEPDIR)/posixtm$U.Po $(DEPDIR)/putenv.Po $(DEPDIR)/quote$U.Po \
|
||||
$(DEPDIR)/quotearg$U.Po $(DEPDIR)/readtokens$U.Po $(DEPDIR)/readutmp.Po \
|
||||
$(DEPDIR)/realloc.Po $(DEPDIR)/regex.Po $(DEPDIR)/rmdir.Po \
|
||||
$(DEPDIR)/rpmatch.Po $(DEPDIR)/safe-read$U.Po $(DEPDIR)/same$U.Po \
|
||||
$(DEPDIR)/save-cwd$U.Po $(DEPDIR)/savedir$U.Po $(DEPDIR)/sha$U.Po \
|
||||
$(DEPDIR)/stat.Po $(DEPDIR)/stime.Po $(DEPDIR)/stpcpy.Po \
|
||||
$(DEPDIR)/strcasecmp.Po $(DEPDIR)/strcspn.Po $(DEPDIR)/strdup.Po \
|
||||
$(DEPDIR)/strftime.Po $(DEPDIR)/stripslash$U.Po \
|
||||
$(DEPDIR)/memcpy.Po $(DEPDIR)/memmove.Po $(DEPDIR)/memrchr.Po \
|
||||
$(DEPDIR)/memset.Po $(DEPDIR)/mktime.Po $(DEPDIR)/modechange$U.Po \
|
||||
$(DEPDIR)/mountlist.Po $(DEPDIR)/nanosleep.Po $(DEPDIR)/obstack.Po \
|
||||
$(DEPDIR)/path-concat$U.Po $(DEPDIR)/posixtm$U.Po $(DEPDIR)/putenv.Po \
|
||||
$(DEPDIR)/quote$U.Po $(DEPDIR)/quotearg$U.Po $(DEPDIR)/readtokens$U.Po \
|
||||
$(DEPDIR)/readutmp.Po $(DEPDIR)/realloc.Po $(DEPDIR)/regex.Po \
|
||||
$(DEPDIR)/rmdir.Po $(DEPDIR)/rpmatch.Po $(DEPDIR)/safe-read$U.Po \
|
||||
$(DEPDIR)/same$U.Po $(DEPDIR)/save-cwd$U.Po $(DEPDIR)/savedir$U.Po \
|
||||
$(DEPDIR)/sha$U.Po $(DEPDIR)/stat.Po $(DEPDIR)/stime.Po \
|
||||
$(DEPDIR)/stpcpy.Po $(DEPDIR)/strcasecmp.Po $(DEPDIR)/strcspn.Po \
|
||||
$(DEPDIR)/strdup.Po $(DEPDIR)/strftime.Po $(DEPDIR)/stripslash$U.Po \
|
||||
$(DEPDIR)/strncasecmp.Po $(DEPDIR)/strndup.Po $(DEPDIR)/strnlen.Po \
|
||||
$(DEPDIR)/strpbrk.Po $(DEPDIR)/strstr.Po $(DEPDIR)/strtod.Po \
|
||||
$(DEPDIR)/strtol.Po $(DEPDIR)/strtoul.Po $(DEPDIR)/strtoull.Po \
|
||||
@@ -238,9 +239,9 @@ Makefile.in TODO __fpending.c alloca.c atexit.c chown.c dup2.c error.c \
|
||||
error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
|
||||
getdate.c getgroups.c gethostname.c getline.c getloadavg.c getpass.c \
|
||||
getusershell.c group-member.c lchown.c malloc.c memchr.c memcmp.c \
|
||||
memcpy.c memmove.c memset.c mktime.c mountlist.c nanosleep.c obstack.c \
|
||||
obstack.h putenv.c readutmp.c realloc.c regex.c rmdir.c rpmatch.c \
|
||||
stime.c stpcpy.c strcasecmp.c strcspn.c strdup.c strftime.c \
|
||||
memcpy.c memmove.c memrchr.c memset.c mktime.c mountlist.c nanosleep.c \
|
||||
obstack.c obstack.h putenv.c readutmp.c realloc.c regex.c rmdir.c \
|
||||
rpmatch.c stime.c stpcpy.c strcasecmp.c strcspn.c strdup.c strftime.c \
|
||||
strncasecmp.c strndup.c strnlen.c strpbrk.c strstr.c strtod.c strtol.c \
|
||||
strtoul.c strtoull.c strtoumax.c strverscmp.c utime.c
|
||||
|
||||
@@ -408,6 +409,8 @@ memcpy_.c: memcpy.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memcpy.c; then echo $(srcdir)/memcpy.c; else echo memcpy.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memcpy_.c
|
||||
memmove_.c: memmove.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memmove.c; then echo $(srcdir)/memmove.c; else echo memmove.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memmove_.c
|
||||
memrchr_.c: memrchr.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memrchr.c; then echo $(srcdir)/memrchr.c; else echo memrchr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memrchr_.c
|
||||
memset_.c: memset.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memset.c; then echo $(srcdir)/memset.c; else echo memset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memset_.c
|
||||
mktime_.c: mktime.c $(ANSI2KNR)
|
||||
@@ -525,17 +528,17 @@ getopt1_.o getpass_.o getstr_.o getugroups_.o getusershell_.o \
|
||||
group-member_.o hard-locale_.o hash_.o human_.o idcache_.o isdir_.o \
|
||||
lchown_.o linebuffer_.o localcharset_.o long-options_.o lstat_.o \
|
||||
makepath_.o malloc_.o mbswidth_.o md5_.o memcasecmp_.o memchr_.o \
|
||||
memcmp_.o memcoll_.o memcpy_.o memmove_.o memset_.o mktime_.o \
|
||||
modechange_.o mountlist_.o nanosleep_.o obstack_.o path-concat_.o \
|
||||
posixtm_.o putenv_.o quote_.o quotearg_.o readtokens_.o readutmp_.o \
|
||||
realloc_.o regex_.o rmdir_.o rpmatch_.o safe-read_.o same_.o \
|
||||
save-cwd_.o savedir_.o sha_.o stat_.o stime_.o stpcpy_.o strcasecmp_.o \
|
||||
strcspn_.o strdup_.o strftime_.o stripslash_.o strncasecmp_.o \
|
||||
strndup_.o strnlen_.o strpbrk_.o strstr_.o strtod_.o strtol_.o \
|
||||
strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o unicodeio_.o \
|
||||
userspec_.o utime_.o version-etc_.o xgetcwd_.o xgethostname_.o \
|
||||
xmalloc_.o xstrdup_.o xstrtod_.o xstrtol_.o xstrtoul_.o xstrtoumax_.o \
|
||||
yesno_.o : $(ANSI2KNR)
|
||||
memcmp_.o memcoll_.o memcpy_.o memmove_.o memrchr_.o memset_.o \
|
||||
mktime_.o modechange_.o mountlist_.o nanosleep_.o obstack_.o \
|
||||
path-concat_.o posixtm_.o putenv_.o quote_.o quotearg_.o readtokens_.o \
|
||||
readutmp_.o realloc_.o regex_.o rmdir_.o rpmatch_.o safe-read_.o \
|
||||
same_.o save-cwd_.o savedir_.o sha_.o stat_.o stime_.o stpcpy_.o \
|
||||
strcasecmp_.o strcspn_.o strdup_.o strftime_.o stripslash_.o \
|
||||
strncasecmp_.o strndup_.o strnlen_.o strpbrk_.o strstr_.o strtod_.o \
|
||||
strtol_.o strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o \
|
||||
unicodeio_.o userspec_.o utime_.o version-etc_.o xgetcwd_.o \
|
||||
xgethostname_.o xmalloc_.o xstrdup_.o xstrtod_.o xstrtol_.o xstrtoul_.o \
|
||||
xstrtoumax_.o yesno_.o : $(ANSI2KNR)
|
||||
.y.c:
|
||||
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
|
||||
if test -f y.tab.h; then \
|
||||
@@ -630,6 +633,7 @@ maintainer-clean-tags:
|
||||
@AMDEP@include $(DEPDIR)/memcoll$U.Po
|
||||
@AMDEP@include $(DEPDIR)/memcpy.Po
|
||||
@AMDEP@include $(DEPDIR)/memmove.Po
|
||||
@AMDEP@include $(DEPDIR)/memrchr.Po
|
||||
@AMDEP@include $(DEPDIR)/memset.Po
|
||||
@AMDEP@include $(DEPDIR)/mktime.Po
|
||||
@AMDEP@include $(DEPDIR)/modechange$U.Po
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
#ifndef CLOSEOUT_H
|
||||
# define CLOSEOUT_H 1
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void close_stdout_set_status PARAMS ((int status));
|
||||
void close_stdout_set_file_name PARAMS ((const char *file));
|
||||
void close_stdout PARAMS ((void));
|
||||
void close_stdout_status PARAMS ((int status));
|
||||
|
||||
#endif
|
||||
|
||||
115
lib/dirname.c
115
lib/dirname.c
@@ -34,6 +34,13 @@ char *malloc ();
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef HAVE_DECL_MEMRCHR
|
||||
"this configure-time declaration test was not run"
|
||||
#endif
|
||||
#if !HAVE_DECL_MEMRCHR
|
||||
void *memrchr ();
|
||||
#endif
|
||||
|
||||
#include "dirname.h"
|
||||
|
||||
#ifndef ISSLASH
|
||||
@@ -42,31 +49,44 @@ char *malloc ();
|
||||
|
||||
#define BACKSLASH_IS_PATH_SEPARATOR ISSLASH ('\\')
|
||||
|
||||
/* Return the leading directories part of PATH,
|
||||
allocated with malloc. If out of memory, return 0.
|
||||
Assumes that trailing slashes have already been
|
||||
removed. */
|
||||
|
||||
char *
|
||||
dir_name (const char *path)
|
||||
/* Return the length of `dirname (PATH)' and set *RESULT
|
||||
to point to PATH or to `"."', as appropriate.
|
||||
Works properly even if there are trailing slashes
|
||||
(by effectively ignoring them). */
|
||||
size_t
|
||||
dir_name_r (char const *path, char const **result)
|
||||
{
|
||||
char *newpath;
|
||||
char *slash;
|
||||
int length; /* Length of result, not including NUL. */
|
||||
char const *slash;
|
||||
size_t length; /* Length of result, not including NUL. */
|
||||
|
||||
slash = strrchr (path, '/');
|
||||
if (BACKSLASH_IS_PATH_SEPARATOR)
|
||||
{
|
||||
char *b = strrchr (path, '\\');
|
||||
char const *b = strrchr (path, '\\');
|
||||
if (b && slash < b)
|
||||
slash = b;
|
||||
}
|
||||
|
||||
/* Make sure there are no trailing slashes. */
|
||||
assert (slash == NULL /* There are no slashes in PATH. */
|
||||
|| slash[1] != 0 /* There is a non-NUL byte after the last slash. */
|
||||
|| path == slash /* PATH is just `/'. */
|
||||
);
|
||||
/* If the last byte of PATH is a slash, decrement SLASH until it's
|
||||
pointing at the leftmost in a sequence of trailing slashes. */
|
||||
if (slash && slash[1] == 0)
|
||||
{
|
||||
while (path < slash && ISSLASH (slash[-1]))
|
||||
{
|
||||
--slash;
|
||||
}
|
||||
|
||||
if (path < slash)
|
||||
{
|
||||
slash = memrchr (path, '/', slash - path);
|
||||
if (BACKSLASH_IS_PATH_SEPARATOR)
|
||||
{
|
||||
char const *b = memrchr (path, '\\', slash - path);
|
||||
if (b && slash < b)
|
||||
slash = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (slash == 0)
|
||||
{
|
||||
@@ -79,7 +99,7 @@ dir_name (const char *path)
|
||||
/* Remove any trailing slashes from the result. */
|
||||
if (BACKSLASH_IS_PATH_SEPARATOR)
|
||||
{
|
||||
const char *lim = ((path[0] >= 'A' && path[0] <= 'z'
|
||||
char const *lim = ((path[0] >= 'A' && path[0] <= 'z'
|
||||
&& path[1] == ':')
|
||||
? path + 2 : path);
|
||||
|
||||
@@ -96,10 +116,67 @@ dir_name (const char *path)
|
||||
length = slash - path + 1;
|
||||
}
|
||||
|
||||
newpath = (char *) malloc (length + 1);
|
||||
*result = path;
|
||||
return length;
|
||||
}
|
||||
|
||||
/* Return the leading directories part of PATH,
|
||||
allocated with malloc. If out of memory, return 0.
|
||||
Works properly even if there are trailing slashes
|
||||
(by effectively ignoring them). */
|
||||
|
||||
char *
|
||||
dir_name (char const *path)
|
||||
{
|
||||
char const *result;
|
||||
size_t length = dir_name_r (path, &result);
|
||||
char *newpath = (char *) malloc (length + 1);
|
||||
if (newpath == 0)
|
||||
return 0;
|
||||
strncpy (newpath, path, length);
|
||||
strncpy (newpath, result, length);
|
||||
newpath[length] = 0;
|
||||
return newpath;
|
||||
}
|
||||
|
||||
#ifdef TEST_DIRNAME
|
||||
/*
|
||||
|
||||
Run the test like this (expect no output):
|
||||
gcc -DHAVE_CONFIG_H -DTEST_DIRNAME -I.. -O -Wall memrchr.c dirname.c
|
||||
sed -n '/^BEGIN-DATA$/,/^END-DATA$/p' dirname.c|grep -v DATA|./a.out
|
||||
|
||||
BEGIN-DATA
|
||||
foo//// .
|
||||
bar/foo//// bar
|
||||
foo/ .
|
||||
/ /
|
||||
. .
|
||||
a .
|
||||
END-DATA
|
||||
|
||||
*/
|
||||
|
||||
# define MAX_BUFF_LEN 1024
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char buff[MAX_BUFF_LEN + 1];
|
||||
|
||||
buff[MAX_BUFF_LEN] = 0;
|
||||
while (fgets (buff, MAX_BUFF_LEN, stdin) && buff[0])
|
||||
{
|
||||
char path[MAX_BUFF_LEN];
|
||||
char expected_result[MAX_BUFF_LEN];
|
||||
char const *result;
|
||||
sscanf (buff, "%s %s", path, expected_result);
|
||||
result = dir_name (path);
|
||||
if (strcmp (result, expected_result))
|
||||
printf ("%s: got %s, expected %s\n", path, result, expected_result);
|
||||
}
|
||||
exit (0);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -28,4 +28,7 @@
|
||||
char *
|
||||
dir_name PARAMS ((const char *path));
|
||||
|
||||
size_t
|
||||
dir_name_r PARAMS ((const char *path, const char **result));
|
||||
|
||||
#endif /* not DIRNAME_H_ */
|
||||
|
||||
10
lib/error.c
10
lib/error.c
@@ -1,5 +1,5 @@
|
||||
/* Error handler for noninteractive utilities
|
||||
Copyright (C) 1990-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990-1998, 2000 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.
|
||||
@@ -26,6 +26,9 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#if HAVE_LIBINTL_H
|
||||
# include <libintl.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
|
||||
# if __STDC__
|
||||
@@ -83,6 +86,11 @@ unsigned int error_message_count;
|
||||
# define error __error
|
||||
# define error_at_line __error_at_line
|
||||
|
||||
# ifdef USE_IN_LIBIO
|
||||
# include <libio/iolibio.h>
|
||||
# define fflush(s) _IO_fflush (s)
|
||||
# endif
|
||||
|
||||
#else /* not _LIBC */
|
||||
|
||||
/* The calling program should define program_name and set it to the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Declaration for error-reporting function
|
||||
Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright 1991, 1992, 1993, 1996, 1997, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -27,30 +27,18 @@
|
||||
#include <fnmatch.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined STDC_HEADERS || !defined isascii
|
||||
# define IN_CTYPE_DOMAIN(c) 1
|
||||
#else
|
||||
# define IN_CTYPE_DOMAIN(c) isascii (c)
|
||||
#endif
|
||||
|
||||
/* 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__
|
||||
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
|
||||
|
||||
|
||||
# if defined STDC_HEADERS || !defined isascii
|
||||
# define IN_CTYPE_DOMAIN(c) 1
|
||||
# else
|
||||
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
||||
# endif
|
||||
|
||||
# define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
|
||||
|
||||
|
||||
# ifndef errno
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Match STRING against the filename pattern PATTERN, returning zero if
|
||||
it matches, nonzero if not. */
|
||||
@@ -61,7 +49,9 @@ fnmatch (const char *pattern, const char *string, int flags)
|
||||
register char c;
|
||||
|
||||
/* Note that this evaluates C many times. */
|
||||
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
|
||||
#define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER ((unsigned char) (c)) \
|
||||
? tolower ((unsigned char) (c)) \
|
||||
: (c))
|
||||
|
||||
while ((c = *p++) != '\0')
|
||||
{
|
||||
@@ -99,13 +89,10 @@ fnmatch (const char *pattern, const char *string, int flags)
|
||||
|
||||
for (c = *p++; c == '?' || c == '*'; c = *p++)
|
||||
{
|
||||
if ((flags & FNM_FILE_NAME) && *n == '/')
|
||||
/* A slash does not match a wildcard under FNM_FILE_NAME. */
|
||||
return FNM_NOMATCH;
|
||||
else if (c == '?')
|
||||
if (c == '?')
|
||||
{
|
||||
/* A ? needs to match one character. */
|
||||
if (*n == '\0')
|
||||
if (*n == '\0' || (*n == '/' && (flags & FNM_FILE_NAME)))
|
||||
/* There isn't another character; no match. */
|
||||
return FNM_NOMATCH;
|
||||
else
|
||||
@@ -117,7 +104,13 @@ fnmatch (const char *pattern, const char *string, int flags)
|
||||
}
|
||||
|
||||
if (c == '\0')
|
||||
return 0;
|
||||
{
|
||||
if ((flags & (FNM_FILE_NAME | FNM_LEADING_DIR)) == FNM_FILE_NAME)
|
||||
for (; *n != '\0'; n++)
|
||||
if (*n == '/')
|
||||
return FNM_NOMATCH;
|
||||
return 0;
|
||||
}
|
||||
|
||||
{
|
||||
char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
|
||||
@@ -126,6 +119,8 @@ fnmatch (const char *pattern, const char *string, int flags)
|
||||
if ((c == '[' || FOLD (*n) == c1) &&
|
||||
fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
|
||||
return 0;
|
||||
else if (*n == '/' && (flags & FNM_FILE_NAME))
|
||||
break;
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
|
||||
@@ -231,7 +226,5 @@ fnmatch (const char *pattern, const char *string, int flags)
|
||||
|
||||
return FNM_NOMATCH;
|
||||
|
||||
# undef FOLD
|
||||
#undef FOLD
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1997, 1999 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
|
||||
|
||||
@@ -75,11 +75,12 @@
|
||||
#endif
|
||||
|
||||
#ifndef _
|
||||
/* This is for other GNU distributions with internationalized messages.
|
||||
When compiling libc, the _ macro is predefined. */
|
||||
# ifdef HAVE_LIBINTL_H
|
||||
/* This is for other GNU distributions with internationalized messages. */
|
||||
# if defined HAVE_LIBINTL_H || defined _LIBC
|
||||
# include <libintl.h>
|
||||
# define _(msgid) gettext (msgid)
|
||||
# ifndef _
|
||||
# define _(msgid) gettext (msgid)
|
||||
# endif
|
||||
# else
|
||||
# define _(msgid) (msgid)
|
||||
# endif
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#else
|
||||
#endif
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#if !defined __STDC__ || !__STDC__
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
@@ -28,9 +31,6 @@
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
@@ -100,10 +100,8 @@ void
|
||||
setusershell ()
|
||||
{
|
||||
default_index = 0;
|
||||
if (shellstream == NULL)
|
||||
shellstream = fopen (SHELLS_FILE, "r");
|
||||
else
|
||||
fseek (shellstream, 0L, 0);
|
||||
if (shellstream)
|
||||
rewind (shellstream);
|
||||
}
|
||||
|
||||
/* Close the shells file. */
|
||||
|
||||
@@ -267,7 +267,7 @@ hash_get_first (const Hash_table *table)
|
||||
|
||||
/* Return the user data for the entry following ENTRY, where ENTRY has been
|
||||
returned by a previous call to either `hash_get_first' or `hash_get_next'.
|
||||
Return NULL if there is no more entries. */
|
||||
Return NULL if there are no more entries. */
|
||||
|
||||
void *
|
||||
hash_get_next (const Hash_table *table, const void *entry)
|
||||
@@ -284,7 +284,7 @@ hash_get_next (const Hash_table *table, const void *entry)
|
||||
return cursor->next->data;
|
||||
|
||||
/* Find first entry in any subsequent bucket. */
|
||||
for (; bucket < table->bucket_limit; bucket++)
|
||||
while (++bucket < table->bucket_limit)
|
||||
if (bucket->data)
|
||||
return bucket->data;
|
||||
|
||||
|
||||
@@ -148,10 +148,10 @@ void strip_trailing_slashes ();
|
||||
function creates DIR and to zero otherwise. Give a diagnostic and
|
||||
return non-zero if DIR cannot be created or cannot be determined to
|
||||
exist already. Use DIRPATH in any diagnostic, not DIR.
|
||||
Note that if DIR already exists, this function will return zero
|
||||
(indicating success) and will set *CREATED_DIR_P to zero. */
|
||||
Note that if DIR already exists, this function returns zero
|
||||
(indicating success) and sets *CREATED_DIR_P to zero. */
|
||||
|
||||
static int
|
||||
int
|
||||
make_dir (const char *dir, const char *dirpath, mode_t mode, int *created_dir_p)
|
||||
{
|
||||
int fail = 0;
|
||||
|
||||
@@ -14,3 +14,9 @@ make_path PARAMS ((const char *_argpath,
|
||||
gid_t _group,
|
||||
int _preserve_existing,
|
||||
const char *_verbose_fmt_string));
|
||||
|
||||
int
|
||||
make_dir PARAMS ((const char *dir,
|
||||
const char *dirpath,
|
||||
mode_t mode,
|
||||
int *created_dir_p));
|
||||
|
||||
11
lib/md5.c
11
lib/md5.c
@@ -304,19 +304,16 @@ md5_process_block (buffer, len, ctx)
|
||||
{ \
|
||||
a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
|
||||
++words; \
|
||||
CYCLIC (a, s); \
|
||||
a = rol (a, s); \
|
||||
a += b; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* It is unfortunate that C does not provide an operator for
|
||||
cyclic rotation. Hope the C compiler is smart enough. */
|
||||
#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
|
||||
|
||||
/* Before we start, one word to the strange constants.
|
||||
They are defined in RFC 1321 as
|
||||
|
||||
T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
|
||||
T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or
|
||||
perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}'
|
||||
*/
|
||||
|
||||
/* Round 1. */
|
||||
@@ -345,7 +342,7 @@ md5_process_block (buffer, len, ctx)
|
||||
do \
|
||||
{ \
|
||||
a += f (b, c, d) + correct_words[k] + T; \
|
||||
CYCLIC (a, s); \
|
||||
a = rol (a, s); \
|
||||
a += b; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
@@ -145,7 +145,7 @@ extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
|
||||
|
||||
/* The following is from gnupg-1.0.2's cipher/bithelp.h. */
|
||||
/* Rotate a 32 bit integer by n bytes */
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
#if defined __GNUC__ && defined __i386__
|
||||
static inline md5_uint32
|
||||
rol(md5_uint32 x, int n)
|
||||
{
|
||||
|
||||
31
lib/memchr.c
31
lib/memchr.c
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1993, 1997, 1999 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991,93,96,97,99,2000 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);
|
||||
@@ -34,11 +34,18 @@ USA. */
|
||||
# define __ptr_t char *
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
#if defined (_LIBC)
|
||||
#if defined _LIBC
|
||||
# include <string.h>
|
||||
# include <memcopy.h>
|
||||
#else
|
||||
# define reg_char char
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_LIMITS_H) || defined (_LIBC)
|
||||
#if HAVE_STDLIB_H || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H || defined _LIBC
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
@@ -49,21 +56,28 @@ USA. */
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#if HAVE_BP_SYM_H || defined _LIBC
|
||||
# include <bp-sym.h>
|
||||
#else
|
||||
# define BP_SYM(sym) sym
|
||||
#endif
|
||||
|
||||
#undef memchr
|
||||
#undef __memchr
|
||||
|
||||
/* Search no more than N bytes of S for C. */
|
||||
|
||||
__ptr_t
|
||||
memchr (s, c, n)
|
||||
__memchr (s, c_in, n)
|
||||
const __ptr_t s;
|
||||
int c;
|
||||
int c_in;
|
||||
size_t n;
|
||||
{
|
||||
const unsigned char *char_ptr;
|
||||
const unsigned long int *longword_ptr;
|
||||
unsigned long int longword, magic_bits, charmask;
|
||||
unsigned reg_char c;
|
||||
|
||||
c = (unsigned char) c;
|
||||
c = (unsigned char) c_in;
|
||||
|
||||
/* Handle the first few characters by reading one character at a time.
|
||||
Do this until CHAR_PTR is aligned on a longword boundary. */
|
||||
@@ -197,3 +211,6 @@ memchr (s, c, n)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#ifdef weak_alias
|
||||
weak_alias (__memchr, BP_SYM (memchr))
|
||||
#endif
|
||||
|
||||
@@ -49,6 +49,11 @@
|
||||
#ifdef _LIBC
|
||||
|
||||
# include <memcopy.h>
|
||||
# include <endian.h>
|
||||
|
||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define WORDS_BIGENDIAN
|
||||
# endif
|
||||
|
||||
#else /* Not in the GNU C library. */
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
209
lib/memrchr.c
Normal file
209
lib/memrchr.c
Normal file
@@ -0,0 +1,209 @@
|
||||
/* memrchr -- find the last occurrence of a byte in a memory block
|
||||
Copyright (C) 1991, 93, 96, 97, 99, 2000 Free Software Foundation, Inc.
|
||||
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
|
||||
with help from Dan Sahlin (dan@sics.se) and
|
||||
commentary by Jim Blandy (jimb@ai.mit.edu);
|
||||
adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
|
||||
and implemented by Roland McGrath (roland@ai.mit.edu).
|
||||
|
||||
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. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#undef __ptr_t
|
||||
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
||||
# define __ptr_t void *
|
||||
#else /* Not C++ or ANSI C. */
|
||||
# define __ptr_t char *
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
#if defined (_LIBC)
|
||||
# include <string.h>
|
||||
# include <memcopy.h>
|
||||
#else
|
||||
# define reg_char char
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_LIMITS_H) || defined (_LIBC)
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#define LONG_MAX_32_BITS 2147483647
|
||||
|
||||
#ifndef LONG_MAX
|
||||
# define LONG_MAX LONG_MAX_32_BITS
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#undef __memrchr
|
||||
#undef memrchr
|
||||
|
||||
#ifndef weak_alias
|
||||
# define __memrchr memrchr
|
||||
#endif
|
||||
|
||||
/* Search no more than N bytes of S for C. */
|
||||
__ptr_t
|
||||
__memrchr (s, c_in, n)
|
||||
const __ptr_t s;
|
||||
int c_in;
|
||||
size_t n;
|
||||
{
|
||||
const unsigned char *char_ptr;
|
||||
const unsigned long int *longword_ptr;
|
||||
unsigned long int longword, magic_bits, charmask;
|
||||
unsigned reg_char c;
|
||||
|
||||
c = (unsigned char) c_in;
|
||||
|
||||
/* Handle the last few characters by reading one character at a time.
|
||||
Do this until CHAR_PTR is aligned on a longword boundary. */
|
||||
for (char_ptr = (const unsigned char *) s + n;
|
||||
n > 0 && ((unsigned long int) char_ptr
|
||||
& (sizeof (longword) - 1)) != 0;
|
||||
--n)
|
||||
if (*--char_ptr == c)
|
||||
return (__ptr_t) char_ptr;
|
||||
|
||||
/* All these elucidatory comments refer to 4-byte longwords,
|
||||
but the theory applies equally well to 8-byte longwords. */
|
||||
|
||||
longword_ptr = (unsigned long int *) char_ptr;
|
||||
|
||||
/* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
|
||||
the "holes." Note that there is a hole just to the left of
|
||||
each byte, with an extra at the end:
|
||||
|
||||
bits: 01111110 11111110 11111110 11111111
|
||||
bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
|
||||
|
||||
The 1-bits make sure that carries propagate to the next 0-bit.
|
||||
The 0-bits provide holes for carries to fall into. */
|
||||
|
||||
if (sizeof (longword) != 4 && sizeof (longword) != 8)
|
||||
abort ();
|
||||
|
||||
#if LONG_MAX <= LONG_MAX_32_BITS
|
||||
magic_bits = 0x7efefeff;
|
||||
#else
|
||||
magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
|
||||
#endif
|
||||
|
||||
/* Set up a longword, each of whose bytes is C. */
|
||||
charmask = c | (c << 8);
|
||||
charmask |= charmask << 16;
|
||||
#if LONG_MAX > LONG_MAX_32_BITS
|
||||
charmask |= charmask << 32;
|
||||
#endif
|
||||
|
||||
/* Instead of the traditional loop which tests each character,
|
||||
we will test a longword at a time. The tricky part is testing
|
||||
if *any of the four* bytes in the longword in question are zero. */
|
||||
while (n >= sizeof (longword))
|
||||
{
|
||||
/* We tentatively exit the loop if adding MAGIC_BITS to
|
||||
LONGWORD fails to change any of the hole bits of LONGWORD.
|
||||
|
||||
1) Is this safe? Will it catch all the zero bytes?
|
||||
Suppose there is a byte with all zeros. Any carry bits
|
||||
propagating from its left will fall into the hole at its
|
||||
least significant bit and stop. Since there will be no
|
||||
carry from its most significant bit, the LSB of the
|
||||
byte to the left will be unchanged, and the zero will be
|
||||
detected.
|
||||
|
||||
2) Is this worthwhile? Will it ignore everything except
|
||||
zero bytes? Suppose every byte of LONGWORD has a bit set
|
||||
somewhere. There will be a carry into bit 8. If bit 8
|
||||
is set, this will carry into bit 16. If bit 8 is clear,
|
||||
one of bits 9-15 must be set, so there will be a carry
|
||||
into bit 16. Similarly, there will be a carry into bit
|
||||
24. If one of bits 24-30 is set, there will be a carry
|
||||
into bit 31, so all of the hole bits will be changed.
|
||||
|
||||
The one misfire occurs when bits 24-30 are clear and bit
|
||||
31 is set; in this case, the hole at bit 31 is not
|
||||
changed. If we had access to the processor carry flag,
|
||||
we could close this loophole by putting the fourth hole
|
||||
at bit 32!
|
||||
|
||||
So it ignores everything except 128's, when they're aligned
|
||||
properly.
|
||||
|
||||
3) But wait! Aren't we looking for C, not zero?
|
||||
Good point. So what we do is XOR LONGWORD with a longword,
|
||||
each of whose bytes is C. This turns each byte that is C
|
||||
into a zero. */
|
||||
|
||||
longword = *--longword_ptr ^ charmask;
|
||||
|
||||
/* Add MAGIC_BITS to LONGWORD. */
|
||||
if ((((longword + magic_bits)
|
||||
|
||||
/* Set those bits that were unchanged by the addition. */
|
||||
^ ~longword)
|
||||
|
||||
/* Look at only the hole bits. If any of the hole bits
|
||||
are unchanged, most likely one of the bytes was a
|
||||
zero. */
|
||||
& ~magic_bits) != 0)
|
||||
{
|
||||
/* Which of the bytes was C? If none of them were, it was
|
||||
a misfire; continue the search. */
|
||||
|
||||
const unsigned char *cp = (const unsigned char *) longword_ptr;
|
||||
|
||||
#if LONG_MAX > 2147483647
|
||||
if (cp[7] == c)
|
||||
return (__ptr_t) &cp[7];
|
||||
if (cp[6] == c)
|
||||
return (__ptr_t) &cp[6];
|
||||
if (cp[5] == c)
|
||||
return (__ptr_t) &cp[5];
|
||||
if (cp[4] == c)
|
||||
return (__ptr_t) &cp[4];
|
||||
#endif
|
||||
if (cp[3] == c)
|
||||
return (__ptr_t) &cp[3];
|
||||
if (cp[2] == c)
|
||||
return (__ptr_t) &cp[2];
|
||||
if (cp[1] == c)
|
||||
return (__ptr_t) &cp[1];
|
||||
if (cp[0] == c)
|
||||
return (__ptr_t) cp;
|
||||
}
|
||||
|
||||
n -= sizeof (longword);
|
||||
}
|
||||
|
||||
char_ptr = (const unsigned char *) longword_ptr;
|
||||
|
||||
while (n-- > 0)
|
||||
{
|
||||
if (*--char_ptr == c)
|
||||
return (__ptr_t) char_ptr;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#ifdef weak_alias
|
||||
weak_alias (__memrchr, memrchr)
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/* modechange.c -- file mode manipulation
|
||||
Copyright (C) 1989, 1990, 1997-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989, 1990, 1997, 1998, 1999 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* obstack.c - subroutines used implicitly by object stack macros
|
||||
Copyright (C) 1988-1994,96,97,98,1999, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-1994,96,97,98,99,2000 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.
|
||||
@@ -282,9 +282,10 @@ _obstack_newchunk (h, length)
|
||||
register long obj_size = h->next_free - h->object_base;
|
||||
register long i;
|
||||
long already;
|
||||
char *object_base;
|
||||
|
||||
/* Compute size for new chunk. */
|
||||
new_size = (obj_size + length) + (obj_size >> 3) + 100;
|
||||
new_size = (obj_size + length) + (obj_size >> 3) + h->alignment_mask + 100;
|
||||
if (new_size < h->chunk_size)
|
||||
new_size = h->chunk_size;
|
||||
|
||||
@@ -296,6 +297,11 @@ _obstack_newchunk (h, length)
|
||||
new_chunk->prev = old_chunk;
|
||||
new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
|
||||
|
||||
/* Compute an aligned object_base in the new chunk */
|
||||
object_base =
|
||||
__INT_TO_PTR ((__PTR_TO_INT (new_chunk->contents) + h->alignment_mask)
|
||||
& ~ (h->alignment_mask));
|
||||
|
||||
/* Move the existing object to the new chunk.
|
||||
Word at a time is fast and is safe if the object
|
||||
is sufficiently aligned. */
|
||||
@@ -303,7 +309,7 @@ _obstack_newchunk (h, length)
|
||||
{
|
||||
for (i = obj_size / sizeof (COPYING_UNIT) - 1;
|
||||
i >= 0; i--)
|
||||
((COPYING_UNIT *)new_chunk->contents)[i]
|
||||
((COPYING_UNIT *)object_base)[i]
|
||||
= ((COPYING_UNIT *)h->object_base)[i];
|
||||
/* We used to copy the odd few remaining bytes as one extra COPYING_UNIT,
|
||||
but that can cross a page boundary on a machine
|
||||
@@ -314,7 +320,7 @@ _obstack_newchunk (h, length)
|
||||
already = 0;
|
||||
/* Copy remaining bytes one by one. */
|
||||
for (i = already; i < obj_size; i++)
|
||||
new_chunk->contents[i] = h->object_base[i];
|
||||
object_base[i] = h->object_base[i];
|
||||
|
||||
/* If the object just copied was the only data in OLD_CHUNK,
|
||||
free that chunk and remove it from the chain.
|
||||
@@ -325,7 +331,7 @@ _obstack_newchunk (h, length)
|
||||
CALL_FREEFUN (h, old_chunk);
|
||||
}
|
||||
|
||||
h->object_base = new_chunk->contents;
|
||||
h->object_base = object_base;
|
||||
h->next_free = h->object_base + obj_size;
|
||||
/* The new chunk certainly contains no empty object yet. */
|
||||
h->maybe_empty_object = 0;
|
||||
@@ -451,7 +457,7 @@ _obstack_memory_used (h)
|
||||
|
||||
/* Define the error handler. */
|
||||
# ifndef _
|
||||
# ifdef HAVE_LIBINTL_H
|
||||
# if defined HAVE_LIBINTL_H || defined _LIBC
|
||||
# include <libintl.h>
|
||||
# ifndef _
|
||||
# define _(Str) gettext (Str)
|
||||
@@ -518,20 +524,20 @@ int (obstack_make_room) (obstack, length)
|
||||
return obstack_make_room (obstack, length);
|
||||
}
|
||||
|
||||
void (obstack_grow) (obstack, pointer, length)
|
||||
void (obstack_grow) (obstack, data, length)
|
||||
struct obstack *obstack;
|
||||
POINTER pointer;
|
||||
const POINTER data;
|
||||
int length;
|
||||
{
|
||||
obstack_grow (obstack, pointer, length);
|
||||
obstack_grow (obstack, data, length);
|
||||
}
|
||||
|
||||
void (obstack_grow0) (obstack, pointer, length)
|
||||
void (obstack_grow0) (obstack, data, length)
|
||||
struct obstack *obstack;
|
||||
POINTER pointer;
|
||||
const POINTER data;
|
||||
int length;
|
||||
{
|
||||
obstack_grow0 (obstack, pointer, length);
|
||||
obstack_grow0 (obstack, data, length);
|
||||
}
|
||||
|
||||
void (obstack_1grow) (obstack, character)
|
||||
@@ -575,20 +581,20 @@ POINTER (obstack_alloc) (obstack, length)
|
||||
return obstack_alloc (obstack, length);
|
||||
}
|
||||
|
||||
POINTER (obstack_copy) (obstack, pointer, length)
|
||||
POINTER (obstack_copy) (obstack, address, length)
|
||||
struct obstack *obstack;
|
||||
POINTER pointer;
|
||||
const POINTER address;
|
||||
int length;
|
||||
{
|
||||
return obstack_copy (obstack, pointer, length);
|
||||
return obstack_copy (obstack, address, length);
|
||||
}
|
||||
|
||||
POINTER (obstack_copy0) (obstack, pointer, length)
|
||||
POINTER (obstack_copy0) (obstack, address, length)
|
||||
struct obstack *obstack;
|
||||
POINTER pointer;
|
||||
const POINTER address;
|
||||
int length;
|
||||
{
|
||||
return obstack_copy0 (obstack, pointer, length);
|
||||
return obstack_copy0 (obstack, address, length);
|
||||
}
|
||||
|
||||
# endif /* __STDC__ */
|
||||
|
||||
104
lib/obstack.h
104
lib/obstack.h
@@ -1,10 +1,11 @@
|
||||
/* obstack.h - object stack macros
|
||||
Copyright (C) 1988,89,90,91,92,93,94,96,97,98,99 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.
|
||||
|
||||
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.
|
||||
Bugs can be reported to bug-glibc@gnu.org.
|
||||
|
||||
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
|
||||
@@ -13,11 +14,11 @@
|
||||
|
||||
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.
|
||||
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 General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
@@ -219,18 +220,18 @@ void obstack_init (struct obstack *obstack);
|
||||
|
||||
void * obstack_alloc (struct obstack *obstack, int size);
|
||||
|
||||
void * obstack_copy (struct obstack *obstack, void *address, int size);
|
||||
void * obstack_copy0 (struct obstack *obstack, void *address, int size);
|
||||
void * obstack_copy (struct obstack *obstack, const void *address, int size);
|
||||
void * obstack_copy0 (struct obstack *obstack, const void *address, int size);
|
||||
|
||||
void obstack_free (struct obstack *obstack, void *block);
|
||||
|
||||
void obstack_blank (struct obstack *obstack, int size);
|
||||
|
||||
void obstack_grow (struct obstack *obstack, void *data, int size);
|
||||
void obstack_grow0 (struct obstack *obstack, void *data, int size);
|
||||
void obstack_grow (struct obstack *obstack, const void *data, int size);
|
||||
void obstack_grow0 (struct obstack *obstack, const void *data, int size);
|
||||
|
||||
void obstack_1grow (struct obstack *obstack, int data_char);
|
||||
void obstack_ptr_grow (struct obstack *obstack, void *data);
|
||||
void obstack_ptr_grow (struct obstack *obstack, const void *data);
|
||||
void obstack_int_grow (struct obstack *obstack, int data);
|
||||
|
||||
void * obstack_finish (struct obstack *obstack);
|
||||
@@ -240,7 +241,7 @@ 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_ptr_grow_fast (struct obstack *obstack, const void *data);
|
||||
void obstack_int_grow_fast (struct obstack *obstack, int data);
|
||||
void obstack_blank_fast (struct obstack *obstack, int size);
|
||||
|
||||
@@ -290,21 +291,24 @@ extern int obstack_exit_failure;
|
||||
standard C version. */
|
||||
#if defined __STDC__ && __STDC__
|
||||
|
||||
# define obstack_init(h) \
|
||||
_obstack_begin ((h), 0, 0, \
|
||||
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
|
||||
# define obstack_init(h) \
|
||||
_obstack_begin ((h), 0, 0, \
|
||||
(void *(*) (long)) obstack_chunk_alloc, \
|
||||
(void (*) (void *)) obstack_chunk_free)
|
||||
|
||||
# define obstack_begin(h, size) \
|
||||
_obstack_begin ((h), (size), 0, \
|
||||
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
|
||||
# define obstack_begin(h, size) \
|
||||
_obstack_begin ((h), (size), 0, \
|
||||
(void *(*) (long)) obstack_chunk_alloc, \
|
||||
(void (*) (void *)) obstack_chunk_free)
|
||||
|
||||
# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
|
||||
_obstack_begin ((h), (size), (alignment), \
|
||||
(void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun))
|
||||
_obstack_begin ((h), (size), (alignment), \
|
||||
(void *(*) (long)) (chunkfun), \
|
||||
(void (*) (void *)) (freefun))
|
||||
|
||||
# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
|
||||
_obstack_begin_1 ((h), (size), (alignment), \
|
||||
(void *(*) (void *, long)) (chunkfun), \
|
||||
_obstack_begin_1 ((h), (size), (alignment), \
|
||||
(void *(*) (void *, long)) (chunkfun), \
|
||||
(void (*) (void *, void *)) (freefun), (arg))
|
||||
|
||||
# define obstack_chunkfun(h, newchunkfun) \
|
||||
@@ -315,21 +319,25 @@ extern int obstack_exit_failure;
|
||||
|
||||
#else
|
||||
|
||||
# define obstack_init(h) \
|
||||
_obstack_begin ((h), 0, 0, \
|
||||
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
|
||||
# define obstack_init(h) \
|
||||
_obstack_begin ((h), 0, 0, \
|
||||
(void *(*) ()) obstack_chunk_alloc, \
|
||||
(void (*) ()) obstack_chunk_free)
|
||||
|
||||
# define obstack_begin(h, size) \
|
||||
_obstack_begin ((h), (size), 0, \
|
||||
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
|
||||
# define obstack_begin(h, size) \
|
||||
_obstack_begin ((h), (size), 0, \
|
||||
(void *(*) ()) obstack_chunk_alloc, \
|
||||
(void (*) ()) obstack_chunk_free)
|
||||
|
||||
# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
|
||||
_obstack_begin ((h), (size), (alignment), \
|
||||
(void *(*) ()) (chunkfun), (void (*) ()) (freefun))
|
||||
_obstack_begin ((h), (size), (alignment), \
|
||||
(void *(*) ()) (chunkfun), \
|
||||
(void (*) ()) (freefun))
|
||||
|
||||
# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
|
||||
_obstack_begin_1 ((h), (size), (alignment), \
|
||||
(void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg))
|
||||
_obstack_begin_1 ((h), (size), (alignment), \
|
||||
(void *(*) ()) (chunkfun), \
|
||||
(void (*) ()) (freefun), (arg))
|
||||
|
||||
# define obstack_chunkfun(h, newchunkfun) \
|
||||
((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun))
|
||||
@@ -387,7 +395,7 @@ __extension__ \
|
||||
int __len = (length); \
|
||||
if (__o->next_free + __len > __o->chunk_limit) \
|
||||
_obstack_newchunk (__o, __len); \
|
||||
_obstack_memcpy (__o->next_free, (char *) (where), __len); \
|
||||
_obstack_memcpy (__o->next_free, (where), __len); \
|
||||
__o->next_free += __len; \
|
||||
(void) 0; })
|
||||
|
||||
@@ -397,7 +405,7 @@ __extension__ \
|
||||
int __len = (length); \
|
||||
if (__o->next_free + __len + 1 > __o->chunk_limit) \
|
||||
_obstack_newchunk (__o, __len + 1); \
|
||||
_obstack_memcpy (__o->next_free, (char *) (where), __len); \
|
||||
_obstack_memcpy (__o->next_free, (where), __len); \
|
||||
__o->next_free += __len; \
|
||||
*(__o->next_free)++ = 0; \
|
||||
(void) 0; })
|
||||
@@ -410,8 +418,8 @@ __extension__ \
|
||||
*(__o->next_free)++ = (datum); \
|
||||
(void) 0; })
|
||||
|
||||
/* These assume that the obstack alignment is good enough for pointers or ints,
|
||||
and that the data added so far to the current object
|
||||
/* These assume that the obstack alignment is good enough for pointers
|
||||
or ints, and that the data added so far to the current object
|
||||
shares that much alignment. */
|
||||
|
||||
# define obstack_ptr_grow(OBSTACK,datum) \
|
||||
@@ -419,7 +427,7 @@ __extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
|
||||
_obstack_newchunk (__o, sizeof (void *)); \
|
||||
*((void **)__o->next_free)++ = ((void *)datum); \
|
||||
*((void **)__o->next_free)++ = (datum); \
|
||||
(void) 0; })
|
||||
|
||||
# define obstack_int_grow(OBSTACK,datum) \
|
||||
@@ -427,11 +435,14 @@ __extension__ \
|
||||
({ struct obstack *__o = (OBSTACK); \
|
||||
if (__o->next_free + sizeof (int) > __o->chunk_limit) \
|
||||
_obstack_newchunk (__o, sizeof (int)); \
|
||||
*((int *)__o->next_free)++ = ((int)datum); \
|
||||
*((int *)__o->next_free)++ = (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)++ = (aptr))
|
||||
|
||||
# define obstack_int_grow_fast(h,aint) \
|
||||
(*((int *) (h)->next_free)++ = (aint))
|
||||
|
||||
# define obstack_blank(OBSTACK,length) \
|
||||
__extension__ \
|
||||
@@ -512,14 +523,14 @@ __extension__ \
|
||||
( (h)->temp = (length), \
|
||||
(((h)->next_free + (h)->temp > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
|
||||
_obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \
|
||||
_obstack_memcpy ((h)->next_free, (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), \
|
||||
_obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \
|
||||
_obstack_memcpy ((h)->next_free, (where), (h)->temp), \
|
||||
(h)->next_free += (h)->temp, \
|
||||
*((h)->next_free)++ = 0)
|
||||
|
||||
@@ -531,15 +542,18 @@ __extension__ \
|
||||
# define obstack_ptr_grow(h,datum) \
|
||||
( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
|
||||
(*((char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *) datum)))
|
||||
(*((const char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = (datum)))
|
||||
|
||||
# define obstack_int_grow(h,datum) \
|
||||
( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
|
||||
? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
|
||||
(*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = ((int) datum)))
|
||||
(*((int *) (((h)->next_free+=sizeof(int))-sizeof(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) \
|
||||
(*((const char **) (h)->next_free)++ = (aptr))
|
||||
|
||||
# define obstack_int_grow_fast(h,aint) \
|
||||
(*((int *) (h)->next_free)++ = (aint))
|
||||
|
||||
# define obstack_blank(h,length) \
|
||||
( (h)->temp = (length), \
|
||||
|
||||
@@ -26,12 +26,31 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
||||
#if HAVE_STRING_H
|
||||
# if !STDC_HEADERS && HAVE_MEMORY_H
|
||||
# include <memory.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
#else
|
||||
# if HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
# endif
|
||||
#endif
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_MALLOC
|
||||
"this configure-time declaration test was not run"
|
||||
#endif
|
||||
#if !HAVE_DECL_MALLOC
|
||||
char *malloc ();
|
||||
#endif
|
||||
|
||||
#ifndef strdup
|
||||
char *strdup ();
|
||||
#endif
|
||||
|
||||
12
lib/quote.h
12
lib/quote.h
@@ -1,4 +1,12 @@
|
||||
/* prototypes for quote.c */
|
||||
|
||||
char const *quote_n (int n, char const *name);
|
||||
char const *quote (char const *name);
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
char const *quote_n PARAMS ((int n, char const *name));
|
||||
char const *quote PARAMS ((char const *name));
|
||||
|
||||
@@ -89,6 +89,10 @@
|
||||
/* This is for other GNU distributions with internationalized messages. */
|
||||
#if HAVE_LIBINTL_H || defined _LIBC
|
||||
# include <libintl.h>
|
||||
# ifdef _LIBC
|
||||
# undef gettext
|
||||
# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES)
|
||||
# endif
|
||||
#else
|
||||
# define gettext(msgid) (msgid)
|
||||
#endif
|
||||
@@ -2724,7 +2728,10 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
if (c1 == 1)
|
||||
range_start = extra[idx];
|
||||
while (c1-- > 0)
|
||||
SET_LIST_BIT (extra[idx++]);
|
||||
{
|
||||
SET_LIST_BIT (extra[idx]);
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
had_char_class = false;
|
||||
|
||||
26
lib/regex.h
26
lib/regex.h
@@ -513,13 +513,31 @@ extern int re_exec _RE_ARGS ((const char *));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* GCC 2.95 and later have "__restrict"; C99 compilers have
|
||||
"restrict", and "configure" may have defined "restrict". */
|
||||
#ifndef __restrict
|
||||
# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
|
||||
# if defined restrict || 199901L <= __STDC_VERSION__
|
||||
# define __restrict restrict
|
||||
# else
|
||||
# define __restrict
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
/* For now unconditionally define __restrict_arr to expand to nothing.
|
||||
Ideally we would have a test for the compiler which allows defining
|
||||
it to restrict. */
|
||||
#define __restrict_arr
|
||||
|
||||
/* POSIX compatibility. */
|
||||
extern int regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern,
|
||||
extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
|
||||
const char *__restrict __pattern,
|
||||
int __cflags));
|
||||
|
||||
extern int regexec _RE_ARGS ((const regex_t *__preg,
|
||||
const char *__string, size_t __nmatch,
|
||||
regmatch_t __pmatch[], int __eflags));
|
||||
extern int regexec _RE_ARGS ((const regex_t *__restrict __preg,
|
||||
const char *__restrict __string, size_t __nmatch,
|
||||
regmatch_t __pmatch[__restrict_arr],
|
||||
int __eflags));
|
||||
|
||||
extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
|
||||
char *__errbuf, size_t __errbuf_size));
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifndef O_DIRECTORY
|
||||
# define O_DIRECTORY 0
|
||||
#endif
|
||||
|
||||
#include "save-cwd.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -67,7 +71,7 @@ save_cwd (struct saved_cwd *cwd)
|
||||
if (have_working_fchdir)
|
||||
{
|
||||
#if HAVE_FCHDIR
|
||||
cwd->desc = open (".", O_RDONLY);
|
||||
cwd->desc = open (".", O_RDONLY | O_DIRECTORY);
|
||||
if (cwd->desc < 0)
|
||||
{
|
||||
error (0, errno, "cannot open current directory");
|
||||
|
||||
@@ -457,8 +457,7 @@ static CHAR_T const month_name[][10] =
|
||||
return _strftime_copytm (s, maxsize, format, &tmcopy ut_argument);
|
||||
}
|
||||
# undef my_strftime
|
||||
# define my_strftime(S, Maxsize, Format, Tp) \
|
||||
_strftime_copytm (S, Maxsize, Format, Tp)
|
||||
# define my_strftime _strftime_copytm
|
||||
#endif
|
||||
|
||||
|
||||
@@ -516,6 +515,9 @@ my_strftime (s, maxsize, format, tp ut_argument)
|
||||
size_t i = 0;
|
||||
CHAR_T *p = s;
|
||||
const CHAR_T *f;
|
||||
#if DO_MULTIBYTE && !defined COMPILE_WIDE
|
||||
const char *format_end = NULL;
|
||||
#endif
|
||||
|
||||
zone = NULL;
|
||||
#if HAVE_TM_ZONE
|
||||
@@ -608,10 +610,15 @@ my_strftime (s, maxsize, format, tp ut_argument)
|
||||
{
|
||||
mbstate_t mbstate = mbstate_zero;
|
||||
size_t len = 0;
|
||||
size_t fsize;
|
||||
|
||||
if (! format_end)
|
||||
format_end = f + strlen (f) + 1;
|
||||
fsize = format_end - f;
|
||||
|
||||
do
|
||||
{
|
||||
size_t bytes = mbrlen (f + len, (size_t) -1, &mbstate);
|
||||
size_t bytes = mbrlen (f + len, fsize - len, &mbstate);
|
||||
|
||||
if (bytes == 0)
|
||||
break;
|
||||
@@ -801,8 +808,10 @@ my_strftime (s, maxsize, format, tp ut_argument)
|
||||
subformat:
|
||||
{
|
||||
CHAR_T *old_start = p;
|
||||
size_t len = my_strftime (NULL, (size_t) -1, subfmt, tp);
|
||||
add (len, my_strftime (p, maxsize - i, subfmt, tp));
|
||||
size_t len = my_strftime (NULL, (size_t) -1, subfmt,
|
||||
tp ut_argument);
|
||||
add (len, my_strftime (p, maxsize - i, subfmt,
|
||||
tp ut_argument));
|
||||
|
||||
if (to_uppcase)
|
||||
while (old_start < p)
|
||||
|
||||
@@ -28,11 +28,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#if defined _LIBC || defined HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef unsigned chartype;
|
||||
|
||||
#undef strstr
|
||||
|
||||
char *
|
||||
strstr (const char *phaystack, const char *pneedle)
|
||||
{
|
||||
@@ -105,7 +109,7 @@ jin: a = *++haystack;
|
||||
}
|
||||
while (*rhaystack == a);
|
||||
|
||||
needle = rneedle; /* took the register-poor aproach */
|
||||
needle = rneedle; /* took the register-poor approach */
|
||||
|
||||
if (a == '\0')
|
||||
break;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#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 */
|
||||
fractional parts, S_Z: idem but with leading Zeroes only */
|
||||
#define S_N 0x0
|
||||
#define S_I 0x4
|
||||
#define S_F 0x8
|
||||
@@ -36,6 +36,7 @@
|
||||
#define CMP 2
|
||||
#define LEN 3
|
||||
|
||||
|
||||
/* 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.
|
||||
@@ -46,13 +47,20 @@
|
||||
host does not conform to Posix. */
|
||||
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
|
||||
|
||||
#undef __strverscmp
|
||||
#undef strverscmp
|
||||
|
||||
#ifndef weak_alias
|
||||
# define __strverscmp strverscmp
|
||||
#endif
|
||||
|
||||
/* 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 (const char *s1, const char *s2)
|
||||
__strverscmp (const char *s1, const char *s2)
|
||||
{
|
||||
const unsigned char *p1 = (const unsigned char *) s1;
|
||||
const unsigned char *p2 = (const unsigned char *) s2;
|
||||
@@ -120,3 +128,6 @@ strverscmp (const char *s1, const char *s2)
|
||||
return state;
|
||||
}
|
||||
}
|
||||
#ifdef weak_alias
|
||||
weak_alias (__strverscmp, strverscmp)
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* xalloc.h -- malloc with out-of-memory checking
|
||||
Copyright (C) 1990-1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990-1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -52,7 +52,7 @@ void free ();
|
||||
|
||||
char *xmalloc ();
|
||||
|
||||
/* lstat works different on Linux and Solaris systems. POSIX (see
|
||||
/* lstat works differently on Linux and Solaris systems. POSIX (see
|
||||
`pathname resolution' in the glossary) requires that programs like `ls'
|
||||
take into consideration the fact that FILE has a trailing slash when
|
||||
FILE is a symbolic link. On Linux systems, the lstat function already
|
||||
|
||||
47
m4/ChangeLog
47
m4/ChangeLog
@@ -1,3 +1,46 @@
|
||||
2000-12-06 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* xstrtoumax.m4 (jm_AC_PREREQ_XSTRTOUMAX): If we need the replacement
|
||||
strtoull, we may well need the replacement strtoul, too.
|
||||
Check for declarations of strtoul and strtoull.
|
||||
|
||||
2000-12-02 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* off_t-format.m4 (OFF_T_PRINTF_FORMAT_STRING): New file/macro.
|
||||
* jm-macros.m4 (jm_MACROS): require it.
|
||||
|
||||
2000-11-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* jm-macros.m4 (jm_MACROS): Check for stdint.h.
|
||||
|
||||
2000-11-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* getloadavg.m4: s/ifval/m4_ifval/ to accommodate new autoconf.
|
||||
|
||||
2000-11-03 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* jm-macros.m4 (jm_MACROS): Add test for wcrtomb.
|
||||
|
||||
2000-11-04 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* regex.m4: Use the `m4_' prefix on `syscmd' and `m4_sysval'.
|
||||
|
||||
2000-10-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* fsusage.m4: s/AC_SHELL_IFELSE/AS_IFELSE/ to match autoconf renaming.
|
||||
* ls-mntd-fs.m4: Likewise
|
||||
|
||||
2000-10-28 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* prereq.m4 (jm_PREREQ): Add jm_PREREQ_MEMCHR.
|
||||
(jm_PREREQ_MEMCHR): New function.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* check-decl.m4 (jm_CHECK_DECLS): Also check for memrchr.
|
||||
* prereq.m4 (jm_PREREQ_DIRNAME): New macro.
|
||||
* jm-macros.m4 (AC_REPLACE_FUNCS): Add memrchr.
|
||||
|
||||
2000-09-18 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* getloadavg.m4 (AC_FUNC_GETLOADAVG): Restore the initial value of LIBS.
|
||||
@@ -38,8 +81,8 @@
|
||||
|
||||
2000-07-16 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* mbswidth.m4: New file.
|
||||
* prereq.m4 (jm_PREREQ): Call jm_PREREQ_MBSWIDTH.
|
||||
* mbswidth.m4: New file.
|
||||
* prereq.m4 (jm_PREREQ): Call jm_PREREQ_MBSWIDTH.
|
||||
|
||||
2000-07-14 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ mbstate_t.m4 \
|
||||
mbswidth.m4 \
|
||||
memcmp.m4 \
|
||||
nanosleep.m4 \
|
||||
off_t-format.m4 \
|
||||
perl.m4 \
|
||||
prereq.m4 \
|
||||
progtest.m4 \
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -158,6 +159,7 @@ mbstate_t.m4 \
|
||||
mbswidth.m4 \
|
||||
memcmp.m4 \
|
||||
nanosleep.m4 \
|
||||
off_t-format.m4 \
|
||||
perl.m4 \
|
||||
prereq.m4 \
|
||||
progtest.m4 \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 15
|
||||
#serial 16
|
||||
|
||||
dnl This is just a wrapper function to encapsulate this kludge.
|
||||
dnl Putting it in a separate file like this helps share it between
|
||||
@@ -55,6 +55,7 @@ AC_DEFUN(jm_CHECK_DECLS,
|
||||
lseek,
|
||||
malloc,
|
||||
memchr,
|
||||
memrchr,
|
||||
nanosleep,
|
||||
realloc,
|
||||
stpcpy,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 3
|
||||
#serial 4
|
||||
|
||||
# From fileutils/configure.in
|
||||
|
||||
@@ -187,6 +187,6 @@ AC_TRY_CPP([#include <sys/filsys.h>],
|
||||
ac_fsusage_space=yes)
|
||||
fi
|
||||
|
||||
AC_SHELL_IFELSE([test $ac_fsusage_space = yes], [$1], [$2])dnl
|
||||
AS_IFELSE([test $ac_fsusage_space = yes], [$1], [$2])dnl
|
||||
|
||||
])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 7
|
||||
#serial 8
|
||||
|
||||
# A replacement for autoconf's macro by the same name. This version
|
||||
# accepts an optional argument specifying the name of the $srcdir-relative
|
||||
@@ -15,7 +15,7 @@ AC_DEFUN([AC_FUNC_GETLOADAVG],
|
||||
# By default, expect to find getloadavg.c in $srcdir/.
|
||||
ac_lib_dir_getloadavg=$srcdir
|
||||
# But if there's an argument, DIR, expect to find getloadavg.c in $srcdir/DIR.
|
||||
ifval([$1], [ac_lib_dir_getloadavg=$srcdir/$1])
|
||||
m4_ifval([$1], [ac_lib_dir_getloadavg=$srcdir/$1])
|
||||
# Make sure getloadavg.c is where it belongs, at ./configure-time.
|
||||
test -f $ac_lib_dir_getloadavg/getloadavg.c \
|
||||
|| AC_MSG_ERROR([getloadavg.c is not in $ac_lib_dir_getloadavg])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 25
|
||||
#serial 28 -*- autoconf -*-
|
||||
|
||||
dnl Misc type-related macros for fileutils, sh-utils, textutils.
|
||||
|
||||
@@ -32,6 +32,7 @@ AC_DEFUN(jm_MACROS,
|
||||
paths.h \
|
||||
stdlib.h \
|
||||
stddef.h \
|
||||
stdint.h \
|
||||
string.h \
|
||||
sys/acl.h \
|
||||
sys/filsys.h \
|
||||
@@ -69,6 +70,7 @@ AC_DEFUN(jm_MACROS,
|
||||
|
||||
AC_REQUIRE([jm_PREREQ])
|
||||
|
||||
AC_REQUIRE([jm_SYS_OFF_T_PRINTF_FORMAT])
|
||||
AC_REQUIRE([jm_FUNC_LCHOWN])
|
||||
AC_REQUIRE([fetish_FUNC_RMDIR_NOTEMPTY])
|
||||
AC_REQUIRE([jm_FUNC_CHOWN])
|
||||
@@ -116,7 +118,7 @@ AC_DEFUN(jm_MACROS,
|
||||
dnl used by e.g. intl/*domain.c and lib/canon-host.c
|
||||
AC_REPLACE_FUNCS(strdup)
|
||||
|
||||
AC_REPLACE_FUNCS(memchr memmove memcpy memset)
|
||||
AC_REPLACE_FUNCS(memchr memcpy memmove memrchr memset)
|
||||
AC_CHECK_FUNCS(getpagesize)
|
||||
|
||||
# By default, argmatch should fail calling usage (1).
|
||||
@@ -176,6 +178,7 @@ AC_DEFUN(jm_MACROS,
|
||||
strerror \
|
||||
strrchr \
|
||||
sysinfo \
|
||||
wcrtomb \
|
||||
tzset \
|
||||
)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 5
|
||||
#serial 6
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl
|
||||
@@ -239,6 +239,6 @@ if test -z "$ac_list_mounted_fs"; then
|
||||
# Can't build mountlist.c or anything that needs its functions
|
||||
fi
|
||||
|
||||
AC_SHELL_IFELSE([test $ac_list_mounted_fs = found], [$1], [$2])dnl
|
||||
AS_IFELSE([test $ac_list_mounted_fs = found], [$1], [$2])dnl
|
||||
|
||||
])
|
||||
|
||||
55
m4/off_t-format.m4
Normal file
55
m4/off_t-format.m4
Normal file
@@ -0,0 +1,55 @@
|
||||
#serial 1 -*- autoconf -*-
|
||||
|
||||
dnl FIXME
|
||||
AC_DEFUN(jm_SYS_OFF_T_PRINTF_FORMAT,
|
||||
[dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])
|
||||
AC_CHECK_HEADERS(string.h stdlinb.h)
|
||||
AC_CACHE_CHECK([for printf format that works with type off_t],
|
||||
jm_cv_sys_off_t_printf_format,
|
||||
[
|
||||
jm_cv_sys_off_t_printf_format=undef
|
||||
for jm_fmt in '' L ll q; do
|
||||
jm_OFF_T_FORMAT="$jm_fmt"
|
||||
export jm_OFF_T_FORMAT
|
||||
AC_TRY_RUN([
|
||||
# include <sys/types.h>
|
||||
# include <stdio.h>
|
||||
# if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
# if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
# endif
|
||||
int
|
||||
main()
|
||||
{
|
||||
static off_t x[] = {1, 255, 65535, 99999999};
|
||||
char buf[50], fmt[50];
|
||||
|
||||
/* this should be one of these values: "", "L", "ll", "q" */
|
||||
char *f = getenv ("jm_OFF_T_FORMAT");
|
||||
|
||||
sprintf (fmt, "%%%sd %%%sx %%%sx %%%sd", f, f, f, f);
|
||||
sprintf (buf, fmt, x[0], x[1], x[2], x[3]);
|
||||
exit (strcmp (buf, "1 ff ffff 99999999"));
|
||||
}
|
||||
], jm_cv_sys_off_t_printf_format=$jm_fmt; break
|
||||
, dnl didn't work
|
||||
dnl Cross compiling -- you lose. Specify it via the cache.
|
||||
)
|
||||
done
|
||||
|
||||
# Die if none of the above worked.
|
||||
# FIXME: If this failure become a problem that we can't work around,
|
||||
# an alternative would be to arrange not to build od.
|
||||
if test "$jm_cv_sys_off_t_printf_format" = undef; then
|
||||
AC_MSG_ERROR(dnl
|
||||
[couldn't find a printf format that works with the type, off_t])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED(OFF_T_PRINTF_FORMAT_STRING,
|
||||
"$jm_cv_sys_off_t_printf_format",
|
||||
[printf format string for type off_t, without the `%'])
|
||||
])
|
||||
21
m4/prereq.m4
21
m4/prereq.m4
@@ -1,4 +1,4 @@
|
||||
#serial 11
|
||||
#serial 13
|
||||
|
||||
dnl These are the prerequisite macros for files in the lib/
|
||||
dnl directories of the fileutils, sh-utils, and textutils packages.
|
||||
@@ -7,10 +7,12 @@ AC_DEFUN(jm_PREREQ,
|
||||
[
|
||||
jm_PREREQ_ADDEXT
|
||||
jm_PREREQ_CANON_HOST
|
||||
jm_PREREQ_DIRNAME
|
||||
jm_PREREQ_ERROR
|
||||
jm_PREREQ_GETPAGESIZE
|
||||
jm_PREREQ_HUMAN
|
||||
jm_PREREQ_MBSWIDTH
|
||||
jm_PREREQ_MEMCHR
|
||||
jm_PREREQ_QUOTEARG
|
||||
jm_PREREQ_READUTMP
|
||||
jm_PREREQ_REGEX
|
||||
@@ -39,6 +41,18 @@ AC_DEFUN(jm_PREREQ_CANON_HOST,
|
||||
netinet/in.h arpa/inet.h)
|
||||
])
|
||||
|
||||
AC_DEFUN(jm_PREREQ_DIRNAME,
|
||||
[
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(string.h)
|
||||
])
|
||||
|
||||
AC_DEFUN(jm_PREREQ_GETPAGESIZE,
|
||||
[
|
||||
AC_CHECK_FUNCS(getpagesize)
|
||||
AC_CHECK_HEADERS(OS.h unistd.h)
|
||||
])
|
||||
|
||||
# If you use human.c, you need the following files:
|
||||
# uintmax_t.m4 inttypes_h.m4 ulonglong.m4
|
||||
AC_DEFUN(jm_PREREQ_HUMAN,
|
||||
@@ -49,10 +63,9 @@ AC_DEFUN(jm_PREREQ_HUMAN,
|
||||
AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
|
||||
])
|
||||
|
||||
AC_DEFUN(jm_PREREQ_GETPAGESIZE,
|
||||
AC_DEFUN(jm_PREREQ_MEMCHR,
|
||||
[
|
||||
AC_CHECK_FUNCS(getpagesize)
|
||||
AC_CHECK_HEADERS(OS.h unistd.h)
|
||||
AC_CHECK_HEADERS(limits.h stdlib.h bp-sym.h)
|
||||
])
|
||||
|
||||
AC_DEFUN(jm_PREREQ_QUOTEARG,
|
||||
|
||||
@@ -51,10 +51,9 @@ AC_DEFUN(jm_INCLUDED_REGEX,
|
||||
fi
|
||||
|
||||
test -n "$1" || AC_MSG_ERROR([missing argument])
|
||||
syscmd([test -f $1])
|
||||
ifelse(sysval, 0,
|
||||
m4_syscmd([test -f $1])
|
||||
ifelse(m4_sysval, 0,
|
||||
[
|
||||
|
||||
AC_ARG_WITH(included-regex,
|
||||
[ --without-included-regex don't compile regex; this is the default on
|
||||
systems with version 2 of the GNU C library
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 2
|
||||
#serial 3
|
||||
|
||||
# autoconf tests required for use of xstrtoumax.c
|
||||
|
||||
@@ -7,7 +7,8 @@ AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
|
||||
AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
|
||||
AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
|
||||
AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
|
||||
AC_CHECK_HEADERS(stdlib.h)
|
||||
AC_CHECK_DECLS([strtoul, strtoull])
|
||||
AC_CHECK_HEADERS(limits.h stdlib.h)
|
||||
|
||||
AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
|
||||
jm_cv_func_strtoumax_macro,
|
||||
@@ -28,7 +29,13 @@ AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
|
||||
dnl so we need the replacement strtoull only if strtoumax does not exist.
|
||||
case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
|
||||
yes,no,no)
|
||||
AC_REPLACE_FUNCS(strtoull)
|
||||
AC_REPLACE_FUNCS(strtoull strtol)
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
|
||||
no,no)
|
||||
AC_REPLACE_FUNCS(strtoul strtol)
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
30
man/help2man
30
man/help2man
@@ -27,7 +27,7 @@ use Text::Tabs qw(expand);
|
||||
use POSIX qw(strftime setlocale LC_TIME);
|
||||
|
||||
my $this_program = 'help2man';
|
||||
my $this_version = '1.022';
|
||||
my $this_version = '1.23';
|
||||
my $version_info = <<EOT;
|
||||
GNU $this_program $this_version
|
||||
|
||||
@@ -269,9 +269,11 @@ s/^\n+//;
|
||||
s/\n*$/\n/;
|
||||
s/\n\n+/\n\n/g;
|
||||
|
||||
# Temporarily exchange leading dots and backslashes for tokens.
|
||||
# Temporarily exchange leading dots, apostrophes and backslashes for
|
||||
# tokens.
|
||||
s/^\./\x80/mg;
|
||||
s/\\/\x81/g;
|
||||
s/^'/\x81/mg;
|
||||
s/\\/\x82/g;
|
||||
|
||||
# Start a new paragraph (if required) for these.
|
||||
s/([^\n])\n(Report +bugs|Email +bug +reports +to|Written +by)/$1\n\n$2/g;
|
||||
@@ -366,7 +368,7 @@ while (length)
|
||||
{
|
||||
$matched .= $& if %append;
|
||||
$indent = length ($4 || "$1$3");
|
||||
$content = ".TP\n\x82$2\n\x82$5\n";
|
||||
$content = ".TP\n\x83$2\n\x83$5\n";
|
||||
unless ($4)
|
||||
{
|
||||
# Indent may be different on second line.
|
||||
@@ -378,7 +380,7 @@ while (length)
|
||||
elsif (s/^ {1,10}([+-]\S.*)\n//)
|
||||
{
|
||||
$matched .= $& if %append;
|
||||
$content = ".HP\n\x82$1\n";
|
||||
$content = ".HP\n\x83$1\n";
|
||||
$indent = 80; # not continued
|
||||
}
|
||||
|
||||
@@ -387,7 +389,7 @@ while (length)
|
||||
{
|
||||
$matched .= $& if %append;
|
||||
$indent = length $1;
|
||||
$content = ".TP\n\x82$2\n\x82$3\n";
|
||||
$content = ".TP\n\x83$2\n\x83$3\n";
|
||||
}
|
||||
|
||||
# Indented paragraph.
|
||||
@@ -395,7 +397,7 @@ while (length)
|
||||
{
|
||||
$matched .= $& if %append;
|
||||
$indent = length $1;
|
||||
$content = ".IP\n\x82$2\n";
|
||||
$content = ".IP\n\x83$2\n";
|
||||
}
|
||||
|
||||
# Left justified paragraph.
|
||||
@@ -411,7 +413,7 @@ while (length)
|
||||
while (s/^ {$indent}(\S.*)\n//)
|
||||
{
|
||||
$matched .= $& if %append;
|
||||
$content .= "\x82$1\n"
|
||||
$content .= "\x83$1\n"
|
||||
}
|
||||
|
||||
# Move to next paragraph.
|
||||
@@ -419,9 +421,10 @@ while (length)
|
||||
|
||||
for ($content)
|
||||
{
|
||||
# Leading dot protection.
|
||||
s/\x82\./\x80/g;
|
||||
s/\x82//g;
|
||||
# Leading dot and apostrophe protection.
|
||||
s/\x83\./\x80/g;
|
||||
s/\x83'/\x81/g;
|
||||
s/\x83//g;
|
||||
|
||||
# Convert options.
|
||||
s/(^| )(-[][\w=-]+)/$1 . convert_option $2/mge;
|
||||
@@ -485,9 +488,10 @@ for (@pre, (grep ! /^($filter)$/o, @include), @post)
|
||||
|
||||
for ($include{$_})
|
||||
{
|
||||
# Replace leading dot an backslash tokens.
|
||||
# Replace leading dot, apostrophe and backslash tokens.
|
||||
s/\x80/\\&./g;
|
||||
s/\x81/\\e/g;
|
||||
s/\x81/\\&'/g;
|
||||
s/\x82/\\e/g;
|
||||
print;
|
||||
}
|
||||
}
|
||||
|
||||
4
man/sha1sum.x
Normal file
4
man/sha1sum.x
Normal file
@@ -0,0 +1,4 @@
|
||||
[NAME]
|
||||
shasum \- compute and check SHA1 message digest
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
@@ -1,5 +1,523 @@
|
||||
2000-12-03 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.34.
|
||||
|
||||
* src/ls.c (gobble_file) [USE_ACL]: Set have_acl member unconditionally
|
||||
to avoid uninitialized memory reference via FILE_HAS_ACL.
|
||||
|
||||
* Makefile.maint (alpha): Use rsync rather than scp, so the destination
|
||||
file is created only after the successful completion of the copy.
|
||||
|
||||
2000-12-02 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/ls/Makefile.am (TESTS): Add follow-slink.
|
||||
* tests/ls/follow-slink: New file.
|
||||
|
||||
2000-12-01 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/ls.c (gobble_file): Do not fall back on lstat if stat
|
||||
fails; POSIX.2 does not allow this. Invoke acl only on
|
||||
non-symlinks, and only if lstat or stat succeeds.
|
||||
|
||||
2000-12-02 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* configure: Regenerate using the very latest version (in CVS) of
|
||||
autoconf.
|
||||
|
||||
* tests/dd/skip-seek: Remove test #2, now that support for the
|
||||
`B' suffix is gone.
|
||||
* tests/dd/Makefile.am (TESTS): Add skip-seek2
|
||||
* tests/dd/skip-seek2: New file.
|
||||
|
||||
2000-12-01 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/dd.c (skip, dd_copy): Use ssize_t to store result of
|
||||
safe_read, to avoid overflow e.g. on 64-bit Solaris sparc.
|
||||
(dd_copy): Remove unnecessary cast.
|
||||
|
||||
2000-12-01 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* doc/fileutils.texi: Remove B suffix. Document how to have
|
||||
the desired effect without it.
|
||||
|
||||
* src/dd.c: Undo most of the changes since 2000-11-24, since we've
|
||||
documented a standard way to do it.
|
||||
(skip_bytes, seek_bytes): Remove.
|
||||
(usage): Remove B suffix.
|
||||
(scanargs, skip, dd_copy, main): Remove support for B suffix.
|
||||
|
||||
2000-11-28 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/mkdir.c (main): Remove any trailing slash unconditionally.
|
||||
Reported by Volker Borchert.
|
||||
* tests/mkdir/t-slash: Add a test for this.
|
||||
|
||||
2000-11-27 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.33.
|
||||
|
||||
* tests/touch/no-rights: Use touch with `-d tomorrow' to avoid a
|
||||
race condition.
|
||||
|
||||
* tests/Fetish.pm (_compare_files): New function.
|
||||
(_process_file_spec): Likewise.
|
||||
(_at_replace): Likewise.
|
||||
(run_tests): Support new keywords, AUX and CMP and associated
|
||||
syntax and semantics.
|
||||
|
||||
* config.sub: Likewise.
|
||||
* config.guess: Likewise.
|
||||
|
||||
2000-11-26 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/dd.c (skip): Perform the `records < blocksize' test
|
||||
at the top of the loop, not at the bottom.
|
||||
|
||||
2000-11-26 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/dd.c (skip): New arg COUNT_BYTES. Read with BLOCKSIZE
|
||||
bytes, but consider RECORDS to be a byte count if COUNT_BYTES
|
||||
is nonzero.
|
||||
|
||||
2000-11-25 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* doc/fileutils.texi: Document seek=nB and skip=nB.
|
||||
|
||||
* src/dd.c (skip_bytes, seek_bytes): Now booleans, not counts.
|
||||
(seek_records): Renamed from seek_record, for consistency with
|
||||
skip_records and max_records. All uses changed.
|
||||
|
||||
(usage, scanargs): Remove bseek=n and bskip=n; instead, use seek=nB
|
||||
and skip=nB.
|
||||
(enum Unit, Unit): Remove.
|
||||
(skip, dd_copy, main): Undo most recent change.
|
||||
(dd_copy, main): Pass blocksize of 1 as appropriate when
|
||||
skip_bytes or seek_bytes is nonzero.
|
||||
(main): Rework ftruncate failure diagnostic to always use byte count.
|
||||
|
||||
2000-11-25 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/dd.c: Add new options, bskip and bseek.
|
||||
Based on a patch from Chris Sylvain.
|
||||
* tests/dd/skip-seek: New tests.
|
||||
* tests/dd/Makefile.am (TESTS): Add skip-seek.
|
||||
|
||||
2000-11-24 Paul Eggert <eggert@green.twinsun.com>
|
||||
|
||||
* src/dd.c (S_TYPEISSHM): New macro.
|
||||
(main): Report failed fstat.
|
||||
Complain only when ftruncate fails on a regular file,
|
||||
a directory, or a shared memory object.
|
||||
|
||||
2000-11-24 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/dd.c: Declare a pointer parameters to be `const' as appropriate.
|
||||
|
||||
* src/dd.c (main): Use ftruncate only on regular files.
|
||||
Based on a patch from Michael Stone.
|
||||
Reported by andras@kolumbus.fi at http://bugs.debian.org/77174.
|
||||
|
||||
2000-11-23 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/df.c (show_point): Before accepting an entry as a match, make
|
||||
sure that the mount directory exists and has the required device number.
|
||||
Before, e.g., `df /floppy' would mistakenly report on the root
|
||||
partition if /floppy were not listed in /etc/mtab but / was.
|
||||
Patch from Eirik Fuller (http://bugs.debian.org/76923).
|
||||
|
||||
* src/chmod.c (mode_changed): New function.
|
||||
(change_file_mode): Use it to determine accurately when -c should
|
||||
make chmod announce there's been a change.
|
||||
Based on a patch from Michael Stone.
|
||||
Reported by Kai Henningsen as Debian bug #77349.
|
||||
|
||||
* tests/chmod/c-option: New test for the above fix.
|
||||
* tests/chmod/Makefile.am (TESTS): Add c-option
|
||||
|
||||
* tests/sticky-check: New file. Factored out of tests/mkdir/parents.
|
||||
* tests/Makefile.am (EXTRA_DIST): Add sticky-check.
|
||||
* tests/mkdir/parents: Source sticky-check instead of open-coding it.
|
||||
|
||||
2000-11-19 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/chmod/equal-x: Update to use its own directory, and better trap.
|
||||
|
||||
2000-11-18 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/ls.c (BLOCK_SIZE_OPTION, COLOR_OPTION, FORMAT_OPTION,
|
||||
INDICATOR_STYLE_OPTION, QUOTING_STYLE_OPTION,
|
||||
SHOW_CONTROL_CHARS_OPTION, SORT_OPTION, TIME_OPTION): New enum
|
||||
values, to ensure that option values can't collide with chars.
|
||||
(long_options, decode_switches): Use them.
|
||||
|
||||
2000-11-18 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/sys2.h (GETOPT_HELP_CHAR, GETOPT_VERSION_CHAR): Now enum
|
||||
constants rather than macros. Use values that cannot conflict
|
||||
with C characters or with -1, CHAR_MAX + 1, etc.
|
||||
|
||||
2000-11-18 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/du.c (count_entry): Don't omit the size of a directory entry
|
||||
merely because we couldn't `chdir' into it. That would give subtly
|
||||
different results in some cases. Reported by Mattias Wadenstein
|
||||
via Michael Stone.
|
||||
|
||||
* src/ls.c: Revert change of 2000-11-11. It inadvertently change
|
||||
the output format of `ls -l --full-time'.
|
||||
|
||||
* src/mkdir.c (main): When failing to create a directory, give only
|
||||
one diagnostic, not two. Reported by Volker Borchert.
|
||||
|
||||
* src/mkdir.c (main): With --parents, remove any trailing slashes
|
||||
from the argument to the final mkdir call. Required for NetBSD.
|
||||
Reported by Volker Borchert.
|
||||
* tests/mkdir/t-slash: New test for this.
|
||||
* tests/mkdir/Makefile.am (TESTS): Add t-slash.
|
||||
|
||||
* tests/mv/mv-special-1: Create and `cd' into temporary directory
|
||||
before anything else. Reported by Volker Borchert.
|
||||
|
||||
* configure, config.h.in, Makefile.in, etc.: Regenerate using the
|
||||
very latest version (in CVS) of autoconf.
|
||||
|
||||
2000-11-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Makefile.am (.NOTPARALLEL): Remove target.
|
||||
* GNUmakefile (.NOTPARALLEL): ... put it here instead, since this
|
||||
file is common to these packages: fileutils, sh-utils, textutils.
|
||||
|
||||
* Makefile.am (.NOTPARALLEL): New target. Prevent unwanted parallelism.
|
||||
Suggestion from Ulrich Drepper.
|
||||
* po/Makefile.in.in (Makefile): Likewise.
|
||||
|
||||
* Makefile.maint (sha1): Define.
|
||||
(announcement): Include SHA1 digest of .tar.gz file.
|
||||
|
||||
2000-11-14 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/mkdir/perm: Add an `echo' so that the input to the sed command
|
||||
is NL-terminated. Otherwise, Solaris' /bin/sed generates no output.
|
||||
Reported by Vin Shelton.
|
||||
|
||||
2000-11-13 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/sys2.h (ST_TIME_CMP_NS): Fix typo: ST_MTIM_NSEC should
|
||||
be tested with #ifdef, not with #if.
|
||||
|
||||
2000-11-12 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/ls.c (print_long_format): Remove obsolete comment.
|
||||
From Paul Eggert.
|
||||
|
||||
* doc/texinfo.tex: Update from master repository.
|
||||
|
||||
2000-11-11 Paul Eggert <eggert@sic.twinsun.com>
|
||||
|
||||
* src/ls.c (<langinfo.h>): Include if HAVE_LANGINFO_H.
|
||||
(DATE_FMT_LANGINFO): New macro, taken from sh-utils/src/date.c.
|
||||
(print_long_format): Use it to determine "date" format.
|
||||
Do not wrap "%b %e %Y" and "%b %e %H:%M" in _(), as it results in
|
||||
incorrect behavior when LC_ALL is unset, LC_TIME is "C", and
|
||||
LC_MESSAGES or LANG is set to something disagreeing with the POSIX
|
||||
locale.
|
||||
|
||||
2000-11-11 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.32.
|
||||
|
||||
* Makefile.maint (GZIP_ENV): Define to --no-name, so the timestamp
|
||||
is not included in the .tar.gz file.
|
||||
|
||||
* tests/mkdir/perm (tests): Use `empty' (instead of just blanks) to
|
||||
indicate no `-m' option. Using just blanks wasn't portable to
|
||||
Solaris2.5.1's /bin/sh.
|
||||
|
||||
* tests/mkdir/perm: Don't put a newline in IFS; that's not portable to
|
||||
NetBSD's /bin/sh. Instead, filter newlines and leading/trailing blanks
|
||||
out of `tests' before the `set -'.
|
||||
|
||||
* Makefile.maint (announcement): Limit depth of ChangeLog `find' to 2.
|
||||
|
||||
* src/ls.c (print_long_format): Wrap the `--full-time' date format
|
||||
string in _(...), so it too may be internationalized.
|
||||
Suggestion from Jungshik Shin.
|
||||
|
||||
2000-11-10 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/touch.c (main): Interpret a lone numeric argument of 8 or 10
|
||||
digits as a file name, rather than as a date/time in the obsolescent
|
||||
`MMDDhhmm[YY]' format. Reported by Wenjun Zheng.
|
||||
* tests/touch/obsolescent: New test for this.
|
||||
* tests/touch/Makefile.am (TESTS): Add obsolescent.
|
||||
|
||||
2000-11-06 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/cp/cp-parents: Move mkdir tests into ../mkdir.
|
||||
|
||||
* doc/fileutils.texi: Use Free Documentation Licence.
|
||||
Change GNU to @sc{gnu} in many places.
|
||||
|
||||
* doc/texinfo.tex: Update from master repository.
|
||||
* config.sub: Likewise.
|
||||
* config.guess: Likewise.
|
||||
* man/help2man: Update from latest version: 1.23.
|
||||
|
||||
* src/mkdir.c: Do not set the permissions of the final directory
|
||||
component if it was not just created.
|
||||
Based on a patch from Volker Borchert.
|
||||
|
||||
* tests/rwx-to-mode: New file.
|
||||
* tests/Makefile.am (EXTRA_DIST): Add rwx-to-mode.
|
||||
* tests/mkdir/parents: New test for the above mkdir.c fix.
|
||||
* tests/mkdir/Makefile.am (TESTS): Add parents.
|
||||
(TESTS_ENVIRONMENT): Define srcdir=$(srcdir).
|
||||
|
||||
2000-11-02 Won-kyu Park <wkpark@chem.skku.ac.kr>
|
||||
|
||||
* src/df.c (print_header): Mark strings for translation.
|
||||
|
||||
2000-11-05 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.31.
|
||||
|
||||
* configure, config.h.in, Makefile.in, etc.: Regenerate using the
|
||||
very latest version (in CVS) of autoconf.
|
||||
|
||||
* src/mkdir.c (main): Use make_dir instead of using mkdir directly.
|
||||
Diagnose as failure when mkdir tries to create (without the
|
||||
--parent (-p) option) a directory that already exists.
|
||||
* tests/cp/cp-parents: Add a test for the above fix.
|
||||
|
||||
* tests/mv/mv-special-1: Clean up this test.
|
||||
|
||||
2000-11-01 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.30.
|
||||
|
||||
* src/chmod.c (main): Better diagnostics.
|
||||
|
||||
2000-10-31 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/lang-default: Add all the internationalization-related
|
||||
variable names autoconf uses. Set and export them in a loop.
|
||||
|
||||
`mkdir -p' would create parent directories with permissions
|
||||
that did not account for the umask. [introduced with the
|
||||
2000-09-30 change that became part of fileutils-4.0.28]
|
||||
* src/mkdir.c: Include dirname.h.
|
||||
Compute the parent directory `mode' unconditionally, effectively
|
||||
as `$(umask -S),u+wx'.
|
||||
Use make_path to create only the parent directories, thus using
|
||||
the same code, both with and without -p, to create the final
|
||||
component in each file name. Reported by Bob Proulx.
|
||||
|
||||
Add tests for the above fix.
|
||||
* tests/cp/cp-parents: Add some permission tests.
|
||||
* tests/mkdir/perm: Fix the test so it actually does something.
|
||||
Run each test also with mkdir's `-p' option and check permissions
|
||||
on the parent directories.
|
||||
|
||||
2000-10-23 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* doc/getdate.texi: Use @sc where appropriate. Document the
|
||||
ranges of supported times more precisely. Correct menu
|
||||
spacing. Document old Latin 12m/12pm tradition. Remove list
|
||||
of alphabetic time zone names, as it wasn't correct and people
|
||||
shouldn't be relying on it anyway. Relative items also
|
||||
account for non-DST adjustments. Fix some misspellings.
|
||||
|
||||
2000-10-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* configure, config.h.in, Makefile.in, etc.: Regenerate using the
|
||||
very latest version (in CVS) of autoconf.
|
||||
|
||||
2000-10-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 4.0.29.
|
||||
|
||||
* src/cp.c (do_copy): When constructing dst_path for use with the
|
||||
--parents option, first remove any trailing slashes from the command
|
||||
line argument. Otherwise, tests/cp/cp-parent would fail on NetBSD.
|
||||
|
||||
* tests/cp/cp-parents: Add a test.
|
||||
|
||||
* src/ls.c (DT_INIT): Define.
|
||||
[enum filetype]: Remove the #ifdef, and use DT_INIT on the
|
||||
initializers instead. `unknown' was undefined for some systems.
|
||||
Reported by John David Anglin.
|
||||
|
||||
* tests/lang-default (LC_COLLATE): Set it to the empty string and
|
||||
export it. Otherwise, tests/cp/cp-mv-backup would fail e.g., when
|
||||
LC_COLLATE was set to en. Reported by Vin Shelton.
|
||||
|
||||
2000-10-28 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/ls.c (main): In call to gobble_file with `"."', use `directory'
|
||||
as the type, not `unknown'.
|
||||
[enum filetype] (arg_directory): Rather than `100', use
|
||||
a number that should never conflict with another DT_* value.
|
||||
From Ulrich Drepper.
|
||||
|
||||
* Version 4.0.28.
|
||||
|
||||
Make `ls' a lot more efficient on systems (e.g., linux-2.4.*)
|
||||
that store file type information in directory entries.
|
||||
|
||||
* src/ls.c [enum filetype] (unknown):
|
||||
Add members (as yet unused):
|
||||
(HAVE_STRUCT_DIRENT_D_TYPE): Define.
|
||||
(format_needs_type): New global.
|
||||
(main): Set it.
|
||||
(print_dir): Set `type' from directory entry, if possible.
|
||||
(gobble_file): Add a parameter, TYPE.
|
||||
Stat the file only if its type is unknown and we need the type.
|
||||
Patch from Ulrich Drepper.
|
||||
|
||||
Shred can now determine the size of a block devices (e.g. /dev/fd0)
|
||||
by writing until a write operation fails.
|
||||
|
||||
* src/shred.c: Include assert.h.
|
||||
(fillrand): Add a parameter, size_max.
|
||||
Adjust caller.
|
||||
Add an assertion.
|
||||
(dopass): Break out of the `for (;;)' loop if size < offset.
|
||||
That can happen now that dopass is called with SIZE == -1.
|
||||
(do_wipefd): Accept a length of zero only for a regular file.
|
||||
If lseek fails or returns 0 for a non-regular file, let dopass
|
||||
determine the length.
|
||||
Inspired by a patch from Alan Iwi.
|
||||
|
||||
* tests/Makefile.am (EXTRA_DIST): Add lang-default.
|
||||
|
||||
* tests/rm/hash: Factor out the expensive-test-checking code, ...
|
||||
* tests/expensive: ... into this new file.
|
||||
* tests/cp/perm: Disable this test by default; it's expensive.
|
||||
Mark this as an expensive test.
|
||||
* tests/Makefile.am (EXTRA_DIST): Add expensive.
|
||||
|
||||
* doc/fileutils.texi (shred invocation): Give two examples.
|
||||
|
||||
2000-10-26 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/getdate.texi (Authors of getdate): Add Paul Eggert.
|
||||
|
||||
2000-10-23 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add .prev-version.
|
||||
|
||||
2000-10-22 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/cp.c (make_path_private): Add a FIXME comment.
|
||||
|
||||
* tests/lang-default: New file. Set LANG, LC_ALL, and LANGUAGE to ''
|
||||
(rather than to `C') and export them into the environment.
|
||||
Suggestion from Bruno Haible.
|
||||
|
||||
* tests/cp/backup-is-src: Source lang-default rather than open-coding
|
||||
the setting/exporting of LANG, LC_ALL, and LANGUAGE.
|
||||
* tests/cp/cp-mv-backup: Likewise.
|
||||
* tests/cp/same-file: Likewise.
|
||||
* tests/cp/slink-2-slink: Likewise.
|
||||
* tests/cp/symlink-slash: Likewise.
|
||||
* tests/ln/sf-1: Likewise.
|
||||
* tests/ls/symlink-slash: Likewise.
|
||||
* tests/ls/time-1: Likewise.
|
||||
* tests/mv/backup-is-src: Likewise.
|
||||
* tests/mv/diag: Likewise.
|
||||
* tests/mv/force: Likewise.
|
||||
* tests/mv/hard-link-1: Likewise.
|
||||
* tests/mv/i-2: Likewise.
|
||||
* tests/mv/into-self: Likewise.
|
||||
* tests/mv/into-self-2: Likewise.
|
||||
* tests/mv/into-self-3: Likewise.
|
||||
* tests/mv/mv-special-1: Likewise.
|
||||
* tests/mv/part-symlink: Likewise.
|
||||
* tests/mv/partition-perm: Likewise.
|
||||
* tests/rm/r-1: Likewise.
|
||||
* tests/rm/r-2: Likewise.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/cp/cp-parents: New test.
|
||||
* tests/cp/Makefile.am (TESTS): Add cp-parents;
|
||||
|
||||
2000-10-19 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/texinfo.tex: Update from master repository.
|
||||
* config.sub: Likewise.
|
||||
* config.guess: Likewise.
|
||||
* depcomp: Likewise.
|
||||
|
||||
2000-10-18 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/mv/part-symlink: Make sure the programs use C-locale formats
|
||||
and translations. Bruno Haible reported that this test would fail
|
||||
when using other locales, because ls printed a translation of `total'.
|
||||
|
||||
2000-10-16 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/ls.c (print_long_format): Wrap date format strings in _(...)
|
||||
so they may be internationalized. Suggestion from Christian Rose.
|
||||
|
||||
2000-10-13 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/mv.c (rm_option_init): Remove FIXME-maybe comment.
|
||||
|
||||
2000-09-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/du/two-args: Update to use newer template.
|
||||
|
||||
* src/install.c: Remove big, option-describing comment block.
|
||||
(main): Rename local `symbolic_mode' to `specified_mode'.
|
||||
|
||||
* src/mkdir.c (main): Don't set the umask to 0 and hand-apply
|
||||
the previously-set umask unconditionally. Do that only when a
|
||||
MODE has been specified. Otherwise, call mkdir with the full
|
||||
creation mask (0777 or 0666) and let the kernel apply the umask.
|
||||
The difference shows up only on file systems with ACL support
|
||||
when the containing directory has a default ACL.
|
||||
Patch by Andreas Gruenbacher.
|
||||
(main): Rename local `symbolic_mode' to `specified_mode'.
|
||||
* src/mknod.c (main): Likewise (but `call mknod', not mkdir).
|
||||
Also, when MODE is specified, call chmod to ensure that the
|
||||
permission bits are set as specified even when the containing
|
||||
directory has a default ACL.
|
||||
Patch by Andreas Gruenbacher.
|
||||
* src/mkfifo.c (main): Likewise (but `call mkfifo', not mkdir).
|
||||
Patch by Andreas Gruenbacher.
|
||||
|
||||
* tests/mkdir/perm: New test.
|
||||
* tests/mkdir/Makefile.am (TESTS): Add perm.
|
||||
|
||||
2000-08-17 Andreas Gruenbacher <ag@bestbits.at>
|
||||
|
||||
* src/chmod.c (change_file_mode): Perform the chmod even if the
|
||||
file mode permission bits are the same as those that should be set.
|
||||
Omitting the chmod call would be alright with minimal 1003.1e DS17
|
||||
ACLs, but eventually there may be other permissions in addition to
|
||||
rwx. E.g., add and delete for directories, and something analogous
|
||||
to NT's take ownership permission.
|
||||
|
||||
2000-09-25 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/cp/same-file: Don't use `diff -u'. It's not portable.
|
||||
Reported by Christian Krackowizer.
|
||||
* tests/cp/same-file: Run `diff -c' only if cmp finds a difference.
|
||||
* tests/mv/part-symlink: Likewise. And clean up.
|
||||
|
||||
`shred --exact file1 file2' wouldn't touch `file1'
|
||||
* src/shred.c (long_opts): --exact doesn't take an argument.
|
||||
Reported by Alan Iwi.
|
||||
* tests/shred/exact: New test for this.
|
||||
* tests/shred/Makefile.am (TESTS): Add exact.
|
||||
|
||||
* Makefile.maint (PREV_VERSION): Get the value from a file, rather
|
||||
than trying to derive it from the current version number.
|
||||
This is much more robust.
|
||||
(alpha): Record just-released version number in `.prev-version',
|
||||
and commit (post-tag).
|
||||
|
||||
* Version 4.0.27.
|
||||
|
||||
2000-09-24 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
@@ -1,4 +1,41 @@
|
||||
Changes in release 4.01:
|
||||
[4.0.34]
|
||||
* `ls -L dangling-symlink' now fails (per POSIX) rather than printing the
|
||||
link name
|
||||
* dd no longer honors the just-added `B' suffix on skip= and seek= arguments.
|
||||
* `mkdir no-such-dir/' no longer fails on NetBSD systems
|
||||
[4.0.33]
|
||||
* dd now accepts skip=nB and seek=nB, to advance past some number of bytes, n,
|
||||
that need not be a multiple of the block size.
|
||||
* dd (without conv=notrunc) now uses ftruncate only on regular files
|
||||
* chmod --changes (-c) once again issues diagnostics only for the files
|
||||
with changed permissions
|
||||
* mkdir now gives one diagnostic (rather than two) for certain failures
|
||||
* mkdir portability fix for NetBSD
|
||||
[4.0.32]
|
||||
* touch now interprets a lone numeric argument of 8 or 10 digits as a file name,
|
||||
rather than as a date/time in the obsolescent `MMDDhhmm[YY]' format.
|
||||
* mkdir no longer sets the permissions of the final directory component
|
||||
if it already exists (this bug, too, was introduced recently)
|
||||
* ls's --full-time format string is now locale dependent
|
||||
[4.0.31]
|
||||
* mkdir: fix a bug introduced in 4.0.30 whereby `mkdir existing-dir' would
|
||||
succeed. Now it fails, as it should (and used to).
|
||||
[4.0.30]
|
||||
* mkdir: fix a bug introduced in 4.0.28 whereby parent directories created
|
||||
via `mkdir -p' would have permissions that did not account for the umask
|
||||
[4.0.29]
|
||||
* ls.c wouldn't compile on some systems: fix it
|
||||
* `cp -R --parents dir1/ dir2' failed on NetBSD, due to a portability problem
|
||||
[4.0.28]
|
||||
* ls is much more efficient on systems (e.g., linux-2.4.*) that store file
|
||||
type information in directory entries.
|
||||
* shred now automatically determines the size of each block device argument
|
||||
* ls's date/time format strings are now local dependent
|
||||
* mkdir, mknod, mkfifo, and chmod work better in conjunction with ACLs
|
||||
* `cp --parents dir1/ dir2' no longer gets a failed assertion
|
||||
* shred now determines the size of block devices like /dev/fd0
|
||||
* `shred --exact file1 file2' now erases `file1', too
|
||||
[4.0.27]
|
||||
* install once again unlinks an existing destination before trying to open it
|
||||
* mv no longer gets a failed assertion when moving a directory (specified with
|
||||
|
||||
@@ -1,3 +1,104 @@
|
||||
2000-12-02 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 2.0.12.
|
||||
|
||||
* src/seq.c (valid_format): Move pre-increment to a separate statement
|
||||
to avoid a warning.
|
||||
|
||||
* src/id.c: Move dcls of globals used only in main...
|
||||
(main): ...to here.
|
||||
(usage): Clarify option descriptions.
|
||||
|
||||
2000-11-18 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* po/Makefile.in.in: Sync with the one from fileutils.
|
||||
|
||||
* configure, config.h.in, Makefile.in, etc.: Regenerate using the
|
||||
very latest version (in CVS) of autoconf.
|
||||
|
||||
2000-11-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* GNUmakefile (.NOTPARALLEL): New target. Prevent unwanted parallelism.
|
||||
Suggestion from Ulrich Drepper.
|
||||
|
||||
* src/pinky.c: Explicitly include sys/types.h before including system.h.
|
||||
* src/uptime.c: Likewise.
|
||||
* src/users.c: Likewise.
|
||||
* src/who.c: Likewise.
|
||||
|
||||
2000-11-13 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/sys2.h (ST_TIME_CMP_NS): Fix typo: ST_MTIM_NSEC should
|
||||
be tested with #ifdef, not with #if.
|
||||
|
||||
2000-11-12 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/date.c (show_date): Add a comment explaining why the
|
||||
format string must not be translatable via _(). From Paul Eggert.
|
||||
|
||||
2000-10-31 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/sh-utils.texi: Clean up indentation and punctuation.
|
||||
Fix a couple typos. From Brian Youmans.
|
||||
|
||||
2000-10-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* configure, config.h.in, Makefile.in, etc.: Regenerate using the
|
||||
very latest version (in CVS) of autoconf.
|
||||
|
||||
2000-10-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Version 2.0.11.
|
||||
|
||||
2000-10-27 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/date.c (usage): Mention the time zone, UTC, and write the date
|
||||
in ISO format in the description of %s. Suggestion from Karl Berry.
|
||||
|
||||
2000-10-25 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/dirname.c: Include dirname.h.
|
||||
(main): Use dir_name_r rather than open-coding it.
|
||||
|
||||
2000-10-23 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add .prev-version.
|
||||
|
||||
2000-10-18 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/date.c (universal_time): Remove; it's just a temptation to
|
||||
do the wrong thing.
|
||||
(main): The -u option now just sets TZ; it doesn't do anything else.
|
||||
(show_date): Do not do anything special if -u is set.
|
||||
This affects the behavior of the -I and -R options.
|
||||
* doc/sh-utils.texi: Document the above.
|
||||
|
||||
2000-10-18 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/sh-utils.texi (Examples of date): Fix a typo.
|
||||
|
||||
2000-10-11 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/sh-utils.texi (Time directives) [%S]: Range is 0..60, not 0..61.
|
||||
|
||||
2000-10-06 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Undo the effect of the 1997-07-12 change to date.c; it
|
||||
broke "date -u MMDDhhmm" and it wasn't documented.
|
||||
This reverts to the behavior of the 1996-01-03 patch.
|
||||
|
||||
* src/date.c (TZ_UTC0, MAYBE_SET_TZ_UTC0, set_tz): Remove.
|
||||
(batch_convert): Don't futz with TZ.
|
||||
(main): -u now parses all dates as UTC, not just some.
|
||||
Reported by Karl-Michael Schneider.
|
||||
* tests/date/Test.pm (utc-0, utc-1, relative-2): Adjust to
|
||||
above change.
|
||||
|
||||
2000-09-29 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/yes.c (usage): Add a separate usage line, just for `OPTION'.
|
||||
Suggestion from M. P. Suzuki.
|
||||
|
||||
2000-09-09 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/date.c (usage): Make the second `Usage' line more precise
|
||||
@@ -441,8 +542,8 @@
|
||||
|
||||
2000-01-21 Bruno Haible <haible@linuix.math.u-bordeaux.fr>
|
||||
|
||||
Add support for octal and hexadecimal output.
|
||||
* seq.c (intconv): New variable.
|
||||
Add support for octal and hexadecimal output.
|
||||
* seq.c (intconv): New variable.
|
||||
(usage): Update.
|
||||
(main): Call scan_arg instead of scan_double_arg. Call check_format
|
||||
before scan_arg.
|
||||
@@ -1803,8 +1904,8 @@
|
||||
1997-08-31 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/who.c (main): New option --lookup (-l).
|
||||
(print_entry): Only call canon_host if user explicitly asks for it.
|
||||
(usage): Describe --lookup.
|
||||
(print_entry): Only call canon_host if user explicitly asks for it.
|
||||
(usage): Describe --lookup.
|
||||
From Galen Hazelwood.
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add Spanish (es).
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
Changes in release 2.1
|
||||
[2.0k]
|
||||
[2.0.11]
|
||||
* setting the date now works properly, even when using -u
|
||||
* `date -f - < /dev/null' no longer dumps core
|
||||
* some DOS/Windows portability changes
|
||||
[2.0j]
|
||||
* `date -d DATE' now parses certain relative DATEs correctly
|
||||
[2.0i]
|
||||
|
||||
@@ -1,3 +1,258 @@
|
||||
2000-12-03 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/tail.c (tail_file): Initialize ignore, dev, and ino members,
|
||||
when tailing forever and the open failed. Otherwise, we could get
|
||||
uninitialized memory references of those fields in recheck.
|
||||
* tests/tail-2/Makefile.am (TESTS): Add assert-2.
|
||||
* tests/tail-2/assert-2: New file.
|
||||
|
||||
* Version 2.0.9.
|
||||
|
||||
Make od print valid addresses for offsets of 2^32 and larger, and
|
||||
allow byte offset (-j) and byte count (-N) to be 2^32 and larger.
|
||||
|
||||
* src/od.c (MAX_ADDRESS_LENGTH): Don't hard-code as a literal.
|
||||
Rather, define in terms of the type, off_t.
|
||||
(string_min): Declare to be of type size_t.
|
||||
(flag_dump_strings): Declare to be of type int.
|
||||
(print_s_char): Declare the n_bytes parameter and the local, `i',
|
||||
to be of type off_t.
|
||||
(print_char): Likewise.
|
||||
(print_s_short): Likewise.
|
||||
(print_short): Likewise.
|
||||
(print_int): Likewise.
|
||||
(print_long): Likewise.
|
||||
(print_long_long): Likewise.
|
||||
(print_float): Likewise.
|
||||
(print_double): Likewise.
|
||||
(print_long_double): Likewise.
|
||||
(dump_hexl_mode_trailer): Likewise.
|
||||
(print_named_ascii): Likewise.
|
||||
(print_ascii): Likewise.
|
||||
(write_block): Likewise.
|
||||
(print_ascii): Declare local, `print_function' with a prototype.
|
||||
Change a few `>' comparisons to the equivalent `<' form.
|
||||
(parse_options): Declare `tmp' to be of type uintmax_t.
|
||||
Use xstrtoumax, not xstrtoul.
|
||||
Fail if the specified offset if larger than OFF_T_MAX.
|
||||
(dump_strings): Declare local `i' to be of type size_t.
|
||||
Remove the now-unnecessary cast-to-off_t.
|
||||
(main) [IF_LINT]: Initialize desired_width to avoid a warning.
|
||||
Declare `tmp' to be of type uintmax_t.
|
||||
Use xstrtoumax, not xstrtoul.
|
||||
Fail if minimum string length is larger than SIZE_MAX.
|
||||
Fail if specified width is larger than ULONG_MAX.
|
||||
|
||||
* src/od.c (format_address): Use off_t, not long unsigned_int as the
|
||||
parameter type.
|
||||
(format_address_none): Likewise. Mark parameter as unused.
|
||||
(format_address_std): Likewise.
|
||||
(format_address_label): Likewise.
|
||||
(print_ascii): Mark format string parameter as unused.
|
||||
(write_block): Use off_t, not long unsigned_int as offset type.
|
||||
(expand_address_fmt): New function.
|
||||
(main): Use it to expand each address format string template.
|
||||
Reported by Mark Nudelman, via Andreas Jaeger.
|
||||
|
||||
* src/sys2.h (OFF_T_MIN): Define here instead.
|
||||
(OFF_T_MAX): Likewise.
|
||||
(CHAR_BIT): Define.
|
||||
|
||||
* src/tail.c (parse_options): Use xstrtoumax to parse the byte and line
|
||||
offset. Give a better diagnostic when the requested offset is still
|
||||
representable but larger than OFF_T_MAX.
|
||||
(OFF_T_MIN): Remove definition.
|
||||
(OFF_T_MAX): Likewise.
|
||||
|
||||
2000-12-02 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/sort.c (checkfp): Rename local `buf' to avoid shadowing previous
|
||||
declaration.
|
||||
|
||||
* src/sort.c (NONZERO): Define and use it to make the code a tiny
|
||||
bit more readable.
|
||||
|
||||
* doc/textutils.texi (sort invocation): Clarify how -t works
|
||||
when a sort key specifies a range of fields. From Karl O. Pinc.
|
||||
|
||||
2000-11-26 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/od.c (skip): Use lseek instead of worrying about fseeko or fseek.
|
||||
This should be portable, as we seek before doing any I/O.
|
||||
(fseeko): Remove; no longer used.
|
||||
|
||||
2000-11-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/sort.c: s/SIZE_T_MAX/SIZE_MAX/.
|
||||
|
||||
2000-11-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/sys2.h: Include <stdint.h> if HAVE_STDINT_H.
|
||||
(SIZE_MAX): Renamed from SIZE_T_MAX, as C99 uses SIZE_MAX.
|
||||
All uses changed.
|
||||
|
||||
2000-11-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/sort.c: SIZE_MAX is not defined, so s/SIZE_MAX/SIZE_T_MAX/, and...
|
||||
* src/sys2.h (SIZE_T_MAX): ... define.
|
||||
|
||||
2000-11-29 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Port GNU "sort" to hosts where sizes don't fit in "int",
|
||||
e.g. 64-bit Solaris (sparc).
|
||||
|
||||
* src/sort.c ("human.h", "xstrtol.h"): Include.
|
||||
(struct line): length member is now size_t, not int.
|
||||
(struct lines): Likewise for used, alloc, limit members.
|
||||
(struct buffer): Likewise for used, alloc, left, newline_free members.
|
||||
(struct keyfield): Likewise for sword, schar, eword, echar members.
|
||||
(sortalloc, mergealloc, linelength): Now size_t, not int.
|
||||
|
||||
(initbuf, fillbuf, initlines, begfield, limfield, findlines,
|
||||
numcompare, getmonth, keycompare, compare, checkfp, mergefps,
|
||||
sortlines, sort): Accept, return, and use size_t for sizes, not int.
|
||||
|
||||
(fillbuf, initlines, findlines, checkfp, sort): Check for overflow
|
||||
when computing buffer sizes.
|
||||
|
||||
(begfield, limfield): Do not index past end of array.
|
||||
|
||||
(checkfp): Return a boolean, not a line number, as the line
|
||||
number may not fit in int. All callers changed. Use
|
||||
uintmax_t for line numbers, not int.
|
||||
|
||||
(sort): Don't allocate tmp until we need it (and know the right size).
|
||||
|
||||
(parse_field_count): New function.
|
||||
|
||||
(main): Use it to check for overflow in field counts.
|
||||
"outfile" is now a pointer to const.
|
||||
|
||||
2000-11-27 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/checksum.h: Don't include system.h here.
|
||||
* src/md5.c: Include config.h, stdio.h, sys/types.h. and system.h here
|
||||
instead.
|
||||
* src/sha1sum.c: Likewise.
|
||||
|
||||
2000-11-18 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/pr.c (main): Do not assume EOF == -1.
|
||||
Handle the case correctly when digits options immediately precede a
|
||||
non-option.
|
||||
|
||||
2000-11-18 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/textutils.texi: Change GNU to @sc{gnu} in many places.
|
||||
Update to use the Free Documentation Licence.
|
||||
|
||||
* configure, config.h.in, Makefile.in, etc.: Regenerate using the
|
||||
very latest version (in CVS) of autoconf.
|
||||
|
||||
2000-11-17 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* GNUmakefile (.NOTPARALLEL): New target. Prevent unwanted parallelism.
|
||||
Suggestion from Ulrich Drepper.
|
||||
|
||||
2000-11-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
|
||||
|
||||
* tsort.c: Include sys/types.h before system.h.
|
||||
|
||||
2000-11-16 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/join.c: Declare global `tab' to be of type *unsigned* char,
|
||||
so join works with 8-bit delimiter characters.
|
||||
Reported by Antonio Rendas.
|
||||
* tests/join/Test.pm (8-bit-t): New test for the above fix.
|
||||
|
||||
2000-11-13 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/sys2.h (ST_TIME_CMP_NS): Fix typo: ST_MTIM_NSEC should
|
||||
be tested with #ifdef, not with #if.
|
||||
|
||||
2000-11-11 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* doc/textutils.texi: More minor rewording and grammar correction.
|
||||
From Brian Youmans.
|
||||
|
||||
2000-11-06 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/od.c (skip): st_size is not defined for directories.
|
||||
|
||||
2000-11-03 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/sha1sum/sample-vec: New file, with tests derived from
|
||||
http://csrc.nist.gov/cryptval/shs/sha1-vectors.zip
|
||||
* tests/sha1sum/Makefile.am (TESTS): Add sample-vec.
|
||||
|
||||
2000-10-30 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* configure, config.h.in, Makefile.in, etc.: Regenerate using the
|
||||
very latest version (in CVS) of autoconf.
|
||||
|
||||
* src/wc.c: Include "system.h" after wctype.h (not before)
|
||||
to avoid a compilation error on Solaris 5.5.1 systems.
|
||||
Reported by Vin Shelton.
|
||||
|
||||
2000-10-23 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* Makefile.maint: Clean up version-related variables.
|
||||
|
||||
* Version 2.0.8.
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add .prev-version.
|
||||
|
||||
2000-10-22 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* tests/Makefile.am (SUBDIRS): Add sha1sum.
|
||||
* tests/sha1sum/basic-1: New file.
|
||||
* configure.in (AC_OUTPUT): Add tests/sha1sum/Makefile.
|
||||
|
||||
* src/Makefile.am (bin_PROGRAMS): Add sha1sum.
|
||||
(md5sum_SOURCES): Define.
|
||||
(sha1sum_SOURCES): Define.
|
||||
(noinst_HEADERS): Add checksum.h.
|
||||
|
||||
* src/md5sum.c: Factor out the differences between MD5 and SHA1,
|
||||
and parameterize so this code may be used by both md5sum and the new
|
||||
program, sha1sum. Loosely based on a patch from Scott Miller.
|
||||
* src/checksum.h: New file.
|
||||
* src/md5.c: New file that simply defines `algorithm'.
|
||||
* src/sha1sum.c: Likewise.
|
||||
|
||||
* man/Makefile.am (man_MANS): Add sha1sum.1.
|
||||
* man/sha1sum.x: New file.
|
||||
|
||||
Support 8-byte integers, assuming they're printable with e.g., %lld.
|
||||
* src/od.c: Add support for printing data as unsigned
|
||||
long long integers.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
The command, `yes ''|./cat -n' would stop printing after INT_MAX lines.
|
||||
* src/cat.c (cat): Never let `newlines' exceed 3.
|
||||
|
||||
2000-10-21 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
Prevent a counter buffer overrun when numbering lines and when
|
||||
processing 100 billion lines (or more) of input.
|
||||
* src/cat.c (LINE_COUNTER_BUF_LEN): Define to allow numbering as
|
||||
many as 10^18 - 1 lines (the old limit was 10^11 - 1, and could
|
||||
be exceeded without too much trouble). Use this symbol rather
|
||||
than hard-coding the constant everywhere.
|
||||
(next_line_num): Rather than overrunning for input with more lines,
|
||||
mark the line number by putting a `>' in the leftmost slot.
|
||||
Patch by Jan Nieuwenhuizen.
|
||||
|
||||
* src/sort.c (SORT_OUT_OF_ORDER): Define.
|
||||
(main): Use it instead of hard-coding the `1'.
|
||||
|
||||
2000-10-10 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/sort.c (main): Use EXIT_SUCCESS rather than 0.
|
||||
Fail when checking (-c) with more than one file argument,
|
||||
rather than simply ignoring the extra arguments.
|
||||
|
||||
2000-09-07 Jim Meyering <meyering@lucent.com>
|
||||
|
||||
* src/cut.c: Remove obsolete comment block.
|
||||
@@ -84,7 +339,7 @@
|
||||
|
||||
2000-08-06 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/sort.c (usage): Warn more succintly about the effects of
|
||||
* src/sort.c (usage): Warn more succinctly about the effects of
|
||||
the locale on sort order.
|
||||
|
||||
2000-08-06 Jim Meyering <meyering@lucent.com>
|
||||
@@ -2160,8 +2415,8 @@
|
||||
|
||||
1998-02-16 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* configure.in (jm_FUNC_LSTAT): Use it.
|
||||
(jm_FUNC_STAT): Use it.
|
||||
* configure.in (jm_FUNC_LSTAT): Use it.
|
||||
(jm_FUNC_STAT): Use it.
|
||||
* lib/Makefile.am (EXTRA_DIST): Add lstat.c and stat.c.
|
||||
|
||||
1998-02-06 Jim Meyering <meyering@eng.ascend.com>
|
||||
@@ -2190,8 +2445,8 @@
|
||||
|
||||
1998-01-30 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* configure.in (AC_LFS): Put before anything that can affect or use
|
||||
CPPFLAGS, LDFLAGS, or LIBS.
|
||||
* configure.in (AC_LFS): Put before anything that can affect or use
|
||||
CPPFLAGS, LDFLAGS, or LIBS.
|
||||
|
||||
1998-01-25 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
Changes in release 2.1
|
||||
[2.0h]
|
||||
[2.0.9]
|
||||
* od now prints valid addresses for offsets of 2^32 and larger, and allows
|
||||
the byte offset (-j) and byte count (-N) arguments to be 2^32 and larger.
|
||||
* tail now works with line and byte counts of 2^32 and larger, on systems
|
||||
with large file support
|
||||
* join now works with an 8-bit delimiter
|
||||
* fix a compilation failure on some Solaris systems with wc.c
|
||||
[2.0.8]
|
||||
* od now supports 8-byte integers, assuming they're printable with e.g., %lld
|
||||
* new program: sha1sum
|
||||
* wc accepts new -m option: count (potentially multi-byte) characters
|
||||
* wc's `--chars' option is now equivalent to -m, not --bytes as it used to be
|
||||
* `cat -n' works properly when processing 2^31 or more lines
|
||||
[2.0g]
|
||||
* sort's --help output now warns that it is locale-aware
|
||||
* tail: fix a buffer underrun error that occurred on an empty pipe,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Makefile for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
||||
# -*- Makefile -*- for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995, 1996, 1997, 2000 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
@@ -176,7 +176,6 @@ uninstall:
|
||||
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
done
|
||||
rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
|
||||
|
||||
check: all
|
||||
|
||||
@@ -202,8 +201,7 @@ distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist distdir: update-po $(DISTFILES)
|
||||
dists="$(DISTFILES)"; \
|
||||
for file in $$dists; do \
|
||||
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|
||||
|| cp -p $(srcdir)/$$file $(distdir); \
|
||||
cp -p $(srcdir)/$$file $(distdir); \
|
||||
done
|
||||
|
||||
update-po: Makefile
|
||||
@@ -246,3 +244,7 @@ Makefile: Makefile.in.in ../config.status POTFILES
|
||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
# Tell version 3.79 and up of GNU make to not build goals in this
|
||||
# directory in parallel.
|
||||
.NOTPARALLEL:
|
||||
|
||||
56
src/cat.c
56
src/cat.c
@@ -55,19 +55,26 @@ static char *infile;
|
||||
/* Descriptor on which input file is open. */
|
||||
static int input_desc;
|
||||
|
||||
/* Buffer for line numbers. */
|
||||
static char line_buf[13] =
|
||||
{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '0', '\t', '\0'};
|
||||
/* Buffer for line numbers.
|
||||
An 11 digit counter may overflow within an hour on a P2/466,
|
||||
an 18 digit counter needs about 1000y */
|
||||
#define LINE_COUNTER_BUF_LEN 20
|
||||
static char line_buf[LINE_COUNTER_BUF_LEN] =
|
||||
{
|
||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
|
||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '0',
|
||||
'\t', '\0'
|
||||
};
|
||||
|
||||
/* Position in `line_buf' where printing starts. This will not change
|
||||
unless the number of lines is larger than 999999. */
|
||||
static char *line_num_print = line_buf + 5;
|
||||
static char *line_num_print = line_buf + LINE_COUNTER_BUF_LEN - 8;
|
||||
|
||||
/* Position of the first digit in `line_buf'. */
|
||||
static char *line_num_start = line_buf + 10;
|
||||
static char *line_num_start = line_buf + LINE_COUNTER_BUF_LEN - 3;
|
||||
|
||||
/* Position of the last digit in `line_buf'. */
|
||||
static char *line_num_end = line_buf + 10;
|
||||
static char *line_num_end = line_buf + LINE_COUNTER_BUF_LEN - 3;
|
||||
|
||||
/* Preserves the `cat' function's local `newlines' between invocations. */
|
||||
static int newlines2 = 0;
|
||||
@@ -129,7 +136,10 @@ next_line_num (void)
|
||||
*endp-- = '0';
|
||||
}
|
||||
while (endp >= line_num_start);
|
||||
*--line_num_start = '1';
|
||||
if (line_num_start > line_buf)
|
||||
*--line_num_start = '1';
|
||||
else
|
||||
*line_buf = '>';
|
||||
if (line_num_start < line_num_print)
|
||||
line_num_print--;
|
||||
}
|
||||
@@ -340,13 +350,21 @@ cat (
|
||||
|
||||
if (++newlines > 0)
|
||||
{
|
||||
/* Are multiple adjacent empty lines to be substituted by
|
||||
single ditto (-s), and this was the second empty line? */
|
||||
|
||||
if (squeeze_empty_lines && newlines >= 2)
|
||||
if (newlines >= 2)
|
||||
{
|
||||
ch = *bpin++;
|
||||
continue;
|
||||
/* Limit this to 2 here. Otherwise, with lots of
|
||||
consecutive newlines, the counter could wrap
|
||||
around at INT_MAX. */
|
||||
newlines = 2;
|
||||
|
||||
/* Are multiple adjacent empty lines to be substituted
|
||||
by single ditto (-s), and this was the second empty
|
||||
line? */
|
||||
if (squeeze_empty_lines)
|
||||
{
|
||||
ch = *bpin++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Are line numbers to be written at empty lines (-n)? */
|
||||
@@ -775,8 +793,8 @@ main (int argc, char **argv)
|
||||
{
|
||||
inbuf = (unsigned char *) xmalloc (insize + 1);
|
||||
|
||||
/* Why are (OUTSIZE - 1 + INSIZE * 4 + 13) bytes allocated for
|
||||
the output buffer?
|
||||
/* Why are (OUTSIZE - 1 + INSIZE * 4 + LINE_COUNTER_BUF_LEN)
|
||||
bytes allocated for the output buffer?
|
||||
|
||||
A test whether output needs to be written is done when the input
|
||||
buffer empties or when a newline appears in the input. After
|
||||
@@ -788,10 +806,12 @@ main (int argc, char **argv)
|
||||
If the last character in the preceding block of input was a
|
||||
newline, a line number may be written (according to the given
|
||||
options) as the first thing in the output buffer. (Done after the
|
||||
new input is read, but before processing of the input begins.) A
|
||||
line number requires seldom more than 13 positions. */
|
||||
new input is read, but before processing of the input begins.)
|
||||
A line number requires seldom more than LINE_COUNTER_BUF_LEN
|
||||
positions. */
|
||||
|
||||
outbuf = (unsigned char *) xmalloc (outsize - 1 + insize * 4 + 13);
|
||||
outbuf = (unsigned char *) xmalloc (outsize - 1 + insize * 4
|
||||
+ LINE_COUNTER_BUF_LEN);
|
||||
|
||||
cat (inbuf, insize, outbuf, outsize, quote,
|
||||
output_tabs, numbers, numbers_at_empty_lines, mark_line_ends,
|
||||
|
||||
15
src/checksum.h
Normal file
15
src/checksum.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* For long options that have no equivalent short option, use a
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
{
|
||||
ALG_UNSPECIFIED = 0,
|
||||
ALG_MD5 = CHAR_MAX + 1,
|
||||
ALG_SHA1
|
||||
};
|
||||
|
||||
extern int algorithm;
|
||||
65
src/chmod.c
65
src/chmod.c
@@ -95,6 +95,31 @@ static struct option const long_options[] =
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static int
|
||||
mode_changed (const char *file, mode_t old_mode)
|
||||
{
|
||||
struct stat new_stats;
|
||||
|
||||
if (lstat (file, &new_stats))
|
||||
{
|
||||
if (force_silent == 0)
|
||||
error (0, errno, _("getting new attributes of %s"), quote (file));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef S_ISLNK
|
||||
if (S_ISLNK (new_stats.st_mode)
|
||||
&& stat (file, &new_stats))
|
||||
{
|
||||
if (force_silent == 0)
|
||||
error (0, errno, _("getting new attributes of %s"), quote (file));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return old_mode != new_stats.st_mode;
|
||||
}
|
||||
|
||||
/* Tell the user how/if the MODE of FILE has been changed.
|
||||
CHANGED describes what (if anything) has happened. */
|
||||
|
||||
@@ -137,6 +162,8 @@ change_file_mode (const char *file, const struct mode_change *changes,
|
||||
struct stat file_stats;
|
||||
mode_t newmode;
|
||||
int errors = 0;
|
||||
int fail;
|
||||
int saved_errno;
|
||||
|
||||
if (lstat (file, &file_stats))
|
||||
{
|
||||
@@ -161,24 +188,21 @@ change_file_mode (const char *file, const struct mode_change *changes,
|
||||
|
||||
newmode = mode_adjust (file_stats.st_mode, changes);
|
||||
|
||||
if (newmode != (file_stats.st_mode & CHMOD_MODE_BITS))
|
||||
fail = chmod (file, newmode);
|
||||
saved_errno = errno;
|
||||
|
||||
if (verbosity == V_high
|
||||
|| (verbosity == V_changes_only
|
||||
&& !fail && mode_changed (file, file_stats.st_mode)))
|
||||
describe_change (file, newmode, (fail ? CH_FAILED : CH_SUCCEEDED));
|
||||
|
||||
if (fail)
|
||||
{
|
||||
int fail = chmod (file, newmode);
|
||||
int saved_errno = errno;
|
||||
|
||||
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
|
||||
describe_change (file, newmode, (fail ? CH_FAILED : CH_SUCCEEDED));
|
||||
|
||||
if (fail)
|
||||
{
|
||||
if (force_silent == 0)
|
||||
error (0, saved_errno, _("changing permissions of %s"),
|
||||
quote (file));
|
||||
errors = 1;
|
||||
}
|
||||
if (force_silent == 0)
|
||||
error (0, saved_errno, _("changing permissions of %s"),
|
||||
quote (file));
|
||||
errors = 1;
|
||||
}
|
||||
else if (verbosity == V_high)
|
||||
describe_change (file, newmode, CH_NO_CHANGE_REQUESTED);
|
||||
|
||||
if (recurse && S_ISDIR (file_stats.st_mode))
|
||||
errors |= change_dir_mode (file, changes, &file_stats);
|
||||
@@ -313,7 +337,12 @@ main (int argc, char **argv)
|
||||
case '-':
|
||||
case '=':
|
||||
if (modeind != 0 && modeind != thisind)
|
||||
error (1, 0, _("invalid mode"));
|
||||
{
|
||||
static char char_string[2] = {0, 0};
|
||||
char_string[0] = c;
|
||||
error (1, 0, _("invalid character %s in mode string %s"),
|
||||
quote_n (0, char_string), quote_n (1, argv[thisind]));
|
||||
}
|
||||
modeind = thisind;
|
||||
break;
|
||||
case REFERENCE_FILE_OPTION:
|
||||
@@ -351,7 +380,7 @@ main (int argc, char **argv)
|
||||
: mode_compile (argv[modeind], MODE_MASK_ALL));
|
||||
|
||||
if (changes == MODE_INVALID)
|
||||
error (1, 0, _("invalid mode"));
|
||||
error (1, 0, _("invalid mode string: %s"), quote (argv[modeind]));
|
||||
else if (changes == MODE_MEMORY_EXHAUSTED)
|
||||
xalloc_die ();
|
||||
else if (changes == MODE_BAD_REFERENCE)
|
||||
|
||||
19
src/cp.c
19
src/cp.c
@@ -330,6 +330,8 @@ re_protect (const char *const_dst_path, int src_offset,
|
||||
Return 0 if parent of CONST_DIRPATH exists as a directory with the proper
|
||||
permissions when done, otherwise 1. */
|
||||
|
||||
/* FIXME: find a way to synch this function with the one in lib/makepath.c. */
|
||||
|
||||
static int
|
||||
make_path_private (const char *const_dirpath, int src_offset, int mode,
|
||||
const char *verbose_fmt_string, struct dir_attr **attr_list,
|
||||
@@ -516,13 +518,26 @@ do_copy (int n_files, char **file, const char *target_directory,
|
||||
char *arg_in_concat = NULL;
|
||||
char *arg = file[i];
|
||||
|
||||
/* Trailing slashes are meaningful (i.e., maybe worth preserving)
|
||||
only in the source file names. */
|
||||
if (remove_trailing_slashes)
|
||||
strip_trailing_slashes (arg);
|
||||
|
||||
if (flag_path)
|
||||
{
|
||||
/* Append all of `arg' to `dest'. */
|
||||
dst_path = path_concat (dest, arg, &arg_in_concat);
|
||||
char *arg_no_trailing_slash;
|
||||
|
||||
/* Use `arg' without trailing slashes in constructing destination
|
||||
file names. Otherwise, we can end up trying to create a
|
||||
directory via `mkdir ("dst/foo/"...', which is not portable.
|
||||
It fails, due to the trailing slash, on at least
|
||||
NetBSD 1.[34] systems. */
|
||||
ASSIGN_STRDUPA (arg_no_trailing_slash, arg);
|
||||
strip_trailing_slashes (arg_no_trailing_slash);
|
||||
|
||||
/* Append all of `arg' (minus any trailing slash) to `dest'. */
|
||||
dst_path = path_concat (dest, arg_no_trailing_slash,
|
||||
&arg_in_concat);
|
||||
if (dst_path == NULL)
|
||||
xalloc_die ();
|
||||
|
||||
|
||||
86
src/date.c
86
src/date.c
@@ -79,9 +79,6 @@ static int iso_8601_format = 0;
|
||||
/* If non-zero, display time in RFC-822 format for mail or news. */
|
||||
static int rfc_format = 0;
|
||||
|
||||
/* If nonzero, print or set Coordinated Universal Time. */
|
||||
static int universal_time = 0;
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"date", required_argument, NULL, 'd'},
|
||||
@@ -98,17 +95,12 @@ static struct option const long_options[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
#define TZ_UTC0 "TZ=UTC0"
|
||||
|
||||
#if LOCALTIME_CACHE
|
||||
# define TZSET tzset ()
|
||||
#else
|
||||
# define TZSET /* empty */
|
||||
#endif
|
||||
|
||||
#define MAYBE_SET_TZ_UTC0 \
|
||||
do { if (universal_time) set_tz (TZ_UTC0); } while (0)
|
||||
|
||||
#ifdef _DATE_FMT
|
||||
# define DATE_FMT_LANGINFO() nl_langinfo (_DATE_FMT)
|
||||
#else
|
||||
@@ -169,7 +161,7 @@ specifies Coordinated Universal Time. Interpreted sequences are:\n\
|
||||
%%n a newline\n\
|
||||
%%p locale's AM or PM\n\
|
||||
%%r time, 12-hour (hh:mm:ss [AP]M)\n\
|
||||
%%s seconds since 00:00:00, Jan 1, 1970 (a GNU extension)\n\
|
||||
%%s seconds since `00:00:00 1970-01-01 UTC' (a GNU extension)\n\
|
||||
%%S second (00..60)\n\
|
||||
%%t a horizontal tab\n\
|
||||
%%T time, 24-hour (hh:mm:ss)\n\
|
||||
@@ -195,16 +187,6 @@ the following modifiers between `%%' and a numeric directive.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
/* Set the TZ environment variable. */
|
||||
|
||||
static void
|
||||
set_tz (const char *tz_eq_zone)
|
||||
{
|
||||
if (putenv (tz_eq_zone) != 0)
|
||||
error (1, 0, "memory exhausted");
|
||||
TZSET;
|
||||
}
|
||||
|
||||
/* Parse each line in INPUT_FILENAME as with --date and display each
|
||||
resulting time and date. If the file cannot be opened, tell why
|
||||
then exit. Issue a diagnostic for any lines that cannot be parsed.
|
||||
@@ -219,7 +201,6 @@ batch_convert (const char *input_filename, const char *format)
|
||||
int line_length;
|
||||
size_t buflen;
|
||||
time_t when;
|
||||
char *initial_TZ IF_LINT (= NULL);
|
||||
|
||||
if (strcmp (input_filename, "-") == 0)
|
||||
{
|
||||
@@ -237,23 +218,6 @@ batch_convert (const char *input_filename, const char *format)
|
||||
|
||||
line = NULL;
|
||||
buflen = 0;
|
||||
|
||||
if (universal_time)
|
||||
{
|
||||
initial_TZ = getenv ("TZ");
|
||||
if (initial_TZ == NULL)
|
||||
{
|
||||
initial_TZ = xstrdup ("TZ=");
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t tz_len = strlen (initial_TZ);
|
||||
char *buf = xmalloc (3 + tz_len + 1);
|
||||
memcpy (mempcpy (buf, "TZ=", 3), initial_TZ, tz_len + 1);
|
||||
initial_TZ = buf;
|
||||
}
|
||||
}
|
||||
|
||||
status = 0;
|
||||
while (1)
|
||||
{
|
||||
@@ -264,13 +228,6 @@ batch_convert (const char *input_filename, const char *format)
|
||||
break;
|
||||
}
|
||||
|
||||
if (universal_time)
|
||||
{
|
||||
/* When given a universal time option, restore the initial
|
||||
value of TZ before parsing each string. */
|
||||
set_tz (initial_TZ);
|
||||
}
|
||||
|
||||
when = get_date (line, NULL);
|
||||
|
||||
if (when == -1)
|
||||
@@ -282,14 +239,10 @@ batch_convert (const char *input_filename, const char *format)
|
||||
}
|
||||
else
|
||||
{
|
||||
MAYBE_SET_TZ_UTC0;
|
||||
show_date (format, when);
|
||||
}
|
||||
}
|
||||
|
||||
if (universal_time)
|
||||
free (initial_TZ);
|
||||
|
||||
if (fclose (in_stream) == EOF)
|
||||
error (2, errno, "`%s'", input_filename);
|
||||
|
||||
@@ -352,7 +305,12 @@ main (int argc, char **argv)
|
||||
set_date = 1;
|
||||
break;
|
||||
case 'u':
|
||||
universal_time = 1;
|
||||
/* POSIX.2 says that `date -u' is equivalent to setting the TZ
|
||||
environment variable, so this option should do nothing other
|
||||
than setting TZ. */
|
||||
if (putenv ("TZ=UTC0") != 0)
|
||||
xalloc_die ();
|
||||
TZSET;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
@@ -460,10 +418,6 @@ argument must be a format string beginning with `+'."),
|
||||
}
|
||||
}
|
||||
|
||||
/* When given a universal time option, set TZ to UTC0 after
|
||||
parsing the specified date, but before printing it. */
|
||||
MAYBE_SET_TZ_UTC0;
|
||||
|
||||
show_date (format, when);
|
||||
}
|
||||
|
||||
@@ -480,14 +434,13 @@ show_date (const char *format, time_t when)
|
||||
struct tm *tm;
|
||||
char *out = NULL;
|
||||
size_t out_length = 0;
|
||||
/* ISO 8601 formats, in local and UTC. See below regarding %z */
|
||||
static char *iso_format_string[5][2] =
|
||||
/* ISO 8601 formats. See below regarding %z */
|
||||
static char const * const iso_format_string[] =
|
||||
{
|
||||
{"", ""},
|
||||
{"%Y-%m-%d", "%Y-%m-%d"},
|
||||
{"%Y-%m-%dT%H%z", "%Y-%m-%dT%HZ"},
|
||||
{"%Y-%m-%dT%H:%M%z", "%Y-%m-%dT%H:%MZ"},
|
||||
{"%Y-%m-%dT%H:%M:%S%z", "%Y-%m-%dT%H:%M:%SZ"}
|
||||
"%Y-%m-%d",
|
||||
"%Y-%m-%dT%H%z",
|
||||
"%Y-%m-%dT%H:%M%z",
|
||||
"%Y-%m-%dT%H:%M:%S%z"
|
||||
};
|
||||
|
||||
tm = localtime (&when);
|
||||
@@ -502,14 +455,19 @@ show_date (const char *format, time_t when)
|
||||
RFC time format outside the continental United States and GMT. */
|
||||
|
||||
if (rfc_format)
|
||||
format = (universal_time
|
||||
? "%a, %_d %b %Y %H:%M:%S GMT"
|
||||
: "%a, %_d %b %Y %H:%M:%S %z");
|
||||
format = "%a, %_d %b %Y %H:%M:%S %z";
|
||||
else if (iso_8601_format)
|
||||
format = iso_format_string[iso_8601_format][universal_time];
|
||||
format = iso_format_string[iso_8601_format - 1];
|
||||
else
|
||||
{
|
||||
char *date_fmt = DATE_FMT_LANGINFO ();
|
||||
/* Do not wrap the following literal format string with _(...).
|
||||
For example, suppose LC_ALL is unset, LC_TIME="POSIX",
|
||||
and LANG="ko_KR". In that case, POSIX.2 says that LC_TIME
|
||||
determines the format and contents of date and time strings
|
||||
written by date, which means "date" must generate output
|
||||
using the POSIX locale; but adding _() would cause "date"
|
||||
to use a Korean translation of the format. */
|
||||
format = *date_fmt ? date_fmt : "%a %b %e %H:%M:%S %Z %Y";
|
||||
}
|
||||
}
|
||||
|
||||
79
src/dd.c
79
src/dd.c
@@ -48,6 +48,10 @@
|
||||
# define SIGINFO SIGUSR1
|
||||
#endif
|
||||
|
||||
#ifndef S_TYPEISSHM
|
||||
# define S_TYPEISSHM(Mode) 0
|
||||
#endif
|
||||
|
||||
#define ROUND_UP_OFFSET(X, M) ((M) - 1 - (((X) + (M) - 1) % (M)))
|
||||
#define PTR_ALIGN(Ptr, M) ((Ptr) \
|
||||
+ ROUND_UP_OFFSET ((char *)(Ptr) - (char *)0, (M)))
|
||||
@@ -100,7 +104,7 @@ static size_t conversion_blocksize = 0;
|
||||
static uintmax_t skip_records = 0;
|
||||
|
||||
/* Skip this many records of `output_blocksize' bytes before output. */
|
||||
static uintmax_t seek_record = 0;
|
||||
static uintmax_t seek_records = 0;
|
||||
|
||||
/* Copy only this many records. The default is effectively infinity. */
|
||||
static uintmax_t max_records = (uintmax_t) -1;
|
||||
@@ -298,7 +302,7 @@ Copy a file, converting and formatting according to the options.\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
BYTES may be followed by the following multiplicative suffixes:\n\
|
||||
BLOCKS and BYTES may be followed by the following multiplicative suffixes:\n\
|
||||
xM M, c 1, w 2, b 512, kD 1000, k 1024, MD 1,000,000, M 1,048,576,\n\
|
||||
GD 1,000,000,000, G 1,073,741,824, and so on for T, P, E, Z, Y.\n\
|
||||
Each KEYWORD may be:\n\
|
||||
@@ -583,7 +587,7 @@ scanargs (int argc, char **argv)
|
||||
else if (STREQ (name, "skip"))
|
||||
skip_records = n;
|
||||
else if (STREQ (name, "seek"))
|
||||
seek_record = n;
|
||||
seek_records = n;
|
||||
else if (STREQ (name, "count"))
|
||||
max_records = n;
|
||||
else
|
||||
@@ -734,7 +738,7 @@ buggy_lseek_support (int fdesc)
|
||||
on some special files but doesn't return an error, either.
|
||||
In particular, the Linux tape drivers are a problem.
|
||||
For example, when I did the following using dd-4.0y or earlier on a
|
||||
Linux-2.2.17 system with a Exabyte SCSI tape drive:
|
||||
Linux-2.2.17 system with an Exabyte SCSI tape drive:
|
||||
|
||||
dev=/dev/nst0
|
||||
reset='mt -f $dev rewind; mt -f $dev fsf 1'
|
||||
@@ -758,22 +762,20 @@ static void
|
||||
skip (int fdesc, char *file, uintmax_t records, size_t blocksize,
|
||||
unsigned char *buf)
|
||||
{
|
||||
off_t o;
|
||||
off_t offset = records * blocksize;
|
||||
|
||||
/* Try lseek and if an error indicates it was an inappropriate
|
||||
operation, fall back on using read. Some broken versions of
|
||||
lseek may return zero, so count that as an error too as a valid
|
||||
zero return is not possible here. */
|
||||
o = records * blocksize;
|
||||
if (o / blocksize != records
|
||||
|| buggy_lseek_support (fdesc)
|
||||
|| lseek (fdesc, o, SEEK_CUR) <= 0)
|
||||
{
|
||||
while (records-- > 0)
|
||||
{
|
||||
int nread;
|
||||
|
||||
nread = safe_read (fdesc, buf, blocksize);
|
||||
if (offset / blocksize != records
|
||||
|| buggy_lseek_support (fdesc)
|
||||
|| lseek (fdesc, offset, SEEK_CUR) <= 0)
|
||||
{
|
||||
while (records--)
|
||||
{
|
||||
ssize_t nread = safe_read (fdesc, buf, blocksize);
|
||||
if (nread < 0)
|
||||
{
|
||||
error (0, errno, _("reading %s"), quote (file));
|
||||
@@ -791,10 +793,10 @@ skip (int fdesc, char *file, uintmax_t records, size_t blocksize,
|
||||
/* Copy NREAD bytes of BUF, with no conversions. */
|
||||
|
||||
static void
|
||||
copy_simple (unsigned char *buf, int nread)
|
||||
copy_simple (unsigned char const *buf, int nread)
|
||||
{
|
||||
int nfree; /* Number of unused bytes in `obuf'. */
|
||||
unsigned char *start = buf; /* First uncopied char in BUF. */
|
||||
const unsigned char *start = buf; /* First uncopied char in BUF. */
|
||||
|
||||
do
|
||||
{
|
||||
@@ -818,7 +820,7 @@ copy_simple (unsigned char *buf, int nread)
|
||||
replacing the newline with trailing spaces). */
|
||||
|
||||
static void
|
||||
copy_with_block (unsigned char *buf, size_t nread)
|
||||
copy_with_block (unsigned char const *buf, size_t nread)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -850,7 +852,7 @@ copy_with_block (unsigned char *buf, size_t nread)
|
||||
with a newline). */
|
||||
|
||||
static void
|
||||
copy_with_unblock (unsigned char *buf, size_t nread)
|
||||
copy_with_unblock (unsigned char const *buf, size_t nread)
|
||||
{
|
||||
size_t i;
|
||||
unsigned char c;
|
||||
@@ -890,7 +892,7 @@ dd_copy (void)
|
||||
unsigned char *ibuf, *bufstart; /* Input buffer. */
|
||||
unsigned char *real_buf; /* real buffer address before alignment */
|
||||
unsigned char *real_obuf;
|
||||
int nread; /* Bytes read in the current block. */
|
||||
ssize_t nread; /* Bytes read in the current block. */
|
||||
int exit_status = 0;
|
||||
size_t page_size = getpagesize ();
|
||||
size_t n_bytes_read;
|
||||
@@ -935,7 +937,7 @@ dd_copy (void)
|
||||
if (skip_records != 0)
|
||||
skip (STDIN_FILENO, input_file, skip_records, input_blocksize, ibuf);
|
||||
|
||||
if (seek_record != 0)
|
||||
if (seek_records != 0)
|
||||
{
|
||||
/* FIXME: this loses for
|
||||
% ./dd if=dd seek=1 |:
|
||||
@@ -944,8 +946,7 @@ dd_copy (void)
|
||||
0+0 records out
|
||||
*/
|
||||
|
||||
skip (STDOUT_FILENO, output_file, seek_record, output_blocksize,
|
||||
obuf);
|
||||
skip (STDOUT_FILENO, output_file, seek_records, output_blocksize, obuf);
|
||||
}
|
||||
|
||||
if (max_records == 0)
|
||||
@@ -990,7 +991,7 @@ dd_copy (void)
|
||||
}
|
||||
}
|
||||
|
||||
n_bytes_read = (size_t) nread;
|
||||
n_bytes_read = nread;
|
||||
|
||||
if (n_bytes_read < input_blocksize)
|
||||
{
|
||||
@@ -1138,27 +1139,41 @@ main (int argc, char **argv)
|
||||
mode_t perms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
||||
int opts
|
||||
= (O_CREAT
|
||||
| (seek_record || (conversions_mask & C_NOTRUNC) ? 0 : O_TRUNC));
|
||||
| (seek_records || (conversions_mask & C_NOTRUNC) ? 0 : O_TRUNC));
|
||||
|
||||
/* Open the output file with *read* access only if we might
|
||||
need to read to satisfy a `seek=' request. If we can't read
|
||||
the file, go ahead with write-only access; it might work. */
|
||||
if ((! seek_record
|
||||
if ((! seek_records
|
||||
|| open_fd (STDOUT_FILENO, output_file, O_RDWR | opts, perms) < 0)
|
||||
&& open_fd (STDOUT_FILENO, output_file, O_WRONLY | opts, perms) < 0)
|
||||
error (1, errno, _("opening %s"), quote (output_file));
|
||||
|
||||
#if HAVE_FTRUNCATE
|
||||
if (seek_record != 0 && !(conversions_mask & C_NOTRUNC))
|
||||
if (seek_records != 0 && !(conversions_mask & C_NOTRUNC))
|
||||
{
|
||||
off_t o = seek_record * output_blocksize;
|
||||
if (o / output_blocksize != seek_record)
|
||||
struct stat stdout_stat;
|
||||
off_t o = seek_records * output_blocksize;
|
||||
if (o / output_blocksize != seek_records)
|
||||
error (1, 0, _("file offset out of range"));
|
||||
if (ftruncate (STDOUT_FILENO, o) < 0)
|
||||
|
||||
if (fstat (STDOUT_FILENO, &stdout_stat) != 0)
|
||||
error (1, errno, _("cannot fstat %s"), quote (output_file));
|
||||
|
||||
/* Complain only when ftruncate fails on a regular file, a
|
||||
directory, or a shared memory object, as the 2000-08
|
||||
POSIX draft specifies ftruncate's behavior only for these
|
||||
file types. For example, do not complain when Linux 2.4
|
||||
ftruncate fails on /dev/fd0. */
|
||||
if (ftruncate (STDOUT_FILENO, o) != 0
|
||||
&& (S_ISREG (stdout_stat.st_mode)
|
||||
|| S_ISDIR (stdout_stat.st_mode)
|
||||
|| S_TYPEISSHM (stdout_stat.st_mode)))
|
||||
{
|
||||
char buf[LONGEST_HUMAN_READABLE + 1];
|
||||
error (1, errno, _("advancing past %s blocks in output file %s"),
|
||||
human_readable (seek_record, buf, 1, 1),
|
||||
quote (output_file));
|
||||
error (1, errno, _("advancing past %s bytes in output file %s"),
|
||||
human_readable (o, buf, 1, 1),
|
||||
quote (output_file));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
18
src/df.c
18
src/df.c
@@ -149,19 +149,19 @@ static struct option const long_options[] =
|
||||
static void
|
||||
print_header (void)
|
||||
{
|
||||
printf ("Filesystem ");
|
||||
printf (_("Filesystem "));
|
||||
|
||||
if (print_type)
|
||||
printf (" Type");
|
||||
printf (_(" Type"));
|
||||
else
|
||||
printf (" ");
|
||||
|
||||
if (inode_format)
|
||||
printf (" Inodes IUsed IFree IUse%%");
|
||||
printf (_(" Inodes IUsed IFree IUse%%"));
|
||||
else if (output_block_size < 0)
|
||||
printf (" Size Used Avail Use%%");
|
||||
printf (_(" Size Used Avail Use%%"));
|
||||
else if (posix_format)
|
||||
printf (" %4d-blocks Used Available Capacity", output_block_size);
|
||||
printf (_(" %4d-blocks Used Available Capacity"), output_block_size);
|
||||
else
|
||||
{
|
||||
char buf[LONGEST_HUMAN_READABLE + 1];
|
||||
@@ -172,10 +172,10 @@ print_header (void)
|
||||
if (3 <= plen && strncmp (p + plen - 3, ".0", 2) == 0)
|
||||
strcpy (p + plen - 3, p + plen - 1);
|
||||
|
||||
printf (" %4s-blocks Used Available Use%%", p);
|
||||
printf (_(" %4s-blocks Used Available Use%%"), p);
|
||||
}
|
||||
|
||||
printf (" Mounted on\n");
|
||||
printf (_(" Mounted on\n"));
|
||||
}
|
||||
|
||||
/* If FSTYPE is a type of filesystem that should be listed,
|
||||
@@ -612,7 +612,9 @@ show_point (const char *point, const struct stat *statp)
|
||||
}
|
||||
}
|
||||
|
||||
if (best_match && !STREQ (best_match->me_type, "lofs"))
|
||||
if (best_match && !STREQ (best_match->me_type, "lofs")
|
||||
&& stat (best_match->me_mountdir, &disk_stats) == 0
|
||||
&& disk_stats.st_dev == statp->st_dev)
|
||||
{
|
||||
me = best_match;
|
||||
goto show_me;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "system.h"
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
#include "dirname.h"
|
||||
#include "closeout.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
@@ -64,8 +65,8 @@ output `.' (meaning the current directory).\n\
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
register char *path;
|
||||
register char *slash;
|
||||
const char *result;
|
||||
size_t len;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
@@ -91,20 +92,9 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
path = argv[1];
|
||||
strip_trailing_slashes (path);
|
||||
|
||||
slash = strrchr (path, '/');
|
||||
if (slash == NULL)
|
||||
path = (char *) ".";
|
||||
else
|
||||
{
|
||||
/* Remove any trailing slashes and final element. */
|
||||
while (slash > path && *slash == '/')
|
||||
--slash;
|
||||
slash[1] = 0;
|
||||
}
|
||||
puts (path);
|
||||
len = dir_name_r (argv[1], &result);
|
||||
fwrite (result, 1, len, stdout);
|
||||
putchar ('\n');
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
9
src/du.c
9
src/du.c
@@ -520,6 +520,8 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
|
||||
|
||||
dir_dev = stat_buf.st_dev;
|
||||
|
||||
/* Return `0' here, not SIZE, since the SIZE bytes
|
||||
would reside in the new filesystem. */
|
||||
if (opt_one_file_system && !top && last_dev != dir_dev)
|
||||
return 0; /* Don't enter a new file system. */
|
||||
|
||||
@@ -553,7 +555,9 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
|
||||
if (cwd)
|
||||
free_cwd (cwd);
|
||||
exit_status = 1;
|
||||
return 0;
|
||||
/* Do return SIZE, here, since even though we can't chdir into ENT,
|
||||
we *can* count the blocks used by its directory entry. */
|
||||
return opt_separate_dirs ? 0 : size;
|
||||
}
|
||||
|
||||
name_space = savedir (".", stat_buf.st_size);
|
||||
@@ -562,7 +566,8 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
|
||||
error (0, errno, "%s", quote (path->text));
|
||||
pop_dir (cwd, path->text);
|
||||
exit_status = 1;
|
||||
return 0;
|
||||
/* Do count the SIZE bytes. */
|
||||
return opt_separate_dirs ? 0 : size;
|
||||
}
|
||||
|
||||
/* Remember the current path. */
|
||||
|
||||
29
src/id.c
29
src/id.c
@@ -54,21 +54,9 @@ static void print_full_info PARAMS ((const char *username));
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* If nonzero, output only the group ID(s). -g */
|
||||
static int just_group = 0;
|
||||
|
||||
/* If nonzero, output user/group name instead of ID number. -n */
|
||||
static int use_name = 0;
|
||||
|
||||
/* If nonzero, output real UID/GID instead of default effective UID/GID. -r */
|
||||
static int use_real = 0;
|
||||
|
||||
/* If nonzero, output only the user ID(s). -u */
|
||||
static int just_user = 0;
|
||||
|
||||
/* If nonzero, output only the supplementary groups. -G */
|
||||
static int just_group_list = 0;
|
||||
|
||||
/* The real and effective IDs of the user to print. */
|
||||
static uid_t ruid, euid;
|
||||
static gid_t rgid, egid;
|
||||
@@ -101,11 +89,11 @@ usage (int status)
|
||||
Print information for USERNAME, or the current user.\n\
|
||||
\n\
|
||||
-a ignore, for compatibility with other versions\n\
|
||||
-g, --group print only the group ID\n\
|
||||
-G, --groups print only the supplementary groups\n\
|
||||
-g, --group print only the effective group ID\n\
|
||||
-G, --groups print all group IDs\n\
|
||||
-n, --name print a name instead of a number, for -ugG\n\
|
||||
-r, --real print the real ID instead of effective ID, for -ugG\n\
|
||||
-u, --user print only the user ID\n\
|
||||
-r, --real print the real ID instead of the effective ID, with -ugG\n\
|
||||
-u, --user print only the effective user ID\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
@@ -121,6 +109,15 @@ main (int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
|
||||
/* If nonzero, output the list of all group IDs. -G */
|
||||
int just_group_list = 0;
|
||||
/* If nonzero, output only the group ID(s). -g */
|
||||
int just_group = 0;
|
||||
/* If nonzero, output real UID/GID instead of default effective UID/GID. -r */
|
||||
int use_real = 0;
|
||||
/* If nonzero, output only the user ID(s). -u */
|
||||
int just_user = 0;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
|
||||
@@ -15,50 +15,7 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Copy files and set their permission modes and, if possible,
|
||||
their owner and group. Used similarly to `cp'; typically
|
||||
used in Makefiles to copy programs into their destination
|
||||
directories. It can also be used to create the destination
|
||||
directories and any leading directories, and to set the final
|
||||
directory's modes. It refuses to copy files onto themselves.
|
||||
|
||||
Options:
|
||||
-g, --group=GROUP
|
||||
Set the group ownership of the installed file or directory
|
||||
to the group ID of GROUP (default is process's current
|
||||
group). GROUP may also be a numeric group ID.
|
||||
|
||||
-m, --mode=MODE
|
||||
Set the permission mode for the installed file or directory
|
||||
to MODE, which is an octal number (default is u=rwx,g=rx,o=rx).
|
||||
|
||||
-o, --owner=OWNER
|
||||
If run as root, set the ownership of the installed file to
|
||||
the user ID of OWNER (default is root). OWNER may also be
|
||||
a numeric user ID.
|
||||
|
||||
-c No effect. For compatibility with old Unix versions of install.
|
||||
|
||||
-s, --strip
|
||||
Strip the symbol tables from installed files.
|
||||
|
||||
-p, --preserve-timestamps
|
||||
Retain creation and modification timestamps when installing files.
|
||||
|
||||
-d, --directory
|
||||
Create a directory and its leading directories, if they
|
||||
do not already exist. Set the owner, group and mode
|
||||
as given on the command line. Any leading directories
|
||||
that are created are also given those attributes.
|
||||
This is different from the SunOS 4.0 install, which gives
|
||||
directories that it creates the default attributes.
|
||||
|
||||
-D
|
||||
Like the -d option, but a file is installed, along with the directory.
|
||||
Useful when installing into a new directory, and the install
|
||||
process doesn't properly comprehend making directories.
|
||||
|
||||
David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
|
||||
#ifdef _AIX
|
||||
#pragma alloca
|
||||
@@ -226,7 +183,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
int errors = 0;
|
||||
const char *symbolic_mode = NULL;
|
||||
const char *specified_mode = NULL;
|
||||
int make_backups = 0;
|
||||
char *backup_suffix_string;
|
||||
char *version_control_string = NULL;
|
||||
@@ -292,7 +249,7 @@ main (int argc, char **argv)
|
||||
group_name = optarg;
|
||||
break;
|
||||
case 'm':
|
||||
symbolic_mode = optarg;
|
||||
specified_mode = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
owner_name = optarg;
|
||||
@@ -328,11 +285,11 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
if (symbolic_mode)
|
||||
if (specified_mode)
|
||||
{
|
||||
struct mode_change *change = mode_compile (symbolic_mode, 0);
|
||||
struct mode_change *change = mode_compile (specified_mode, 0);
|
||||
if (change == MODE_INVALID)
|
||||
error (1, 0, _("invalid mode %s"), quote (symbolic_mode));
|
||||
error (1, 0, _("invalid mode %s"), quote (specified_mode));
|
||||
else if (change == MODE_MEMORY_EXHAUSTED)
|
||||
xalloc_die ();
|
||||
mode = mode_adjust (0, change);
|
||||
|
||||
@@ -114,7 +114,7 @@ static struct outlist *outlist_end = &outlist_head;
|
||||
/* Tab character separating fields; if this is NUL fields are separated
|
||||
by any nonempty string of white space, otherwise by exactly one
|
||||
tab character. */
|
||||
static char tab;
|
||||
static unsigned char tab;
|
||||
|
||||
/* When using getopt_long_only, no long option can start with
|
||||
a character that is a short option. */
|
||||
|
||||
147
src/ls.c
147
src/ls.c
@@ -197,12 +197,26 @@ int rpl_lstat PARAMS((const char *, struct stat *));
|
||||
# define lstat(Name, Stat_buf) rpl_lstat(Name, Stat_buf)
|
||||
#endif
|
||||
|
||||
#if defined _DIRENT_HAVE_D_TYPE || defined DTTOIF
|
||||
# define HAVE_STRUCT_DIRENT_D_TYPE 1
|
||||
# define DT_INIT(Val) = Val
|
||||
#else
|
||||
# define HAVE_STRUCT_DIRENT_D_TYPE 0
|
||||
# define DT_INIT(Val) /* empty */
|
||||
#endif
|
||||
|
||||
enum filetype
|
||||
{
|
||||
symbolic_link,
|
||||
directory,
|
||||
arg_directory, /* Directory given as command line arg. */
|
||||
normal /* All others. */
|
||||
unknown DT_INIT (DT_UNKNOWN),
|
||||
fifo DT_INIT (DT_FIFO),
|
||||
chardev DT_INIT (DT_CHR),
|
||||
directory DT_INIT (DT_DIR),
|
||||
blockdev DT_INIT (DT_BLK),
|
||||
normal DT_INIT (DT_REG),
|
||||
symbolic_link DT_INIT (DT_LNK),
|
||||
sock DT_INIT (DT_SOCK),
|
||||
arg_directory DT_INIT (2 * (DT_UNKNOWN | DT_FIFO | DT_CHR | DT_DIR | DT_BLK
|
||||
| DT_REG | DT_LNK | DT_SOCK))
|
||||
};
|
||||
|
||||
struct fileinfo
|
||||
@@ -290,8 +304,8 @@ static int rev_cmp_version PARAMS ((const struct fileinfo *file2,
|
||||
const struct fileinfo *file1));
|
||||
static int decode_switches PARAMS ((int argc, char **argv));
|
||||
static int file_interesting PARAMS ((const struct dirent *next));
|
||||
static uintmax_t gobble_file PARAMS ((const char *name, int explicit_arg,
|
||||
const char *dirname));
|
||||
static uintmax_t gobble_file PARAMS ((const char *name, enum filetype type,
|
||||
int explicit_arg, const char *dirname));
|
||||
static void print_color_indicator PARAMS ((const char *name, unsigned int mode,
|
||||
int linkok));
|
||||
static void put_indicator PARAMS ((const struct bin_str *ind));
|
||||
@@ -629,10 +643,29 @@ static int line_length;
|
||||
|
||||
static int format_needs_stat;
|
||||
|
||||
/* Similar to `format_needs_stat', but set if only the file type is
|
||||
needed. */
|
||||
|
||||
static int format_needs_type;
|
||||
|
||||
/* The exit status to use if we don't get any fatal errors. */
|
||||
|
||||
static int exit_status;
|
||||
|
||||
/* For long options that have no equivalent short option, use a
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
{
|
||||
BLOCK_SIZE_OPTION = CHAR_MAX + 1,
|
||||
COLOR_OPTION,
|
||||
FORMAT_OPTION,
|
||||
INDICATOR_STYLE_OPTION,
|
||||
QUOTING_STYLE_OPTION,
|
||||
SHOW_CONTROL_CHARS_OPTION,
|
||||
SORT_OPTION,
|
||||
TIME_OPTION
|
||||
};
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"all", no_argument, 0, 'a'},
|
||||
@@ -655,19 +688,19 @@ static struct option const long_options[] =
|
||||
{"file-type", no_argument, 0, 'p'},
|
||||
{"si", no_argument, 0, 'H'},
|
||||
{"ignore", required_argument, 0, 'I'},
|
||||
{"indicator-style", required_argument, 0, 14},
|
||||
{"indicator-style", required_argument, 0, INDICATOR_STYLE_OPTION},
|
||||
{"dereference", no_argument, 0, 'L'},
|
||||
{"literal", no_argument, 0, 'N'},
|
||||
{"quote-name", no_argument, 0, 'Q'},
|
||||
{"quoting-style", required_argument, 0, 15},
|
||||
{"quoting-style", required_argument, 0, QUOTING_STYLE_OPTION},
|
||||
{"recursive", no_argument, 0, 'R'},
|
||||
{"format", required_argument, 0, 12},
|
||||
{"show-control-chars", no_argument, 0, 16},
|
||||
{"sort", required_argument, 0, 10},
|
||||
{"format", required_argument, 0, FORMAT_OPTION},
|
||||
{"show-control-chars", no_argument, 0, SHOW_CONTROL_CHARS_OPTION},
|
||||
{"sort", required_argument, 0, SORT_OPTION},
|
||||
{"tabsize", required_argument, 0, 'T'},
|
||||
{"time", required_argument, 0, 11},
|
||||
{"color", optional_argument, 0, 13},
|
||||
{"block-size", required_argument, 0, 17},
|
||||
{"time", required_argument, 0, TIME_OPTION},
|
||||
{"color", optional_argument, 0, COLOR_OPTION},
|
||||
{"block-size", required_argument, 0, BLOCK_SIZE_OPTION},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
@@ -845,8 +878,9 @@ main (int argc, char **argv)
|
||||
|
||||
format_needs_stat = sort_type == sort_time || sort_type == sort_size
|
||||
|| format == long_format
|
||||
|| trace_links || trace_dirs || indicator_style != none
|
||||
|| print_block_size || print_inode || print_with_color;
|
||||
|| trace_links || trace_dirs || print_block_size || print_inode;
|
||||
format_needs_type = (format_needs_stat == 0
|
||||
&& (print_with_color || indicator_style != none));
|
||||
|
||||
if (dired && format == long_format)
|
||||
{
|
||||
@@ -864,13 +898,13 @@ main (int argc, char **argv)
|
||||
dir_defaulted = 0;
|
||||
for (; i < argc; i++)
|
||||
{
|
||||
gobble_file (argv[i], 1, "");
|
||||
gobble_file (argv[i], unknown, 1, "");
|
||||
}
|
||||
|
||||
if (dir_defaulted)
|
||||
{
|
||||
if (immediate_dirs)
|
||||
gobble_file (".", 1, "");
|
||||
gobble_file (".", directory, 1, "");
|
||||
else
|
||||
queue_directory (".", 0);
|
||||
}
|
||||
@@ -1230,20 +1264,20 @@ decode_switches (int argc, char **argv)
|
||||
format = one_per_line;
|
||||
break;
|
||||
|
||||
case 10: /* --sort */
|
||||
case SORT_OPTION:
|
||||
sort_type = XARGMATCH ("--sort", optarg, sort_args, sort_types);
|
||||
sort_type_specified = 1;
|
||||
break;
|
||||
|
||||
case 11: /* --time */
|
||||
case TIME_OPTION:
|
||||
time_type = XARGMATCH ("--time", optarg, time_args, time_types);
|
||||
break;
|
||||
|
||||
case 12: /* --format */
|
||||
case FORMAT_OPTION:
|
||||
format = XARGMATCH ("--format", optarg, format_args, format_types);
|
||||
break;
|
||||
|
||||
case 13: /* --color */
|
||||
case COLOR_OPTION:
|
||||
if (optarg)
|
||||
i = XARGMATCH ("--color", optarg, color_args, color_types);
|
||||
else
|
||||
@@ -1264,24 +1298,24 @@ decode_switches (int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
|
||||
case 14: /* --indicator-style */
|
||||
case INDICATOR_STYLE_OPTION:
|
||||
indicator_style = XARGMATCH ("--indicator-style", optarg,
|
||||
indicator_style_args,
|
||||
indicator_style_types);
|
||||
break;
|
||||
|
||||
case 15: /* --quoting-style */
|
||||
case QUOTING_STYLE_OPTION:
|
||||
set_quoting_style (NULL,
|
||||
XARGMATCH ("--quoting-style", optarg,
|
||||
quoting_style_args,
|
||||
quoting_style_vals));
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case SHOW_CONTROL_CHARS_OPTION:
|
||||
qmark_funny_chars = 0;
|
||||
break;
|
||||
|
||||
case 17:
|
||||
case BLOCK_SIZE_OPTION:
|
||||
human_block_size (optarg, 1, &output_block_size);
|
||||
break;
|
||||
|
||||
@@ -1701,7 +1735,17 @@ print_dir (const char *name, const char *realname)
|
||||
|
||||
while ((next = readdir (reading)) != NULL)
|
||||
if (file_interesting (next))
|
||||
total_blocks += gobble_file (next->d_name, 0, name);
|
||||
{
|
||||
enum filetype type = unknown;
|
||||
|
||||
#if HAVE_STRUCT_DIRENT_D_TYPE
|
||||
if (next->d_type == DT_DIR || next->d_type == DT_CHR
|
||||
|| next->d_type == DT_BLK || next->d_type == DT_SOCK
|
||||
|| next->d_type == DT_FIFO)
|
||||
type = next->d_type;
|
||||
#endif
|
||||
total_blocks += gobble_file (next->d_name, type, 0, name);
|
||||
}
|
||||
|
||||
if (CLOSEDIR (reading))
|
||||
{
|
||||
@@ -1812,7 +1856,8 @@ clear_files (void)
|
||||
Return the number of blocks that the file occupies. */
|
||||
|
||||
static uintmax_t
|
||||
gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
gobble_file (const char *name, enum filetype type, int explicit_arg,
|
||||
const char *dirname)
|
||||
{
|
||||
register uintmax_t blocks;
|
||||
register int val;
|
||||
@@ -1829,7 +1874,8 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
files[files_index].linkmode = 0;
|
||||
files[files_index].linkok = 0;
|
||||
|
||||
if (explicit_arg || format_needs_stat)
|
||||
if (explicit_arg || format_needs_stat
|
||||
|| (format_needs_type && type == unknown))
|
||||
{
|
||||
/* `path' is the absolute pathname of this file. */
|
||||
|
||||
@@ -1841,23 +1887,9 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
attach (path, dirname, name);
|
||||
}
|
||||
|
||||
if (trace_links)
|
||||
{
|
||||
val = stat (path, &files[files_index].stat);
|
||||
if (val < 0)
|
||||
{
|
||||
/* Perhaps a symbolically-linked to file doesn't exist; stat
|
||||
the link instead. */
|
||||
val = lstat (path, &files[files_index].stat);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
val = lstat (path, &files[files_index].stat);
|
||||
#if USE_ACL
|
||||
files[files_index].have_acl = (acl (path, GETACLCNT, 0, NULL) > 4);
|
||||
#endif
|
||||
}
|
||||
val = (trace_links
|
||||
? stat (path, &files[files_index].stat)
|
||||
: lstat (path, &files[files_index].stat));
|
||||
|
||||
if (val < 0)
|
||||
{
|
||||
@@ -1866,6 +1898,12 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if USE_ACL
|
||||
files[files_index].have_acl =
|
||||
(! S_ISLNK (files[files_index].stat.st_mode)
|
||||
&& 4 < acl (path, GETACLCNT, 0, NULL));
|
||||
#endif
|
||||
|
||||
if (S_ISLNK (files[files_index].stat.st_mode)
|
||||
&& (explicit_arg || format == long_format || check_symlink_color))
|
||||
{
|
||||
@@ -1937,7 +1975,13 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
}
|
||||
}
|
||||
else
|
||||
blocks = 0;
|
||||
{
|
||||
files[files_index].filetype = type;
|
||||
#if HAVE_STRUCT_DIRENT_D_TYPE
|
||||
files[files_index].stat.st_mode = DTTOIF (type);
|
||||
#endif
|
||||
blocks = 0;
|
||||
}
|
||||
|
||||
files[files_index].name = xstrdup (name);
|
||||
files_index++;
|
||||
@@ -2332,7 +2376,7 @@ print_long_format (const struct fileinfo *f)
|
||||
|
||||
if (full_time)
|
||||
{
|
||||
fmt = "%a %b %d %H:%M:%S %Y";
|
||||
fmt = _("%a %b %d %H:%M:%S %Y");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2345,11 +2389,11 @@ print_long_format (const struct fileinfo *f)
|
||||
Allow a 1 hour slop factor for what is considered "the future",
|
||||
to allow for NFS server/client clock disagreement.
|
||||
Show the year instead of the time of day. */
|
||||
fmt = "%b %e %Y";
|
||||
fmt = _("%b %e %Y");
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt = "%b %e %H:%M";
|
||||
fmt = _("%b %e %H:%M");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2408,9 +2452,6 @@ print_long_format (const struct fileinfo *f)
|
||||
|
||||
p += strlen (p);
|
||||
|
||||
/* Use strftime rather than ctime, because the former can produce
|
||||
locale-dependent names for the weekday (%a) and month (%b). */
|
||||
|
||||
if ((when_local = localtime (&when)))
|
||||
{
|
||||
while (! (s = strftime (p, buf + bufsize - p - 1, fmt, when_local)))
|
||||
|
||||
7
src/md5.c
Normal file
7
src/md5.c
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "checksum.h"
|
||||
|
||||
int algorithm = ALG_MD5;
|
||||
144
src/md5sum.c
144
src/md5sum.c
@@ -1,5 +1,4 @@
|
||||
/* Compute MD5 checksum of files or strings according to the definition
|
||||
of MD5 in RFC 1321 from April 1992.
|
||||
/* Compute MD5 or SHA1 checksum of files or strings
|
||||
Copyright (C) 1995-2000 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -24,16 +23,19 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "md5.h"
|
||||
#include "getline.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "md5.h"
|
||||
#include "sha.h"
|
||||
#include "checksum.h"
|
||||
#include "getline.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "md5sum"
|
||||
#define PROGRAM_NAME (algorithm == ALG_MD5 ? "md5sum" : "shasum")
|
||||
|
||||
#define AUTHORS "Ulrich Drepper"
|
||||
#define AUTHORS "Ulrich Drepper and Scott Miller"
|
||||
|
||||
/* Most systems do not distinguish between external and internal
|
||||
text representations. */
|
||||
@@ -58,24 +60,44 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The minimum length of a valid digest line in a file produced
|
||||
by `md5sum FILE' and read by `md5sum --check'. This length does
|
||||
|
||||
#define DIGEST_TYPE_STRING(Alg) ((Alg) == ALG_MD5 ? "MD5" : "SHA1")
|
||||
#define DIGEST_STREAM(Alg) ((Alg) == ALG_MD5 ? md5_stream : sha_stream)
|
||||
|
||||
#define DIGEST_BITS(Alg) ((Alg) == ALG_MD5 ? 128 : 160)
|
||||
#define DIGEST_HEX_BYTES(Alg) (DIGEST_BITS (Alg) / 4)
|
||||
#define DIGEST_BIN_BYTES(Alg) (DIGEST_BITS (Alg) / 8)
|
||||
|
||||
#define MAX_DIGEST_BIN_BYTES MAX (DIGEST_BIN_BYTES (ALG_MD5), \
|
||||
DIGEST_BIN_BYTES (ALG_SHA1))
|
||||
|
||||
/* The minimum length of a valid digest line. This length does
|
||||
not include any newline character at the end of a line. */
|
||||
#define MIN_DIGEST_LINE_LENGTH (32 /* message digest length */ \
|
||||
+ 2 /* blank and binary indicator */ \
|
||||
+ 1 /* minimum filename length */ )
|
||||
#define MIN_DIGEST_LINE_LENGTH(Alg) \
|
||||
(DIGEST_HEX_BYTES (Alg) /* length of hexadecimal message digest */ \
|
||||
+ 2 /* blank and binary indicator */ \
|
||||
+ 1 /* minimum filename length */ )
|
||||
|
||||
/* Nonzero if any of the files read were the standard input. */
|
||||
static int have_read_stdin;
|
||||
|
||||
/* The minimum length of a valid checksum line for the selected algorithm. */
|
||||
static int min_digest_line_length;
|
||||
|
||||
/* Set to the length of a digest hex string for the selected algorithm. */
|
||||
static size_t digest_hex_bytes;
|
||||
|
||||
/* With --check, don't generate any output.
|
||||
The exit code indicates success or failure. */
|
||||
static int status_only = 0;
|
||||
|
||||
/* With --check, print a message to standard error warning about each
|
||||
improperly formatted MD5 checksum line. */
|
||||
improperly formatted checksum line. */
|
||||
static int warn = 0;
|
||||
|
||||
/* Declared and set via one of the wrapper .c files. */
|
||||
/* int algorithm = ALG_UNSPECIFIED; */
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
@@ -103,25 +125,30 @@ usage (int status)
|
||||
printf (_("\
|
||||
Usage: %s [OPTION] [FILE]...\n\
|
||||
or: %s [OPTION] --check [FILE]\n\
|
||||
Print or check MD5 checksums.\n\
|
||||
Print or check %s (%d-bit) checksums.\n\
|
||||
With no FILE, or when FILE is -, read standard input.\n\
|
||||
\n\
|
||||
-b, --binary read files in binary mode (default on DOS/Windows)\n\
|
||||
-c, --check check MD5 sums against given list\n\
|
||||
-c, --check check %s sums against given list\n\
|
||||
-t, --text read files in text mode (default)\n\
|
||||
\n\
|
||||
The following two options are useful only when verifying checksums:\n\
|
||||
--status don't output anything, status code shows success\n\
|
||||
-w, --warn warn about improperly formated MD5 checksum lines\n\
|
||||
-w, --warn warn about improperly formated checksum lines\n\
|
||||
\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
The sums are computed as described in RFC 1321. When checking, the input\n\
|
||||
The sums are computed as described in %s. When checking, the input\n\
|
||||
should be a former output of this program. The default mode is to print\n\
|
||||
a line with checksum, a character indicating type (`*' for binary, ` ' for\n\
|
||||
text), and name for each FILE.\n"),
|
||||
program_name, program_name);
|
||||
program_name, program_name,
|
||||
DIGEST_TYPE_STRING (algorithm),
|
||||
DIGEST_BITS (algorithm),
|
||||
DIGEST_TYPE_STRING (algorithm),
|
||||
(algorithm == ALG_MD5 ? "RFC 1321" : "FIPS-180-1")
|
||||
);
|
||||
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
|
||||
}
|
||||
|
||||
@@ -140,11 +167,11 @@ split_3 (char *s, size_t s_len, unsigned char **u, int *binary, char **w)
|
||||
while (ISWHITE (s[i]))
|
||||
++i;
|
||||
|
||||
/* The line must have at least 35 (36 if the first is a backslash)
|
||||
more characters to contain correct message digest information.
|
||||
Ignore this line if it is too short. */
|
||||
if (!(s_len - i >= MIN_DIGEST_LINE_LENGTH
|
||||
|| (s[i] == '\\' && s_len - i >= 1 + MIN_DIGEST_LINE_LENGTH)))
|
||||
/* The line must have at least `min_digest_line_length - 1' (or one more, if
|
||||
the first is a backslash) more characters to contain correct message digest
|
||||
information. Ignore this line if it is too short. */
|
||||
if (!(s_len - i >= min_digest_line_length
|
||||
|| (s[i] == '\\' && s_len - i >= 1 + min_digest_line_length)))
|
||||
return 1;
|
||||
|
||||
if (s[i] == '\\')
|
||||
@@ -154,10 +181,10 @@ split_3 (char *s, size_t s_len, unsigned char **u, int *binary, char **w)
|
||||
}
|
||||
*u = (unsigned char *) &s[i];
|
||||
|
||||
/* The first field has to be the 32-character hexadecimal
|
||||
/* The first field has to be the n-character hexadecimal
|
||||
representation of the message digest. If it is not followed
|
||||
immediately by a white space it's an error. */
|
||||
i += 32;
|
||||
i += digest_hex_bytes;
|
||||
if (!ISWHITE (s[i]))
|
||||
return 1;
|
||||
|
||||
@@ -230,12 +257,13 @@ hex_digits (unsigned char const *s)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* An interface to md5_stream. Operate on FILENAME (it may be "-") and
|
||||
put the result in *MD5_RESULT. Return non-zero upon failure, zero
|
||||
to indicate success. */
|
||||
/* An interface to the function, DIGEST_STREAM, (either md5_stream or sha_stream).
|
||||
Operate on FILENAME (it may be "-") and put the result in *BIN_RESULT.
|
||||
Return non-zero upon failure, zero to indicate success. */
|
||||
|
||||
static int
|
||||
md5_file (const char *filename, int binary, unsigned char *md5_result)
|
||||
digest_file (const char *filename, int binary, unsigned char *bin_result,
|
||||
int (*digest_stream)(FILE *, void *))
|
||||
{
|
||||
FILE *fp;
|
||||
int err;
|
||||
@@ -265,7 +293,7 @@ md5_file (const char *filename, int binary, unsigned char *md5_result)
|
||||
}
|
||||
}
|
||||
|
||||
err = md5_stream (fp, md5_result);
|
||||
err = (*digest_stream) (fp, bin_result);
|
||||
if (err)
|
||||
{
|
||||
error (0, errno, "%s", filename);
|
||||
@@ -284,13 +312,13 @@ md5_file (const char *filename, int binary, unsigned char *md5_result)
|
||||
}
|
||||
|
||||
static int
|
||||
md5_check (const char *checkfile_name)
|
||||
digest_check (const char *checkfile_name, int (*digest_stream)(FILE *, void *))
|
||||
{
|
||||
FILE *checkfile_stream;
|
||||
int n_properly_formated_lines = 0;
|
||||
int n_mismatched_checksums = 0;
|
||||
int n_open_or_read_failures = 0;
|
||||
unsigned char md5buffer[16];
|
||||
unsigned char bin_buffer[MAX_DIGEST_BIN_BYTES];
|
||||
size_t line_number;
|
||||
char *line;
|
||||
size_t line_chars_allocated;
|
||||
@@ -318,7 +346,7 @@ md5_check (const char *checkfile_name)
|
||||
{
|
||||
char *filename;
|
||||
int binary;
|
||||
unsigned char *md5num;
|
||||
unsigned char *hex_digest;
|
||||
int err;
|
||||
int line_length;
|
||||
|
||||
@@ -336,14 +364,15 @@ md5_check (const char *checkfile_name)
|
||||
if (line[line_length - 1] == '\n')
|
||||
line[--line_length] = '\0';
|
||||
|
||||
err = split_3 (line, line_length, &md5num, &binary, &filename);
|
||||
if (err || !hex_digits (md5num))
|
||||
err = split_3 (line, line_length, &hex_digest, &binary, &filename);
|
||||
if (err || !hex_digits (hex_digest))
|
||||
{
|
||||
if (warn)
|
||||
{
|
||||
error (0, 0,
|
||||
_("%s: %lu: improperly formatted MD5 checksum line"),
|
||||
checkfile_name, (unsigned long) line_number);
|
||||
_("%s: %lu: improperly formatted %s checksum line"),
|
||||
checkfile_name, (unsigned long) line_number,
|
||||
DIGEST_TYPE_STRING (algorithm));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -356,7 +385,7 @@ md5_check (const char *checkfile_name)
|
||||
|
||||
++n_properly_formated_lines;
|
||||
|
||||
fail = md5_file (filename, binary, md5buffer);
|
||||
fail = digest_file (filename, binary, bin_buffer, digest_stream);
|
||||
|
||||
if (fail)
|
||||
{
|
||||
@@ -369,23 +398,24 @@ md5_check (const char *checkfile_name)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t digest_bin_bytes = digest_hex_bytes / 2;
|
||||
size_t cnt;
|
||||
/* Compare generated binary number with text representation
|
||||
in check file. Ignore case of hex digits. */
|
||||
for (cnt = 0; cnt < 16; ++cnt)
|
||||
for (cnt = 0; cnt < digest_bin_bytes; ++cnt)
|
||||
{
|
||||
if (TOLOWER (md5num[2 * cnt]) != bin2hex[md5buffer[cnt] >> 4]
|
||||
|| (TOLOWER (md5num[2 * cnt + 1])
|
||||
!= (bin2hex[md5buffer[cnt] & 0xf])))
|
||||
if (TOLOWER (hex_digest[2 * cnt]) != bin2hex[bin_buffer[cnt] >> 4]
|
||||
|| (TOLOWER (hex_digest[2 * cnt + 1])
|
||||
!= (bin2hex[bin_buffer[cnt] & 0xf])))
|
||||
break;
|
||||
}
|
||||
if (cnt != 16)
|
||||
if (cnt != digest_bin_bytes)
|
||||
++n_mismatched_checksums;
|
||||
|
||||
if (!status_only)
|
||||
{
|
||||
printf ("%s: %s\n", filename,
|
||||
(cnt != 16 ? _("FAILED") : _("OK")));
|
||||
(cnt != digest_bin_bytes ? _("FAILED") : _("OK")));
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
@@ -411,8 +441,8 @@ md5_check (const char *checkfile_name)
|
||||
if (n_properly_formated_lines == 0)
|
||||
{
|
||||
/* Warn if no tests are found. */
|
||||
error (0, 0, _("%s: no properly formatted MD5 checksum lines found"),
|
||||
checkfile_name);
|
||||
error (0, 0, _("%s: no properly formatted %s checksum lines found"),
|
||||
checkfile_name, DIGEST_TYPE_STRING (algorithm));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -448,7 +478,7 @@ md5_check (const char *checkfile_name)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
unsigned char md5buffer[16];
|
||||
unsigned char bin_buffer[MAX_DIGEST_BIN_BYTES];
|
||||
int do_check = 0;
|
||||
int opt;
|
||||
char **string = NULL;
|
||||
@@ -513,6 +543,9 @@ main (int argc, char **argv)
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
min_digest_line_length = MIN_DIGEST_LINE_LENGTH (algorithm);
|
||||
digest_hex_bytes = DIGEST_HEX_BYTES (algorithm);
|
||||
|
||||
if (file_type_specified && do_check)
|
||||
{
|
||||
error (0, 0, _("the --binary and --text options are meaningless when \
|
||||
@@ -553,10 +586,13 @@ verifying checksums"));
|
||||
for (i = 0; i < n_strings; ++i)
|
||||
{
|
||||
size_t cnt;
|
||||
md5_buffer (string[i], strlen (string[i]), md5buffer);
|
||||
if (algorithm == ALG_MD5)
|
||||
md5_buffer (string[i], strlen (string[i]), bin_buffer);
|
||||
else
|
||||
sha_buffer (string[i], strlen (string[i]), bin_buffer);
|
||||
|
||||
for (cnt = 0; cnt < 16; ++cnt)
|
||||
printf ("%02x", md5buffer[cnt]);
|
||||
for (cnt = 0; cnt < (digest_hex_bytes / 2); ++cnt)
|
||||
printf ("%02x", bin_buffer[cnt]);
|
||||
|
||||
printf (" \"%s\"\n", string[i]);
|
||||
}
|
||||
@@ -570,7 +606,8 @@ verifying checksums"));
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
err = md5_check ((optind == argc) ? "-" : argv[optind]);
|
||||
err = digest_check ((optind == argc) ? "-" : argv[optind],
|
||||
DIGEST_STREAM (algorithm));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -582,7 +619,8 @@ verifying checksums"));
|
||||
int fail;
|
||||
char *file = argv[optind];
|
||||
|
||||
fail = md5_file (file, binary, md5buffer);
|
||||
fail = digest_file (file, binary, bin_buffer,
|
||||
DIGEST_STREAM (algorithm));
|
||||
err |= fail;
|
||||
if (!fail)
|
||||
{
|
||||
@@ -593,8 +631,8 @@ verifying checksums"));
|
||||
if (strchr (file, '\n') || strchr (file, '\\'))
|
||||
putchar ('\\');
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
printf ("%02x", md5buffer[i]);
|
||||
for (i = 0; i < (digest_hex_bytes / 2); ++i)
|
||||
printf ("%02x", bin_buffer[i]);
|
||||
|
||||
putchar (' ');
|
||||
if (binary)
|
||||
|
||||
76
src/mkdir.c
76
src/mkdir.c
@@ -23,6 +23,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "dirname.h"
|
||||
#include "error.h"
|
||||
#include "makepath.h"
|
||||
#include "modechange.h"
|
||||
@@ -33,6 +34,8 @@
|
||||
|
||||
#define AUTHORS "David MacKenzie"
|
||||
|
||||
void strip_trailing_slashes ();
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
@@ -77,7 +80,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
mode_t newmode;
|
||||
mode_t parent_mode;
|
||||
const char *symbolic_mode = NULL;
|
||||
const char *specified_mode = NULL;
|
||||
const char *verbose_fmt_string = NULL;
|
||||
int errors = 0;
|
||||
int optc;
|
||||
@@ -101,7 +104,7 @@ main (int argc, char **argv)
|
||||
create_parents = 1;
|
||||
break;
|
||||
case 'm':
|
||||
symbolic_mode = optarg;
|
||||
specified_mode = optarg;
|
||||
break;
|
||||
case 'v': /* --verbose */
|
||||
verbose_fmt_string = _("created directory %s");
|
||||
@@ -119,13 +122,19 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
newmode = S_IRWXUGO & ~ umask (0);
|
||||
parent_mode = S_IWUSR | S_IXUSR | newmode;
|
||||
if (symbolic_mode)
|
||||
newmode = S_IRWXUGO;
|
||||
{
|
||||
mode_t umask_value = umask (0);
|
||||
umask (umask_value); /* Restore the old value. */
|
||||
parent_mode = (newmode & (~ umask_value)) | S_IWUSR | S_IXUSR;
|
||||
}
|
||||
|
||||
if (specified_mode)
|
||||
{
|
||||
struct mode_change *change = mode_compile (symbolic_mode, 0);
|
||||
struct mode_change *change = mode_compile (specified_mode, 0);
|
||||
newmode &= ~ umask (0);
|
||||
if (change == MODE_INVALID)
|
||||
error (1, 0, _("invalid mode %s"), quote (symbolic_mode));
|
||||
error (1, 0, _("invalid mode %s"), quote (specified_mode));
|
||||
else if (change == MODE_MEMORY_EXHAUSTED)
|
||||
xalloc_die ();
|
||||
newmode = mode_adjust (newmode, change);
|
||||
@@ -134,33 +143,64 @@ main (int argc, char **argv)
|
||||
for (; optind < argc; ++optind)
|
||||
{
|
||||
int fail = 0;
|
||||
|
||||
/* Remove any trailing slashes. Not removing them would lead to calling
|
||||
`mkdir ("dir/", mode)' for e.g., the commands `mkdir dir/' and
|
||||
`mkdir -p dir/', and such a call fails on NetBSD systems when `dir'
|
||||
doesn't already exist. */
|
||||
strip_trailing_slashes (argv[optind]);
|
||||
|
||||
if (create_parents)
|
||||
{
|
||||
fail = make_path (argv[optind], newmode, parent_mode,
|
||||
char *parents = dir_name (argv[optind]);
|
||||
fail = make_path (parents, parent_mode, parent_mode,
|
||||
-1, -1, 1, verbose_fmt_string);
|
||||
free (parents);
|
||||
}
|
||||
else
|
||||
|
||||
if (fail == 0)
|
||||
{
|
||||
fail = mkdir (argv[optind], newmode);
|
||||
const char *dir = argv[optind];
|
||||
int dir_created;
|
||||
int t_errno;
|
||||
fail = make_dir (dir, dir, newmode, &dir_created);
|
||||
t_errno = errno;
|
||||
if (fail)
|
||||
error (0, errno, _("cannot create directory %s"),
|
||||
quote (argv[optind]));
|
||||
{
|
||||
/* make_dir already gave a diagnostic. */
|
||||
}
|
||||
else if (!create_parents && !dir_created && (t_errno = EEXIST))
|
||||
{
|
||||
/* make_dir `succeeds' when DIR already exists.
|
||||
In that case, mkdir must fail, unless --parents (-p)
|
||||
was specified. */
|
||||
error (0, t_errno, _("cannot create directory %s"),
|
||||
quote (dir));
|
||||
fail = 1;
|
||||
}
|
||||
else if (verbose_fmt_string)
|
||||
error (0, 0, verbose_fmt_string, quote (argv[optind]));
|
||||
error (0, 0, verbose_fmt_string, quote (dir));
|
||||
|
||||
/* mkdir(2) is required to honor only the file permission bits.
|
||||
In particular, it needn't do anything about `special' bits,
|
||||
so if any were set in newmode, apply them with chmod. */
|
||||
if (fail == 0 && (newmode & ~S_IRWXUGO))
|
||||
so if any were set in newmode, apply them with chmod.
|
||||
This extra step is necessary in some cases when the containing
|
||||
directory has a default ACL. */
|
||||
|
||||
/* Set the permissions only if this directory has just
|
||||
been created. */
|
||||
|
||||
if (fail == 0 && specified_mode && dir_created)
|
||||
{
|
||||
fail = chmod (argv[optind], newmode);
|
||||
fail = chmod (dir, newmode);
|
||||
if (fail)
|
||||
error (0, errno, _("cannot set permissions of directory %s"),
|
||||
quote (argv[optind]));
|
||||
quote (dir));
|
||||
}
|
||||
}
|
||||
|
||||
errors |= fail;
|
||||
if (fail)
|
||||
errors = 1;
|
||||
}
|
||||
|
||||
exit (errors);
|
||||
|
||||
43
src/mkfifo.c
43
src/mkfifo.c
@@ -15,12 +15,7 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Options:
|
||||
-m, --mode=mode Set the mode of created fifo's to MODE, which is
|
||||
symbolic as in chmod and uses the umask as a point of
|
||||
departure.
|
||||
|
||||
David MacKenzie <djm@ai.mit.edu> */
|
||||
/* David MacKenzie <djm@ai.mit.edu> */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
@@ -76,7 +71,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
mode_t newmode;
|
||||
struct mode_change *change;
|
||||
const char *symbolic_mode;
|
||||
const char *specified_mode;
|
||||
int errors = 0;
|
||||
int optc;
|
||||
|
||||
@@ -87,7 +82,7 @@ main (int argc, char **argv)
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
symbolic_mode = NULL;
|
||||
specified_mode = NULL;
|
||||
|
||||
#ifndef S_ISFIFO
|
||||
error (4, 0, _("fifo files not supported"));
|
||||
@@ -99,7 +94,7 @@ main (int argc, char **argv)
|
||||
case 0:
|
||||
break;
|
||||
case 'm':
|
||||
symbolic_mode = optarg;
|
||||
specified_mode = optarg;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
@@ -114,11 +109,11 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
newmode = ((S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
|
||||
& ~ umask (0));
|
||||
if (symbolic_mode)
|
||||
newmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
if (specified_mode)
|
||||
{
|
||||
change = mode_compile (symbolic_mode, 0);
|
||||
newmode &= ~ umask (0);
|
||||
change = mode_compile (specified_mode, 0);
|
||||
if (change == MODE_INVALID)
|
||||
error (1, 0, _("invalid mode"));
|
||||
else if (change == MODE_MEMORY_EXHAUSTED)
|
||||
@@ -128,11 +123,23 @@ main (int argc, char **argv)
|
||||
|
||||
for (; optind < argc; ++optind)
|
||||
{
|
||||
if (mkfifo (argv[optind], newmode))
|
||||
{
|
||||
error (0, errno, _("cannot make fifo %s"), quote (argv[optind]));
|
||||
errors = 1;
|
||||
}
|
||||
int fail = mkfifo (argv[optind], newmode);
|
||||
if (fail)
|
||||
error (0, errno, _("cannot create fifo `%s'"), quote (argv[optind]));
|
||||
|
||||
/* If the containing directory happens to have a default ACL, chmod
|
||||
ensures the file mode permission bits are still set as desired. */
|
||||
|
||||
if (fail == 0 && specified_mode)
|
||||
{
|
||||
fail = chmod (argv[optind], newmode);
|
||||
if (fail)
|
||||
error (0, errno, _("cannot set permissions of fifo `%s'"),
|
||||
quote (argv[optind]));
|
||||
}
|
||||
|
||||
if (fail)
|
||||
errors = 1;
|
||||
}
|
||||
|
||||
exit (errors);
|
||||
|
||||
25
src/mknod.c
25
src/mknod.c
@@ -86,7 +86,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
mode_t newmode;
|
||||
struct mode_change *change;
|
||||
const char *symbolic_mode;
|
||||
const char *specified_mode;
|
||||
int optc;
|
||||
int i_major, i_minor;
|
||||
long int tmp_major, tmp_minor;
|
||||
@@ -99,7 +99,7 @@ main (int argc, char **argv)
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
symbolic_mode = NULL;
|
||||
specified_mode = NULL;
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1)
|
||||
{
|
||||
@@ -108,7 +108,7 @@ main (int argc, char **argv)
|
||||
case 0:
|
||||
break;
|
||||
case 'm':
|
||||
symbolic_mode = optarg;
|
||||
specified_mode = optarg;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
@@ -117,11 +117,11 @@ main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
newmode = ((S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
|
||||
& ~ umask (0));
|
||||
if (symbolic_mode)
|
||||
newmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
if (specified_mode)
|
||||
{
|
||||
change = mode_compile (symbolic_mode, 0);
|
||||
newmode &= ~ umask (0);
|
||||
change = mode_compile (specified_mode, 0);
|
||||
if (change == MODE_INVALID)
|
||||
error (1, 0, _("invalid mode"));
|
||||
else if (change == MODE_MEMORY_EXHAUSTED)
|
||||
@@ -223,5 +223,16 @@ major and minor device numbers may not be specified for fifo files"));
|
||||
usage (1);
|
||||
}
|
||||
|
||||
/* Perform an explicit chmod to ensure the file mode permission bits
|
||||
are set as specified. This extra step is necessary in some cases
|
||||
when the containing directory has a default ACL. */
|
||||
|
||||
if (specified_mode)
|
||||
{
|
||||
if (chmod (argv[optind], newmode))
|
||||
error (0, errno, _("cannot set permissions of `%s'"),
|
||||
quote (argv[optind]));
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
1
src/mv.c
1
src/mv.c
@@ -88,7 +88,6 @@ rm_option_init (struct rm_options *x)
|
||||
{
|
||||
x->unlink_dirs = 0;
|
||||
|
||||
/* FIXME: maybe this should be 1. The POSIX spec doesn't specify. */
|
||||
x->ignore_missing_files = 0;
|
||||
|
||||
x->recursive = 1;
|
||||
|
||||
224
src/od.c
224
src/od.c
@@ -65,11 +65,6 @@ typedef double LONG_DOUBLE;
|
||||
# define LDBL_DIG DBL_DIG
|
||||
#endif
|
||||
|
||||
#if !HAVE_FSEEKO
|
||||
# undef fseeko
|
||||
# define fseeko(Stream, Offset, Whence) (-1)
|
||||
#endif
|
||||
|
||||
enum size_spec
|
||||
{
|
||||
NO_SIZE,
|
||||
@@ -77,6 +72,8 @@ enum size_spec
|
||||
SHORT,
|
||||
INT,
|
||||
LONG,
|
||||
LONG_LONG,
|
||||
/* FIXME: add INTMAX support, too */
|
||||
FLOAT_SINGLE,
|
||||
FLOAT_DOUBLE,
|
||||
FLOAT_LONG_DOUBLE
|
||||
@@ -156,16 +153,17 @@ static const char *const charname[33] =
|
||||
/* A printf control string for printing a file offset. */
|
||||
static const char *output_address_fmt_string;
|
||||
|
||||
/* FIXME: make this the number of octal digits in an unsigned long. */
|
||||
#define MAX_ADDRESS_LENGTH 13
|
||||
/* The number of octal digits required to represent the largest off_t value. */
|
||||
#define MAX_ADDRESS_LENGTH \
|
||||
((sizeof (off_t) * CHAR_BIT + CHAR_BIT - 1) / 3)
|
||||
|
||||
/* Space for a normal address, a space, a pseudo address, parentheses
|
||||
around the pseudo address, and a trailing zero byte. */
|
||||
static char address_fmt_buffer[2 * MAX_ADDRESS_LENGTH + 4];
|
||||
static char address_pad[MAX_ADDRESS_LENGTH + 1];
|
||||
|
||||
static unsigned long int string_min;
|
||||
static unsigned long int flag_dump_strings;
|
||||
static size_t string_min;
|
||||
static int flag_dump_strings;
|
||||
|
||||
/* Non-zero if we should recognize the pre-POSIX non-option arguments
|
||||
that specified at most one file and optional arguments specifying
|
||||
@@ -181,7 +179,7 @@ static long int pseudo_offset;
|
||||
|
||||
/* Function to format an address and optionally an additional parenthesized
|
||||
pseudo-address; it returns the formatted string. */
|
||||
static const char *(*format_address) PARAMS ((long unsigned int));
|
||||
static const char *(*format_address) PARAMS ((off_t));
|
||||
|
||||
/* The number of input bytes to skip before formatting and writing. */
|
||||
static off_t n_bytes_to_skip = 0;
|
||||
@@ -229,7 +227,11 @@ static FILE *in_stream;
|
||||
/* If nonzero, at least one of the files we read was standard input. */
|
||||
static int have_read_stdin;
|
||||
|
||||
#define LONGEST_INTEGRAL_TYPE long int
|
||||
#ifdef HAVE_UNSIGNED_LONG_LONG
|
||||
# define LONGEST_INTEGRAL_TYPE unsigned long long
|
||||
#else
|
||||
# define LONGEST_INTEGRAL_TYPE long int
|
||||
#endif
|
||||
|
||||
#define MAX_INTEGRAL_TYPE_SIZE sizeof(LONGEST_INTEGRAL_TYPE)
|
||||
static enum size_spec integral_type_size[MAX_INTEGRAL_TYPE_SIZE + 1];
|
||||
@@ -358,10 +360,9 @@ lcm (unsigned int u, unsigned int v)
|
||||
}
|
||||
|
||||
static void
|
||||
print_s_char (long unsigned int n_bytes, const char *block,
|
||||
const char *fmt_string)
|
||||
print_s_char (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
for (i = n_bytes; i > 0; i--)
|
||||
{
|
||||
int tmp = (unsigned) *(const unsigned char *) block;
|
||||
@@ -374,10 +375,9 @@ print_s_char (long unsigned int n_bytes, const char *block,
|
||||
}
|
||||
|
||||
static void
|
||||
print_char (long unsigned int n_bytes, const char *block,
|
||||
const char *fmt_string)
|
||||
print_char (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
for (i = n_bytes; i > 0; i--)
|
||||
{
|
||||
unsigned int tmp = *(const unsigned char *) block;
|
||||
@@ -387,10 +387,9 @@ print_char (long unsigned int n_bytes, const char *block,
|
||||
}
|
||||
|
||||
static void
|
||||
print_s_short (long unsigned int n_bytes, const char *block,
|
||||
const char *fmt_string)
|
||||
print_s_short (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
for (i = n_bytes / sizeof (unsigned short); i > 0; i--)
|
||||
{
|
||||
int tmp = (unsigned) *(const unsigned short *) block;
|
||||
@@ -403,10 +402,9 @@ print_s_short (long unsigned int n_bytes, const char *block,
|
||||
}
|
||||
|
||||
static void
|
||||
print_short (long unsigned int n_bytes, const char *block,
|
||||
const char *fmt_string)
|
||||
print_short (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
for (i = n_bytes / sizeof (unsigned short); i > 0; i--)
|
||||
{
|
||||
unsigned int tmp = *(const unsigned short *) block;
|
||||
@@ -416,10 +414,9 @@ print_short (long unsigned int n_bytes, const char *block,
|
||||
}
|
||||
|
||||
static void
|
||||
print_int (long unsigned int n_bytes, const char *block,
|
||||
const char *fmt_string)
|
||||
print_int (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
for (i = n_bytes / sizeof (unsigned int); i > 0; i--)
|
||||
{
|
||||
unsigned int tmp = *(const unsigned int *) block;
|
||||
@@ -429,10 +426,9 @@ print_int (long unsigned int n_bytes, const char *block,
|
||||
}
|
||||
|
||||
static void
|
||||
print_long (long unsigned int n_bytes, const char *block,
|
||||
const char *fmt_string)
|
||||
print_long (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
for (i = n_bytes / sizeof (unsigned long); i > 0; i--)
|
||||
{
|
||||
unsigned long tmp = *(const unsigned long *) block;
|
||||
@@ -441,11 +437,24 @@ print_long (long unsigned int n_bytes, const char *block,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_UNSIGNED_LONG_LONG
|
||||
static void
|
||||
print_float (long unsigned int n_bytes, const char *block,
|
||||
const char *fmt_string)
|
||||
print_long_long (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
for (i = n_bytes / sizeof (unsigned long long); i > 0; i--)
|
||||
{
|
||||
unsigned long long tmp = *(const unsigned long long *) block;
|
||||
printf (fmt_string, tmp);
|
||||
block += sizeof (unsigned long long);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
print_float (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
{
|
||||
off_t i;
|
||||
for (i = n_bytes / sizeof (float); i > 0; i--)
|
||||
{
|
||||
float tmp = *(const float *) block;
|
||||
@@ -455,10 +464,9 @@ print_float (long unsigned int n_bytes, const char *block,
|
||||
}
|
||||
|
||||
static void
|
||||
print_double (long unsigned int n_bytes, const char *block,
|
||||
const char *fmt_string)
|
||||
print_double (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
for (i = n_bytes / sizeof (double); i > 0; i--)
|
||||
{
|
||||
double tmp = *(const double *) block;
|
||||
@@ -469,10 +477,9 @@ print_double (long unsigned int n_bytes, const char *block,
|
||||
|
||||
#ifdef HAVE_LONG_DOUBLE
|
||||
static void
|
||||
print_long_double (long unsigned int n_bytes, const char *block,
|
||||
const char *fmt_string)
|
||||
print_long_double (off_t n_bytes, const char *block, const char *fmt_string)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
for (i = n_bytes / sizeof (LONG_DOUBLE); i > 0; i--)
|
||||
{
|
||||
LONG_DOUBLE tmp = *(const LONG_DOUBLE *) block;
|
||||
@@ -484,9 +491,9 @@ print_long_double (long unsigned int n_bytes, const char *block,
|
||||
#endif
|
||||
|
||||
static void
|
||||
dump_hexl_mode_trailer (long unsigned int n_bytes, const char *block)
|
||||
dump_hexl_mode_trailer (off_t n_bytes, const char *block)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
fputs (" >", stdout);
|
||||
for (i = n_bytes; i > 0; i--)
|
||||
{
|
||||
@@ -499,10 +506,10 @@ dump_hexl_mode_trailer (long unsigned int n_bytes, const char *block)
|
||||
}
|
||||
|
||||
static void
|
||||
print_named_ascii (long unsigned int n_bytes, const char *block,
|
||||
const char *unused_fmt_string)
|
||||
print_named_ascii (off_t n_bytes, const char *block,
|
||||
const char *unused_fmt_string ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
for (i = n_bytes; i > 0; i--)
|
||||
{
|
||||
unsigned int c = *(const unsigned char *) block;
|
||||
@@ -526,10 +533,10 @@ print_named_ascii (long unsigned int n_bytes, const char *block,
|
||||
}
|
||||
|
||||
static void
|
||||
print_ascii (long unsigned int n_bytes, const char *block,
|
||||
const char *unused_fmt_string)
|
||||
print_ascii (off_t n_bytes, const char *block,
|
||||
const char *unused_fmt_string ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int i;
|
||||
off_t i;
|
||||
for (i = n_bytes; i > 0; i--)
|
||||
{
|
||||
unsigned int c = *(const unsigned char *) block;
|
||||
@@ -631,7 +638,7 @@ decode_one_format (const char *s_orig, const char *s, const char **next,
|
||||
enum output_format fmt;
|
||||
const char *pre_fmt_string;
|
||||
char *fmt_string;
|
||||
void (*print_function) ();
|
||||
void (*print_function) PARAMS ((off_t, const char *, const char *));
|
||||
const char *p;
|
||||
unsigned int c;
|
||||
unsigned int field_width = 0;
|
||||
@@ -681,7 +688,7 @@ decode_one_format (const char *s_orig, const char *s, const char **next,
|
||||
size = sizeof (int);
|
||||
else
|
||||
{
|
||||
if (size > MAX_INTEGRAL_TYPE_SIZE
|
||||
if (MAX_INTEGRAL_TYPE_SIZE < size
|
||||
|| integral_type_size[size] == NO_SIZE)
|
||||
{
|
||||
error (0, 0, _("invalid type string `%s';\n\
|
||||
@@ -704,7 +711,9 @@ this system doesn't provide a %lu-byte integral type"), s_orig, size);
|
||||
fmt = SIGNED_DECIMAL;
|
||||
sprintf (fmt_string, " %%%u%sd",
|
||||
(field_width = bytes_to_signed_dec_digits[size]),
|
||||
(size_spec == LONG ? "l" : ""));
|
||||
(size_spec == LONG ? "l"
|
||||
: (size_spec == LONG_LONG ? "ll"
|
||||
: "")));
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
@@ -756,6 +765,10 @@ this system doesn't provide a %lu-byte integral type"), s_orig, size);
|
||||
print_function = print_long;
|
||||
break;
|
||||
|
||||
case LONG_LONG:
|
||||
print_function = print_long_long;
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
@@ -959,15 +972,15 @@ skip (off_t n_skip)
|
||||
if (n_skip == 0)
|
||||
break;
|
||||
|
||||
/* First try using fseek. For large offsets, this extra work is
|
||||
/* First try seeking. For large offsets, this extra work is
|
||||
worthwhile. If the offset is below some threshold it may be
|
||||
more efficient to move the pointer by reading. There are two
|
||||
issues when trying to use fseek:
|
||||
issues when trying to seek:
|
||||
- the file must be seekable.
|
||||
- before seeking to the specified position, make sure
|
||||
that the new position is in the current file.
|
||||
Try to do that by getting file's size using fstat().
|
||||
But that will work only for regular files and dirs. */
|
||||
Try to do that by getting file's size using fstat.
|
||||
But that will work only for regular files. */
|
||||
|
||||
if (fstat (fileno (in_stream), &file_stats))
|
||||
{
|
||||
@@ -976,14 +989,14 @@ skip (off_t n_skip)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* The st_size field is valid only for regular files and
|
||||
directories. FIXME: is the preceding true?
|
||||
/* The st_size field is valid only for regular files
|
||||
(and for symbolic links, which cannot occur here).
|
||||
If the number of bytes left to skip is at least as large as
|
||||
the size of the current file, we can decrement
|
||||
n_skip and go on to the next file. */
|
||||
if (S_ISREG (file_stats.st_mode) || S_ISDIR (file_stats.st_mode))
|
||||
if (S_ISREG (file_stats.st_mode))
|
||||
{
|
||||
if (n_skip >= file_stats.st_size)
|
||||
if (file_stats.st_size <= n_skip)
|
||||
{
|
||||
n_skip -= file_stats.st_size;
|
||||
if (in_stream != stdin && fclose (in_stream) == EOF)
|
||||
@@ -995,10 +1008,7 @@ skip (off_t n_skip)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Try fseeko if available, fseek otherwise. */
|
||||
if (fseeko (in_stream, n_skip, SEEK_SET) == 0
|
||||
|| (n_skip <= LONG_MAX
|
||||
&& fseek (in_stream, (long) n_skip, SEEK_SET) == 0))
|
||||
if (0 <= lseek (fileno (in_stream), n_skip, SEEK_CUR))
|
||||
{
|
||||
n_skip = 0;
|
||||
break;
|
||||
@@ -1009,10 +1019,10 @@ skip (off_t n_skip)
|
||||
/* Seek didn't work or wasn't attempted; position the file pointer
|
||||
by reading. */
|
||||
|
||||
for (j = n_skip / BUFSIZ; j >= 0; j--)
|
||||
for (j = n_skip / BUFSIZ; 0 <= j; j--)
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
size_t n_bytes_to_read = (j > 0
|
||||
size_t n_bytes_to_read = (0 < j
|
||||
? BUFSIZ
|
||||
: n_skip % BUFSIZ);
|
||||
size_t n_bytes_read;
|
||||
@@ -1033,13 +1043,13 @@ skip (off_t n_skip)
|
||||
}
|
||||
|
||||
static const char *
|
||||
format_address_none (long unsigned int address)
|
||||
format_address_none (off_t address ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
static const char *
|
||||
format_address_std (long unsigned int address)
|
||||
format_address_std (off_t address)
|
||||
{
|
||||
const char *address_string;
|
||||
|
||||
@@ -1049,7 +1059,7 @@ format_address_std (long unsigned int address)
|
||||
}
|
||||
|
||||
static const char *
|
||||
format_address_label (long unsigned int address)
|
||||
format_address_label (off_t address)
|
||||
{
|
||||
const char *address_string;
|
||||
assert (output_address_fmt_string != NULL);
|
||||
@@ -1072,7 +1082,7 @@ format_address_label (long unsigned int address)
|
||||
only when it has not been padded to length BYTES_PER_BLOCK. */
|
||||
|
||||
static void
|
||||
write_block (long unsigned int current_offset, long unsigned int n_bytes,
|
||||
write_block (off_t current_offset, off_t n_bytes,
|
||||
const char *prev_block, const char *curr_block)
|
||||
{
|
||||
static int first = 1;
|
||||
@@ -1237,7 +1247,7 @@ read_block (size_t n, char *block, size_t *n_bytes_in_buffer)
|
||||
{
|
||||
int err;
|
||||
|
||||
assert (n > 0 && n <= bytes_per_block);
|
||||
assert (0 < n && n <= bytes_per_block);
|
||||
|
||||
*n_bytes_in_buffer = 0;
|
||||
|
||||
@@ -1314,7 +1324,7 @@ parse_old_offset (const char *s)
|
||||
int radix;
|
||||
off_t offset;
|
||||
enum strtol_error s_err;
|
||||
long unsigned int tmp;
|
||||
uintmax_t tmp;
|
||||
|
||||
if (*s == '\0')
|
||||
return -1;
|
||||
@@ -1336,12 +1346,15 @@ parse_old_offset (const char *s)
|
||||
radix = 8;
|
||||
}
|
||||
|
||||
s_err = xstrtoul (s, NULL, radix, &tmp, "Bb");
|
||||
s_err = xstrtoumax (s, NULL, radix, &tmp, "Bb");
|
||||
if (s_err != LONGINT_OK)
|
||||
{
|
||||
STRTOL_FAIL_WARN (s, _("old-style offset"), s_err);
|
||||
return -1;
|
||||
}
|
||||
if (OFF_T_MAX < tmp)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("%s is larger than the maximum file size on this system"), s);
|
||||
offset = tmp;
|
||||
return offset;
|
||||
}
|
||||
@@ -1458,15 +1471,14 @@ dump_strings (void)
|
||||
err = 0;
|
||||
while (1)
|
||||
{
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
int c;
|
||||
|
||||
/* See if the next `string_min' chars are all printing chars. */
|
||||
tryline:
|
||||
|
||||
if (limit_bytes_to_format
|
||||
&& address >= (n_bytes_to_skip + max_bytes_to_format -
|
||||
(off_t) string_min))
|
||||
&& address >= (n_bytes_to_skip + max_bytes_to_format - string_min))
|
||||
break;
|
||||
|
||||
for (i = 0; i < string_min; i++)
|
||||
@@ -1563,6 +1575,26 @@ dump_strings (void)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* There must be exactly one %s format specifier in FORMAT_TEMPLATE.
|
||||
Return the just-malloc'd result of using sprintf to insert
|
||||
OFF_T_PRINTF_FORMAT_STRING into FORMAT_TEMPLATE.
|
||||
Technically, the caller should free this memory, but IMHO it's not
|
||||
worth it in this case. */
|
||||
static char *
|
||||
expand_address_fmt (char const *format_template)
|
||||
{
|
||||
size_t len = strlen (format_template);
|
||||
char *fmt = xmalloc (len + 1);
|
||||
/* Ensure that the literal we're inserting is no longer than the two-byte
|
||||
string `%s' it's replacing. There's also the %%, so technically we don't
|
||||
even need the `+ 1' above. */
|
||||
assert (OFF_T_PRINTF_FORMAT_STRING[0] == 0
|
||||
|| OFF_T_PRINTF_FORMAT_STRING[1] == 0
|
||||
|| OFF_T_PRINTF_FORMAT_STRING[2] == 0);
|
||||
sprintf (fmt, format_template, OFF_T_PRINTF_FORMAT_STRING);
|
||||
return fmt;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@@ -1571,7 +1603,7 @@ main (int argc, char **argv)
|
||||
unsigned int i;
|
||||
unsigned int l_c_m;
|
||||
unsigned int address_pad_len;
|
||||
unsigned long int desired_width;
|
||||
unsigned long int desired_width IF_LINT (= 0);
|
||||
int width_specified = 0;
|
||||
int n_failed_decodes = 0;
|
||||
int err;
|
||||
@@ -1596,6 +1628,9 @@ main (int argc, char **argv)
|
||||
integral_type_size[sizeof (short int)] = SHORT;
|
||||
integral_type_size[sizeof (int)] = INT;
|
||||
integral_type_size[sizeof (long int)] = LONG;
|
||||
#ifdef HAVE_UNSIGNED_LONG_LONG
|
||||
integral_type_size[sizeof (long long)] = LONG_LONG;
|
||||
#endif
|
||||
|
||||
for (i = 0; i <= MAX_FP_TYPE_SIZE; i++)
|
||||
fp_type_size[i] = NO_SIZE;
|
||||
@@ -1611,7 +1646,7 @@ main (int argc, char **argv)
|
||||
n_specs_allocated = 5;
|
||||
spec = (struct tspec *) xmalloc (n_specs_allocated * sizeof (struct tspec));
|
||||
|
||||
output_address_fmt_string = "%07o";
|
||||
output_address_fmt_string = expand_address_fmt ("%%07%so");
|
||||
format_address = format_address_std;
|
||||
address_pad_len = 7;
|
||||
flag_dump_strings = 0;
|
||||
@@ -1619,7 +1654,7 @@ main (int argc, char **argv)
|
||||
while ((c = getopt_long (argc, argv, "abcdfhilos::xw::A:j:N:t:v",
|
||||
long_options, NULL)) != -1)
|
||||
{
|
||||
unsigned long int tmp;
|
||||
uintmax_t tmp;
|
||||
enum strtol_error s_err;
|
||||
|
||||
switch (c)
|
||||
@@ -1631,17 +1666,17 @@ main (int argc, char **argv)
|
||||
switch (optarg[0])
|
||||
{
|
||||
case 'd':
|
||||
output_address_fmt_string = "%07d";
|
||||
output_address_fmt_string = expand_address_fmt ("%%07%sd");
|
||||
format_address = format_address_std;
|
||||
address_pad_len = 7;
|
||||
break;
|
||||
case 'o':
|
||||
output_address_fmt_string = "%07o";
|
||||
output_address_fmt_string = expand_address_fmt ("%%07%so");
|
||||
format_address = format_address_std;
|
||||
address_pad_len = 7;
|
||||
break;
|
||||
case 'x':
|
||||
output_address_fmt_string = "%06x";
|
||||
output_address_fmt_string = expand_address_fmt ("%%06%sx");
|
||||
format_address = format_address_std;
|
||||
address_pad_len = 6;
|
||||
break;
|
||||
@@ -1660,7 +1695,7 @@ it must be one character from [doxn]"),
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
s_err = xstrtoul (optarg, NULL, 0, &tmp, "bkm");
|
||||
s_err = xstrtoumax (optarg, NULL, 0, &tmp, "bkm");
|
||||
n_bytes_to_skip = tmp;
|
||||
if (s_err != LONGINT_OK)
|
||||
STRTOL_FATAL_ERROR (optarg, _("skip argument"), s_err);
|
||||
@@ -1669,17 +1704,15 @@ it must be one character from [doxn]"),
|
||||
case 'N':
|
||||
limit_bytes_to_format = 1;
|
||||
|
||||
/* FIXME: if off_t is long long and that's an 8-byte type,
|
||||
use xstrtouq here. */
|
||||
s_err = xstrtoul (optarg, NULL, 0, &tmp, "bkm");
|
||||
s_err = xstrtoumax (optarg, NULL, 0, &tmp, "bkm");
|
||||
max_bytes_to_format = tmp;
|
||||
if (s_err != LONGINT_OK)
|
||||
STRTOL_FATAL_ERROR (optarg, _("limit argument"), s_err);
|
||||
|
||||
if (tmp > LONG_MAX)
|
||||
if (OFF_T_MAX < tmp)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("specified number of bytes `%s' is larger than \
|
||||
the maximum\nrepresentable value of type `long'"), optarg);
|
||||
_("%s is larger than the maximum file size on this system"),
|
||||
optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
@@ -1687,11 +1720,18 @@ the maximum\nrepresentable value of type `long'"), optarg);
|
||||
string_min = 3;
|
||||
else
|
||||
{
|
||||
s_err = xstrtoul (optarg, NULL, 0, &string_min, "bkm");
|
||||
s_err = xstrtoumax (optarg, NULL, 0, &tmp, "bkm");
|
||||
if (s_err != LONGINT_OK)
|
||||
STRTOL_FATAL_ERROR (optarg, _("minimum string length"), s_err);
|
||||
|
||||
/* The minimum string length may be no larger than SIZE_MAX,
|
||||
since we may allocate a buffer of this size. */
|
||||
if (SIZE_MAX < tmp)
|
||||
error (EXIT_FAILURE, 0, _("%s is too large"), optarg);
|
||||
|
||||
string_min = tmp;
|
||||
}
|
||||
++flag_dump_strings;
|
||||
flag_dump_strings = 1;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
@@ -1741,9 +1781,13 @@ the maximum\nrepresentable value of type `long'"), optarg);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_err = xstrtoul (optarg, NULL, 10, &desired_width, "");
|
||||
uintmax_t w_tmp;
|
||||
s_err = xstrtoumax (optarg, NULL, 10, &w_tmp, "");
|
||||
if (s_err != LONGINT_OK)
|
||||
STRTOL_FATAL_ERROR (optarg, _("width specification"), s_err);
|
||||
if (ULONG_MAX < w_tmp)
|
||||
error (EXIT_FAILURE, 0, _("%s is too large"), optarg);
|
||||
desired_width = w_tmp;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1845,7 +1889,7 @@ the maximum\nrepresentable value of type `long'"), optarg);
|
||||
|
||||
if (output_address_fmt_string == NULL)
|
||||
{
|
||||
output_address_fmt_string = "(%07o)";
|
||||
output_address_fmt_string = expand_address_fmt ("(%%07%so)");
|
||||
format_address = format_address_std;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
|
||||
#include "error.h"
|
||||
#include "readutmp.h"
|
||||
#include "closeout.h"
|
||||
|
||||
65
src/pr.c
65
src/pr.c
@@ -861,57 +861,40 @@ main (int argc, char **argv)
|
||||
? (char **) xmalloc ((argc - 1) * sizeof (char *))
|
||||
: NULL);
|
||||
|
||||
while (1)
|
||||
while ((c = getopt_long (argc, argv,
|
||||
"-0123456789abcde::fFh:i::Jl:mn::N:o:rs::S::tTvw:W:",
|
||||
long_options, NULL))
|
||||
!= -1)
|
||||
{
|
||||
c = getopt_long (argc, argv,
|
||||
"-0123456789abcde::fFh:i::Jl:mn::N:o:rs::S::tTvw:W:",
|
||||
long_options, NULL);
|
||||
if (c == 1) /* Non-option argument. */
|
||||
if (ISDIGIT (c))
|
||||
{
|
||||
char *s;
|
||||
s = optarg;
|
||||
if (*s == '+')
|
||||
{
|
||||
/* long option --page dominates old `+FIRST_PAGE ...' */
|
||||
if (first_page_number > 0 || last_page_number > 0)
|
||||
continue;
|
||||
++s;
|
||||
first_last_page (s);
|
||||
}
|
||||
else
|
||||
{
|
||||
file_names[n_files++] = optarg;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ISDIGIT (c))
|
||||
{
|
||||
accum = accum * 10 + c - '0';
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (accum > 0)
|
||||
{
|
||||
columns = accum;
|
||||
explicit_columns = TRUE;
|
||||
accum = 0;
|
||||
}
|
||||
}
|
||||
accum = accum * 10 + c - '0';
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == 1)
|
||||
continue;
|
||||
|
||||
if (c == EOF)
|
||||
break;
|
||||
if (accum > 0)
|
||||
{
|
||||
columns = accum;
|
||||
explicit_columns = TRUE;
|
||||
accum = 0;
|
||||
}
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0: /* getopt long option */
|
||||
break;
|
||||
|
||||
case 1: /* Non-option argument. */
|
||||
if (*optarg == '+')
|
||||
{
|
||||
/* long option --page dominates old `+FIRST_PAGE ...' */
|
||||
if (first_page_number <= 0 && last_page_number <= 0)
|
||||
first_last_page (optarg);
|
||||
}
|
||||
else
|
||||
file_names[n_files++] = optarg;
|
||||
break;
|
||||
|
||||
case PAGES_OPTION: /* --pages=FIRST_PAGE[:LAST_PAGE] */
|
||||
{ /* dominates old opt +... */
|
||||
if (optarg)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
struct rm_options
|
||||
{
|
||||
/* If nonzero, ignore nonexistant files. */
|
||||
/* If nonzero, ignore nonexistent files. */
|
||||
int ignore_missing_files;
|
||||
|
||||
/* If nonzero, query the user about whether to remove each file. */
|
||||
|
||||
@@ -147,7 +147,10 @@ valid_format (const char *fmt)
|
||||
fmt += strspn (fmt, "0123456789");
|
||||
|
||||
if (*fmt == '.')
|
||||
fmt += strspn (++fmt, "0123456789");
|
||||
{
|
||||
++fmt;
|
||||
fmt += strspn (fmt, "0123456789");
|
||||
}
|
||||
}
|
||||
|
||||
if (!(*fmt == 'e' || *fmt == 'f' || *fmt == 'g'))
|
||||
|
||||
7
src/sha1sum.c
Normal file
7
src/sha1sum.c
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "checksum.h"
|
||||
|
||||
int algorithm = ALG_SHA1;
|
||||
42
src/shred.c
42
src/shred.c
@@ -83,6 +83,7 @@
|
||||
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
@@ -438,7 +439,7 @@ struct Options
|
||||
|
||||
static struct option const long_opts[] =
|
||||
{
|
||||
{"exact", required_argument, NULL, 'x'},
|
||||
{"exact", no_argument, NULL, 'x'},
|
||||
{"force", no_argument, NULL, 'f'},
|
||||
{"iterations", required_argument, NULL, 'n'},
|
||||
{"size", required_argument, NULL, 's'},
|
||||
@@ -990,13 +991,14 @@ fillpattern (int type, unsigned char *r, size_t size)
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill a buffer with random data.
|
||||
* size is rounded UP to a multiple of ISAAC_BYTES.
|
||||
* Fill a buffer, R (of size SIZE_MAX), with random data.
|
||||
* SIZE is rounded UP to a multiple of ISAAC_BYTES.
|
||||
*/
|
||||
static void
|
||||
fillrand (struct isaac_state *s, word32 *r, size_t size)
|
||||
fillrand (struct isaac_state *s, word32 *r, size_t size_max, size_t size)
|
||||
{
|
||||
size = (size + ISAAC_BYTES - 1) / ISAAC_BYTES;
|
||||
assert (size <= size_max);
|
||||
|
||||
while (size--)
|
||||
{
|
||||
@@ -1083,12 +1085,14 @@ dopass (int fd, char const *qname, off_t *sizep, int type,
|
||||
lim = sizeof r;
|
||||
if ((off_t) lim > size - offset && size != -1)
|
||||
{
|
||||
if (size < offset)
|
||||
break;
|
||||
lim = (size_t) (size - offset);
|
||||
if (!lim)
|
||||
break;
|
||||
}
|
||||
if (type < 0)
|
||||
fillrand (s, r, lim);
|
||||
fillrand (s, r, sizeof r, lim);
|
||||
/* Loop to retry partial writes. */
|
||||
for (soff = 0; soff < lim; soff += ssize)
|
||||
{
|
||||
@@ -1422,17 +1426,33 @@ do_wipefd (int fd, char const *qname, struct isaac_state *s,
|
||||
size = flags->size;
|
||||
if (size == -1)
|
||||
{
|
||||
size = (S_ISREG (st.st_mode)
|
||||
? st.st_size
|
||||
: lseek (fd, (off_t) 0, SEEK_END));
|
||||
if (size < (S_ISREG (st.st_mode) ? 0 : -1))
|
||||
/* Accept a length of zero only if it's a regular file.
|
||||
For any other type of file, try to get the size another way. */
|
||||
if (S_ISREG (st.st_mode))
|
||||
{
|
||||
error (0, 0, _("%s: file has negative size"), qname);
|
||||
return -1;
|
||||
size = st.st_size;
|
||||
if (size < 0)
|
||||
{
|
||||
error (0, 0, _("%s: file has negative size"), qname);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size = lseek (fd, (off_t) 0, SEEK_END);
|
||||
if (size <= 0)
|
||||
{
|
||||
/* We are unable to determine the length, up front.
|
||||
Let dopass do that as part of its first iteration. */
|
||||
size = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 <= size && !(flags->exact))
|
||||
{
|
||||
size += ST_BLKSIZE (st) - 1 - (size - 1) % ST_BLKSIZE (st);
|
||||
|
||||
/* If in rounding up, we've just overflowed, use the maximum. */
|
||||
if (size < 0)
|
||||
size = TYPE_MAXIMUM (off_t);
|
||||
}
|
||||
|
||||
288
src/sort.c
288
src/sort.c
@@ -32,8 +32,10 @@
|
||||
#include "long-options.h"
|
||||
#include "error.h"
|
||||
#include "hard-locale.h"
|
||||
#include "human.h"
|
||||
#include "memcoll.h"
|
||||
#include "xalloc.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "sort"
|
||||
@@ -73,6 +75,7 @@ double strtod ();
|
||||
not properly sorted. Any other irregular exit must exit with a
|
||||
status code greater than 1. */
|
||||
#define SORT_FAILURE 2
|
||||
#define SORT_OUT_OF_ORDER 1
|
||||
|
||||
#define C_DECIMAL_POINT '.'
|
||||
#define NEGATION_SIGN '-'
|
||||
@@ -98,6 +101,8 @@ static int hard_LC_TIME;
|
||||
|
||||
#endif
|
||||
|
||||
#define NONZERO(x) (x != 0)
|
||||
|
||||
/* The kind of blanks for '-b' to skip in various options. */
|
||||
enum blanktype { bl_start, bl_end, bl_both };
|
||||
|
||||
@@ -108,7 +113,7 @@ int eolchar = '\n';
|
||||
struct line
|
||||
{
|
||||
char *text; /* Text of the line. */
|
||||
int length; /* Length including final newline. */
|
||||
size_t length; /* Length including final newline. */
|
||||
char *keybeg; /* Start of first key. */
|
||||
char *keylim; /* Limit of first key. */
|
||||
};
|
||||
@@ -117,29 +122,29 @@ struct line
|
||||
struct lines
|
||||
{
|
||||
struct line *lines; /* Dynamically allocated array of lines. */
|
||||
int used; /* Number of slots used. */
|
||||
int alloc; /* Number of slots allocated. */
|
||||
int limit; /* Max number of slots to allocate. */
|
||||
size_t used; /* Number of slots used. */
|
||||
size_t alloc; /* Number of slots allocated. */
|
||||
size_t limit; /* Max number of slots to allocate. */
|
||||
};
|
||||
|
||||
/* Input buffers. */
|
||||
struct buffer
|
||||
{
|
||||
char *buf; /* Dynamically allocated buffer. */
|
||||
int used; /* Number of bytes used. */
|
||||
int alloc; /* Number of bytes allocated. */
|
||||
int left; /* Number of bytes left from previous reads. */
|
||||
int newline_free; /* Number of left bytes that are known
|
||||
size_t used; /* Number of bytes used. */
|
||||
size_t alloc; /* Number of bytes allocated. */
|
||||
size_t left; /* Number of bytes left from previous reads. */
|
||||
size_t newline_free; /* Number of left bytes that are known
|
||||
to be newline-free. */
|
||||
};
|
||||
|
||||
struct keyfield
|
||||
{
|
||||
int sword; /* Zero-origin 'word' to start at. */
|
||||
int schar; /* Additional characters to skip. */
|
||||
size_t sword; /* Zero-origin 'word' to start at. */
|
||||
size_t schar; /* Additional characters to skip. */
|
||||
int skipsblanks; /* Skip leading white space at start. */
|
||||
int eword; /* Zero-origin first word after field. */
|
||||
int echar; /* Additional characters in field. */
|
||||
size_t eword; /* Zero-origin first word after field. */
|
||||
size_t echar; /* Additional characters in field. */
|
||||
int skipeblanks; /* Skip trailing white space at finish. */
|
||||
int *ignore; /* Boolean array of characters to ignore. */
|
||||
char *translate; /* Translation applied to characters. */
|
||||
@@ -213,14 +218,14 @@ static MONTHTAB_CONST struct month monthtab[] =
|
||||
/* Initial buffer size for in-core sorting. The buffer will grow only
|
||||
if a line longer than this is seen. */
|
||||
#define SORTALLOC (8 * 1024 * 1024)
|
||||
static int const sortalloc = SORTALLOC;
|
||||
static size_t const sortalloc = SORTALLOC;
|
||||
|
||||
/* Initial buffer size for in core merge buffers. Bear in mind that
|
||||
up to NMERGE * mergealloc bytes may be allocated for merge buffers. */
|
||||
static int const mergealloc = SORTALLOC / NMERGE / 2;
|
||||
static size_t const mergealloc = SORTALLOC / NMERGE / 2;
|
||||
|
||||
/* Guess of average line length. */
|
||||
static int const linelength = 30;
|
||||
static size_t const linelength = 30;
|
||||
|
||||
/* Maximum number of elements for the array(s) of struct line's, in bytes. */
|
||||
#define LINEALLOC (SORTALLOC / 2)
|
||||
@@ -556,7 +561,7 @@ inittables (void)
|
||||
/* Initialize BUF, allocating ALLOC bytes initially. */
|
||||
|
||||
static void
|
||||
initbuf (struct buffer *buf, int alloc)
|
||||
initbuf (struct buffer *buf, size_t alloc)
|
||||
{
|
||||
buf->alloc = alloc;
|
||||
buf->buf = xmalloc (buf->alloc);
|
||||
@@ -568,7 +573,7 @@ initbuf (struct buffer *buf, int alloc)
|
||||
file wasn't terminated by a newline, supply one. Return a count
|
||||
of bytes buffered. */
|
||||
|
||||
static int
|
||||
static size_t
|
||||
fillbuf (struct buffer *buf, FILE *fp)
|
||||
{
|
||||
if (buf->used != buf->left)
|
||||
@@ -579,10 +584,12 @@ fillbuf (struct buffer *buf, FILE *fp)
|
||||
|
||||
while (!feof (fp))
|
||||
{
|
||||
int cc;
|
||||
size_t cc;
|
||||
if (buf->used == buf->alloc)
|
||||
{
|
||||
buf->alloc *= 2;
|
||||
if (buf->alloc < buf->used)
|
||||
xalloc_die ();
|
||||
buf->buf = xrealloc (buf->buf, buf->alloc);
|
||||
}
|
||||
cc = fread (buf->buf + buf->used, 1, buf->alloc - buf->used, fp);
|
||||
@@ -607,6 +614,8 @@ fillbuf (struct buffer *buf, FILE *fp)
|
||||
if (buf->newline_free != buf->used)
|
||||
return buf->used;
|
||||
buf->alloc *= 2;
|
||||
if (buf->alloc < buf->used)
|
||||
xalloc_die ();
|
||||
buf->buf = xrealloc (buf->buf, buf->alloc);
|
||||
}
|
||||
buf->buf[buf->used++] = eolchar;
|
||||
@@ -620,9 +629,11 @@ fillbuf (struct buffer *buf, FILE *fp)
|
||||
for, ever. */
|
||||
|
||||
static void
|
||||
initlines (struct lines *lines, int alloc, int limit)
|
||||
initlines (struct lines *lines, size_t alloc, size_t limit)
|
||||
{
|
||||
lines->alloc = alloc;
|
||||
if (SIZE_MAX / sizeof (struct line) < alloc)
|
||||
xalloc_die ();
|
||||
lines->lines = (struct line *) xmalloc (lines->alloc * sizeof (struct line));
|
||||
lines->used = 0;
|
||||
lines->limit = limit;
|
||||
@@ -635,7 +646,8 @@ static char *
|
||||
begfield (const struct line *line, const struct keyfield *key)
|
||||
{
|
||||
register char *ptr = line->text, *lim = ptr + line->length - 1;
|
||||
register int sword = key->sword, schar = key->schar;
|
||||
register size_t sword = key->sword;
|
||||
register size_t schar = key->schar;
|
||||
|
||||
if (tab)
|
||||
while (ptr < lim && sword--)
|
||||
@@ -658,7 +670,7 @@ begfield (const struct line *line, const struct keyfield *key)
|
||||
while (ptr < lim && blanks[UCHAR (*ptr)])
|
||||
++ptr;
|
||||
|
||||
if (ptr + schar <= lim)
|
||||
if (schar < lim - ptr)
|
||||
ptr += schar;
|
||||
else
|
||||
ptr = lim;
|
||||
@@ -673,7 +685,7 @@ static char *
|
||||
limfield (const struct line *line, const struct keyfield *key)
|
||||
{
|
||||
register char *ptr = line->text, *lim = ptr + line->length - 1;
|
||||
register int eword = key->eword, echar = key->echar;
|
||||
register size_t eword = key->eword, echar = key->echar;
|
||||
|
||||
/* Note: from the POSIX spec:
|
||||
The leading field separator itself is included in
|
||||
@@ -691,7 +703,7 @@ limfield (const struct line *line, const struct keyfield *key)
|
||||
{
|
||||
while (ptr < lim && *ptr != tab)
|
||||
++ptr;
|
||||
if (ptr < lim && (eword || echar > 0))
|
||||
if (ptr < lim && (eword | echar))
|
||||
++ptr;
|
||||
}
|
||||
else
|
||||
@@ -760,7 +772,7 @@ limfield (const struct line *line, const struct keyfield *key)
|
||||
++ptr;
|
||||
|
||||
/* Advance PTR by ECHAR (if possible), but no further than LIM. */
|
||||
if (ptr + echar <= lim)
|
||||
if (echar < lim - ptr)
|
||||
ptr += echar;
|
||||
else
|
||||
ptr = lim;
|
||||
@@ -795,6 +807,8 @@ findlines (struct buffer *buf, struct lines *lines)
|
||||
if (lines->used == lines->alloc)
|
||||
{
|
||||
lines->alloc *= 2;
|
||||
if (SIZE_MAX / sizeof (struct line) < lines->alloc)
|
||||
xalloc_die ();
|
||||
lines->lines = (struct line *)
|
||||
xrealloc ((char *) lines->lines,
|
||||
lines->alloc * sizeof (struct line));
|
||||
@@ -807,9 +821,9 @@ findlines (struct buffer *buf, struct lines *lines)
|
||||
if (key)
|
||||
{
|
||||
/* Precompute the position of the first key for efficiency. */
|
||||
line->keylim = 0 <= key->eword ? limfield (line, key) : ptr;
|
||||
line->keylim = (key->eword == -1 ? ptr : limfield (line, key));
|
||||
|
||||
if (key->sword >= 0)
|
||||
if (key->sword != -1)
|
||||
line->keybeg = begfield (line, key);
|
||||
else
|
||||
{
|
||||
@@ -901,7 +915,8 @@ fraccompare (register const char *a, register const char *b)
|
||||
static int
|
||||
numcompare (register const char *a, register const char *b)
|
||||
{
|
||||
register int tmpa, tmpb, loga, logb, tmp;
|
||||
register int tmpa, tmpb, tmp;
|
||||
register size_t loga, logb;
|
||||
|
||||
tmpa = *a;
|
||||
tmpb = *b;
|
||||
@@ -964,8 +979,8 @@ numcompare (register const char *a, register const char *b)
|
||||
tmpb = *++b;
|
||||
while (IS_THOUSANDS_SEP (tmpb));
|
||||
|
||||
if (logb - loga != 0)
|
||||
return logb - loga;
|
||||
if (loga != logb)
|
||||
return loga < logb ? 1 : -1;
|
||||
|
||||
if (!loga)
|
||||
return 0;
|
||||
@@ -1026,8 +1041,8 @@ numcompare (register const char *a, register const char *b)
|
||||
tmpb = *++b;
|
||||
while (IS_THOUSANDS_SEP (tmpb));
|
||||
|
||||
if (loga - logb != 0)
|
||||
return loga - logb;
|
||||
if (loga != logb)
|
||||
return loga < logb ? -1 : 1;
|
||||
|
||||
if (!loga)
|
||||
return 0;
|
||||
@@ -1069,10 +1084,11 @@ general_numcompare (const char *sa, const char *sb)
|
||||
Return 0 if the name in S is not recognized. */
|
||||
|
||||
static int
|
||||
getmonth (const char *s, int len)
|
||||
getmonth (const char *s, size_t len)
|
||||
{
|
||||
char *month;
|
||||
register int i, lo = 0, hi = MONTHS_PER_YEAR, result;
|
||||
register size_t i;
|
||||
register int lo = 0, hi = MONTHS_PER_YEAR, result;
|
||||
|
||||
while (len > 0 && blanks[UCHAR (*s)])
|
||||
{
|
||||
@@ -1122,7 +1138,8 @@ keycompare (const struct line *a, const struct line *b)
|
||||
register char *lima = a->keylim;
|
||||
register char *limb = b->keylim;
|
||||
|
||||
int diff, lena, lenb;
|
||||
int diff;
|
||||
size_t lena, lenb;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@@ -1130,11 +1147,8 @@ keycompare (const struct line *a, const struct line *b)
|
||||
register int *ignore = key->ignore;
|
||||
|
||||
/* Find the lengths. */
|
||||
lena = lima - texta, lenb = limb - textb;
|
||||
if (lena < 0)
|
||||
lena = 0;
|
||||
if (lenb < 0)
|
||||
lenb = 0;
|
||||
lena = lima <= texta ? 0 : lima - texta;
|
||||
lenb = limb <= textb ? 0 : limb - textb;
|
||||
|
||||
if (key->skipeblanks)
|
||||
{
|
||||
@@ -1167,7 +1181,7 @@ keycompare (const struct line *a, const struct line *b)
|
||||
{
|
||||
char *copy_a = (char *) alloca (lena + 1 + lenb + 1);
|
||||
char *copy_b = copy_a + lena + 1;
|
||||
int new_len_a, new_len_b, i;
|
||||
size_t new_len_a, new_len_b, i;
|
||||
|
||||
/* Ignore and/or translate chars before comparing. */
|
||||
for (new_len_a = new_len_b = i = 0; i < max (lena, lenb); i++)
|
||||
@@ -1193,7 +1207,7 @@ keycompare (const struct line *a, const struct line *b)
|
||||
diff = memcoll (copy_a, new_len_a, copy_b, new_len_b);
|
||||
}
|
||||
else if (lena == 0)
|
||||
diff = -lenb;
|
||||
diff = - NONZERO (lenb);
|
||||
else if (lenb == 0)
|
||||
goto greater;
|
||||
else
|
||||
@@ -1231,7 +1245,7 @@ keycompare (const struct line *a, const struct line *b)
|
||||
CMP_WITH_IGNORE (UCHAR (*texta), UCHAR (*textb));
|
||||
}
|
||||
else if (lena == 0)
|
||||
diff = -lenb;
|
||||
diff = - NONZERO (lenb);
|
||||
else if (lenb == 0)
|
||||
goto greater;
|
||||
else
|
||||
@@ -1252,7 +1266,7 @@ keycompare (const struct line *a, const struct line *b)
|
||||
if (diff)
|
||||
goto not_equal;
|
||||
}
|
||||
diff = lena - lenb;
|
||||
diff = lena < lenb ? -1 : lena != lenb;
|
||||
}
|
||||
|
||||
if (diff)
|
||||
@@ -1263,12 +1277,12 @@ keycompare (const struct line *a, const struct line *b)
|
||||
break;
|
||||
|
||||
/* Find the beginning and limit of the next field. */
|
||||
if (key->eword >= 0)
|
||||
if (key->eword != -1)
|
||||
lima = limfield (a, key), limb = limfield (b, key);
|
||||
else
|
||||
lima = a->text + a->length - 1, limb = b->text + b->length - 1;
|
||||
|
||||
if (key->sword >= 0)
|
||||
if (key->sword != -1)
|
||||
texta = begfield (a, key), textb = begfield (b, key);
|
||||
else
|
||||
{
|
||||
@@ -1297,7 +1311,8 @@ keycompare (const struct line *a, const struct line *b)
|
||||
static int
|
||||
compare (register const struct line *a, register const struct line *b)
|
||||
{
|
||||
int diff, alen, blen;
|
||||
int diff;
|
||||
size_t alen, blen;
|
||||
|
||||
/* First try to compare on the specified keys (if any).
|
||||
The only two cases with no key at all are unadorned sort,
|
||||
@@ -1315,23 +1330,23 @@ compare (register const struct line *a, register const struct line *b)
|
||||
alen = a->length - 1, blen = b->length - 1;
|
||||
|
||||
if (alen == 0)
|
||||
diff = - blen;
|
||||
diff = - NONZERO (blen);
|
||||
else if (blen == 0)
|
||||
diff = alen;
|
||||
diff = NONZERO (alen);
|
||||
#ifdef ENABLE_NLS
|
||||
else if (hard_LC_COLLATE)
|
||||
diff = memcoll (a->text, alen, b->text, blen);
|
||||
#endif
|
||||
else if (! (diff = memcmp (a->text, b->text, min (alen, blen))))
|
||||
diff = alen - blen;
|
||||
diff = alen < blen ? -1 : alen != blen;
|
||||
|
||||
return reverse ? -diff : diff;
|
||||
}
|
||||
|
||||
/* Check that the lines read from the given FP come in order. Print a
|
||||
diagnostic (FILE_NAME, line number, contents of line) to stderr and return
|
||||
the line number of the first out-of-order line (counting from 1) if they
|
||||
are not in order. Otherwise, print no diagnostic and return zero. */
|
||||
one if they are not in order. Otherwise, print no diagnostic
|
||||
and return zero. */
|
||||
|
||||
static int
|
||||
checkfp (FILE *fp, const char *file_name)
|
||||
@@ -1339,11 +1354,11 @@ checkfp (FILE *fp, const char *file_name)
|
||||
struct buffer buf; /* Input buffer. */
|
||||
struct lines lines; /* Lines scanned from the buffer. */
|
||||
struct line temp; /* Copy of previous line. */
|
||||
int cc; /* Character count. */
|
||||
int alloc;
|
||||
int line_number = 1;
|
||||
size_t cc; /* Character count. */
|
||||
size_t alloc;
|
||||
uintmax_t line_number = 1;
|
||||
struct line *disorder_line IF_LINT (= NULL);
|
||||
int disorder_line_number = 0;
|
||||
uintmax_t disorder_line_number = 0;
|
||||
struct keyfield *key = keylist;
|
||||
|
||||
initbuf (&buf, mergealloc);
|
||||
@@ -1362,16 +1377,16 @@ checkfp (FILE *fp, const char *file_name)
|
||||
{
|
||||
struct line *prev_line; /* Pointer to previous line. */
|
||||
int cmp; /* Result of calling compare. */
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
/* Compare each line in the buffer with its successor. */
|
||||
for (i = 0; i < lines.used - 1; ++i)
|
||||
for (i = 1; i < lines.used; ++i)
|
||||
{
|
||||
cmp = compare (&lines.lines[i], &lines.lines[i + 1]);
|
||||
cmp = compare (&lines.lines[i - 1], &lines.lines[i]);
|
||||
if ((unique && cmp >= 0) || (cmp > 0))
|
||||
{
|
||||
disorder_line = &lines.lines[i + 1];
|
||||
disorder_line_number = line_number + i + 1;
|
||||
disorder_line = &lines.lines[i];
|
||||
disorder_line_number = line_number + i;
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
@@ -1382,8 +1397,14 @@ checkfp (FILE *fp, const char *file_name)
|
||||
prev_line = lines.lines + (lines.used - 1);
|
||||
if (alloc < prev_line->length)
|
||||
{
|
||||
while ((alloc *= 2) < prev_line->length)
|
||||
continue;
|
||||
do
|
||||
{
|
||||
if (alloc * 2 < alloc)
|
||||
xalloc_die ();
|
||||
alloc *= 2;
|
||||
}
|
||||
while (alloc < prev_line->length);
|
||||
|
||||
temp.text = xrealloc (temp.text, alloc);
|
||||
}
|
||||
memcpy (temp.text, prev_line->text, prev_line->length);
|
||||
@@ -1415,8 +1436,9 @@ finish:
|
||||
|
||||
if (disorder_line_number)
|
||||
{
|
||||
fprintf (stderr, _("%s: %s:%d: disorder: "), program_name, file_name,
|
||||
disorder_line_number);
|
||||
char hr_buf[LONGEST_HUMAN_READABLE + 1];
|
||||
fprintf (stderr, _("%s: %s:%s: disorder: "), program_name, file_name,
|
||||
human_readable (disorder_line_number, hr_buf, 1, 1));
|
||||
write_bytes (disorder_line->text, disorder_line->length, stderr,
|
||||
_("standard error"));
|
||||
}
|
||||
@@ -1424,7 +1446,7 @@ finish:
|
||||
free (buf.buf);
|
||||
free ((char *) lines.lines);
|
||||
free (temp.text);
|
||||
return disorder_line_number;
|
||||
return NONZERO (disorder_line_number);
|
||||
}
|
||||
|
||||
/* Merge lines from FPS onto OFP. NFPS cannot be greater than NMERGE.
|
||||
@@ -1438,8 +1460,8 @@ mergefps (FILE **fps, register int nfps, FILE *ofp, const char *output_file)
|
||||
struct line saved; /* Saved line storage for unique check. */
|
||||
struct line const *savedline IF_LINT (= NULL);
|
||||
/* &saved if there is a saved line. */
|
||||
int savealloc IF_LINT (= 0); /* Size allocated for the saved line. */
|
||||
int cur[NMERGE]; /* Current line in each line table. */
|
||||
size_t savealloc IF_LINT (= 0); /* Size allocated for the saved line. */
|
||||
size_t cur[NMERGE]; /* Current line in each line table. */
|
||||
int ord[NMERGE]; /* Table representing a permutation of fps,
|
||||
such that lines[ord[0]].lines[cur[ord[0]]]
|
||||
is the smallest line and will be next
|
||||
@@ -1584,10 +1606,10 @@ mergefps (FILE **fps, register int nfps, FILE *ofp, const char *output_file)
|
||||
/* Sort the array LINES with NLINES members, using TEMP for temporary space. */
|
||||
|
||||
static void
|
||||
sortlines (struct line *lines, int nlines, struct line *temp)
|
||||
sortlines (struct line *lines, size_t nlines, struct line *temp)
|
||||
{
|
||||
register struct line *lo, *hi, *t;
|
||||
register int nlo, nhi;
|
||||
register size_t nlo, nhi;
|
||||
|
||||
if (nlines == 2)
|
||||
{
|
||||
@@ -1637,10 +1659,7 @@ check (char **files, int nfiles)
|
||||
for (i = 0; i < nfiles; ++i)
|
||||
{
|
||||
fp = xfopen (files[i], "r");
|
||||
if (checkfp (fp, files[i]))
|
||||
{
|
||||
++disorders;
|
||||
}
|
||||
disorders += checkfp (fp, files[i]);
|
||||
}
|
||||
return disorders;
|
||||
}
|
||||
@@ -1693,8 +1712,8 @@ sort (char **files, int nfiles, FILE *ofp, const char *output_file)
|
||||
{
|
||||
struct buffer buf;
|
||||
struct lines lines;
|
||||
struct line *tmp;
|
||||
int i, ntmp;
|
||||
struct line *tmp = NULL;
|
||||
size_t ntmp = 0;
|
||||
FILE *fp, *tfp;
|
||||
struct tempnode *node;
|
||||
int n_temp_files = 0;
|
||||
@@ -1703,8 +1722,6 @@ sort (char **files, int nfiles, FILE *ofp, const char *output_file)
|
||||
initbuf (&buf, sortalloc);
|
||||
initlines (&lines, sortalloc / linelength + 1,
|
||||
LINEALLOC / sizeof (struct line));
|
||||
ntmp = lines.alloc;
|
||||
tmp = (struct line *) xmalloc (ntmp * sizeof (struct line));
|
||||
|
||||
while (nfiles--)
|
||||
{
|
||||
@@ -1713,6 +1730,8 @@ sort (char **files, int nfiles, FILE *ofp, const char *output_file)
|
||||
fp = xfopen (*files++, "r");
|
||||
while (fillbuf (&buf, fp))
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (nfiles && buf.used != buf.alloc && feof (fp))
|
||||
{
|
||||
/* End of file, but there is more input and buffer room.
|
||||
@@ -1725,8 +1744,13 @@ sort (char **files, int nfiles, FILE *ofp, const char *output_file)
|
||||
findlines (&buf, &lines);
|
||||
if (ntmp < lines.used)
|
||||
{
|
||||
while ((ntmp *= 2) < lines.used)
|
||||
continue;
|
||||
if (ntmp == 0)
|
||||
ntmp = lines.used;
|
||||
else
|
||||
while ((ntmp *= 2) < lines.used)
|
||||
continue;
|
||||
if (SIZE_MAX / sizeof (struct line) < ntmp)
|
||||
xalloc_die ();
|
||||
tmp = (struct line *)
|
||||
xrealloc ((char *) tmp, ntmp * sizeof (struct line));
|
||||
}
|
||||
@@ -1758,8 +1782,8 @@ sort (char **files, int nfiles, FILE *ofp, const char *output_file)
|
||||
|
||||
if (n_temp_files)
|
||||
{
|
||||
int i = n_temp_files;
|
||||
tempfiles = (char **) xmalloc (n_temp_files * sizeof (char *));
|
||||
i = n_temp_files;
|
||||
for (node = temphead.next; i > 0; node = node->next)
|
||||
tempfiles[--i] = node->name;
|
||||
merge (tempfiles, n_temp_files, ofp, output_file);
|
||||
@@ -1786,6 +1810,39 @@ badfieldspec (const char *s)
|
||||
error (SORT_FAILURE, 0, _("invalid field specification `%s'"), s);
|
||||
}
|
||||
|
||||
/* Parse the leading integer in STRING and store the resulting value
|
||||
(which must fit into size_t) into *VAL. Return the address of the
|
||||
suffix after the integer. */
|
||||
static char const *
|
||||
parse_field_count (char const *string, size_t *val)
|
||||
{
|
||||
/* '@' can't possibly be a valid suffix; return &bad_suffix so that
|
||||
the caller will eventually invoke badfieldspec. */
|
||||
static char const invalid_suffix = '@';
|
||||
char *suffix;
|
||||
uintmax_t n;
|
||||
|
||||
switch (xstrtoumax (string, &suffix, 10, &n, ""))
|
||||
{
|
||||
case LONGINT_OK:
|
||||
case LONGINT_INVALID_SUFFIX_CHAR:
|
||||
*val = n;
|
||||
if (*val == n)
|
||||
break;
|
||||
/* Fall through. */
|
||||
case LONGINT_OVERFLOW:
|
||||
error (0, 0, _("count `%.*s' too large"),
|
||||
(int) (suffix - string), string);
|
||||
return &invalid_suffix;
|
||||
|
||||
case LONGINT_INVALID:
|
||||
error (0, 0, _("invalid count at start of `%s'"), string);
|
||||
return &invalid_suffix;
|
||||
}
|
||||
|
||||
return suffix;
|
||||
}
|
||||
|
||||
/* Handle interrupts and hangups. */
|
||||
|
||||
static void
|
||||
@@ -1864,10 +1921,11 @@ int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct keyfield *key = NULL, gkey;
|
||||
char *s;
|
||||
int i, t, t2;
|
||||
char const *s;
|
||||
int i;
|
||||
int checkonly = 0, mergeonly = 0, nfiles = 0;
|
||||
char *minus = "-", *outfile = minus, **files, *tmp;
|
||||
char *minus = "-", **files, *tmp;
|
||||
char const *outfile = minus;
|
||||
FILE *ofp;
|
||||
#ifdef SA_NOCLDSTOP
|
||||
struct sigaction oldact, newact;
|
||||
@@ -1965,18 +2023,10 @@ main (int argc, char **argv)
|
||||
s = argv[i] + 1;
|
||||
if (! (ISDIGIT (*s) || (*s == '.' && ISDIGIT (s[1]))))
|
||||
badfieldspec (argv[i]);
|
||||
for (t = 0; ISDIGIT (*s); ++s)
|
||||
t = 10 * t + *s - '0';
|
||||
t2 = 0;
|
||||
s = parse_field_count (s, &key->sword);
|
||||
if (*s == '.')
|
||||
for (++s; ISDIGIT (*s); ++s)
|
||||
t2 = 10 * t2 + *s - '0';
|
||||
if (t2 || t)
|
||||
{
|
||||
key->sword = t;
|
||||
key->schar = t2;
|
||||
}
|
||||
else
|
||||
s = parse_field_count (s + 1, &key->schar);
|
||||
if (! (key->sword | key->schar))
|
||||
key->sword = -1;
|
||||
s = set_ordering (s, key, bl_start);
|
||||
if (*s)
|
||||
@@ -1994,14 +2044,9 @@ main (int argc, char **argv)
|
||||
key specifiers,\nthe +POS specifier must come first"));
|
||||
usage (SORT_FAILURE);
|
||||
}
|
||||
for (t = 0; ISDIGIT (*s); ++s)
|
||||
t = t * 10 + *s - '0';
|
||||
t2 = 0;
|
||||
s = parse_field_count (s, &key->eword);
|
||||
if (*s == '.')
|
||||
for (++s; ISDIGIT (*s); ++s)
|
||||
t2 = t2 * 10 + *s - '0';
|
||||
key->eword = t;
|
||||
key->echar = t2;
|
||||
s = parse_field_count (s + 1, &key->echar);
|
||||
s = set_ordering (s, key, bl_end);
|
||||
if (*s)
|
||||
badfieldspec (argv[i]);
|
||||
@@ -2038,17 +2083,14 @@ key specifiers,\nthe +POS specifier must come first"));
|
||||
/* Get POS1. */
|
||||
if (!ISDIGIT (*s))
|
||||
badfieldspec (argv[i]);
|
||||
for (t = 0; ISDIGIT (*s); ++s)
|
||||
t = 10 * t + *s - '0';
|
||||
if (t == 0)
|
||||
s = parse_field_count (s, &key->sword);
|
||||
if (! key->sword--)
|
||||
{
|
||||
/* Provoke with `sort -k0' */
|
||||
error (0, 0, _("the starting field number argument \
|
||||
to the `-k' option must be positive"));
|
||||
badfieldspec (argv[i]);
|
||||
}
|
||||
--t;
|
||||
t2 = 0;
|
||||
if (*s == '.')
|
||||
{
|
||||
if (!ISDIGIT (s[1]))
|
||||
@@ -2058,23 +2100,16 @@ to the `-k' option must be positive"));
|
||||
lacks following character offset"));
|
||||
badfieldspec (argv[i]);
|
||||
}
|
||||
for (++s; ISDIGIT (*s); ++s)
|
||||
t2 = 10 * t2 + *s - '0';
|
||||
if (t2 == 0)
|
||||
s = parse_field_count (s + 1, &key->schar);
|
||||
if (! key->schar--)
|
||||
{
|
||||
/* Provoke with `sort -k1.0' */
|
||||
error (0, 0, _("starting field character offset \
|
||||
argument to the `-k' option\nmust be positive"));
|
||||
badfieldspec (argv[i]);
|
||||
}
|
||||
--t2;
|
||||
}
|
||||
if (t2 || t)
|
||||
{
|
||||
key->sword = t;
|
||||
key->schar = t2;
|
||||
}
|
||||
else
|
||||
if (! (key->sword | key->schar))
|
||||
key->sword = -1;
|
||||
s = set_ordering (s, key, bl_start);
|
||||
if (*s == 0)
|
||||
@@ -2096,17 +2131,14 @@ lacks following field spec"));
|
||||
badfieldspec (argv[i]);
|
||||
}
|
||||
/* Get POS2. */
|
||||
for (t = 0; ISDIGIT (*s); ++s)
|
||||
t = t * 10 + *s - '0';
|
||||
if (t == 0)
|
||||
s = parse_field_count (s, &key->eword);
|
||||
if (! key->eword--)
|
||||
{
|
||||
/* Provoke with `sort -k1,0' */
|
||||
error (0, 0, _("ending field number argument \
|
||||
to the `-k' option must be positive"));
|
||||
badfieldspec (argv[i]);
|
||||
}
|
||||
--t;
|
||||
t2 = 0;
|
||||
if (*s == '.')
|
||||
{
|
||||
if (!ISDIGIT (s[1]))
|
||||
@@ -2116,16 +2148,13 @@ to the `-k' option must be positive"));
|
||||
but lacks following character offset"));
|
||||
badfieldspec (argv[i]);
|
||||
}
|
||||
for (++s; ISDIGIT (*s); ++s)
|
||||
t2 = t2 * 10 + *s - '0';
|
||||
s = parse_field_count (s + 1, &key->echar);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* `-k 2,3' is equivalent to `+1 -3'. */
|
||||
++t;
|
||||
key->eword++;
|
||||
}
|
||||
key->eword = t;
|
||||
key->echar = t2;
|
||||
s = set_ordering (s, key, bl_end);
|
||||
if (*s)
|
||||
badfieldspec (argv[i]);
|
||||
@@ -2242,9 +2271,14 @@ but lacks following character offset"));
|
||||
|
||||
if (checkonly)
|
||||
{
|
||||
if (nfiles > 1)
|
||||
error (SORT_FAILURE, 0,
|
||||
_("too many arguments; with -c, there may be at most\
|
||||
one file argument"));
|
||||
|
||||
/* POSIX requires that sort return 1 IFF invoked with -c and the
|
||||
input is not properly sorted. */
|
||||
exit (check (files, nfiles) == 0 ? 0 : 1);
|
||||
exit (check (files, nfiles) == 0 ? EXIT_SUCCESS : SORT_OUT_OF_ORDER);
|
||||
}
|
||||
|
||||
if (!STREQ (outfile, "-"))
|
||||
|
||||
32
src/sys2.h
32
src/sys2.h
@@ -126,7 +126,7 @@
|
||||
#define CHMOD_MODE_BITS \
|
||||
(S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
|
||||
|
||||
#if ST_MTIM_NSEC
|
||||
#ifdef ST_MTIM_NSEC
|
||||
# define ST_TIME_CMP_NS(a, b, ns) ((a).ns < (b).ns ? -1 : (a).ns > (b).ns)
|
||||
#else
|
||||
# define ST_TIME_CMP_NS(a, b, ns) 0
|
||||
@@ -167,6 +167,10 @@ char *alloca ();
|
||||
# include <sys/exceptn.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
/* Jim Meyering writes:
|
||||
@@ -427,8 +431,14 @@ char *base_name PARAMS ((char const *));
|
||||
|
||||
/* Factor out some of the common --help and --version processing code. */
|
||||
|
||||
#define GETOPT_HELP_CHAR 250
|
||||
#define GETOPT_VERSION_CHAR 251
|
||||
/* These enum values cannot possibly conflict with the option values
|
||||
ordinarily used by commands, including CHAR_MAX + 1, etc. Avoid
|
||||
CHAR_MIN - 1, as it may equal -1, the getopt end-of-options value. */
|
||||
enum
|
||||
{
|
||||
GETOPT_HELP_CHAR = (CHAR_MIN - 2),
|
||||
GETOPT_VERSION_CHAR = (CHAR_MIN - 3)
|
||||
};
|
||||
|
||||
#define GETOPT_HELP_OPTION_DECL \
|
||||
"help", no_argument, 0, GETOPT_HELP_CHAR
|
||||
@@ -513,6 +523,18 @@ char *base_name PARAMS ((char const *));
|
||||
# define ULONG_MAX TYPE_MAXIMUM (unsigned long)
|
||||
#endif
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
# define SIZE_MAX TYPE_MAXIMUM (size_t)
|
||||
#endif
|
||||
|
||||
#ifndef OFF_T_MIN
|
||||
# define OFF_T_MIN TYPE_MINIMUM (off_t)
|
||||
#endif
|
||||
|
||||
#ifndef OFF_T_MAX
|
||||
# define OFF_T_MAX TYPE_MAXIMUM (off_t)
|
||||
#endif
|
||||
|
||||
#ifndef UID_T_MAX
|
||||
# define UID_T_MAX TYPE_MAXIMUM (uid_t)
|
||||
#endif
|
||||
@@ -525,6 +547,10 @@ char *base_name PARAMS ((char const *));
|
||||
# define PID_T_MAX TYPE_MAXIMUM (pid_t)
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
/* Use this to suppress gcc's `...may be used before initialized' warnings. */
|
||||
#ifdef lint
|
||||
# define IF_LINT(Code) Code
|
||||
|
||||
33
src/tail.c
33
src/tail.c
@@ -44,14 +44,6 @@
|
||||
#define AUTHORS \
|
||||
"Paul Rubin, David MacKenzie, Ian Lance Taylor, and Jim Meyering"
|
||||
|
||||
#ifndef OFF_T_MIN
|
||||
# define OFF_T_MIN TYPE_MINIMUM (off_t)
|
||||
#endif
|
||||
|
||||
#ifndef OFF_T_MAX
|
||||
# define OFF_T_MAX TYPE_MAXIMUM (off_t)
|
||||
#endif
|
||||
|
||||
#ifndef ENOSYS
|
||||
/* Some systems don't have ENOSYS -- this should be a big enough
|
||||
value that no valid errno value will match it. */
|
||||
@@ -1145,6 +1137,9 @@ tail_file (struct File_spec *f, off_t n_units)
|
||||
{
|
||||
f->fd = -1;
|
||||
f->errnum = errno;
|
||||
f->ignore = 0;
|
||||
f->ino = 0;
|
||||
f->dev = 0;
|
||||
}
|
||||
error (0, errno, "%s", pretty_name (f));
|
||||
errors = 1;
|
||||
@@ -1382,8 +1377,8 @@ parse_options (int argc, char **argv,
|
||||
|
||||
{
|
||||
strtol_error s_err;
|
||||
unsigned long int tmp_ulong;
|
||||
s_err = xstrtoul (optarg, NULL, 10, &tmp_ulong, "bkm");
|
||||
uintmax_t n;
|
||||
s_err = xstrtoumax (optarg, NULL, 10, &n, "bkm");
|
||||
if (s_err == LONGINT_INVALID)
|
||||
{
|
||||
error (EXIT_FAILURE, 0, "%s: %s", optarg,
|
||||
@@ -1391,14 +1386,16 @@ parse_options (int argc, char **argv,
|
||||
? _("invalid number of lines")
|
||||
: _("invalid number of bytes")));
|
||||
}
|
||||
if (s_err != LONGINT_OK || tmp_ulong > OFF_T_MAX)
|
||||
{
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("%s: %s is so large that it is not representable"),
|
||||
optarg,
|
||||
c == 'n' ? _("number of lines") : _("number of bytes"));
|
||||
}
|
||||
*n_units = (off_t) tmp_ulong;
|
||||
|
||||
if (s_err != LONGINT_OK)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("%s: is so large that it is not representable"), optarg);
|
||||
|
||||
if (OFF_T_MAX < n)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("%s is larger than the maximum file size on this system"),
|
||||
optarg);
|
||||
*n_units = (off_t) n;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -334,7 +334,9 @@ main (int argc, char **argv)
|
||||
date_set++;
|
||||
}
|
||||
|
||||
if (!date_set && optind < argc && !STREQ (argv[optind - 1], "--"))
|
||||
/* The obsolescent `MMDDhhmm[YY]' form is valid IFF there are
|
||||
two or more non-option arguments. */
|
||||
if (!date_set && 2 <= argc - optind && !STREQ (argv[optind - 1], "--"))
|
||||
{
|
||||
newtime = posixtime (argv[optind], PDS_TRAILING_YEAR);
|
||||
if (newtime != (time_t) -1)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
|
||||
#include "error.h"
|
||||
#include "long-options.h"
|
||||
#include "readutmp.h"
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
|
||||
#include "error.h"
|
||||
#include "long-options.h"
|
||||
#include "readutmp.h"
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
|
||||
15
src/wc.c
15
src/wc.c
@@ -26,11 +26,6 @@
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "human.h"
|
||||
#include "safe-read.h"
|
||||
|
||||
/* Get mbstate_t, mbrtowc(), wcwidth(). */
|
||||
#if HAVE_WCHAR_H
|
||||
@@ -45,6 +40,16 @@
|
||||
# define iswprint(wc) 1
|
||||
#endif
|
||||
|
||||
/* Include this after wctype.h so that we `#undef' ISPRINT
|
||||
(from Solaris's euc.h, from widec.h, from wctype.h) before
|
||||
redefining and using it. */
|
||||
#include "system.h"
|
||||
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "human.h"
|
||||
#include "safe-read.h"
|
||||
|
||||
/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
|
||||
#if HAVE_MBRTOWC && defined mbstate_t
|
||||
# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
|
||||
|
||||
@@ -28,9 +28,11 @@
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
|
||||
#include "error.h"
|
||||
#include "readutmp.h"
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
|
||||
@@ -46,7 +46,12 @@ usage (int status)
|
||||
program_name);
|
||||
else
|
||||
{
|
||||
printf (_("Usage: %s [OPTION]... [STRING]...\n"), program_name);
|
||||
printf (_("\
|
||||
Usage: %s [STRING]...\n\
|
||||
or: %s OPTION\n\
|
||||
"),
|
||||
program_name, program_name);
|
||||
|
||||
printf (_("\
|
||||
Repeatedly output a line with all specified STRING(s), or `y'.\n\
|
||||
\n\
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user