mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
623 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3dcf7a4d23 | ||
|
|
eeeccb3d0f | ||
|
|
6fa5f12107 | ||
|
|
d99c479311 | ||
|
|
9f39fa8559 | ||
|
|
00f84872e4 | ||
|
|
a8fde98844 | ||
|
|
e412e5cb49 | ||
|
|
e65d0d0525 | ||
|
|
9b6538aa8d | ||
|
|
843a0f1a23 | ||
|
|
22fa69e27d | ||
|
|
c04cb1274c | ||
|
|
b102ed9ba6 | ||
|
|
9b4aa5e268 | ||
|
|
53191d01e2 | ||
|
|
26559b513d | ||
|
|
b498eb071d | ||
|
|
991a1d6de9 | ||
|
|
2827bb5704 | ||
|
|
d1df6ef183 | ||
|
|
e45c9a02a4 | ||
|
|
1f95a45099 | ||
|
|
143bfd67c9 | ||
|
|
0b47305caa | ||
|
|
25bbb44dbb | ||
|
|
25507a54f7 | ||
|
|
8e6a68e2fd | ||
|
|
5b86dc69d7 | ||
|
|
f31ea18146 | ||
|
|
8f7fae5972 | ||
|
|
e6d2d94794 | ||
|
|
fd53921a68 | ||
|
|
20d523bfa2 | ||
|
|
bd23509bef | ||
|
|
a4780e67f4 | ||
|
|
b581752137 | ||
|
|
558525592b | ||
|
|
ba5a1036f1 | ||
|
|
d16b4760d7 | ||
|
|
98aec338ef | ||
|
|
ebb9617fde | ||
|
|
c160afe902 | ||
|
|
cf0bb5e05d | ||
|
|
20dc2a6a61 | ||
|
|
1644e58905 | ||
|
|
55efc5f3ee | ||
|
|
93f6771e82 | ||
|
|
83244ba312 | ||
|
|
df2e983677 | ||
|
|
97d21865fb | ||
|
|
a4053c5291 | ||
|
|
85507b24f9 | ||
|
|
19a0b6be60 | ||
|
|
51b88670cb | ||
|
|
4f526d2d64 | ||
|
|
02c3dc9de8 | ||
|
|
8b638f994a | ||
|
|
5d71171e01 | ||
|
|
c763b485f5 | ||
|
|
0d61f144a3 | ||
|
|
826095ffad | ||
|
|
cb0d71399c | ||
|
|
59cec5af12 | ||
|
|
ce9c2c64de | ||
|
|
2b1e6636be | ||
|
|
8c4f28b124 | ||
|
|
0433f90e3d | ||
|
|
1c7d5b5847 | ||
|
|
6449370e9e | ||
|
|
ebfbdf9f0e | ||
|
|
2d10b7617b | ||
|
|
14cdeddbf3 | ||
|
|
2209d10f4c | ||
|
|
18332a65af | ||
|
|
17b18bfa6c | ||
|
|
eb1e30c213 | ||
|
|
d88c9f95e3 | ||
|
|
b50a4ae557 | ||
|
|
3a914fa76d | ||
|
|
224a69b56b | ||
|
|
9a2a8f0b3e | ||
|
|
3f1579c470 | ||
|
|
bba5a47651 | ||
|
|
ca4e48f822 | ||
|
|
3a8d16800c | ||
|
|
de13679b32 | ||
|
|
f7da3f1c10 | ||
|
|
9bde4fd426 | ||
|
|
359c48d5c6 | ||
|
|
74ba433a14 | ||
|
|
c980b0566a | ||
|
|
31896c21c6 | ||
|
|
773a88d33f | ||
|
|
cd78f85b0b | ||
|
|
2061cd8aa6 | ||
|
|
0c91ae335d | ||
|
|
0e40e9de57 | ||
|
|
0a3f944791 | ||
|
|
fa391362e1 | ||
|
|
8c243ff965 | ||
|
|
86cef85b36 | ||
|
|
65ba955988 | ||
|
|
dac5f12c6e | ||
|
|
26d3d090bd | ||
|
|
1eaacac312 | ||
|
|
5d0b158f4c | ||
|
|
982504452d | ||
|
|
48cae1e864 | ||
|
|
022889a457 | ||
|
|
adc62b5d9f | ||
|
|
1f4fcd083d | ||
|
|
9c8e4f6918 | ||
|
|
ed85df444a | ||
|
|
0dc4478f13 | ||
|
|
8ed84c3438 | ||
|
|
c55c0e7369 | ||
|
|
e3e9713fad | ||
|
|
6b8578af5e | ||
|
|
04d49874a2 | ||
|
|
18810ae65f | ||
|
|
d3dcb10f90 | ||
|
|
52b4d2a51a | ||
|
|
2b32399fdc | ||
|
|
44421c22a3 | ||
|
|
61a42e3743 | ||
|
|
60ca9e1599 | ||
|
|
0889381cbf | ||
|
|
1bdf77ad52 | ||
|
|
05a50b7848 | ||
|
|
2f61473e85 | ||
|
|
460ebb078e | ||
|
|
0d5508de13 | ||
|
|
ddf56e0440 | ||
|
|
2fbee63cc9 | ||
|
|
b27275c668 | ||
|
|
016f8c9998 | ||
|
|
10f3e12a0d | ||
|
|
83ae1bdd44 | ||
|
|
2a8f5104cd | ||
|
|
065f14f471 | ||
|
|
9a45c19667 | ||
|
|
f6240c49df | ||
|
|
b52a88607f | ||
|
|
f15842de47 | ||
|
|
c926d002b5 | ||
|
|
31b6c0489a | ||
|
|
a488f288a2 | ||
|
|
a7592cfcb2 | ||
|
|
3288ebb0d7 | ||
|
|
9934f50282 | ||
|
|
46d6df933e | ||
|
|
7b1967351c | ||
|
|
d01338eb3d | ||
|
|
a99c35b04d | ||
|
|
5e3a5ae519 | ||
|
|
1fd718e93c | ||
|
|
972967903d | ||
|
|
e0035fa4eb | ||
|
|
99be907838 | ||
|
|
1ead085826 | ||
|
|
695682d514 | ||
|
|
442d63051c | ||
|
|
7fc5292a29 | ||
|
|
cf5616a0aa | ||
|
|
13601dd3cf | ||
|
|
1ee192a9ff | ||
|
|
cbecb8cab8 | ||
|
|
fb992bae4c | ||
|
|
ac9e4915ad | ||
|
|
92465d59c6 | ||
|
|
921feefb12 | ||
|
|
0c65638b0f | ||
|
|
5c065bb0cb | ||
|
|
680afe6751 | ||
|
|
0fcf730104 | ||
|
|
f144582e17 | ||
|
|
9a913a2461 | ||
|
|
317d2c6384 | ||
|
|
292d68565a | ||
|
|
c352bb469d | ||
|
|
22a2a43021 | ||
|
|
4000c35ae3 | ||
|
|
99eccc3359 | ||
|
|
9965d234e5 | ||
|
|
a011b01af1 | ||
|
|
28fbe5a487 | ||
|
|
9b8023e69c | ||
|
|
b8497a3a7a | ||
|
|
c2e56e0de7 | ||
|
|
031e2fb5e9 | ||
|
|
e181802521 | ||
|
|
c58b5daa33 | ||
|
|
80325aca2d | ||
|
|
d3b5555f10 | ||
|
|
ca738e4414 | ||
|
|
21eb87e6ea | ||
|
|
7ef56a26fd | ||
|
|
aa2617b908 | ||
|
|
016958f2f0 | ||
|
|
1ce9d86c30 | ||
|
|
00b5a2db33 | ||
|
|
e34894bf3f | ||
|
|
b14e5c40b9 | ||
|
|
90f74735aa | ||
|
|
d6a62182f0 | ||
|
|
847ab6a518 | ||
|
|
b5b3690d06 | ||
|
|
57e2022b8d | ||
|
|
be6b4218e4 | ||
|
|
48a05a9ce9 | ||
|
|
fc3b301d4f | ||
|
|
c7e971bee0 | ||
|
|
b0312caf6f | ||
|
|
1c318d52de | ||
|
|
186b655094 | ||
|
|
8333cc3c0f | ||
|
|
c27c4a0957 | ||
|
|
a5e53ecc2c | ||
|
|
d5ab05998c | ||
|
|
a2be861b04 | ||
|
|
fbd87029cf | ||
|
|
3ece0355d5 | ||
|
|
1760ade090 | ||
|
|
ed017d44b2 | ||
|
|
8b09875b59 | ||
|
|
4e38e6a19c | ||
|
|
b3e779c090 | ||
|
|
17409787bb | ||
|
|
ac819e1044 | ||
|
|
36eb45201f | ||
|
|
b43255473f | ||
|
|
90a83264b9 | ||
|
|
43448b0493 | ||
|
|
854284f788 | ||
|
|
0e2ac2de24 | ||
|
|
03911ef780 | ||
|
|
32d4d0dd5e | ||
|
|
cfa2120e83 | ||
|
|
1c5e5d6277 | ||
|
|
41ec3548b0 | ||
|
|
5b27ec57b0 | ||
|
|
1e48b1fee5 | ||
|
|
5dc070cc86 | ||
|
|
b4ec994b26 | ||
|
|
2bf151cd93 | ||
|
|
153477479a | ||
|
|
fec0e89c20 | ||
|
|
407e8f0fdd | ||
|
|
461231f022 | ||
|
|
b705e9a9e7 | ||
|
|
b3677e5e38 | ||
|
|
cc0f637b6d | ||
|
|
7920f2c14a | ||
|
|
99f4994982 | ||
|
|
5afac2aee1 | ||
|
|
aa67daf63b | ||
|
|
f7a009c17c | ||
|
|
028e12ce3b | ||
|
|
f3f1ccfd87 | ||
|
|
08c38ab7cb | ||
|
|
d60e33e241 | ||
|
|
31a884dab7 | ||
|
|
74443830ea | ||
|
|
2ae61facc7 | ||
|
|
bb7fa1e932 | ||
|
|
16c8062085 | ||
|
|
17278118ee | ||
|
|
7f6fb43e7d | ||
|
|
ddc409b59e | ||
|
|
7eb3aab88b | ||
|
|
4fb3704c25 | ||
|
|
514b7fbc00 | ||
|
|
555c219d9e | ||
|
|
59964c164b | ||
|
|
7377f49ea8 | ||
|
|
969841cb77 | ||
|
|
c3e1fe230b | ||
|
|
1833a876ae | ||
|
|
0f5695bd59 | ||
|
|
42df6d7de2 | ||
|
|
9c0c57a1b4 | ||
|
|
a36f4cb451 | ||
|
|
ed0a1c9f94 | ||
|
|
f9da2d0e87 | ||
|
|
42285406aa | ||
|
|
5149348906 | ||
|
|
fbc5aa7c47 | ||
|
|
15f4d612df | ||
|
|
e505736f82 | ||
|
|
7eb15e1020 | ||
|
|
ef13885b37 | ||
|
|
0628b73f35 | ||
|
|
dafbd407bc | ||
|
|
94c59c97f9 | ||
|
|
ab02e256e9 | ||
|
|
0eff09dfcf | ||
|
|
0482f193b5 | ||
|
|
cfe3602ad6 | ||
|
|
cee53c1430 | ||
|
|
0643c51cab | ||
|
|
b616886492 | ||
|
|
58aaf71f07 | ||
|
|
24412edeaf | ||
|
|
a5111af33e | ||
|
|
1e3ebd660a | ||
|
|
2f706199d0 | ||
|
|
e13188e7ef | ||
|
|
2a4dcb627e | ||
|
|
13a2025998 | ||
|
|
9a33347007 | ||
|
|
e916c8ff05 | ||
|
|
beaee48f26 | ||
|
|
2643b4b77d | ||
|
|
8c4a656fad | ||
|
|
fec05eb377 | ||
|
|
6d5bf36d5c | ||
|
|
be11df4916 | ||
|
|
2f776f3096 | ||
|
|
13edec7c62 | ||
|
|
57622cac71 | ||
|
|
3b39aa796f | ||
|
|
a7ea04404c | ||
|
|
e34eb51728 | ||
|
|
771484f47a | ||
|
|
c7c961a3e5 | ||
|
|
4718a2fdf4 | ||
|
|
2298544c64 | ||
|
|
18efee4e2a | ||
|
|
f923ceceba | ||
|
|
e10e4b6697 | ||
|
|
cddcb5d468 | ||
|
|
3e8f9c8d35 | ||
|
|
ae1c205fc4 | ||
|
|
2221ea2c3a | ||
|
|
a06afbeec5 | ||
|
|
d9903062cf | ||
|
|
9dcebc51be | ||
|
|
1084bf78ea | ||
|
|
68561594ca | ||
|
|
22e5102f19 | ||
|
|
e4fa3e7808 | ||
|
|
737461d23f | ||
|
|
6b22726dd4 | ||
|
|
54281e9c60 | ||
|
|
ea2887bbe4 | ||
|
|
ef6a361a07 | ||
|
|
63a7120c28 | ||
|
|
5bf3e7ee96 | ||
|
|
0c1fc1c715 | ||
|
|
f03a67735a | ||
|
|
f325d180cf | ||
|
|
bfe4a55520 | ||
|
|
8ea96a5c90 | ||
|
|
f3574102d3 | ||
|
|
edd292f8d4 | ||
|
|
929479026b | ||
|
|
4c9fae4e97 | ||
|
|
a01c4720d6 | ||
|
|
081ebb2822 | ||
|
|
22999697b8 | ||
|
|
7e0019b168 | ||
|
|
64c25ed741 | ||
|
|
d9c0881137 | ||
|
|
4290abda87 | ||
|
|
5a74a2d566 | ||
|
|
7ee3d2430a | ||
|
|
f0f6e14610 | ||
|
|
e4fd2bf4e6 | ||
|
|
18e2a330b9 | ||
|
|
4ebf956b4e | ||
|
|
0392142b87 | ||
|
|
127c689f64 | ||
|
|
baad54258d | ||
|
|
d3ad58376d | ||
|
|
a1cb30c1fb | ||
|
|
d7e2f425e7 | ||
|
|
4b5e044be3 | ||
|
|
43f66923cc | ||
|
|
cd1f4bc1ec | ||
|
|
b673a5b8ac | ||
|
|
2a2d3f237b | ||
|
|
0d279d2378 | ||
|
|
c339cff4a6 | ||
|
|
ae5ae5e117 | ||
|
|
f65cafd67b | ||
|
|
d9207b48a3 | ||
|
|
d7f79cf6cb | ||
|
|
8c3835bf93 | ||
|
|
273c10fc2c | ||
|
|
f4bffea5e9 | ||
|
|
6b9f1bdd66 | ||
|
|
ffc630e598 | ||
|
|
c4c3dbc024 | ||
|
|
110df929fc | ||
|
|
e3b5543ea8 | ||
|
|
84f6abfe00 | ||
|
|
00c6aacf31 | ||
|
|
8d974b00fb | ||
|
|
b44f5f74aa | ||
|
|
662ce25d83 | ||
|
|
0d75784da0 | ||
|
|
cbdcc9fb4e | ||
|
|
bee58d8a04 | ||
|
|
e535754fdb | ||
|
|
f674a10f7e | ||
|
|
4fff95cfe1 | ||
|
|
77d97a1be4 | ||
|
|
f82c5ba71e | ||
|
|
9bb0d5766e | ||
|
|
1ee81530c0 | ||
|
|
ecb0ea20ca | ||
|
|
9a221e27f5 | ||
|
|
4e6af68846 | ||
|
|
186b45aaed | ||
|
|
773be9eca8 | ||
|
|
8461d49df0 | ||
|
|
b1a1fcbf57 | ||
|
|
0fb0a03c5c | ||
|
|
63467fa187 | ||
|
|
5483165b12 | ||
|
|
9a4e22d036 | ||
|
|
bba4d3e054 | ||
|
|
760bc6f7e7 | ||
|
|
9396eb9037 | ||
|
|
8da8dfc470 | ||
|
|
1d9b3de948 | ||
|
|
f38003890b | ||
|
|
5b610a06b2 | ||
|
|
5cc42f7de6 | ||
|
|
0a98d79bd2 | ||
|
|
a676856285 | ||
|
|
e2dbcee444 | ||
|
|
8ce745dc61 | ||
|
|
1fcd8cf8b4 | ||
|
|
595fc63c42 | ||
|
|
58b2e1204a | ||
|
|
27311c9e85 | ||
|
|
556fbb5721 | ||
|
|
b1a1c9ee06 | ||
|
|
3d309aa725 | ||
|
|
4f4700cca8 | ||
|
|
2e6fa14d16 | ||
|
|
3ea1fe588e | ||
|
|
574f761403 | ||
|
|
c1aabf84e6 | ||
|
|
02bfd65480 | ||
|
|
2c88abe2a2 | ||
|
|
7d10e30088 | ||
|
|
61f94d4dbc | ||
|
|
a087f17a44 | ||
|
|
20905b0cdc | ||
|
|
322c6f2e5c | ||
|
|
3435bb7f40 | ||
|
|
96ae7199c4 | ||
|
|
a7a328af0f | ||
|
|
94cecb5cf6 | ||
|
|
58db1bb942 | ||
|
|
45e67188d6 | ||
|
|
3de1559830 | ||
|
|
956abf969c | ||
|
|
b1db942595 | ||
|
|
2cbbbf6319 | ||
|
|
837bb31803 | ||
|
|
44530f2ddd | ||
|
|
9823682c2f | ||
|
|
1463824d8e | ||
|
|
d42994df5d | ||
|
|
d7d80c5b7b | ||
|
|
20c0b8701f | ||
|
|
46a811b9e7 | ||
|
|
bbbc35c9ed | ||
|
|
c49b2e32bb | ||
|
|
b83c498809 | ||
|
|
6c79825ce9 | ||
|
|
3808eccbbf | ||
|
|
81d0c8f367 | ||
|
|
98a96822d9 | ||
|
|
5f47278372 | ||
|
|
47ed009e57 | ||
|
|
394f88c4aa | ||
|
|
8253a9aeb4 | ||
|
|
a16bee4f07 | ||
|
|
e63c9825da | ||
|
|
263bb1be67 | ||
|
|
23c2a0cbac | ||
|
|
252d6d01c9 | ||
|
|
6eec737ade | ||
|
|
68158e6b10 | ||
|
|
75e0047c4b | ||
|
|
74c0bfbc4c | ||
|
|
80213bc66d | ||
|
|
4b92612944 | ||
|
|
896b672499 | ||
|
|
1b0b6c8d08 | ||
|
|
cc4bdb92f9 | ||
|
|
0647f3eb5a | ||
|
|
77b1bfc85c | ||
|
|
434258ca73 | ||
|
|
eebe731014 | ||
|
|
91c1384602 | ||
|
|
265c4b83a8 | ||
|
|
4a510cd399 | ||
|
|
ecb67c8389 | ||
|
|
86535835fe | ||
|
|
01e6181965 | ||
|
|
8a4192d3c0 | ||
|
|
423f28be77 | ||
|
|
dd3612a12b | ||
|
|
3cafcf8584 | ||
|
|
4db4c2aa6d | ||
|
|
d81d2e0ba6 | ||
|
|
eba365275b | ||
|
|
eb4b2d462e | ||
|
|
72df741618 | ||
|
|
fc6827e2bb | ||
|
|
6c9b505329 | ||
|
|
9f678af5f3 | ||
|
|
8581bcc9e3 | ||
|
|
00a3098235 | ||
|
|
c6c9e8730e | ||
|
|
8976a2b27e | ||
|
|
87386cc8a9 | ||
|
|
545a116748 | ||
|
|
9d59509937 | ||
|
|
26552f2756 | ||
|
|
86837548f1 | ||
|
|
199d850038 | ||
|
|
581b2e3cee | ||
|
|
d8382a4d26 | ||
|
|
74a106985a | ||
|
|
be2abe31fd | ||
|
|
b69b4cca95 | ||
|
|
7855cbfcac | ||
|
|
29290d0485 | ||
|
|
3ceabe1bfc | ||
|
|
5e6a1837ea | ||
|
|
76367f06b3 | ||
|
|
c4a9551eee | ||
|
|
9300779cc8 | ||
|
|
878e51ebfa | ||
|
|
51243cdaca | ||
|
|
1081bbc74e | ||
|
|
ea54b6f47c | ||
|
|
4a4fe636dc | ||
|
|
c6a3937288 | ||
|
|
0bf3eb3682 | ||
|
|
513a235858 | ||
|
|
433881d802 | ||
|
|
295d47736a | ||
|
|
346dd8b5bf | ||
|
|
65d65fe094 | ||
|
|
a59258fbc7 | ||
|
|
b347377bd3 | ||
|
|
0fe9fc4558 | ||
|
|
15b0d75930 | ||
|
|
f0ad302ca9 | ||
|
|
28c9d4ecff | ||
|
|
ce7b12ef1b | ||
|
|
7fcb73cec0 | ||
|
|
6a9c6804dd | ||
|
|
7c9c6c7875 | ||
|
|
d3dc29c0be | ||
|
|
6ec3a4f033 | ||
|
|
7cc3733f29 | ||
|
|
e98006dde0 | ||
|
|
bc2b9e04e9 | ||
|
|
5ad6145142 | ||
|
|
2656da4705 | ||
|
|
3269104d17 | ||
|
|
f15e62d12e | ||
|
|
32b84c9c90 | ||
|
|
1f3e964802 | ||
|
|
62ebe4dabd | ||
|
|
cca51697aa | ||
|
|
22adc16d9c | ||
|
|
f375a52f51 | ||
|
|
eb62800728 | ||
|
|
f02102211e | ||
|
|
209850fd7e | ||
|
|
4d3bf408b9 | ||
|
|
2224ef83fe | ||
|
|
0b66c5776e | ||
|
|
c64411a38a | ||
|
|
fcd450ecb9 | ||
|
|
d701f6abb7 | ||
|
|
a892af0d48 | ||
|
|
e3171c43eb | ||
|
|
bbc49eb536 | ||
|
|
bbc0cb0f37 | ||
|
|
28f1b61e59 | ||
|
|
29a2fb3856 | ||
|
|
ed30cd94e3 | ||
|
|
eef629eea1 | ||
|
|
2f55920ffc | ||
|
|
d6ec836387 | ||
|
|
5a3b0c4805 | ||
|
|
972e2737ab | ||
|
|
816e56a3de | ||
|
|
bbafdc3c8f | ||
|
|
dfdb532fd3 | ||
|
|
53d8a2c412 | ||
|
|
427f179542 | ||
|
|
8dc387dba5 | ||
|
|
cca6a8d7e5 | ||
|
|
6bbbd65d89 | ||
|
|
d30ac3d321 | ||
|
|
37370a584c | ||
|
|
8657cf19e2 | ||
|
|
1a5b6e3a50 | ||
|
|
0a4a938b6b | ||
|
|
d9c1b8fd30 | ||
|
|
0bc8813b1e | ||
|
|
68466d44b1 | ||
|
|
79a98d9bc1 | ||
|
|
a6894d063c | ||
|
|
90bc2fe272 | ||
|
|
c51900a6bd | ||
|
|
b214b51ca0 | ||
|
|
512e111a92 | ||
|
|
d25bf9dceb | ||
|
|
fdb7e5b44c | ||
|
|
b29e812e82 |
7
.gitattributes
vendored
Normal file
7
.gitattributes
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
*.texi* diff=texinfo
|
||||
|
||||
# Put something like the following e.g., in your ~/.gitconfig file
|
||||
# # Include proper "function name" string in diffs of texinfo.
|
||||
# # Derived from the regexp in emacs' lisp/add-log.el.
|
||||
# [diff "texinfo"]
|
||||
# funcname = "^@node[ \t][ \t]*\\([^,][^,]*\\)"
|
||||
26
.gitignore
vendored
26
.gitignore
vendored
@@ -44,6 +44,7 @@ coreutils-*.tar.lzma.sig
|
||||
gnulib-tests
|
||||
lib/.cvsignore
|
||||
lib/.gitignore
|
||||
lib/arpa
|
||||
lib/binary-io.h
|
||||
lib/charset.alias
|
||||
lib/configmake.h
|
||||
@@ -52,6 +53,7 @@ lib/printf.c
|
||||
lib/progname.c
|
||||
lib/progname.h
|
||||
lib/selinux
|
||||
lib/uniwidth
|
||||
m4/.cvsignore
|
||||
m4/.gitignore
|
||||
po/*.gmo
|
||||
@@ -65,27 +67,7 @@ po/POTFILES
|
||||
po/checksums
|
||||
po/coreutils.pot
|
||||
po/stamp-po
|
||||
src/version.c
|
||||
src/version.h
|
||||
stamp-h1
|
||||
tests/*/*.log
|
||||
tests/cut/Makefile.am
|
||||
tests/cut/cut-tests
|
||||
tests/head/Makefile.am
|
||||
tests/head/head-tests
|
||||
tests/join/Makefile.am
|
||||
tests/join/join-tests
|
||||
tests/pr/Makefile.am
|
||||
tests/pr/pr-tests
|
||||
tests/sort/Makefile.am
|
||||
tests/sort/sort-tests
|
||||
tests/tac/Makefile.am
|
||||
tests/tac/tac-tests
|
||||
tests/tail/Makefile.am
|
||||
tests/tail/tail-tests
|
||||
tests/test/Makefile.am
|
||||
tests/test/test-tests
|
||||
tests/tr/Makefile.am
|
||||
tests/tr/tr-tests
|
||||
tests/uniq/Makefile.am
|
||||
tests/uniq/uniq-tests
|
||||
tests/wc/Makefile.am
|
||||
tests/wc/wc-tests
|
||||
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "gnulib"]
|
||||
path = gnulib
|
||||
url = git://git.sv.gnu.org/gnulib.git
|
||||
@@ -1 +1 @@
|
||||
6.10
|
||||
7.1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Suppress valgrind diagnostics we don't care about.
|
||||
|
||||
# Copyright (C) 2003, 2004, 2006-2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003, 2004, 2006-2008 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
|
||||
@@ -90,3 +90,11 @@
|
||||
fun:gobble_file
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
utimensat-NULL
|
||||
Memcheck:Param
|
||||
utimensat(filename)
|
||||
fun:futimens
|
||||
fun:gl_futimens
|
||||
fun:main
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
ChangeLog(-[0-9]+)?$
|
||||
^old/
|
||||
^src/c99-to-c98\.diff$
|
||||
^gl/.*
|
||||
1
.x-sc_error_message_uppercase
Normal file
1
.x-sc_error_message_uppercase
Normal file
@@ -0,0 +1 @@
|
||||
build-aux/cvsu
|
||||
1
.x-sc_po_check
Normal file
1
.x-sc_po_check
Normal file
@@ -0,0 +1 @@
|
||||
^gl/
|
||||
2
.x-sc_program_name
Normal file
2
.x-sc_program_name
Normal file
@@ -0,0 +1,2 @@
|
||||
gl/lib/randint.c
|
||||
lib/euidaccess-stat.c
|
||||
@@ -1,6 +1 @@
|
||||
ChangeLog
|
||||
^TODO$
|
||||
^lib/euidaccess-stat\.c$
|
||||
^maint\.mk$
|
||||
^doc/coreutils.texi$
|
||||
^tests/misc/stty-invalid$
|
||||
|
||||
4
.x-sc_prohibit_stat_st_blocks
Normal file
4
.x-sc_prohibit_stat_st_blocks
Normal file
@@ -0,0 +1,4 @@
|
||||
src/system.h
|
||||
tests/du/2g
|
||||
old/fileutils/ChangeLog-1997
|
||||
ChangeLog-2005
|
||||
@@ -1,2 +1 @@
|
||||
^src/system\.h
|
||||
ChangeLog
|
||||
|
||||
@@ -1,30 +1,9 @@
|
||||
^lib/at-func\.c$
|
||||
^lib/bcopy\.c$
|
||||
^lib/buffer-lcm\.c$
|
||||
^lib/c-strtold\.c$
|
||||
^lib/fnmatch_loop\.c$
|
||||
^lib/full-read\.c$
|
||||
^lib/imaxtostr\.c$
|
||||
^lib/mempcpy\.c$
|
||||
^lib/memset\.c$
|
||||
^lib/offtostr\.c$
|
||||
^lib/regcomp\.c$
|
||||
^lib/regex_internal\.c$
|
||||
^lib/regexec\.c$
|
||||
^lib/safe-write\.c$
|
||||
^lib/strtoll\.c$
|
||||
^lib/strtoul\.c$
|
||||
^lib/strtoull\.c$
|
||||
^lib/strtoumax\.c$
|
||||
^lib/umaxtostr\.c$
|
||||
^lib/xstrtold\.c$
|
||||
^lib/xstrtoul\.c$
|
||||
^src/false\.c$
|
||||
^src/lbracket\.c$
|
||||
^src/ls-dir\.c$
|
||||
^src/ls-ls\.c$
|
||||
^src/ls-vdir\.c$
|
||||
^src/rand-isaac\.c$
|
||||
^src/tac-pipe\.c$
|
||||
^src/uname-arch\.c$
|
||||
^src/uname-uname\.c$
|
||||
|
||||
9
.x-sc_require_config_h_first
Normal file
9
.x-sc_require_config_h_first
Normal file
@@ -0,0 +1,9 @@
|
||||
^lib/buffer-lcm\.c$
|
||||
^src/false\.c$
|
||||
^src/lbracket\.c$
|
||||
^src/ls-dir\.c$
|
||||
^src/ls-ls\.c$
|
||||
^src/ls-vdir\.c$
|
||||
^src/tac-pipe\.c$
|
||||
^src/uname-arch\.c$
|
||||
^src/uname-uname\.c$
|
||||
38
AUTHORS
38
AUTHORS
@@ -3,29 +3,29 @@ each followed by the name(s) of its author(s).
|
||||
|
||||
arch: David MacKenzie, Karel Zak
|
||||
base64: Simon Josefsson
|
||||
basename: FIXME unknown
|
||||
cat: Torbjorn Granlund, Richard M. Stallman
|
||||
basename: David MacKenzie
|
||||
cat: Torbjörn Granlund, Richard M. Stallman
|
||||
chcon: Russell Coker, Jim Meyering
|
||||
chgrp: David MacKenzie, Jim Meyering
|
||||
chmod: David MacKenzie, Jim Meyering
|
||||
chown: David MacKenzie, Jim Meyering
|
||||
chroot: Roland McGrath
|
||||
cksum: Q. Frank Xia
|
||||
comm: Richard Stallman, David MacKenzie
|
||||
cp: Torbjorn Granlund, David MacKenzie, Jim Meyering
|
||||
comm: Richard M. Stallman, David MacKenzie
|
||||
cp: Torbjörn Granlund, David MacKenzie, Jim Meyering
|
||||
csplit: Stuart Kemp, David MacKenzie
|
||||
cut: David Ihnat, David MacKenzie, Jim Meyering
|
||||
cut: David M. Ihnat, David MacKenzie, Jim Meyering
|
||||
date: David MacKenzie
|
||||
dd: Paul Rubin, David MacKenzie, Stuart Kemp
|
||||
df: Torbjorn Granlund, David MacKenzie, Paul Eggert
|
||||
dir: Richard Stallman, David MacKenzie
|
||||
df: Torbjörn Granlund, David MacKenzie, Paul Eggert
|
||||
dir: Richard M. Stallman, David MacKenzie
|
||||
dircolors: H. Peter Anvin
|
||||
dirname: David MacKenzie, Jim Meyering
|
||||
du: Torbjorn Granlund, David MacKenzie, Paul Eggert, Jim Meyering
|
||||
echo: FIXME unknown
|
||||
du: Torbjörn Granlund, David MacKenzie, Paul Eggert, Jim Meyering
|
||||
echo: Brian Fox, Chet Ramey
|
||||
env: Richard Mlynarik, David MacKenzie
|
||||
expand: David MacKenzie
|
||||
expr: Mike Parker
|
||||
expr: Mike Parker, James Youngman, Paul Eggert
|
||||
factor: Paul Rubin
|
||||
false: Jim Meyering
|
||||
fmt: Ross Paterson
|
||||
@@ -41,7 +41,7 @@ kill: Paul Eggert
|
||||
link: Michael Stone
|
||||
ln: Mike Parker, David MacKenzie
|
||||
logname: FIXME: unknown
|
||||
ls: Richard Stallman, David MacKenzie
|
||||
ls: Richard M. Stallman, David MacKenzie
|
||||
md5sum: Ulrich Drepper, Scott Miller, David Madore
|
||||
mkdir: David MacKenzie
|
||||
mkfifo: David MacKenzie
|
||||
@@ -58,10 +58,10 @@ pinky: Joseph Arceneaux, David MacKenzie, Kaveh Ghazi
|
||||
pr: Pete TerMaat, Roland Huebner
|
||||
printenv: David MacKenzie, Richard Mlynarik
|
||||
printf: David MacKenzie
|
||||
ptx: F. Pinard
|
||||
ptx: François Pinard
|
||||
pwd: Jim Meyering
|
||||
readlink: Dmitry V. Levin
|
||||
rm: Paul Rubin, David MacKenzie, Richard Stallman, Jim Meyering
|
||||
rm: Paul Rubin, David MacKenzie, Richard M. Stallman, Jim Meyering
|
||||
rmdir: David MacKenzie
|
||||
runcon: Russell Coker
|
||||
seq: Ulrich Drepper
|
||||
@@ -74,7 +74,7 @@ shred: Colin Plumb
|
||||
shuf: Paul Eggert
|
||||
sleep: Jim Meyering, Paul Eggert
|
||||
sort: Mike Haertel, Paul Eggert
|
||||
split: Torbjorn Granlund, Richard M. Stallman
|
||||
split: Torbjörn Granlund, Richard M. Stallman
|
||||
stat: Michael Meskes
|
||||
stty: David MacKenzie
|
||||
su: David MacKenzie
|
||||
@@ -84,19 +84,25 @@ tac: Jay Lepreau, David MacKenzie
|
||||
tail: Paul Rubin, David MacKenzie, Ian Lance Taylor, Jim Meyering
|
||||
tee: Mike Parker, Richard M. Stallman, David MacKenzie
|
||||
test: Kevin Braunsdorf, Matthew Bradburn
|
||||
timeout: Pádraig Brady
|
||||
touch: Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, Randy Smith
|
||||
tr: Jim Meyering
|
||||
true: Jim Meyering
|
||||
truncate: Pádraig Brady
|
||||
tsort: Mark Kettenis
|
||||
tty: David MacKenzie
|
||||
uname: David MacKenzie
|
||||
unexpand: David MacKenzie
|
||||
uniq: Richard Stallman, David MacKenzie
|
||||
uniq: Richard M. Stallman, David MacKenzie
|
||||
unlink: Michael Stone
|
||||
uptime: Joseph Arceneaux, David MacKenzie, Kaveh Ghazi
|
||||
users: Joseph Arceneaux, David MacKenzie
|
||||
vdir: Richard Stallman, David MacKenzie
|
||||
vdir: Richard M. Stallman, David MacKenzie
|
||||
wc: Paul Rubin, David MacKenzie
|
||||
who: Joseph Arceneaux, David MacKenzie, Michael Stone
|
||||
whoami: Richard Mlynarik
|
||||
yes: David MacKenzie
|
||||
|
||||
;; Local Variables:
|
||||
;; coding: utf-8
|
||||
;; End:
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2008-12-16 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
NB: ChangeLog files are no longer manually maintained.
|
||||
See HACKING for details.
|
||||
|
||||
2008-02-07 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
We *do* need two different version files.
|
||||
|
||||
180
HACKING
180
HACKING
@@ -26,11 +26,21 @@ That downloads the entire repository, including revision control history
|
||||
dating back to 1991. The repository (the part you download, and which
|
||||
resides in coreutils/.git) currently weighs in at about 30MB. So you
|
||||
don't want to download it more often than necessary. Once downloaded,
|
||||
you can get incremental updates by running this command from inside
|
||||
your new coreutils/ directory:
|
||||
you can get incremental updates by running one of these commands from
|
||||
inside your new coreutils/ directory:
|
||||
|
||||
If you have made *no* changes:
|
||||
git pull
|
||||
|
||||
If you *have* made changes and mistakenly committed them to "master",
|
||||
do the following to put your changes on a private branch, "br", and
|
||||
to restore master to its unmodified (relative-to-upstream) state:
|
||||
git checkout -b br
|
||||
git checkout master
|
||||
git reset --hard origin
|
||||
|
||||
Then "git pull" should work.
|
||||
|
||||
|
||||
*Before* you commit changes
|
||||
===========================
|
||||
@@ -64,7 +74,7 @@ Once your change is committed, you can create a proper patch that includes
|
||||
a log message and authorship information as well as any permissions
|
||||
changes. Use this command to save that single, most-recent change set:
|
||||
|
||||
git format-patch --stdout --signoff HEAD~1 > DIFF
|
||||
git format-patch --stdout -1 > DIFF
|
||||
|
||||
The trouble with this approach is that you've just checked in a change
|
||||
(remember, it's only local) on the "master" branch, and that's where new
|
||||
@@ -180,9 +190,9 @@ It's easy to adjust:
|
||||
|
||||
edit your files # this can include running "git add NEW" or "git rm BAD"
|
||||
git commit --amend -e -a
|
||||
git format-patch --stdout --signoff HEAD~1 > your-branch.diff
|
||||
git format-patch --stdout -1 > your-branch.diff
|
||||
|
||||
That replaces the most recent commit with the revised one.
|
||||
That replaces the most recent change-set with the revised one.
|
||||
|
||||
|
||||
|
||||
@@ -206,6 +216,13 @@ line should be blank, and the remaining lines are usually ChangeLog-style
|
||||
entries for all affected files. Omit the leading TABs that you're used
|
||||
to seeing in a "real" ChangeLog file.
|
||||
|
||||
Try to make the summary line fit one of the following forms:
|
||||
|
||||
program_name: change-description
|
||||
prog1, prog2: change-description
|
||||
doc: change-description
|
||||
tests: change-description
|
||||
|
||||
|
||||
Use SPACE-only indentation in new files.
|
||||
========================================
|
||||
@@ -223,8 +240,12 @@ with --no-tabs) and put these lines at the end of the file:
|
||||
Do not change TABs to spaces or vice versa in any existing file.
|
||||
|
||||
|
||||
Send patches to bug-coreutils@gnu.org
|
||||
=====================================
|
||||
Send patches to the address listed in --help output
|
||||
===================================================
|
||||
Please follow the guidelines in the "Sending your patches." section of
|
||||
git's own SubmittingPatches:
|
||||
|
||||
http://git.kernel.org/?p=git/git.git;a=blob;f=Documentation/SubmittingPatches
|
||||
|
||||
|
||||
Add documentation
|
||||
@@ -232,10 +253,39 @@ Add documentation
|
||||
If you add a feature or change some user-visible aspect of a program,
|
||||
document it. If you add an option, document it both in --help output
|
||||
(i.e., in the usage function that generates the --help output) and in
|
||||
doc/coreutils.texi. The man pages are generated from --help output, so
|
||||
doc/*.texi. The man pages are generated from --help output, so
|
||||
you shouldn't need to change anything under man/. User-visible changes
|
||||
are usually documented in NEWS, too.
|
||||
|
||||
When writing prose (documentation, comments, log entries), use an
|
||||
active voice, not a passive one. I.e., say "print the frobnozzle",
|
||||
not "the frobnozzle will be printed".
|
||||
|
||||
|
||||
Minor syntactic preferences
|
||||
===========================
|
||||
[I hesitate to write this one down, because it appears to be an
|
||||
acquired taste, at least for native-English speakers. It seems odd
|
||||
(if not truly backwards) to nearly anyone who doesn't have a strong
|
||||
mathematics background and perhaps a streak of something odd in their
|
||||
character ;-) ]
|
||||
In writing arithmetic comparisons, use "<" and "<=" rather than
|
||||
">" and ">=". For some justification, read this:
|
||||
http://thread.gmane.org/gmane.comp.version-control.git/3903/focus=4126
|
||||
|
||||
const placement:
|
||||
Write "Type const *var", not "const Type *var".
|
||||
FIXME: dig up justification
|
||||
|
||||
|
||||
Be nice to translators
|
||||
======================
|
||||
Don't change translatable strings if you can avoid it.
|
||||
If you must rearrange individual lines (e.g., in multi-line --help
|
||||
strings), extract and create new strings, rather than extracting
|
||||
and moving into existing blocks. This avoids making unnecessary
|
||||
work for translators.
|
||||
|
||||
|
||||
Add tests
|
||||
==========
|
||||
@@ -243,7 +293,9 @@ Nearly every significant change must be accompanied by a test suite
|
||||
addition that exercises it. If you fix a bug, add at least one test that
|
||||
fails without the patch, but that succeeds once your patch is applied.
|
||||
If you add a feature, add tests to exercise as much of the new code
|
||||
as possible.
|
||||
as possible. Note to run tests/misc/newtest in isolation you can do:
|
||||
|
||||
(cd tests && make check TESTS=misc/newtest VERBOSE=yes)
|
||||
|
||||
There are hundreds of tests in the tests/ directories. You can use
|
||||
tests/sample-test as a template, or one of the various Perl-based ones
|
||||
@@ -271,22 +323,28 @@ doc/Copyright/request-assign.changes:
|
||||
|
||||
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/Copyright/request-assign.changes;hb=HEAD
|
||||
|
||||
If you would like to assign past and future coreutils work,
|
||||
If you would like to assign past and future contributions to a project,
|
||||
you'd use doc/Copyright/request-assign.future:
|
||||
|
||||
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/Copyright/request-assign.future;hb=HEAD
|
||||
|
||||
You may make assignments for up to four projects at a time.
|
||||
|
||||
In case you're wondering why we bother with all of this, read this:
|
||||
|
||||
http://www.gnu.org/licenses/why-assign.html
|
||||
|
||||
|
||||
Run "make syntax-check", or even "make distcheck"
|
||||
================================================
|
||||
Making either of those targets runs many integrity and
|
||||
coreutils-specific policy-conformance tests. For example, the former
|
||||
project-specific policy-conformance tests. For example, the former
|
||||
ensures that you add no trailing blanks and no uses of certain deprecated
|
||||
functions. The latter performs all "syntax-check" tests, and also
|
||||
ensures that the build completes with no warnings when using a certain
|
||||
set of gcc -W... options. Don't even bother running "make distcheck"
|
||||
unless you have a very up to date installation including recent versions
|
||||
of gcc and the linux kernel, and modern GNU tools.
|
||||
unless you have a reasonably up to date installation including recent
|
||||
versions of gcc and the linux kernel, and modern GNU tools.
|
||||
|
||||
|
||||
Ensure that your changes are indented properly.
|
||||
@@ -298,6 +356,49 @@ With other files, there will be some existing differences.
|
||||
Try not to add any more.
|
||||
|
||||
|
||||
Avoid trailing white space
|
||||
==========================
|
||||
You may notice that the only trailing blanks in coreutils'
|
||||
version-controlled files are in a single directory: tests/pr,
|
||||
which contains expected output from various invocations of pr.
|
||||
|
||||
Do not add any more trailing blanks anywhere. While "make syntax-check"
|
||||
will alert you if you slip up, it's better to nip any problem in the
|
||||
bud, as you're typing. A good way to help you adapt to this rule is
|
||||
to configure your editor to highlight any offending characters in the
|
||||
files you edit. If you use Emacs, customize its font-lock mode (FIXME:
|
||||
provide more detail) or try one of its whitespace packages. This appears
|
||||
to be the one that will end up in emacs 23:
|
||||
|
||||
http://www.emacswiki.org/emacs/WhiteSpace
|
||||
|
||||
[that page says its version also works with emacs 21 and 22]
|
||||
If you use vim, add this to ~/.vimrc:
|
||||
|
||||
let c_space_errors=1
|
||||
highlight RedundantSpaces ctermbg=red guibg=red
|
||||
match RedundantSpaces /\s\+$\| \+\ze\t/
|
||||
|
||||
|
||||
Git can help too, by stopping you from committing any change that would
|
||||
add trailing blanks. The example pre-commit hook contains code to check
|
||||
for trailing whitespace and spaces before tabs; enable it by moving it
|
||||
to the right place and making sure it is executable:
|
||||
|
||||
mv .git/hooks/pre-commit.sample .git/hooks/pre-commit
|
||||
|
||||
With a repository created by git-1.5.6 or older, use this command:
|
||||
|
||||
chmod +x .git/hooks/pre-commit
|
||||
|
||||
To manually check for whitespace errors before committing, you can use
|
||||
|
||||
git diff --check
|
||||
|
||||
Git also has some settings to enable suitable internal whitespace checks.
|
||||
See the manpage for git-apply for details.
|
||||
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
Miscellaneous useful git commands
|
||||
@@ -312,3 +413,56 @@ Miscellaneous useful git commands
|
||||
* git rebase -i master: run this from on a branch, and it gives
|
||||
you an interface with which you can reorder and modify arbitrary
|
||||
change sets on that branch.
|
||||
|
||||
* if you "misplace" a change set, i.e., via git reset --hard ..., so that
|
||||
it's no longer reachable by any branch, you can use "git fsck" to find
|
||||
its SHA1 and then tag it or cherry-pick it onto an existing branch.
|
||||
For example, run this:
|
||||
git fsck --lost-found HEAD && cd .git/lost-found/commit \
|
||||
&& for i in *; do git show $i|grep SOME_IDENTIFYING_STRING \
|
||||
&& echo $i; done
|
||||
The "git fsck ..." command creates the .git/lost-found/... hierarchy
|
||||
listing all unreachable objects. Then the for loop
|
||||
print SHA1s for commits that match via log or patch.
|
||||
For example, say that found 556fbb57216b119155cdda824c98dc579b8121c8,
|
||||
you could run "git show 556fbb57216b119" to examine the change set,
|
||||
or "git checkout -b found 556fbb5721" to give it a branch name.
|
||||
Finally, you might run "git checkout master && git cherry-pick 556fbb5721"
|
||||
to put that change on the tip of "master".
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
Finding things to do
|
||||
====================
|
||||
If you don't know where to start, check out the TODO file for projects
|
||||
that look like they're at your skill-/interest-level. Another good
|
||||
option is always to improve tests. You never know what you might
|
||||
uncover when you improve test coverage, and even if you don't find
|
||||
any bugs your contribution is sure to be appreciated.
|
||||
|
||||
A good way to quickly assess current test coverage is to use "lcov"
|
||||
to generate HTML coverage reports. Follow these steps:
|
||||
|
||||
# configure with coverage information
|
||||
./configure CFLAGS="-g -fprofile-arcs -ftest-coverage"
|
||||
make
|
||||
# run whatever tests you want, i.e.:
|
||||
make check
|
||||
# run lcov
|
||||
lcov -t coreutils -q -d lib -b lib -o lib.lcov -c
|
||||
lcov -t coreutils -q -d src -b src -o src.lcov -c
|
||||
# generate HTML from the output
|
||||
genhtml -p `pwd` -t coreutils -q --output-directory lcov-html *.lcov
|
||||
|
||||
Then just open the index.html file (in the generated lcov-html directory)
|
||||
in your favorite web browser.
|
||||
|
||||
========================================================================
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 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 ``GNU Free
|
||||
Documentation License'' file as part of this distribution.
|
||||
|
||||
13
Makefile.am
13
Makefile.am
@@ -20,10 +20,13 @@ EXTRA_DIST = cfg.mk maint.mk \
|
||||
.prev-version THANKS-to-translators THANKStt.in \
|
||||
.version \
|
||||
.vg-suppressions \
|
||||
.x-po-check \
|
||||
.x-sc_GPL_version \
|
||||
.x-sc_file_system .x-sc_obsolete_symbols \
|
||||
.x-sc_file_system \
|
||||
.x-sc_obsolete_symbols \
|
||||
.x-sc_po_check \
|
||||
.x-sc_program_name \
|
||||
.x-sc_prohibit_atoi_atof \
|
||||
.x-sc_prohibit_stat_st_blocks \
|
||||
.x-sc_prohibit_strcmp \
|
||||
.x-sc_require_config_h \
|
||||
.x-sc_space_tab .x-sc_sun_os_names \
|
||||
@@ -57,7 +60,7 @@ ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
# Some tests always need root privileges, others need them only sometimes.
|
||||
check-root:
|
||||
cd tests && $(MAKE) $@
|
||||
cd tests && $(MAKE) $@ SUBDIRS=
|
||||
|
||||
# Just prior to distribution, ...
|
||||
# transform the automake-generated rule that runs `rm -f rm'.
|
||||
@@ -99,8 +102,8 @@ MAINTAINERCLEANFILES = THANKS-to-translators
|
||||
THANKS-to-translators: po/LINGUAS THANKStt.in
|
||||
( \
|
||||
cat $(srcdir)/THANKStt.in; \
|
||||
for lang in `cat $(srcdir)/po/LINGUAS`; do \
|
||||
echo http://www.iro.umontreal.ca/contrib/po/HTML/team-$$lang.html; \
|
||||
for lang in `cat $(srcdir)/po/LINGUAS`; do \
|
||||
echo http://translationproject.org/team/$$lang.html; \
|
||||
done; \
|
||||
) > $@-tmp && mv $@-tmp $@
|
||||
|
||||
|
||||
245
NEWS
245
NEWS
@@ -1,5 +1,247 @@
|
||||
GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release 7.2 (2009-03-31) [stable]
|
||||
|
||||
** New features
|
||||
|
||||
pwd now accepts the options --logical (-L) and --physical (-P). For
|
||||
compatibility with existing scripts, -P is the default behavior
|
||||
unless POSIXLY_CORRECT is requested.
|
||||
|
||||
** Bug fixes
|
||||
|
||||
cat once again immediately outputs data it has processed.
|
||||
Previously it would have been buffered and only output if enough
|
||||
data was read, or on process exit.
|
||||
[bug introduced in coreutils-6.0]
|
||||
|
||||
comm's new --check-order option would fail to detect disorder on any pair
|
||||
of lines where one was a prefix of the other. For example, this would
|
||||
fail to report the disorder: printf 'Xb\nX\n'>k; comm --check-order k k
|
||||
[bug introduced in coreutils-7.0]
|
||||
|
||||
cp once again diagnoses the invalid "cp -rl dir dir" right away,
|
||||
rather than after creating a very deep dir/dir/dir/... hierarchy.
|
||||
The bug strikes only with both --recursive (-r, -R) and --link (-l).
|
||||
[bug introduced in coreutils-7.1]
|
||||
|
||||
ls --sort=version (-v) sorted names beginning with "." inconsistently.
|
||||
Now, names that start with "." are always listed before those that don't.
|
||||
|
||||
pr: fix the bug whereby --indent=N (-o) did not indent header lines
|
||||
[bug introduced in coreutils-6.9.90]
|
||||
|
||||
sort now handles specified key ends correctly.
|
||||
Previously -k1,1b would have caused leading space from field 2 to be
|
||||
included in the sort while -k2,3.0 would have not included field 3.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
cp,mv,install,cat,split: now read and write a minimum of 32KiB
|
||||
at a time. This was seen to increase throughput. Up to 2 times
|
||||
when reading cached files on linux for example.
|
||||
|
||||
cp -a now tries to preserve extended attributes (xattr), but does not
|
||||
diagnose xattr-preservation failure. However, cp --preserve=all still does.
|
||||
|
||||
ls --color: hard link highlighting can be now disabled by changing the
|
||||
LS_COLORS environment variable. To disable it you can add something like
|
||||
this to your profile: eval `dircolors | sed s/hl=[^:]*:/hl=:/`
|
||||
|
||||
|
||||
* Noteworthy changes in release 7.1 (2009-02-21) [stable]
|
||||
|
||||
** New features
|
||||
|
||||
Add extended attribute support available on certain filesystems like ext2
|
||||
and XFS.
|
||||
cp: Tries to copy xattrs when --preserve=xattr or --preserve=all specified
|
||||
mv: Always tries to copy xattrs
|
||||
install: Never copies xattrs
|
||||
|
||||
cp and mv accept a new option, --no-clobber (-n): silently refrain
|
||||
from overwriting any existing destination file
|
||||
|
||||
dd accepts iflag=cio and oflag=cio to open the file in CIO (concurrent I/O)
|
||||
mode where this feature is available.
|
||||
|
||||
install accepts a new option, --compare (-C): compare each pair of source
|
||||
and destination files, and if the destination has identical content and
|
||||
any specified owner, group, permissions, and possibly SELinux context, then
|
||||
do not modify the destination at all.
|
||||
|
||||
ls --color now highlights hard linked files, too
|
||||
|
||||
stat -f recognizes the Lustre file system type
|
||||
|
||||
** Bug fixes
|
||||
|
||||
chgrp, chmod, chown --silent (--quiet, -f) no longer print some diagnostics
|
||||
[bug introduced in coreutils-5.1]
|
||||
|
||||
cp uses much less memory in some situations
|
||||
|
||||
cp -a now correctly tries to preserve SELinux context (announced in 6.9.90),
|
||||
doesn't inform about failure, unlike with --preserve=all
|
||||
|
||||
du --files0-from=FILE no longer reads all of FILE into RAM before
|
||||
processing the first file name
|
||||
|
||||
seq 9223372036854775807 9223372036854775808 now prints only two numbers
|
||||
on systems with extended long double support and good library support.
|
||||
Even with this patch, on some systems, it still produces invalid output,
|
||||
from 3 to at least 1026 lines long. [bug introduced in coreutils-6.11]
|
||||
|
||||
seq -w now accounts for a decimal point added to the last number
|
||||
to correctly print all numbers to the same width.
|
||||
|
||||
wc --files0-from=FILE no longer reads all of FILE into RAM, before
|
||||
processing the first file name, unless the list of names is known
|
||||
to be small enough.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
cp and mv: the --reply={yes,no,query} option has been removed.
|
||||
Using it has elicited a warning for the last three years.
|
||||
|
||||
dd: user specified offsets that are too big are handled better.
|
||||
Previously, erroneous parameters to skip and seek could result
|
||||
in redundant reading of the file with no warnings or errors.
|
||||
|
||||
du: -H (initially equivalent to --si) is now equivalent to
|
||||
--dereference-args, and thus works as POSIX requires
|
||||
|
||||
shred: now does 3 overwrite passes by default rather than 25.
|
||||
|
||||
ls -l now marks SELinux-only files with the less obtrusive '.',
|
||||
rather than '+'. A file with any other combination of MAC and ACL
|
||||
is still marked with a '+'.
|
||||
|
||||
|
||||
* Noteworthy changes in release 7.0 (2008-10-05) [beta]
|
||||
|
||||
** New programs
|
||||
|
||||
timeout: Run a command with bounded time.
|
||||
truncate: Set the size of a file to a specified size.
|
||||
|
||||
** New features
|
||||
|
||||
chgrp, chmod, chown, chcon, du, rm: now all display linear performance,
|
||||
even when operating on million-entry directories on ext3 and ext4 file
|
||||
systems. Before, they would exhibit O(N^2) performance, due to linear
|
||||
per-entry seek time cost when operating on entries in readdir order.
|
||||
Rm was improved directly, while the others inherit the improvement
|
||||
from the newer version of fts in gnulib.
|
||||
|
||||
comm now verifies that the inputs are in sorted order. This check can
|
||||
be turned off with the --nocheck-order option.
|
||||
|
||||
comm accepts new option, --output-delimiter=STR, that allows specification
|
||||
of an output delimiter other than the default single TAB.
|
||||
|
||||
cp and mv: the deprecated --reply=X option is now also undocumented.
|
||||
|
||||
dd accepts iflag=fullblock to make it accumulate full input blocks.
|
||||
With this new option, after a short read, dd repeatedly calls read,
|
||||
until it fills the incomplete block, reaches EOF, or encounters an error.
|
||||
|
||||
df accepts a new option --total, which produces a grand total of all
|
||||
arguments after all arguments have been processed.
|
||||
|
||||
If the GNU MP library is available at configure time, factor and
|
||||
expr support arbitrarily large numbers. Pollard's rho algorithm is
|
||||
used to factor large numbers.
|
||||
|
||||
install accepts a new option --strip-program to specify the program used to
|
||||
strip binaries.
|
||||
|
||||
ls now colorizes files with capabilities if libcap is available
|
||||
|
||||
ls -v now uses filevercmp function as sort predicate (instead of strverscmp)
|
||||
|
||||
md5sum now accepts the new option, --quiet, to suppress the printing of
|
||||
'OK' messages. sha1sum, sha224sum, sha384sum, and sha512sum accept it, too.
|
||||
|
||||
sort accepts a new option, --files0-from=F, that specifies a file
|
||||
containing a null-separated list of files to sort. This list is used
|
||||
instead of filenames passed on the command-line to avoid problems with
|
||||
maximum command-line (argv) length.
|
||||
|
||||
sort accepts a new option --batch-size=NMERGE, where NMERGE
|
||||
represents the maximum number of inputs that will be merged at once.
|
||||
When processing more than NMERGE inputs, sort uses temporary files.
|
||||
|
||||
sort accepts a new option --version-sort (-V, --sort=version),
|
||||
specifying that ordering is to be based on filevercmp.
|
||||
|
||||
** Bug fixes
|
||||
|
||||
chcon --verbose now prints a newline after each message
|
||||
|
||||
od no longer suffers from platform bugs in printf(3). This is
|
||||
probably most noticeable when using 'od -tfL' to print long doubles.
|
||||
|
||||
seq -0.1 0.1 2 now prints 2,0 when locale's decimal point is ",".
|
||||
Before, it would mistakenly omit the final number in that example.
|
||||
|
||||
shuf honors the --zero-terminated (-z) option, even with --input-range=LO-HI
|
||||
|
||||
shuf --head-count is now correctly documented. The documentation
|
||||
previously claimed it was called --head-lines.
|
||||
|
||||
** Improvements
|
||||
|
||||
Improved support for access control lists (ACLs): On MacOS X, Solaris 7..10,
|
||||
HP-UX 11, Tru64, AIX, IRIX 6.5, and Cygwin, "ls -l" now displays the presence
|
||||
of an ACL on a file via a '+' sign after the mode, and "cp -p" copies ACLs.
|
||||
|
||||
join has significantly better performance due to better memory management
|
||||
|
||||
ls now uses constant memory when not sorting and using one_per_line format,
|
||||
no matter how many files are in a given directory
|
||||
|
||||
od now aligns fields across lines when printing multiple -t
|
||||
specifiers, and no longer prints fields that resulted entirely from
|
||||
padding the input out to the least common multiple width.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
stat's --context (-Z) option has always been a no-op.
|
||||
Now it evokes a warning that it is obsolete and will be removed.
|
||||
|
||||
|
||||
* Noteworthy changes in release 6.12 (2008-05-31) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
chcon, runcon: --help output now includes the bug-reporting address
|
||||
|
||||
cp -p copies permissions more portably. For example, on MacOS X 10.5,
|
||||
"cp -p some-fifo some-file" no longer fails while trying to copy the
|
||||
permissions from the some-fifo argument.
|
||||
|
||||
id with no options now prints the SELinux context only when invoked
|
||||
with no USERNAME argument.
|
||||
|
||||
id and groups once again print the AFS-specific nameless group-ID (PAG).
|
||||
Printing of such large-numbered, kernel-only (not in /etc/group) group-IDs
|
||||
was suppressed in 6.11 due to ignorance that they are useful.
|
||||
|
||||
uniq: avoid subtle field-skipping malfunction due to isblank misuse.
|
||||
In some locales on some systems, isblank(240) (aka  ) is nonzero.
|
||||
On such systems, uniq --skip-fields=N would fail to skip the proper
|
||||
number of fields for some inputs.
|
||||
|
||||
tac: avoid segfault with --regex (-r) and multiple files, e.g.,
|
||||
"echo > x; tac -r x x". [bug present at least in textutils-1.8b, from 1992]
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
install once again sets SELinux context, when possible
|
||||
[it was deliberately disabled in 6.9.90]
|
||||
|
||||
|
||||
* Noteworthy changes in release 6.11 (2008-04-19) [stable]
|
||||
|
||||
** Bug fixes
|
||||
@@ -2180,8 +2422,7 @@ packages, see ./old/*/NEWS.
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright (C) 2001-2009 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
|
||||
30
README
30
README
@@ -13,8 +13,9 @@ The programs that can be built with this package are:
|
||||
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
|
||||
od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
|
||||
runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf
|
||||
sleep sort split stat stty su sum sync tac tail tee test touch tr true
|
||||
tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes
|
||||
sleep sort split stat stty su sum sync tac tail tee test timeout touch tr
|
||||
true truncate tsort tty uname unexpand uniq unlink uptime users vdir wc who
|
||||
whoami yes
|
||||
|
||||
See the file NEWS for a list of major changes in the current release.
|
||||
|
||||
@@ -91,11 +92,15 @@ compiler, due to the use of declarations after non-declaration statements
|
||||
in several files in src/. There is code in configure to find and, if
|
||||
possible, enable an appropriate compiler. However, if configure doesn't
|
||||
find a C99 compiler, it continues nonetheless, and your build will fail.
|
||||
If that happens, simply apply the included patch using the following
|
||||
If that happens, simply[*] apply the included patch using the following
|
||||
command, and then run make again:
|
||||
|
||||
cd src && patch < c99-to-c89.diff
|
||||
|
||||
[*] however, as of coreutils-7.1, the "c99-to-c89.diff" file is no longer
|
||||
maintained, so even if the patches still apply, the result will be an
|
||||
incomplete conversion. It's been 10 years. Get a decent compiler! ;-)
|
||||
|
||||
|
||||
***********************
|
||||
HPUX 11.x build failure
|
||||
@@ -145,7 +150,7 @@ I find that it is best to unpack and build as a non-privileged
|
||||
user, and then to run the following command as that user in order
|
||||
to run the privilege-requiring tests:
|
||||
|
||||
sudo env NON_ROOT_USERNAME=$USER make -k check-root
|
||||
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k check-root
|
||||
|
||||
If you can run the tests as root, please do so and report any
|
||||
problems. We get much less test coverage in that mode, and it's
|
||||
@@ -160,17 +165,13 @@ Reporting bugs:
|
||||
IMPORTANT: if you take the time to report a test failure,
|
||||
please be sure to include the output of running `make check'
|
||||
in verbose mode for each failing test. For example,
|
||||
if the test that fails is tests/mv/hard-link-1, then you
|
||||
would run this command:
|
||||
if the test that fails is tests/misc/df, then you would
|
||||
run this command:
|
||||
|
||||
env VERBOSE=yes make check -C tests/mv TESTS=hard-link-1 >> log 2>&1
|
||||
(cd tests && make check TESTS=misc/df VERBOSE=yes) >> log 2>&1
|
||||
|
||||
For some tests, you can get even more detail by including
|
||||
DEBUG=yes in the environment:
|
||||
|
||||
env DEBUG=yes VERBOSE=yes make check -C tests/mv TESTS=hard-link-1 >> log 2>&1
|
||||
|
||||
and then include the contents of the file `log' in your bug report.
|
||||
For some tests, you can get even more detail by adding DEBUG=yes.
|
||||
Then include the contents of the file `log' in your bug report.
|
||||
|
||||
***************************************
|
||||
|
||||
@@ -230,8 +231,7 @@ the address on the last line of --help output.
|
||||
|
||||
========================================================================
|
||||
|
||||
Copyright (C) 1998, 2002, 2003, 2004, 2005, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
Copyright (C) 1998, 2002-2009 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
|
||||
These notes intend to help people working on the checked-out sources.
|
||||
These requirements do not apply when building from a distribution tarball.
|
||||
See also HACKING for more detailed coreutils contribution guidlines.
|
||||
|
||||
* Requirements
|
||||
|
||||
We've opted to keep only the highest-level sources in the GIT repository.
|
||||
This eases our maintenance burden, (fewer merges etc.), but imposes more
|
||||
requirements on anyone wishing to build from the just-checked-out sources.
|
||||
For example, you have to use the latest stable versions of the maintainer
|
||||
tools we depend upon, including:
|
||||
Specific tools and versions will be checked for and listed by the
|
||||
bootstrap script shown below, and will include:
|
||||
|
||||
- Automake <http://www.gnu.org/software/automake/>
|
||||
- Autoconf <http://www.gnu.org/software/autoconf/>
|
||||
@@ -22,46 +23,44 @@ tools we depend upon, including:
|
||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||
- Tar <http://www.gnu.org/software/tar/>
|
||||
|
||||
Valgrind <http://valgrind.org/> is also highly recommended, if
|
||||
Valgrind supports your architecture.
|
||||
|
||||
Only building the initial full source tree will be a bit painful.
|
||||
Later, a plain `git pull && make' should be sufficient.
|
||||
|
||||
* LZMA
|
||||
- Valgrind
|
||||
|
||||
The coreutils build procedure can build distribution tarballs with the
|
||||
LZMA compression scheme. This feature is so new that it is not
|
||||
supported by the latest version of Automake. If you don't care about
|
||||
building LZMA tarballs, you can manually remove the string "dist-lzma"
|
||||
from configure.ac before bootstrapping.
|
||||
Valgrind <http://valgrind.org/> is also highly recommended, if
|
||||
Valgrind supports your architecture. See also README-valgrind.
|
||||
|
||||
If you do want to build LZMA tarballs, you'll need to make sure you
|
||||
have the latest stable version of the LZMA Utils
|
||||
<http://tukaani.org/lzma/>. Also, you'll need a version of
|
||||
Automake that supports the dist-lzma feature, like automake-1.10.1.
|
||||
- XZ utils (successor to LZMA)
|
||||
|
||||
This package's build procedure uses XZ to create a compressed
|
||||
distribution tarball. Using this feature of Automake requires
|
||||
version 1.10a or newer, as well as the xz program itself.
|
||||
Make sure you have the latest version of the XZ Utils from
|
||||
<http://tukaani.org/lzma/download>.
|
||||
|
||||
* First GIT checkout
|
||||
|
||||
You can get a copy of the source repository like this:
|
||||
|
||||
$ git clone git://git.sv.gnu.org/coreutils
|
||||
$ git clone git://git.sv.gnu.org/coreutils
|
||||
$ cd coreutils
|
||||
|
||||
The next step is to get other files needed to build, which are
|
||||
extracted from other source packages:
|
||||
The next step is to get and check other files needed to build,
|
||||
which are extracted from other source packages:
|
||||
|
||||
$ ./bootstrap
|
||||
$ ./bootstrap
|
||||
|
||||
And there you are! Just
|
||||
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make check
|
||||
$ ./configure #[--enable-gcc-warnings]
|
||||
$ make
|
||||
$ make check
|
||||
|
||||
At this point, there should be no difference between your local copy,
|
||||
and the GIT master copy:
|
||||
|
||||
$ git diff
|
||||
$ git diff
|
||||
|
||||
should output no difference.
|
||||
|
||||
@@ -69,7 +68,7 @@ Enjoy!
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -83,3 +82,7 @@ GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Local Variables:
|
||||
indent-tabs-mode: nil
|
||||
End:
|
||||
|
||||
32
README-prereq
Normal file
32
README-prereq
Normal file
@@ -0,0 +1,32 @@
|
||||
Detailed below are concrete examples for
|
||||
getting the prerequisites for particular systems.
|
||||
|
||||
- linux - fedora
|
||||
|
||||
This shows the steps for getting the required tools to build coreutils 7.0
|
||||
on a Fedora 8 system. We try to use official packages where possible.
|
||||
The 3 methods described for making these required packages available, should
|
||||
help clarify build requirements on any linux system at least.
|
||||
|
||||
1. Make sure offical distro git package is installed
|
||||
# yum install git
|
||||
|
||||
2. The distro autoconf is too old, but there is a newer one available
|
||||
so we rebuild that and make it available to the full system:
|
||||
# yum install emacs #autoconf build requires emacs (20MB)
|
||||
# rpmbuild --rebuild http://download.fedora.redhat.com/pub/fedora/linux/development/source/SRPMS/autoconf-2.63-1.fc10.src.rpm
|
||||
# rpm -Uvh /usr/src/redhat/RPMS/noarch/autoconf-2.63-1.fc8.noarch.rpm
|
||||
Note Autoconf 2.61a-341 or newer is needed to build automake-1.10a in step 3.
|
||||
Apply the same method to install the lzma package.
|
||||
[FIXME: mention xz when it's packaged]
|
||||
|
||||
3. The latest released automake (1.10.1) was not new enough, so we download
|
||||
and build automake-1.10a from its repository and make it available
|
||||
just to coreutils:
|
||||
# yum install help2man #required to build automake fully
|
||||
$ git clone git://git.sv.gnu.org/automake.git
|
||||
$ cd automake && ./configure --prefix=$HOME/coreutils/deps
|
||||
$ make install
|
||||
|
||||
Now we can build coreutils as described in README-hacking
|
||||
as long as $PATH starts with $HOME/coreutils/deps
|
||||
95
README-release
Normal file
95
README-release
Normal file
@@ -0,0 +1,95 @@
|
||||
Here are most of the steps we (maintainers) follow when making a release.
|
||||
|
||||
* start from a clean, up-to-date git directory.
|
||||
|
||||
git checkout master; git pull
|
||||
|
||||
* Run ./configure && make maintainer-clean
|
||||
|
||||
* Ensure that the desired versions of autoconf, automake, bison, etc.
|
||||
are in your PATH. See HACKING for the complete list.
|
||||
|
||||
* Ensure that you're on "master" with no uncommitted diffs.
|
||||
This should produce no output: git checkout master; git diff
|
||||
|
||||
* Make sure your local gnulib directory is up to date.
|
||||
|
||||
* Run bootstrap, (assuming your local copy of gnulib is in /gnulib):
|
||||
./bootstrap --gnulib-srcdir=/gnulib
|
||||
|
||||
FIXME: enable excluded programs like arch? to get their manual pages?
|
||||
|
||||
* Pre-release testing:
|
||||
On at least one SELinux-enabled (enforcing) and one non-SELinux system,
|
||||
run all tests, both root-only and regular.
|
||||
Run *all* non-root tests, including expensive and very expensive ones i.e.,
|
||||
run this: make check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
|
||||
|
||||
Run the root-only tests:
|
||||
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k check-root
|
||||
|
||||
* Run "make distcheck"
|
||||
|
||||
* Manually set the date, version number, and [stable/alpha/beta] on
|
||||
line 3 of NEWS, then do this:
|
||||
|
||||
v=7.1
|
||||
git commit -F <(printf 'version '$v'\n\n* NEWS: Record release date.\n') -a
|
||||
git tag -s -m "coreutils $v" v$v HEAD
|
||||
|
||||
* Run the following to create release tarballs. Your choice selects the
|
||||
corresponding upload-to destination in the emitted gnupload command.
|
||||
|
||||
# "TYPE" must be major, beta or alpha
|
||||
make TYPE
|
||||
|
||||
* Test the tarball. copy it to a few odd-ball systems and ensure that
|
||||
it builds and passes all tests.
|
||||
|
||||
* While that's happening, write the release announcement that you will
|
||||
soon post.
|
||||
|
||||
Once all the builds and tests have passed,
|
||||
|
||||
* Run the gnupload command suggested by your "XZ_OPT=-9e make major" run above.
|
||||
|
||||
* Wait a few minutes (maybe up to 30?) and then use the release URLs to
|
||||
download all tarball/signature pairs and use gpg --verify to ensure
|
||||
that they're all valid.
|
||||
|
||||
* Push the new tag:
|
||||
git push origin tag v<JUST_RELEASED_VERSION_NUMBER>
|
||||
|
||||
* Send the gpg-signed announcement mail, e.g.,
|
||||
To: info-gnu@gnu.org, coreutils-announce@gnu.org
|
||||
Cc: coordinator@translationproject.org, bug-coreutils@gnu.org
|
||||
Subject: coreutils-7.1 released [stable]
|
||||
|
||||
* Approve the announcement here:
|
||||
http://lists.gnu.org/mailman/admindb/coreutils-announce
|
||||
|
||||
* Announce it on Savannah, too:
|
||||
From here:
|
||||
https://savannah.gnu.org/projects/coreutils/
|
||||
click on the "submit news", then write something like the following:
|
||||
|
||||
The announcement is here:
|
||||
http://article.gmane.org/gmane.comp.gnu.core-utils.announce/48
|
||||
|
||||
Then go here to approve it:
|
||||
https://savannah.gnu.org/news/approve.php?group=coreutils
|
||||
|
||||
* For non-alpha releases, update the on-line manual at
|
||||
|
||||
http://www.gnu.org/software/coreutils/manual/
|
||||
|
||||
Run `make web-manual', then copy the contents of doc/manual
|
||||
into a CVS checkout of the coreutils manual repository.
|
||||
Also edit coreutils.html (FIXME? why?) before doing a CVS commit.
|
||||
|
||||
CVS_RSH=ssh \
|
||||
cvs -d:ext:$USER@cvs.savannah.gnu.org:/web/coreutils co coreutils
|
||||
|
||||
Be sure to "cvs add -ko" any files that "cvs status" marks with "?".
|
||||
That is necessary whenever a new texinfo node is added. Each becomes
|
||||
a new file in html_node that must then be "cvs add"ed.
|
||||
48
THANKS
48
THANKS
@@ -10,6 +10,7 @@ the bug-report mailing list (as seen on last line of e.g., cp --help).
|
||||
A Costa agcosta@gis.net
|
||||
Aaron Hawley ashawley@uvm.edu
|
||||
Achim Blumensath blume@corona.oche.de
|
||||
Adam Jimerson vendion@charter.net
|
||||
Adam Klein aklein@debian.org
|
||||
Adrian Bunk bunk@stusta.de
|
||||
AIDA Shinra shinra@j10n.org
|
||||
@@ -21,6 +22,9 @@ Albert Hopkins ahopkins@dynacare.com
|
||||
Alberto Accomazzi alberto@cfa0.harvard.edu
|
||||
aldomel aldomel@ix.netcom.com
|
||||
Alen Muzinic zveki@fly.cc.fer.hr
|
||||
Alexander Nguyen vinh@seas.ucla.edu
|
||||
Alexander V. Lukyanov lav@netis.ru
|
||||
Allen Hewes allen@decisiv.net
|
||||
Axel Dörfler axeld@pinc-software.de
|
||||
Alexandre Duret-Lutz duret_g@epita.fr
|
||||
Alexey Solovyov alekso@math.uu.se
|
||||
@@ -32,11 +36,12 @@ Andreas Frische andreasfrische@gmail.com
|
||||
Andreas Gruenbacher ag@bestbits.at
|
||||
Andreas Jaeger jaeger@gnu.org
|
||||
Andreas Luik luik@isa.de
|
||||
Andreas Schwab schwab@suse.de
|
||||
Andreas Schwab schwab@linux-m68k.org
|
||||
Andreas Stolcke stolcke@ICSI.Berkeley.EDU
|
||||
Andrei Gaponenko andr@triumf.ca
|
||||
Andres Soolo andres@soolo.matti.ee
|
||||
Andrew Burgess aab@cichlid.com
|
||||
Andrew Church achurch@achurch.org
|
||||
Andrew Dalke dalke@bioreason.com
|
||||
Andrew Fabbro andrew@fabbro.org
|
||||
Andrew Pham andpha@us.ibm.com
|
||||
@@ -57,6 +62,7 @@ Augey Mikus mikus@dqc.org
|
||||
Aurelien Jarno aurel32@debian.org
|
||||
Austin Donnelly Austin.Donnelly@cl.cam.ac.uk
|
||||
Axel Kittenberger Anshil@gmx.net
|
||||
Barry Kelly http://barrkel.blogspot.com/
|
||||
Bauke Jan Douma bjdouma@xs4all.nl
|
||||
Ben Elliston bje@air.net.au
|
||||
Ben Harris bjh21@netbsd.org
|
||||
@@ -78,12 +84,16 @@ Bob Proulx rwp@fc.hp.com
|
||||
Branden Robinson branden@necrotic.deadbeast.net
|
||||
Brendan O'Dea bod@compusol.com.au
|
||||
Brian Kimball bfk@footbag.org
|
||||
Brian M. Carlson sandals@crustytoothpaste.ath.cx
|
||||
Brian Silverman bsilverman@conceptxdesign.com
|
||||
Brian Youmans 3diff@gnu.org
|
||||
Bruce Korb bkorb@veritas.com
|
||||
Bruce Robertson brucer@theodolite.dyndns.org
|
||||
Bruno Haible haible@clisp.cons.org
|
||||
C de-Avillez hggdh2@gmail.com
|
||||
Carl Johnson carlj@cjlinux.home.org
|
||||
Carl Lowenstein cdl@mpl.UCSD.EDU
|
||||
Carl Roth roth@urs.us
|
||||
Carlos Canau Carlos.Canau@relay.puug.pt
|
||||
Charles Karney karney@pppl.gov
|
||||
Charles Randall crandall@matchlogic.com
|
||||
@@ -109,8 +119,9 @@ Cray-Cyber Project http://www.cray-cyber.org
|
||||
Cristian Cadar cristic@stanford.edu
|
||||
Cyril Bouthors cyril@bouthors.org
|
||||
Dale Scheetz dwarf@polaris.net
|
||||
Dameon G. Rogers dgr03@uark.edu
|
||||
Dan Hagerty hag@gnu.ai.it.edu
|
||||
Dan Jacobson http://www.geocities.com/jidani
|
||||
Dan Jacobson jidanni@jidanni.org
|
||||
Dan Pascu dan@services.iiruc.ro
|
||||
Daniel Bergstrom noa@melody.se
|
||||
Daniel Dunbar ddunbar@stanford.edu
|
||||
@@ -121,6 +132,7 @@ Darrel Francis d.francis@cheerful.com
|
||||
Darren Salt ds@youmustbejoking.demon.co.uk
|
||||
Dave Beckett dajobe@dajobe.org
|
||||
David Alan Gilbert gilbertd@treblig.org
|
||||
David Bartley dtbartle@csclub.uwaterloo.ca
|
||||
David Dyck dcd@tc.fluke.COM
|
||||
David Eisner cradle@umd.edu
|
||||
David Flynn dav@chess.plus.com
|
||||
@@ -128,9 +140,11 @@ David Godfrey dave@delta.demon.co.uk
|
||||
David Luyer david_luyer@pacific.net.au
|
||||
David Madore david.madore@ens.fr
|
||||
David Malone dwmalone@cnri.dit.ie
|
||||
Davide Canova kc.canova@gmail.com
|
||||
Dawson Engler engler@stanford.edu
|
||||
Dean Gaudet dean-savannah@arctic.org
|
||||
Deepak Goel deego@gnufans.org
|
||||
Denis Excoffier denis.excoffier@airbus.com
|
||||
Dennis Henriksen opus@flamingo.osrl.dk
|
||||
Dennis Smit ds@nerds-incorporated.org
|
||||
Derek Clegg dclegg@next.com
|
||||
@@ -155,6 +169,7 @@ Elbert Pol elbert.pol@gmail.com
|
||||
Eli Zaretskii eliz@is.elta.co.il
|
||||
Elias Pipping pipping@gentoo.org
|
||||
Emile LeBlanc leblanc@math.toronto.edu
|
||||
Erik Auerswald auerswal@unix-ag.uni-kl.de
|
||||
Eric Backus ericb@lsid.hp.com
|
||||
Eric Blake ebb9@byu.net
|
||||
Eric G. Miller egm2@jps.net
|
||||
@@ -180,6 +195,7 @@ Gabor Z. Papp gzp@gzp.org.hu
|
||||
Gaël Quéri gqueri@mail.dotcom.fr
|
||||
Galen Hazelwood galenh@micron.net
|
||||
Gary Anderson ganderson@clark.net
|
||||
Gary Johnson garyjohn@spk.agilent.com
|
||||
Gary V. Vaughan gary@gnu.org
|
||||
Gaute Hvoslef Kvalnes gaute@verdsveven.com
|
||||
Geoff Collyer geoff at collyer.net
|
||||
@@ -189,11 +205,13 @@ Geoff Whale geoffw@cse.unsw.EDU.AU
|
||||
Gerald Pfeifer gerald@pfeifer.com
|
||||
Gerhard Poul gpoul@gnu.org
|
||||
Germano Leichsenring germano@jedi.cs.kobe-u.ac.jp
|
||||
Göran Uddeborg goeran@uddeborg.pp.se
|
||||
Glen Lenker glen.lenker@gmail.com
|
||||
Göran Uddeborg goeran@uddeborg.se
|
||||
Guochun Shi gshi@ncsa.uiuc.edu
|
||||
GOTO Masanori gotom@debian.or.jp
|
||||
Greg Louis glouis@dynamicro.on.ca
|
||||
Greg McGary gkm@gnu.org
|
||||
Greg Metcalfe metcalfegreg@qwest.net
|
||||
Greg Schafer gschafer@zip.com.au
|
||||
Greg Troxel gdt@bbn.com
|
||||
Greg Wooledge gawooledge@sherwin.com
|
||||
@@ -208,6 +226,7 @@ Harald Dunkel harald.dunkel@t-online.de
|
||||
Harry Liu rliu@lek.ugcs.caltech.edu
|
||||
Harti Brandt brandt@fokus.fraunhofer.de
|
||||
Harvey Eneman Harvey.Eneman@oracle.com
|
||||
Heiko Marr h.marr@webmasters.de
|
||||
Helen Faulkner helen_ml_faulkner@yahoo.co.uk
|
||||
Herbert Xu herbert@gondor.apana.org.au
|
||||
Holger Berger hberger@ess.nec.de
|
||||
@@ -219,6 +238,7 @@ Ian Jackson ijackson@chiark.greenend.org.uk
|
||||
Ian Lance Taylor ian@cygnus.com
|
||||
Ian Turner vectro@pipeline.com
|
||||
Iida Yosiaki iida@gnu.org
|
||||
Ilya N. Golubev gin@mo.msk.ru
|
||||
Ingo Saitz ingo@debian.org
|
||||
Ivo Timmermans ivo@debian.org
|
||||
James james@albion.glarp.com
|
||||
@@ -228,19 +248,22 @@ James Hunt jamesodhunt@hotmail.com
|
||||
James Ralston ralston@pobox.com
|
||||
James Sneeringer jvs@ocslink.com
|
||||
James Tanis jtt@soscorp.com
|
||||
James Youngman james+usenet@free-lunch.demon.co.uk
|
||||
James Youngman jay@gnu.org
|
||||
Jamie Lokier jamie@imbolc.ucc.ie
|
||||
Jamie McClelland jm@mayfirst.org
|
||||
Jan Engelhardt jengelh@medozas.de
|
||||
Jan Fedak J.Fedak@sh.cvut.cz
|
||||
Jan Moringen jan.moringen@uni-bielefeld.de
|
||||
Jan Nieuwenhuizen janneke@gnu.org
|
||||
Janos Farkas chexum@shadow.banki.hu
|
||||
Jarkko Hietaniemi jhi@epsilon.hut.fi
|
||||
Jarod Wilson jwilson@redhat.com
|
||||
Jean Charles Delepine delepine@u-picardie.fr
|
||||
Jeff Moore jbm@mordor.com
|
||||
Jeff Sheinberg jeff@bsrd.net
|
||||
Jens Elkner elkner@imsgroup.de
|
||||
Jens Schmidt jms@jsds.hamburg.com
|
||||
Jeph Cowan jeph@ucar.edu
|
||||
Jeremy Maitin-Shepard jbms@cmu.edu
|
||||
Jerome Abela abela@hsc.fr
|
||||
Jérôme Zago bug-coreutils-ml@agt-the-walker.net
|
||||
@@ -270,6 +293,7 @@ Jon Peatfield J.S.Peatfield@damtp.cam.ac.uk
|
||||
Joost van Baal joostvb@xs4all.nl
|
||||
Jorge Stolfi stolfi@ic.unicamp.br
|
||||
Joseph S. Myers jsm28@cam.ac.uk
|
||||
Josh Triplett josh@freedesktop.org
|
||||
Joshua Hudson joshudson@gmail.com
|
||||
Josselin Mouette joss@debian.org
|
||||
Juan F. Codagnone juam@arnet.com.ar
|
||||
@@ -343,6 +367,7 @@ Mate Wierdl mw@moni.msci.memphis.edu
|
||||
Matej Vela mvela@public.srce.hr
|
||||
Matt Kraai kraai@ftbfs.org
|
||||
Matt Perry matt@primefactor.com
|
||||
Matt Pham mattvpham@gmail.com
|
||||
Matt Schalit mschalit@pacbell.net
|
||||
Matt Swift swift@alum.mit.edu
|
||||
Matthew Arnison maffew@cat.org.au
|
||||
@@ -356,6 +381,7 @@ Matthew Woehlke mw_triad@users.sourceforge.net
|
||||
Matthias Urlichs smurf@noris.de
|
||||
Matti Aarnio matti.aarnio@zmailer.org
|
||||
Mattias Wadenstein maswan@acc.umu.se
|
||||
Max Chang maxchang@ucla.edu
|
||||
Meelis Roos mroos@tartu.cyber.ee
|
||||
Michael michael@aplatform.com
|
||||
Michael ??? michael@roka.net
|
||||
@@ -379,6 +405,7 @@ Michal Politowski mpol@charybda.icm.edu.pl
|
||||
Michal Svec msvec@suse.cz
|
||||
Michel Robitaille robitail@IRO.UMontreal.CA
|
||||
Michiel Bacchiani bacchian@raven.bu.edu
|
||||
Mikael Magnusson mikachu@gmail.com
|
||||
Mike Castle dalgoda@ix.netcom.com
|
||||
Mike Coleman mkc@mathdogs.com
|
||||
Mike Jetzer mjetzer@mke.catalystwms.com
|
||||
@@ -392,11 +419,13 @@ Neal H Walfield neal@cs.uml.edu
|
||||
Neil Brown neilb@cse.unsw.edu.au
|
||||
Nelson H. F. Beebe beebe@math.utah.edu
|
||||
Nick Estes debian@nickstoys.com
|
||||
Nick Graham nick.d.graham@gmail.com
|
||||
Nick Lawes nlawes@silverplatter.com
|
||||
Nickolai Zeldovich nickolai@cs.stanford.edu
|
||||
Nicolas François nicolas.francois@centraliens.net
|
||||
Niklas Edmundsson nikke@acc.umu.se
|
||||
Nikola Milutinovic Nikola.Milutinovic@ev.co.yu
|
||||
Nima Nikzad nnikzad@ucla.edu
|
||||
Noah Friedman friedman@splode.com
|
||||
Noel Cragg noel@red-bean.com
|
||||
Norbert Kiesel nkiesel@tbdnetworks.com
|
||||
@@ -408,6 +437,7 @@ Oliver Kiddle okiddle@yahoo.co.uk
|
||||
Oskar Liljeblad osk@hem.passagen.se
|
||||
Pádraig Brady P@draigBrady.com
|
||||
Patrick Mauritz oxygene@studentenbude.ath.cx
|
||||
Paul D. Smith psmith@gnu.org
|
||||
Paul Eggert eggert@twinsun.com
|
||||
Paul Ghaleb paul.ghaleb@st.com
|
||||
Paul Jarc prj@po.cwru.edu
|
||||
@@ -429,9 +459,11 @@ Peter Moulder reiter@netspace.net.au
|
||||
Peter O'Gorman bug-coreutils@mlists.thewrittenword.com
|
||||
Peter Samuelson psamuels@sampo.creighton.edu
|
||||
Peter Seebach seebs@taniemarie.solon.com
|
||||
Petr Uzel petr.uzel@suse.cz
|
||||
Petter Reinholdtsen pere@hungry.com
|
||||
Phelippe Neveu pneveu@pcigeomatics.com
|
||||
Phil Richards phil.richards@vf.vodafone.co.uk
|
||||
Philip Rowlands phr@doc.ic.ac.uk
|
||||
Philippe De Muyter phdm@macqel.be
|
||||
Philippe Schnoebelen Philippe.Schnoebelen@imag.fr
|
||||
Phillip Jones mouse@datastacks.com
|
||||
@@ -439,6 +471,7 @@ Piergiorgio Sartor sartor@sony.de
|
||||
Pieter Bowman bowman@math.utah.edu
|
||||
Piotr Kwapulinski kwap@univ.gda.pl
|
||||
Prashant TR tr@eth.net
|
||||
Priit Jõerüüt jemm4jemm@yahoo.com
|
||||
Rainer Orth ro@TechFak.Uni-Bielefeld.DE
|
||||
Ralf W. Stephan stephan@tmt.de
|
||||
Ralf Wildenhues Ralf.Wildenhues@gmx.de
|
||||
@@ -466,6 +499,7 @@ Ross Alexander r.alexander@auckland.ac.nz
|
||||
Ross Paterson rap@doc.ic.ac.uk
|
||||
Ross Ridge rridge@calum.csclub.uwaterloo.ca
|
||||
Rudolf Kastl rkastl@redhat.com
|
||||
Sahil Amoli sahilamoli@gmail.com
|
||||
Sami Farin sfarin@ratol.fi
|
||||
Samuel Tardieu sam@rfc1149.net
|
||||
Samuel Thibault samuel.thibault@ens-lyon.org
|
||||
@@ -492,6 +526,7 @@ Steven G. Johnson stevenj@alum.mit.edu
|
||||
Steven Mocking ufo@quicknet.nl
|
||||
Steven P Watson steven@magelico.net
|
||||
Stuart Kemp skemp@peter.bmc.com
|
||||
Stuart Shelton stuart@shelton.me
|
||||
Sven Joachim svenjoac@gmx.de
|
||||
Szakacsits Szabolcs szaka@sienet.hu
|
||||
Tadayoshi Funaba tadf@kt.rim.or.jp
|
||||
@@ -509,8 +544,10 @@ Thomas Schwinge tschwinge@gnu.org
|
||||
Thomas Wolff mined@towo.net
|
||||
Tim J. Robbins tjr@FreeBSD.org
|
||||
Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu
|
||||
Tim Ryan Tim_Ryan@bnz.co.nz
|
||||
Tim Smithers mouse@dmouse.com.au
|
||||
Tim Waugh twaugh@redhat
|
||||
Tobias Stoeckmann tobias@bugol.de
|
||||
Toby Peterson toby@opendarwin.org
|
||||
Todd A. Jacobs tjacobs@codegnome.org
|
||||
Tom Haynes thomas@netapp.com
|
||||
@@ -527,6 +564,7 @@ Torbjorn Granlund tege@nada.kth.se
|
||||
Torbjorn Lindgren tl@funcom.no
|
||||
Torsten Landschoff torsten@pclab.ifg.uni-kiel.de
|
||||
Tristan Miller psychonaut@nothingisreal.com
|
||||
Tzvi Rotshtein tzvi.ro@gmail.com
|
||||
Ulrich Drepper drepper@gnu.org
|
||||
Ulrich Hermisson ulrich_hermisson@hotmail.com
|
||||
Urs Thuermann urs@isnogud.escape.de
|
||||
@@ -534,7 +572,9 @@ Uwe H. Steinfeld usteinfeld@gmx.net
|
||||
Vesselin Atanasov vesselin@bgnet.bg
|
||||
Vin Shelton acs@alumni.princeton.edu
|
||||
Vineet Chadha chadha@acis.ufl.edu
|
||||
Vitali Lovich vlovich@gmail.com
|
||||
Vitaly A. Ostanin vyt@altlinux.org
|
||||
Vito Caputo vcaputo@pengaru.com
|
||||
Vlada Macek tuttle@bbs.fsik.cvut.cz
|
||||
Volker Borchert bt@teknon.de
|
||||
Volker Paul vpaul@dohle.com
|
||||
|
||||
48
TODO
48
TODO
@@ -5,19 +5,30 @@ longer pertinent, please search the mailing list and post your intent
|
||||
before embarking on a big project.
|
||||
|
||||
==================================================
|
||||
Modify chmod so that it does not change an inode's st_ctime
|
||||
when the selected operation would have no other effect.
|
||||
First suggested by Hans Ecke <http://hans.ecke.ws> in
|
||||
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/2920
|
||||
Discussed more recently on <http://bugs.debian.org/497514>.
|
||||
|
||||
document the following in coreutils.texi:
|
||||
runcon
|
||||
chcon
|
||||
mktemp
|
||||
[
|
||||
pinky
|
||||
uptime
|
||||
Also document the SELinux changes.
|
||||
|
||||
comm: add an option, --output-delimiter=STR
|
||||
Files to change: src/comm.c, ChangeLog, NEWS, doc/coreutils.texi,
|
||||
Add a new file, tests/misc/comm (use another file in that directory as
|
||||
a template), to exercise the new option. Suggestion from Dan Jacobson.
|
||||
Suggestion from Paul Eggert:
|
||||
More generally, there's not that much use for imaxtostr nowadays,
|
||||
since the inttypes module and newer versions of gettext allow things
|
||||
like _("truncating %s at %" PRIdMAX " bytes") to work portably.
|
||||
I suspect that (if someone cares to take the time) we can remove
|
||||
all instances of imaxtostr and umaxtostr in coreutils and gnulib.
|
||||
|
||||
cp --recursive: use fts and *at functions to perform directory traversals
|
||||
in source and destination hierarchy rather than forming full file names.
|
||||
The latter (current) approach fails unnecessarily when the names
|
||||
become very long, and requires space and time that is quadratic in the
|
||||
depth of the hierarchy. [Bo Borgerson is working on this]
|
||||
|
||||
printf:
|
||||
Now that gnulib supports *printf("%a"), import one of the
|
||||
@@ -29,9 +40,6 @@ renice: POSIX utility, needs implementing.
|
||||
suggestion from Karl Berry (among others).
|
||||
Bob Proulx is working on this.
|
||||
|
||||
install: add an option to specify the program used to strip binaries.
|
||||
suggestion from Karl Berry
|
||||
|
||||
doc/coreutils.texi:
|
||||
Address this comment: FIXME: mv's behavior in this case is system-dependent
|
||||
Better still: fix the code so it's *not* system-dependent.
|
||||
@@ -59,8 +67,6 @@ Should printf '\0123' print "\n3"?
|
||||
|
||||
printf: consider adapting builtins/printf.def from bash
|
||||
|
||||
df: add `--total' option, suggested here http://bugs.debian.org/186007
|
||||
|
||||
tail: don't use xlseek; it *exits*.
|
||||
Instead, maybe use a macro and return nonzero.
|
||||
|
||||
@@ -96,9 +102,8 @@ sort: Investigate better sorting algorithms; see Knuth vol. 3.
|
||||
5.3.1, who credits Lester Ford, Jr. and Selmer Johnson, American
|
||||
Mathematical Monthly 66 (1959), 387-389.
|
||||
|
||||
cp --recursive: perform dir traversals in source and dest hierarchy rather
|
||||
than forming full file names. The latter (current) approach fails
|
||||
unnecessarily when the names become very long.
|
||||
shred: Update shred as described here to conform to DoD 5220 rules:
|
||||
http://lists.gnu.org/archive/html/bug-coreutils/2007-05/msg00075.html
|
||||
|
||||
Remove suspicious uses of alloca (ones that may allocate more than
|
||||
about 4k)
|
||||
@@ -106,6 +111,9 @@ Remove suspicious uses of alloca (ones that may allocate more than
|
||||
Adapt these contribution guidelines for coreutils:
|
||||
http://sources.redhat.com/automake/contribute.html
|
||||
|
||||
Improve test coverage.
|
||||
See HACKING for instructions on generating an html test coverage report.
|
||||
Find a program that has poor coverage and improve.
|
||||
|
||||
Changes expected to go in, someday.
|
||||
======================================
|
||||
@@ -120,9 +128,6 @@ Changes expected to go in, someday.
|
||||
an implicit --NO-dereference-command-line-symlink-to-dir meaning.
|
||||
Pointed out by Karl Berry.
|
||||
|
||||
A more efficient version of factor, and possibly one that
|
||||
accepts inputs of size 2^64 and larger.
|
||||
|
||||
dd: consider adding an option to suppress `bytes/block read/written'
|
||||
output to stderr. Suggested here:
|
||||
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=165045
|
||||
@@ -152,6 +157,11 @@ remove all uses of the `register' keyword: Done. add a maint.mk rule
|
||||
remove or adjust chown's --changes option, since it
|
||||
can't always do what it currently says it does.
|
||||
|
||||
Support arbitrary-precision arithmetic in those tools for which it
|
||||
makes sense. Factor and expr already support this via libgmp.
|
||||
The "test" program is covered via its string-based comparison of
|
||||
integers. To be converted: seq.
|
||||
|
||||
Adapt tools like wc, tr, fmt, etc. (most of the textutils) to be
|
||||
multibyte aware. The problem is that I want to avoid duplicating
|
||||
significant blocks of logic, yet I also want to incur only minimal
|
||||
@@ -161,7 +171,7 @@ pr's use of nstrftime can make it malloc a very large (up to SIZE_MAX) buffer
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
225
bootstrap
225
bootstrap
@@ -2,7 +2,7 @@
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2009 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -49,9 +49,12 @@ Options:
|
||||
not to have been checked out.
|
||||
--skip-po Do not download po files.
|
||||
|
||||
If the file bootstrap.conf exists in the current working directory, its
|
||||
If the file $0.conf exists in the same directory as this script, its
|
||||
contents are read as shell variables to configure the bootstrap.
|
||||
|
||||
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
||||
are honored.
|
||||
|
||||
Running without arguments will suffice in most cases.
|
||||
"
|
||||
}
|
||||
@@ -146,7 +149,13 @@ copy=false
|
||||
vc_ignore=auto
|
||||
|
||||
# Override the default configuration, if necessary.
|
||||
test -r bootstrap.conf && . ./bootstrap.conf
|
||||
# Make sure that bootstrap.conf is sourced from the current directory
|
||||
# if we were invoked as "sh bootstrap".
|
||||
case "$0" in
|
||||
*/*) test -r "$0.conf" && . "$0.conf" ;;
|
||||
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
||||
esac
|
||||
|
||||
|
||||
if test "$vc_ignore" = auto; then
|
||||
vc_ignore=
|
||||
@@ -165,7 +174,7 @@ do
|
||||
usage
|
||||
exit;;
|
||||
--gnulib-srcdir=*)
|
||||
GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
|
||||
GNULIB_SRCDIR=`expr "X$option" : 'X--gnulib-srcdir=\(.*\)'`;;
|
||||
--skip-po)
|
||||
SKIP_PO=t;;
|
||||
--force)
|
||||
@@ -189,7 +198,7 @@ insert_sorted_if_absent() {
|
||||
file=$1
|
||||
str=$2
|
||||
test -f $file || touch $file
|
||||
echo "$str" | sort -u - $file | cmp -s - $file \
|
||||
echo "$str" | sort -u - $file | cmp - $file > /dev/null \
|
||||
|| echo "$str" | sort -u - $file -o $file \
|
||||
|| exit 1
|
||||
}
|
||||
@@ -216,29 +225,161 @@ if test ! -d $build_aux; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Note this deviates from the version comparison in automake
|
||||
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
|
||||
# but this should suffice as we won't be specifying old
|
||||
# version formats or redundant trailing .0 in bootstrap.conf.
|
||||
# If we did want full compatibility then we should probably
|
||||
# use m4_version_compare from autoconf.
|
||||
sort_ver() { #sort -V is not generally available
|
||||
ver1="$1"
|
||||
ver2="$2"
|
||||
|
||||
#split on '.' and compare each component
|
||||
i=1
|
||||
while : ; do
|
||||
p1=$(echo "$ver1" | cut -d. -f$i)
|
||||
p2=$(echo "$ver2" | cut -d. -f$i)
|
||||
if [ ! "$p1" ]; then
|
||||
echo "$1 $2"
|
||||
break
|
||||
elif [ ! "$p2" ]; then
|
||||
echo "$2 $1"
|
||||
break
|
||||
elif [ ! "$p1" = "$p2" ]; then
|
||||
if [ "$p1" -gt "$p2" ] 2>/dev/null; then #numeric comparision
|
||||
echo "$2 $1"
|
||||
elif [ "$p2" -gt "$p1" ] 2>/dev/null; then #numeric comparision
|
||||
echo "$1 $2"
|
||||
else #numeric, then lexographic comparison
|
||||
lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
|
||||
if [ "$lp" = "$p2" ]; then
|
||||
echo "$1 $2"
|
||||
else
|
||||
echo "$2 $1"
|
||||
fi
|
||||
fi
|
||||
break
|
||||
fi
|
||||
i=$(($i+1))
|
||||
done
|
||||
}
|
||||
|
||||
get_version() {
|
||||
app=$1
|
||||
|
||||
$app --version >/dev/null 2>&1 || return 1
|
||||
|
||||
$app --version 2>&1 |
|
||||
sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
|
||||
t done
|
||||
d
|
||||
:done
|
||||
q'
|
||||
}
|
||||
|
||||
check_versions() {
|
||||
ret=0
|
||||
|
||||
while read app req_ver; do
|
||||
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
|
||||
appvar=`echo $app | tr '[a-z]' '[A-Z]'`
|
||||
test "$appvar" = TAR && appvar=AMTAR
|
||||
eval "app=\${$appvar-$app}"
|
||||
inst_ver=$(get_version $app)
|
||||
if [ ! "$inst_ver" ]; then
|
||||
echo "Error: '$app' not found" >&2
|
||||
ret=1
|
||||
elif [ ! "$req_ver" = "-" ]; then
|
||||
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
|
||||
if [ ! "$latest_ver" = "$inst_ver" ]; then
|
||||
echo "Error: '$app' version == $inst_ver is too old" >&2
|
||||
echo " '$app' version >= $req_ver is required" >&2
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
print_versions() {
|
||||
echo "Program Min_version"
|
||||
echo "----------------------"
|
||||
printf "$buildreq"
|
||||
echo "----------------------"
|
||||
#can't depend on column -t
|
||||
}
|
||||
|
||||
if ! printf "$buildreq" | check_versions; then
|
||||
test -f README-prereq &&
|
||||
echo "Please see README-prereq for notes on obtaining these prerequisite programs:" >&2
|
||||
echo
|
||||
print_versions
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$0: Bootstrapping from checked-out $package sources..."
|
||||
|
||||
# See if we can use gnulib's git-merge-changelog merge driver.
|
||||
if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
|
||||
if git config merge.merge-changelog.driver >/dev/null ; then
|
||||
:
|
||||
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
|
||||
echo "initializing git-merge-changelog driver"
|
||||
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
||||
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
||||
else
|
||||
echo "consider installing git-merge-changelog from gnulib"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
cleanup_gnulib() {
|
||||
status=$?
|
||||
rm -fr gnulib
|
||||
exit $status
|
||||
}
|
||||
|
||||
git_modules_config () {
|
||||
GIT_CONFIG=.gitmodules git config "$@"
|
||||
}
|
||||
|
||||
# Get gnulib files.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
if [ ! -d gnulib ]; then
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init || exit $?
|
||||
git submodule update || exit $?
|
||||
|
||||
elif [ ! -d gnulib ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
git clone --depth 2 git://git.sv.gnu.org/gnulib ||
|
||||
git clone --help|grep depth > /dev/null && depth='--depth 2' || depth=
|
||||
git clone $depth git://git.sv.gnu.org/gnulib ||
|
||||
cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
GNULIB_SRCDIR=gnulib
|
||||
;;
|
||||
*)
|
||||
# Redirect the gnulib submodule to the directory on the command line
|
||||
# if possible.
|
||||
if test -d "$GNULIB_SRCDIR"/.git && \
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
git submodule init
|
||||
GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
|
||||
git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule update || exit $?
|
||||
GNULIB_SRCDIR=gnulib
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
@@ -273,15 +414,15 @@ update_po_files() {
|
||||
|
||||
langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
|
||||
test "$langs" = '*' && langs=x
|
||||
for po in `cd $ref_po_dir && echo *.po|sed 's/\.po//g'`; do
|
||||
for po in $langs; do
|
||||
case $po in x) continue;; esac
|
||||
new_po="$ref_po_dir/$po.po"
|
||||
cksum_file="$ref_po_dir/$po.s1"
|
||||
if ! test -f "$cksum_file" ||
|
||||
! test -f "$po_dir/$po.po" ||
|
||||
! sha1sum -c --status "$cksum_file" < "$new_po" > /dev/null; then
|
||||
! ${SHA1SUM-sha1sum} -c --status "$cksum_file" < "$new_po" > /dev/null; then
|
||||
echo "updated $po_dir/$po.po..."
|
||||
cp "$new_po" "$po_dir/$po.po" && sha1sum < "$new_po" > "$cksum_file"
|
||||
cp "$new_po" "$po_dir/$po.po" && ${SHA1SUM-sha1sum} < "$new_po" > "$cksum_file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -383,9 +524,13 @@ cp_mark_as_generated()
|
||||
|
||||
if test -z "$c1"; then
|
||||
cmp -s "$cp_src" "$cp_dst" || {
|
||||
# Copy the file first to get proper permissions if it
|
||||
# doesn't already exist. Then overwrite the copy.
|
||||
echo "$0: cp -f $cp_src $cp_dst" &&
|
||||
rm -f "$cp_dst" &&
|
||||
sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst"
|
||||
cp "$cp_src" "$cp_dst-t" &&
|
||||
sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
|
||||
mv -f "$cp_dst-t" "$cp_dst"
|
||||
}
|
||||
else
|
||||
# Copy the file first to get proper permissions if it
|
||||
@@ -440,7 +585,7 @@ slurp() {
|
||||
if test $file = Makefile.am; then
|
||||
copied=$copied${sep}$gnulib_mk; sep=$nl
|
||||
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
|
||||
sed "$remove_intl" $1/$dir/$file | cmp -s - $dir/$gnulib_mk || {
|
||||
sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {
|
||||
echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
|
||||
rm -f $dir/$gnulib_mk &&
|
||||
sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
|
||||
@@ -522,32 +667,12 @@ grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
|
||||
with_gettext=no
|
||||
|
||||
if test $with_gettext = yes; then
|
||||
echo "$0: (cd $bt2; autopoint) ..."
|
||||
echo "$0: (cd $bt2; ${AUTOPOINT-autopoint}) ..."
|
||||
cp configure.ac $bt2 &&
|
||||
(cd $bt2 && autopoint && rm configure.ac) &&
|
||||
(cd $bt2 && ${AUTOPOINT-autopoint} && rm configure.ac) &&
|
||||
slurp $bt2 $bt || exit
|
||||
|
||||
rm -fr $bt $bt2 || exit
|
||||
fi
|
||||
|
||||
# Coreutils is unusual in that it generates some of its test-related
|
||||
# Makefile.am files. That must be done before invoking automake.
|
||||
mam_template=tests/Makefile.am.in
|
||||
if test -f $mam_template; then
|
||||
PERL=perl
|
||||
for tool in cut head join pr sort tac tail test tr uniq wc; do
|
||||
m=tests/$tool/Makefile.am
|
||||
t=${m}t
|
||||
rm -f $m $t
|
||||
sed -n '1,/^##test-files-begin/p' $mam_template > $t
|
||||
echo "x = $tool" >> $t
|
||||
srcdir=tests/$tool
|
||||
$PERL -I$srcdir -w -- tests/mk-script $srcdir --list >> $t
|
||||
sed -n '/^##test-files-end/,$p' $mam_template >> $t
|
||||
chmod -w $t
|
||||
mv $t $m
|
||||
done
|
||||
fi
|
||||
rm -fr $bt $bt2 || exit
|
||||
|
||||
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
||||
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
|
||||
@@ -561,20 +686,33 @@ find "$m4_base" "$source_base" \
|
||||
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
|
||||
-type l -xtype l -delete > /dev/null 2>&1
|
||||
|
||||
# Use automake's --silent-rules option, if possible.
|
||||
automake="${AUTOMAKE-automake} --add-missing --copy --force-missing"
|
||||
(${AUTOMAKE-automake} --help) 2>&1 \
|
||||
| grep -e '^ *--silent-rules' > /dev/null \
|
||||
&& automake="$automake --silent-rules"
|
||||
|
||||
# Reconfigure, getting other files.
|
||||
|
||||
for command in \
|
||||
libtool \
|
||||
'aclocal --force -I m4' \
|
||||
'autoconf --force' \
|
||||
'autoheader --force' \
|
||||
'automake --add-missing --copy --force-missing';
|
||||
"${ACLOCAL-aclocal} --force -I m4" \
|
||||
"${AUTOCONF-autoconf} --force" \
|
||||
"${AUTOHEADER-autoheader} --force" \
|
||||
"$automake"
|
||||
do
|
||||
if test "$command" = libtool; then
|
||||
grep '^[ ]*AM_PROG_LIBTOOL\>' configure.ac >/dev/null ||
|
||||
continue
|
||||
command='libtoolize -c -f'
|
||||
use_libtool=0
|
||||
# We'd like to use grep -E, to see if any of LT_INIT,
|
||||
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
||||
# but that's not portable enough (e.g., for Solaris).
|
||||
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
|
||||
&& use_libtool=1
|
||||
grep '^[ ]*LT_INIT' configure.ac >/dev/null \
|
||||
&& use_libtool=1
|
||||
test $use_libtool = 0 \
|
||||
&& continue
|
||||
command="${LIBTOOLIZE-libtoolize} -c -f"
|
||||
fi
|
||||
echo "$0: $command ..."
|
||||
$command || exit
|
||||
@@ -630,7 +768,4 @@ m=gnulib-tests/gnulib.mk
|
||||
sed 's,\.\./\.\.,..,g' $m > $m-t
|
||||
mv -f $m-t $m
|
||||
|
||||
# Make tests executable.
|
||||
chmod a+x gnulib-tests/test-*.sh
|
||||
|
||||
echo "$0: done. Now you can run './configure'."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Bootstrap configuration.
|
||||
|
||||
# Copyright (C) 2006-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2009 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -16,11 +16,11 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# We don't need these modules, even though gnulib-tool mistakenly
|
||||
# includes them because of gettext and fchdir dependencies.
|
||||
# We don't need these modules.
|
||||
avoided_gnulib_modules='
|
||||
--avoid=lock
|
||||
--avoid=canonicalize-lgpl
|
||||
--avoid=dummy
|
||||
--avoid=lock
|
||||
'
|
||||
|
||||
# These modules are obsolete and can probably be removed soon,
|
||||
@@ -34,38 +34,53 @@ obsolete_gnulib_modules='
|
||||
gnulib_modules="
|
||||
$avoided_gnulib_modules
|
||||
$obsolete_gnulib_modules
|
||||
acl alloca announce-gen argmatch assert
|
||||
acl alloca announce-gen argmatch
|
||||
argv-iter
|
||||
assert
|
||||
autobuild
|
||||
backupfile base64
|
||||
c-strcase c-strtod
|
||||
c-strtold calloc canon-host canonicalize chown cloexec
|
||||
config-h configmake
|
||||
closein closeout
|
||||
crypto/md5 crypto/sha1
|
||||
sha256 sha512
|
||||
crypto/md5
|
||||
crypto/sha1
|
||||
crypto/sha256
|
||||
crypto/sha512
|
||||
cycle-check
|
||||
d-ino d-type diacrit dirfd dirname dup2
|
||||
error euidaccess exclude exitfail fchdir fcntl fcntl-safer fdl
|
||||
file-type fileblocks filemode filenamecat fnmatch-gnu
|
||||
file-type fileblocks filemode filenamecat filevercmp fnmatch-gnu
|
||||
fopen-safer
|
||||
fprintftime
|
||||
fseeko
|
||||
fsusage ftruncate
|
||||
ftello
|
||||
fts getdate getgroups gethrxtime
|
||||
gendocs
|
||||
getline getloadavg getndelim2 getopt getpagesize getpass-gnu
|
||||
gettext gettime gettimeofday getugroups getusershell
|
||||
git-version-gen
|
||||
gitlog-to-changelog
|
||||
gnu-make gnumakefile gnupload
|
||||
group-member hard-locale hash hash-pjw host-os human idcache
|
||||
ignore-value
|
||||
inttostr inttypes isapipe
|
||||
lchmod lchown lib-ignore linebuffer link-follow
|
||||
long-options lstat malloc mbswidth memcasecmp mempcpy
|
||||
long-options lstat malloc
|
||||
manywarnings
|
||||
mbrtowc
|
||||
mbswidth
|
||||
memcasecmp memcmp2 mempcpy
|
||||
memrchr mgetgroups
|
||||
mkancesdirs mkdir mkdir-p mkstemp mktime modechange
|
||||
mountlist mpsort obstack pathmax perl physmem
|
||||
posix-shell posixtm posixver putenv
|
||||
posix-shell
|
||||
posixtm
|
||||
posixver
|
||||
progname
|
||||
propername
|
||||
putenv
|
||||
quote quotearg raise readlink areadlink-with-size
|
||||
randint
|
||||
randperm
|
||||
@@ -77,9 +92,10 @@ gnulib_modules="
|
||||
safe-read same
|
||||
save-cwd savedir savewd
|
||||
selinux-at
|
||||
settime sig2str ssize_t stat-macros
|
||||
settime sig2str sigaction ssize_t stat-macros
|
||||
stat-time stdbool stdlib-safer stpcpy
|
||||
stpncpy
|
||||
strdup
|
||||
strftime
|
||||
strpbrk strtoimax strtoumax strverscmp sys_stat timespec tzset
|
||||
unicodeio unistd-safer unlink-busy unlinkdir unlocked-io
|
||||
@@ -88,9 +104,12 @@ gnulib_modules="
|
||||
userspec utimecmp utimens
|
||||
vasprintf-posix
|
||||
vc-list-files
|
||||
verify version-etc-fsf
|
||||
verify version-etc-fsf verror
|
||||
warnings
|
||||
wcwidth winsz-ioctl winsz-termios write-any-file
|
||||
xalloc xgetcwd xgethostname
|
||||
xalloc
|
||||
xfreopen
|
||||
xgetcwd xgethostname
|
||||
xmemcoll xnanosleep
|
||||
xprintf
|
||||
xprintf-posix
|
||||
@@ -103,17 +122,27 @@ EXTRA_LOCALE_CATEGORIES=LC_TIME
|
||||
|
||||
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
||||
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
||||
--from-code=UTF-8\\\
|
||||
--flag=asprintf:2:c-format\\\
|
||||
--flag=asnprintf:3:c-format\\\
|
||||
--flag=asprintf:2:c-format\\\
|
||||
--flag=error:3:c-format\\\
|
||||
--flag=error_at_line:5:c-format\\\
|
||||
--flag=vasprintf:2:c-format\\\
|
||||
--flag=vasnprintf:3:c-format\\\
|
||||
--flag=vasprintf:2:c-format\\\
|
||||
--flag=verror:3:c-format\\\
|
||||
--flag=verror_at_line:5:c-format\\\
|
||||
--flag=wrapf:1:c-format\\\
|
||||
--flag=xasprintf:1:c-format\\\
|
||||
--flag=xfprintf:2:c-format\\\
|
||||
--flag=xprintf:1:c-format\\\
|
||||
--from-code=UTF-8\\\
|
||||
'
|
||||
|
||||
# Append these, since we use the propername module.
|
||||
see_manual='"This is a proper name. See the gettext manual, section Names."'
|
||||
see_manual=\'"$see_manual"\'
|
||||
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
||||
--keyword=proper_name:1,'"$see_manual"'\\\
|
||||
--keyword=proper_name_utf8:1,'"$see_manual"'\\\
|
||||
'
|
||||
|
||||
# If "AM_GNU_GETTEXT(external" or "AM_GNU_GETTEXT([external]"
|
||||
@@ -145,5 +174,21 @@ fi
|
||||
|
||||
gnulib_tool_option_extras="--tests-base=$bt/gnulib-tests --with-tests"
|
||||
|
||||
# Build prerequisites
|
||||
buildreq="\
|
||||
autoconf 2.61
|
||||
automake 1.10a
|
||||
autopoint -
|
||||
bison -
|
||||
gettext -
|
||||
git 1.4.4
|
||||
gperf -
|
||||
gzip -
|
||||
makeinfo -
|
||||
perl 5.5
|
||||
rsync -
|
||||
tar -
|
||||
"
|
||||
|
||||
# Automake requires that ChangeLog exist.
|
||||
touch ChangeLog
|
||||
|
||||
@@ -41,7 +41,7 @@ ENABLE_HARD_ERRORS = :
|
||||
|
||||
## We use GNU Make extensions (%-rules) inside GNU_MAKE checks,
|
||||
## and we override check-TESTS.
|
||||
AUTOMAKE_OPTIONS = -Wno-portability -Wno-override
|
||||
AUTOMAKE_OPTIONS += -Wno-portability -Wno-override
|
||||
|
||||
# Restructured Text title and section.
|
||||
am__rst_title = sed 's/.*/ & /;h;s/./=/g;p;x;p;g;p;s/.*//'
|
||||
@@ -100,15 +100,20 @@ _dirname = \
|
||||
# To be inserted before the command running the test. Creates the
|
||||
# directory for the log if needed. Stores in $dir the directory
|
||||
# containing $src, and passes TESTS_ENVIRONMENT.
|
||||
# Save and restore TERM around use of TESTS_ENVIRONMENT,
|
||||
# in case that unsets it.
|
||||
am__check_pre = \
|
||||
$(SH_E_WORKAROUND); \
|
||||
tst=`echo "$$src" | sed 's|^.*/||'`; \
|
||||
rm -f $@-t; \
|
||||
trap 'st=$$?; rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st' \
|
||||
1 2 13 15; \
|
||||
$(mkdir_p) "$$(echo '$@'|$(_dirname))" || exit; \
|
||||
if test -f "./$$src"; then dir=./; \
|
||||
elif test -f "$$src"; then dir=; \
|
||||
else dir="$(srcdir)/"; fi; \
|
||||
$(TESTS_ENVIRONMENT) $(SHELL)
|
||||
__SAVED_TERM=$$TERM; \
|
||||
$(TESTS_ENVIRONMENT)
|
||||
|
||||
# To be appended to the command running the test. Handles the stdout
|
||||
# and stderr redirection, and catch the exit status.
|
||||
@@ -118,6 +123,7 @@ estatus=$$?; \
|
||||
if test $$estatus -eq 177; then \
|
||||
$(ENABLE_HARD_ERRORS) || estatus=1; \
|
||||
fi; \
|
||||
TERM=$$__SAVED_TERM; export TERM; \
|
||||
$(am__tty_colors); \
|
||||
xfailed=PASS; \
|
||||
for xfail in : $(XFAIL_TESTS); do \
|
||||
@@ -139,7 +145,7 @@ echo "$$res: $@ (exit: $$estatus)" | \
|
||||
cat $@-t >>$@; \
|
||||
rm $@-t
|
||||
|
||||
SUFFIXES = .html .log
|
||||
SUFFIXES += .html .log
|
||||
|
||||
# From a test (with no extension) to a log file.
|
||||
if GNU_MAKE
|
||||
@@ -153,8 +159,9 @@ CHECK-FORCE:
|
||||
DEPENDENCY = CHECK-FORCE
|
||||
$(TEST_LOGS): $(DEPENDENCY)
|
||||
@if test '$(DEPENDENCY)' = CHECK-FORCE; then \
|
||||
dst=$@; \
|
||||
exec $(MAKE) $(AM_MAKEFLAGS) DEPENDENCY='$(srcdir)'/$${dst%.log} $@;\
|
||||
dst=$@; src=$${dst%.log}; \
|
||||
test -x "$$src" || src='$(srcdir)'/$$src; \
|
||||
exec $(MAKE) $(AM_MAKEFLAGS) DEPENDENCY="$$src" $@; \
|
||||
else \
|
||||
src='$(DEPENDENCY)'; \
|
||||
$(am__check_pre) "$$dir$$src" $(am__check_post); \
|
||||
@@ -206,8 +213,8 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
|
||||
for f in $(TEST_LOGS); \
|
||||
do \
|
||||
case $$(sed 1q $$f) in \
|
||||
SKIP:*|PASS:*|XFAIL:*);; \
|
||||
*) echo; cat $$f;; \
|
||||
SKIP:*|PASS:*|XFAIL:*);; \
|
||||
*) echo; cat $$f;; \
|
||||
esac; \
|
||||
done; \
|
||||
} >$(TEST_SUITE_LOG).tmp; \
|
||||
|
||||
158
cfg.mk
158
cfg.mk
@@ -1,5 +1,5 @@
|
||||
# Customize maint.mk -*- makefile -*-
|
||||
# Copyright (C) 2003-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2009 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -21,6 +21,9 @@ gnu_ftp_host-beta = alpha.gnu.org
|
||||
gnu_ftp_host-major = ftp.gnu.org
|
||||
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
|
||||
|
||||
# Used in maint.mk's web-manual rule
|
||||
manual_title = Core GNU utilities
|
||||
|
||||
url_dir_list = \
|
||||
ftp://$(gnu_rel_host)/gnu/coreutils
|
||||
|
||||
@@ -33,9 +36,162 @@ gpg_key_ID = B9AB9A16
|
||||
# at the top of the file for each `make distcheck' run.
|
||||
local-checks-to-skip = changelog-check strftime-check
|
||||
|
||||
local-checks-to-skip += patch-check
|
||||
|
||||
# The local directory containing the checked-out copy of gnulib used in this
|
||||
# release. Used solely to get gnulib's SHA1 for the "announcement" target.
|
||||
gnulib_dir = /gnulib
|
||||
|
||||
# Now that we have better (check.mk) tests, make this the default.
|
||||
export VERBOSE = yes
|
||||
|
||||
old_NEWS_hash = fa6cba1740b3f385520c1b54d90859ca
|
||||
|
||||
# Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
|
||||
dd = $(srcdir)/src/dd.c
|
||||
sc_dd_O_FLAGS:
|
||||
@rm -f $@.1 $@.2
|
||||
@{ echo O_FULLBLOCK; perl -nle '/^ +\| (O_\w*)$$/ and print $$1' \
|
||||
$(dd); } | sort > $@.1
|
||||
@{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
|
||||
$(dd); } | sort > $@.2
|
||||
@diff -u $@.1 $@.2 || diff=1 || diff=; \
|
||||
rm -f $@.1 $@.2; \
|
||||
test "$$diff" \
|
||||
&& { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
|
||||
# with the strings from the two affected variables.
|
||||
dd_c = $(srcdir)/src/dd.c
|
||||
sc_dd_max_sym_length:
|
||||
ifneq ($(wildcard $(dd_c)),)
|
||||
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
|
||||
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|
||||
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
|
||||
| wc --max-line-length); \
|
||||
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|
||||
|tr -d '"' | wc --max-line-length); \
|
||||
if test "$$len" = "$$max"; then :; else \
|
||||
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
endif
|
||||
|
||||
# Many m4 macros names once began with `jm_'.
|
||||
# On 2004-04-13, they were all changed to start with gl_ instead.
|
||||
# Make sure that none are inadvertently reintroduced.
|
||||
sc_prohibit_jm_in_m4:
|
||||
@grep -nE 'jm_[A-Z]' \
|
||||
$$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
|
||||
{ echo '$(ME): do not use jm_ in m4 macro names' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Ensure that each root-requiring test is run via the "check-root" rule.
|
||||
sc_root_tests:
|
||||
@if test -d tests \
|
||||
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
|
||||
t1=sc-root.expected; t2=sc-root.actual; \
|
||||
grep -nl '^require_root_$$' \
|
||||
$$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
|
||||
sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
|
||||
$(srcdir)/tests/Makefile.am \
|
||||
| sed 's/^ *//;/^root_tests =/d' \
|
||||
| tr -s '\012\\' ' ' | fmt -1 | sort > $$t2; \
|
||||
diff -u $$t1 $$t2 || diff=1 || diff=; \
|
||||
rm -f $$t1 $$t2; \
|
||||
test "$$diff" \
|
||||
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
headers_with_interesting_macro_defs = \
|
||||
exit.h \
|
||||
fcntl_.h \
|
||||
fnmatch_.h \
|
||||
intprops.h \
|
||||
inttypes_.h \
|
||||
lchown.h \
|
||||
openat.h \
|
||||
stat-macros.h \
|
||||
stdint_.h
|
||||
|
||||
# Create a list of regular expressions matching the names
|
||||
# of macros that are guaranteed by parts of gnulib to be defined.
|
||||
.re-defmac:
|
||||
@(cd $(srcdir)/lib; \
|
||||
for f in $(headers_with_interesting_macro_defs); do \
|
||||
test -f $$f && \
|
||||
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
|
||||
done; \
|
||||
) | sort -u \
|
||||
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
|
||||
| sed 's/^/^# *define /' \
|
||||
> $@-t
|
||||
@mv $@-t $@
|
||||
|
||||
# Don't define macros that we already get from gnulib header files.
|
||||
sc_always_defined_macros: .re-defmac
|
||||
@if test -f $(srcdir)/src/system.h; then \
|
||||
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
|
||||
grep -f .re-defmac $$($(VC_LIST)) \
|
||||
&& { echo '$(ME): define the above via some gnulib .h file' \
|
||||
1>&2; exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# Create a list of regular expressions matching the names
|
||||
# of files included from system.h. Exclude a couple.
|
||||
.re-list:
|
||||
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
|
||||
| grep -Ev 'sys/(param|file)\.h' \
|
||||
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
|
||||
> $@-t
|
||||
@mv $@-t $@
|
||||
|
||||
# Files in src/ should not include directly any of
|
||||
# the headers already included via system.h.
|
||||
sc_system_h_headers: .re-list
|
||||
@if test -f $(srcdir)/src/system.h; then \
|
||||
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
|
||||
grep -nE -f .re-list \
|
||||
$$($(VC_LIST) src | \
|
||||
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
|
||||
&& { echo '$(ME): the above are already included via system.h'\
|
||||
1>&2; exit 1; } || :; \
|
||||
fi
|
||||
|
||||
sc_sun_os_names:
|
||||
@grep -nEi \
|
||||
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_tight_scope:
|
||||
@$(MAKE) -C src $@
|
||||
|
||||
# Perl-based tests used to exec perl from a #!/bin/sh script.
|
||||
# Now they all start with #!/usr/bin/perl and the portability
|
||||
# infrastructure is in tests/Makefile.am. Make sure no old-style
|
||||
# script sneaks back in.
|
||||
sc_no_exec_perl_coreutils:
|
||||
@if test -f $(srcdir)/tests/Coreutils.pm; then \
|
||||
grep '^exec *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) && \
|
||||
{ echo 1>&2 '$(ME): found anachronistic Perl-based tests'; \
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# Ensure that date's --help output stays in sync with the info
|
||||
# documentation for GNU strftime. The only exception is %N,
|
||||
# which date accepts but GNU strftime does not.
|
||||
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
|
||||
sc_strftime_check:
|
||||
@if test -f $(srcdir)/src/date.c; then \
|
||||
grep '^ %. ' $(srcdir)/src/date.c | sort \
|
||||
| $(extract_char) > $@-src; \
|
||||
{ echo N; \
|
||||
info libc date calendar format | grep '^ `%.'\' \
|
||||
| $(extract_char); } | sort > $@-info; \
|
||||
diff -u $@-src $@-info || exit 1; \
|
||||
rm -f $@-src $@-info; \
|
||||
fi
|
||||
|
||||
182
configure.ac
182
configure.ac
@@ -1,7 +1,7 @@
|
||||
# -*- autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Copyright (C) 1991, 1993-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 1993-2009 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
dnl Written by Jim Meyering.
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
AC_PREREQ([2.61])
|
||||
|
||||
# Make inter-release version strings look like, e.g., v6.9-219-g58ddd, which
|
||||
# indicates that it is built from the 219th delta (in _some_ repository)
|
||||
@@ -27,13 +27,12 @@ AC_INIT([GNU coreutils],
|
||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
[bug-coreutils@gnu.org])
|
||||
|
||||
AC_CONFIG_SRCDIR(src/ls.c)
|
||||
AC_CONFIG_SRCDIR([src/ls.c])
|
||||
|
||||
AC_CONFIG_AUX_DIR(build-aux)
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
|
||||
|
||||
AB_INIT()
|
||||
AM_INIT_AUTOMAKE([1.10.1 dist-lzma])
|
||||
AM_INIT_AUTOMAKE([1.10a dist-xz])
|
||||
|
||||
AC_PROG_CC_STDC
|
||||
AM_PROG_CC_C_O
|
||||
@@ -45,20 +44,82 @@ gl_EARLY
|
||||
gl_INIT
|
||||
coreutils_MACROS
|
||||
|
||||
AC_ARG_ENABLE([gcc-warnings],
|
||||
[AS_HELP_STRING([--enable-gcc-warnings],
|
||||
[turn on lots of GCC warnings (for developers)])],
|
||||
[case $enableval in
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
|
||||
esac
|
||||
gl_gcc_warnings=$enableval],
|
||||
[gl_gcc_warnings=no]
|
||||
)
|
||||
|
||||
if test "$gl_gcc_warnings" = yes; then
|
||||
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
||||
AC_SUBST([WERROR_CFLAGS])
|
||||
|
||||
# Add many warnings, except some...
|
||||
nw="$nw -Wdeclaration-after-statement" # too useful to forbid
|
||||
nw="$nw -Waggregate-return" # anachronistic
|
||||
nw="$nw -Wc++-compat" # We don't care about C++ compilers
|
||||
nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
|
||||
nw="$nw -Wtraditional" # Warns on #elif which we use often
|
||||
nw="$nw -Wcast-qual" # Too many warnings for now
|
||||
nw="$nw -Wconversion" # Too many warnings for now
|
||||
nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
|
||||
nw="$nw -Wsign-conversion" # Too many warnings for now
|
||||
nw="$nw -Wtraditional-conversion" # Too many warnings for now
|
||||
nw="$nw -Wunreachable-code" # Too many warnings for now
|
||||
nw="$nw -Wpadded" # Our structs are not padded
|
||||
nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat
|
||||
nw="$nw -Wlogical-op" # any use of fwrite provokes this
|
||||
nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses
|
||||
nw="$nw -Wvla" # warnings in gettext.h
|
||||
nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
|
||||
nw="$nw -Wswitch-enum" # Too many warnings for now
|
||||
nw="$nw -Wswitch-default" # Too many warnings for now
|
||||
# things I might fix soon:
|
||||
nw="$nw -Wfloat-equal" # sort.c, seq.c
|
||||
nw="$nw -Wmissing-format-attribute" # copy.c
|
||||
nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
|
||||
nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot
|
||||
nw="$nw -Wstrict-overflow" # expr.c, pr.c, tr.c, factor.c
|
||||
# ?? -Wstrict-overflow
|
||||
|
||||
gl_MANYWARN_ALL_GCC([ws])
|
||||
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
|
||||
for w in $ws; do
|
||||
gl_WARN_ADD([$w])
|
||||
done
|
||||
gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
|
||||
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
|
||||
gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
|
||||
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
|
||||
gl_WARN_ADD([-fdiagnostics-show-option])
|
||||
|
||||
AC_SUBST([WARN_CFLAGS])
|
||||
|
||||
AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
|
||||
AC_DEFINE([_FORTIFY_SOURCE], [2],
|
||||
[enable compile-time and run-time bounds-checking, and some warnings])
|
||||
AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
|
||||
fi
|
||||
|
||||
AC_FUNC_FORK
|
||||
|
||||
optional_bin_progs=
|
||||
AC_CHECK_FUNCS(uname,
|
||||
AC_CHECK_FUNCS([uname],
|
||||
gl_ADD_PROG([optional_bin_progs], [uname]))
|
||||
AC_CHECK_FUNCS(chroot,
|
||||
AC_CHECK_FUNCS([chroot],
|
||||
gl_ADD_PROG([optional_bin_progs], [chroot]))
|
||||
AC_CHECK_FUNCS(gethostid,
|
||||
AC_CHECK_FUNCS([gethostid],
|
||||
gl_ADD_PROG([optional_bin_progs], [hostid]))
|
||||
|
||||
gl_WINSIZE_IN_PTEM
|
||||
|
||||
AC_MSG_CHECKING(whether localtime caches TZ)
|
||||
AC_CACHE_VAL(utils_cv_localtime_cache,
|
||||
AC_MSG_CHECKING([whether localtime caches TZ])
|
||||
AC_CACHE_VAL([utils_cv_localtime_cache],
|
||||
[if test x$ac_cv_func_tzset = xyes; then
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
|
||||
#if STDC_HEADERS
|
||||
@@ -99,22 +160,22 @@ else
|
||||
# since we can't invalidate the cache if we don't have tzset.
|
||||
utils_cv_localtime_cache=no
|
||||
fi])dnl
|
||||
AC_MSG_RESULT($utils_cv_localtime_cache)
|
||||
AC_MSG_RESULT([$utils_cv_localtime_cache])
|
||||
if test $utils_cv_localtime_cache = yes; then
|
||||
AC_DEFINE(LOCALTIME_CACHE, 1, [FIXME])
|
||||
AC_DEFINE([LOCALTIME_CACHE], [1], [FIXME])
|
||||
fi
|
||||
|
||||
# SCO-ODT-3.0 is reported to need -los to link programs using initgroups
|
||||
AC_CHECK_FUNCS(initgroups)
|
||||
AC_CHECK_FUNCS([initgroups])
|
||||
if test $ac_cv_func_initgroups = no; then
|
||||
AC_CHECK_LIB(os, initgroups)
|
||||
AC_CHECK_LIB([os], [initgroups])
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(syslog)
|
||||
AC_CHECK_FUNCS([syslog])
|
||||
if test $ac_cv_func_syslog = no; then
|
||||
# syslog is not in the default libraries. See if it's in some other.
|
||||
for lib in bsd socket inet; do
|
||||
AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG, 1, [FIXME])
|
||||
AC_CHECK_LIB([$lib], [syslog], [AC_DEFINE([HAVE_SYSLOG], [1], [FIXME])
|
||||
LIBS="$LIBS -l$lib"; break])
|
||||
done
|
||||
fi
|
||||
@@ -148,29 +209,29 @@ AC_DEFUN([coreutils_DUMMY_1],
|
||||
])
|
||||
coreutils_DUMMY_1
|
||||
|
||||
AC_MSG_CHECKING(ut_host in struct utmp)
|
||||
AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
|
||||
AC_MSG_CHECKING([ut_host in struct utmp])
|
||||
AC_CACHE_VAL([su_cv_func_ut_host_in_utmp],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
||||
#include <utmp.h>]], [[struct utmp ut; return !sizeof ut.ut_host;]])],
|
||||
[su_cv_func_ut_host_in_utmp=yes],
|
||||
[su_cv_func_ut_host_in_utmp=no])])
|
||||
AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
|
||||
AC_MSG_RESULT([$su_cv_func_ut_host_in_utmp])
|
||||
if test $su_cv_func_ut_host_in_utmp = yes; then
|
||||
have_ut_host=1
|
||||
AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
|
||||
AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
|
||||
fi
|
||||
|
||||
if test -z "$have_ut_host"; then
|
||||
AC_MSG_CHECKING(ut_host in struct utmpx)
|
||||
AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
|
||||
AC_MSG_CHECKING([ut_host in struct utmpx])
|
||||
AC_CACHE_VAL([su_cv_func_ut_host_in_utmpx],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
||||
#include <utmpx.h>]], [[struct utmpx ut; return !sizeof ut.ut_host;]])],
|
||||
[su_cv_func_ut_host_in_utmpx=yes],
|
||||
[su_cv_func_ut_host_in_utmpx=no])])
|
||||
AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
|
||||
AC_MSG_RESULT([$su_cv_func_ut_host_in_utmpx])
|
||||
if test $su_cv_func_ut_host_in_utmpx = yes; then
|
||||
AC_DEFINE(HAVE_UTMPX_H, 1, [FIXME])
|
||||
AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
|
||||
AC_DEFINE([HAVE_UTMPX_H], [1], [FIXME])
|
||||
AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -182,24 +243,24 @@ gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
|
||||
if test $ac_cv_sys_posix_termios = yes; then
|
||||
gl_ADD_PROG([optional_bin_progs], [stty])
|
||||
|
||||
AC_MSG_CHECKING(whether termios.h needs _XOPEN_SOURCE)
|
||||
AC_CACHE_VAL(su_cv_sys_termios_needs_xopen_source,
|
||||
[AC_EGREP_CPP(yes, [#include <termios.h>
|
||||
AC_MSG_CHECKING([whether termios.h needs _XOPEN_SOURCE])
|
||||
AC_CACHE_VAL([su_cv_sys_termios_needs_xopen_source],
|
||||
[AC_EGREP_CPP([yes], [#include <termios.h>
|
||||
#ifdef IUCLC
|
||||
yes
|
||||
#endif], su_cv_sys_termios_needs_xopen_source=no,
|
||||
AC_EGREP_CPP(yes, [#define _XOPEN_SOURCE
|
||||
AC_EGREP_CPP([yes], [#define _XOPEN_SOURCE
|
||||
#include <termios.h>
|
||||
#ifdef IUCLC
|
||||
yes
|
||||
#endif], su_cv_sys_termios_needs_xopen_source=yes,
|
||||
su_cv_sys_termios_needs_xopen_source=no))])
|
||||
AC_MSG_RESULT($su_cv_sys_termios_needs_xopen_source)
|
||||
AC_MSG_RESULT([$su_cv_sys_termios_needs_xopen_source])
|
||||
test $su_cv_sys_termios_needs_xopen_source = yes &&
|
||||
AC_DEFINE(TERMIOS_NEEDS_XOPEN_SOURCE, 1, [FIXME])
|
||||
AC_DEFINE([TERMIOS_NEEDS_XOPEN_SOURCE], [1], [FIXME])
|
||||
|
||||
AC_MSG_CHECKING(c_line in struct termios)
|
||||
AC_CACHE_VAL(su_cv_sys_c_line_in_termios,
|
||||
AC_MSG_CHECKING([c_line in struct termios])
|
||||
AC_CACHE_VAL([su_cv_sys_c_line_in_termios],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE
|
||||
#endif
|
||||
@@ -207,9 +268,9 @@ yes
|
||||
#include <termios.h>]], [[struct termios t; return !sizeof t.c_line;]])],
|
||||
[su_cv_sys_c_line_in_termios=yes],
|
||||
[su_cv_sys_c_line_in_termios=no])])
|
||||
AC_MSG_RESULT($su_cv_sys_c_line_in_termios)
|
||||
AC_MSG_RESULT([$su_cv_sys_c_line_in_termios])
|
||||
test $su_cv_sys_c_line_in_termios = yes \
|
||||
&& AC_DEFINE(HAVE_C_LINE, 1, [FIXME])
|
||||
&& AC_DEFINE([HAVE_C_LINE], [1], [FIXME])
|
||||
fi
|
||||
|
||||
# FIXME: note that this macro appears above, too.
|
||||
@@ -220,8 +281,8 @@ gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
|
||||
|
||||
if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
|
||||
test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
|
||||
AC_MSG_CHECKING(TIOCGWINSZ in sys/pty.h)
|
||||
AC_CACHE_VAL(su_cv_sys_tiocgwinsz_in_sys_pty_h,
|
||||
AC_MSG_CHECKING([TIOCGWINSZ in sys/pty.h])
|
||||
AC_CACHE_VAL([su_cv_sys_tiocgwinsz_in_sys_pty_h],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
||||
#ifdef WINSIZE_IN_PTEM
|
||||
# include <sys/stream.h>
|
||||
@@ -232,10 +293,10 @@ if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
|
||||
#include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
|
||||
[su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
|
||||
[su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
|
||||
AC_MSG_RESULT($su_cv_sys_tiocgwinsz_in_sys_pty_h)
|
||||
AC_MSG_RESULT([$su_cv_sys_tiocgwinsz_in_sys_pty_h])
|
||||
|
||||
test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
|
||||
&& AC_DEFINE(GWINSZ_IN_SYS_PTY, 1,
|
||||
&& AC_DEFINE([GWINSZ_IN_SYS_PTY], [1],
|
||||
[Define if your system defines TIOCGWINSZ in sys/pty.h.])
|
||||
fi
|
||||
|
||||
@@ -245,6 +306,7 @@ AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
|
||||
#include <signal.h>])
|
||||
|
||||
cu_LIB_CHECK
|
||||
cu_GMP
|
||||
|
||||
# Build df only if there's a point to it.
|
||||
if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
|
||||
@@ -259,7 +321,7 @@ mk="$srcdir/src/Makefile.am"
|
||||
v=EXTRA_PROGRAMS
|
||||
for gl_i in `sed -n '/^'$v' =/,/[[^\]]$/p' $mk \
|
||||
| sed 's/^ *//;/^\$.*/d;/^'$v' =/d' \
|
||||
| tr -s '\\012\\\\' ' '`; do
|
||||
| tr -s '\\015\\012\\\\' ' '`; do
|
||||
gl_ADD_PROG([optional_bin_progs], $gl_i)
|
||||
done
|
||||
|
||||
@@ -310,10 +372,11 @@ case " $optional_bin_progs " in
|
||||
*) INSTALL_SU=no ;;
|
||||
esac
|
||||
|
||||
MAN=`echo "$optional_bin_progs "|sed 's/ /.1 /g;s/ $//'`
|
||||
MAN=`echo "$optional_bin_progs "|sed 's/ /.1 /g;s/ $//'|tr -d '\\015\\012'`
|
||||
|
||||
# Change ginstall.1 to "install.h" in $MAN.
|
||||
MAN=`for m in $MAN; do test $m = ginstall.1 && m=install.1; echo $m; done | tr '\012' ' '; echo`
|
||||
MAN=`for m in $MAN; do test $m = ginstall.1 && m=install.1; echo $m; done \
|
||||
| tr '\015\012' ' '; echo`
|
||||
|
||||
# Remove [.1, since writing a portable rule for it in man/Makefile.am
|
||||
# is not practical. The sed LHS below uses the autoconf quadrigraph
|
||||
@@ -325,6 +388,8 @@ AC_SUBST([OPTIONAL_BIN_PROGS])
|
||||
NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default
|
||||
AC_SUBST([NO_INSTALL_PROGS_DEFAULT])
|
||||
|
||||
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
||||
|
||||
# Arrange to rerun configure whenever the file, src/Makefile.am,
|
||||
# containing the list of program names changes.
|
||||
CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/src/Makefile.am'
|
||||
@@ -334,6 +399,9 @@ AC_SUBST([CONFIG_STATUS_DEPENDENCIES])
|
||||
AM_GNU_GETTEXT([external], [need-formatstring-macros])
|
||||
AM_GNU_GETTEXT_VERSION([0.15])
|
||||
|
||||
# For a test of uniq: it uses the $LOCALE_FR envvar.
|
||||
gt_LOCALE_FR
|
||||
|
||||
AC_CONFIG_FILES(
|
||||
Makefile
|
||||
doc/Makefile
|
||||
@@ -343,33 +411,5 @@ AC_CONFIG_FILES(
|
||||
src/Makefile
|
||||
tests/Makefile
|
||||
gnulib-tests/Makefile
|
||||
tests/chgrp/Makefile
|
||||
tests/chmod/Makefile
|
||||
tests/chown/Makefile
|
||||
tests/cp/Makefile
|
||||
tests/cut/Makefile
|
||||
tests/dd/Makefile
|
||||
tests/du/Makefile
|
||||
tests/head/Makefile
|
||||
tests/install/Makefile
|
||||
tests/join/Makefile
|
||||
tests/ln/Makefile
|
||||
tests/ls/Makefile
|
||||
tests/misc/Makefile
|
||||
tests/mkdir/Makefile
|
||||
tests/mv/Makefile
|
||||
tests/pr/Makefile
|
||||
tests/readlink/Makefile
|
||||
tests/rm/Makefile
|
||||
tests/rmdir/Makefile
|
||||
tests/sort/Makefile
|
||||
tests/tac/Makefile
|
||||
tests/tail-2/Makefile
|
||||
tests/tail/Makefile
|
||||
tests/test/Makefile
|
||||
tests/touch/Makefile
|
||||
tests/tr/Makefile
|
||||
tests/uniq/Makefile
|
||||
tests/wc/Makefile
|
||||
)
|
||||
AC_OUTPUT
|
||||
|
||||
1
doc/.gitignore
vendored
1
doc/.gitignore
vendored
@@ -16,6 +16,7 @@ coreutils.toc
|
||||
coreutils.tp
|
||||
coreutils.vr
|
||||
fdl.texi
|
||||
gendocs_template
|
||||
getdate.texi
|
||||
stamp-vti
|
||||
version.texi
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Make coreutils documentation. -*-Makefile-*-
|
||||
|
||||
# Copyright (C) 1995-1998, 2001-2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995-1998, 2001-2009 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -29,10 +29,13 @@ EXTRA_DIST = perm.texi getdate.texi constants.texi fdl.texi
|
||||
# old systems.
|
||||
AM_MAKEINFOFLAGS = --no-split
|
||||
|
||||
constants.texi: $(top_srcdir)/src/tail.c
|
||||
constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c
|
||||
LC_ALL=C \
|
||||
sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
|
||||
$(top_srcdir)/src/tail.c > t-$@
|
||||
LC_ALL=C \
|
||||
sed -n -e 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
|
||||
$(top_srcdir)/src/shred.c >> t-$@
|
||||
mv t-$@ $@
|
||||
|
||||
MAINTAINERCLEANFILES = constants.texi
|
||||
@@ -50,13 +53,14 @@ syntax_checks = \
|
||||
sc-avoid-timezone \
|
||||
sc-avoid-zeroes \
|
||||
sc-exponent-grouping \
|
||||
sc-lower-case-var \
|
||||
sc-use-small-caps-NUL
|
||||
|
||||
.PHONY: $(syntax_checks) check-texinfo
|
||||
|
||||
# List words/regexps here that should not appear in the texinfo documentation.
|
||||
check-texinfo: $(syntax_checks)
|
||||
fail=0; \
|
||||
@fail=0; \
|
||||
grep '@url{' $(srcdir)/*.texi && fail=1; \
|
||||
grep '\$$@"' $(srcdir)/*.texi && fail=1; \
|
||||
grep -n '[^[:punct:]]@footnote' $(srcdir)/*.texi && fail=1; \
|
||||
@@ -68,32 +72,50 @@ check-texinfo: $(syntax_checks)
|
||||
$(srcdir)/*.texi 2> /dev/null || fail=1; }; \
|
||||
$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi && fail=1; \
|
||||
$(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi \
|
||||
| $(EGREP) -v '@vindex PATH$$|@env[{]PATH[}]' && fail=1; \
|
||||
| $(EGREP) -v 'search path|@vindex PATH$$|@env[{]PATH[}]' && fail=1; \
|
||||
exit $$fail
|
||||
|
||||
# Use `time zone', not `timezone'.
|
||||
sc-avoid-timezone:
|
||||
$(EGREP) timezone $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) timezone $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# Check for insufficient exponent grouping, e.g.,
|
||||
# @math{2^64} should be @math{2^{64}}.
|
||||
sc-exponent-grouping:
|
||||
$(EGREP) '\{.*\^[0-9][0-9]' $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) '\{.*\^[0-9][0-9]' $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# E.g., use @sc{nul}, not NUL.
|
||||
sc-use-small-caps-NUL:
|
||||
$(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# Say I/O, not IO.
|
||||
sc-avoid-io:
|
||||
$(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# I prefer nonzero over non-zero.
|
||||
sc-avoid-non-zero:
|
||||
$(EGREP) non-zero $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) non-zero $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent).
|
||||
sc-avoid-zeroes:
|
||||
$(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
@$(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && exit 1 || :
|
||||
|
||||
# ME = $(subdir)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
ME = doc/Makefile
|
||||
|
||||
# The quantity inside @var{...} should not contain upper case letters.
|
||||
# The leading backslash exemption is to permit in-macro uses like
|
||||
# @var{\varName\} where the upper case letter is part of a parameter name.
|
||||
find_upper_case_var = \
|
||||
'/\@var{/ or next; \
|
||||
while (/\@var{(.+?)}/g) \
|
||||
{ \
|
||||
$$v = $$1; \
|
||||
$$v =~ /[A-Z]/ && $$v !~ /^\\/ and (print "$$ARGV:$$.:$$_"), $$m = 1 \
|
||||
} \
|
||||
END {$$m and (warn "$(ME): do not use upper case in \@var{...}\n"), exit 1}'
|
||||
sc-lower-case-var:
|
||||
@$(PERL) -e 1 2> /dev/null && \
|
||||
$(PERL) -lne $(find_upper_case_var) $(srcdir)/*.texi
|
||||
|
||||
check: check-texinfo
|
||||
|
||||
1798
doc/coreutils.texi
1798
doc/coreutils.texi
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,10 @@
|
||||
@c File mode bits
|
||||
|
||||
@c Copyright (C) 1994, 1996, 1999, 2000, 2001, 2003, 2004, 2005, 2006
|
||||
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006, 2008
|
||||
@c Free Software Foundation, Inc.
|
||||
|
||||
@c Permission is granted to copy, distribute and/or modify this document
|
||||
@c under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
@c under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
@c any later version published by the Free Software Foundation; with no
|
||||
@c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
@c Texts. A copy of the license is included in the ``GNU Free
|
||||
|
||||
117
gl/lib/argv-iter.c
Normal file
117
gl/lib/argv-iter.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/* Iterate over arguments from argv or --files0-from=FILE
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#include <config.h>
|
||||
#include "argv-iter.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct argv_iterator
|
||||
{
|
||||
/* Test FP to determine whether in read-mode or argv-mode. */
|
||||
/* file-mode: fp records position */
|
||||
FILE *fp;
|
||||
size_t item_idx;
|
||||
char *tok;
|
||||
size_t buf_len;
|
||||
|
||||
/* argv-mode: record just argv and current pointer */
|
||||
char **arg_list;
|
||||
char **p;
|
||||
};
|
||||
|
||||
struct argv_iterator *
|
||||
argv_iter_init_argv (char **argv)
|
||||
{
|
||||
struct argv_iterator *ai = malloc (sizeof *ai);
|
||||
if (!ai)
|
||||
return NULL;
|
||||
ai->fp = NULL;
|
||||
ai->arg_list = argv;
|
||||
ai->p = argv;
|
||||
return ai;
|
||||
}
|
||||
|
||||
/* Initialize to read from the stream, FP.
|
||||
The input is expected to contain a list of NUL-delimited tokens. */
|
||||
struct argv_iterator *
|
||||
argv_iter_init_stream (FILE *fp)
|
||||
{
|
||||
struct argv_iterator *ai = malloc (sizeof *ai);
|
||||
if (!ai)
|
||||
return NULL;
|
||||
ai->fp = fp;
|
||||
ai->tok = NULL;
|
||||
ai->buf_len = 0;
|
||||
|
||||
ai->item_idx = 0;
|
||||
ai->arg_list = NULL;
|
||||
return ai;
|
||||
}
|
||||
|
||||
char *
|
||||
argv_iter (struct argv_iterator *ai, enum argv_iter_err *err)
|
||||
{
|
||||
if (ai->fp)
|
||||
{
|
||||
ssize_t len = getdelim (&ai->tok, &ai->buf_len, '\0', ai->fp);
|
||||
if (len < 0)
|
||||
{
|
||||
*err = feof (ai->fp) ? AI_ERR_EOF : AI_ERR_READ;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*err = AI_ERR_OK;
|
||||
ai->item_idx++;
|
||||
return ai->tok;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*(ai->p) == NULL)
|
||||
{
|
||||
*err = AI_ERR_EOF;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*err = AI_ERR_OK;
|
||||
return *(ai->p++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
argv_iter_n_args (struct argv_iterator const *ai)
|
||||
{
|
||||
return ai->fp ? ai->item_idx : ai->p - ai->arg_list;
|
||||
}
|
||||
|
||||
void
|
||||
argv_iter_free (struct argv_iterator *ai)
|
||||
{
|
||||
if (ai->fp)
|
||||
free (ai->tok);
|
||||
free (ai);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
47
gl/lib/argv-iter.h
Normal file
47
gl/lib/argv-iter.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* Iterate over arguments from argv or --files0-from=FILE
|
||||
Copyright (C) 2008-2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct argv_iterator;
|
||||
enum argv_iter_err;
|
||||
|
||||
#undef _ATTRIBUTE_NONNULL_
|
||||
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
|
||||
# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
|
||||
#else
|
||||
# define _ATTRIBUTE_NONNULL_(m)
|
||||
#endif
|
||||
|
||||
enum argv_iter_err
|
||||
{
|
||||
AI_ERR_OK = 1,
|
||||
AI_ERR_EOF,
|
||||
AI_ERR_MEM,
|
||||
AI_ERR_READ
|
||||
};
|
||||
|
||||
struct argv_iterator *argv_iter_init_argv (char **argv)
|
||||
_ATTRIBUTE_NONNULL_ (1);
|
||||
struct argv_iterator *argv_iter_init_stream (FILE *fp)
|
||||
_ATTRIBUTE_NONNULL_ (1);
|
||||
char *argv_iter (struct argv_iterator *, enum argv_iter_err *)
|
||||
_ATTRIBUTE_NONNULL_ (1) _ATTRIBUTE_NONNULL_ (2);
|
||||
size_t argv_iter_n_args (struct argv_iterator const *)
|
||||
_ATTRIBUTE_NONNULL_ (1);
|
||||
void argv_iter_free (struct argv_iterator *)
|
||||
_ATTRIBUTE_NONNULL_ (1);
|
||||
558
gl/lib/base64.c
558
gl/lib/base64.c
@@ -1,558 +0,0 @@
|
||||
/* base64.c -- Encode binary data using printable characters.
|
||||
Copyright (C) 1999, 2000, 2001, 2004, 2005, 2006, 2007 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Simon Josefsson. Partially adapted from GNU MailUtils
|
||||
* (mailbox/filter_trans.c, as of 2004-11-28). Improved by review
|
||||
* from Paul Eggert, Bruno Haible, and Stepan Kasal.
|
||||
*
|
||||
* See also RFC 3548 <http://www.ietf.org/rfc/rfc3548.txt>.
|
||||
*
|
||||
* Be careful with error checking. Here is how you would typically
|
||||
* use these functions:
|
||||
*
|
||||
* bool ok = base64_decode_alloc (in, inlen, &out, &outlen);
|
||||
* if (!ok)
|
||||
* FAIL: input was not valid base64
|
||||
* if (out == NULL)
|
||||
* FAIL: memory allocation error
|
||||
* OK: data in OUT/OUTLEN
|
||||
*
|
||||
* size_t outlen = base64_encode_alloc (in, inlen, &out);
|
||||
* if (out == NULL && outlen == 0 && inlen != 0)
|
||||
* FAIL: input too long
|
||||
* if (out == NULL)
|
||||
* FAIL: memory allocation error
|
||||
* OK: data in OUT/OUTLEN.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Get prototype. */
|
||||
#include "base64.h"
|
||||
|
||||
/* Get malloc. */
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Get UCHAR_MAX. */
|
||||
#include <limits.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* C89 compliant way to cast 'char' to 'unsigned char'. */
|
||||
static inline unsigned char
|
||||
to_uchar (char ch)
|
||||
{
|
||||
return ch;
|
||||
}
|
||||
|
||||
/* Base64 encode IN array of size INLEN into OUT array of size OUTLEN.
|
||||
If OUTLEN is less than BASE64_LENGTH(INLEN), write as many bytes as
|
||||
possible. If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero
|
||||
terminate the output buffer. */
|
||||
void
|
||||
base64_encode (const char *restrict in, size_t inlen,
|
||||
char *restrict out, size_t outlen)
|
||||
{
|
||||
static const char b64str[64] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
while (inlen && outlen)
|
||||
{
|
||||
*out++ = b64str[(to_uchar (in[0]) >> 2) & 0x3f];
|
||||
if (!--outlen)
|
||||
break;
|
||||
*out++ = b64str[((to_uchar (in[0]) << 4)
|
||||
+ (--inlen ? to_uchar (in[1]) >> 4 : 0))
|
||||
& 0x3f];
|
||||
if (!--outlen)
|
||||
break;
|
||||
*out++ =
|
||||
(inlen
|
||||
? b64str[((to_uchar (in[1]) << 2)
|
||||
+ (--inlen ? to_uchar (in[2]) >> 6 : 0))
|
||||
& 0x3f]
|
||||
: '=');
|
||||
if (!--outlen)
|
||||
break;
|
||||
*out++ = inlen ? b64str[to_uchar (in[2]) & 0x3f] : '=';
|
||||
if (!--outlen)
|
||||
break;
|
||||
if (inlen)
|
||||
inlen--;
|
||||
if (inlen)
|
||||
in += 3;
|
||||
}
|
||||
|
||||
if (outlen)
|
||||
*out = '\0';
|
||||
}
|
||||
|
||||
/* Allocate a buffer and store zero terminated base64 encoded data
|
||||
from array IN of size INLEN, returning BASE64_LENGTH(INLEN), i.e.,
|
||||
the length of the encoded data, excluding the terminating zero. On
|
||||
return, the OUT variable will hold a pointer to newly allocated
|
||||
memory that must be deallocated by the caller. If output string
|
||||
length would overflow, 0 is returned and OUT is set to NULL. If
|
||||
memory allocation failed, OUT is set to NULL, and the return value
|
||||
indicates length of the requested memory block, i.e.,
|
||||
BASE64_LENGTH(inlen) + 1. */
|
||||
size_t
|
||||
base64_encode_alloc (const char *in, size_t inlen, char **out)
|
||||
{
|
||||
size_t outlen = 1 + BASE64_LENGTH (inlen);
|
||||
|
||||
/* Check for overflow in outlen computation.
|
||||
*
|
||||
* If there is no overflow, outlen >= inlen.
|
||||
*
|
||||
* If the operation (inlen + 2) overflows then it yields at most +1, so
|
||||
* outlen is 0.
|
||||
*
|
||||
* If the multiplication overflows, we lose at least half of the
|
||||
* correct value, so the result is < ((inlen + 2) / 3) * 2, which is
|
||||
* less than (inlen + 2) * 0.66667, which is less than inlen as soon as
|
||||
* (inlen > 4).
|
||||
*/
|
||||
if (inlen > outlen)
|
||||
{
|
||||
*out = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
*out = malloc (outlen);
|
||||
if (!*out)
|
||||
return outlen;
|
||||
|
||||
base64_encode (in, inlen, *out, outlen);
|
||||
|
||||
return outlen - 1;
|
||||
}
|
||||
|
||||
/* With this approach this file works independent of the charset used
|
||||
(think EBCDIC). However, it does assume that the characters in the
|
||||
Base64 alphabet (A-Za-z0-9+/) are encoded in 0..255. POSIX
|
||||
1003.1-2001 require that char and unsigned char are 8-bit
|
||||
quantities, though, taking care of that problem. But this may be a
|
||||
potential problem on non-POSIX C99 platforms.
|
||||
|
||||
IBM C V6 for AIX mishandles "#define B64(x) ...'x'...", so use "_"
|
||||
as the formal parameter rather than "x". */
|
||||
#define B64(_) \
|
||||
((_) == 'A' ? 0 \
|
||||
: (_) == 'B' ? 1 \
|
||||
: (_) == 'C' ? 2 \
|
||||
: (_) == 'D' ? 3 \
|
||||
: (_) == 'E' ? 4 \
|
||||
: (_) == 'F' ? 5 \
|
||||
: (_) == 'G' ? 6 \
|
||||
: (_) == 'H' ? 7 \
|
||||
: (_) == 'I' ? 8 \
|
||||
: (_) == 'J' ? 9 \
|
||||
: (_) == 'K' ? 10 \
|
||||
: (_) == 'L' ? 11 \
|
||||
: (_) == 'M' ? 12 \
|
||||
: (_) == 'N' ? 13 \
|
||||
: (_) == 'O' ? 14 \
|
||||
: (_) == 'P' ? 15 \
|
||||
: (_) == 'Q' ? 16 \
|
||||
: (_) == 'R' ? 17 \
|
||||
: (_) == 'S' ? 18 \
|
||||
: (_) == 'T' ? 19 \
|
||||
: (_) == 'U' ? 20 \
|
||||
: (_) == 'V' ? 21 \
|
||||
: (_) == 'W' ? 22 \
|
||||
: (_) == 'X' ? 23 \
|
||||
: (_) == 'Y' ? 24 \
|
||||
: (_) == 'Z' ? 25 \
|
||||
: (_) == 'a' ? 26 \
|
||||
: (_) == 'b' ? 27 \
|
||||
: (_) == 'c' ? 28 \
|
||||
: (_) == 'd' ? 29 \
|
||||
: (_) == 'e' ? 30 \
|
||||
: (_) == 'f' ? 31 \
|
||||
: (_) == 'g' ? 32 \
|
||||
: (_) == 'h' ? 33 \
|
||||
: (_) == 'i' ? 34 \
|
||||
: (_) == 'j' ? 35 \
|
||||
: (_) == 'k' ? 36 \
|
||||
: (_) == 'l' ? 37 \
|
||||
: (_) == 'm' ? 38 \
|
||||
: (_) == 'n' ? 39 \
|
||||
: (_) == 'o' ? 40 \
|
||||
: (_) == 'p' ? 41 \
|
||||
: (_) == 'q' ? 42 \
|
||||
: (_) == 'r' ? 43 \
|
||||
: (_) == 's' ? 44 \
|
||||
: (_) == 't' ? 45 \
|
||||
: (_) == 'u' ? 46 \
|
||||
: (_) == 'v' ? 47 \
|
||||
: (_) == 'w' ? 48 \
|
||||
: (_) == 'x' ? 49 \
|
||||
: (_) == 'y' ? 50 \
|
||||
: (_) == 'z' ? 51 \
|
||||
: (_) == '0' ? 52 \
|
||||
: (_) == '1' ? 53 \
|
||||
: (_) == '2' ? 54 \
|
||||
: (_) == '3' ? 55 \
|
||||
: (_) == '4' ? 56 \
|
||||
: (_) == '5' ? 57 \
|
||||
: (_) == '6' ? 58 \
|
||||
: (_) == '7' ? 59 \
|
||||
: (_) == '8' ? 60 \
|
||||
: (_) == '9' ? 61 \
|
||||
: (_) == '+' ? 62 \
|
||||
: (_) == '/' ? 63 \
|
||||
: -1)
|
||||
|
||||
static const signed char b64[0x100] = {
|
||||
B64 (0), B64 (1), B64 (2), B64 (3),
|
||||
B64 (4), B64 (5), B64 (6), B64 (7),
|
||||
B64 (8), B64 (9), B64 (10), B64 (11),
|
||||
B64 (12), B64 (13), B64 (14), B64 (15),
|
||||
B64 (16), B64 (17), B64 (18), B64 (19),
|
||||
B64 (20), B64 (21), B64 (22), B64 (23),
|
||||
B64 (24), B64 (25), B64 (26), B64 (27),
|
||||
B64 (28), B64 (29), B64 (30), B64 (31),
|
||||
B64 (32), B64 (33), B64 (34), B64 (35),
|
||||
B64 (36), B64 (37), B64 (38), B64 (39),
|
||||
B64 (40), B64 (41), B64 (42), B64 (43),
|
||||
B64 (44), B64 (45), B64 (46), B64 (47),
|
||||
B64 (48), B64 (49), B64 (50), B64 (51),
|
||||
B64 (52), B64 (53), B64 (54), B64 (55),
|
||||
B64 (56), B64 (57), B64 (58), B64 (59),
|
||||
B64 (60), B64 (61), B64 (62), B64 (63),
|
||||
B64 (64), B64 (65), B64 (66), B64 (67),
|
||||
B64 (68), B64 (69), B64 (70), B64 (71),
|
||||
B64 (72), B64 (73), B64 (74), B64 (75),
|
||||
B64 (76), B64 (77), B64 (78), B64 (79),
|
||||
B64 (80), B64 (81), B64 (82), B64 (83),
|
||||
B64 (84), B64 (85), B64 (86), B64 (87),
|
||||
B64 (88), B64 (89), B64 (90), B64 (91),
|
||||
B64 (92), B64 (93), B64 (94), B64 (95),
|
||||
B64 (96), B64 (97), B64 (98), B64 (99),
|
||||
B64 (100), B64 (101), B64 (102), B64 (103),
|
||||
B64 (104), B64 (105), B64 (106), B64 (107),
|
||||
B64 (108), B64 (109), B64 (110), B64 (111),
|
||||
B64 (112), B64 (113), B64 (114), B64 (115),
|
||||
B64 (116), B64 (117), B64 (118), B64 (119),
|
||||
B64 (120), B64 (121), B64 (122), B64 (123),
|
||||
B64 (124), B64 (125), B64 (126), B64 (127),
|
||||
B64 (128), B64 (129), B64 (130), B64 (131),
|
||||
B64 (132), B64 (133), B64 (134), B64 (135),
|
||||
B64 (136), B64 (137), B64 (138), B64 (139),
|
||||
B64 (140), B64 (141), B64 (142), B64 (143),
|
||||
B64 (144), B64 (145), B64 (146), B64 (147),
|
||||
B64 (148), B64 (149), B64 (150), B64 (151),
|
||||
B64 (152), B64 (153), B64 (154), B64 (155),
|
||||
B64 (156), B64 (157), B64 (158), B64 (159),
|
||||
B64 (160), B64 (161), B64 (162), B64 (163),
|
||||
B64 (164), B64 (165), B64 (166), B64 (167),
|
||||
B64 (168), B64 (169), B64 (170), B64 (171),
|
||||
B64 (172), B64 (173), B64 (174), B64 (175),
|
||||
B64 (176), B64 (177), B64 (178), B64 (179),
|
||||
B64 (180), B64 (181), B64 (182), B64 (183),
|
||||
B64 (184), B64 (185), B64 (186), B64 (187),
|
||||
B64 (188), B64 (189), B64 (190), B64 (191),
|
||||
B64 (192), B64 (193), B64 (194), B64 (195),
|
||||
B64 (196), B64 (197), B64 (198), B64 (199),
|
||||
B64 (200), B64 (201), B64 (202), B64 (203),
|
||||
B64 (204), B64 (205), B64 (206), B64 (207),
|
||||
B64 (208), B64 (209), B64 (210), B64 (211),
|
||||
B64 (212), B64 (213), B64 (214), B64 (215),
|
||||
B64 (216), B64 (217), B64 (218), B64 (219),
|
||||
B64 (220), B64 (221), B64 (222), B64 (223),
|
||||
B64 (224), B64 (225), B64 (226), B64 (227),
|
||||
B64 (228), B64 (229), B64 (230), B64 (231),
|
||||
B64 (232), B64 (233), B64 (234), B64 (235),
|
||||
B64 (236), B64 (237), B64 (238), B64 (239),
|
||||
B64 (240), B64 (241), B64 (242), B64 (243),
|
||||
B64 (244), B64 (245), B64 (246), B64 (247),
|
||||
B64 (248), B64 (249), B64 (250), B64 (251),
|
||||
B64 (252), B64 (253), B64 (254), B64 (255)
|
||||
};
|
||||
|
||||
#if UCHAR_MAX == 255
|
||||
# define uchar_in_range(c) true
|
||||
#else
|
||||
# define uchar_in_range(c) ((c) <= 255)
|
||||
#endif
|
||||
|
||||
/* Return true if CH is a character from the Base64 alphabet, and
|
||||
false otherwise. Note that '=' is padding and not considered to be
|
||||
part of the alphabet. */
|
||||
bool
|
||||
isbase64 (char ch)
|
||||
{
|
||||
return uchar_in_range (to_uchar (ch)) && 0 <= b64[to_uchar (ch)];
|
||||
}
|
||||
|
||||
/* Initialize decode-context buffer, CTX. */
|
||||
void
|
||||
base64_decode_ctx_init (struct base64_decode_context *ctx)
|
||||
{
|
||||
ctx->i = 0;
|
||||
}
|
||||
|
||||
/* If CTX->i is 0 or 4, there are four or more bytes in [*IN..IN_END), and
|
||||
none of those four is a newline, then return *IN. Otherwise, copy up to
|
||||
4 - CTX->i non-newline bytes from that range into CTX->buf, starting at
|
||||
index CTX->i and setting CTX->i to reflect the number of bytes copied,
|
||||
and return CTX->buf. In either case, advance *IN to point to the byte
|
||||
after the last one processed, and set *N_NON_NEWLINE to the number of
|
||||
verified non-newline bytes accessible through the returned pointer. */
|
||||
static inline char *
|
||||
get_4 (struct base64_decode_context *ctx,
|
||||
char const *restrict *in, char const *restrict in_end,
|
||||
size_t *n_non_newline)
|
||||
{
|
||||
if (ctx->i == 4)
|
||||
ctx->i = 0;
|
||||
|
||||
if (ctx->i == 0)
|
||||
{
|
||||
char const *t = *in;
|
||||
if (4 <= in_end - *in && memchr (t, '\n', 4) == NULL)
|
||||
{
|
||||
/* This is the common case: no newline. */
|
||||
*in += 4;
|
||||
*n_non_newline = 4;
|
||||
return (char *) t;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
/* Copy non-newline bytes into BUF. */
|
||||
char const *p = *in;
|
||||
while (p < in_end)
|
||||
{
|
||||
char c = *p++;
|
||||
if (c != '\n')
|
||||
{
|
||||
ctx->buf[ctx->i++] = c;
|
||||
if (ctx->i == 4)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*in = p;
|
||||
*n_non_newline = ctx->i;
|
||||
return ctx->buf;
|
||||
}
|
||||
}
|
||||
|
||||
#define return_false \
|
||||
do \
|
||||
{ \
|
||||
*outp = out; \
|
||||
return false; \
|
||||
} \
|
||||
while (false)
|
||||
|
||||
/* Decode up to four bytes of base64-encoded data, IN, of length INLEN
|
||||
into the output buffer, *OUT, of size *OUTLEN bytes. Return true if
|
||||
decoding is successful, false otherwise. If *OUTLEN is too small,
|
||||
as many bytes as possible are written to *OUT. On return, advance
|
||||
*OUT to point to the byte after the last one written, and decrement
|
||||
*OUTLEN to reflect the number of bytes remaining in *OUT. */
|
||||
static inline bool
|
||||
decode_4 (char const *restrict in, size_t inlen,
|
||||
char *restrict *outp, size_t *outleft)
|
||||
{
|
||||
char *out = *outp;
|
||||
if (inlen < 2)
|
||||
return false;
|
||||
|
||||
if (!isbase64 (in[0]) || !isbase64 (in[1]))
|
||||
return false;
|
||||
|
||||
if (*outleft)
|
||||
{
|
||||
*out++ = ((b64[to_uchar (in[0])] << 2)
|
||||
| (b64[to_uchar (in[1])] >> 4));
|
||||
--*outleft;
|
||||
}
|
||||
|
||||
if (inlen == 2)
|
||||
return_false;
|
||||
|
||||
if (in[2] == '=')
|
||||
{
|
||||
if (inlen != 4)
|
||||
return_false;
|
||||
|
||||
if (in[3] != '=')
|
||||
return_false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isbase64 (in[2]))
|
||||
return_false;
|
||||
|
||||
if (*outleft)
|
||||
{
|
||||
*out++ = (((b64[to_uchar (in[1])] << 4) & 0xf0)
|
||||
| (b64[to_uchar (in[2])] >> 2));
|
||||
--*outleft;
|
||||
}
|
||||
|
||||
if (inlen == 3)
|
||||
return_false;
|
||||
|
||||
if (in[3] == '=')
|
||||
{
|
||||
if (inlen != 4)
|
||||
return_false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isbase64 (in[3]))
|
||||
return_false;
|
||||
|
||||
if (*outleft)
|
||||
{
|
||||
*out++ = (((b64[to_uchar (in[2])] << 6) & 0xc0)
|
||||
| b64[to_uchar (in[3])]);
|
||||
--*outleft;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*outp = out;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Decode base64-encoded input array IN of length INLEN to output array
|
||||
OUT that can hold *OUTLEN bytes. The input data may be interspersed
|
||||
with newlines. Return true if decoding was successful, i.e. if the
|
||||
input was valid base64 data, false otherwise. If *OUTLEN is too
|
||||
small, as many bytes as possible will be written to OUT. On return,
|
||||
*OUTLEN holds the length of decoded bytes in OUT. Note that as soon
|
||||
as any non-alphabet, non-newline character is encountered, decoding
|
||||
is stopped and false is returned. If INLEN is zero, then process
|
||||
only whatever data is stored in CTX.
|
||||
|
||||
Initially, CTX must have been initialized via base64_decode_ctx_init.
|
||||
Subsequent calls to this function must reuse whatever state is recorded
|
||||
in that buffer. It is necessary for when a quadruple of base64 input
|
||||
bytes spans two input buffers. */
|
||||
|
||||
bool
|
||||
base64_decode (struct base64_decode_context *ctx,
|
||||
const char *restrict in, size_t inlen,
|
||||
char *restrict out, size_t *outlen)
|
||||
{
|
||||
size_t outleft = *outlen;
|
||||
bool flush_ctx = inlen == 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
size_t outleft_save = outleft;
|
||||
if (ctx->i == 0 && !flush_ctx)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
/* Save a copy of outleft, in case we need to re-parse this
|
||||
block of four bytes. */
|
||||
outleft_save = outleft;
|
||||
if (!decode_4 (in, inlen, &out, &outleft))
|
||||
break;
|
||||
|
||||
in += 4;
|
||||
inlen -= 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (inlen == 0 && !flush_ctx)
|
||||
break;
|
||||
|
||||
/* Handle the common case of 72-byte wrapped lines.
|
||||
This also handles any other multiple-of-4-byte wrapping. */
|
||||
if (inlen && *in == '\n')
|
||||
{
|
||||
++in;
|
||||
--inlen;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Restore OUT and OUTLEFT. */
|
||||
out -= outleft_save - outleft;
|
||||
outleft = outleft_save;
|
||||
|
||||
{
|
||||
char const *in_end = in + inlen;
|
||||
char const *non_nl = get_4 (ctx, &in, in_end, &inlen);
|
||||
|
||||
/* If the input is empty or consists solely of newlines (0 non-newlines),
|
||||
then we're done. Likewise if there are fewer than 4 bytes when not
|
||||
flushing context. */
|
||||
if (inlen == 0 || (inlen < 4 && !flush_ctx))
|
||||
{
|
||||
inlen = 0;
|
||||
break;
|
||||
}
|
||||
if (!decode_4 (non_nl, inlen, &out, &outleft))
|
||||
break;
|
||||
|
||||
inlen = in_end - in;
|
||||
}
|
||||
}
|
||||
|
||||
*outlen -= outleft;
|
||||
|
||||
return inlen == 0;
|
||||
}
|
||||
|
||||
/* Allocate an output buffer in *OUT, and decode the base64 encoded
|
||||
data stored in IN of size INLEN to the *OUT buffer. On return, the
|
||||
size of the decoded data is stored in *OUTLEN. OUTLEN may be NULL,
|
||||
if the caller is not interested in the decoded length. *OUT may be
|
||||
NULL to indicate an out of memory error, in which case *OUTLEN
|
||||
contains the size of the memory block needed. The function returns
|
||||
true on successful decoding and memory allocation errors. (Use the
|
||||
*OUT and *OUTLEN parameters to differentiate between successful
|
||||
decoding and memory error.) The function returns false if the
|
||||
input was invalid, in which case *OUT is NULL and *OUTLEN is
|
||||
undefined. */
|
||||
bool
|
||||
base64_decode_alloc (struct base64_decode_context *ctx,
|
||||
const char *in, size_t inlen, char **out,
|
||||
size_t *outlen)
|
||||
{
|
||||
/* This may allocate a few bytes too many, depending on input,
|
||||
but it's not worth the extra CPU time to compute the exact size.
|
||||
The exact size is 3 * inlen / 4, minus 1 if the input ends
|
||||
with "=" and minus another 1 if the input ends with "==".
|
||||
Dividing before multiplying avoids the possibility of overflow. */
|
||||
size_t needlen = 3 * (inlen / 4) + 2;
|
||||
|
||||
*out = malloc (needlen);
|
||||
if (!*out)
|
||||
return true;
|
||||
|
||||
if (!base64_decode (ctx, in, inlen, *out, &needlen))
|
||||
{
|
||||
free (*out);
|
||||
*out = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (outlen)
|
||||
*outlen = needlen;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/* base64.h -- Encode binary data using printable characters.
|
||||
Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Written by Simon Josefsson.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef BASE64_H
|
||||
# define BASE64_H
|
||||
|
||||
/* Get size_t. */
|
||||
# include <stddef.h>
|
||||
|
||||
/* Get bool. */
|
||||
# include <stdbool.h>
|
||||
|
||||
/* This uses that the expression (n+(k-1))/k means the smallest
|
||||
integer >= n/k, i.e., the ceiling of n/k. */
|
||||
# define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
|
||||
|
||||
struct base64_decode_context
|
||||
{
|
||||
unsigned int i;
|
||||
char buf[4];
|
||||
};
|
||||
|
||||
extern bool isbase64 (char ch);
|
||||
|
||||
extern void base64_encode (const char *restrict in, size_t inlen,
|
||||
char *restrict out, size_t outlen);
|
||||
|
||||
extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
|
||||
|
||||
extern void base64_decode_ctx_init (struct base64_decode_context *ctx);
|
||||
extern bool base64_decode (struct base64_decode_context *ctx,
|
||||
const char *restrict in, size_t inlen,
|
||||
char *restrict out, size_t *outlen);
|
||||
|
||||
extern bool base64_decode_alloc (struct base64_decode_context *ctx,
|
||||
const char *in, size_t inlen,
|
||||
char **out, size_t *outlen);
|
||||
|
||||
#endif /* BASE64_H */
|
||||
@@ -1,6 +1,6 @@
|
||||
/* mgetgroups.c -- return a list of the groups a user is in
|
||||
|
||||
Copyright (C) 2007-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -33,16 +33,16 @@
|
||||
#include "xalloc.h"
|
||||
|
||||
|
||||
static void *
|
||||
allocate_groupbuf (int size)
|
||||
static GETGROUPS_T *
|
||||
realloc_groupbuf (GETGROUPS_T *g, size_t num)
|
||||
{
|
||||
if (xalloc_oversized (size, sizeof (GETGROUPS_T)))
|
||||
if (xalloc_oversized (num, sizeof (*g)))
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return malloc (size * sizeof (GETGROUPS_T));
|
||||
return realloc (g, num * sizeof (*g));
|
||||
}
|
||||
|
||||
/* Like getugroups, but store the result in malloc'd storage.
|
||||
@@ -65,45 +65,27 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
|
||||
performance characteristics.
|
||||
|
||||
In glibc 2.3.2, getgrouplist is buggy. If you pass a zero as the
|
||||
size of the output buffer, getgrouplist will still write to the
|
||||
length of the output buffer, getgrouplist will still write to the
|
||||
buffer. Contrary to what some versions of the getgrouplist
|
||||
manpage say, this doesn't happen with nonzero buffer sizes.
|
||||
Therefore our usage here just avoids a zero sized buffer. */
|
||||
if (username)
|
||||
{
|
||||
enum { N_GROUPS_INIT = 10 };
|
||||
GETGROUPS_T smallbuf[N_GROUPS_INIT];
|
||||
|
||||
max_n_groups = N_GROUPS_INIT;
|
||||
ng = getgrouplist (username, gid, smallbuf, &max_n_groups);
|
||||
|
||||
g = allocate_groupbuf (max_n_groups);
|
||||
g = realloc_groupbuf (NULL, max_n_groups);
|
||||
if (g == NULL)
|
||||
return -1;
|
||||
|
||||
if (max_n_groups <= N_GROUPS_INIT)
|
||||
{
|
||||
/* smallbuf was big enough, so we already have our data */
|
||||
memcpy (g, smallbuf, max_n_groups * sizeof *g);
|
||||
*groups = g;
|
||||
return max_n_groups;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
GETGROUPS_T *h;
|
||||
|
||||
/* getgrouplist updates max_n_groups to num required. */
|
||||
ng = getgrouplist (username, gid, g, &max_n_groups);
|
||||
if (0 <= ng)
|
||||
{
|
||||
*groups = g;
|
||||
return ng;
|
||||
}
|
||||
|
||||
/* When getgrouplist fails, it guarantees that
|
||||
max_n_groups reflects the new number of groups. */
|
||||
|
||||
if (xalloc_oversized (max_n_groups, sizeof *h)
|
||||
|| (h = realloc (g, max_n_groups * sizeof *h)) == NULL)
|
||||
if ((h = realloc_groupbuf (g, max_n_groups)) == NULL)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
free (g);
|
||||
@@ -111,6 +93,12 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
|
||||
return -1;
|
||||
}
|
||||
g = h;
|
||||
|
||||
if (0 <= ng)
|
||||
{
|
||||
*groups = g;
|
||||
return ng;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* else no username, so fall through and use getgroups. */
|
||||
@@ -125,7 +113,7 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
|
||||
if (max_n_groups < 0)
|
||||
max_n_groups = 5;
|
||||
|
||||
g = allocate_groupbuf (max_n_groups);
|
||||
g = realloc_groupbuf (NULL, max_n_groups);
|
||||
if (g == NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Generate buffers of random data.
|
||||
|
||||
Copyright (C) 2006, 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2008-2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -43,16 +43,6 @@
|
||||
# define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef __attribute__
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
|
||||
# define __attribute__(x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
#endif
|
||||
|
||||
#if _STRING_ARCH_unaligned
|
||||
# define ALIGNED_POINTER(ptr, type) true
|
||||
#else
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef SELINUX_CONTEXT_H
|
||||
# define SELINUX_CONTEXT_H
|
||||
|
||||
# include <errno.h>
|
||||
/* Some systems don't have ENOTSUP. */
|
||||
# ifndef ENOTSUP
|
||||
# ifdef ENOSYS
|
||||
# define ENOTSUP ENOSYS
|
||||
# else
|
||||
/* Some systems don't have ENOSYS either. */
|
||||
# define ENOTSUP EINVAL
|
||||
# endif
|
||||
# endif
|
||||
|
||||
typedef int context_t;
|
||||
static inline context_t context_new (char const *s)
|
||||
{ errno = ENOTSUP; return 0; }
|
||||
static inline char *context_str (context_t con)
|
||||
{ errno = ENOTSUP; return (void *) 0; }
|
||||
static inline void context_free (context_t c) {}
|
||||
|
||||
static inline int context_user_set (context_t sc, char const *s)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int context_role_set (context_t sc, char const *s)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int context_range_set (context_t sc, char const *s)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int context_type_set (context_t sc, char const *s)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
|
||||
#endif
|
||||
@@ -1,57 +0,0 @@
|
||||
#ifndef SELINUX_SELINUX_H
|
||||
# define SELINUX_SELINUX_H
|
||||
|
||||
# include <sys/types.h>
|
||||
# include <errno.h>
|
||||
/* Some systems don't have ENOTSUP. */
|
||||
# ifndef ENOTSUP
|
||||
# ifdef ENOSYS
|
||||
# define ENOTSUP ENOSYS
|
||||
# else
|
||||
/* Some systems don't have ENOSYS either. */
|
||||
# define ENOTSUP EINVAL
|
||||
# endif
|
||||
# endif
|
||||
|
||||
typedef unsigned short security_class_t;
|
||||
# define security_context_t char*
|
||||
# define is_selinux_enabled() 0
|
||||
|
||||
static inline int getcon (security_context_t *con) { errno = ENOTSUP; return -1; }
|
||||
static inline void freecon (security_context_t con) {}
|
||||
|
||||
|
||||
static inline int getfscreatecon (security_context_t *con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int setfscreatecon (security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int matchpathcon (char const *s, mode_t m,
|
||||
security_context_t *con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
|
||||
static inline int getfilecon (char const *s, security_context_t *con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int lgetfilecon (char const *s, security_context_t *con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int setfilecon (char const *s, security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int lsetfilecon (char const *s, security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int fsetfilecon (int fd, security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
|
||||
static inline int security_check_context (security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int security_check_context_raw (security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int setexeccon (security_context_t con)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int security_compute_create (security_context_t scon,
|
||||
security_context_t tcon,
|
||||
security_class_t tclass,
|
||||
security_context_t *newcon)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
static inline int matchpathcon_init_prefix (char const *path,
|
||||
char const *prefix)
|
||||
{ errno = ENOTSUP; return -1; }
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/* openat-style fd-relative functions for SE Linux
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -29,9 +29,6 @@
|
||||
#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
|
||||
#include "save-cwd.h"
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
#include "openat-priv.h"
|
||||
|
||||
#define AT_FUNC_NAME getfileconat
|
||||
|
||||
550
gl/lib/sha256.c
550
gl/lib/sha256.c
@@ -1,550 +0,0 @@
|
||||
/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
|
||||
memory blocks according to the NIST specification FIPS-180-2.
|
||||
|
||||
Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by David Madore, considerably copypasting from
|
||||
Scott G. Miller's sha1.c
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "sha256.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#if USE_UNLOCKED_IO
|
||||
# include "unlocked-io.h"
|
||||
#endif
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define SWAP(n) (n)
|
||||
#else
|
||||
# define SWAP(n) \
|
||||
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
|
||||
#endif
|
||||
|
||||
#define BLOCKSIZE 4096
|
||||
#if BLOCKSIZE % 64 != 0
|
||||
# error "invalid BLOCKSIZE"
|
||||
#endif
|
||||
|
||||
/* This array contains the bytes used to pad the buffer to the next
|
||||
64-byte boundary. */
|
||||
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
|
||||
|
||||
|
||||
/*
|
||||
Takes a pointer to a 256 bit block of data (eight 32 bit ints) and
|
||||
intializes it to the start constants of the SHA256 algorithm. This
|
||||
must be called before using hash in the call to sha256_hash
|
||||
*/
|
||||
void
|
||||
sha256_init_ctx (struct sha256_ctx *ctx)
|
||||
{
|
||||
ctx->state[0] = 0x6a09e667UL;
|
||||
ctx->state[1] = 0xbb67ae85UL;
|
||||
ctx->state[2] = 0x3c6ef372UL;
|
||||
ctx->state[3] = 0xa54ff53aUL;
|
||||
ctx->state[4] = 0x510e527fUL;
|
||||
ctx->state[5] = 0x9b05688cUL;
|
||||
ctx->state[6] = 0x1f83d9abUL;
|
||||
ctx->state[7] = 0x5be0cd19UL;
|
||||
|
||||
ctx->total[0] = ctx->total[1] = 0;
|
||||
ctx->buflen = 0;
|
||||
}
|
||||
|
||||
void
|
||||
sha224_init_ctx (struct sha256_ctx *ctx)
|
||||
{
|
||||
ctx->state[0] = 0xc1059ed8UL;
|
||||
ctx->state[1] = 0x367cd507UL;
|
||||
ctx->state[2] = 0x3070dd17UL;
|
||||
ctx->state[3] = 0xf70e5939UL;
|
||||
ctx->state[4] = 0xffc00b31UL;
|
||||
ctx->state[5] = 0x68581511UL;
|
||||
ctx->state[6] = 0x64f98fa7UL;
|
||||
ctx->state[7] = 0xbefa4fa4UL;
|
||||
|
||||
ctx->total[0] = ctx->total[1] = 0;
|
||||
ctx->buflen = 0;
|
||||
}
|
||||
|
||||
/* Copy the value from v into the memory location pointed to by *cp,
|
||||
If your architecture allows unaligned access this is equivalent to
|
||||
* (uint32_t *) cp = v */
|
||||
static inline void
|
||||
set_uint32 (char *cp, uint32_t v)
|
||||
{
|
||||
memcpy (cp, &v, sizeof v);
|
||||
}
|
||||
|
||||
/* Put result from CTX in first 32 bytes following RESBUF. The result
|
||||
must be in little endian byte order. */
|
||||
void *
|
||||
sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
|
||||
{
|
||||
int i;
|
||||
char *r = resbuf;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
||||
|
||||
return resbuf;
|
||||
}
|
||||
|
||||
void *
|
||||
sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
|
||||
{
|
||||
int i;
|
||||
char *r = resbuf;
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
||||
|
||||
return resbuf;
|
||||
}
|
||||
|
||||
/* Process the remaining bytes in the internal buffer and the usual
|
||||
prolog according to the standard and write the result to RESBUF. */
|
||||
static void
|
||||
sha256_conclude_ctx (struct sha256_ctx *ctx)
|
||||
{
|
||||
/* Take yet unprocessed bytes into account. */
|
||||
uint32_t bytes = ctx->buflen;
|
||||
size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
|
||||
|
||||
/* Now count remaining bytes. */
|
||||
ctx->total[0] += bytes;
|
||||
if (ctx->total[0] < bytes)
|
||||
++ctx->total[1];
|
||||
|
||||
/* Put the 64-bit file length in *bits* at the end of the buffer. */
|
||||
ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
|
||||
ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3);
|
||||
|
||||
memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
|
||||
|
||||
/* Process last bytes. */
|
||||
sha256_process_block (ctx->buffer, size * 4, ctx);
|
||||
}
|
||||
|
||||
void *
|
||||
sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
|
||||
{
|
||||
sha256_conclude_ctx (ctx);
|
||||
return sha256_read_ctx (ctx, resbuf);
|
||||
}
|
||||
|
||||
void *
|
||||
sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
|
||||
{
|
||||
sha256_conclude_ctx (ctx);
|
||||
return sha224_read_ctx (ctx, resbuf);
|
||||
}
|
||||
|
||||
/* Compute SHA256 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 32 bytes
|
||||
beginning at RESBLOCK. */
|
||||
int
|
||||
sha256_stream (FILE *stream, void *resblock)
|
||||
{
|
||||
struct sha256_ctx ctx;
|
||||
char buffer[BLOCKSIZE + 72];
|
||||
size_t sum;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
sha256_init_ctx (&ctx);
|
||||
|
||||
/* Iterate over full file contents. */
|
||||
while (1)
|
||||
{
|
||||
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
|
||||
computation function processes the whole buffer so that with the
|
||||
next round of the loop another block can be read. */
|
||||
size_t n;
|
||||
sum = 0;
|
||||
|
||||
/* Read block. Take care for partial reads. */
|
||||
while (1)
|
||||
{
|
||||
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
|
||||
|
||||
sum += n;
|
||||
|
||||
if (sum == BLOCKSIZE)
|
||||
break;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
/* Check for the error flag IFF N == 0, so that we don't
|
||||
exit the loop after a partial read due to e.g., EAGAIN
|
||||
or EWOULDBLOCK. */
|
||||
if (ferror (stream))
|
||||
return 1;
|
||||
goto process_partial_block;
|
||||
}
|
||||
|
||||
/* We've read at least one byte, so ignore errors. But always
|
||||
check for EOF, since feof may be true even though N > 0.
|
||||
Otherwise, we could end up calling fread after EOF. */
|
||||
if (feof (stream))
|
||||
goto process_partial_block;
|
||||
}
|
||||
|
||||
/* Process buffer with BLOCKSIZE bytes. Note that
|
||||
BLOCKSIZE % 64 == 0
|
||||
*/
|
||||
sha256_process_block (buffer, BLOCKSIZE, &ctx);
|
||||
}
|
||||
|
||||
process_partial_block:;
|
||||
|
||||
/* Process any remaining bytes. */
|
||||
if (sum > 0)
|
||||
sha256_process_bytes (buffer, sum, &ctx);
|
||||
|
||||
/* Construct result in desired memory. */
|
||||
sha256_finish_ctx (&ctx, resblock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: Avoid code duplication */
|
||||
int
|
||||
sha224_stream (FILE *stream, void *resblock)
|
||||
{
|
||||
struct sha256_ctx ctx;
|
||||
char buffer[BLOCKSIZE + 72];
|
||||
size_t sum;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
sha224_init_ctx (&ctx);
|
||||
|
||||
/* Iterate over full file contents. */
|
||||
while (1)
|
||||
{
|
||||
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
|
||||
computation function processes the whole buffer so that with the
|
||||
next round of the loop another block can be read. */
|
||||
size_t n;
|
||||
sum = 0;
|
||||
|
||||
/* Read block. Take care for partial reads. */
|
||||
while (1)
|
||||
{
|
||||
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
|
||||
|
||||
sum += n;
|
||||
|
||||
if (sum == BLOCKSIZE)
|
||||
break;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
/* Check for the error flag IFF N == 0, so that we don't
|
||||
exit the loop after a partial read due to e.g., EAGAIN
|
||||
or EWOULDBLOCK. */
|
||||
if (ferror (stream))
|
||||
return 1;
|
||||
goto process_partial_block;
|
||||
}
|
||||
|
||||
/* We've read at least one byte, so ignore errors. But always
|
||||
check for EOF, since feof may be true even though N > 0.
|
||||
Otherwise, we could end up calling fread after EOF. */
|
||||
if (feof (stream))
|
||||
goto process_partial_block;
|
||||
}
|
||||
|
||||
/* Process buffer with BLOCKSIZE bytes. Note that
|
||||
BLOCKSIZE % 64 == 0
|
||||
*/
|
||||
sha256_process_block (buffer, BLOCKSIZE, &ctx);
|
||||
}
|
||||
|
||||
process_partial_block:;
|
||||
|
||||
/* Process any remaining bytes. */
|
||||
if (sum > 0)
|
||||
sha256_process_bytes (buffer, sum, &ctx);
|
||||
|
||||
/* Construct result in desired memory. */
|
||||
sha224_finish_ctx (&ctx, resblock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
void *
|
||||
sha256_buffer (const char *buffer, size_t len, void *resblock)
|
||||
{
|
||||
struct sha256_ctx ctx;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
sha256_init_ctx (&ctx);
|
||||
|
||||
/* Process whole buffer but last len % 64 bytes. */
|
||||
sha256_process_bytes (buffer, len, &ctx);
|
||||
|
||||
/* Put result in desired memory area. */
|
||||
return sha256_finish_ctx (&ctx, resblock);
|
||||
}
|
||||
|
||||
void *
|
||||
sha224_buffer (const char *buffer, size_t len, void *resblock)
|
||||
{
|
||||
struct sha256_ctx ctx;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
sha224_init_ctx (&ctx);
|
||||
|
||||
/* Process whole buffer but last len % 64 bytes. */
|
||||
sha256_process_bytes (buffer, len, &ctx);
|
||||
|
||||
/* Put result in desired memory area. */
|
||||
return sha224_finish_ctx (&ctx, resblock);
|
||||
}
|
||||
|
||||
void
|
||||
sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx)
|
||||
{
|
||||
/* When we already have some bits in our internal buffer concatenate
|
||||
both inputs first. */
|
||||
if (ctx->buflen != 0)
|
||||
{
|
||||
size_t left_over = ctx->buflen;
|
||||
size_t add = 128 - left_over > len ? len : 128 - left_over;
|
||||
|
||||
memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
|
||||
ctx->buflen += add;
|
||||
|
||||
if (ctx->buflen > 64)
|
||||
{
|
||||
sha256_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
|
||||
|
||||
ctx->buflen &= 63;
|
||||
/* The regions in the following copy operation cannot overlap. */
|
||||
memcpy (ctx->buffer,
|
||||
&((char *) ctx->buffer)[(left_over + add) & ~63],
|
||||
ctx->buflen);
|
||||
}
|
||||
|
||||
buffer = (const char *) buffer + add;
|
||||
len -= add;
|
||||
}
|
||||
|
||||
/* Process available complete blocks. */
|
||||
if (len >= 64)
|
||||
{
|
||||
#if !_STRING_ARCH_unaligned
|
||||
# define alignof(type) offsetof (struct { char c; type x; }, x)
|
||||
# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
|
||||
if (UNALIGNED_P (buffer))
|
||||
while (len > 64)
|
||||
{
|
||||
sha256_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
|
||||
buffer = (const char *) buffer + 64;
|
||||
len -= 64;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
sha256_process_block (buffer, len & ~63, ctx);
|
||||
buffer = (const char *) buffer + (len & ~63);
|
||||
len &= 63;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move remaining bytes in internal buffer. */
|
||||
if (len > 0)
|
||||
{
|
||||
size_t left_over = ctx->buflen;
|
||||
|
||||
memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
|
||||
left_over += len;
|
||||
if (left_over >= 64)
|
||||
{
|
||||
sha256_process_block (ctx->buffer, 64, ctx);
|
||||
left_over -= 64;
|
||||
memcpy (ctx->buffer, &ctx->buffer[16], left_over);
|
||||
}
|
||||
ctx->buflen = left_over;
|
||||
}
|
||||
}
|
||||
|
||||
/* --- Code below is the primary difference between sha1.c and sha256.c --- */
|
||||
|
||||
/* SHA256 round constants */
|
||||
#define K(I) sha256_round_constants[I]
|
||||
static const uint32_t sha256_round_constants[64] = {
|
||||
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
|
||||
0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
|
||||
0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
|
||||
0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
|
||||
0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
|
||||
0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
|
||||
0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
|
||||
0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
|
||||
0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
|
||||
0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
|
||||
0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
|
||||
0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
|
||||
0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
|
||||
0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
|
||||
0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
|
||||
0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL,
|
||||
};
|
||||
|
||||
/* Round functions. */
|
||||
#define F2(A,B,C) ( ( A & B ) | ( C & ( A | B ) ) )
|
||||
#define F1(E,F,G) ( G ^ ( E & ( F ^ G ) ) )
|
||||
|
||||
/* Process LEN bytes of BUFFER, accumulating context into CTX.
|
||||
It is assumed that LEN % 64 == 0.
|
||||
Most of this code comes from GnuPG's cipher/sha1.c. */
|
||||
|
||||
void
|
||||
sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
|
||||
{
|
||||
const uint32_t *words = buffer;
|
||||
size_t nwords = len / sizeof (uint32_t);
|
||||
const uint32_t *endp = words + nwords;
|
||||
uint32_t x[16];
|
||||
uint32_t a = ctx->state[0];
|
||||
uint32_t b = ctx->state[1];
|
||||
uint32_t c = ctx->state[2];
|
||||
uint32_t d = ctx->state[3];
|
||||
uint32_t e = ctx->state[4];
|
||||
uint32_t f = ctx->state[5];
|
||||
uint32_t g = ctx->state[6];
|
||||
uint32_t h = ctx->state[7];
|
||||
|
||||
/* First increment the byte count. FIPS PUB 180-2 specifies the possible
|
||||
length of the file up to 2^64 bits. Here we only compute the
|
||||
number of bytes. Do a double word increment. */
|
||||
ctx->total[0] += len;
|
||||
if (ctx->total[0] < len)
|
||||
++ctx->total[1];
|
||||
|
||||
#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||
#define S0(x) (rol(x,25)^rol(x,14)^(x>>3))
|
||||
#define S1(x) (rol(x,15)^rol(x,13)^(x>>10))
|
||||
#define SS0(x) (rol(x,30)^rol(x,19)^rol(x,10))
|
||||
#define SS1(x) (rol(x,26)^rol(x,21)^rol(x,7))
|
||||
|
||||
#define M(I) ( tm = S1(x[(I-2)&0x0f]) + x[(I-7)&0x0f] \
|
||||
+ S0(x[(I-15)&0x0f]) + x[I&0x0f] \
|
||||
, x[I&0x0f] = tm )
|
||||
|
||||
#define R(A,B,C,D,E,F,G,H,K,M) do { t0 = SS0(A) + F2(A,B,C); \
|
||||
t1 = H + SS1(E) \
|
||||
+ F1(E,F,G) \
|
||||
+ K \
|
||||
+ M; \
|
||||
D += t1; H = t0 + t1; \
|
||||
} while(0)
|
||||
|
||||
while (words < endp)
|
||||
{
|
||||
uint32_t tm;
|
||||
uint32_t t0, t1;
|
||||
int t;
|
||||
/* FIXME: see sha1.c for a better implementation. */
|
||||
for (t = 0; t < 16; t++)
|
||||
{
|
||||
x[t] = SWAP (*words);
|
||||
words++;
|
||||
}
|
||||
|
||||
R( a, b, c, d, e, f, g, h, K( 0), x[ 0] );
|
||||
R( h, a, b, c, d, e, f, g, K( 1), x[ 1] );
|
||||
R( g, h, a, b, c, d, e, f, K( 2), x[ 2] );
|
||||
R( f, g, h, a, b, c, d, e, K( 3), x[ 3] );
|
||||
R( e, f, g, h, a, b, c, d, K( 4), x[ 4] );
|
||||
R( d, e, f, g, h, a, b, c, K( 5), x[ 5] );
|
||||
R( c, d, e, f, g, h, a, b, K( 6), x[ 6] );
|
||||
R( b, c, d, e, f, g, h, a, K( 7), x[ 7] );
|
||||
R( a, b, c, d, e, f, g, h, K( 8), x[ 8] );
|
||||
R( h, a, b, c, d, e, f, g, K( 9), x[ 9] );
|
||||
R( g, h, a, b, c, d, e, f, K(10), x[10] );
|
||||
R( f, g, h, a, b, c, d, e, K(11), x[11] );
|
||||
R( e, f, g, h, a, b, c, d, K(12), x[12] );
|
||||
R( d, e, f, g, h, a, b, c, K(13), x[13] );
|
||||
R( c, d, e, f, g, h, a, b, K(14), x[14] );
|
||||
R( b, c, d, e, f, g, h, a, K(15), x[15] );
|
||||
R( a, b, c, d, e, f, g, h, K(16), M(16) );
|
||||
R( h, a, b, c, d, e, f, g, K(17), M(17) );
|
||||
R( g, h, a, b, c, d, e, f, K(18), M(18) );
|
||||
R( f, g, h, a, b, c, d, e, K(19), M(19) );
|
||||
R( e, f, g, h, a, b, c, d, K(20), M(20) );
|
||||
R( d, e, f, g, h, a, b, c, K(21), M(21) );
|
||||
R( c, d, e, f, g, h, a, b, K(22), M(22) );
|
||||
R( b, c, d, e, f, g, h, a, K(23), M(23) );
|
||||
R( a, b, c, d, e, f, g, h, K(24), M(24) );
|
||||
R( h, a, b, c, d, e, f, g, K(25), M(25) );
|
||||
R( g, h, a, b, c, d, e, f, K(26), M(26) );
|
||||
R( f, g, h, a, b, c, d, e, K(27), M(27) );
|
||||
R( e, f, g, h, a, b, c, d, K(28), M(28) );
|
||||
R( d, e, f, g, h, a, b, c, K(29), M(29) );
|
||||
R( c, d, e, f, g, h, a, b, K(30), M(30) );
|
||||
R( b, c, d, e, f, g, h, a, K(31), M(31) );
|
||||
R( a, b, c, d, e, f, g, h, K(32), M(32) );
|
||||
R( h, a, b, c, d, e, f, g, K(33), M(33) );
|
||||
R( g, h, a, b, c, d, e, f, K(34), M(34) );
|
||||
R( f, g, h, a, b, c, d, e, K(35), M(35) );
|
||||
R( e, f, g, h, a, b, c, d, K(36), M(36) );
|
||||
R( d, e, f, g, h, a, b, c, K(37), M(37) );
|
||||
R( c, d, e, f, g, h, a, b, K(38), M(38) );
|
||||
R( b, c, d, e, f, g, h, a, K(39), M(39) );
|
||||
R( a, b, c, d, e, f, g, h, K(40), M(40) );
|
||||
R( h, a, b, c, d, e, f, g, K(41), M(41) );
|
||||
R( g, h, a, b, c, d, e, f, K(42), M(42) );
|
||||
R( f, g, h, a, b, c, d, e, K(43), M(43) );
|
||||
R( e, f, g, h, a, b, c, d, K(44), M(44) );
|
||||
R( d, e, f, g, h, a, b, c, K(45), M(45) );
|
||||
R( c, d, e, f, g, h, a, b, K(46), M(46) );
|
||||
R( b, c, d, e, f, g, h, a, K(47), M(47) );
|
||||
R( a, b, c, d, e, f, g, h, K(48), M(48) );
|
||||
R( h, a, b, c, d, e, f, g, K(49), M(49) );
|
||||
R( g, h, a, b, c, d, e, f, K(50), M(50) );
|
||||
R( f, g, h, a, b, c, d, e, K(51), M(51) );
|
||||
R( e, f, g, h, a, b, c, d, K(52), M(52) );
|
||||
R( d, e, f, g, h, a, b, c, K(53), M(53) );
|
||||
R( c, d, e, f, g, h, a, b, K(54), M(54) );
|
||||
R( b, c, d, e, f, g, h, a, K(55), M(55) );
|
||||
R( a, b, c, d, e, f, g, h, K(56), M(56) );
|
||||
R( h, a, b, c, d, e, f, g, K(57), M(57) );
|
||||
R( g, h, a, b, c, d, e, f, K(58), M(58) );
|
||||
R( f, g, h, a, b, c, d, e, K(59), M(59) );
|
||||
R( e, f, g, h, a, b, c, d, K(60), M(60) );
|
||||
R( d, e, f, g, h, a, b, c, K(61), M(61) );
|
||||
R( c, d, e, f, g, h, a, b, K(62), M(62) );
|
||||
R( b, c, d, e, f, g, h, a, K(63), M(63) );
|
||||
|
||||
a = ctx->state[0] += a;
|
||||
b = ctx->state[1] += b;
|
||||
c = ctx->state[2] += c;
|
||||
d = ctx->state[3] += d;
|
||||
e = ctx->state[4] += e;
|
||||
f = ctx->state[5] += f;
|
||||
g = ctx->state[6] += g;
|
||||
h = ctx->state[7] += h;
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/* Declarations of functions and data types used for SHA256 and SHA224 sum
|
||||
library functions.
|
||||
Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef SHA256_H
|
||||
# define SHA256_H 1
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdint.h>
|
||||
|
||||
/* Structure to save state of computation between the single steps. */
|
||||
struct sha256_ctx
|
||||
{
|
||||
uint32_t state[8];
|
||||
|
||||
uint32_t total[2];
|
||||
uint32_t buflen;
|
||||
uint32_t buffer[32];
|
||||
};
|
||||
|
||||
enum { SHA224_DIGEST_SIZE = 24 };
|
||||
enum { SHA256_DIGEST_SIZE = 32 };
|
||||
|
||||
/* Initialize structure containing state of computation. */
|
||||
extern void sha256_init_ctx (struct sha256_ctx *ctx);
|
||||
extern void sha224_init_ctx (struct sha256_ctx *ctx);
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is necessary that LEN is a multiple of 64!!! */
|
||||
extern void sha256_process_block (const void *buffer, size_t len,
|
||||
struct sha256_ctx *ctx);
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is NOT required that LEN is a multiple of 64. */
|
||||
extern void sha256_process_bytes (const void *buffer, size_t len,
|
||||
struct sha256_ctx *ctx);
|
||||
|
||||
/* Process the remaining bytes in the buffer and put result from CTX
|
||||
in first 32 (28) bytes following RESBUF. The result is always in little
|
||||
endian byte order, so that a byte-wise output yields to the wanted
|
||||
ASCII representation of the message digest. */
|
||||
extern void *sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf);
|
||||
extern void *sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf);
|
||||
|
||||
|
||||
/* Put result from CTX in first 32 (28) bytes following RESBUF. The result is
|
||||
always in little endian byte order, so that a byte-wise output yields
|
||||
to the wanted ASCII representation of the message digest. */
|
||||
extern void *sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
|
||||
extern void *sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
|
||||
|
||||
|
||||
/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 32 (28) bytes
|
||||
beginning at RESBLOCK. */
|
||||
extern int sha256_stream (FILE *stream, void *resblock);
|
||||
extern int sha224_stream (FILE *stream, void *resblock);
|
||||
|
||||
/* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
extern void *sha256_buffer (const char *buffer, size_t len, void *resblock);
|
||||
extern void *sha224_buffer (const char *buffer, size_t len, void *resblock);
|
||||
|
||||
#endif
|
||||
600
gl/lib/sha512.c
600
gl/lib/sha512.c
@@ -1,600 +0,0 @@
|
||||
/* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or
|
||||
memory blocks according to the NIST specification FIPS-180-2.
|
||||
|
||||
Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by David Madore, considerably copypasting from
|
||||
Scott G. Miller's sha1.c
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "sha512.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#if USE_UNLOCKED_IO
|
||||
# include "unlocked-io.h"
|
||||
#endif
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define SWAP(n) (n)
|
||||
#else
|
||||
# define SWAP(n) \
|
||||
u64or (u64or (u64or (u64shl (n, 56), \
|
||||
u64shl (u64and (n, u64lo (0x0000ff00)), 40)), \
|
||||
u64or (u64shl (u64and (n, u64lo (0x00ff0000)), 24), \
|
||||
u64shl (u64and (n, u64lo (0xff000000)), 8))), \
|
||||
u64or (u64or (u64and (u64shr (n, 8), u64lo (0xff000000)), \
|
||||
u64and (u64shr (n, 24), u64lo (0x00ff0000))), \
|
||||
u64or (u64and (u64shr (n, 40), u64lo (0x0000ff00)), \
|
||||
u64shr (n, 56))))
|
||||
#endif
|
||||
|
||||
#define BLOCKSIZE 4096
|
||||
#if BLOCKSIZE % 128 != 0
|
||||
# error "invalid BLOCKSIZE"
|
||||
#endif
|
||||
|
||||
/* This array contains the bytes used to pad the buffer to the next
|
||||
128-byte boundary. */
|
||||
static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ };
|
||||
|
||||
|
||||
/*
|
||||
Takes a pointer to a 512 bit block of data (eight 64 bit ints) and
|
||||
intializes it to the start constants of the SHA512 algorithm. This
|
||||
must be called before using hash in the call to sha512_hash
|
||||
*/
|
||||
void
|
||||
sha512_init_ctx (struct sha512_ctx *ctx)
|
||||
{
|
||||
ctx->state[0] = u64hilo (0x6a09e667, 0xf3bcc908);
|
||||
ctx->state[1] = u64hilo (0xbb67ae85, 0x84caa73b);
|
||||
ctx->state[2] = u64hilo (0x3c6ef372, 0xfe94f82b);
|
||||
ctx->state[3] = u64hilo (0xa54ff53a, 0x5f1d36f1);
|
||||
ctx->state[4] = u64hilo (0x510e527f, 0xade682d1);
|
||||
ctx->state[5] = u64hilo (0x9b05688c, 0x2b3e6c1f);
|
||||
ctx->state[6] = u64hilo (0x1f83d9ab, 0xfb41bd6b);
|
||||
ctx->state[7] = u64hilo (0x5be0cd19, 0x137e2179);
|
||||
|
||||
ctx->total[0] = ctx->total[1] = u64lo (0);
|
||||
ctx->buflen = 0;
|
||||
}
|
||||
|
||||
void
|
||||
sha384_init_ctx (struct sha512_ctx *ctx)
|
||||
{
|
||||
ctx->state[0] = u64hilo (0xcbbb9d5d, 0xc1059ed8);
|
||||
ctx->state[1] = u64hilo (0x629a292a, 0x367cd507);
|
||||
ctx->state[2] = u64hilo (0x9159015a, 0x3070dd17);
|
||||
ctx->state[3] = u64hilo (0x152fecd8, 0xf70e5939);
|
||||
ctx->state[4] = u64hilo (0x67332667, 0xffc00b31);
|
||||
ctx->state[5] = u64hilo (0x8eb44a87, 0x68581511);
|
||||
ctx->state[6] = u64hilo (0xdb0c2e0d, 0x64f98fa7);
|
||||
ctx->state[7] = u64hilo (0x47b5481d, 0xbefa4fa4);
|
||||
|
||||
ctx->total[0] = ctx->total[1] = u64lo (0);
|
||||
ctx->buflen = 0;
|
||||
}
|
||||
|
||||
/* Copy the value from V into the memory location pointed to by *CP,
|
||||
If your architecture allows unaligned access, this is equivalent to
|
||||
* (__typeof__ (v) *) cp = v */
|
||||
static inline void
|
||||
set_uint64 (char *cp, u64 v)
|
||||
{
|
||||
memcpy (cp, &v, sizeof v);
|
||||
}
|
||||
|
||||
/* Put result from CTX in first 64 bytes following RESBUF.
|
||||
The result must be in little endian byte order. */
|
||||
void *
|
||||
sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
|
||||
{
|
||||
int i;
|
||||
char *r = resbuf;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
set_uint64 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
||||
|
||||
return resbuf;
|
||||
}
|
||||
|
||||
void *
|
||||
sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
|
||||
{
|
||||
int i;
|
||||
char *r = resbuf;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
set_uint64 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
||||
|
||||
return resbuf;
|
||||
}
|
||||
|
||||
/* Process the remaining bytes in the internal buffer and the usual
|
||||
prolog according to the standard and write the result to RESBUF. */
|
||||
static void
|
||||
sha512_conclude_ctx (struct sha512_ctx *ctx)
|
||||
{
|
||||
/* Take yet unprocessed bytes into account. */
|
||||
size_t bytes = ctx->buflen;
|
||||
size_t size = (bytes < 112) ? 128 / 8 : 128 * 2 / 8;
|
||||
|
||||
/* Now count remaining bytes. */
|
||||
ctx->total[0] = u64plus (ctx->total[0], u64lo (bytes));
|
||||
if (u64lt (ctx->total[0], u64lo (bytes)))
|
||||
ctx->total[1] = u64plus (ctx->total[1], u64lo (1));
|
||||
|
||||
/* Put the 64-bit file length in *bits* at the end of the buffer. */
|
||||
ctx->buffer[size - 2] = SWAP (u64or (u64shl (ctx->total[1], 3),
|
||||
u64shr (ctx->total[0], 61)));
|
||||
ctx->buffer[size - 1] = SWAP (u64shl (ctx->total[0], 3));
|
||||
|
||||
memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 8 - bytes);
|
||||
|
||||
/* Process last bytes. */
|
||||
sha512_process_block (ctx->buffer, size * 8, ctx);
|
||||
}
|
||||
|
||||
void *
|
||||
sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
|
||||
{
|
||||
sha512_conclude_ctx (ctx);
|
||||
return sha512_read_ctx (ctx, resbuf);
|
||||
}
|
||||
|
||||
void *
|
||||
sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
|
||||
{
|
||||
sha512_conclude_ctx (ctx);
|
||||
return sha384_read_ctx (ctx, resbuf);
|
||||
}
|
||||
|
||||
/* Compute SHA512 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 64 bytes
|
||||
beginning at RESBLOCK. */
|
||||
int
|
||||
sha512_stream (FILE *stream, void *resblock)
|
||||
{
|
||||
struct sha512_ctx ctx;
|
||||
char buffer[BLOCKSIZE + 72];
|
||||
size_t sum;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
sha512_init_ctx (&ctx);
|
||||
|
||||
/* Iterate over full file contents. */
|
||||
while (1)
|
||||
{
|
||||
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
|
||||
computation function processes the whole buffer so that with the
|
||||
next round of the loop another block can be read. */
|
||||
size_t n;
|
||||
sum = 0;
|
||||
|
||||
/* Read block. Take care for partial reads. */
|
||||
while (1)
|
||||
{
|
||||
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
|
||||
|
||||
sum += n;
|
||||
|
||||
if (sum == BLOCKSIZE)
|
||||
break;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
/* Check for the error flag IFF N == 0, so that we don't
|
||||
exit the loop after a partial read due to e.g., EAGAIN
|
||||
or EWOULDBLOCK. */
|
||||
if (ferror (stream))
|
||||
return 1;
|
||||
goto process_partial_block;
|
||||
}
|
||||
|
||||
/* We've read at least one byte, so ignore errors. But always
|
||||
check for EOF, since feof may be true even though N > 0.
|
||||
Otherwise, we could end up calling fread after EOF. */
|
||||
if (feof (stream))
|
||||
goto process_partial_block;
|
||||
}
|
||||
|
||||
/* Process buffer with BLOCKSIZE bytes. Note that
|
||||
BLOCKSIZE % 128 == 0
|
||||
*/
|
||||
sha512_process_block (buffer, BLOCKSIZE, &ctx);
|
||||
}
|
||||
|
||||
process_partial_block:;
|
||||
|
||||
/* Process any remaining bytes. */
|
||||
if (sum > 0)
|
||||
sha512_process_bytes (buffer, sum, &ctx);
|
||||
|
||||
/* Construct result in desired memory. */
|
||||
sha512_finish_ctx (&ctx, resblock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: Avoid code duplication */
|
||||
int
|
||||
sha384_stream (FILE *stream, void *resblock)
|
||||
{
|
||||
struct sha512_ctx ctx;
|
||||
char buffer[BLOCKSIZE + 72];
|
||||
size_t sum;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
sha384_init_ctx (&ctx);
|
||||
|
||||
/* Iterate over full file contents. */
|
||||
while (1)
|
||||
{
|
||||
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
|
||||
computation function processes the whole buffer so that with the
|
||||
next round of the loop another block can be read. */
|
||||
size_t n;
|
||||
sum = 0;
|
||||
|
||||
/* Read block. Take care for partial reads. */
|
||||
while (1)
|
||||
{
|
||||
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
|
||||
|
||||
sum += n;
|
||||
|
||||
if (sum == BLOCKSIZE)
|
||||
break;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
/* Check for the error flag IFF N == 0, so that we don't
|
||||
exit the loop after a partial read due to e.g., EAGAIN
|
||||
or EWOULDBLOCK. */
|
||||
if (ferror (stream))
|
||||
return 1;
|
||||
goto process_partial_block;
|
||||
}
|
||||
|
||||
/* We've read at least one byte, so ignore errors. But always
|
||||
check for EOF, since feof may be true even though N > 0.
|
||||
Otherwise, we could end up calling fread after EOF. */
|
||||
if (feof (stream))
|
||||
goto process_partial_block;
|
||||
}
|
||||
|
||||
/* Process buffer with BLOCKSIZE bytes. Note that
|
||||
BLOCKSIZE % 128 == 0
|
||||
*/
|
||||
sha512_process_block (buffer, BLOCKSIZE, &ctx);
|
||||
}
|
||||
|
||||
process_partial_block:;
|
||||
|
||||
/* Process any remaining bytes. */
|
||||
if (sum > 0)
|
||||
sha512_process_bytes (buffer, sum, &ctx);
|
||||
|
||||
/* Construct result in desired memory. */
|
||||
sha384_finish_ctx (&ctx, resblock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
void *
|
||||
sha512_buffer (const char *buffer, size_t len, void *resblock)
|
||||
{
|
||||
struct sha512_ctx ctx;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
sha512_init_ctx (&ctx);
|
||||
|
||||
/* Process whole buffer but last len % 128 bytes. */
|
||||
sha512_process_bytes (buffer, len, &ctx);
|
||||
|
||||
/* Put result in desired memory area. */
|
||||
return sha512_finish_ctx (&ctx, resblock);
|
||||
}
|
||||
|
||||
void *
|
||||
sha384_buffer (const char *buffer, size_t len, void *resblock)
|
||||
{
|
||||
struct sha512_ctx ctx;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
sha384_init_ctx (&ctx);
|
||||
|
||||
/* Process whole buffer but last len % 128 bytes. */
|
||||
sha512_process_bytes (buffer, len, &ctx);
|
||||
|
||||
/* Put result in desired memory area. */
|
||||
return sha384_finish_ctx (&ctx, resblock);
|
||||
}
|
||||
|
||||
void
|
||||
sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx)
|
||||
{
|
||||
/* When we already have some bits in our internal buffer concatenate
|
||||
both inputs first. */
|
||||
if (ctx->buflen != 0)
|
||||
{
|
||||
size_t left_over = ctx->buflen;
|
||||
size_t add = 256 - left_over > len ? len : 256 - left_over;
|
||||
|
||||
memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
|
||||
ctx->buflen += add;
|
||||
|
||||
if (ctx->buflen > 128)
|
||||
{
|
||||
sha512_process_block (ctx->buffer, ctx->buflen & ~127, ctx);
|
||||
|
||||
ctx->buflen &= 127;
|
||||
/* The regions in the following copy operation cannot overlap. */
|
||||
memcpy (ctx->buffer,
|
||||
&((char *) ctx->buffer)[(left_over + add) & ~127],
|
||||
ctx->buflen);
|
||||
}
|
||||
|
||||
buffer = (const char *) buffer + add;
|
||||
len -= add;
|
||||
}
|
||||
|
||||
/* Process available complete blocks. */
|
||||
if (len >= 128)
|
||||
{
|
||||
#if !_STRING_ARCH_unaligned
|
||||
# define alignof(type) offsetof (struct { char c; type x; }, x)
|
||||
# define UNALIGNED_P(p) (((size_t) p) % alignof (u64) != 0)
|
||||
if (UNALIGNED_P (buffer))
|
||||
while (len > 128)
|
||||
{
|
||||
sha512_process_block (memcpy (ctx->buffer, buffer, 128), 128, ctx);
|
||||
buffer = (const char *) buffer + 128;
|
||||
len -= 128;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
sha512_process_block (buffer, len & ~127, ctx);
|
||||
buffer = (const char *) buffer + (len & ~127);
|
||||
len &= 127;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move remaining bytes in internal buffer. */
|
||||
if (len > 0)
|
||||
{
|
||||
size_t left_over = ctx->buflen;
|
||||
|
||||
memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
|
||||
left_over += len;
|
||||
if (left_over >= 128)
|
||||
{
|
||||
sha512_process_block (ctx->buffer, 128, ctx);
|
||||
left_over -= 128;
|
||||
memcpy (ctx->buffer, &ctx->buffer[16], left_over);
|
||||
}
|
||||
ctx->buflen = left_over;
|
||||
}
|
||||
}
|
||||
|
||||
/* --- Code below is the primary difference between sha1.c and sha512.c --- */
|
||||
|
||||
/* SHA512 round constants */
|
||||
#define K(I) sha512_round_constants[I]
|
||||
static u64 const sha512_round_constants[80] = {
|
||||
u64init (0x428a2f98, 0xd728ae22), u64init (0x71374491, 0x23ef65cd),
|
||||
u64init (0xb5c0fbcf, 0xec4d3b2f), u64init (0xe9b5dba5, 0x8189dbbc),
|
||||
u64init (0x3956c25b, 0xf348b538), u64init (0x59f111f1, 0xb605d019),
|
||||
u64init (0x923f82a4, 0xaf194f9b), u64init (0xab1c5ed5, 0xda6d8118),
|
||||
u64init (0xd807aa98, 0xa3030242), u64init (0x12835b01, 0x45706fbe),
|
||||
u64init (0x243185be, 0x4ee4b28c), u64init (0x550c7dc3, 0xd5ffb4e2),
|
||||
u64init (0x72be5d74, 0xf27b896f), u64init (0x80deb1fe, 0x3b1696b1),
|
||||
u64init (0x9bdc06a7, 0x25c71235), u64init (0xc19bf174, 0xcf692694),
|
||||
u64init (0xe49b69c1, 0x9ef14ad2), u64init (0xefbe4786, 0x384f25e3),
|
||||
u64init (0x0fc19dc6, 0x8b8cd5b5), u64init (0x240ca1cc, 0x77ac9c65),
|
||||
u64init (0x2de92c6f, 0x592b0275), u64init (0x4a7484aa, 0x6ea6e483),
|
||||
u64init (0x5cb0a9dc, 0xbd41fbd4), u64init (0x76f988da, 0x831153b5),
|
||||
u64init (0x983e5152, 0xee66dfab), u64init (0xa831c66d, 0x2db43210),
|
||||
u64init (0xb00327c8, 0x98fb213f), u64init (0xbf597fc7, 0xbeef0ee4),
|
||||
u64init (0xc6e00bf3, 0x3da88fc2), u64init (0xd5a79147, 0x930aa725),
|
||||
u64init (0x06ca6351, 0xe003826f), u64init (0x14292967, 0x0a0e6e70),
|
||||
u64init (0x27b70a85, 0x46d22ffc), u64init (0x2e1b2138, 0x5c26c926),
|
||||
u64init (0x4d2c6dfc, 0x5ac42aed), u64init (0x53380d13, 0x9d95b3df),
|
||||
u64init (0x650a7354, 0x8baf63de), u64init (0x766a0abb, 0x3c77b2a8),
|
||||
u64init (0x81c2c92e, 0x47edaee6), u64init (0x92722c85, 0x1482353b),
|
||||
u64init (0xa2bfe8a1, 0x4cf10364), u64init (0xa81a664b, 0xbc423001),
|
||||
u64init (0xc24b8b70, 0xd0f89791), u64init (0xc76c51a3, 0x0654be30),
|
||||
u64init (0xd192e819, 0xd6ef5218), u64init (0xd6990624, 0x5565a910),
|
||||
u64init (0xf40e3585, 0x5771202a), u64init (0x106aa070, 0x32bbd1b8),
|
||||
u64init (0x19a4c116, 0xb8d2d0c8), u64init (0x1e376c08, 0x5141ab53),
|
||||
u64init (0x2748774c, 0xdf8eeb99), u64init (0x34b0bcb5, 0xe19b48a8),
|
||||
u64init (0x391c0cb3, 0xc5c95a63), u64init (0x4ed8aa4a, 0xe3418acb),
|
||||
u64init (0x5b9cca4f, 0x7763e373), u64init (0x682e6ff3, 0xd6b2b8a3),
|
||||
u64init (0x748f82ee, 0x5defb2fc), u64init (0x78a5636f, 0x43172f60),
|
||||
u64init (0x84c87814, 0xa1f0ab72), u64init (0x8cc70208, 0x1a6439ec),
|
||||
u64init (0x90befffa, 0x23631e28), u64init (0xa4506ceb, 0xde82bde9),
|
||||
u64init (0xbef9a3f7, 0xb2c67915), u64init (0xc67178f2, 0xe372532b),
|
||||
u64init (0xca273ece, 0xea26619c), u64init (0xd186b8c7, 0x21c0c207),
|
||||
u64init (0xeada7dd6, 0xcde0eb1e), u64init (0xf57d4f7f, 0xee6ed178),
|
||||
u64init (0x06f067aa, 0x72176fba), u64init (0x0a637dc5, 0xa2c898a6),
|
||||
u64init (0x113f9804, 0xbef90dae), u64init (0x1b710b35, 0x131c471b),
|
||||
u64init (0x28db77f5, 0x23047d84), u64init (0x32caab7b, 0x40c72493),
|
||||
u64init (0x3c9ebe0a, 0x15c9bebc), u64init (0x431d67c4, 0x9c100d4c),
|
||||
u64init (0x4cc5d4be, 0xcb3e42b6), u64init (0x597f299c, 0xfc657e2a),
|
||||
u64init (0x5fcb6fab, 0x3ad6faec), u64init (0x6c44198c, 0x4a475817),
|
||||
};
|
||||
|
||||
/* Round functions. */
|
||||
#define F2(A, B, C) u64or (u64and (A, B), u64and (C, u64or (A, B)))
|
||||
#define F1(E, F, G) u64xor (G, u64and (E, u64xor (F, G)))
|
||||
|
||||
/* Process LEN bytes of BUFFER, accumulating context into CTX.
|
||||
It is assumed that LEN % 128 == 0.
|
||||
Most of this code comes from GnuPG's cipher/sha1.c. */
|
||||
|
||||
void
|
||||
sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
|
||||
{
|
||||
u64 const *words = buffer;
|
||||
u64 const *endp = words + len / sizeof (u64);
|
||||
u64 x[16];
|
||||
u64 a = ctx->state[0];
|
||||
u64 b = ctx->state[1];
|
||||
u64 c = ctx->state[2];
|
||||
u64 d = ctx->state[3];
|
||||
u64 e = ctx->state[4];
|
||||
u64 f = ctx->state[5];
|
||||
u64 g = ctx->state[6];
|
||||
u64 h = ctx->state[7];
|
||||
|
||||
/* First increment the byte count. FIPS PUB 180-2 specifies the possible
|
||||
length of the file up to 2^128 bits. Here we only compute the
|
||||
number of bytes. Do a double word increment. */
|
||||
ctx->total[0] = u64plus (ctx->total[0], u64lo (len));
|
||||
if (u64lt (ctx->total[0], u64lo (len)))
|
||||
ctx->total[1] = u64plus (ctx->total[1], u64lo (1));
|
||||
|
||||
#define S0(x) u64xor (u64rol(x, 63), u64xor (u64rol (x, 56), u64shr (x, 7)))
|
||||
#define S1(x) u64xor (u64rol (x, 45), u64xor (u64rol (x, 3), u64shr (x, 6)))
|
||||
#define SS0(x) u64xor (u64rol (x, 36), u64xor (u64rol (x, 30), u64rol (x, 25)))
|
||||
#define SS1(x) u64xor (u64rol(x, 50), u64xor (u64rol (x, 46), u64rol (x, 23)))
|
||||
|
||||
#define M(I) (x[(I) & 15] \
|
||||
= u64plus (x[(I) & 15], \
|
||||
u64plus (S1 (x[((I) - 2) & 15]), \
|
||||
u64plus (x[((I) - 7) & 15], \
|
||||
S0 (x[((I) - 15) & 15])))))
|
||||
|
||||
#define R(A, B, C, D, E, F, G, H, K, M) \
|
||||
do \
|
||||
{ \
|
||||
u64 t0 = u64plus (SS0 (A), F2 (A, B, C)); \
|
||||
u64 t1 = \
|
||||
u64plus (H, u64plus (SS1 (E), \
|
||||
u64plus (F1 (E, F, G), u64plus (K, M)))); \
|
||||
D = u64plus (D, t1); \
|
||||
H = u64plus (t0, t1); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
while (words < endp)
|
||||
{
|
||||
int t;
|
||||
/* FIXME: see sha1.c for a better implementation. */
|
||||
for (t = 0; t < 16; t++)
|
||||
{
|
||||
x[t] = SWAP (*words);
|
||||
words++;
|
||||
}
|
||||
|
||||
R( a, b, c, d, e, f, g, h, K( 0), x[ 0] );
|
||||
R( h, a, b, c, d, e, f, g, K( 1), x[ 1] );
|
||||
R( g, h, a, b, c, d, e, f, K( 2), x[ 2] );
|
||||
R( f, g, h, a, b, c, d, e, K( 3), x[ 3] );
|
||||
R( e, f, g, h, a, b, c, d, K( 4), x[ 4] );
|
||||
R( d, e, f, g, h, a, b, c, K( 5), x[ 5] );
|
||||
R( c, d, e, f, g, h, a, b, K( 6), x[ 6] );
|
||||
R( b, c, d, e, f, g, h, a, K( 7), x[ 7] );
|
||||
R( a, b, c, d, e, f, g, h, K( 8), x[ 8] );
|
||||
R( h, a, b, c, d, e, f, g, K( 9), x[ 9] );
|
||||
R( g, h, a, b, c, d, e, f, K(10), x[10] );
|
||||
R( f, g, h, a, b, c, d, e, K(11), x[11] );
|
||||
R( e, f, g, h, a, b, c, d, K(12), x[12] );
|
||||
R( d, e, f, g, h, a, b, c, K(13), x[13] );
|
||||
R( c, d, e, f, g, h, a, b, K(14), x[14] );
|
||||
R( b, c, d, e, f, g, h, a, K(15), x[15] );
|
||||
R( a, b, c, d, e, f, g, h, K(16), M(16) );
|
||||
R( h, a, b, c, d, e, f, g, K(17), M(17) );
|
||||
R( g, h, a, b, c, d, e, f, K(18), M(18) );
|
||||
R( f, g, h, a, b, c, d, e, K(19), M(19) );
|
||||
R( e, f, g, h, a, b, c, d, K(20), M(20) );
|
||||
R( d, e, f, g, h, a, b, c, K(21), M(21) );
|
||||
R( c, d, e, f, g, h, a, b, K(22), M(22) );
|
||||
R( b, c, d, e, f, g, h, a, K(23), M(23) );
|
||||
R( a, b, c, d, e, f, g, h, K(24), M(24) );
|
||||
R( h, a, b, c, d, e, f, g, K(25), M(25) );
|
||||
R( g, h, a, b, c, d, e, f, K(26), M(26) );
|
||||
R( f, g, h, a, b, c, d, e, K(27), M(27) );
|
||||
R( e, f, g, h, a, b, c, d, K(28), M(28) );
|
||||
R( d, e, f, g, h, a, b, c, K(29), M(29) );
|
||||
R( c, d, e, f, g, h, a, b, K(30), M(30) );
|
||||
R( b, c, d, e, f, g, h, a, K(31), M(31) );
|
||||
R( a, b, c, d, e, f, g, h, K(32), M(32) );
|
||||
R( h, a, b, c, d, e, f, g, K(33), M(33) );
|
||||
R( g, h, a, b, c, d, e, f, K(34), M(34) );
|
||||
R( f, g, h, a, b, c, d, e, K(35), M(35) );
|
||||
R( e, f, g, h, a, b, c, d, K(36), M(36) );
|
||||
R( d, e, f, g, h, a, b, c, K(37), M(37) );
|
||||
R( c, d, e, f, g, h, a, b, K(38), M(38) );
|
||||
R( b, c, d, e, f, g, h, a, K(39), M(39) );
|
||||
R( a, b, c, d, e, f, g, h, K(40), M(40) );
|
||||
R( h, a, b, c, d, e, f, g, K(41), M(41) );
|
||||
R( g, h, a, b, c, d, e, f, K(42), M(42) );
|
||||
R( f, g, h, a, b, c, d, e, K(43), M(43) );
|
||||
R( e, f, g, h, a, b, c, d, K(44), M(44) );
|
||||
R( d, e, f, g, h, a, b, c, K(45), M(45) );
|
||||
R( c, d, e, f, g, h, a, b, K(46), M(46) );
|
||||
R( b, c, d, e, f, g, h, a, K(47), M(47) );
|
||||
R( a, b, c, d, e, f, g, h, K(48), M(48) );
|
||||
R( h, a, b, c, d, e, f, g, K(49), M(49) );
|
||||
R( g, h, a, b, c, d, e, f, K(50), M(50) );
|
||||
R( f, g, h, a, b, c, d, e, K(51), M(51) );
|
||||
R( e, f, g, h, a, b, c, d, K(52), M(52) );
|
||||
R( d, e, f, g, h, a, b, c, K(53), M(53) );
|
||||
R( c, d, e, f, g, h, a, b, K(54), M(54) );
|
||||
R( b, c, d, e, f, g, h, a, K(55), M(55) );
|
||||
R( a, b, c, d, e, f, g, h, K(56), M(56) );
|
||||
R( h, a, b, c, d, e, f, g, K(57), M(57) );
|
||||
R( g, h, a, b, c, d, e, f, K(58), M(58) );
|
||||
R( f, g, h, a, b, c, d, e, K(59), M(59) );
|
||||
R( e, f, g, h, a, b, c, d, K(60), M(60) );
|
||||
R( d, e, f, g, h, a, b, c, K(61), M(61) );
|
||||
R( c, d, e, f, g, h, a, b, K(62), M(62) );
|
||||
R( b, c, d, e, f, g, h, a, K(63), M(63) );
|
||||
R( a, b, c, d, e, f, g, h, K(64), M(64) );
|
||||
R( h, a, b, c, d, e, f, g, K(65), M(65) );
|
||||
R( g, h, a, b, c, d, e, f, K(66), M(66) );
|
||||
R( f, g, h, a, b, c, d, e, K(67), M(67) );
|
||||
R( e, f, g, h, a, b, c, d, K(68), M(68) );
|
||||
R( d, e, f, g, h, a, b, c, K(69), M(69) );
|
||||
R( c, d, e, f, g, h, a, b, K(70), M(70) );
|
||||
R( b, c, d, e, f, g, h, a, K(71), M(71) );
|
||||
R( a, b, c, d, e, f, g, h, K(72), M(72) );
|
||||
R( h, a, b, c, d, e, f, g, K(73), M(73) );
|
||||
R( g, h, a, b, c, d, e, f, K(74), M(74) );
|
||||
R( f, g, h, a, b, c, d, e, K(75), M(75) );
|
||||
R( e, f, g, h, a, b, c, d, K(76), M(76) );
|
||||
R( d, e, f, g, h, a, b, c, K(77), M(77) );
|
||||
R( c, d, e, f, g, h, a, b, K(78), M(78) );
|
||||
R( b, c, d, e, f, g, h, a, K(79), M(79) );
|
||||
|
||||
a = ctx->state[0] = u64plus (ctx->state[0], a);
|
||||
b = ctx->state[1] = u64plus (ctx->state[1], b);
|
||||
c = ctx->state[2] = u64plus (ctx->state[2], c);
|
||||
d = ctx->state[3] = u64plus (ctx->state[3], d);
|
||||
e = ctx->state[4] = u64plus (ctx->state[4], e);
|
||||
f = ctx->state[5] = u64plus (ctx->state[5], f);
|
||||
g = ctx->state[6] = u64plus (ctx->state[6], g);
|
||||
h = ctx->state[7] = u64plus (ctx->state[7], h);
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/* Declarations of functions and data types used for SHA512 and SHA384 sum
|
||||
library functions.
|
||||
Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef SHA512_H
|
||||
# define SHA512_H 1
|
||||
|
||||
# include <stdio.h>
|
||||
|
||||
# include "u64.h"
|
||||
|
||||
/* Structure to save state of computation between the single steps. */
|
||||
struct sha512_ctx
|
||||
{
|
||||
u64 state[8];
|
||||
|
||||
u64 total[2];
|
||||
size_t buflen;
|
||||
u64 buffer[32];
|
||||
};
|
||||
|
||||
enum { SHA384_DIGEST_SIZE = 48 };
|
||||
enum { SHA512_DIGEST_SIZE = 64 };
|
||||
|
||||
/* Initialize structure containing state of computation. */
|
||||
extern void sha512_init_ctx (struct sha512_ctx *ctx);
|
||||
extern void sha384_init_ctx (struct sha512_ctx *ctx);
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is necessary that LEN is a multiple of 128!!! */
|
||||
extern void sha512_process_block (const void *buffer, size_t len,
|
||||
struct sha512_ctx *ctx);
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is NOT required that LEN is a multiple of 128. */
|
||||
extern void sha512_process_bytes (const void *buffer, size_t len,
|
||||
struct sha512_ctx *ctx);
|
||||
|
||||
/* Process the remaining bytes in the buffer and put result from CTX
|
||||
in first 64 (48) bytes following RESBUF. The result is always in little
|
||||
endian byte order, so that a byte-wise output yields to the wanted
|
||||
ASCII representation of the message digest. */
|
||||
extern void *sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf);
|
||||
extern void *sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf);
|
||||
|
||||
|
||||
/* Put result from CTX in first 64 (48) bytes following RESBUF. The result is
|
||||
always in little endian byte order, so that a byte-wise output yields
|
||||
to the wanted ASCII representation of the message digest.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
extern void *sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
|
||||
extern void *sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
|
||||
|
||||
|
||||
/* Compute SHA512 (SHA384) message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 64 (48) bytes
|
||||
beginning at RESBLOCK. */
|
||||
extern int sha512_stream (FILE *stream, void *resblock);
|
||||
extern int sha384_stream (FILE *stream, void *resblock);
|
||||
|
||||
/* Compute SHA512 (SHA384) message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
extern void *sha512_buffer (const char *buffer, size_t len, void *resblock);
|
||||
extern void *sha384_buffer (const char *buffer, size_t len, void *resblock);
|
||||
|
||||
#endif
|
||||
159
gl/lib/u64.h
159
gl/lib/u64.h
@@ -1,159 +0,0 @@
|
||||
/* uint64_t-like operations that work even on hosts lacking uint64_t
|
||||
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* Return X rotated left by N bits, where 0 < N < 64. */
|
||||
#define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n))
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
|
||||
/* Native implementations are trivial. See below for comments on what
|
||||
these operations do. */
|
||||
typedef uint64_t u64;
|
||||
# define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo)))
|
||||
# define u64init(hi, lo) u64hilo (hi, lo)
|
||||
# define u64lo(x) ((u64) (x))
|
||||
# define u64lt(x, y) ((x) < (y))
|
||||
# define u64and(x, y) ((x) & (y))
|
||||
# define u64or(x, y) ((x) | (y))
|
||||
# define u64xor(x, y) ((x) ^ (y))
|
||||
# define u64plus(x, y) ((x) + (y))
|
||||
# define u64shl(x, n) ((x) << (n))
|
||||
# define u64shr(x, n) ((x) >> (n))
|
||||
|
||||
#else
|
||||
|
||||
/* u64 is a 64-bit unsigned integer value.
|
||||
u64init (HI, LO), is like u64hilo (HI, LO), but for use in
|
||||
initializer contexts. */
|
||||
# ifdef WORDS_BIGENDIAN
|
||||
typedef struct { uint32_t hi, lo; } u64;
|
||||
# define u64init(hi, lo) { hi, lo }
|
||||
# else
|
||||
typedef struct { uint32_t lo, hi; } u64;
|
||||
# define u64init(hi, lo) { lo, hi }
|
||||
# endif
|
||||
|
||||
/* Given the high and low-order 32-bit quantities HI and LO, return a u64
|
||||
value representing (HI << 32) + LO. */
|
||||
static inline u64
|
||||
u64hilo (uint32_t hi, uint32_t lo)
|
||||
{
|
||||
u64 r;
|
||||
r.hi = hi;
|
||||
r.lo = lo;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Return a u64 value representing LO. */
|
||||
static inline u64
|
||||
u64lo (uint32_t lo)
|
||||
{
|
||||
u64 r;
|
||||
r.hi = 0;
|
||||
r.lo = lo;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Return X < Y. */
|
||||
static inline int
|
||||
u64lt (u64 x, u64 y)
|
||||
{
|
||||
return x.hi < y.hi || (x.hi == y.hi && x.lo < y.lo);
|
||||
}
|
||||
|
||||
/* Return X & Y. */
|
||||
static inline u64
|
||||
u64and (u64 x, u64 y)
|
||||
{
|
||||
u64 r;
|
||||
r.hi = x.hi & y.hi;
|
||||
r.lo = x.lo & y.lo;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Return X | Y. */
|
||||
static inline u64
|
||||
u64or (u64 x, u64 y)
|
||||
{
|
||||
u64 r;
|
||||
r.hi = x.hi | y.hi;
|
||||
r.lo = x.lo | y.lo;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Return X ^ Y. */
|
||||
static inline u64
|
||||
u64xor (u64 x, u64 y)
|
||||
{
|
||||
u64 r;
|
||||
r.hi = x.hi ^ y.hi;
|
||||
r.lo = x.lo ^ y.lo;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Return X + Y. */
|
||||
static inline u64
|
||||
u64plus (u64 x, u64 y)
|
||||
{
|
||||
u64 r;
|
||||
r.lo = x.lo + y.lo;
|
||||
r.hi = x.hi + y.hi + (r.lo < x.lo);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Return X << N. */
|
||||
static inline u64
|
||||
u64shl (u64 x, int n)
|
||||
{
|
||||
u64 r;
|
||||
if (n < 32)
|
||||
{
|
||||
r.hi = (x.hi << n) | (x.lo >> (32 - n));
|
||||
r.lo = x.lo << n;
|
||||
}
|
||||
else
|
||||
{
|
||||
r.hi = x.lo << (n - 32);
|
||||
r.lo = 0;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Return X >> N. */
|
||||
static inline u64
|
||||
u64shr (u64 x, int n)
|
||||
{
|
||||
u64 r;
|
||||
if (n < 32)
|
||||
{
|
||||
r.hi = x.hi >> n;
|
||||
r.lo = (x.hi << (32 - n)) | (x.lo >> n);
|
||||
}
|
||||
else
|
||||
{
|
||||
r.hi = 0;
|
||||
r.lo = x.hi >> (n - 32);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
41
gl/lib/xfreopen.c
Normal file
41
gl/lib/xfreopen.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/* a wrapper for frepoen
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
#include "xfreopen.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include "error.h"
|
||||
#include "exitfail.h"
|
||||
#include "quote.h"
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(msgid) gettext (msgid)
|
||||
|
||||
void
|
||||
xfreopen (char const *filename, char const *mode, FILE *fp)
|
||||
{
|
||||
if (!freopen (filename, mode, fp))
|
||||
{
|
||||
char const *f = (filename ? filename
|
||||
: (fp == stdin ? _("stdin")
|
||||
: (fp == stdout ? _("stdout")
|
||||
: (fp == stderr ? _("stderr")
|
||||
: _("unknown stream")))));
|
||||
error (exit_failure, errno, _("failed to reopen %s with mode %s"),
|
||||
quote_n (0, f), quote_n (1, mode));
|
||||
}
|
||||
}
|
||||
2
gl/lib/xfreopen.h
Normal file
2
gl/lib/xfreopen.h
Normal file
@@ -0,0 +1,2 @@
|
||||
#include <stdio.h>
|
||||
void xfreopen (char const *filename, char const *mode, FILE *fp);
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 2
|
||||
#serial 3
|
||||
dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
@@ -6,6 +6,6 @@ dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_MGETGROUPS],
|
||||
[
|
||||
AC_CHECK_FUNCS(getgrouplist)
|
||||
AC_CHECK_FUNCS([getgrouplist])
|
||||
AC_LIBOBJ([mgetgroups])
|
||||
])
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# serial 1 -*- Autoconf -*-
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# From Jim Meyering
|
||||
# Provide <selinux/context.h>, if necessary.
|
||||
|
||||
AC_DEFUN([gl_HEADERS_SELINUX_CONTEXT_H],
|
||||
[
|
||||
# Check for <selinux/context.h>,
|
||||
AC_CHECK_HEADERS([selinux/context.h],
|
||||
[SELINUX_CONTEXT_H=],
|
||||
[SELINUX_CONTEXT_H=selinux/context.h])
|
||||
AC_SUBST([SELINUX_CONTEXT_H])
|
||||
])
|
||||
@@ -1,17 +0,0 @@
|
||||
# serial 1 -*- Autoconf -*-
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# From Jim Meyering
|
||||
# Provide <selinux/selinux.h>, if necessary.
|
||||
|
||||
AC_DEFUN([gl_HEADERS_SELINUX_SELINUX_H],
|
||||
[
|
||||
# Check for <selinux/selinux.h>,
|
||||
AC_CHECK_HEADERS([selinux/selinux.h],
|
||||
[SELINUX_SELINUX_H=],
|
||||
[SELINUX_SELINUX_H=selinux/selinux.h])
|
||||
AC_SUBST([SELINUX_SELINUX_H])
|
||||
])
|
||||
@@ -1,13 +0,0 @@
|
||||
# sha256.m4 serial 2
|
||||
dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_SHA256],
|
||||
[
|
||||
AC_LIBOBJ([sha256])
|
||||
|
||||
dnl Prerequisites of lib/sha256.c.
|
||||
AC_REQUIRE([AC_C_BIGENDIAN])
|
||||
])
|
||||
@@ -1,13 +0,0 @@
|
||||
# sha512.m4 serial 3
|
||||
dnl Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_SHA512],
|
||||
[
|
||||
AC_LIBOBJ([sha512])
|
||||
|
||||
dnl Prerequisites of lib/sha512.c.
|
||||
AC_REQUIRE([AC_C_BIGENDIAN])
|
||||
])
|
||||
24
gl/modules/argv-iter
Normal file
24
gl/modules/argv-iter
Normal file
@@ -0,0 +1,24 @@
|
||||
Description:
|
||||
iterate through argv or a --files0-from=-specified file
|
||||
|
||||
Files:
|
||||
lib/argv-iter.c
|
||||
lib/argv-iter.h
|
||||
|
||||
Depends-on:
|
||||
getdelim
|
||||
stdbool
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += argv-iter.c argv-iter.h
|
||||
|
||||
Include:
|
||||
"argv-iter.h"
|
||||
|
||||
License
|
||||
GPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
10
gl/modules/argv-iter-tests
Normal file
10
gl/modules/argv-iter-tests
Normal file
@@ -0,0 +1,10 @@
|
||||
Files:
|
||||
tests/test-argv-iter.c
|
||||
|
||||
Depends-on:
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
TESTS += test-argv-iter
|
||||
check_PROGRAMS += test-argv-iter
|
||||
@@ -1,16 +1,13 @@
|
||||
Index: modules/getloadavg
|
||||
===================================================================
|
||||
RCS file: /sources/gnulib/gnulib/modules/getloadavg,v
|
||||
retrieving revision 1.13
|
||||
diff -u -p -r1.13 getloadavg
|
||||
--- modules/getloadavg 22 Sep 2006 12:47:55 -0000 1.13
|
||||
+++ modules/getloadavg 23 Sep 2006 16:41:36 -0000
|
||||
@@ -14,7 +14,7 @@ stdbool
|
||||
diff --git a/modules/getloadavg b/modules/getloadavg
|
||||
index 2fbeb40..b79aaca 100644
|
||||
--- a/modules/getloadavg
|
||||
+++ b/modules/getloadavg
|
||||
@@ -16,7 +16,7 @@ stdbool
|
||||
fcntl-safer
|
||||
|
||||
configure.ac:
|
||||
-gl_GETLOADAVG([$gl_source_base])
|
||||
+gl_GETLOADAVG([lib])
|
||||
gl_STDLIB_MODULE_INDICATOR([getloadavg])
|
||||
|
||||
Makefile.am:
|
||||
|
||||
|
||||
@@ -13,12 +13,13 @@ configure.ac:
|
||||
# For runcon.
|
||||
AC_CHECK_HEADERS([selinux/flask.h])
|
||||
AC_LIBOBJ([selinux-at])
|
||||
ac_save_LIBS="$LIBS"
|
||||
AC_SEARCH_LIBS(setfilecon, selinux,
|
||||
gl_save_LIBS=$LIBS
|
||||
LIB_SELINUX=
|
||||
AC_SEARCH_LIBS([setfilecon], [selinux],
|
||||
[test "$ac_cv_search_setfilecon" = "none required" ||
|
||||
LIB_SELINUX=$ac_cv_search_setfilecon])
|
||||
AC_SUBST(LIB_SELINUX)
|
||||
LIBS="$ac_save_LIBS"
|
||||
LIBS=$gl_save_LIBS
|
||||
|
||||
Makefile.am:
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
Description:
|
||||
SELinux-related headers for systems that lack them.
|
||||
|
||||
Files:
|
||||
lib/se-context.in.h
|
||||
lib/se-selinux.in.h
|
||||
m4/selinux-context-h.m4
|
||||
m4/selinux-selinux-h.m4
|
||||
|
||||
Depends-on:
|
||||
|
||||
configure.ac:
|
||||
gl_HEADERS_SELINUX_SELINUX_H
|
||||
gl_HEADERS_SELINUX_CONTEXT_H
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += se-context.in.h se-selinux.in.h
|
||||
|
||||
BUILT_SOURCES += $(SELINUX_SELINUX_H)
|
||||
selinux/selinux.h: se-selinux.in.h
|
||||
mkdir -p selinux
|
||||
cp $(srcdir)/se-selinux.in.h $@-t
|
||||
chmod a-x $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += selinux/selinux.h selinux/selinux.h-t
|
||||
|
||||
BUILT_SOURCES += $(SELINUX_CONTEXT_H)
|
||||
selinux/context.h: se-context.in.h
|
||||
mkdir -p selinux
|
||||
cp $(srcdir)/se-context.in.h $@-t
|
||||
chmod a-x $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += selinux/context.h selinux/context.h-t
|
||||
MOSTLYCLEANDIRS += selinux
|
||||
|
||||
Include:
|
||||
#include <selinux/selinux.h>
|
||||
#include <selinux/context.h>
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
|
||||
# lib/selinux-at.c
|
||||
#
|
||||
# # For runcon.
|
||||
# AC_CHECK_HEADERS([selinux/flask.h])
|
||||
#
|
||||
# ac_save_LIBS="$LIBS"
|
||||
# AC_SEARCH_LIBS(setfilecon, selinux,
|
||||
# [test "$ac_cv_search_setfilecon" = "none required" ||
|
||||
# LIB_SELINUX=$ac_cv_search_setfilecon])
|
||||
# AC_SUBST(LIB_SELINUX)
|
||||
# LIBS="$ac_save_LIBS"
|
||||
@@ -1,24 +0,0 @@
|
||||
Description:
|
||||
Compute SHA224 and SHA256 checksums.
|
||||
|
||||
Files:
|
||||
lib/sha256.h
|
||||
lib/sha256.c
|
||||
m4/sha256.m4
|
||||
|
||||
Depends-on:
|
||||
stdint
|
||||
|
||||
configure.ac:
|
||||
gl_SHA256
|
||||
|
||||
Makefile.am:
|
||||
|
||||
Include:
|
||||
"sha256.h"
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
@@ -1,25 +0,0 @@
|
||||
Description:
|
||||
Compute SHA384 and SHA512 checksums.
|
||||
|
||||
Files:
|
||||
lib/sha512.h
|
||||
lib/sha512.c
|
||||
m4/sha512.m4
|
||||
lib/u64.h
|
||||
|
||||
Depends-on:
|
||||
stdint
|
||||
|
||||
configure.ac:
|
||||
gl_SHA512
|
||||
|
||||
Makefile.am:
|
||||
|
||||
Include:
|
||||
"sha512.h"
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
25
gl/modules/xfreopen
Normal file
25
gl/modules/xfreopen
Normal file
@@ -0,0 +1,25 @@
|
||||
Description:
|
||||
a wrapper for frepoen
|
||||
|
||||
Files:
|
||||
lib/xfreopen.c
|
||||
lib/xfreopen.h
|
||||
|
||||
Depends-on:
|
||||
error
|
||||
exitfail
|
||||
quote
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += xfreopen.c xfreopen.h
|
||||
|
||||
Include:
|
||||
"xfreopen.h"
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering
|
||||
120
gl/tests/test-argv-iter.c
Normal file
120
gl/tests/test-argv-iter.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/* Test argv iterator
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
|
||||
#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
|
||||
#define ASSERT(expr) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
|
||||
fflush (stderr); \
|
||||
abort (); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#include "argv-iter.h"
|
||||
|
||||
static FILE *
|
||||
write_nul_delimited_argv (char **argv)
|
||||
{
|
||||
FILE *fp = tmpfile ();
|
||||
ASSERT (fp);
|
||||
while (*argv)
|
||||
{
|
||||
size_t len = strlen (*argv) + 1;
|
||||
ASSERT (fwrite (*argv, len, 1, fp) == 1);
|
||||
argv++;
|
||||
}
|
||||
ASSERT (fflush (fp) == 0);
|
||||
rewind (fp);
|
||||
return fp;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
/* set_program_name (argv[0]); placate overzealous "syntax-check" test. */
|
||||
static char *av[][4] = {
|
||||
{NULL},
|
||||
{"1", NULL},
|
||||
{"1", "2", NULL},
|
||||
{"1", "2", "3", NULL}
|
||||
};
|
||||
|
||||
int use_stream;
|
||||
for (use_stream = 0; use_stream < 2; use_stream++)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < ARRAY_CARDINALITY (av); i++)
|
||||
{
|
||||
FILE *fp;
|
||||
struct argv_iterator *ai;
|
||||
size_t n_found = 0;
|
||||
if (use_stream)
|
||||
{
|
||||
/* Generate an identical list to be read via FP. */
|
||||
ASSERT ((fp = write_nul_delimited_argv (av[i])) != NULL);
|
||||
ai = argv_iter_init_stream (fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
fp = NULL;
|
||||
ai = argv_iter_init_argv (av[i]);
|
||||
}
|
||||
ASSERT (ai);
|
||||
|
||||
while (1)
|
||||
{
|
||||
enum argv_iter_err ai_err;
|
||||
char *s = argv_iter (ai, &ai_err);
|
||||
ASSERT ((i == n_found) == (ai_err == AI_ERR_EOF));
|
||||
ASSERT ((s == NULL) ^ (ai_err == AI_ERR_OK));
|
||||
ASSERT (ai_err == AI_ERR_OK || ai_err == AI_ERR_EOF);
|
||||
if (ai_err == AI_ERR_OK)
|
||||
++n_found;
|
||||
if (ai_err == AI_ERR_EOF)
|
||||
break;
|
||||
/* In stream mode, the strings are equal, but
|
||||
in argv mode the actual pointers are equal. */
|
||||
ASSERT (use_stream
|
||||
? STREQ (s, av[i][n_found - 1])
|
||||
: s == av[i][n_found - 1]);
|
||||
}
|
||||
ASSERT (argv_iter_n_args (ai) == i);
|
||||
argv_iter_free (ai);
|
||||
if (fp)
|
||||
ASSERT (fclose (fp) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
1
gnulib
Submodule
1
gnulib
Submodule
Submodule gnulib added at 5a1286a9f8
@@ -1 +1,6 @@
|
||||
include gnulib.mk
|
||||
|
||||
TEST_LOGS = $(TESTS:=.log)
|
||||
|
||||
# Parallel replacement of Automake's check-TESTS target.
|
||||
include $(top_srcdir)/build-aux/check.mk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Makefile for gnulib/lib -*-Makefile-*-
|
||||
|
||||
# Copyright (C) 1995-2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995-2007, 2009 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
include gnulib.mk
|
||||
|
||||
AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
|
||||
AM_CFLAGS += $(WARN_CFLAGS) # $(WERROR_CFLAGS)
|
||||
|
||||
libcoreutils_a_SOURCES += \
|
||||
buffer-lcm.c buffer-lcm.h \
|
||||
|
||||
@@ -52,9 +52,9 @@ xmemxfrm (char *restrict dest, size_t destsize,
|
||||
if (errno)
|
||||
{
|
||||
error (0, errno, _("string transformation failed"));
|
||||
error (0, 0, _("Set LC_ALL='C' to work around the problem."));
|
||||
error (0, 0, _("set LC_ALL='C' to work around the problem"));
|
||||
error (exit_failure, 0,
|
||||
_("The untransformed string was %s."),
|
||||
_("the untransformed string was %s"),
|
||||
quotearg_n_style_mem (0, locale_quoting_style, src, srcsize));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# boottime.m4 serial 3
|
||||
# boottime.m4 serial 4
|
||||
# Determine whether this system has infrastructure for obtaining the boot time.
|
||||
|
||||
# Copyright (C) 1996, 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996, 2000, 2002-2004, 2006, 2008 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -20,14 +20,14 @@
|
||||
* ----------------------------------------------------------
|
||||
AC_DEFUN([GNULIB_BOOT_TIME],
|
||||
[
|
||||
AC_CHECK_FUNCS(sysctl)
|
||||
AC_CHECK_HEADERS_ONCE(sys/param.h)
|
||||
AC_CHECK_HEADERS(sys/sysctl.h, [], [],
|
||||
AC_CHECK_FUNCS([sysctl])
|
||||
AC_CHECK_HEADERS_ONCE([sys/param.h])
|
||||
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
[#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif]])
|
||||
AC_CHECK_HEADERS_ONCE(utmp.h utmpx.h OS.h)
|
||||
AC_CHECK_HEADERS_ONCE([utmp.h utmpx.h OS.h])
|
||||
AC_CACHE_CHECK(
|
||||
[whether we can get the system boot time],
|
||||
[gnulib_cv_have_boot_time],
|
||||
@@ -57,8 +57,8 @@ AC_DEFUN([GNULIB_BOOT_TIME],
|
||||
please_tell_us_how_to_determine_boot_time_on_your_system
|
||||
#endif
|
||||
]])],
|
||||
gnulib_cv_have_boot_time=yes,
|
||||
gnulib_cv_have_boot_time=no)
|
||||
[gnulib_cv_have_boot_time=yes],
|
||||
[gnulib_cv_have_boot_time=no])
|
||||
])
|
||||
AS_IF([test $gnulib_cv_have_boot_time = yes], [$1], [$2])
|
||||
])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#serial 23
|
||||
#serial 24
|
||||
# Check declarations for this package.
|
||||
|
||||
dnl Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
|
||||
dnl Copyright (C) 1997-2001, 2003-2006, 2008
|
||||
dnl Free Software Foundation, Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
@@ -16,7 +16,7 @@ AC_DEFUN([gl_CHECK_DECLS],
|
||||
[
|
||||
AC_REQUIRE([AC_HEADER_TIME])
|
||||
|
||||
AC_CHECK_HEADERS_ONCE(grp.h pwd.h)
|
||||
AC_CHECK_HEADERS_ONCE([grp.h pwd.h])
|
||||
headers='
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
36
m4/gmp.m4
Normal file
36
m4/gmp.m4
Normal file
@@ -0,0 +1,36 @@
|
||||
# Tests for GNU GMP (or any compatible replacement).
|
||||
|
||||
dnl Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl Written by James Youngman.
|
||||
|
||||
dnl Check for libgmp. We avoid use of AC_CHECK_LIBS because we don't want to
|
||||
dnl add this to $LIBS for all targets.
|
||||
AC_DEFUN([cu_GMP],
|
||||
[
|
||||
LIB_GMP=
|
||||
AC_SUBST([LIB_GMP])
|
||||
|
||||
AC_ARG_WITH([gmp],
|
||||
AS_HELP_STRING([--without-gmp],
|
||||
[do not use the GNU MP library for arbitrary precision
|
||||
calculation (default: use it if available)]),
|
||||
[cu_use_gmp=$withval],
|
||||
[cu_use_gmp=auto])
|
||||
|
||||
if test $cu_use_gmp != no; then
|
||||
cu_saved_libs=$LIBS
|
||||
AC_SEARCH_LIBS([__gmpz_init], [gmp],
|
||||
[test "$ac_cv_search___gmpz_init" = "none required" ||
|
||||
{
|
||||
LIB_GMP=$ac_cv_search___gmpz_init
|
||||
AC_DEFINE([HAVE_GMP], [1],
|
||||
[Define if you have GNU libgmp (or replacement)])
|
||||
}])
|
||||
LIBS=$cu_saved_libs
|
||||
fi
|
||||
])
|
||||
@@ -1,8 +1,8 @@
|
||||
#serial 106 -*- autoconf -*-
|
||||
#serial 109 -*- autoconf -*-
|
||||
|
||||
dnl Misc type-related macros for coreutils.
|
||||
|
||||
# Copyright (C) 1998, 2000-2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1998, 2000-2009 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -22,7 +22,7 @@ dnl Misc type-related macros for coreutils.
|
||||
AC_DEFUN([coreutils_MACROS],
|
||||
[
|
||||
AM_MISSING_PROG(HELP2MAN, help2man)
|
||||
AC_SUBST(MAN)
|
||||
AC_SUBST([MAN])
|
||||
|
||||
dnl This macro actually runs replacement code. See isc-posix.m4.
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
@@ -36,15 +36,21 @@ AC_DEFUN([coreutils_MACROS],
|
||||
AC_REQUIRE([AC_FUNC_FSEEKO])
|
||||
|
||||
# By default, argmatch should fail calling usage (1).
|
||||
AC_DEFINE(ARGMATCH_DIE, [usage (1)],
|
||||
AC_DEFINE([ARGMATCH_DIE], [usage (1)],
|
||||
[Define to the function xargmatch calls on failures.])
|
||||
AC_DEFINE(ARGMATCH_DIE_DECL, [void usage ()],
|
||||
AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)],
|
||||
[Define to the declaration of the xargmatch failure function.])
|
||||
|
||||
# used by ls
|
||||
AC_REQUIRE([gl_CLOCK_TIME])
|
||||
# used by shred
|
||||
AC_CHECK_FUNCS_ONCE(directio)
|
||||
AC_CHECK_FUNCS_ONCE([directio])
|
||||
|
||||
# Used by install.c.
|
||||
AC_CHECK_FUNCS_ONCE([matchpathcon_init_prefix])
|
||||
|
||||
# Used by sort.c.
|
||||
AC_CHECK_FUNCS_ONCE([nl_langinfo])
|
||||
|
||||
AC_CHECK_FUNCS_ONCE( \
|
||||
endgrent \
|
||||
@@ -73,24 +79,38 @@ AC_DEFUN([coreutils_MACROS],
|
||||
[test "$ac_cv_search_fdatasync" = "none required" ||
|
||||
LIB_FDATASYNC=$ac_cv_search_fdatasync])
|
||||
AC_SUBST([LIB_FDATASYNC])
|
||||
AC_CHECK_FUNCS(fdatasync)
|
||||
AC_CHECK_FUNCS([fdatasync])
|
||||
LIBS=$coreutils_saved_libs
|
||||
|
||||
# Check whether libcap is usable -- for ls --color support
|
||||
AC_ARG_ENABLE([libcap],
|
||||
AC_HELP_STRING([--disable-libcap], [disable libcap support]),
|
||||
AC_MSG_WARN([libcap support disabled by user]),
|
||||
[AC_CHECK_LIB([cap], [cap_get_file],
|
||||
[AC_CHECK_HEADER([sys/capability.h],
|
||||
[LIB_CAP=-lcap
|
||||
AC_DEFINE([HAVE_CAP], [1], [libcap usability])],
|
||||
[AC_MSG_WARN([header sys/capability.h was not found, support for libcap will not be built])]
|
||||
)],
|
||||
[AC_MSG_WARN([libcap library was not found or not usable, support for libcap will not be built])])
|
||||
])
|
||||
AC_SUBST([LIB_CAP])
|
||||
|
||||
# See if linking `seq' requires -lm.
|
||||
# It does on nearly every system. The single exception (so far) is
|
||||
# BeOS which has all the math functions in the normal runtime library
|
||||
# and doesn't have a separate math library.
|
||||
|
||||
AC_SUBST(SEQ_LIBM)
|
||||
AC_SUBST([SEQ_LIBM])
|
||||
ac_seq_body='
|
||||
static double x, y;
|
||||
x = floor (x);
|
||||
x = rint (x);
|
||||
x = modf (x, &y);'
|
||||
AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
|
||||
AC_TRY_LINK([#include <math.h>], [$ac_seq_body], ,
|
||||
[ac_seq_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
|
||||
AC_TRY_LINK([#include <math.h>], [$ac_seq_body], [SEQ_LIBM=-lm])
|
||||
LIBS="$ac_seq_save_LIBS"
|
||||
])
|
||||
|
||||
@@ -113,7 +133,7 @@ AC_DEFUN([gl_CHECK_ALL_HEADERS],
|
||||
syslog.h \
|
||||
termios.h \
|
||||
)
|
||||
AC_CHECK_HEADERS(sys/sysctl.h, [], [],
|
||||
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
[#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
@@ -134,10 +154,9 @@ AC_DEFUN([gl_CHECK_ALL_TYPES],
|
||||
AC_REQUIRE([AM_C_PROTOTYPES])
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_REQUIRE([AC_C_BIGENDIAN])
|
||||
AC_REQUIRE([gl_BIGENDIAN])
|
||||
AC_REQUIRE([AC_C_VOLATILE])
|
||||
AC_REQUIRE([AC_C_INLINE])
|
||||
AC_REQUIRE([AC_C_LONG_DOUBLE])
|
||||
AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
|
||||
|
||||
AC_REQUIRE([gl_CHECK_ALL_HEADERS])
|
||||
@@ -155,12 +174,12 @@ AC_DEFUN([gl_CHECK_ALL_TYPES],
|
||||
AC_REQUIRE([AC_TYPE_PID_T])
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])
|
||||
AC_REQUIRE([AC_TYPE_UID_T])
|
||||
AC_CHECK_TYPE(ino_t, unsigned long int)
|
||||
AC_CHECK_TYPE([ino_t], [unsigned long int])
|
||||
|
||||
dnl This relies on the fact that Autoconf's implementation of
|
||||
dnl AC_CHECK_TYPE checks includes unistd.h.
|
||||
AC_CHECK_TYPE(major_t, unsigned int)
|
||||
AC_CHECK_TYPE(minor_t, unsigned int)
|
||||
AC_CHECK_TYPE([major_t], [unsigned int])
|
||||
AC_CHECK_TYPE([minor_t], [unsigned int])
|
||||
|
||||
AC_REQUIRE([AC_HEADER_MAJOR])
|
||||
])
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#serial 10
|
||||
#serial 11
|
||||
|
||||
dnl Misc lib-related macros for coreutils.
|
||||
|
||||
# Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004,
|
||||
# 2005, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1993-1997, 2000-2001, 2003-2006, 2008
|
||||
# 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
|
||||
@@ -24,20 +24,20 @@ AC_DEFUN([cu_LIB_CHECK],
|
||||
[
|
||||
|
||||
# Check for libypsec.a on Dolphin M88K machines.
|
||||
AC_CHECK_LIB(ypsec, main)
|
||||
AC_CHECK_LIB([ypsec], [main])
|
||||
|
||||
# m88k running dgux 5.4 needs this
|
||||
AC_CHECK_LIB(ldgc, main)
|
||||
AC_CHECK_LIB([ldgc], [main])
|
||||
|
||||
# The -lsun library is required for YP support on Irix-4.0.5 systems.
|
||||
# m88k/svr3 DolphinOS systems using YP need -lypsec for id.
|
||||
AC_SEARCH_LIBS(yp_match, [sun ypsec])
|
||||
AC_SEARCH_LIBS([yp_match], [sun ypsec])
|
||||
|
||||
# SysV needs -lsec, older versions of Linux need -lshadow for
|
||||
# shadow passwords. UnixWare 7 needs -lgen.
|
||||
AC_SEARCH_LIBS(getspnam, [shadow sec gen])
|
||||
AC_SEARCH_LIBS([getspnam], [shadow sec gen])
|
||||
|
||||
AC_CHECK_HEADERS(shadow.h)
|
||||
AC_CHECK_HEADERS([shadow.h])
|
||||
|
||||
# Requirements for su.c.
|
||||
shadow_includes="\
|
||||
@@ -47,14 +47,14 @@ $ac_includes_default
|
||||
#endif
|
||||
"
|
||||
AC_CHECK_MEMBERS([struct spwd.sp_pwdp],,,[$shadow_includes])
|
||||
AC_CHECK_FUNCS(getspnam)
|
||||
AC_CHECK_FUNCS([getspnam])
|
||||
|
||||
# SCO-ODT-3.0 is reported to need -lufc for crypt.
|
||||
# NetBSD needs -lcrypt for crypt.
|
||||
cu_saved_libs="$LIBS"
|
||||
AC_SEARCH_LIBS(crypt, [ufc crypt],
|
||||
AC_SEARCH_LIBS([crypt], [ufc crypt],
|
||||
[test "$ac_cv_search_crypt" = "none required" ||
|
||||
LIB_CRYPT="$ac_cv_search_crypt"])
|
||||
LIBS="$cu_saved_libs"
|
||||
AC_SUBST(LIB_CRYPT)
|
||||
AC_SUBST([LIB_CRYPT])
|
||||
])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 75
|
||||
#serial 76
|
||||
|
||||
dnl We use gl_ for non Autoconf macros.
|
||||
m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
|
||||
@@ -7,7 +7,7 @@ m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
|
||||
# directory of the coreutils package.
|
||||
|
||||
|
||||
# Copyright (C) 1998, 2000, 2001, 2003-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1998, 2000, 2001, 2003-2009 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -38,6 +38,7 @@ AC_DEFUN([gl_PREREQ],
|
||||
# handles that; see ../bootstrap.conf.
|
||||
AC_REQUIRE([gl_EUIDACCESS_STAT])
|
||||
AC_REQUIRE([gl_FD_REOPEN])
|
||||
AC_REQUIRE([gl_FUNC_XATTR])
|
||||
AC_REQUIRE([gl_FUNC_XFTS])
|
||||
AC_REQUIRE([gl_MEMXFRM])
|
||||
AC_REQUIRE([gl_STRINTCMP])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# stat-prog.m4 serial 5
|
||||
# stat-prog.m4 serial 6
|
||||
# Record the prerequisites of src/stat.c from the coreutils package.
|
||||
|
||||
# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2004, 2006, 2008 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
|
||||
@@ -68,7 +68,7 @@ AC_INCLUDES_DEFAULT
|
||||
[$statvfs_includes],
|
||||
[static statvfs s;
|
||||
return (s.s_fsid ^ 0) == 0;])],
|
||||
[AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], 1,
|
||||
[AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], [1],
|
||||
[Define to 1 if the f_fsid member of struct statvfs is an integer.])])
|
||||
else
|
||||
AC_CHECK_MEMBERS([struct statfs.f_namelen, struct statfs.f_type],,,
|
||||
@@ -79,7 +79,7 @@ AC_INCLUDES_DEFAULT
|
||||
[$statfs_includes],
|
||||
[static statfs s;
|
||||
return (s.s_fsid ^ 0) == 0;])],
|
||||
[AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], 1,
|
||||
[AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], [1],
|
||||
[Define to 1 if the f_fsid member of struct statfs is an integer.])])
|
||||
fi
|
||||
fi
|
||||
|
||||
36
m4/xattr.m4
Normal file
36
m4/xattr.m4
Normal file
@@ -0,0 +1,36 @@
|
||||
# xattr.m4 - check for Extended Attributes (Linux)
|
||||
|
||||
# Copyright (C) 2003, 2008-2009 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# Originally written by Andreas Gruenbacher.
|
||||
# http://www.suse.de/~agruen/coreutils/5.91/coreutils-xattr.diff
|
||||
|
||||
AC_DEFUN([gl_FUNC_XATTR],
|
||||
[
|
||||
AC_ARG_ENABLE([xattr],
|
||||
AC_HELP_STRING([--disable-xattr],
|
||||
[do not support extended attributes]),
|
||||
[use_xattr=$enableval], [use_xattr=yes])
|
||||
|
||||
if test "$use_xattr" = "yes"; then
|
||||
AC_CHECK_HEADERS([attr/error_context.h attr/libattr.h])
|
||||
if test $ac_cv_header_attr_libattr_h = yes \
|
||||
&& test $ac_cv_header_attr_error_context_h = yes; then
|
||||
use_xattr=1
|
||||
else
|
||||
use_xattr=0
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([USE_XATTR], [$use_xattr],
|
||||
[Define if you want extended attribute support.])
|
||||
xattr_saved_LIBS=$LIBS
|
||||
AC_SEARCH_LIBS([attr_copy_file], [attr],
|
||||
[test "$ac_cv_search_attr_copy_file" = "none required" ||
|
||||
LIB_XATTR=$ac_cv_search_attr_copy_file])
|
||||
AC_CHECK_FUNCS([attr_copy_file])
|
||||
LIBS=$xattr_saved_LIBS
|
||||
AC_SUBST([LIB_XATTR])
|
||||
fi
|
||||
])
|
||||
675
maint.mk
675
maint.mk
@@ -2,7 +2,7 @@
|
||||
# This Makefile fragment tries to be general-purpose enough to be
|
||||
# used by at least coreutils, idutils, CPPI, Bison, and Autoconf.
|
||||
|
||||
## Copyright (C) 2001-2008 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2001-2009 Free Software Foundation, Inc.
|
||||
##
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@@ -31,7 +31,7 @@ GIT = git
|
||||
VC = $(GIT)
|
||||
VC-tag = git tag -s -m '$(VERSION)'
|
||||
|
||||
VC_LIST = build-aux/vc-list-files
|
||||
VC_LIST = $(srcdir)/build-aux/vc-list-files
|
||||
|
||||
VC_LIST_EXCEPT = \
|
||||
$(VC_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
|
||||
@@ -42,6 +42,7 @@ endif
|
||||
|
||||
PREV_VERSION := $(shell cat $(prev_version_file))
|
||||
VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
||||
PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
|
||||
|
||||
ifeq ($(VC),$(GIT))
|
||||
this-vc-tag = v$(VERSION)
|
||||
@@ -61,24 +62,25 @@ release_archive_dir ?= ../release
|
||||
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
|
||||
export LC_ALL = C
|
||||
|
||||
|
||||
|
||||
## --------------- ##
|
||||
## Sanity checks. ##
|
||||
## --------------- ##
|
||||
|
||||
# Collect the names of rules starting with `sc_'.
|
||||
syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
|
||||
$(srcdir)/$(ME))
|
||||
$(srcdir)/$(ME) $(srcdir)/cfg.mk)
|
||||
.PHONY: $(syntax-check-rules)
|
||||
|
||||
local-checks-available = \
|
||||
po-check copyright-check m4-check author_mark_check \
|
||||
patch-check strftime-check $(syntax-check-rules) \
|
||||
makefile_path_separator_check \
|
||||
patch-check $(syntax-check-rules) \
|
||||
makefile-check check-AUTHORS
|
||||
.PHONY: $(local-checks-available)
|
||||
|
||||
# Arrange to print the name of each syntax-checking rule just before running it.
|
||||
$(syntax-check-rules): %: %.m
|
||||
$(patsubst %, %.m, $(syntax-check-rules)):
|
||||
@echo $(patsubst sc_%.m, %, $@)
|
||||
|
||||
local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
|
||||
|
||||
syntax-check: $(local-check)
|
||||
@@ -93,6 +95,21 @@ syntax-check: $(local-check)
|
||||
# exit 1; } || :
|
||||
# FIXME: don't allow `#include .strings\.h' anywhere
|
||||
|
||||
# By default, _prohibit_regexp does not ignore case.
|
||||
export ignore_case =
|
||||
_ignore_case = $$(test -n "$$ignore_case" && echo -i || :)
|
||||
|
||||
# There are many rules below that prohibit constructs in this package.
|
||||
# If the offending construct can be matched with a grep-E-style regexp,
|
||||
# use this macro. The shell variables "re" and "msg" must be defined.
|
||||
define _prohibit_regexp
|
||||
dummy=; : so we do not need a semicolon before each use \
|
||||
test "x$$re" != x || { echo '$(ME): re not defined' 1>&2; exit 1; }; \
|
||||
test "x$$msg" != x || { echo '$(ME): msg not defined' 1>&2; exit 1; };\
|
||||
grep $(_ignore_case) -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): '"$$msg" 1>&2; exit 1; } || :
|
||||
endef
|
||||
|
||||
sc_avoid_if_before_free:
|
||||
@$(srcdir)/build-aux/useless-if-before-free \
|
||||
$(useless_free_options) \
|
||||
@@ -101,55 +118,75 @@ sc_avoid_if_before_free:
|
||||
exit 1; } || :
|
||||
|
||||
sc_cast_of_argument_to_free:
|
||||
@grep -nE '\<free \(\(' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): don'\''t cast free argument' 1>&2; \
|
||||
exit 1; } || :
|
||||
@re='\<free *\( *\(' msg='don'\''t cast free argument' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
sc_cast_of_x_alloc_return_value:
|
||||
@grep -nE '\*\) *x(m|c|re)alloc\>' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
|
||||
exit 1; } || :
|
||||
@re='\*\) *x(m|c|re)alloc\>' \
|
||||
msg='don'\''t cast x*alloc return value' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
sc_cast_of_alloca_return_value:
|
||||
@grep -nE '\*\) *alloca\>' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): don'\''t cast alloca return value' 1>&2; \
|
||||
exit 1; } || :
|
||||
@re='\*\) *alloca\>' msg='don'\''t cast alloca return value' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
sc_space_tab:
|
||||
@grep -n '[ ] ' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
|
||||
1>&2; exit 1; } || :
|
||||
@re='[ ] ' msg='found SPACE-TAB sequence; remove the SPACE' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Don't use *scanf or the old ato* functions in `real' code.
|
||||
# They provide no error checking mechanism.
|
||||
# Instead, use strto* functions.
|
||||
sc_prohibit_atoi_atof:
|
||||
@grep -nE '\<([fs]?scanf|ato([filq]|ll))\>' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): do not use *scan''f, ato''f, ato''i, ato''l, ato''ll, ato''q, or ss''canf' \
|
||||
1>&2; exit 1; } || :
|
||||
@re='\<([fs]?scanf|ato([filq]|ll)) *\(' \
|
||||
msg='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Use STREQ rather than comparing strcmp == 0, or != 0.
|
||||
sc_prohibit_strcmp:
|
||||
@grep -nE '! *str''cmp \(|\<str''cmp \([^)]+\) *==' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
@grep -nE '! *str''cmp *\(|\<str''cmp *\([^)]+\) *==' \
|
||||
$$($(VC_LIST_EXCEPT)) \
|
||||
| grep -vE ':# *define STREQ\(' && \
|
||||
{ echo '$(ME): use STREQ in place of the above uses of str''cmp' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Using EXIT_SUCCESS as the first argument to error is misleading,
|
||||
# since when that parameter is 0, error does not exit. Use `0' instead.
|
||||
sc_error_exit_success:
|
||||
@grep -nF 'error (EXIT_SUCCESS,' \
|
||||
$$(find -type f -name '*.[chly]') && \
|
||||
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
|
||||
@grep -nE 'error \(EXIT_SUCCESS,' \
|
||||
$$($(VC_LIST_EXCEPT) | grep -E '\.[chly]$$') && \
|
||||
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; exit 1; } || :
|
||||
|
||||
# `FATAL:' should be fully upper-cased in error messages
|
||||
# `WARNING:' should be fully upper-cased, or fully lower-cased
|
||||
sc_error_message_warn_fatal:
|
||||
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
|
||||
| grep -E '"Warning|"Fatal|"fatal' && \
|
||||
{ echo '$(ME): use FATAL, WARNING or warning' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Error messages should not start with a capital letter
|
||||
sc_error_message_uppercase:
|
||||
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
|
||||
| grep -E '"[A-Z]' \
|
||||
| grep -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' && \
|
||||
{ echo '$(ME): found capitalized error message' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Error messages should not end with a period
|
||||
sc_error_message_period:
|
||||
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
|
||||
| grep -E '[^."]\."' && \
|
||||
{ echo '$(ME): found error message ending in period' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_file_system:
|
||||
@grep -ni 'file''system' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found use of "file''system";' \
|
||||
'rewrite to use "file system"' 1>&2; \
|
||||
exit 1; } || :
|
||||
@re=file''system ignore_case=1 \
|
||||
msg='found use of "file''system"; spell it "file system"' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
sc_no_have_config_h:
|
||||
# Don't use cpp tests of this symbol. All code assumes config.h is included.
|
||||
sc_prohibit_have_config_h:
|
||||
@grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
|
||||
1>&2; exit 1; } || :
|
||||
@@ -165,6 +202,25 @@ sc_require_config_h:
|
||||
else :; \
|
||||
fi
|
||||
|
||||
# You must include <config.h> before including any other header file.
|
||||
sc_require_config_h_first:
|
||||
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
|
||||
fail=0; \
|
||||
for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do \
|
||||
grep '^# *include\>' $$i | sed 1q \
|
||||
| grep '^# *include <config\.h>' > /dev/null \
|
||||
|| { echo $$i; fail=1; }; \
|
||||
done; \
|
||||
test $$fail = 1 && \
|
||||
{ echo '$(ME): the above files include some other header' \
|
||||
'before <config.h>' 1>&2; exit 1; } || :; \
|
||||
else :; \
|
||||
fi
|
||||
|
||||
sc_prohibit_HAVE_MBRTOWC:
|
||||
@re='\bHAVE_MBRTOWC\b' msg="do not use $$re; it is always defined" \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# To use this "command" macro, you must first define two shell variables:
|
||||
# h: the header, enclosed in <> or ""
|
||||
# re: a regular expression that matches IFF something provided by $h is used.
|
||||
@@ -226,11 +282,53 @@ sc_prohibit_root_dev_ino_without_use:
|
||||
re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
|
||||
$(_header_without_use)
|
||||
|
||||
# Prohibit the inclusion of c-ctype.h without an actual use.
|
||||
ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
|
||||
|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
|
||||
sc_prohibit_c_ctype_without_use:
|
||||
@h='[<"]c-ctype.h[">]' re='\<c_($(ctype_re)) *\(' $(_header_without_use)
|
||||
|
||||
_empty =
|
||||
_sp = $(_empty) $(_empty)
|
||||
# The following list was generated by running:
|
||||
# man signal.h|col -b|perl -ne '/bsd_signal.*;/.../sigwaitinfo.*;/ and print' \
|
||||
# | perl -lne '/^\s+(?:int|void).*?(\w+).*/ and print $1' | fmt
|
||||
_sig_functions = \
|
||||
bsd_signal kill killpg pthread_kill pthread_sigmask raise sigaction \
|
||||
sigaddset sigaltstack sigdelset sigemptyset sigfillset sighold sigignore \
|
||||
siginterrupt sigismember signal sigpause sigpending sigprocmask sigqueue \
|
||||
sigrelse sigset sigsuspend sigtimedwait sigwait sigwaitinfo
|
||||
_sig_function_re = $(subst $(_sp),|,$(strip $(_sig_functions)))
|
||||
# The following were extracted from "man signal.h" manually.
|
||||
_sig_types_and_consts = \
|
||||
MINSIGSTKSZ SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK \
|
||||
SA_RESETHAND SA_RESTART SA_SIGINFO SIGEV_NONE SIGEV_SIGNAL \
|
||||
SIGEV_THREAD SIGSTKSZ SIG_BLOCK SIG_SETMASK SIG_UNBLOCK SS_DISABLE \
|
||||
SS_ONSTACK mcontext_t pid_t sig_atomic_t sigevent siginfo_t sigset_t \
|
||||
sigstack sigval stack_t ucontext_t
|
||||
# generated via this:
|
||||
# perl -lne '/^#ifdef (SIG\w+)/ and print $1' lib/sig2str.c|sort -u|fmt -70
|
||||
_sig_names = \
|
||||
SIGABRT SIGALRM SIGALRM1 SIGBUS SIGCANCEL SIGCHLD SIGCLD SIGCONT \
|
||||
SIGDANGER SIGDIL SIGEMT SIGFPE SIGFREEZE SIGGRANT SIGHUP SIGILL \
|
||||
SIGINFO SIGINT SIGIO SIGIOT SIGKAP SIGKILL SIGKILLTHR SIGLOST SIGLWP \
|
||||
SIGMIGRATE SIGMSG SIGPHONE SIGPIPE SIGPOLL SIGPRE SIGPROF SIGPWR \
|
||||
SIGQUIT SIGRETRACT SIGSAK SIGSEGV SIGSOUND SIGSTKFLT SIGSTOP SIGSYS \
|
||||
SIGTERM SIGTHAW SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGUSR1 \
|
||||
SIGUSR2 SIGVIRT SIGVTALRM SIGWAITING SIGWINCH SIGWIND SIGWINDOW \
|
||||
SIGXCPU SIGXFSZ
|
||||
_sig_syms_re = $(subst $(_sp),|,$(strip $(_sig_names) $(_sig_types_and_consts)))
|
||||
|
||||
# Prohibit the inclusion of signal.h without an actual use.
|
||||
sc_prohibit_signal_without_use:
|
||||
@h='<signal.h>' \
|
||||
re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>' \
|
||||
$(_header_without_use)
|
||||
|
||||
sc_obsolete_symbols:
|
||||
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
|
||||
1>&2; exit 1; } || :
|
||||
@re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
|
||||
msg='do not use HAVE''_FCNTL_H or O'_NDELAY \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
|
||||
|
||||
@@ -240,137 +338,43 @@ sc_changelog:
|
||||
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
|
||||
# with the strings from the two affected variables.
|
||||
dd_c = $(srcdir)/src/dd.c
|
||||
sc_dd_max_sym_length:
|
||||
ifneq ($(wildcard $(dd_c)),)
|
||||
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
|
||||
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|
||||
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
|
||||
| wc --max-line-length); \
|
||||
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|
||||
|tr -d '"' | wc --max-line-length); \
|
||||
if test "$$len" = "$$max"; then :; else \
|
||||
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
endif
|
||||
|
||||
# Many m4 macros names once began with `jm_'.
|
||||
# On 2004-04-13, they were all changed to start with gl_ instead.
|
||||
# Make sure that none are inadvertently reintroduced.
|
||||
sc_prohibit_jm_in_m4:
|
||||
@grep -nE 'jm_[A-Z]' \
|
||||
$$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
|
||||
{ echo '$(ME): do not use jm_ in m4 macro names' \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
sc_root_tests:
|
||||
@if test -d tests \
|
||||
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
|
||||
t1=sc-root.expected; t2=sc-root.actual; \
|
||||
grep -nl '^require_root_$$' \
|
||||
$$($(VC_LIST) tests) |sed s,tests,., |sort > $$t1; \
|
||||
sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
|
||||
$(srcdir)/tests/Makefile.am |sort > $$t2; \
|
||||
diff -u $$t1 $$t2 || diff=1; \
|
||||
rm -f $$t1 $$t2; \
|
||||
test "$$diff" \
|
||||
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
headers_with_interesting_macro_defs = \
|
||||
exit.h \
|
||||
fcntl_.h \
|
||||
fnmatch_.h \
|
||||
intprops.h \
|
||||
inttypes_.h \
|
||||
lchown.h \
|
||||
openat.h \
|
||||
stat-macros.h \
|
||||
stdint_.h
|
||||
|
||||
# Create a list of regular expressions matching the names
|
||||
# of macros that are guaranteed by parts of gnulib to be defined.
|
||||
.re-defmac:
|
||||
@(cd $(srcdir)/lib; \
|
||||
for f in $(headers_with_interesting_macro_defs); do \
|
||||
test -f $$f && \
|
||||
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
|
||||
done; \
|
||||
) | sort -u \
|
||||
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
|
||||
| sed 's/^/^# *define /' \
|
||||
> $@-t
|
||||
@mv $@-t $@
|
||||
|
||||
# Don't define macros that we already get from gnulib header files.
|
||||
sc_always_defined_macros: .re-defmac
|
||||
@if test -f $(srcdir)/src/system.h; then \
|
||||
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
|
||||
grep -f .re-defmac $$($(VC_LIST)) \
|
||||
&& { echo '$(ME): define the above via some gnulib .h file' \
|
||||
1>&2; exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# Create a list of regular expressions matching the names
|
||||
# of files included from system.h. Exclude a couple.
|
||||
.re-list:
|
||||
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
|
||||
| grep -Ev 'sys/(param|file)\.h' \
|
||||
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
|
||||
> $@-t
|
||||
@mv $@-t $@
|
||||
|
||||
# Files in src/ should not include directly any of
|
||||
# the headers already included via system.h.
|
||||
sc_system_h_headers: .re-list
|
||||
@if test -f $(srcdir)/src/system.h; then \
|
||||
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
|
||||
grep -nE -f .re-list \
|
||||
$$($(VC_LIST) src | \
|
||||
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
|
||||
&& { echo '$(ME): the above are already included via system.h'\
|
||||
1>&2; exit 1; } || :; \
|
||||
# Ensure that each .c file containing a "main" function also
|
||||
# calls set_program_name.
|
||||
sc_program_name:
|
||||
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
|
||||
files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \
|
||||
grep -LE 'set_program_name *\(m?argv\[0\]\);' $$files \
|
||||
| grep . && \
|
||||
{ echo '$(ME): the above files do not call set_program_name' \
|
||||
1>&2; exit 1; } || :; \
|
||||
else :; \
|
||||
fi
|
||||
|
||||
# Require that the final line of each test-lib.sh-using test be this one:
|
||||
# (exit $fail); exit $fail
|
||||
# Exit $fail
|
||||
# Note: this test requires GNU grep's --label= option.
|
||||
sc_require_test_exit_idiom:
|
||||
@if test -f $(srcdir)/tests/test-lib.sh; then \
|
||||
die=0; \
|
||||
for i in $$(grep -l -F /../test-lib.sh $$($(VC_LIST) tests)); do \
|
||||
tail -n1 $$i | grep '^(exit \$$fail); exit \$$fail$$' > /dev/null \
|
||||
tail -n1 $$i | grep '^Exit \$$fail$$' > /dev/null \
|
||||
&& : || { die=1; echo $$i; } \
|
||||
done; \
|
||||
test $$die = 1 && \
|
||||
{ echo 1>&2 '$(ME): the final line in each of the above is not:'; \
|
||||
echo 1>&2 '(exit $$fail); exit $$fail'; \
|
||||
echo 1>&2 'Exit $$fail'; \
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
sc_sun_os_names:
|
||||
@grep -nEi \
|
||||
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_the_the:
|
||||
@grep -ni '\<the ''the\>' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found use of "the ''the";' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_tight_scope:
|
||||
$(MAKE) -C src $@
|
||||
@re='\<the ''the\>' \
|
||||
ignore_case=1 msg='found use of "the ''the";' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
sc_trailing_blank:
|
||||
@grep -n '[ ]$$' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): found trailing blank(s)' \
|
||||
1>&2; exit 1; } || :
|
||||
@re='[ ]$$' \
|
||||
msg='found trailing blank(s)' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Match lines like the following, but where there is only one space
|
||||
# between the options and the description:
|
||||
@@ -380,7 +384,7 @@ sc_two_space_separator_in_usage:
|
||||
@grep -nE '^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
|
||||
$$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo "$(ME): help2man requires at least two spaces between"; \
|
||||
echo "$(ME): an option and its description"; \
|
||||
echo "$(ME): an option and its description"; \
|
||||
1>&2; exit 1; } || :
|
||||
|
||||
# Look for diagnostics that aren't marked for translation.
|
||||
@@ -401,18 +405,99 @@ sc_useless_cpp_parens:
|
||||
|
||||
# Require the latest GPL.
|
||||
sc_GPL_version:
|
||||
@grep -n 'either ''version [^3]' $$($(VC_LIST_EXCEPT)) && \
|
||||
{ echo '$(ME): GPL vN, N!=3' 1>&2; exit 1; } || :
|
||||
@re='either ''version [^3]' msg='GPL vN, N!=3' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
cvs_keywords = \
|
||||
Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
|
||||
|
||||
sc_prohibit_cvs_keyword:
|
||||
@re='\$$($(cvs_keywords))\$$' \
|
||||
msg='do not use CVS keyword expansion' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Make sure we don't use st_blocks. Use ST_NBLOCKS instead.
|
||||
# This is a bit of a kludge, since it prevents use of the string
|
||||
# even in comments, but for now it does the job with no false positives.
|
||||
sc_prohibit_stat_st_blocks:
|
||||
@re='[.>]st_blocks' msg='do not use st_blocks; use ST_NBLOCKS' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Make sure we don't define any S_IS* macros in src/*.c files.
|
||||
# They're already defined via gnulib's sys/stat.h replacement.
|
||||
sc_prohibit_S_IS_definition:
|
||||
@re='^ *# *define *S_IS' \
|
||||
msg='do not define S_IS* macros; include <sys/stat.h>' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
# Each program that uses proper_name_utf8 must link with
|
||||
# one of the ICONV libraries.
|
||||
sc_proper_name_utf8_requires_ICONV:
|
||||
@progs=$$(grep -l 'proper_name_utf8 ''("' $$($(VC_LIST_EXCEPT)));\
|
||||
if test "x$$progs" != x; then \
|
||||
fail=0; \
|
||||
for p in $$progs; do \
|
||||
dir=$$(dirname "$$p"); \
|
||||
base=$$(basename "$$p" .c); \
|
||||
grep "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \
|
||||
|| { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \
|
||||
done; \
|
||||
test $$fail = 1 && \
|
||||
{ echo 1>&2 '$(ME): the above do not link with any ICONV library'; \
|
||||
exit 1; } || :; \
|
||||
fi
|
||||
|
||||
# Warn about "c0nst struct Foo const foo[]",
|
||||
# but not about "char const *const foo" or "#define const const".
|
||||
sc_redundant_const:
|
||||
@re='\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \
|
||||
msg='redundant "const" in declarations' \
|
||||
$(_prohibit_regexp)
|
||||
|
||||
sc_const_long_option:
|
||||
@grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT)) \
|
||||
| grep -Ev 'const struct option|struct option const' && { \
|
||||
echo 1>&2 '$(ME): add "const" to the above declarations'; \
|
||||
exit 1; } || :
|
||||
|
||||
NEWS_hash = \
|
||||
$$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
|
||||
$(srcdir)/NEWS \
|
||||
| grep -v '^Copyright .*Free Software' \
|
||||
| md5sum - \
|
||||
| sed 's/ .*//')
|
||||
|
||||
# Ensure that we don't accidentally insert an entry into an old NEWS block.
|
||||
sc_immutable_NEWS:
|
||||
@if test -f $(srcdir)/NEWS; then \
|
||||
test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \
|
||||
{ echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \
|
||||
fi
|
||||
|
||||
# Update the hash stored above. Do this after each release and
|
||||
# for any corrections to old entries.
|
||||
update-NEWS-hash: NEWS
|
||||
perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \
|
||||
$(srcdir)/cfg.mk
|
||||
|
||||
epoch_date = 1970-01-01 00:00:00.000000000 +0000
|
||||
# Ensure that the c99-to-c89 patch applies cleanly.
|
||||
patch-check:
|
||||
rm -rf src-c89 $@.1 $@.2
|
||||
cp -a src src-c89
|
||||
(cd src-c89; patch -p1 -V never --fuzz=0) < src/c99-to-c89.diff \
|
||||
cp -a $(srcdir)/src src-c89
|
||||
if test "x$(srcdir)" != x.; then \
|
||||
cp -a src/* src-c89; \
|
||||
dotfiles=`ls src/.[!.]* 2>/dev/null`; \
|
||||
test -z "$$dotfiles" || cp -a src/.[!.]* src-c89; \
|
||||
fi
|
||||
(cd src-c89; patch -p1 -V never --fuzz=0) < $(srcdir)/src/c99-to-c89.diff \
|
||||
> $@.1 2>&1
|
||||
if test "$$REGEN_PATCH" = yes; then \
|
||||
diff -upr src src-c89 | sed 's,src-c89/,src/,' \
|
||||
| grep -v '^Only in' > new-diff || : ; fi
|
||||
if test "$(REGEN_PATCH)" = yes; then \
|
||||
diff -upr $(srcdir)/src src-c89 | sed 's,$(srcdir)/src-c89/,src/,' \
|
||||
| grep -vE '^(Only in|File )' \
|
||||
| perl -pe 's/^((?:\+\+\+|---) \S+\t).*/$${1}$(epoch_date)/;' \
|
||||
-e 's/^ $$//' \
|
||||
> new-diff || : ; fi
|
||||
grep -v '^patching file ' $@.1 > $@.2 || :
|
||||
msg=ok; test -s $@.2 && msg='fuzzy patch' || : ; \
|
||||
rm -f src-c89/*.o || msg='rm failed'; \
|
||||
@@ -421,29 +506,18 @@ patch-check:
|
||||
test "$$msg" = ok && rm -rf src-c89 $@.1 $@.2 || echo "$$msg" 1>&2; \
|
||||
test "$$msg" = ok
|
||||
|
||||
# Ensure that date's --help output stays in sync with the info
|
||||
# documentation for GNU strftime. The only exception is %N,
|
||||
# which date accepts but GNU strftime does not.
|
||||
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
|
||||
strftime-check:
|
||||
if test -f $(srcdir)/src/date.c; then \
|
||||
grep '^ %. ' $(srcdir)/src/date.c | sort \
|
||||
| $(extract_char) > $@-src; \
|
||||
{ echo N; \
|
||||
info libc date calendar format | grep '^ `%.'\' \
|
||||
| $(extract_char); } | sort > $@-info; \
|
||||
diff -u $@-src $@-info || exit 1; \
|
||||
rm -f $@-src $@-info; \
|
||||
fi
|
||||
|
||||
check-AUTHORS:
|
||||
$(MAKE) -C src $@
|
||||
|
||||
# Ensure that we use only the standard $(VAR) notation,
|
||||
# not @...@ in Makefile.am, now that we can rely on automake
|
||||
# to emit a definition for each substituted variable.
|
||||
# We use perl rather than "grep -nE ..." to exempt a single
|
||||
# use of an @...@-delimited variable name in src/Makefile.am.
|
||||
makefile-check:
|
||||
grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
|
||||
@perl -ne '/\@[A-Z_0-9]+\@/ && !/^cu_install_program =/' \
|
||||
-e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}' \
|
||||
$$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$') \
|
||||
&& { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
|
||||
|
||||
news-date-check: NEWS
|
||||
@@ -465,22 +539,33 @@ changelog-check:
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
m4-check:
|
||||
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
|
||||
&& { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \
|
||||
sc_makefile_TAB_only_indentation:
|
||||
@grep -nE '^ [ ]{8}' \
|
||||
$$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
|
||||
&& { echo '$(ME): found TAB-8-space indentation' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
sc_m4_quote_check:
|
||||
@grep -nE '(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]' \
|
||||
$$($(VC_LIST_EXCEPT) | grep -E '(^configure\.ac|\.m4)$$') \
|
||||
&& { echo '$(ME): quote the first arg to AC_DEF*' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
fix_po_file_diag = \
|
||||
'you have changed the set of files with translatable diagnostics;\n\
|
||||
apply the above patch\n'
|
||||
|
||||
# Verify that all source files using _() are listed in po/POTFILES.in.
|
||||
# FIXME: don't hard-code file names below; use a more general mechanism.
|
||||
po-check:
|
||||
if test -f po/POTFILES.in; then \
|
||||
grep -E -v '^(#|$$)' po/POTFILES.in \
|
||||
po_file = po/POTFILES.in
|
||||
sc_po_check:
|
||||
@if test -f $(po_file); then \
|
||||
grep -E -v '^(#|$$)' $(po_file) \
|
||||
| grep -v '^src/false\.c$$' | sort > $@-1; \
|
||||
files=; \
|
||||
for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \
|
||||
case $$file in \
|
||||
djgpp/* | man/*) continue;; \
|
||||
*/c99-to-c89.diff) continue;; \
|
||||
*.?|*.??) ;; \
|
||||
*) continue;; \
|
||||
esac; \
|
||||
case $$file in \
|
||||
*.[ch]) \
|
||||
@@ -491,34 +576,25 @@ po-check:
|
||||
done; \
|
||||
grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \
|
||||
| sort -u > $@-2; \
|
||||
diff -u $@-1 $@-2 || exit 1; \
|
||||
diff -u -L $(po_file) -L $(po_file) $@-1 $@-2 \
|
||||
|| { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; }; \
|
||||
rm -f $@-1 $@-2; \
|
||||
fi
|
||||
|
||||
# In a definition of #define AUTHORS "... and ..." where the RHS contains
|
||||
# the English word `and', the string must be marked with `N_ (...)' so that
|
||||
# gettext recognizes it as a string requiring translation.
|
||||
author_mark_check:
|
||||
@grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
|
||||
{ echo '$(ME): enclose the above strings in N_ (...)' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Sometimes it is useful to change the PATH environment variable
|
||||
# in Makefiles. When doing so, it's better not to use the Unix-centric
|
||||
# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
|
||||
# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
|
||||
# and there probably aren't many projects with so many Makefile.am files
|
||||
# that we'd have to worry about limits on command line length.
|
||||
msg = '$(ME): Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
|
||||
makefile_path_separator_check:
|
||||
@grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
|
||||
# path separator of `:', but rather the automake-provided `$(PATH_SEPARATOR)'.
|
||||
msg = '$(ME): Do not use `:'\'' above; use $$(PATH_SEPARATOR) instead'
|
||||
sc_makefile_path_separator_check:
|
||||
@grep -nE 'PATH[=].*:' \
|
||||
$$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
|
||||
&& { echo $(msg) 1>&2; exit 1; } || :
|
||||
|
||||
# Check that `make alpha' will not fail at the end of the process.
|
||||
writable-files:
|
||||
if test -d $(release_archive_dir); then :; else \
|
||||
for file in $(distdir).tar.gz \
|
||||
$(release_archive_dir)/$(distdir).tar.gz; do \
|
||||
$(release_archive_dir)/$(distdir).tar.gz; do \
|
||||
test -e $$file || continue; \
|
||||
test -w $$file \
|
||||
|| { echo ERROR: $$file is not writable; fail=1; }; \
|
||||
@@ -531,24 +607,24 @@ sample-test = tests/sample-test
|
||||
texi = doc/$(PACKAGE).texi
|
||||
# Make sure that the copyright date in $(v_etc_file) is up to date.
|
||||
# Do the same for the $(sample-test) and the main doc/.texi file.
|
||||
copyright-check:
|
||||
@if test -f $(v_etc_file); then \
|
||||
sc_copyright_check:
|
||||
@if test -f $(v_etc_file); then \
|
||||
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
|
||||
>/dev/null \
|
||||
>/dev/null \
|
||||
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
|
||||
exit 1; }; \
|
||||
exit 1; }; \
|
||||
fi
|
||||
@if test -f $(sample-test); then \
|
||||
grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \
|
||||
>/dev/null \
|
||||
@if test -f $(sample-test); then \
|
||||
grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \
|
||||
>/dev/null \
|
||||
|| { echo 'out of date copyright in $(sample-test); update it' 1>&2; \
|
||||
exit 1; }; \
|
||||
exit 1; }; \
|
||||
fi
|
||||
@if test -f $(texi); then \
|
||||
grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \
|
||||
>/dev/null \
|
||||
|| { echo 'out of date copyright in $(texi); update it' 1>&2; \
|
||||
exit 1; }; \
|
||||
@if test -f $(texi); then \
|
||||
grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \
|
||||
>/dev/null \
|
||||
|| { echo 'out of date copyright in $(texi); update it' 1>&2; \
|
||||
exit 1; }; \
|
||||
fi
|
||||
|
||||
vc-diff-check:
|
||||
@@ -565,13 +641,14 @@ cvs-check: vc-diff-check
|
||||
|
||||
maintainer-distcheck:
|
||||
$(MAKE) distcheck
|
||||
$(MAKE) taint-distcheck
|
||||
$(MAKE) my-distcheck
|
||||
|
||||
|
||||
# Don't make a distribution if checks fail.
|
||||
# Also, make sure the NEWS file is up-to-date.
|
||||
vc-dist: $(local-check) cvs-check maintainer-distcheck
|
||||
$(MAKE) dist
|
||||
XZ_OPT=-9ev $(MAKE) dist
|
||||
|
||||
# Use this to make sure we don't run these programs when building
|
||||
# from a virgin tgz file, below.
|
||||
@@ -589,35 +666,77 @@ bin=bin-$$$$
|
||||
|
||||
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
|
||||
|
||||
# Use -Wformat -Werror to detect format-string/arg-list mismatches.
|
||||
# Also, check for shadowing problems with -Wshadow, and for pointer
|
||||
# arithmetic problems with -Wpointer-arith.
|
||||
# These CFLAGS are pretty strict. If you build this target, you probably
|
||||
# have to have a recent version of gcc and glibc headers.
|
||||
# The for-loop below ensures that there is a bin/ directory full of all
|
||||
# of the programs under test (except the few that are required for basic
|
||||
# Makefile rules), all symlinked to the just-built "false" program.
|
||||
# This is to ensure that if ever a test neglects to make PATH include
|
||||
# the build srcdir, these always-failing programs will run.
|
||||
# Otherwise, it is too easy to test the wrong programs.
|
||||
# Note that "false" itself is a symlink to true, so it too will malfunction.
|
||||
TMPDIR ?= /tmp
|
||||
t=$(TMPDIR)/$(PACKAGE)/test
|
||||
my-distcheck: $(local-check) check
|
||||
-rm -rf $(t)
|
||||
mkdir -p $(t)
|
||||
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
||||
cd $(t)/$(distdir) \
|
||||
&& ./configure --disable-nls --prefix=$(t)/i \
|
||||
&& $(MAKE) CFLAGS='$(warn_cflags)' \
|
||||
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(MAKE) install \
|
||||
&& test -f $(mandir)/man1/ls.1 \
|
||||
&& mkdir $(bin) \
|
||||
&& ($(write_loser)) > $(bin)/loser \
|
||||
&& chmod a+x $(bin)/loser \
|
||||
&& for i in $(built_programs); do \
|
||||
pfx=$(t)/i
|
||||
|
||||
# More than once, tainted build and source directory names would
|
||||
# have caused at least one "make check" test to apply "chmod 700"
|
||||
# to all directories under $HOME. Make sure it doesn't happen again.
|
||||
tp := $(shell echo "$(TMPDIR)/$(PACKAGE)-$$$$")
|
||||
t_prefix = $(tp)/a
|
||||
t_taint = '$(t_prefix) b'
|
||||
fake_home = $(tp)/home
|
||||
|
||||
# Ensure that tests run from tainted build and src dir names work,
|
||||
# and don't affect anything in $HOME. Create witness files in $HOME,
|
||||
# record their attributes, and build/test. Then ensure that the
|
||||
# witnesses were not affected.
|
||||
taint-distcheck: $(DIST_ARCHIVES)
|
||||
test -d $(t_taint) && chmod -R 700 $(t_taint) || :
|
||||
-rm -rf $(t_taint) $(fake_home)
|
||||
mkdir -p $(t_prefix) $(t_taint) $(fake_home)
|
||||
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t_taint) -zxf $(distdir).tar.gz
|
||||
mkfifo $(fake_home)/fifo
|
||||
touch $(fake_home)/f
|
||||
mkdir -p $(fake_home)/d/e
|
||||
ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
|
||||
cd $(t_taint)/$(distdir) \
|
||||
&& ./configure \
|
||||
&& $(MAKE) \
|
||||
&& HOME=$(fake_home) $(MAKE) check \
|
||||
&& ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
|
||||
&& diff $(tp)/.ls-before $(tp)/.ls-after \
|
||||
&& test -d $(t_prefix)
|
||||
rm -rf $(tp)
|
||||
|
||||
# Verify that a twisted use of --program-transform-name=PROGRAM works.
|
||||
define install-transform-check
|
||||
echo running install-transform-check \
|
||||
&& rm -rf $(pfx) \
|
||||
&& $(MAKE) program_transform_name='s/.*/zyx/' \
|
||||
prefix=$(pfx) install \
|
||||
&& test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \
|
||||
&& test "$$(find $(pfx)/share/man -type f|sed 's,.*/,,;s,\..*,,')" = "zyx"
|
||||
endef
|
||||
|
||||
# Install, then verify that all binaries and man pages are in place.
|
||||
# Note that neither the binary, ginstall, nor the ].1 man page is installed.
|
||||
define my-instcheck
|
||||
$(MAKE) prefix=$(pfx) install \
|
||||
&& test ! -f $(pfx)/bin/ginstall \
|
||||
&& { fail=0; \
|
||||
for i in $(built_programs); do \
|
||||
test "$$i" = ginstall && i=install; \
|
||||
for j in "$(pfx)/bin/$$i" \
|
||||
"$(pfx)/share/man/man1/$$i.1"; do \
|
||||
case $$j in *'[.1') continue;; esac; \
|
||||
test -f "$$j" && : \
|
||||
|| { echo "$$j not installed"; fail=1; }; \
|
||||
done; \
|
||||
done; \
|
||||
test $$fail = 1 && exit 1 || :; \
|
||||
}
|
||||
endef
|
||||
|
||||
define coreutils-path-check
|
||||
{ \
|
||||
if test -f $(srcdir)/src/true.c; then \
|
||||
fail=1; \
|
||||
mkdir $(bin) \
|
||||
&& ($(write_loser)) > $(bin)/loser \
|
||||
&& chmod a+x $(bin)/loser \
|
||||
&& for i in $(built_programs); do \
|
||||
case $$i in \
|
||||
rm|expr|basename|echo|sort|ls|tr);; \
|
||||
cat|dirname|mv|wc);; \
|
||||
@@ -625,20 +744,50 @@ my-distcheck: $(local-check) check
|
||||
esac; \
|
||||
done \
|
||||
&& ln -sf ../src/true $(bin)/false \
|
||||
&& PATH=`pwd`/$(bin):$$PATH $(MAKE) -C tests check \
|
||||
&& $(MAKE) -C gnulib-tests check \
|
||||
&& PATH=`pwd`/$(bin)$(PATH_SEPARATOR)$$PATH \
|
||||
$(MAKE) -C tests check \
|
||||
&& { test -d gnulib-tests \
|
||||
&& $(MAKE) -C gnulib-tests check \
|
||||
|| :; } \
|
||||
&& rm -rf $(bin) \
|
||||
&& fail=0; \
|
||||
else \
|
||||
fail=0; \
|
||||
fi; \
|
||||
test $$fail = 1 && exit 1 || :; \
|
||||
}
|
||||
endef
|
||||
|
||||
# Use -Wformat -Werror to detect format-string/arg-list mismatches.
|
||||
# Also, check for shadowing problems with -Wshadow, and for pointer
|
||||
# arithmetic problems with -Wpointer-arith.
|
||||
# These CFLAGS are pretty strict. If you build this target, you probably
|
||||
# have to have a recent version of gcc and glibc headers.
|
||||
# The hard-linking for-loop below ensures that there is a bin/ directory
|
||||
# full of all of the programs under test (except the ones that are required
|
||||
# for basic Makefile rules), all symlinked to the just-built "false" program.
|
||||
# This is to ensure that if ever a test neglects to make PATH include
|
||||
# the build srcdir, these always-failing programs will run.
|
||||
# Otherwise, it is too easy to test the wrong programs.
|
||||
# Note that "false" itself is a symlink to true, so it too will malfunction.
|
||||
my-distcheck: $(DIST_ARCHIVES) $(local-check)
|
||||
$(MAKE) syntax-check
|
||||
$(MAKE) check
|
||||
-rm -rf $(t)
|
||||
mkdir -p $(t)
|
||||
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
|
||||
cd $(t)/$(distdir) \
|
||||
&& ./configure --disable-nls \
|
||||
&& $(MAKE) CFLAGS='$(warn_cflags)' \
|
||||
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(install-transform-check) \
|
||||
&& $(my-instcheck) \
|
||||
&& $(coreutils-path-check) \
|
||||
&& $(MAKE) distclean
|
||||
(cd $(t) && mv $(distdir) $(distdir).old \
|
||||
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
|
||||
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
||||
if test -f $(srcdir)/src/c99-to-c89.diff; then \
|
||||
cd $(t)/$(distdir) \
|
||||
&& (cd src && patch -V never --fuzz=0 <c99-to-c89.diff) \
|
||||
&& ./configure --disable-largefile \
|
||||
CFLAGS='-Werror -ansi -Wno-long-long' \
|
||||
&& $(MAKE); \
|
||||
fi
|
||||
-rm -rf $(t)
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
@@ -670,6 +819,7 @@ announcement: NEWS ChangeLog $(rel-files)
|
||||
--news=NEWS \
|
||||
--bootstrap-tools=autoconf,automake,bison,gnulib \
|
||||
--gnulib-version=$(gnulib-version) \
|
||||
--no-print-checksums \
|
||||
$(addprefix --url-dir=, $(url_dir_list))
|
||||
|
||||
## ---------------- ##
|
||||
@@ -692,6 +842,14 @@ emit_upload_commands:
|
||||
@echo =====================================
|
||||
@echo =====================================
|
||||
|
||||
noteworthy = * Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
define emit-commit-log
|
||||
printf '%s\n' 'post-release administrivia' '' \
|
||||
'* NEWS: Add header line for next release.' \
|
||||
'* .prev-version: Record previous version.' \
|
||||
'* cfg.mk (old_NEWS_hash): Auto-update.'
|
||||
endef
|
||||
|
||||
.PHONY: alpha beta major
|
||||
alpha beta major: $(local-check) writable-files
|
||||
test $@ = major \
|
||||
@@ -707,6 +865,17 @@ alpha beta major: $(local-check) writable-files
|
||||
fi
|
||||
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
|
||||
echo $(VERSION) > $(prev_version_file)
|
||||
$(VC) commit -m \
|
||||
'$(prev_version_file): Record previous version: $(VERSION).' \
|
||||
$(prev_version_file)
|
||||
$(MAKE) update-NEWS-hash
|
||||
perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS
|
||||
$(emit-commit-log) > .ci-msg
|
||||
$(VC) commit -F .ci-msg -a
|
||||
|
||||
.PHONY: web-manual
|
||||
web-manual:
|
||||
@test -z "$(manual_title)" \
|
||||
&& { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
|
||||
@cd '$(srcdir)/doc'; \
|
||||
$(SHELL) ../build-aux/gendocs.sh -o '$(abs_builddir)/doc/manual' \
|
||||
--email $(PACKAGE_BUGREPORT) $(PACKAGE) \
|
||||
"$(PACKAGE_NAME) - $(manual_title)"
|
||||
@echo " *** Upload the doc/manual directory to web-cvs."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Make coreutils man pages. -*-Makefile-*-
|
||||
|
||||
# Copyright (C) 2002-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2009 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -113,9 +113,11 @@ tac.1: $(common_dep) $(srcdir)/tac.x ../src/tac.c
|
||||
tail.1: $(common_dep) $(srcdir)/tail.x ../src/tail.c
|
||||
tee.1: $(common_dep) $(srcdir)/tee.x ../src/tee.c
|
||||
test.1: $(common_dep) $(srcdir)/test.x ../src/test.c
|
||||
timeout.1: $(common_dep) $(srcdir)/timeout.x ../src/timeout.c
|
||||
touch.1: $(common_dep) $(srcdir)/touch.x ../src/touch.c
|
||||
tr.1: $(common_dep) $(srcdir)/tr.x ../src/tr.c
|
||||
true.1: $(common_dep) $(srcdir)/true.x ../src/true.c
|
||||
truncate.1: $(common_dep) $(srcdir)/truncate.x ../src/truncate.c
|
||||
tsort.1: $(common_dep) $(srcdir)/tsort.x ../src/tsort.c
|
||||
tty.1: $(common_dep) $(srcdir)/tty.x ../src/tty.c
|
||||
uname.1: $(common_dep) $(srcdir)/uname.x ../src/uname.c
|
||||
@@ -130,6 +132,10 @@ who.1: $(common_dep) $(srcdir)/who.x ../src/who.c
|
||||
whoami.1: $(common_dep) $(srcdir)/whoami.x ../src/whoami.c
|
||||
yes.1: $(common_dep) $(srcdir)/yes.x ../src/yes.c
|
||||
|
||||
# This is required so that changes to e.g., emit_bug_reporting_address
|
||||
# provoke regeneration of all $(MAN) files.
|
||||
$(MAN): $(top_srcdir)/src/system.h
|
||||
|
||||
SUFFIXES = .x .1
|
||||
|
||||
# Ensure that help2man runs the ../src/ginstall binary as
|
||||
@@ -150,16 +156,15 @@ mapped_name = `echo $*|sed 's/^install$$/ginstall/; s/^test$$/[/'`
|
||||
*) \
|
||||
rm -f $@ \
|
||||
&& { echo "Updating man page $@"; \
|
||||
rm -rf $t; \
|
||||
mkdir $t; \
|
||||
(cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
|
||||
$(PERL) -- $(srcdir)/help2man \
|
||||
--source='$(PACKAGE_STRING)' \
|
||||
--include=$(srcdir)/$*.x \
|
||||
--output=$t/$@ $t/$*; \
|
||||
rm -rf $t; \
|
||||
mkdir $t; \
|
||||
(cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
|
||||
$(PERL) -- $(srcdir)/help2man \
|
||||
--source='$(PACKAGE_STRING)' \
|
||||
--include=$(srcdir)/$*.x \
|
||||
--output=$t/$@ $t/$*; \
|
||||
} \
|
||||
&& sed 's|$*\.td/||g' $t/$@ > $@ \
|
||||
&& chmod a-w $@ \
|
||||
&& rm -rf $t ;; \
|
||||
esac
|
||||
|
||||
|
||||
2
man/du.x
2
man/du.x
@@ -19,7 +19,7 @@ will match any files whose names end in
|
||||
.BR .o .
|
||||
Therefore, the command
|
||||
.IP
|
||||
.B du --exclude='*.o'
|
||||
.B du --exclude=\(aq*.o\(aq
|
||||
.PP
|
||||
will skip all files and subdirectories ending in
|
||||
.BR .o
|
||||
|
||||
13
man/help2man
13
man/help2man
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# Generate a short man page from --help and --version output.
|
||||
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008
|
||||
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -34,7 +34,7 @@ my $have_gettext;
|
||||
BEGIN {
|
||||
eval {
|
||||
require Locale::gettext;
|
||||
Locale::gettext->import;
|
||||
Locale::gettext->import (qw(gettext textdomain));
|
||||
$have_gettext = 1;
|
||||
};
|
||||
|
||||
@@ -134,7 +134,7 @@ die $help_info unless @ARGV == 1;
|
||||
die "$this_program: no locale support (Locale::gettext required)\n"
|
||||
unless $locale eq 'C' or $have_gettext;
|
||||
|
||||
# Set localisation of date and executable's ouput.
|
||||
# Set localization of date and executable's output.
|
||||
delete @ENV{qw(LANGUAGE LC_MESSAGES LANG)};
|
||||
setlocale LC_ALL, $ENV{LC_ALL} = $locale;
|
||||
|
||||
@@ -368,7 +368,7 @@ s/^\./\x80/mg;
|
||||
s/^'/\x81/mg;
|
||||
s/\\/\x82/g;
|
||||
|
||||
my $PAT_BUGS = _('Report +bugs|Email +bug +reports +to');
|
||||
my $PAT_BUGS = _('Report +(?:\w+ +)?bugs|Email +bug +reports +to');
|
||||
my $PAT_AUTHOR = _('Written +by');
|
||||
my $PAT_OPTIONS = _('Options');
|
||||
my $PAT_EXAMPLES = _('Examples');
|
||||
@@ -567,7 +567,7 @@ and
|
||||
.B %s
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info coreutils '%s invocation'
|
||||
.B info coreutils \(aq%s invocation\(aq
|
||||
.PP
|
||||
should give you access to the complete manual.
|
||||
EOT
|
||||
@@ -607,6 +607,9 @@ for my $sect (@pre, (grep ! /^($filter)$/o, @include), @post)
|
||||
# Convert some latin1 chars to troff equivalents
|
||||
s/\xa0/\\ /g; # non-breaking space
|
||||
|
||||
$sect eq 'REPORTING BUGS'
|
||||
and s/\n(.)/\n.br\n$1/g;
|
||||
|
||||
print;
|
||||
}
|
||||
}
|
||||
|
||||
2
man/id.x
2
man/id.x
@@ -1,4 +1,4 @@
|
||||
[NAME]
|
||||
id \- print user identity
|
||||
id \- print real and effective user and group IDs
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
|
||||
6
man/timeout.x
Normal file
6
man/timeout.x
Normal file
@@ -0,0 +1,6 @@
|
||||
[NAME]
|
||||
timeout \- run a command with a time limit
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
[SEE ALSO]
|
||||
kill(1)
|
||||
6
man/truncate.x
Normal file
6
man/truncate.x
Normal file
@@ -0,0 +1,6 @@
|
||||
[NAME]
|
||||
truncate \- shrink or extend the size of a file to the specified size
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
[SEE ALSO]
|
||||
dd(1), truncate(2), ftruncate(2)
|
||||
@@ -753,7 +753,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the ``GNU Free
|
||||
|
||||
@@ -277,7 +277,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the ``GNU Free
|
||||
|
||||
@@ -465,7 +465,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2006 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the ``GNU Free
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# List of files which contain translatable strings.
|
||||
# Copyright (C) 1996-2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2009 Free Software Foundation, Inc.
|
||||
|
||||
# These are nominally temporary...
|
||||
lib/acl.c
|
||||
lib/argmatch.c
|
||||
lib/closein.c
|
||||
lib/closeout.c
|
||||
lib/copy-acl.c
|
||||
lib/error.c
|
||||
lib/euidaccess-stat.c
|
||||
lib/file-type.c
|
||||
@@ -19,10 +19,13 @@ lib/randread.c
|
||||
lib/regcomp.c
|
||||
lib/root-dev-ino.h
|
||||
lib/rpmatch.c
|
||||
lib/set-mode-acl.c
|
||||
lib/unicodeio.c
|
||||
lib/userspec.c
|
||||
lib/verror.c
|
||||
lib/version-etc.c
|
||||
lib/xalloc-die.c
|
||||
lib/xfreopen.c
|
||||
lib/xfts.c
|
||||
lib/xmemcoll.c
|
||||
lib/xmemxfrm.c
|
||||
@@ -60,6 +63,7 @@ src/factor.c
|
||||
src/false.c
|
||||
src/fmt.c
|
||||
src/fold.c
|
||||
src/getlimits.c
|
||||
src/group-list.c
|
||||
src/groups.c
|
||||
src/head.c
|
||||
@@ -83,6 +87,7 @@ src/nice.c
|
||||
src/nl.c
|
||||
src/nohup.c
|
||||
src/od.c
|
||||
src/operand2sig.c
|
||||
src/paste.c
|
||||
src/pathchk.c
|
||||
src/pinky.c
|
||||
@@ -114,9 +119,11 @@ src/tac.c
|
||||
src/tail.c
|
||||
src/tee.c
|
||||
src/test.c
|
||||
src/timeout.c
|
||||
src/touch.c
|
||||
src/tr.c
|
||||
src/true.c
|
||||
src/truncate.c
|
||||
src/tsort.c
|
||||
src/tty.c
|
||||
src/uname.c
|
||||
|
||||
4
src/.gitignore
vendored
4
src/.gitignore
vendored
@@ -31,6 +31,7 @@ false
|
||||
fmt
|
||||
fold
|
||||
fs.h
|
||||
getlimits
|
||||
ginstall
|
||||
groups
|
||||
head
|
||||
@@ -39,6 +40,7 @@ hostname
|
||||
id
|
||||
join
|
||||
kill
|
||||
libver.a
|
||||
link
|
||||
ln
|
||||
localedir.h
|
||||
@@ -87,9 +89,11 @@ tac
|
||||
tail
|
||||
tee
|
||||
test
|
||||
timeout
|
||||
touch
|
||||
tr
|
||||
true
|
||||
truncate
|
||||
tsort
|
||||
tty
|
||||
uname
|
||||
|
||||
127
src/Makefile.am
127
src/Makefile.am
@@ -1,6 +1,6 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
|
||||
## Copyright (C) 1990, 1991, 1993-2008 Free Software Foundation, Inc.
|
||||
## Copyright (C) 1990, 1991, 1993-2009 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
@@ -26,6 +26,8 @@ no_install__progs = \
|
||||
build_if_possible__progs = \
|
||||
chroot df hostid nice pinky stty su uname uptime users who
|
||||
|
||||
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
|
||||
|
||||
EXTRA_PROGRAMS = \
|
||||
$(no_install__progs) \
|
||||
$(build_if_possible__progs) \
|
||||
@@ -39,12 +41,12 @@ EXTRA_PROGRAMS = \
|
||||
basename date dirname echo env expr factor false \
|
||||
id kill logname pathchk printenv printf pwd \
|
||||
runcon seq sleep tee \
|
||||
test true tty whoami yes \
|
||||
test timeout true truncate tty whoami yes \
|
||||
base64
|
||||
|
||||
bin_PROGRAMS = $(OPTIONAL_BIN_PROGS)
|
||||
|
||||
noinst_PROGRAMS = setuidgid
|
||||
noinst_PROGRAMS = setuidgid getlimits
|
||||
|
||||
noinst_HEADERS = \
|
||||
chown-core.h \
|
||||
@@ -54,6 +56,7 @@ noinst_HEADERS = \
|
||||
fs.h \
|
||||
group-list.h \
|
||||
ls.h \
|
||||
operand2sig.h \
|
||||
prog-fprintf.h \
|
||||
remove.h \
|
||||
system.h \
|
||||
@@ -68,12 +71,24 @@ CLEANFILES = $(SCRIPTS) su
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/lib
|
||||
|
||||
noinst_LIBRARIES = libver.a
|
||||
nodist_libver_a_SOURCES = version.c version.h
|
||||
|
||||
# Sometimes, the expansion of $(LIBINTL) includes -lc which may
|
||||
# include modules defining variables like `optind', so libcoreutils.a
|
||||
# must precede $(LIBINTL) in order to ensure we use GNU getopt.
|
||||
# But libcoreutils.a must also follow $(LIBINTL), since libintl uses
|
||||
# replacement functions defined in libcoreutils.a.
|
||||
LDADD = ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a
|
||||
LDADD = libver.a ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a
|
||||
|
||||
cat_LDADD = $(LDADD)
|
||||
df_LDADD = $(LDADD)
|
||||
du_LDADD = $(LDADD)
|
||||
getlimits_LDADD = $(LDADD)
|
||||
ptx_LDADD = $(LDADD)
|
||||
split_LDADD = $(LDADD)
|
||||
timeout_LDADD = $(LDADD)
|
||||
truncate_LDADD = $(LDADD)
|
||||
|
||||
# for eaccess in lib/euidaccess.c.
|
||||
chcon_LDADD = $(LDADD) $(LIB_SELINUX)
|
||||
@@ -92,15 +107,15 @@ __LDADD = $(LDADD) $(LIB_EACCESS)
|
||||
|
||||
# for clock_gettime and fdatasync
|
||||
dd_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
|
||||
dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
|
||||
dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
|
||||
id_LDADD = $(LDADD) $(LIB_SELINUX)
|
||||
ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
|
||||
ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
|
||||
mktemp_LDADD = $(LDADD) $(LIB_GETHRXTIME)
|
||||
pr_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
|
||||
shred_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
|
||||
shuf_LDADD = $(LDADD) $(LIB_GETHRXTIME)
|
||||
tac_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
|
||||
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
|
||||
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
|
||||
|
||||
## If necessary, add -lm to resolve use of pow in lib/strtod.c.
|
||||
sort_LDADD = $(LDADD) $(POW_LIB) $(LIB_GETHRXTIME)
|
||||
@@ -120,6 +135,12 @@ seq_LDADD = $(LDADD) $(POW_LIB)
|
||||
# and the `nanosleep' reference in lib/xnanosleep.c.
|
||||
nanosec_libs = $(LDADD) $(POW_LIB) $(LIB_NANOSLEEP)
|
||||
|
||||
# for various GMP functions
|
||||
expr_LDADD = $(LDADD) $(LIB_GMP)
|
||||
|
||||
# for various GMP functions
|
||||
factor_LDADD = $(LDADD) $(LIB_GMP)
|
||||
|
||||
sleep_LDADD = $(nanosec_libs)
|
||||
tail_LDADD = $(nanosec_libs)
|
||||
|
||||
@@ -131,12 +152,27 @@ su_LDADD = $(LDADD) $(LIB_CRYPT)
|
||||
dir_LDADD += $(LIB_ACL)
|
||||
ls_LDADD += $(LIB_ACL)
|
||||
vdir_LDADD += $(LIB_ACL)
|
||||
cp_LDADD += $(LIB_ACL)
|
||||
mv_LDADD += $(LIB_ACL)
|
||||
ginstall_LDADD += $(LIB_ACL)
|
||||
cp_LDADD += $(LIB_ACL) $(LIB_XATTR)
|
||||
mv_LDADD += $(LIB_ACL) $(LIB_XATTR)
|
||||
ginstall_LDADD += $(LIB_ACL) $(LIB_XATTR)
|
||||
|
||||
stat_LDADD = $(LDADD) $(LIB_SELINUX)
|
||||
|
||||
# Append $(LIBICONV) to each program that uses proper_name_utf8.
|
||||
cat_LDADD += $(LIBICONV)
|
||||
cp_LDADD += $(LIBICONV)
|
||||
df_LDADD += $(LIBICONV)
|
||||
du_LDADD += $(LIBICONV)
|
||||
getlimits_LDADD += $(LIBICONV)
|
||||
ptx_LDADD += $(LIBICONV)
|
||||
split_LDADD += $(LIBICONV)
|
||||
timeout_LDADD += $(LIBICONV)
|
||||
truncate_LDADD += $(LIBICONV)
|
||||
|
||||
# programs that use getaddrinfo (e.g., via canon_host)
|
||||
pinky_LDADD = $(LDADD) $(GETADDRINFO_LIB)
|
||||
who_LDADD = $(LDADD) $(GETADDRINFO_LIB)
|
||||
|
||||
$(PROGRAMS): ../lib/libcoreutils.a
|
||||
|
||||
# Get the release year from ../lib/version-etc.c.
|
||||
@@ -204,7 +240,7 @@ copy_sources = copy.c cp-hash.c
|
||||
# confusion with the `install' target. The install rule transforms `ginstall'
|
||||
# to install before applying any user-specified name transformations.
|
||||
|
||||
transform = s/ginstall/install/; @program_transform_name@
|
||||
transform = s/ginstall/install/; $(program_transform_name)
|
||||
ginstall_SOURCES = install.c prog-fprintf.c $(copy_sources)
|
||||
|
||||
# This is for the '[' program. Automake transliterates '[' to '_'.
|
||||
@@ -219,6 +255,8 @@ ln_SOURCES = ln.c
|
||||
ls_SOURCES = ls.c ls-ls.c
|
||||
chown_SOURCES = chown.c chown-core.c
|
||||
chgrp_SOURCES = chgrp.c chown-core.c
|
||||
kill_SOURCES = kill.c operand2sig.c
|
||||
timeout_SOURCES = timeout.c operand2sig.c
|
||||
|
||||
mv_SOURCES = mv.c remove.c $(copy_sources)
|
||||
rm_SOURCES = rm.c remove.c
|
||||
@@ -242,6 +280,8 @@ sha384sum_CPPFLAGS = -DHASH_ALGO_SHA384=1 $(AM_CPPFLAGS)
|
||||
sha512sum_SOURCES = md5sum.c
|
||||
sha512sum_CPPFLAGS = -DHASH_ALGO_SHA512=1 $(AM_CPPFLAGS)
|
||||
|
||||
ginstall_CPPFLAGS = -DENABLE_MATCHPATHCON=1 $(AM_CPPFLAGS)
|
||||
|
||||
editpl = sed -e 's,@''PERL''@,$(PERL),g'
|
||||
|
||||
BUILT_SOURCES += dircolors.h
|
||||
@@ -279,6 +319,22 @@ fs.h: stat.c extract-magic
|
||||
@chmod a-w $@t
|
||||
mv $@t $@
|
||||
|
||||
BUILT_SOURCES += version.c
|
||||
version.c: Makefile
|
||||
rm -f $@
|
||||
printf '#include <config.h>\n' > $@t
|
||||
printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
|
||||
@chmod a-w $@t
|
||||
mv $@t $@
|
||||
|
||||
BUILT_SOURCES += version.h
|
||||
version.h: Makefile
|
||||
rm -f $@
|
||||
printf 'extern char const *Version;\n' > $@t
|
||||
@chmod a-w $@t
|
||||
mv $@t $@
|
||||
|
||||
DISTCLEANFILES = version.c version.h
|
||||
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
# Sort in traditional ASCII order, regardless of the current locale;
|
||||
@@ -303,7 +359,7 @@ pm = progs-makefile
|
||||
pr = progs-readme
|
||||
# Ensure that the list of programs in README matches the list
|
||||
# of programs we can build.
|
||||
check: check-README check-misc check-duplicate-no-install
|
||||
check: check-README check-duplicate-no-install
|
||||
.PHONY: check-README
|
||||
check-README:
|
||||
rm -rf $(pr) $(pm)
|
||||
@@ -326,8 +382,8 @@ au_dotdot = authors-dotdot
|
||||
au_actual = authors-actual
|
||||
.PHONY: check-AUTHORS
|
||||
check-AUTHORS: $(all_programs)
|
||||
rm -f $(au_actual) $(au_dotdot)
|
||||
for i in `ls $(all_programs) | sed -e 's,$(EXEEXT)$$,,' \
|
||||
@rm -f $(au_actual) $(au_dotdot)
|
||||
@for i in `ls $(all_programs) | sed -e 's,$(EXEEXT)$$,,' \
|
||||
| $(ASSORT) -u`; do \
|
||||
test "$$i" = '[' && continue; \
|
||||
exe=$$i; \
|
||||
@@ -336,23 +392,12 @@ check-AUTHORS: $(all_programs)
|
||||
elif test "$$i" = test; then \
|
||||
exe='['; \
|
||||
fi; \
|
||||
./$$exe --version \
|
||||
LC_ALL=en_US.UTF-8 ./$$exe --version \
|
||||
| perl -0 -pi -e 's/,\n/, /gm' \
|
||||
|sed -n '/Written by /{ s//'"$$i"': /; s/,* and /, /; s/\.$$//; p; }'; \
|
||||
done > $(au_actual)
|
||||
sed -n '/:/p' $(top_srcdir)/AUTHORS > $(au_dotdot)
|
||||
diff $(au_actual) $(au_dotdot) && rm -f $(au_actual) $(au_dotdot)
|
||||
|
||||
# Make sure we don't define any S_IS* macros in src/*.c files.
|
||||
# Not a big deal, but they're already defined via system.h.
|
||||
#
|
||||
# Also make sure we don't use st_blocks. Use ST_NBLOCKS instead.
|
||||
# This is a bit of a kludge, since it prevents use of the string
|
||||
# even in comments, but for now it does the job with no false positives.
|
||||
.PHONY: check-misc
|
||||
check-misc:
|
||||
cd $(srcdir); grep '^# *define *S_IS' $(SOURCES) && exit 1 || :
|
||||
cd $(srcdir); grep st_blocks $(SOURCES) && exit 1 || :
|
||||
cd $(srcdir); grep '^# *define .*defined' $(SOURCES) && exit 1 || :
|
||||
@sed -n '/^[^ ][^ ]*:/p' $(top_srcdir)/AUTHORS > $(au_dotdot)
|
||||
@diff $(au_actual) $(au_dotdot) && rm -f $(au_actual) $(au_dotdot)
|
||||
|
||||
# Extract the list of authors from each file.
|
||||
sed_filter = s/^ *//;s/N_ (//;s/^"//;s/")*$$//
|
||||
@@ -360,7 +405,6 @@ sed_filter = s/^ *//;s/N_ (//;s/^"//;s/")*$$//
|
||||
s1 = '/^\#define AUTHORS \([^\\]\)/{;s//\1/;$(sed_filter);p;q;}'
|
||||
# Sometimes the string is on the backslash-continued line after the #define.
|
||||
s2 = '/^\#define AUTHORS \\\\/{;n;$(sed_filter);p;q;}'
|
||||
# FIXME: handle *.sh; and use $(all_programs), not $(SOURCES)
|
||||
../AUTHORS: $(SOURCES)
|
||||
rm -f $@-t
|
||||
( \
|
||||
@@ -393,22 +437,35 @@ s2 = '/^\#define AUTHORS \\\\/{;n;$(sed_filter);p;q;}'
|
||||
sc_tight_scope: $(all_programs)
|
||||
@t=exceptions-$$$$; \
|
||||
trap "s=$$?; rm -f $$t; exit $$s" 0 1 2 13 15; \
|
||||
src=`for f in $(SOURCES); do \
|
||||
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
|
||||
hdr=`for f in $(noinst_HEADERS); do \
|
||||
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
|
||||
( printf 'main\nusage\n'; \
|
||||
grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
|
||||
grep -h -A1 '^extern .*[^;]$$' $$src \
|
||||
| grep -vE '^(extern |--)' | sed 's/ .*//'; \
|
||||
perl -ne '/^extern \S+ (\S*) \(/ and print "$$1\n"' \
|
||||
$(noinst_HEADERS); \
|
||||
perl -ne '/^extern \S+ (\S*) \(/ and print "$$1\n"' $$hdr; \
|
||||
) | $(ASSORT) -u | sed 's/^/^/;s/$$/$$/' > $$t; \
|
||||
nm -e *.$(OBJEXT) \
|
||||
| sed -n 's/.* T //p' \
|
||||
| sed 's/^_//' \
|
||||
| grep -Ev -f $$t && \
|
||||
{ echo 'the above functions should have static scope' 1>&2; \
|
||||
exit 1; } || : ; \
|
||||
( printf '^program_name$$\n'; \
|
||||
sed -n 's/^extern int \([^ ][^ ]*\);$$/^\1$$/p' \
|
||||
$(noinst_HEADERS) ) > $$t; \
|
||||
perl -ne '/^extern .*?\**(\w+);/ and print "^$$1\$$\n"' \
|
||||
$$hdr *.h ) | $(ASSORT) -u > $$t; \
|
||||
nm -e *.$(OBJEXT) \
|
||||
| sed -n 's/.* [BD] //p' \
|
||||
| sed 's/^_//' \
|
||||
| grep -Ev -f $$t && \
|
||||
{ echo 'the above variables should have static scope' 1>&2; \
|
||||
exit 1; } || :
|
||||
|
||||
# Use the just-built ./ginstall, when not cross-compiling.
|
||||
if CROSS_COMPILING
|
||||
cu_install_program = @INSTALL_PROGRAM@
|
||||
else
|
||||
cu_install_program = ./ginstall
|
||||
endif
|
||||
INSTALL_PROGRAM = $(cu_install_program)
|
||||
|
||||
30
src/base64.c
30
src/base64.c
@@ -1,5 +1,5 @@
|
||||
/* Base64 encode/decode strings or files.
|
||||
Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 2004-2008 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Base64.
|
||||
|
||||
@@ -35,24 +35,20 @@
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "base64"
|
||||
|
||||
#define AUTHOR "Simon Josefsson"
|
||||
#define AUTHORS proper_name ("Simon Josefsson")
|
||||
|
||||
/* The invocation name of this program. */
|
||||
char *program_name;
|
||||
|
||||
static const struct option long_options[] = {
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"decode", no_argument, 0, 'd'},
|
||||
{"wrap", required_argument, 0, 'w'},
|
||||
{"ignore-garbage", no_argument, 0, 'i'},
|
||||
{"help", no_argument, 0, GETOPT_HELP_CHAR},
|
||||
{"version", no_argument, 0, GETOPT_VERSION_CHAR},
|
||||
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
static void
|
||||
void
|
||||
usage (int status)
|
||||
{
|
||||
if (status != EXIT_SUCCESS)
|
||||
@@ -61,7 +57,7 @@ usage (int status)
|
||||
else
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s [OPTION] [FILE]\n\
|
||||
Usage: %s [OPTION]... [FILE]\n\
|
||||
Base64 encode or decode FILE, or standard input, to standard output.\n\
|
||||
\n"), program_name);
|
||||
fputs (_("\
|
||||
@@ -218,12 +214,12 @@ do_decode (FILE *in, FILE *out, bool ignore_garbage)
|
||||
However, when it processes the final input buffer, we want
|
||||
to iterate it one additional time, but with an indicator
|
||||
telling it to flush what is in CTX. */
|
||||
for (k = 0; k < 1 + feof (in); k++)
|
||||
for (k = 0; k < 1 + !!feof (in); k++)
|
||||
{
|
||||
if (k == 1 && ctx.i == 0)
|
||||
break;
|
||||
n = BLOCKSIZE;
|
||||
ok = base64_decode (&ctx, inbuf, (k == 0 ? sum : 0), outbuf, &n);
|
||||
ok = base64_decode_ctx (&ctx, inbuf, (k == 0 ? sum : 0), outbuf, &n);
|
||||
|
||||
if (fwrite (outbuf, 1, n, out) < n)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
@@ -242,22 +238,22 @@ main (int argc, char **argv)
|
||||
FILE *input_fh;
|
||||
const char *infile;
|
||||
|
||||
/* True if --decode has bene given and we should decode data. */
|
||||
/* True if --decode has been given and we should decode data. */
|
||||
bool decode = false;
|
||||
/* True if we should ignore non-alphabetic characters. */
|
||||
/* True if we should ignore non-base64-alphabetic characters. */
|
||||
bool ignore_garbage = false;
|
||||
/* Wrap encoded base64 data around the 76:th column, by default. */
|
||||
uintmax_t wrap_column = 76;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
while ((opt = getopt_long (argc, argv, "dqiw:", long_options, NULL)) != -1)
|
||||
while ((opt = getopt_long (argc, argv, "diw:", long_options, NULL)) != -1)
|
||||
switch (opt)
|
||||
{
|
||||
case 'd':
|
||||
@@ -276,7 +272,7 @@ main (int argc, char **argv)
|
||||
|
||||
case_GETOPT_HELP_CHAR;
|
||||
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHOR);
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
|
||||
default:
|
||||
usage (EXIT_FAILURE);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* basename -- strip directory and suffix from file names
|
||||
Copyright (C) 1990-1997, 1999-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990-1997, 1999-2008 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
|
||||
@@ -37,10 +37,7 @@
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "basename"
|
||||
|
||||
#define AUTHORS "FIXME unknown"
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
#define AUTHORS proper_name ("David MacKenzie")
|
||||
|
||||
void
|
||||
usage (int status)
|
||||
@@ -99,14 +96,14 @@ main (int argc, char **argv)
|
||||
char *name;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
|
||||
usage, AUTHORS, (char const *) NULL);
|
||||
if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
|
||||
usage (EXIT_FAILURE);
|
||||
|
||||
@@ -1,25 +1,7 @@
|
||||
--- src/id.c 2008-03-04 18:50:55.000000000 +0100
|
||||
+++ src/id.c 2008-03-04 19:32:24.000000000 +0100
|
||||
@@ -196,6 +196,7 @@ of a different user"));
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("cannot print only names or real IDs in default format"));
|
||||
|
||||
+ {
|
||||
char const *user_name;
|
||||
if (argc - optind == 1)
|
||||
{
|
||||
@@ -239,6 +240,7 @@ of a different user"));
|
||||
{
|
||||
print_full_info (user_name);
|
||||
}
|
||||
+ }
|
||||
putchar ('\n');
|
||||
|
||||
exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
diff -upr src/remove.c src/remove.c
|
||||
--- src/remove.c 2007-07-23 12:56:20.000000000 +0200
|
||||
+++ src/remove.c 2007-07-23 13:03:12.000000000 +0200
|
||||
@@ -264,9 +264,10 @@ pop_dir (Dirstack_state *ds)
|
||||
--- src/remove.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ src/remove.c 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -262,9 +262,10 @@ pop_dir (Dirstack_state *ds)
|
||||
{
|
||||
size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);
|
||||
size_t *length = obstack_base (&ds->len_stack);
|
||||
@@ -31,7 +13,7 @@ diff -upr src/remove.c src/remove.c
|
||||
assert (top_len >= 2);
|
||||
|
||||
/* Pop the specified length of file name. */
|
||||
@@ -424,10 +425,11 @@ AD_stack_top (Dirstack_state const *ds)
|
||||
@@ -422,10 +423,11 @@ AD_stack_top (Dirstack_state const *ds)
|
||||
static void
|
||||
AD_stack_pop (Dirstack_state *ds)
|
||||
{
|
||||
@@ -44,7 +26,7 @@ diff -upr src/remove.c src/remove.c
|
||||
if (top->unremovable)
|
||||
hash_free (top->unremovable);
|
||||
obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
|
||||
@@ -836,14 +838,13 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
@@ -834,14 +836,13 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
{
|
||||
int write_protected = 0;
|
||||
int dirent_type = *pdirent_type;
|
||||
@@ -60,7 +42,7 @@ diff -upr src/remove.c src/remove.c
|
||||
if (!x->ignore_missing_files
|
||||
&& ((x->interactive == RMI_ALWAYS) || x->stdin_tty)
|
||||
&& dirent_type != DT_LNK)
|
||||
@@ -891,6 +892,7 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
@@ -889,6 +890,7 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -68,7 +50,7 @@ diff -upr src/remove.c src/remove.c
|
||||
char const *quoted_name = quote (full_filename (filename));
|
||||
|
||||
if (write_protected < 0)
|
||||
@@ -930,6 +932,7 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
@@ -928,6 +930,7 @@ prompt (int fd_cwd, Dirstack_state const
|
||||
: _("%s: remove %s %s? ")),
|
||||
program_name, file_type (sbuf), quoted_name);
|
||||
}
|
||||
@@ -76,7 +58,7 @@ diff -upr src/remove.c src/remove.c
|
||||
|
||||
if (!yesno ())
|
||||
return RM_USER_DECLINED;
|
||||
@@ -1549,6 +1552,7 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
@@ -1547,6 +1550,7 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
return RM_ERROR;
|
||||
}
|
||||
|
||||
@@ -84,7 +66,7 @@ diff -upr src/remove.c src/remove.c
|
||||
struct stat st;
|
||||
cache_stat_init (&st);
|
||||
cycle_check_init (&ds->cycle_check_state);
|
||||
@@ -1571,6 +1575,7 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
@@ -1569,6 +1573,7 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
AD_push_initial (ds);
|
||||
AD_INIT_OTHER_MEMBERS ();
|
||||
|
||||
@@ -92,7 +74,7 @@ diff -upr src/remove.c src/remove.c
|
||||
enum RM_status status = remove_entry (AT_FDCWD, ds, filename,
|
||||
DT_UNKNOWN, &st, x);
|
||||
if (status == RM_NONEMPTY_DIR)
|
||||
@@ -1589,6 +1594,8 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
@@ -1587,6 +1592,8 @@ rm_1 (Dirstack_state *ds, char const *fi
|
||||
ds_clear (ds);
|
||||
return status;
|
||||
}
|
||||
@@ -102,8 +84,8 @@ diff -upr src/remove.c src/remove.c
|
||||
/* Remove all files and/or directories specified by N_FILES and FILE.
|
||||
Apply the options in X. */
|
||||
diff -upr src/rm.c src/rm.c
|
||||
--- src/rm.c 2007-07-23 12:56:20.000000000 +0200
|
||||
+++ src/rm.c 2007-07-23 13:03:12.000000000 +0200
|
||||
--- src/rm.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ src/rm.c 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -354,6 +354,7 @@ main (int argc, char **argv)
|
||||
quote ("/"));
|
||||
}
|
||||
@@ -124,9 +106,9 @@ diff -upr src/rm.c src/rm.c
|
||||
+ }
|
||||
}
|
||||
diff -upr src/seq.c src/seq.c
|
||||
--- src/seq.c 2008-04-14 11:17:15.000000000 +0200
|
||||
+++ src/seq.c 2008-04-14 11:26:57.000000000 +0200
|
||||
@@ -166,6 +166,7 @@ scan_arg (const char *arg)
|
||||
--- src/seq.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ src/seq.c 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -163,6 +163,7 @@ scan_arg (const char *arg)
|
||||
: (decimal_point == arg /* .# -> 0.# */
|
||||
|| ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */
|
||||
}
|
||||
@@ -134,7 +116,7 @@ diff -upr src/seq.c src/seq.c
|
||||
char const *e = strchr (arg, 'e');
|
||||
if (! e)
|
||||
e = strchr (arg, 'E');
|
||||
@@ -174,6 +175,7 @@ scan_arg (const char *arg)
|
||||
@@ -171,6 +172,7 @@ scan_arg (const char *arg)
|
||||
long exponent = strtol (e + 1, NULL, 10);
|
||||
ret.precision += exponent < 0 ? -exponent : 0;
|
||||
}
|
||||
@@ -142,7 +124,7 @@ diff -upr src/seq.c src/seq.c
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -349,6 +351,7 @@ get_default_format (operand first, opera
|
||||
@@ -346,6 +348,7 @@ get_default_format (operand first, opera
|
||||
size_t last_width = last.width + (prec - last.precision);
|
||||
if (last.precision && prec == 0)
|
||||
last_width--; /* don't include space for '.' */
|
||||
@@ -150,7 +132,7 @@ diff -upr src/seq.c src/seq.c
|
||||
size_t width = MAX (first_width, last_width);
|
||||
if (width <= INT_MAX)
|
||||
{
|
||||
@@ -356,6 +359,7 @@ get_default_format (operand first, opera
|
||||
@@ -353,6 +356,7 @@ get_default_format (operand first, opera
|
||||
sprintf (format_buf, "%%0%d.%dLf", w, prec);
|
||||
return format_buf;
|
||||
}
|
||||
@@ -158,7 +140,7 @@ diff -upr src/seq.c src/seq.c
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -444,6 +448,7 @@ main (int argc, char **argv)
|
||||
@@ -441,6 +445,7 @@ main (int argc, char **argv)
|
||||
if (format_str)
|
||||
{
|
||||
validate_format (format_str);
|
||||
@@ -166,7 +148,7 @@ diff -upr src/seq.c src/seq.c
|
||||
char const *f = long_double_format (format_str, &layout);
|
||||
if (! f)
|
||||
{
|
||||
@@ -451,6 +456,7 @@ main (int argc, char **argv)
|
||||
@@ -448,6 +453,7 @@ main (int argc, char **argv)
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
format_str = f;
|
||||
@@ -175,9 +157,9 @@ diff -upr src/seq.c src/seq.c
|
||||
|
||||
last = scan_arg (argv[optind++]);
|
||||
diff -upr src/shred.c src/shred.c
|
||||
--- src/shred.c 2007-07-23 12:56:20.000000000 +0200
|
||||
+++ src/shred.c 2007-07-23 13:03:12.000000000 +0200
|
||||
@@ -461,7 +461,7 @@ dopass (int fd, char const *qname, off_t
|
||||
--- src/shred.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ src/shred.c 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -468,7 +468,7 @@ dopass (int fd, char const *qname, off_t
|
||||
out. Thus, it shouldn't give up on bad blocks. This
|
||||
code works because lim is always a multiple of
|
||||
SECTOR_SIZE, except at the end. */
|
||||
|
||||
30
src/cat.c
30
src/cat.c
@@ -1,5 +1,5 @@
|
||||
/* cat -- concatenate files and print on the standard output.
|
||||
Copyright (C) 88, 90, 91, 1995-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 88, 90, 91, 1995-2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -39,18 +39,14 @@
|
||||
#include "full-write.h"
|
||||
#include "quote.h"
|
||||
#include "safe-read.h"
|
||||
#include "xfreopen.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "cat"
|
||||
|
||||
#define AUTHORS "Torbjorn Granlund", "Richard M. Stallman"
|
||||
|
||||
/* Undefine, to avoid warning about redefinition on some systems. */
|
||||
#undef max
|
||||
#define max(h,i) ((h) > (i) ? (h) : (i))
|
||||
|
||||
/* Name under which this program was invoked. */
|
||||
char *program_name;
|
||||
#define AUTHORS \
|
||||
proper_name_utf8 ("Torbjorn Granlund", "Torbj\303\266rn Granlund"), \
|
||||
proper_name ("Richard M. Stallman")
|
||||
|
||||
/* Name of input file. May be "-". */
|
||||
static char const *infile;
|
||||
@@ -91,7 +87,7 @@ usage (int status)
|
||||
else
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s [OPTION] [FILE]...\n\
|
||||
Usage: %s [OPTION]... [FILE]...\n\
|
||||
"),
|
||||
program_name);
|
||||
fputs (_("\
|
||||
@@ -337,7 +333,7 @@ cat (
|
||||
input_pending = true;
|
||||
#endif
|
||||
|
||||
if (input_pending)
|
||||
if (!input_pending)
|
||||
write_pending (outbuf, &bpout);
|
||||
|
||||
/* Read more input into INBUF. */
|
||||
@@ -563,7 +559,7 @@ main (int argc, char **argv)
|
||||
};
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -640,7 +636,7 @@ main (int argc, char **argv)
|
||||
if (fstat (STDOUT_FILENO, &stat_buf) < 0)
|
||||
error (EXIT_FAILURE, errno, _("standard output"));
|
||||
|
||||
outsize = ST_BLKSIZE (stat_buf);
|
||||
outsize = io_blksize (stat_buf);
|
||||
/* Input file can be output file for non-regular files.
|
||||
fstat on pipes returns S_IFSOCK on some systems, S_IFIFO
|
||||
on others, so the checking should not be done for those types,
|
||||
@@ -665,7 +661,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
file_open_mode |= O_BINARY;
|
||||
if (O_BINARY && ! isatty (STDOUT_FILENO))
|
||||
freopen (NULL, "wb", stdout);
|
||||
xfreopen (NULL, "wb", stdout);
|
||||
}
|
||||
|
||||
/* Check if any of the input files are the same as the output file. */
|
||||
@@ -685,7 +681,7 @@ main (int argc, char **argv)
|
||||
have_read_stdin = true;
|
||||
input_desc = STDIN_FILENO;
|
||||
if ((file_open_mode & O_BINARY) && ! isatty (STDIN_FILENO))
|
||||
freopen (NULL, "rb", stdin);
|
||||
xfreopen (NULL, "rb", stdin);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -704,7 +700,7 @@ main (int argc, char **argv)
|
||||
ok = false;
|
||||
goto contin;
|
||||
}
|
||||
insize = ST_BLKSIZE (stat_buf);
|
||||
insize = io_blksize (stat_buf);
|
||||
|
||||
/* Compare the device and i-node numbers of this input file with
|
||||
the corresponding values of the (output file associated with)
|
||||
@@ -726,7 +722,7 @@ main (int argc, char **argv)
|
||||
if (! (number | show_ends | show_nonprinting
|
||||
| show_tabs | squeeze_blank))
|
||||
{
|
||||
insize = max (insize, outsize);
|
||||
insize = MAX (insize, outsize);
|
||||
inbuf = xmalloc (insize + page_size - 1);
|
||||
|
||||
ok &= simple_cat (ptr_align (inbuf, page_size), insize);
|
||||
|
||||
35
src/chcon.c
35
src/chcon.c
@@ -31,30 +31,9 @@
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "chcon"
|
||||
|
||||
#define AUTHORS "Russell Coker", "Jim Meyering"
|
||||
|
||||
enum Change_status
|
||||
{
|
||||
CH_NOT_APPLIED,
|
||||
CH_SUCCEEDED,
|
||||
CH_FAILED,
|
||||
CH_NO_CHANGE_REQUESTED
|
||||
};
|
||||
|
||||
enum Verbosity
|
||||
{
|
||||
/* Print a message for each file that is processed. */
|
||||
V_high,
|
||||
|
||||
/* Print a message for each file whose attributes we change. */
|
||||
V_changes_only,
|
||||
|
||||
/* Do not be verbose. This is the default. */
|
||||
V_off
|
||||
};
|
||||
|
||||
/* The name the program was run with. */
|
||||
char *program_name;
|
||||
#define AUTHORS \
|
||||
proper_name ("Russell Coker"), \
|
||||
proper_name ("Jim Meyering")
|
||||
|
||||
/* If nonzero, and the systems has support for it, change the context
|
||||
of symbolic links rather than any files they point to. */
|
||||
@@ -301,7 +280,7 @@ process_file (FTS *fts, FTSENT *ent)
|
||||
if (ok)
|
||||
{
|
||||
if (verbose)
|
||||
printf (_("changing security context of %s"),
|
||||
printf (_("changing security context of %s\n"),
|
||||
quote (file_full_name));
|
||||
|
||||
if (change_file_context (fts->fts_cwd_fd, file) != 0)
|
||||
@@ -370,7 +349,6 @@ Usage: %s [OPTION]... CONTEXT FILE...\n\
|
||||
Change the security context of each FILE to CONTEXT.\n\
|
||||
With --reference, change the security context of each FILE to that of RFILE.\n\
|
||||
\n\
|
||||
-c, --changes like verbose but report only when a change is made\n\
|
||||
-h, --no-dereference affect symbolic links instead of any referenced file\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
@@ -400,6 +378,7 @@ one takes effect.\n\
|
||||
"), stdout);
|
||||
fputs (HELP_OPTION_DESCRIPTION, stdout);
|
||||
fputs (VERSION_OPTION_DESCRIPTION, stdout);
|
||||
emit_bug_reporting_address ();
|
||||
}
|
||||
exit (status);
|
||||
}
|
||||
@@ -423,14 +402,14 @@ main (int argc, char **argv)
|
||||
int optc;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
while ((optc = getopt_long (argc, argv, "HLPRchvu:r:t:l:", long_options, NULL))
|
||||
while ((optc = getopt_long (argc, argv, "HLPRhvu:r:t:l:", long_options, NULL))
|
||||
!= -1)
|
||||
{
|
||||
switch (optc)
|
||||
|
||||
12
src/chgrp.c
12
src/chgrp.c
@@ -1,5 +1,5 @@
|
||||
/* chgrp -- change group ownership of files
|
||||
Copyright (C) 89, 90, 91, 1995-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 1995-2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -34,15 +34,14 @@
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "chgrp"
|
||||
|
||||
#define AUTHORS "David MacKenzie", "Jim Meyering"
|
||||
#define AUTHORS \
|
||||
proper_name ("David MacKenzie"), \
|
||||
proper_name ("Jim Meyering")
|
||||
|
||||
#if ! HAVE_ENDGRENT
|
||||
# define endgrent() ((void) 0)
|
||||
#endif
|
||||
|
||||
/* The name the program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* The argument to the --reference option. Use the group ID of this file.
|
||||
This file must exist. */
|
||||
static char *reference_file;
|
||||
@@ -182,7 +181,7 @@ main (int argc, char **argv)
|
||||
int optc;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -303,6 +302,7 @@ main (int argc, char **argv)
|
||||
quote ("/"));
|
||||
}
|
||||
|
||||
bit_flags |= FTS_DEFER_STAT;
|
||||
ok = chown_files (argv + optind, bit_flags,
|
||||
(uid_t) -1, gid,
|
||||
(uid_t) -1, (gid_t) -1, &chopt);
|
||||
|
||||
38
src/chmod.c
38
src/chmod.c
@@ -1,5 +1,5 @@
|
||||
/* chmod -- change permission modes of files
|
||||
Copyright (C) 89, 90, 91, 1995-2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 1995-2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -34,7 +34,9 @@
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "chmod"
|
||||
|
||||
#define AUTHORS "David MacKenzie", "Jim Meyering"
|
||||
#define AUTHORS \
|
||||
proper_name ("David MacKenzie"), \
|
||||
proper_name ("Jim Meyering")
|
||||
|
||||
enum Change_status
|
||||
{
|
||||
@@ -56,9 +58,6 @@ enum Verbosity
|
||||
V_off
|
||||
};
|
||||
|
||||
/* The name the program was run with. */
|
||||
char *program_name;
|
||||
|
||||
/* The desired change to the mode. */
|
||||
static struct mode_change *change;
|
||||
|
||||
@@ -68,7 +67,7 @@ static mode_t umask_value;
|
||||
/* If true, change the modes of directories recursively. */
|
||||
static bool recurse;
|
||||
|
||||
/* If true, force silence (no error messages). */
|
||||
/* If true, force silence (suppress most of error messages). */
|
||||
static bool force_silent;
|
||||
|
||||
/* If true, diagnose surprises from naive misuses like "chmod -r file".
|
||||
@@ -122,7 +121,7 @@ mode_changed (char const *file, mode_t old_mode, mode_t new_mode)
|
||||
|
||||
if (stat (file, &new_stats) != 0)
|
||||
{
|
||||
if (!force_silent)
|
||||
if (! force_silent)
|
||||
error (0, errno, _("getting new attributes of %s"), quote (file));
|
||||
return false;
|
||||
}
|
||||
@@ -204,24 +203,29 @@ process_file (FTS *fts, FTSENT *ent)
|
||||
fts_set (fts, ent, FTS_AGAIN);
|
||||
return true;
|
||||
}
|
||||
error (0, ent->fts_errno, _("cannot access %s"), quote (file_full_name));
|
||||
if (! force_silent)
|
||||
error (0, ent->fts_errno, _("cannot access %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
case FTS_ERR:
|
||||
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
|
||||
if (! force_silent)
|
||||
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
case FTS_DNR:
|
||||
error (0, ent->fts_errno, _("cannot read directory %s"),
|
||||
quote (file_full_name));
|
||||
if (! force_silent)
|
||||
error (0, ent->fts_errno, _("cannot read directory %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
case FTS_SLNONE:
|
||||
error (0, 0, _("cannot operate on dangling symlink %s"),
|
||||
quote (file_full_name));
|
||||
if (! force_silent)
|
||||
error (0, 0, _("cannot operate on dangling symlink %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
|
||||
default:
|
||||
@@ -320,7 +324,8 @@ process_files (char **files, int bit_flags)
|
||||
if (errno != 0)
|
||||
{
|
||||
/* FIXME: try to give a better message */
|
||||
error (0, errno, _("fts_read failed"));
|
||||
if (! force_silent)
|
||||
error (0, errno, _("fts_read failed"));
|
||||
ok = false;
|
||||
}
|
||||
break;
|
||||
@@ -392,7 +397,7 @@ main (int argc, char **argv)
|
||||
int c;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -529,7 +534,8 @@ main (int argc, char **argv)
|
||||
root_dev_ino = NULL;
|
||||
}
|
||||
|
||||
ok = process_files (argv + optind, FTS_COMFOLLOW | FTS_PHYSICAL);
|
||||
ok = process_files (argv + optind,
|
||||
FTS_COMFOLLOW | FTS_PHYSICAL | FTS_DEFER_STAT);
|
||||
|
||||
exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "system.h"
|
||||
#include "chown-core.h"
|
||||
#include "error.h"
|
||||
#include "inttostr.h"
|
||||
#include "quote.h"
|
||||
#include "root-dev-ino.h"
|
||||
#include "xfts.h"
|
||||
@@ -297,18 +296,22 @@ change_file_owner (FTS *fts, FTSENT *ent,
|
||||
fts_set (fts, ent, FTS_AGAIN);
|
||||
return true;
|
||||
}
|
||||
error (0, ent->fts_errno, _("cannot access %s"), quote (file_full_name));
|
||||
if (! chopt->force_silent)
|
||||
error (0, ent->fts_errno, _("cannot access %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
case FTS_ERR:
|
||||
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
|
||||
if (! chopt->force_silent)
|
||||
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
case FTS_DNR:
|
||||
error (0, ent->fts_errno, _("cannot read directory %s"),
|
||||
quote (file_full_name));
|
||||
if (! chopt->force_silent)
|
||||
error (0, ent->fts_errno, _("cannot read directory %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
break;
|
||||
|
||||
@@ -339,8 +342,9 @@ change_file_owner (FTS *fts, FTSENT *ent,
|
||||
{
|
||||
if (fstatat (fts->fts_cwd_fd, file, &stat_buf, 0) != 0)
|
||||
{
|
||||
error (0, errno, _("cannot dereference %s"),
|
||||
quote (file_full_name));
|
||||
if (! chopt->force_silent)
|
||||
error (0, errno, _("cannot dereference %s"),
|
||||
quote (file_full_name));
|
||||
ok = false;
|
||||
}
|
||||
|
||||
@@ -493,7 +497,8 @@ chown_files (char **files, int bit_flags,
|
||||
if (errno != 0)
|
||||
{
|
||||
/* FIXME: try to give a better message */
|
||||
error (0, errno, _("fts_read failed"));
|
||||
if (! chopt->force_silent)
|
||||
error (0, errno, _("fts_read failed"));
|
||||
ok = false;
|
||||
}
|
||||
break;
|
||||
|
||||
14
src/chown.c
14
src/chown.c
@@ -1,5 +1,5 @@
|
||||
/* chown -- change user and group ownership of files
|
||||
Copyright (C) 89, 90, 91, 1995-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 1995-2009 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -43,10 +43,9 @@
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "chown"
|
||||
|
||||
#define AUTHORS "David MacKenzie", "Jim Meyering"
|
||||
|
||||
/* The name the program was run with. */
|
||||
char *program_name;
|
||||
#define AUTHORS \
|
||||
proper_name ("David MacKenzie"), \
|
||||
proper_name ("Jim Meyering")
|
||||
|
||||
/* The argument to the --reference option. Use the owner and group IDs
|
||||
of this file. This file must exist. */
|
||||
@@ -184,7 +183,7 @@ main (int argc, char **argv)
|
||||
int optc;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -313,7 +312,7 @@ main (int argc, char **argv)
|
||||
empty string so that diagnostics say "ownership :GROUP"
|
||||
rather than "group GROUP". */
|
||||
if (!chopt.user_name && chopt.group_name)
|
||||
chopt.user_name = "";
|
||||
chopt.user_name = bad_cast ("");
|
||||
|
||||
optind++;
|
||||
}
|
||||
@@ -327,6 +326,7 @@ main (int argc, char **argv)
|
||||
quote ("/"));
|
||||
}
|
||||
|
||||
bit_flags |= FTS_DEFER_STAT;
|
||||
ok = chown_files (argv + optind, bit_flags,
|
||||
uid, gid,
|
||||
required_uid, required_gid, &chopt);
|
||||
|
||||
21
src/chroot.c
21
src/chroot.c
@@ -1,5 +1,6 @@
|
||||
/* chroot -- run command or shell with special root directory
|
||||
Copyright (C) 95, 96, 1997, 1999-2004, 2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 95, 96, 1997, 1999-2004, 2007-2009
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -29,10 +30,7 @@
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "chroot"
|
||||
|
||||
#define AUTHORS "Roland McGrath"
|
||||
|
||||
/* The name this program was run with, for error messages. */
|
||||
char *program_name;
|
||||
#define AUTHORS proper_name ("Roland McGrath")
|
||||
|
||||
void
|
||||
usage (int status)
|
||||
@@ -43,7 +41,7 @@ usage (int status)
|
||||
else
|
||||
{
|
||||
printf (_("\
|
||||
Usage: %s NEWROOT [COMMAND...]\n\
|
||||
Usage: %s NEWROOT [COMMAND [ARG]...]\n\
|
||||
or: %s OPTION\n\
|
||||
"), program_name, program_name);
|
||||
fputs (_("\
|
||||
@@ -65,7 +63,7 @@ int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
@@ -73,7 +71,7 @@ main (int argc, char **argv)
|
||||
initialize_exit_failure (EXIT_FAILURE);
|
||||
atexit (close_stdout);
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
|
||||
usage, AUTHORS, (char const *) NULL);
|
||||
if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
|
||||
usage (EXIT_FAILURE);
|
||||
@@ -85,7 +83,8 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
if (chroot (argv[optind]) != 0)
|
||||
error (EXIT_FAILURE, errno, _("cannot change root directory to %s"), argv[1]);
|
||||
error (EXIT_FAILURE, errno, _("cannot change root directory to %s"),
|
||||
argv[optind]);
|
||||
|
||||
if (chdir ("/"))
|
||||
error (EXIT_FAILURE, errno, _("cannot chdir to root directory"));
|
||||
@@ -95,9 +94,9 @@ main (int argc, char **argv)
|
||||
/* No command. Run an interactive shell. */
|
||||
char *shell = getenv ("SHELL");
|
||||
if (shell == NULL)
|
||||
shell = "/bin/sh";
|
||||
shell = bad_cast ("/bin/sh");
|
||||
argv[0] = shell;
|
||||
argv[1] = "-i";
|
||||
argv[1] = bad_cast ("-i");
|
||||
argv[2] = NULL;
|
||||
}
|
||||
else
|
||||
|
||||
15
src/cksum.c
15
src/cksum.c
@@ -1,5 +1,5 @@
|
||||
/* cksum -- calculate and print POSIX checksums and sizes of files
|
||||
Copyright (C) 92, 1995-2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 92, 1995-2006, 2008 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
|
||||
@@ -37,12 +37,13 @@
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "cksum"
|
||||
|
||||
#define AUTHORS "Q. Frank Xia"
|
||||
#define AUTHORS proper_name ("Q. Frank Xia")
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include "system.h"
|
||||
#include "xfreopen.h"
|
||||
|
||||
#ifdef CRCTAB
|
||||
|
||||
@@ -108,14 +109,10 @@ main (void)
|
||||
# include <getopt.h>
|
||||
# include "long-options.h"
|
||||
# include "error.h"
|
||||
# include "inttostr.h"
|
||||
|
||||
/* Number of bytes to read at once. */
|
||||
# define BUFLEN (1 << 16)
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
static uint_fast32_t const crctab[256] =
|
||||
{
|
||||
0x00000000,
|
||||
@@ -196,7 +193,7 @@ cksum (const char *file, bool print_name)
|
||||
fp = stdin;
|
||||
have_read_stdin = true;
|
||||
if (O_BINARY && ! isatty (STDIN_FILENO))
|
||||
freopen (NULL, "rb", stdin);
|
||||
xfreopen (NULL, "rb", stdin);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -284,14 +281,14 @@ main (int argc, char **argv)
|
||||
bool ok;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
program_name = argv[0];
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, Version,
|
||||
usage, AUTHORS, (char const *) NULL);
|
||||
if (getopt_long (argc, argv, "", NULL, NULL) != -1)
|
||||
usage (EXIT_FAILURE);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user