mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
498 Commits
FILEUTILS-
...
FILEUTILS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ae3622d9e | ||
|
|
27682ba5ce | ||
|
|
8dd3e53122 | ||
|
|
d1187d36da | ||
|
|
0f85045bb3 | ||
|
|
69835e9fb6 | ||
|
|
3ba948db7e | ||
|
|
d1f9e2315b | ||
|
|
d04604664a | ||
|
|
4e9a99dd9a | ||
|
|
3f3df4e600 | ||
|
|
27e780fe97 | ||
|
|
122d3f15ae | ||
|
|
bb3fca40db | ||
|
|
91c40bd499 | ||
|
|
0f4fcb1fbd | ||
|
|
3fbc98bb54 | ||
|
|
240b9c0f89 | ||
|
|
fc13bb65df | ||
|
|
27f3ca3d5a | ||
|
|
f1a7e03bbe | ||
|
|
8d58cbb99e | ||
|
|
3b87431a69 | ||
|
|
d09816b054 | ||
|
|
19c23eefb7 | ||
|
|
ef8d2acace | ||
|
|
f7d6ece6e4 | ||
|
|
90a63a16ec | ||
|
|
ec7ec3773f | ||
|
|
a97f821233 | ||
|
|
b15e832f4d | ||
|
|
e77a16efec | ||
|
|
7fd7c6465e | ||
|
|
7fc23ef625 | ||
|
|
1bd7deb235 | ||
|
|
f2dd2f10c1 | ||
|
|
1af4f2f11d | ||
|
|
1703d0d59c | ||
|
|
7ac1d190bc | ||
|
|
0c3c6b1b0b | ||
|
|
01c3ff5a1e | ||
|
|
1b03d98f62 | ||
|
|
b294d530d4 | ||
|
|
75b6b90fe1 | ||
|
|
7613946ac6 | ||
|
|
5b16f997e8 | ||
|
|
ee041d6d4f | ||
|
|
f89f495c0d | ||
|
|
5e3e9e7a15 | ||
|
|
8d4d2c4cf4 | ||
|
|
36de2ed1e2 | ||
|
|
f42b337a0b | ||
|
|
6cdd12a9f2 | ||
|
|
a0ec87fbf9 | ||
|
|
5c71306463 | ||
|
|
da69105424 | ||
|
|
1ea1c0864c | ||
|
|
a4e98775a4 | ||
|
|
5017930f13 | ||
|
|
73b7370917 | ||
|
|
bca292d9e6 | ||
|
|
6e3b675ea8 | ||
|
|
95efa0587b | ||
|
|
e49ef588db | ||
|
|
5823a999fe | ||
|
|
218c464b91 | ||
|
|
3cc80de466 | ||
|
|
52fa9ac235 | ||
|
|
9b809393be | ||
|
|
610567e17f | ||
|
|
ad4e506e0f | ||
|
|
4475ffda48 | ||
|
|
1b23f5094d | ||
|
|
02f917c543 | ||
|
|
60a6e7be26 | ||
|
|
8133377948 | ||
|
|
1df5503ccf | ||
|
|
e9a5c7551c | ||
|
|
adfde62439 | ||
|
|
4b05962106 | ||
|
|
df142feab8 | ||
|
|
b2aff777b1 | ||
|
|
b793f241f4 | ||
|
|
ad22b83e45 | ||
|
|
c71fc5f18e | ||
|
|
3e13b5e49d | ||
|
|
8f55e63084 | ||
|
|
2eb479a682 | ||
|
|
ec65e39e6f | ||
|
|
bedf44ba83 | ||
|
|
0cb0cc4e2f | ||
|
|
aee16a6664 | ||
|
|
93d47b3db9 | ||
|
|
18c222c5b5 | ||
|
|
bb01a24be5 | ||
|
|
1ccc979847 | ||
|
|
ad1d74e973 | ||
|
|
0142ca7d96 | ||
|
|
bcfa9cbbd7 | ||
|
|
6c93489171 | ||
|
|
345c323ffd | ||
|
|
1f682431ae | ||
|
|
698a43f363 | ||
|
|
def9c2bf0b | ||
|
|
6191d1839a | ||
|
|
184870f9bb | ||
|
|
6ccae5e2d8 | ||
|
|
31f6e2b228 | ||
|
|
d05618c5c2 | ||
|
|
7a314199db | ||
|
|
837a447ba4 | ||
|
|
5d2bbddf97 | ||
|
|
6dda2aaa52 | ||
|
|
3fa1d4bb24 | ||
|
|
1c84606b56 | ||
|
|
b1b273f24f | ||
|
|
e211d3960f | ||
|
|
9282f5f8a6 | ||
|
|
1d2074e02a | ||
|
|
8dce8df49a | ||
|
|
4d4b2c8e5e | ||
|
|
a72bab1a32 | ||
|
|
affbb977af | ||
|
|
aa1c5467ec | ||
|
|
435fa5a7dd | ||
|
|
b7441176e3 | ||
|
|
f3c14cb59f | ||
|
|
8ba97d963e | ||
|
|
223e88f957 | ||
|
|
83d4b736d2 | ||
|
|
257c5c4737 | ||
|
|
391c960cba | ||
|
|
62f208d493 | ||
|
|
60ae0b81a5 | ||
|
|
09d344df5b | ||
|
|
43f4099c95 | ||
|
|
476cb02516 | ||
|
|
159788fcca | ||
|
|
f32dc5a2b0 | ||
|
|
ea7102f120 | ||
|
|
41ef62c472 | ||
|
|
26d5ce2f26 | ||
|
|
868ed3b0af | ||
|
|
6552bb980b | ||
|
|
79a6760fe4 | ||
|
|
531453d901 | ||
|
|
1d94869663 | ||
|
|
ce195c7a07 | ||
|
|
09a2261919 | ||
|
|
c5eb9edf26 | ||
|
|
dd9470cb58 | ||
|
|
02fc5fa0d0 | ||
|
|
b62793b100 | ||
|
|
c7af539321 | ||
|
|
e989012b57 | ||
|
|
7aeda9a4d3 | ||
|
|
d51682ef43 | ||
|
|
ab869ed00e | ||
|
|
73ab48d4e7 | ||
|
|
73e6d60538 | ||
|
|
032aecf5e7 | ||
|
|
8f3524de4a | ||
|
|
439fdff851 | ||
|
|
933b990ab9 | ||
|
|
ae965a958a | ||
|
|
214ee5aecd | ||
|
|
4dc12acc27 | ||
|
|
a92dd43b7c | ||
|
|
d2698caef3 | ||
|
|
db8fe3cf1f | ||
|
|
664ba0841c | ||
|
|
26d84b6c70 | ||
|
|
70c8aaf873 | ||
|
|
182a1780ac | ||
|
|
cf430d3590 | ||
|
|
6ae99a4290 | ||
|
|
c76172fbb0 | ||
|
|
dd040b917a | ||
|
|
4ec1fad4e7 | ||
|
|
9d9fef5595 | ||
|
|
6fd3c331ba | ||
|
|
9b989298f4 | ||
|
|
07507c07da | ||
|
|
c96968a2a3 | ||
|
|
a3e1200b4a | ||
|
|
2b2424aab8 | ||
|
|
994c3c82ef | ||
|
|
dfc86db1cc | ||
|
|
162f6824cf | ||
|
|
feccdc6c58 | ||
|
|
2f617e52d6 | ||
|
|
d200f4974b | ||
|
|
de45950430 | ||
|
|
4d95aa356f | ||
|
|
d82af243b1 | ||
|
|
2781ec69b7 | ||
|
|
4a9222e0c2 | ||
|
|
84c104b6da | ||
|
|
500594433a | ||
|
|
ed1fdb8841 | ||
|
|
5d59e18618 | ||
|
|
94ff35fc2d | ||
|
|
dc6658157d | ||
|
|
36fc028151 | ||
|
|
6db9dc96d3 | ||
|
|
7af859841f | ||
|
|
dcfb3e037a | ||
|
|
bc63f10b59 | ||
|
|
ce42a622b2 | ||
|
|
5cd15e8abb | ||
|
|
c685d1c4cb | ||
|
|
cc13b3d81f | ||
|
|
f23d890626 | ||
|
|
e7976515e2 | ||
|
|
25485fa497 | ||
|
|
ab4ea710f1 | ||
|
|
39f78131e2 | ||
|
|
75637a7ef4 | ||
|
|
9e1c89c38e | ||
|
|
c726bc5709 | ||
|
|
585b65b676 | ||
|
|
b815641481 | ||
|
|
84d222f735 | ||
|
|
001e1b4302 | ||
|
|
dd2934197b | ||
|
|
ad174925d9 | ||
|
|
2aacc55e9b | ||
|
|
6f050de759 | ||
|
|
45d32cef80 | ||
|
|
3f51edcdec | ||
|
|
59c9c4036b | ||
|
|
ef2860263b | ||
|
|
d6b76c3f75 | ||
|
|
efa242bee1 | ||
|
|
8ea818e214 | ||
|
|
9bd57c9f22 | ||
|
|
0d457a6aee | ||
|
|
2722883a87 | ||
|
|
8105878c15 | ||
|
|
231c5aec0f | ||
|
|
e4e242e839 | ||
|
|
da8b83f81a | ||
|
|
df610e05ba | ||
|
|
9dab634c13 | ||
|
|
e5154f74b1 | ||
|
|
67786e0fb6 | ||
|
|
c84011e059 | ||
|
|
e36f49348b | ||
|
|
e786c1a0eb | ||
|
|
c057d35836 | ||
|
|
d9b628359a | ||
|
|
29b1eab1af | ||
|
|
9abd463ffb | ||
|
|
b54c86e8bc | ||
|
|
b885f7cbca | ||
|
|
7006d5fed6 | ||
|
|
976664803c | ||
|
|
3fdd4e6cd2 | ||
|
|
42755ceb62 | ||
|
|
8f03befb52 | ||
|
|
78af2f9732 | ||
|
|
88b4a9a940 | ||
|
|
045ebed00c | ||
|
|
24a7456cc0 | ||
|
|
b17e1af41c | ||
|
|
349b13e33a | ||
|
|
7b1d31a9b1 | ||
|
|
085866c1a3 | ||
|
|
4f75855c2e | ||
|
|
d649910685 | ||
|
|
e3e1698c6b | ||
|
|
b49e060cda | ||
|
|
e769659852 | ||
|
|
33d7cba8a7 | ||
|
|
65b2d6c97e | ||
|
|
2f3c1a3561 | ||
|
|
d8b68fc0c5 | ||
|
|
06ffb13ff0 | ||
|
|
3e62291a3c | ||
|
|
10972f68e8 | ||
|
|
15aac9a45d | ||
|
|
43fd950ef9 | ||
|
|
6c4002b2b5 | ||
|
|
816ee7dc0d | ||
|
|
916c762152 | ||
|
|
0d7fe8a4de | ||
|
|
841c6fbfe0 | ||
|
|
859bfc78b1 | ||
|
|
21ae3d911c | ||
|
|
4520ff31e2 | ||
|
|
92ce634177 | ||
|
|
6d89cf5f12 | ||
|
|
83a4462018 | ||
|
|
2b416bd83e | ||
|
|
96ab6a541a | ||
|
|
571a29d870 | ||
|
|
20f1f8b063 | ||
|
|
4e1e8c600d | ||
|
|
d816bb4f14 | ||
|
|
ce60ef7400 | ||
|
|
6e98d78fd4 | ||
|
|
2c5862c808 | ||
|
|
268db2760a | ||
|
|
0062e8f915 | ||
|
|
057743741f | ||
|
|
3f2774c8b4 | ||
|
|
3e0c559579 | ||
|
|
e7d6615b76 | ||
|
|
91df5bbc48 | ||
|
|
4cc5661b42 | ||
|
|
19a98e3edc | ||
|
|
50e17793c8 | ||
|
|
8a0a50e6b0 | ||
|
|
a42054dd57 | ||
|
|
24da56f990 | ||
|
|
d8e6937773 | ||
|
|
e1b2b2337d | ||
|
|
60c77b6c28 | ||
|
|
c7b3d3e91b | ||
|
|
60c1207b74 | ||
|
|
d344aaa129 | ||
|
|
83c2cfa04d | ||
|
|
53c7a54a58 | ||
|
|
e81bcd87cb | ||
|
|
10d98345b4 | ||
|
|
e17b601d5e | ||
|
|
f5d8ee465e | ||
|
|
51c06c49cf | ||
|
|
bbf4d37373 | ||
|
|
9bb85624cf | ||
|
|
9b5402ec48 | ||
|
|
77728e4f4b | ||
|
|
9db889c372 | ||
|
|
caace05438 | ||
|
|
cd7f8d6e9b | ||
|
|
bf598c02ba | ||
|
|
3954a4f441 | ||
|
|
506343b223 | ||
|
|
2f8dc98340 | ||
|
|
d015aad1f2 | ||
|
|
a99c3df843 | ||
|
|
e78bc7655d | ||
|
|
a519a07f25 | ||
|
|
02efcd60ed | ||
|
|
39e2377300 | ||
|
|
cda5bf9db9 | ||
|
|
27c8d53a3a | ||
|
|
3e7e7d0792 | ||
|
|
a5b0ca6f24 | ||
|
|
1f62fd20a3 | ||
|
|
254fc64f64 | ||
|
|
9dc7d5d2ae | ||
|
|
45af919ce6 | ||
|
|
89c9e683a3 | ||
|
|
d20d0fc27d | ||
|
|
5b7e895b65 | ||
|
|
2e97d27586 | ||
|
|
a155c3d684 | ||
|
|
3489f267a4 | ||
|
|
3fc7024e49 | ||
|
|
30b522371a | ||
|
|
88013e3cb4 | ||
|
|
7c8a2cdacf | ||
|
|
876f399d50 | ||
|
|
05ffec210e | ||
|
|
163f7f9c20 | ||
|
|
8fbf79b4e0 | ||
|
|
08b5c3046c | ||
|
|
551b879bf1 | ||
|
|
bd1eee0315 | ||
|
|
72f7eb4e63 | ||
|
|
fef313b2b0 | ||
|
|
464e2ce05d | ||
|
|
a48999494d | ||
|
|
d5d061ee9b | ||
|
|
b44e91e99d | ||
|
|
ce3668f3c1 | ||
|
|
44fa09dc5e | ||
|
|
808b938840 | ||
|
|
83d4d74a88 | ||
|
|
0d38a270a4 | ||
|
|
3f017c26ca | ||
|
|
4c946943ea | ||
|
|
7dd872d963 | ||
|
|
b7d50ca523 | ||
|
|
fe18d63a65 | ||
|
|
6668e39160 | ||
|
|
d738449858 | ||
|
|
7254d243f2 | ||
|
|
91da5cedc7 | ||
|
|
1187f5eb7f | ||
|
|
5bcc1fd7fd | ||
|
|
e4c9ae3c6b | ||
|
|
d1121fa4c0 | ||
|
|
713c315978 | ||
|
|
8cc46c2a18 | ||
|
|
518f85fc40 | ||
|
|
48990a9078 | ||
|
|
69a3ee0b49 | ||
|
|
8ed3137f52 | ||
|
|
d4257e63c7 | ||
|
|
7154d646cb | ||
|
|
b388203a65 | ||
|
|
66c7b3c41d | ||
|
|
ac7b3c4fa9 | ||
|
|
b402870080 | ||
|
|
1cbe202b0a | ||
|
|
d618576e0e | ||
|
|
51fe35760e | ||
|
|
8bbe8ab5d4 | ||
|
|
ba51843a2c | ||
|
|
397d9be228 | ||
|
|
dddfcab3b3 | ||
|
|
00ea94587f | ||
|
|
49875c1593 | ||
|
|
7b9c4d3d03 | ||
|
|
3783d6be57 | ||
|
|
632ebfa209 | ||
|
|
29cc8bf4f3 | ||
|
|
50892edd61 | ||
|
|
72193ba149 | ||
|
|
854b5197ad | ||
|
|
d90641d9d8 | ||
|
|
300be5a250 | ||
|
|
3911fadcf9 | ||
|
|
382ca69cec | ||
|
|
9fc10dc6c3 | ||
|
|
f0a8ebf596 | ||
|
|
53c085b7e5 | ||
|
|
faa759b349 | ||
|
|
398e92a2ec | ||
|
|
3483943ebc | ||
|
|
108b074aea | ||
|
|
19fcb4356c | ||
|
|
c4b7f217a5 | ||
|
|
cb04f85936 | ||
|
|
902bbe7707 | ||
|
|
c9a9ec9b53 | ||
|
|
840a08ccde | ||
|
|
5fbcd963df | ||
|
|
953c42bd52 | ||
|
|
765122f558 | ||
|
|
e46a424ce9 | ||
|
|
095c92bc46 | ||
|
|
7957dcc00a | ||
|
|
108f8f2d04 | ||
|
|
39463d50ed | ||
|
|
4a46351e06 | ||
|
|
8aca15bac0 | ||
|
|
1ddffff8c0 | ||
|
|
e7683a577a | ||
|
|
3063e56f2e | ||
|
|
eb3a4daa24 | ||
|
|
b6844f1931 | ||
|
|
a636450727 | ||
|
|
6456a7d8ac | ||
|
|
a57d5061ff | ||
|
|
45e8e5c550 | ||
|
|
69412999dc | ||
|
|
85b39cb589 | ||
|
|
9f358e6830 | ||
|
|
defb2bdef8 | ||
|
|
6e577f0b56 | ||
|
|
c157e5fbef | ||
|
|
ca6cf35a5e | ||
|
|
ede420f14a | ||
|
|
52a2ff839c | ||
|
|
821a0823b1 | ||
|
|
e52d8736b1 | ||
|
|
5c0ee776d4 | ||
|
|
465ebf7c37 | ||
|
|
18ad404d02 | ||
|
|
28cb02fc78 | ||
|
|
cbf0181378 | ||
|
|
bca2db9877 | ||
|
|
aa71be25c0 | ||
|
|
cd053a291e | ||
|
|
fa4148be50 | ||
|
|
5695f8ea2d | ||
|
|
18d159d47e | ||
|
|
0bb2acd9da | ||
|
|
7a8b4afa3e | ||
|
|
3a0352ad9a | ||
|
|
55569d4f9f | ||
|
|
eeef5c523d | ||
|
|
e8ab1c28f8 | ||
|
|
df4ba7d9ca | ||
|
|
e832812173 | ||
|
|
ac648dbc8a | ||
|
|
c75ccba2d3 | ||
|
|
a33adfebb2 | ||
|
|
b50b941826 | ||
|
|
6ec5bace8a | ||
|
|
b48e78e3b7 | ||
|
|
33179975d7 | ||
|
|
d4a8891aef | ||
|
|
fcbfefa513 | ||
|
|
fcf6405f2d |
166
ABOUT-NLS
166
ABOUT-NLS
@@ -1,16 +1,16 @@
|
||||
Notes on the GNU Translation Project
|
||||
************************************
|
||||
Notes on the Free Translation Project
|
||||
*************************************
|
||||
|
||||
GNU is going international! The GNU Translation Project is a way to
|
||||
get maintainers, translators, and users all together, so that GNU will
|
||||
gradually become able to speak many languages. A few packages already
|
||||
provide translations for their messages.
|
||||
Free software is going international! The Free Translation Project
|
||||
is a way to get maintainers of free software, translators, and users all
|
||||
together, so that will gradually become able to speak many languages.
|
||||
A few packages already provide translations for their messages.
|
||||
|
||||
If you found this `ABOUT-NLS' file inside a GNU distribution, you
|
||||
may assume that the distributed package does use GNU `gettext'
|
||||
internally, itself available at your nearest GNU archive site. But you
|
||||
do *not* need to install GNU `gettext' prior to configuring, installing
|
||||
or using this package with messages translated.
|
||||
If you found this `ABOUT-NLS' file inside a distribution, you may
|
||||
assume that the distributed package does use GNU `gettext' internally,
|
||||
itself available at your nearest GNU archive site. But you do *not*
|
||||
need to install GNU `gettext' prior to configuring, installing or using
|
||||
this package with messages translated.
|
||||
|
||||
Installers will find here some useful hints. These notes also
|
||||
explain how users should proceed for getting the programs to use the
|
||||
@@ -31,19 +31,23 @@ should configure it using
|
||||
./configure --with-included-gettext
|
||||
|
||||
to force usage of internationalizing routines provided within this
|
||||
package, despite the existence of internationalizing capabilities in
|
||||
the operating system where this package is being installed. So far, no
|
||||
prior implementation provides as many useful features (such as locale
|
||||
alias or message inheritance). It is also not possible to offer this
|
||||
additional functionality on top of a `catgets' implementation. Future
|
||||
versions of GNU `gettext' will very likely convey even more
|
||||
functionality. So it might be a good idea to change to GNU `gettext'
|
||||
as soon as possible.
|
||||
package, despite the existence of internationalizing capabilities in the
|
||||
operating system where this package is being installed. So far, only
|
||||
the `gettext' implementation in the GNU C library version 2 provides as
|
||||
many features (such as locale alias or message inheritance) as the
|
||||
implementation here. It is also not possible to offer this additional
|
||||
functionality on top of a `catgets' implementation. Future versions of
|
||||
GNU `gettext' will very likely convey even more functionality. So it
|
||||
might be a good idea to change to GNU `gettext' as soon as possible.
|
||||
|
||||
So you need not provide this option if you are using GNU libc 2 or
|
||||
you have installed a recent copy of the GNU gettext package with the
|
||||
included `libintl'.
|
||||
|
||||
INSTALL Matters
|
||||
===============
|
||||
|
||||
Some GNU packages are "localizable" when properly installed; the
|
||||
Some packages are "localizable" when properly installed; the
|
||||
programs they contain can be made to speak your own native language.
|
||||
Most such packages use GNU `gettext'. Other packages have their own
|
||||
ways to internationalization, predating GNU `gettext'.
|
||||
@@ -113,37 +117,35 @@ shell prompt, merely execute `setenv LANG de' (in `csh'),
|
||||
can be done from your `.login' or `.profile' file, once and for all.
|
||||
|
||||
An operating system might already offer message localization for
|
||||
many of its programs, while other programs (whether GNU or not) have
|
||||
been installed locally with the full capabilities of GNU `gettext'.
|
||||
Just using `gettext' extended syntax for `LANG' would break proper
|
||||
localization of already available operating system programs. In this
|
||||
case, users should set both `LANGUAGE' and `LANG' variables in their
|
||||
environment, as programs using GNU `gettext' give preference to
|
||||
`LANGUAGE'. For example, some Swedish users would rather read
|
||||
translations in German than English for when Swedish is not available.
|
||||
This is easily accomplished by setting `LANGUAGE' to `sv:de' while
|
||||
leaving `LANG' to `sv'.
|
||||
many of its programs, while other programs have been installed locally
|
||||
with the full capabilities of GNU `gettext'. Just using `gettext'
|
||||
extended syntax for `LANG' would break proper localization of already
|
||||
available operating system programs. In this case, users should set
|
||||
both `LANGUAGE' and `LANG' variables in their environment, as programs
|
||||
using GNU `gettext' give preference to `LANGUAGE'. For example, some
|
||||
Swedish users would rather read translations in German than English for
|
||||
when Swedish is not available. This is easily accomplished by setting
|
||||
`LANGUAGE' to `sv:de' while leaving `LANG' to `sv'.
|
||||
|
||||
Translating Teams
|
||||
=================
|
||||
|
||||
For the GNU Translation Project to be a success, we need interested
|
||||
For the Free Translation Project to be a success, we need interested
|
||||
people who like their own language and write it well, and who are also
|
||||
able to synergize with other translators speaking the same language.
|
||||
Each translation team has its own mailing list, courtesy of Linux
|
||||
International. You may reach your translation team at the address
|
||||
`LL@li.org', replacing LL by the two-letter ISO 639 code for your
|
||||
language. Language codes are *not* the same as the country codes given
|
||||
in ISO 3166. The following translation teams exist, as of February
|
||||
in ISO 3166. The following translation teams exist, as of December
|
||||
1997:
|
||||
|
||||
Arabic `ar', Chinese `zh', Czech `cs', Danish `da', Dutch `nl',
|
||||
English `en', Esperanto `eo', Finnish `fi', French `fr', German
|
||||
`de', Greek `el', Hebrew `he', Hungarian `hu', Irish `ga', Italian
|
||||
`it', Indonesian `id', Japanese `ja', Korean `ko', Latin `la',
|
||||
Norwegian `no', Persian `fa', Polish `pl', Portuguese `pt',
|
||||
Russian `ru', Slovenian `sl', Spanish `es', Swedish `sv', Telugu
|
||||
`te', Turkish `tr' and Ukrainian `uk'.
|
||||
Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en',
|
||||
Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian
|
||||
`hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja',
|
||||
Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish
|
||||
`pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es',
|
||||
Swedish `sv', and Turkish `tr'.
|
||||
|
||||
For example, you may reach the Chinese translation team by writing to
|
||||
`zh@li.org'.
|
||||
@@ -160,55 +162,53 @@ message to `sv-request@li.org', having this message body:
|
||||
*actively* in translations, or at solving translational difficulties,
|
||||
rather than merely lurking around. If your team does not exist yet and
|
||||
you want to start one, or if you are unsure about what to do or how to
|
||||
get started, please write to `gnu-translation@gnu.ai.mit.edu' to reach
|
||||
the GNU coordinator for all translator teams.
|
||||
get started, please write to `translation@iro.umontreal.ca' to reach the
|
||||
coordinator for all translator teams.
|
||||
|
||||
The English team is special. It works at improving and uniformizing
|
||||
the terminology used in GNU. Proven linguistic skill are praised more
|
||||
than programming skill, here. For the time being, please avoid
|
||||
subscribing to the English team unless explicitly invited to do so.
|
||||
the terminology in use. Proven linguistic skill are praised more than
|
||||
programming skill, here.
|
||||
|
||||
Available Packages
|
||||
==================
|
||||
|
||||
Languages are not equally supported in all GNU packages. The
|
||||
following matrix shows the current state of GNU internationalization,
|
||||
as of February 1997. The matrix shows, in regard of each package, for
|
||||
which languages PO files have been submitted to translation
|
||||
coordination.
|
||||
Languages are not equally supported in all packages. The following
|
||||
matrix shows the current state of internationalization, as of December
|
||||
1997. The matrix shows, in regard of each package, for which languages
|
||||
PO files have been submitted to translation coordination.
|
||||
|
||||
Ready PO files cs de en es fi fr ja ko nl no pl pt sl sv
|
||||
.-------------------------------------------.
|
||||
bash | [] [] [] | 3
|
||||
bison | [] [] [] | 3
|
||||
clisp | [] [] [] | 3
|
||||
cpio | [] [] [] [] [] | 5
|
||||
diffutils | [] [] [] [] | 4
|
||||
enscript | [] [] [] [] [] | 5
|
||||
fileutils | [] [] [] [] [] [] [] [] | 8
|
||||
findutils | [] [] [] [] [] [] [] | 7
|
||||
flex | [] [] [] | 3
|
||||
gcal | [] [] [] | 3
|
||||
gettext | [] [] [] [] [] [] [] [] [] [] | 11
|
||||
grep | [] [] [] [] [] [] [] [] | 8
|
||||
hello | [] [] [] [] [] [] [] [] [] [] | 10
|
||||
id-utils | [] [] | 2
|
||||
indent | [] [] | 2
|
||||
libc | [] [] [] [] [] [] [] | 7
|
||||
m4 | [] [] [] [] [] | 5
|
||||
make | [] [] [] [] [] [] | 6
|
||||
music | [] | 1
|
||||
ptx | [] [] [] [] [] [] [] [] | 8
|
||||
recode | [] [] [] [] [] [] [] [] | 8
|
||||
sh-utils | [] [] [] [] [] | 5
|
||||
sharutils | [] [] [] [] [] | 5
|
||||
tar | [] [] [] [] [] [] [] [] [] | 9
|
||||
texinfo | | 0
|
||||
textutils | [] [] [] [] [] [] | 6
|
||||
wdiff | [] [] [] [] [] [] [] [] | 8
|
||||
`-------------------------------------------'
|
||||
14 languages cs de en es fi fr ja ko nl no pl pt sl sv
|
||||
27 packages 1 22 1 14 1 25 1 10 20 7 14 7 7 15 145
|
||||
Ready PO files cs da de en es fi fr it ja ko nl no pl pt ru sl sv
|
||||
.----------------------------------------------------.
|
||||
bash | [] [] [] | 3
|
||||
bison | [] [] [] | 3
|
||||
clisp | [] [] [] [] | 4
|
||||
cpio | [] [] [] [] [] [] | 6
|
||||
diffutils | [] [] [] [] [] | 5
|
||||
enscript | [] [] [] [] [] [] | 6
|
||||
fileutils | [] [] [] [] [] [] [] [] [] [] | 10
|
||||
findutils | [] [] [] [] [] [] [] [] [] | 9
|
||||
flex | [] [] [] [] | 4
|
||||
gcal | [] [] [] [] [] | 5
|
||||
gettext | [] [] [] [] [] [] [] [] [] [] [] | 12
|
||||
grep | [] [] [] [] [] [] [] [] [] [] | 10
|
||||
hello | [] [] [] [] [] [] [] [] [] [] [] | 11
|
||||
id-utils | [] [] [] | 3
|
||||
indent | [] [] [] [] [] | 5
|
||||
libc | [] [] [] [] [] [] [] | 7
|
||||
m4 | [] [] [] [] [] [] | 6
|
||||
make | [] [] [] [] [] [] | 6
|
||||
music | [] [] | 2
|
||||
ptx | [] [] [] [] [] [] [] [] | 8
|
||||
recode | [] [] [] [] [] [] [] [] [] | 9
|
||||
sh-utils | [] [] [] [] [] [] [] [] | 8
|
||||
sharutils | [] [] [] [] [] [] | 6
|
||||
tar | [] [] [] [] [] [] [] [] [] [] [] | 11
|
||||
texinfo | [] [] [] | 3
|
||||
textutils | [] [] [] [] [] [] [] [] [] | 9
|
||||
wdiff | [] [] [] [] [] [] [] [] | 8
|
||||
`----------------------------------------------------'
|
||||
17 languages cs da de en es fi fr it ja ko nl no pl pt ru sl sv
|
||||
27 packages 6 4 25 1 18 1 26 2 1 12 20 9 19 7 4 7 17 179
|
||||
|
||||
Some counters in the preceding matrix are higher than the number of
|
||||
visible blocks let us expect. This is because a few extra PO files are
|
||||
@@ -219,8 +219,8 @@ dialects.
|
||||
which it applies should also have been internationalized and
|
||||
distributed as such by its maintainer. There might be an observable
|
||||
lag between the mere existence a PO file and its wide availability in a
|
||||
GNU distribution.
|
||||
distribution.
|
||||
|
||||
If February 1997 seems to be old, you may fetch a more recent copy
|
||||
If December 1997 seems to be old, you may fetch a more recent copy
|
||||
of this `ABOUT-NLS' file on most GNU archive sites.
|
||||
|
||||
|
||||
20
GNUmakefile
20
GNUmakefile
@@ -1,7 +1,23 @@
|
||||
# Having a separate GNUmakefile lets me `include' the dynamically
|
||||
# generated rules created via Makefile.maint as well as Makefile.maint itself.
|
||||
# This makefile is used only if you run GNU Make.
|
||||
# It is necessary if you modify files in the m4/ directory or
|
||||
# want to build targets usually of interest only to the maintainer.
|
||||
# It is necessary if you want to build targets usually of interest
|
||||
# only to the maintainer.
|
||||
|
||||
have-Makefile := $(shell test -f Makefile && echo yes)
|
||||
|
||||
# If the user runs GNU make but has not yet run ./configure,
|
||||
# give them a diagnostic.
|
||||
ifeq ($(have-Makefile),yes)
|
||||
|
||||
include Makefile
|
||||
include $(srcdir)/Makefile.maint
|
||||
|
||||
else
|
||||
|
||||
all:
|
||||
@echo There seems to be no Makefile in this directory.
|
||||
@echo "You must run ./configure before running \`make'."
|
||||
@exit 1
|
||||
|
||||
endif
|
||||
|
||||
@@ -32,7 +32,7 @@ my-distcheck: dist
|
||||
mkdir $(t)
|
||||
GZIP=$(GZIP) $(TAR) -C $(t) -zxf $(distdir).tar.gz
|
||||
cd $(t)/$(distdir) \
|
||||
&& ./configure --disable-gettext \
|
||||
&& ./configure --disable-nls \
|
||||
&& $(MAKE) \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(MAKE) check \
|
||||
@@ -42,21 +42,3 @@ my-distcheck: dist
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "========================"
|
||||
|
||||
acdir = m4
|
||||
aclocal-files: configure.in m4/Makefile.am
|
||||
echo "acfiles = \\" > $@-tmp
|
||||
(cd $(srcdir) && find $(acdir) -type f -name '*.m4' -print) \
|
||||
| sed 's!^!$(top_srcdir)/!' \
|
||||
| tr '\012' ' ' \
|
||||
| fmt \
|
||||
| sed -e 's/$$/ \\/' -e '$$s/..$$//' \
|
||||
>> $@-tmp
|
||||
echo >> $@-tmp
|
||||
mv $@-tmp $@
|
||||
|
||||
-include aclocal-files
|
||||
|
||||
# Override default rule to use --acdir option
|
||||
$(srcdir)/aclocal.m4: configure.in $(acfiles)
|
||||
cd $(srcdir) && aclocal -I $(acdir)
|
||||
|
||||
5
THANKS
5
THANKS
@@ -8,19 +8,24 @@ Bauke Jan Douma: bjdouma@xs4all.nl
|
||||
Bengt Martensson: bengt@mathematik.uni-Bremen.de
|
||||
Bjorn Helgaas: helgaas@rsn.hp.com
|
||||
Charles Karney: karney@pppl.gov
|
||||
Dirk Lattermann: dlatt@t-online.de
|
||||
Don Parsons: dparsons@synapse.kent.edu
|
||||
Eirik Fuller: eirik@netcom.com
|
||||
Eli Zaretskii: eliz@is.elta.co.il
|
||||
Emile LeBlanc: leblanc@math.toronto.edu
|
||||
François Pinard: pinard@iro.umontreal.ca
|
||||
Galen Hazelwood: galenh@micron.net
|
||||
Göran Uddeborg: goeran@uddeborg.pp.se
|
||||
Greg McGary: gkm@eng.ascend.com
|
||||
Hugh Daniel: hugh@xanadu.com
|
||||
James: james@albion.glarp.com
|
||||
James Antill: jmanti%essex.ac.uk@seralph21.essex.ac.uk
|
||||
James Tanis: jtt@soscorp.com
|
||||
Jesse Thilo: jgt2@eecs.lehigh.edu
|
||||
Joakim Rosqvist: dvljrt@cs.umu.se
|
||||
John Gatewood Ham: zappaman@alphabox.compsci.buu.ac.th
|
||||
Kjetil Torgrim Homme: kjetilho@ifi.uio.no
|
||||
Lorne Baker: lbaker@nitro.avint.net
|
||||
Marcus Daniels: marcus@sysc.pdx.edu
|
||||
Mark A. Thomas: thommark@access.digex.net
|
||||
Mark Harris: mark@monitor.designacc.com
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
@@ -32,6 +31,8 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -66,6 +67,7 @@ GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
@@ -111,14 +113,14 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
default: all
|
||||
all: Makefile $(INFO_DEPS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .dvi .info .ps .texi .texinfo .txi
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits doc/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
@@ -198,21 +200,21 @@ DVIPS = dvips
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(infodir)
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir)
|
||||
@for file in $(INFO_DEPS); do \
|
||||
d=$(srcdir); \
|
||||
for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
|
||||
if test -f $$d/$$ifile; then \
|
||||
echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \
|
||||
echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
for file in $(INFO_DEPS); do \
|
||||
echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\
|
||||
install-info --info-dir=$(infodir) $(infodir)/$$file || :;\
|
||||
echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
|
||||
install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
|
||||
done; \
|
||||
else : ; fi
|
||||
|
||||
@@ -223,11 +225,11 @@ uninstall-info:
|
||||
else ii=; fi; \
|
||||
for file in $(INFO_DEPS); do \
|
||||
test -z "$ii" \
|
||||
|| install-info --info-dir=$(infodir) --remove $$file; \
|
||||
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
|
||||
done
|
||||
@$(NORMAL_UNINSTALL)
|
||||
for file in $(INFO_DEPS); do \
|
||||
(cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
(cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
@@ -295,12 +297,10 @@ install: install-exec install-data all
|
||||
|
||||
uninstall: uninstall-info
|
||||
|
||||
all: Makefile $(INFO_DEPS)
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(infodir)
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
@@ -329,11 +329,11 @@ maintainer-clean: maintainer-clean-vti maintainer-clean-aminfo \
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default mostlyclean-vti distclean-vti clean-vti \
|
||||
maintainer-clean-vti install-info-am uninstall-info mostlyclean-aminfo \
|
||||
distclean-aminfo clean-aminfo maintainer-clean-aminfo tags distdir info \
|
||||
dvi installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
.PHONY: mostlyclean-vti distclean-vti clean-vti maintainer-clean-vti \
|
||||
install-info-am uninstall-info mostlyclean-aminfo distclean-aminfo \
|
||||
clean-aminfo maintainer-clean-aminfo tags distdir info dvi installcheck \
|
||||
install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
|
||||
@@ -467,15 +467,15 @@ year.
|
||||
@cindex MacKenzie, David
|
||||
@cindex Meyering, Jim
|
||||
@code{getdate} was originally implemented by Steven M. Bellovin
|
||||
(@samp{smb@@research.att.com}) while at the University of North Carolina
|
||||
(@email{smb@@research.att.com}) while at the University of North Carolina
|
||||
at Chapel Hill. The code was later tweaked by a couple of people on
|
||||
Usenet, then completely overhauled by Rich $alz (@samp{rsalz@@bbn.com})
|
||||
and Jim Berets (@samp{jberets@@bbn.com}) in August, 1990. Various
|
||||
Usenet, then completely overhauled by Rich $alz (@email{rsalz@@bbn.com})
|
||||
and Jim Berets (@email{jberets@@bbn.com}) in August, 1990. Various
|
||||
revisions for the GNU system were made by David MacKenzie, Jim Meyering,
|
||||
and others.
|
||||
|
||||
@cindex Pinard, F.
|
||||
@cindex Berry, K.
|
||||
This chapter was originally produced by Fran@,{c}ois Pinard
|
||||
(@samp{pinard@@iro.umontreal.ca}) from the @file{getdate.y} source code,
|
||||
and then edited by K.@: Berry (@samp{kb@@cs.umb.edu}).
|
||||
(@email{pinard@@iro.umontreal.ca}) from the @file{getdate.y} source code,
|
||||
and then edited by K.@: Berry (@email{kb@@cs.umb.edu}).
|
||||
|
||||
@@ -1140,15 +1140,16 @@ The only options are a lone @samp{--help} or
|
||||
Synopses:
|
||||
|
||||
@example
|
||||
stty [@var{setting}]@dots{}
|
||||
stty [@var{option}] [@var{setting}]@dots{}
|
||||
stty [@var{option}]
|
||||
@end example
|
||||
|
||||
If given no arguments, @code{stty} prints the baud rate, line
|
||||
If given no line settings, @code{stty} prints the baud rate, line
|
||||
discipline number (on systems that support it), and line settings
|
||||
that have been changed from the values set by @samp{stty sane}.
|
||||
Mode reading and setting are performed on the tty line connected to
|
||||
standard input.
|
||||
By default, mode reading and setting are performed on the tty line
|
||||
connected to standard input, although this can be modified by the
|
||||
@samp{--file} option.
|
||||
|
||||
@code{stty} accepts many non-option arguments that change aspects of
|
||||
the terminal line operation, as described below.
|
||||
@@ -1160,7 +1161,19 @@ The program accepts the following options. Also see @ref{Common options}.
|
||||
@itemx --all
|
||||
@opindex -a
|
||||
@opindex --all
|
||||
Print all current settings in human-readable form.
|
||||
Print all current settings in human-readable form. This option may not
|
||||
be used in combination with any line settings.
|
||||
|
||||
@item -F @var{device}
|
||||
@itemx --file @var{device}
|
||||
@opindex -F
|
||||
@opindex --file
|
||||
Set the line opened by the filename specified in @var{device} instead of
|
||||
the tty line connected to standard input. This option is necessary
|
||||
because opening a POSIX tty requires use of the @code{O_NONDELAY} flag to
|
||||
prevent a POSIX tty from blocking until the carrier detect line is high if
|
||||
the @code{clocal} flag is not set. Hence, it is not always possible
|
||||
to allow the shell to open the device in the traditional manner.
|
||||
|
||||
@item -g
|
||||
@itemx --save
|
||||
@@ -1168,7 +1181,8 @@ Print all current settings in human-readable form.
|
||||
@opindex --save
|
||||
@cindex machine-readable @code{stty} output
|
||||
Print all current settings in a form that can be used as an argument to
|
||||
another @code{stty} command to restore the current settings.
|
||||
another @code{stty} command to restore the current settings. This option
|
||||
may not be used in combination with any line settings.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
455
doc/texinfo.tex
455
doc/texinfo.tex
@@ -1,32 +1,56 @@
|
||||
%% TeX macros to handle Texinfo files.
|
||||
%% $Id: texinfo.tex,v 1.16 1997/12/25 18:00:21 meyering Exp $
|
||||
|
||||
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
|
||||
% 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
|
||||
%This texinfo.tex file is free software; you can redistribute it and/or
|
||||
%modify it under the terms of the GNU General Public License as
|
||||
%published by the Free Software Foundation; either version 2, or (at
|
||||
%your option) any later version.
|
||||
|
||||
%This texinfo.tex file 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 texinfo.tex file; see the file COPYING. If not, write
|
||||
%to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
%Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
%In other words, you are welcome to use, share and improve this program.
|
||||
%You are forbidden to forbid anyone else to use, share and improve
|
||||
%what you give them. Help stamp out software-hoarding!
|
||||
|
||||
|
||||
% Send bug reports to bug-texinfo@prep.ai.mit.edu.
|
||||
% Please include a *precise* test case in each bug report.
|
||||
% texinfo.tex -- TeX macros to handle Texinfo files.
|
||||
% $Id: texinfo.tex,v 1.17 1998/04/11 15:03:51 meyering Exp $
|
||||
%
|
||||
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98
|
||||
% Free Software Foundation, Inc.
|
||||
%
|
||||
% This texinfo.tex file is free software; you can redistribute it and/or
|
||||
% modify it under the terms of the GNU General Public License as
|
||||
% published by the Free Software Foundation; either version 2, or (at
|
||||
% your option) any later version.
|
||||
%
|
||||
% This texinfo.tex file 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 texinfo.tex file; see the file COPYING. If not, write
|
||||
% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
% Boston, MA 02111-1307, USA.
|
||||
%
|
||||
% In other words, you are welcome to use, share and improve this program.
|
||||
% You are forbidden to forbid anyone else to use, share and improve
|
||||
% what you give them. Help stamp out software-hoarding!
|
||||
%
|
||||
% Please try the latest version of texinfo.tex before submitting bug
|
||||
% reports; you can get the latest version from:
|
||||
% /home/gd/gnu/doc/texinfo.tex on the GNU machines.
|
||||
% ftp://ftp.gnu.org/pub/gnu/texinfo.tex
|
||||
% (and all GNU mirrors)
|
||||
% ftp://tug.org/tex/texinfo.tex
|
||||
% ftp://ctan.org/macros/texinfo/texinfo.tex
|
||||
% (and all CTAN mirrors, finger ctan@tug.org for a list).
|
||||
%
|
||||
% Send bug reports to bug-texinfo@gnu.org.
|
||||
% Please include a precise test case in each bug report,
|
||||
% including a complete document with which we can reproduce the problem.
|
||||
%
|
||||
% Texinfo macros (with @macro) are *not* supported by texinfo.tex. You
|
||||
% have to run makeinfo -E to expand macros first; the texi2dvi script
|
||||
% does this.
|
||||
%
|
||||
% To process a Texinfo manual with TeX, it's most reliable to use the
|
||||
% texi2dvi shell script that comes with the distribution. For simple
|
||||
% manuals, you can get away with:
|
||||
% tex foo.texi
|
||||
% texindex foo.??
|
||||
% tex foo.texi
|
||||
% tex foo.texi
|
||||
% dvips foo.dvi -o # or whatever, to process the dvi file.
|
||||
% The extra runs of TeX get the cross-reference information correct.
|
||||
% Sometimes one run after texindex suffices, and sometimes you need more
|
||||
% than two; texi2dvi does it as many times as necessary.
|
||||
|
||||
|
||||
% Make it possible to create a .fmt file just by loading this file:
|
||||
@@ -36,7 +60,7 @@
|
||||
|
||||
% This automatically updates the version number based on RCS.
|
||||
\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
|
||||
\deftexinfoversion$Revision: 1.16 $
|
||||
\deftexinfoversion$Revision: 1.17 $
|
||||
\message{Loading texinfo package [Version \texinfoversion]:}
|
||||
|
||||
% If in a .fmt file, print the version number
|
||||
@@ -54,24 +78,17 @@
|
||||
\let\ptexdot=\.
|
||||
\let\ptexdots=\dots
|
||||
\let\ptexend=\end
|
||||
\let\ptexequiv = \equiv
|
||||
\let\ptexequiv=\equiv
|
||||
\let\ptexexclam=\!
|
||||
\let\ptexi=\i
|
||||
\let\ptexlbrace=\{
|
||||
\let\ptexrbrace=\}
|
||||
\let\ptexstar=\*
|
||||
\let\ptext=\t
|
||||
|
||||
% Be sure we're in horizontal mode when doing a tie, since we make space
|
||||
% equivalent to this in @example-like environments. Otherwise, a space
|
||||
% at the beginning of a line will start with \penalty -- and
|
||||
% since \penalty is valid in vertical mode, we'd end up putting the
|
||||
% penalty on the vertical list instead of in the new paragraph.
|
||||
{\catcode`@ = 11
|
||||
% Avoid using \@M directly, because that causes trouble
|
||||
% if the definition is written into an index file.
|
||||
\global\let\tiepenalty = \@M
|
||||
\gdef\tie{\leavevmode\penalty\tiepenalty\ }
|
||||
}
|
||||
% We never want plain's outer \+ definition in Texinfo.
|
||||
% For @tex, we can use \tabalign.
|
||||
\let\+ = \relax
|
||||
|
||||
|
||||
\message{Basics,}
|
||||
@@ -384,7 +401,7 @@
|
||||
|
||||
% @@ prints an @
|
||||
% Kludge this until the fonts are right (grr).
|
||||
\def\@{{\tt \char '100}}
|
||||
\def\@{{\tt\char64}}
|
||||
|
||||
% This is turned off because it was never documented
|
||||
% and you can use @w{...} around a quote to suppress ligatures.
|
||||
@@ -394,8 +411,8 @@
|
||||
%\def\'{{'}}
|
||||
|
||||
% Used to generate quoted braces.
|
||||
\def\mylbrace {{\tt \char '173}}
|
||||
\def\myrbrace {{\tt \char '175}}
|
||||
\def\mylbrace {{\tt\char123}}
|
||||
\def\myrbrace {{\tt\char125}}
|
||||
\let\{=\mylbrace
|
||||
\let\}=\myrbrace
|
||||
\begingroup
|
||||
@@ -432,6 +449,18 @@
|
||||
\fi\fi
|
||||
}
|
||||
|
||||
% Be sure we're in horizontal mode when doing a tie, since we make space
|
||||
% equivalent to this in @example-like environments. Otherwise, a space
|
||||
% at the beginning of a line will start with \penalty -- and
|
||||
% since \penalty is valid in vertical mode, we'd end up putting the
|
||||
% penalty on the vertical list instead of in the new paragraph.
|
||||
{\catcode`@ = 11
|
||||
% Avoid using \@M directly, because that causes trouble
|
||||
% if the definition is written into an index file.
|
||||
\global\let\tiepenalty = \@M
|
||||
\gdef\tie{\leavevmode\penalty\tiepenalty\ }
|
||||
}
|
||||
|
||||
% @: forces normal size whitespace following.
|
||||
\def\:{\spacefactor=1000 }
|
||||
|
||||
@@ -763,6 +792,7 @@ where each line of input produces a line of output.}
|
||||
% Also ignore @macro ... @end macro. The user must run texi2dvi,
|
||||
% which runs makeinfo to do macro expansion. Ignore @unmacro, too.
|
||||
\def\macro{\doignore{macro}}
|
||||
\def\macrocsname{macro}
|
||||
\let\unmacro = \comment
|
||||
|
||||
|
||||
@@ -777,7 +807,9 @@ where each line of input produces a line of output.}
|
||||
\ignoresections
|
||||
%
|
||||
% Define a command to swallow text until we reach `@end #1'.
|
||||
\long\def\doignoretext##1\end #1{\enddoignore}%
|
||||
% This @ is a catcode 12 token (that is the normal catcode of @ in
|
||||
% this texinfo.tex file). We change the catcode of @ below to match.
|
||||
\long\def\doignoretext##1@end #1{\enddoignore}%
|
||||
%
|
||||
% Make sure that spaces turn into tokens that match what \doignoretext wants.
|
||||
\catcode32 = 10
|
||||
@@ -786,6 +818,22 @@ where each line of input produces a line of output.}
|
||||
\catcode`\{ = 9
|
||||
\catcode`\} = 9
|
||||
%
|
||||
% We must not have @c interpreted as a control sequence.
|
||||
\catcode`\@ = 12
|
||||
%
|
||||
% Make the letter c a comment character so that the rest of the line
|
||||
% will be ignored. This way, the document can have (for example)
|
||||
% @c @end ifinfo
|
||||
% and the @end ifinfo will be properly ignored.
|
||||
% (We've just changed @ to catcode 12.)
|
||||
%
|
||||
% But we can't do this if #1 is `macro', since that actually contains a c.
|
||||
% Happily, none of the other conditionals have the letter `c' in their names!
|
||||
\def\temp{#1}%
|
||||
\ifx\temp\macrocsname \else
|
||||
\catcode`\c = 14
|
||||
\fi
|
||||
%
|
||||
% And now expand that command.
|
||||
\doignoretext
|
||||
}
|
||||
@@ -1278,6 +1326,10 @@ where each line of input produces a line of output.}
|
||||
%
|
||||
\textfonts
|
||||
|
||||
% Define these so they can be easily changed for other fonts.
|
||||
\def\angleleft{$\langle$}
|
||||
\def\angleright{$\rangle$}
|
||||
|
||||
% Count depth in font-changes, for error checks
|
||||
\newcount\fontdepth \fontdepth=0
|
||||
|
||||
@@ -1315,15 +1367,15 @@ where each line of input produces a line of output.}
|
||||
\null
|
||||
}
|
||||
\let\ttfont=\t
|
||||
\def\samp #1{`\tclose{#1}'\null}
|
||||
\def\samp#1{`\tclose{#1}'\null}
|
||||
\setfont\smallrm\rmshape{8}{1000}
|
||||
\font\smallsy=cmsy9
|
||||
\def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
|
||||
\raise0.4pt\hbox{$\langle$}\kern-.08em\vtop{%
|
||||
\raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
|
||||
\vbox{\hrule\kern-0.4pt
|
||||
\hbox{\raise0.4pt\hbox{\vphantom{$\langle$}}#1}}%
|
||||
\hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
|
||||
\kern-0.4pt\hrule}%
|
||||
\kern-.06em\raise0.4pt\hbox{$\rangle$}}}}
|
||||
\kern-.06em\raise0.4pt\hbox{\angleright}}}}
|
||||
% The old definition, with no lozenge:
|
||||
%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
|
||||
\def\ctrl #1{{\tt \rawbackslash \hat}#1}
|
||||
@@ -1436,7 +1488,7 @@ where each line of input produces a line of output.}
|
||||
|
||||
% rms does not like the angle brackets --karl, 17may97.
|
||||
% So now @email is just like @uref.
|
||||
%\def\email#1{$\langle${\tt #1}$\rangle$}
|
||||
%\def\email#1{\angleleft{\tt #1}\angleright}
|
||||
\let\email=\uref
|
||||
|
||||
% Check if we are currently using a typewriter font. Since all the
|
||||
@@ -1689,18 +1741,6 @@ July\or August\or September\or October\or November\or December\fi
|
||||
|
||||
|
||||
\message{tables,}
|
||||
|
||||
% @tabs -- simple alignment
|
||||
|
||||
% These don't work. For one thing, \+ is defined as outer.
|
||||
% So these macros cannot even be defined.
|
||||
|
||||
%\def\tabs{\parsearg\tabszzz}
|
||||
%\def\tabszzz #1{\settabs\+#1\cr}
|
||||
%\def\tabline{\parsearg\tablinezzz}
|
||||
%\def\tablinezzz #1{\+#1\cr}
|
||||
%\def\&{&}
|
||||
|
||||
% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
|
||||
|
||||
% default indentation of table text
|
||||
@@ -2058,10 +2098,7 @@ July\or August\or September\or October\or November\or December\fi
|
||||
% @multitablelinespace is space to leave between table items, baseline
|
||||
% to baseline.
|
||||
% 0pt means it depends on current normal line spacing.
|
||||
|
||||
%%%%
|
||||
% Dimensions
|
||||
|
||||
%
|
||||
\newskip\multitableparskip
|
||||
\newskip\multitableparindent
|
||||
\newdimen\multitablecolspace
|
||||
@@ -2071,15 +2108,15 @@ July\or August\or September\or October\or November\or December\fi
|
||||
\multitablecolspace=12pt
|
||||
\multitablelinespace=0pt
|
||||
|
||||
%%%%
|
||||
% Macros used to set up halign preamble:
|
||||
%
|
||||
\let\endsetuptable\relax
|
||||
\def\xendsetuptable{\endsetuptable}
|
||||
\let\columnfractions\relax
|
||||
\def\xcolumnfractions{\columnfractions}
|
||||
\newif\ifsetpercent
|
||||
|
||||
%% 2/1/96, to allow fractions to be given with more than one digit.
|
||||
% 2/1/96, to allow fractions to be given with more than one digit.
|
||||
\def\pickupwholefraction#1 {\global\advance\colcount by1 %
|
||||
\expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
|
||||
\setuptable}
|
||||
@@ -2105,80 +2142,84 @@ July\or August\or September\or October\or November\or December\fi
|
||||
\ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
|
||||
\fi\go}
|
||||
|
||||
%%%%
|
||||
% multitable syntax
|
||||
\def\tab{&\hskip1sp\relax} % 2/2/96
|
||||
% tiny skip here makes sure this column space is
|
||||
% maintained, even if it is never used.
|
||||
|
||||
|
||||
%%%%
|
||||
% @multitable ... @end multitable definitions:
|
||||
|
||||
\def\multitable{\parsearg\dotable}
|
||||
|
||||
\def\dotable#1{\bgroup
|
||||
\let\item\cr
|
||||
\tolerance=9500
|
||||
\hbadness=9500
|
||||
\setmultitablespacing
|
||||
\parskip=\multitableparskip
|
||||
\parindent=\multitableparindent
|
||||
\overfullrule=0pt
|
||||
\global\colcount=0\relax%
|
||||
\def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
|
||||
% To parse everything between @multitable and @item :
|
||||
\setuptable#1 \endsetuptable
|
||||
% Need to reset this to 0 after \setuptable.
|
||||
\global\colcount=0\relax%
|
||||
%
|
||||
% This preamble sets up a generic column definition, which will
|
||||
% be used as many times as user calls for columns.
|
||||
% \vtop will set a single line and will also let text wrap and
|
||||
% continue for many paragraphs if desired.
|
||||
\halign\bgroup&\global\advance\colcount by 1\relax%
|
||||
\multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
|
||||
% In order to keep entries from bumping into each other
|
||||
% we will add a \leftskip of \multitablecolspace to all columns after
|
||||
% the first one.
|
||||
% If a template has been used, we will add \multitablecolspace
|
||||
% to the width of each template entry.
|
||||
% If user has set preamble in terms of percent of \hsize
|
||||
% we will use that dimension as the width of the column, and
|
||||
% the \leftskip will keep entries from bumping into each other.
|
||||
% Table will start at left margin and final column will justify at
|
||||
% right margin.
|
||||
\ifnum\colcount=1
|
||||
\else
|
||||
\ifsetpercent
|
||||
\vskip\parskip
|
||||
\let\item\crcr
|
||||
\tolerance=9500
|
||||
\hbadness=9500
|
||||
\setmultitablespacing
|
||||
\parskip=\multitableparskip
|
||||
\parindent=\multitableparindent
|
||||
\overfullrule=0pt
|
||||
\global\colcount=0
|
||||
\def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
|
||||
%
|
||||
% To parse everything between @multitable and @item:
|
||||
\setuptable#1 \endsetuptable
|
||||
%
|
||||
% \everycr will reset column counter, \colcount, at the end of
|
||||
% each line. Every column entry will cause \colcount to advance by one.
|
||||
% The table preamble
|
||||
% looks at the current \colcount to find the correct column width.
|
||||
\everycr{\noalign{%
|
||||
%
|
||||
% \filbreak%% keeps underfull box messages off when table breaks over pages.
|
||||
% Maybe so, but it also creates really weird page breaks when the table
|
||||
% breaks over pages. Wouldn't \vfil be better? Wait until the problem
|
||||
% manifests itself, so it can be fixed for real --karl.
|
||||
\global\colcount=0\relax}}%
|
||||
%
|
||||
% This preamble sets up a generic column definition, which will
|
||||
% be used as many times as user calls for columns.
|
||||
% \vtop will set a single line and will also let text wrap and
|
||||
% continue for many paragraphs if desired.
|
||||
\halign\bgroup&\global\advance\colcount by 1\relax
|
||||
\multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
|
||||
%
|
||||
% In order to keep entries from bumping into each other
|
||||
% we will add a \leftskip of \multitablecolspace to all columns after
|
||||
% the first one.
|
||||
%
|
||||
% If a template has been used, we will add \multitablecolspace
|
||||
% to the width of each template entry.
|
||||
%
|
||||
% If the user has set preamble in terms of percent of \hsize we will
|
||||
% use that dimension as the width of the column, and the \leftskip
|
||||
% will keep entries from bumping into each other. Table will start at
|
||||
% left margin and final column will justify at right margin.
|
||||
%
|
||||
% Make sure we don't inherit \rightskip from the outer environment.
|
||||
\rightskip=0pt
|
||||
\ifnum\colcount=1
|
||||
% The first column will be indented with the surrounding text.
|
||||
\advance\hsize by\leftskip
|
||||
\else
|
||||
% If user has <not> set preamble in terms of percent of \hsize
|
||||
% we will advance \hsize by \multitablecolspace
|
||||
\advance\hsize by \multitablecolspace
|
||||
\ifsetpercent \else
|
||||
% If user has not set preamble in terms of percent of \hsize
|
||||
% we will advance \hsize by \multitablecolspace.
|
||||
\advance\hsize by \multitablecolspace
|
||||
\fi
|
||||
% In either case we will make \leftskip=\multitablecolspace:
|
||||
\leftskip=\multitablecolspace
|
||||
\fi
|
||||
% In either case we will make \leftskip=\multitablecolspace:
|
||||
\leftskip=\multitablecolspace
|
||||
\fi
|
||||
% Ignoring space at the beginning and end avoids an occasional spurious
|
||||
% blank line, when TeX decides to break the line at the space before the
|
||||
% box from the multistrut, so the strut ends up on a line by itself.
|
||||
% For example:
|
||||
% @multitable @columnfractions .11 .89
|
||||
% @item @code{#}
|
||||
% @tab Legal holiday which is valid in major parts of the whole country.
|
||||
% Is automatically provided with highlighting sequences respectively marking
|
||||
% characters.
|
||||
\noindent\ignorespaces##\unskip\multistrut}\cr
|
||||
% \everycr will reset column counter, \colcount, at the end of
|
||||
% each line. Every column entry will cause \colcount to advance by one.
|
||||
% The table preamble
|
||||
% looks at the current \colcount to find the correct column width.
|
||||
\global\everycr{\noalign{%
|
||||
% \filbreak%% keeps underfull box messages off when table breaks over pages.
|
||||
% Maybe so, but it also creates really weird page breaks when the table
|
||||
% breaks over pages Wouldn't \vfil be better? Wait until the problem
|
||||
% manifests itself, so it can be fixed for real --karl.
|
||||
\global\colcount=0\relax}}
|
||||
% Ignoring space at the beginning and end avoids an occasional spurious
|
||||
% blank line, when TeX decides to break the line at the space before the
|
||||
% box from the multistrut, so the strut ends up on a line by itself.
|
||||
% For example:
|
||||
% @multitable @columnfractions .11 .89
|
||||
% @item @code{#}
|
||||
% @tab Legal holiday which is valid in major parts of the whole country.
|
||||
% Is automatically provided with highlighting sequences respectively marking
|
||||
% characters.
|
||||
\noindent\ignorespaces##\unskip\multistrut}\cr
|
||||
}
|
||||
|
||||
\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
|
||||
@@ -2246,20 +2287,24 @@ width0pt\relax} \fi
|
||||
|
||||
% @synindex foo bar makes index foo feed into index bar.
|
||||
% Do this instead of @defindex foo if you don't want it as a separate index.
|
||||
\def\synindex #1 #2 {%
|
||||
\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
|
||||
\expandafter\let\csname#1indfile\endcsname=\synindexfoo
|
||||
\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
|
||||
\noexpand\doindex {#2}}%
|
||||
% The \closeout helps reduce unnecessary open files; the limit on the
|
||||
% Acorn RISC OS is a mere 16 files.
|
||||
\def\synindex#1 #2 {%
|
||||
\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
|
||||
\expandafter\closeout\csname#1indfile\endcsname
|
||||
\expandafter\let\csname#1indfile\endcsname=\synindexfoo
|
||||
\expandafter\xdef\csname#1index\endcsname{% define \xxxindex
|
||||
\noexpand\doindex{#2}}%
|
||||
}
|
||||
|
||||
% @syncodeindex foo bar similar, but put all entries made for index foo
|
||||
% inside @code.
|
||||
\def\syncodeindex #1 #2 {%
|
||||
\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
|
||||
\expandafter\let\csname#1indfile\endcsname=\synindexfoo
|
||||
\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
|
||||
\noexpand\docodeindex {#2}}%
|
||||
\def\syncodeindex#1 #2 {%
|
||||
\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
|
||||
\expandafter\closeout\csname#1indfile\endcsname
|
||||
\expandafter\let\csname#1indfile\endcsname=\synindexfoo
|
||||
\expandafter\xdef\csname#1index\endcsname{% define \xxxindex
|
||||
\noexpand\docodeindex{#2}}%
|
||||
}
|
||||
|
||||
% Define \doindex, the driver for all \fooindex macros.
|
||||
@@ -2525,6 +2570,11 @@ width0pt\relax} \fi
|
||||
\indexbreaks
|
||||
%
|
||||
% See if the index file exists and is nonempty.
|
||||
% Change catcode of @ here so that if the index file contains
|
||||
% \initial {@}
|
||||
% as its first line, TeX doesn't complain about mismatched braces
|
||||
% (because it thinks @} is a control sequence).
|
||||
\catcode`\@ = 11
|
||||
\openin 1 \jobname.#1s
|
||||
\ifeof 1
|
||||
% \enddoublecolumns gets confused if there is no text in the index,
|
||||
@@ -2546,7 +2596,6 @@ width0pt\relax} \fi
|
||||
% to make right now.
|
||||
\def\indexbackslash{\rawbackslashxx}%
|
||||
\catcode`\\ = 0
|
||||
\catcode`\@ = 11
|
||||
\escapechar = `\\
|
||||
\begindoublecolumns
|
||||
\input \jobname.#1s
|
||||
@@ -3442,11 +3491,12 @@ width0pt\relax} \fi
|
||||
% the index entries, but we want to suppress hyphenation here. (We
|
||||
% can't do that in the \entry macro, since index entries might consist
|
||||
% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
|
||||
%
|
||||
% \turnoffactive is for the sake of @" used for umlauts.
|
||||
\def\tocentry#1#2{\begingroup
|
||||
\vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
|
||||
\entry{\turnoffactive #1}{\turnoffactive #2}%
|
||||
% Do not use \turnoffactive in these arguments. Since the toc is
|
||||
% typeset in cmr, so characters such as _ would come out wrong; we
|
||||
% have to do the usual translation tricks.
|
||||
\entry{#1}{#2}%
|
||||
\endgroup}
|
||||
|
||||
% Space between chapter (or whatever) number and the title.
|
||||
@@ -3512,30 +3562,36 @@ width0pt\relax} \fi
|
||||
% But \@ or @@ will get a plain tex @ character.
|
||||
|
||||
\def\tex{\begingroup
|
||||
\catcode `\\=0 \catcode `\{=1 \catcode `\}=2
|
||||
\catcode `\$=3 \catcode `\&=4 \catcode `\#=6
|
||||
\catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
|
||||
\catcode `\%=14
|
||||
\catcode 43=12 % plus
|
||||
\catcode`\"=12
|
||||
\catcode`\==12
|
||||
\catcode`\|=12
|
||||
\catcode`\<=12
|
||||
\catcode`\>=12
|
||||
\escapechar=`\\
|
||||
%
|
||||
\let\,=\ptexcomma
|
||||
\let\{=\ptexlbrace
|
||||
\let\}=\ptexrbrace
|
||||
\let\.=\ptexdot
|
||||
\let\*=\ptexstar
|
||||
\let\dots=\ptexdots
|
||||
\def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
|
||||
\def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
|
||||
\def\@{@}%
|
||||
\let\bullet=\ptexbullet
|
||||
\let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext
|
||||
%
|
||||
\catcode `\\=0 \catcode `\{=1 \catcode `\}=2
|
||||
\catcode `\$=3 \catcode `\&=4 \catcode `\#=6
|
||||
\catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
|
||||
\catcode `\%=14
|
||||
\catcode 43=12 % plus
|
||||
\catcode`\"=12
|
||||
\catcode`\==12
|
||||
\catcode`\|=12
|
||||
\catcode`\<=12
|
||||
\catcode`\>=12
|
||||
\escapechar=`\\
|
||||
%
|
||||
\let\b=\ptexb
|
||||
\let\bullet=\ptexbullet
|
||||
\let\c=\ptexc
|
||||
\let\,=\ptexcomma
|
||||
\let\.=\ptexdot
|
||||
\let\dots=\ptexdots
|
||||
\let\equiv=\ptexequiv
|
||||
\let\!=\ptexexclam
|
||||
\let\i=\ptexi
|
||||
\let\{=\ptexlbrace
|
||||
\let\+=\tabalign
|
||||
\let\}=\ptexrbrace
|
||||
\let\*=\ptexstar
|
||||
\let\t=\ptext
|
||||
%
|
||||
\def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
|
||||
\def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
|
||||
\def\@{@}%
|
||||
\let\Etex=\endgroup}
|
||||
|
||||
% Define @lisp ... @endlisp.
|
||||
@@ -3580,8 +3636,8 @@ width0pt\relax} \fi
|
||||
% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
|
||||
\let\nonarrowing=\relax
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% \cartouche: draw rectangle w/rounded corners around argument
|
||||
% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
|
||||
% environment contents.
|
||||
\font\circle=lcircle10
|
||||
\newdimen\circthick
|
||||
\newdimen\cartouter\newdimen\cartinner
|
||||
@@ -3608,9 +3664,9 @@ width0pt\relax} \fi
|
||||
\cartinner=\hsize \advance\cartinner by-\lskip
|
||||
\advance\cartinner by-\rskip
|
||||
\cartouter=\hsize
|
||||
\advance\cartouter by 18pt % allow for 3pt kerns on either
|
||||
\advance\cartouter by 18.4pt % allow for 3pt kerns on either
|
||||
% side, and for 6pt waste from
|
||||
% each corner char
|
||||
% each corner char, and rule thickness
|
||||
\normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
|
||||
% Flag to tell @lisp, etc., not to narrow margin.
|
||||
\let\nonarrowing=\comment
|
||||
@@ -4246,18 +4302,17 @@ width0pt\relax} \fi
|
||||
|
||||
|
||||
\message{cross reference,}
|
||||
% Define cross-reference macros
|
||||
\newwrite \auxfile
|
||||
\newwrite\auxfile
|
||||
|
||||
\newif\ifhavexrefs % True if xref values are known.
|
||||
\newif\ifhavexrefs % True if xref values are known.
|
||||
\newif\ifwarnedxrefs % True if we warned once that they aren't known.
|
||||
|
||||
% @inforef is simple.
|
||||
% @inforef is relatively simple.
|
||||
\def\inforef #1{\inforefzzz #1,,,,**}
|
||||
\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
|
||||
node \samp{\ignorespaces#1{}}}
|
||||
|
||||
% \setref{foo} defines a cross-reference point named foo.
|
||||
% @setref{foo} defines a cross-reference point named foo.
|
||||
|
||||
\def\setref#1{%
|
||||
\dosetq{#1-title}{Ytitle}%
|
||||
@@ -4325,7 +4380,7 @@ width0pt\relax} \fi
|
||||
% into the usual \leavevmode...\vrule stuff for purposes of
|
||||
% printing. So we \turnoffactive for the \refx-snt, back on for the
|
||||
% printing, back off for the \refx-pg.
|
||||
{\turnoffactive \refx{#1-snt}{}}%
|
||||
{\normalturnoffactive \refx{#1-snt}{}}%
|
||||
\space [\printednodename],\space
|
||||
\turnoffactive \putwordpage\tie\refx{#1-pg}{}%
|
||||
\fi
|
||||
@@ -4333,11 +4388,15 @@ width0pt\relax} \fi
|
||||
|
||||
% \dosetq is the interface for calls from other macros
|
||||
|
||||
% Use \turnoffactive so that punctuation chars such as underscore
|
||||
% work in node names.
|
||||
\def\dosetq #1#2{{\let\folio=0 \turnoffactive
|
||||
\edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
|
||||
\next}}
|
||||
% Use \normalturnoffactive so that punctuation chars such as underscore
|
||||
% and backslash work in node names. (\turnoffactive doesn't do \.)
|
||||
\def\dosetq#1#2{%
|
||||
{\let\folio=0
|
||||
\normalturnoffactive
|
||||
\edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
|
||||
\next
|
||||
}%
|
||||
}
|
||||
|
||||
% \internalsetq {foo}{page} expands into
|
||||
% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
|
||||
@@ -4388,7 +4447,7 @@ width0pt\relax} \fi
|
||||
\def\refx#1#2{%
|
||||
\expandafter\ifx\csname X#1\endcsname\relax
|
||||
% If not defined, say something at least.
|
||||
$\langle$un\-de\-fined$\rangle$%
|
||||
\angleleft un\-de\-fined\angleright
|
||||
\ifhavexrefs
|
||||
\message{\linenumber Undefined cross reference `#1'.}%
|
||||
\else
|
||||
@@ -4405,10 +4464,13 @@ width0pt\relax} \fi
|
||||
}
|
||||
|
||||
% This is the macro invoked by entries in the aux file.
|
||||
\def\xrdef #1#2{{%
|
||||
\catcode`\'=\other
|
||||
\expandafter\gdef\csname X#1\endcsname{#2}%
|
||||
}}
|
||||
%
|
||||
\def\xrdef#1{\begingroup
|
||||
% Reenable \ as an escape while reading the second argument.
|
||||
\catcode`\\ = 0
|
||||
\afterassignment\endgroup
|
||||
\expandafter\gdef\csname X#1\endcsname
|
||||
}
|
||||
|
||||
% Read the last existing aux file, if any. No error if none exists.
|
||||
\def\readauxfile{\begingroup
|
||||
@@ -4465,8 +4527,7 @@ width0pt\relax} \fi
|
||||
\catcode`\$=\other
|
||||
\catcode`\#=\other
|
||||
\catcode`\&=\other
|
||||
% `\+ does not work, so use 43.
|
||||
\catcode43=\other
|
||||
\catcode`+=\other % avoid \+ for paranoia even though we've turned it off
|
||||
% Make the characters 128-255 be printing characters
|
||||
{%
|
||||
\count 1=128
|
||||
@@ -4837,10 +4898,10 @@ width0pt\relax} \fi
|
||||
% use math or other variants that look better in normal text.
|
||||
|
||||
\catcode`\"=\active
|
||||
\def\activedoublequote{{\tt \char '042}}
|
||||
\def\activedoublequote{{\tt\char34}}
|
||||
\let"=\activedoublequote
|
||||
\catcode`\~=\active
|
||||
\def~{{\tt \char '176}}
|
||||
\def~{{\tt\char126}}
|
||||
\chardef\hat=`\^
|
||||
\catcode`\^=\active
|
||||
\def^{{\tt \hat}}
|
||||
@@ -4851,7 +4912,7 @@ width0pt\relax} \fi
|
||||
\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
|
||||
|
||||
\catcode`\|=\active
|
||||
\def|{{\tt \char '174}}
|
||||
\def|{{\tt\char124}}
|
||||
\chardef \less=`\<
|
||||
\catcode`\<=\active
|
||||
\def<{{\tt \less}}
|
||||
@@ -4938,8 +4999,8 @@ width0pt\relax} \fi
|
||||
@gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
|
||||
@catcode`+=@active @catcode`@_=@active}
|
||||
|
||||
%% These look ok in all fonts, so just make them not special. The @rm below
|
||||
%% makes sure that the current font starts out as the newly loaded cmr10
|
||||
% These look ok in all fonts, so just make them not special. The @rm below
|
||||
% makes sure that the current font starts out as the newly loaded cmr10
|
||||
@catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
|
||||
|
||||
@textfonts
|
||||
|
||||
@@ -142,7 +142,7 @@ The GNU text utilities are mostly compatible with the @sc{POSIX.2} standard.
|
||||
@c This paragraph appears in all of fileutils.texi, textutils.texi, and
|
||||
@c sh-utils.texi too -- so be sure to keep them consistent.
|
||||
@cindex bugs, reporting
|
||||
Please report bugs to @samp{textutils-bugs@@gnu.org}. Remember
|
||||
Please report bugs to @email{textutils-bugs@@gnu.org}. Remember
|
||||
to include the version number, machine architecture, input files, and
|
||||
any other information needed to reproduce the bug: your input, what you
|
||||
expected, what you got, and why it is wrong. Diffs are welcome, but
|
||||
@@ -2696,6 +2696,24 @@ Convert each sequence of repeated newlines to a single newline:
|
||||
tr -s '\n'
|
||||
@end example
|
||||
|
||||
@item
|
||||
Find doubled occurrences of words in a document.
|
||||
For example, people often write ``the the'' with the duplicated words
|
||||
separated by a newline. The bourne shell script below works first
|
||||
by converting each sequence of punctuation and blank characters to a
|
||||
single newline. That puts each ``word'' on a line by itself.
|
||||
Next it maps all uppercase characters to lower case, and finally it
|
||||
runs @code{uniq} with the @samp{-d} option to print out only the words
|
||||
that were adjacent duplicates.
|
||||
|
||||
@example
|
||||
#!/bin/sh
|
||||
cat "$@@" \
|
||||
| tr -s '[:punct:][:blank:]' '\n' \
|
||||
| tr '[:upper:]' '[:lower:]' \
|
||||
| uniq -d
|
||||
@end example
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
|
||||
@@ -4,9 +4,6 @@ AUTOMAKE_OPTIONS = ../src/ansi2knr
|
||||
|
||||
noinst_LIBRARIES = libfu.a
|
||||
|
||||
EXTRA_DIST = chown.c getgroups.c getline.c lstat.c malloc.c mktime.c \
|
||||
realloc.c stat.c strftime.c
|
||||
|
||||
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||
|
||||
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
|
||||
@@ -22,8 +19,9 @@ libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
|
||||
|
||||
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
|
||||
error.h exclude.h fnmatch.h fsusage.h \
|
||||
getdate.h getline.h getopt.h group-member.h human.h long-options.h \
|
||||
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
|
||||
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
|
||||
quotearg.h save-cwd.h savedir.h strverscmp.h xalloc.h xstrtol.h xstrtoul.h
|
||||
quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
|
||||
xalloc.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
|
||||
210
lib/Makefile.in
210
lib/Makefile.in
@@ -1,10 +1,9 @@
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
@@ -32,6 +31,8 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -66,6 +67,7 @@ GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
@@ -91,9 +93,6 @@ AUTOMAKE_OPTIONS = ../src/ansi2knr
|
||||
|
||||
noinst_LIBRARIES = libfu.a
|
||||
|
||||
EXTRA_DIST = chown.c getgroups.c getline.c lstat.c malloc.c mktime.c \
|
||||
realloc.c stat.c strftime.c
|
||||
|
||||
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||
|
||||
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
|
||||
@@ -109,9 +108,10 @@ libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
|
||||
|
||||
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
|
||||
error.h exclude.h fnmatch.h fsusage.h \
|
||||
getdate.h getline.h getopt.h group-member.h human.h long-options.h \
|
||||
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
|
||||
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
|
||||
quotearg.h save-cwd.h savedir.h strverscmp.h xalloc.h xstrtol.h xstrtoul.h
|
||||
quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
|
||||
xalloc.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
@@ -139,13 +139,13 @@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in alloca.c chown.c error.c error.h \
|
||||
euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c getdate.c \
|
||||
getgroups.c getline.c group-member.c lstat.c malloc.c memcmp.c memcpy.c \
|
||||
memset.c mkdir.c mktime.c mountlist.c obstack.c obstack.h posixtm.c \
|
||||
realloc.c regex.c regex.h rename.c rmdir.c rpmatch.c rx.c rx.h stat.c \
|
||||
stpcpy.c strcasecmp.c strdup.c strftime.c strndup.c strstr.c strtol.c \
|
||||
strtoul.c strverscmp.c ylwrap
|
||||
DIST_COMMON = Makefile.am Makefile.in TODO alloca.c chown.c error.c \
|
||||
error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
|
||||
getdate.c getgroups.c getline.c group-member.c lchown.c lstat.c \
|
||||
malloc.c memcmp.c memcpy.c memset.c mkdir.c mktime.c mountlist.c \
|
||||
obstack.c obstack.h posixtm.c realloc.c regex.c rename.c rmdir.c \
|
||||
rpmatch.c stat.c stpcpy.c strcasecmp.c strdup.c strftime.c strndup.c \
|
||||
strstr.c strtol.c strtoul.c strverscmp.c utime.c ylwrap
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@@ -159,28 +159,29 @@ DEP_FILES = .deps/addext.P .deps/alloca.P .deps/argmatch.P \
|
||||
.deps/ftruncate.P .deps/full-write.P .deps/getdate .deps/getdate.P \
|
||||
.deps/getgroups.P .deps/getline.P .deps/getopt.P .deps/getopt1.P \
|
||||
.deps/group-member.P .deps/hash.P .deps/human.P .deps/idcache.P \
|
||||
.deps/isdir.P .deps/long-options.P .deps/lstat.P .deps/makepath.P \
|
||||
.deps/malloc.P .deps/memcmp.P .deps/memcpy.P .deps/memset.P \
|
||||
.deps/mkdir.P .deps/mktime.P .deps/modechange.P .deps/mountlist.P \
|
||||
.deps/obstack.P .deps/path-concat.P .deps/posixtm .deps/posixtm.P \
|
||||
.deps/quotearg.P .deps/realloc.P .deps/regex.P .deps/rename.P \
|
||||
.deps/rmdir.P .deps/rpmatch.P .deps/rx.P .deps/safe-read.P \
|
||||
.deps/isdir.P .deps/lchown.P .deps/long-options.P .deps/lstat.P \
|
||||
.deps/makepath.P .deps/malloc.P .deps/memcmp.P .deps/memcpy.P \
|
||||
.deps/memset.P .deps/mkdir.P .deps/mktime.P .deps/modechange.P \
|
||||
.deps/mountlist.P .deps/obstack.P .deps/path-concat.P .deps/posixtm \
|
||||
.deps/posixtm.P .deps/quotearg.P .deps/realloc.P .deps/regex.P \
|
||||
.deps/rename.P .deps/rmdir.P .deps/rpmatch.P .deps/safe-read.P \
|
||||
.deps/save-cwd.P .deps/savedir.P .deps/stat.P .deps/stpcpy.P \
|
||||
.deps/strcasecmp.P .deps/strdup.P .deps/strftime.P .deps/stripslash.P \
|
||||
.deps/strndup.P .deps/strstr.P .deps/strtol.P .deps/strtoul.P \
|
||||
.deps/strverscmp.P .deps/userspec.P .deps/xgetcwd.P .deps/xmalloc.P \
|
||||
.deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
|
||||
.deps/strverscmp.P .deps/userspec.P .deps/utime.P .deps/xgetcwd.P \
|
||||
.deps/xmalloc.P .deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P \
|
||||
.deps/yesno.P
|
||||
SOURCES = $(libfu_a_SOURCES)
|
||||
OBJECTS = $(libfu_a_OBJECTS)
|
||||
|
||||
default: all
|
||||
all: Makefile $(LIBRARIES) $(HEADERS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .o .s .y
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits lib/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
@@ -212,6 +213,9 @@ maintainer-clean-compile:
|
||||
../src/ansi2knr: ../src/ansi2knr.o
|
||||
cd ../src && $(MAKE) ansi2knr
|
||||
|
||||
../src/ansi2knr.o:
|
||||
cd ../src && $(MAKE) ansi2knr.o
|
||||
|
||||
|
||||
mostlyclean-kr:
|
||||
-rm -f *_.c
|
||||
@@ -232,155 +236,157 @@ posixtm.h: posixtm.c
|
||||
getdate.h: getdate.c
|
||||
|
||||
addext_.c: addext.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/addext.c; then echo $(srcdir)/addext.c; else echo addext.c; fi` addext_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/addext.c; then echo $(srcdir)/addext.c; else echo addext.c; fi` | $(ANSI2KNR) > addext_.c
|
||||
alloca_.c: alloca.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/alloca.c; then echo $(srcdir)/alloca.c; else echo alloca.c; fi` alloca_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/alloca.c; then echo $(srcdir)/alloca.c; else echo alloca.c; fi` | $(ANSI2KNR) > alloca_.c
|
||||
argmatch_.c: argmatch.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/argmatch.c; then echo $(srcdir)/argmatch.c; else echo argmatch.c; fi` argmatch_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/argmatch.c; then echo $(srcdir)/argmatch.c; else echo argmatch.c; fi` | $(ANSI2KNR) > argmatch_.c
|
||||
backupfile_.c: backupfile.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/backupfile.c; then echo $(srcdir)/backupfile.c; else echo backupfile.c; fi` backupfile_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/backupfile.c; then echo $(srcdir)/backupfile.c; else echo backupfile.c; fi` | $(ANSI2KNR) > backupfile_.c
|
||||
basename_.c: basename.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/basename.c; then echo $(srcdir)/basename.c; else echo basename.c; fi` basename_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/basename.c; then echo $(srcdir)/basename.c; else echo basename.c; fi` | $(ANSI2KNR) > basename_.c
|
||||
chown_.c: chown.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/chown.c; then echo $(srcdir)/chown.c; else echo chown.c; fi` chown_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/chown.c; then echo $(srcdir)/chown.c; else echo chown.c; fi` | $(ANSI2KNR) > chown_.c
|
||||
closeout_.c: closeout.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/closeout.c; then echo $(srcdir)/closeout.c; else echo closeout.c; fi` closeout_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/closeout.c; then echo $(srcdir)/closeout.c; else echo closeout.c; fi` | $(ANSI2KNR) > closeout_.c
|
||||
dirname_.c: dirname.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/dirname.c; then echo $(srcdir)/dirname.c; else echo dirname.c; fi` dirname_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/dirname.c; then echo $(srcdir)/dirname.c; else echo dirname.c; fi` | $(ANSI2KNR) > dirname_.c
|
||||
error_.c: error.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/error.c; then echo $(srcdir)/error.c; else echo error.c; fi` error_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/error.c; then echo $(srcdir)/error.c; else echo error.c; fi` | $(ANSI2KNR) > error_.c
|
||||
euidaccess_.c: euidaccess.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/euidaccess.c; then echo $(srcdir)/euidaccess.c; else echo euidaccess.c; fi` euidaccess_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/euidaccess.c; then echo $(srcdir)/euidaccess.c; else echo euidaccess.c; fi` | $(ANSI2KNR) > euidaccess_.c
|
||||
exclude_.c: exclude.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/exclude.c; then echo $(srcdir)/exclude.c; else echo exclude.c; fi` exclude_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/exclude.c; then echo $(srcdir)/exclude.c; else echo exclude.c; fi` | $(ANSI2KNR) > exclude_.c
|
||||
fileblocks_.c: fileblocks.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/fileblocks.c; then echo $(srcdir)/fileblocks.c; else echo fileblocks.c; fi` fileblocks_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/fileblocks.c; then echo $(srcdir)/fileblocks.c; else echo fileblocks.c; fi` | $(ANSI2KNR) > fileblocks_.c
|
||||
filemode_.c: filemode.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/filemode.c; then echo $(srcdir)/filemode.c; else echo filemode.c; fi` filemode_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/filemode.c; then echo $(srcdir)/filemode.c; else echo filemode.c; fi` | $(ANSI2KNR) > filemode_.c
|
||||
fnmatch_.c: fnmatch.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/fnmatch.c; then echo $(srcdir)/fnmatch.c; else echo fnmatch.c; fi` fnmatch_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/fnmatch.c; then echo $(srcdir)/fnmatch.c; else echo fnmatch.c; fi` | $(ANSI2KNR) > fnmatch_.c
|
||||
fsusage_.c: fsusage.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/fsusage.c; then echo $(srcdir)/fsusage.c; else echo fsusage.c; fi` fsusage_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/fsusage.c; then echo $(srcdir)/fsusage.c; else echo fsusage.c; fi` | $(ANSI2KNR) > fsusage_.c
|
||||
ftruncate_.c: ftruncate.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/ftruncate.c; then echo $(srcdir)/ftruncate.c; else echo ftruncate.c; fi` ftruncate_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/ftruncate.c; then echo $(srcdir)/ftruncate.c; else echo ftruncate.c; fi` | $(ANSI2KNR) > ftruncate_.c
|
||||
full-write_.c: full-write.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/full-write.c; then echo $(srcdir)/full-write.c; else echo full-write.c; fi` full-write_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/full-write.c; then echo $(srcdir)/full-write.c; else echo full-write.c; fi` | $(ANSI2KNR) > full-write_.c
|
||||
getdate_.c: getdate.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/getdate.c; then echo $(srcdir)/getdate.c; else echo getdate.c; fi` getdate_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/getdate.c; then echo $(srcdir)/getdate.c; else echo getdate.c; fi` | $(ANSI2KNR) > getdate_.c
|
||||
getgroups_.c: getgroups.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/getgroups.c; then echo $(srcdir)/getgroups.c; else echo getgroups.c; fi` getgroups_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/getgroups.c; then echo $(srcdir)/getgroups.c; else echo getgroups.c; fi` | $(ANSI2KNR) > getgroups_.c
|
||||
getline_.c: getline.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/getline.c; then echo $(srcdir)/getline.c; else echo getline.c; fi` getline_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/getline.c; then echo $(srcdir)/getline.c; else echo getline.c; fi` | $(ANSI2KNR) > getline_.c
|
||||
getopt_.c: getopt.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` getopt_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` | $(ANSI2KNR) > getopt_.c
|
||||
getopt1_.c: getopt1.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` getopt1_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` | $(ANSI2KNR) > getopt1_.c
|
||||
group-member_.c: group-member.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/group-member.c; then echo $(srcdir)/group-member.c; else echo group-member.c; fi` group-member_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/group-member.c; then echo $(srcdir)/group-member.c; else echo group-member.c; fi` | $(ANSI2KNR) > group-member_.c
|
||||
hash_.c: hash.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/hash.c; then echo $(srcdir)/hash.c; else echo hash.c; fi` hash_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/hash.c; then echo $(srcdir)/hash.c; else echo hash.c; fi` | $(ANSI2KNR) > hash_.c
|
||||
human_.c: human.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/human.c; then echo $(srcdir)/human.c; else echo human.c; fi` human_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/human.c; then echo $(srcdir)/human.c; else echo human.c; fi` | $(ANSI2KNR) > human_.c
|
||||
idcache_.c: idcache.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/idcache.c; then echo $(srcdir)/idcache.c; else echo idcache.c; fi` idcache_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/idcache.c; then echo $(srcdir)/idcache.c; else echo idcache.c; fi` | $(ANSI2KNR) > idcache_.c
|
||||
isdir_.c: isdir.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/isdir.c; then echo $(srcdir)/isdir.c; else echo isdir.c; fi` isdir_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/isdir.c; then echo $(srcdir)/isdir.c; else echo isdir.c; fi` | $(ANSI2KNR) > isdir_.c
|
||||
lchown_.c: lchown.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/lchown.c; then echo $(srcdir)/lchown.c; else echo lchown.c; fi` | $(ANSI2KNR) > lchown_.c
|
||||
long-options_.c: long-options.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/long-options.c; then echo $(srcdir)/long-options.c; else echo long-options.c; fi` long-options_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/long-options.c; then echo $(srcdir)/long-options.c; else echo long-options.c; fi` | $(ANSI2KNR) > long-options_.c
|
||||
lstat_.c: lstat.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/lstat.c; then echo $(srcdir)/lstat.c; else echo lstat.c; fi` lstat_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/lstat.c; then echo $(srcdir)/lstat.c; else echo lstat.c; fi` | $(ANSI2KNR) > lstat_.c
|
||||
makepath_.c: makepath.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/makepath.c; then echo $(srcdir)/makepath.c; else echo makepath.c; fi` makepath_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/makepath.c; then echo $(srcdir)/makepath.c; else echo makepath.c; fi` | $(ANSI2KNR) > makepath_.c
|
||||
malloc_.c: malloc.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/malloc.c; then echo $(srcdir)/malloc.c; else echo malloc.c; fi` malloc_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/malloc.c; then echo $(srcdir)/malloc.c; else echo malloc.c; fi` | $(ANSI2KNR) > malloc_.c
|
||||
memcmp_.c: memcmp.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/memcmp.c; then echo $(srcdir)/memcmp.c; else echo memcmp.c; fi` memcmp_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/memcmp.c; then echo $(srcdir)/memcmp.c; else echo memcmp.c; fi` | $(ANSI2KNR) > memcmp_.c
|
||||
memcpy_.c: memcpy.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/memcpy.c; then echo $(srcdir)/memcpy.c; else echo memcpy.c; fi` memcpy_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/memcpy.c; then echo $(srcdir)/memcpy.c; else echo memcpy.c; fi` | $(ANSI2KNR) > memcpy_.c
|
||||
memset_.c: memset.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/memset.c; then echo $(srcdir)/memset.c; else echo memset.c; fi` memset_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/memset.c; then echo $(srcdir)/memset.c; else echo memset.c; fi` | $(ANSI2KNR) > memset_.c
|
||||
mkdir_.c: mkdir.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/mkdir.c; then echo $(srcdir)/mkdir.c; else echo mkdir.c; fi` mkdir_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/mkdir.c; then echo $(srcdir)/mkdir.c; else echo mkdir.c; fi` | $(ANSI2KNR) > mkdir_.c
|
||||
mktime_.c: mktime.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/mktime.c; then echo $(srcdir)/mktime.c; else echo mktime.c; fi` mktime_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/mktime.c; then echo $(srcdir)/mktime.c; else echo mktime.c; fi` | $(ANSI2KNR) > mktime_.c
|
||||
modechange_.c: modechange.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/modechange.c; then echo $(srcdir)/modechange.c; else echo modechange.c; fi` modechange_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/modechange.c; then echo $(srcdir)/modechange.c; else echo modechange.c; fi` | $(ANSI2KNR) > modechange_.c
|
||||
mountlist_.c: mountlist.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/mountlist.c; then echo $(srcdir)/mountlist.c; else echo mountlist.c; fi` mountlist_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/mountlist.c; then echo $(srcdir)/mountlist.c; else echo mountlist.c; fi` | $(ANSI2KNR) > mountlist_.c
|
||||
obstack_.c: obstack.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/obstack.c; then echo $(srcdir)/obstack.c; else echo obstack.c; fi` obstack_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/obstack.c; then echo $(srcdir)/obstack.c; else echo obstack.c; fi` | $(ANSI2KNR) > obstack_.c
|
||||
path-concat_.c: path-concat.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/path-concat.c; then echo $(srcdir)/path-concat.c; else echo path-concat.c; fi` path-concat_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/path-concat.c; then echo $(srcdir)/path-concat.c; else echo path-concat.c; fi` | $(ANSI2KNR) > path-concat_.c
|
||||
posixtm_.c: posixtm.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/posixtm.c; then echo $(srcdir)/posixtm.c; else echo posixtm.c; fi` posixtm_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/posixtm.c; then echo $(srcdir)/posixtm.c; else echo posixtm.c; fi` | $(ANSI2KNR) > posixtm_.c
|
||||
quotearg_.c: quotearg.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/quotearg.c; then echo $(srcdir)/quotearg.c; else echo quotearg.c; fi` quotearg_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/quotearg.c; then echo $(srcdir)/quotearg.c; else echo quotearg.c; fi` | $(ANSI2KNR) > quotearg_.c
|
||||
realloc_.c: realloc.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` realloc_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` | $(ANSI2KNR) > realloc_.c
|
||||
regex_.c: regex.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/regex.c; then echo $(srcdir)/regex.c; else echo regex.c; fi` regex_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/regex.c; then echo $(srcdir)/regex.c; else echo regex.c; fi` | $(ANSI2KNR) > regex_.c
|
||||
rename_.c: rename.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/rename.c; then echo $(srcdir)/rename.c; else echo rename.c; fi` rename_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/rename.c; then echo $(srcdir)/rename.c; else echo rename.c; fi` | $(ANSI2KNR) > rename_.c
|
||||
rmdir_.c: rmdir.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/rmdir.c; then echo $(srcdir)/rmdir.c; else echo rmdir.c; fi` rmdir_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/rmdir.c; then echo $(srcdir)/rmdir.c; else echo rmdir.c; fi` | $(ANSI2KNR) > rmdir_.c
|
||||
rpmatch_.c: rpmatch.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/rpmatch.c; then echo $(srcdir)/rpmatch.c; else echo rpmatch.c; fi` rpmatch_.c
|
||||
rx_.c: rx.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/rx.c; then echo $(srcdir)/rx.c; else echo rx.c; fi` rx_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/rpmatch.c; then echo $(srcdir)/rpmatch.c; else echo rpmatch.c; fi` | $(ANSI2KNR) > rpmatch_.c
|
||||
safe-read_.c: safe-read.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/safe-read.c; then echo $(srcdir)/safe-read.c; else echo safe-read.c; fi` safe-read_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/safe-read.c; then echo $(srcdir)/safe-read.c; else echo safe-read.c; fi` | $(ANSI2KNR) > safe-read_.c
|
||||
save-cwd_.c: save-cwd.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/save-cwd.c; then echo $(srcdir)/save-cwd.c; else echo save-cwd.c; fi` save-cwd_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/save-cwd.c; then echo $(srcdir)/save-cwd.c; else echo save-cwd.c; fi` | $(ANSI2KNR) > save-cwd_.c
|
||||
savedir_.c: savedir.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/savedir.c; then echo $(srcdir)/savedir.c; else echo savedir.c; fi` savedir_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/savedir.c; then echo $(srcdir)/savedir.c; else echo savedir.c; fi` | $(ANSI2KNR) > savedir_.c
|
||||
stat_.c: stat.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/stat.c; then echo $(srcdir)/stat.c; else echo stat.c; fi` stat_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/stat.c; then echo $(srcdir)/stat.c; else echo stat.c; fi` | $(ANSI2KNR) > stat_.c
|
||||
stpcpy_.c: stpcpy.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/stpcpy.c; then echo $(srcdir)/stpcpy.c; else echo stpcpy.c; fi` stpcpy_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/stpcpy.c; then echo $(srcdir)/stpcpy.c; else echo stpcpy.c; fi` | $(ANSI2KNR) > stpcpy_.c
|
||||
strcasecmp_.c: strcasecmp.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/strcasecmp.c; then echo $(srcdir)/strcasecmp.c; else echo strcasecmp.c; fi` strcasecmp_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/strcasecmp.c; then echo $(srcdir)/strcasecmp.c; else echo strcasecmp.c; fi` | $(ANSI2KNR) > strcasecmp_.c
|
||||
strdup_.c: strdup.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/strdup.c; then echo $(srcdir)/strdup.c; else echo strdup.c; fi` strdup_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/strdup.c; then echo $(srcdir)/strdup.c; else echo strdup.c; fi` | $(ANSI2KNR) > strdup_.c
|
||||
strftime_.c: strftime.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/strftime.c; then echo $(srcdir)/strftime.c; else echo strftime.c; fi` strftime_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/strftime.c; then echo $(srcdir)/strftime.c; else echo strftime.c; fi` | $(ANSI2KNR) > strftime_.c
|
||||
stripslash_.c: stripslash.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/stripslash.c; then echo $(srcdir)/stripslash.c; else echo stripslash.c; fi` stripslash_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/stripslash.c; then echo $(srcdir)/stripslash.c; else echo stripslash.c; fi` | $(ANSI2KNR) > stripslash_.c
|
||||
strndup_.c: strndup.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/strndup.c; then echo $(srcdir)/strndup.c; else echo strndup.c; fi` strndup_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/strndup.c; then echo $(srcdir)/strndup.c; else echo strndup.c; fi` | $(ANSI2KNR) > strndup_.c
|
||||
strstr_.c: strstr.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/strstr.c; then echo $(srcdir)/strstr.c; else echo strstr.c; fi` strstr_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/strstr.c; then echo $(srcdir)/strstr.c; else echo strstr.c; fi` | $(ANSI2KNR) > strstr_.c
|
||||
strtol_.c: strtol.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/strtol.c; then echo $(srcdir)/strtol.c; else echo strtol.c; fi` strtol_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/strtol.c; then echo $(srcdir)/strtol.c; else echo strtol.c; fi` | $(ANSI2KNR) > strtol_.c
|
||||
strtoul_.c: strtoul.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/strtoul.c; then echo $(srcdir)/strtoul.c; else echo strtoul.c; fi` strtoul_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/strtoul.c; then echo $(srcdir)/strtoul.c; else echo strtoul.c; fi` | $(ANSI2KNR) > strtoul_.c
|
||||
strverscmp_.c: strverscmp.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/strverscmp.c; then echo $(srcdir)/strverscmp.c; else echo strverscmp.c; fi` strverscmp_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/strverscmp.c; then echo $(srcdir)/strverscmp.c; else echo strverscmp.c; fi` | $(ANSI2KNR) > strverscmp_.c
|
||||
userspec_.c: userspec.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/userspec.c; then echo $(srcdir)/userspec.c; else echo userspec.c; fi` userspec_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/userspec.c; then echo $(srcdir)/userspec.c; else echo userspec.c; fi` | $(ANSI2KNR) > userspec_.c
|
||||
utime_.c: utime.c $(ANSI2KNR)
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/utime.c; then echo $(srcdir)/utime.c; else echo utime.c; fi` | $(ANSI2KNR) > utime_.c
|
||||
xgetcwd_.c: xgetcwd.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/xgetcwd.c; then echo $(srcdir)/xgetcwd.c; else echo xgetcwd.c; fi` xgetcwd_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/xgetcwd.c; then echo $(srcdir)/xgetcwd.c; else echo xgetcwd.c; fi` | $(ANSI2KNR) > xgetcwd_.c
|
||||
xmalloc_.c: xmalloc.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/xmalloc.c; then echo $(srcdir)/xmalloc.c; else echo xmalloc.c; fi` xmalloc_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/xmalloc.c; then echo $(srcdir)/xmalloc.c; else echo xmalloc.c; fi` | $(ANSI2KNR) > xmalloc_.c
|
||||
xstrdup_.c: xstrdup.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/xstrdup.c; then echo $(srcdir)/xstrdup.c; else echo xstrdup.c; fi` xstrdup_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/xstrdup.c; then echo $(srcdir)/xstrdup.c; else echo xstrdup.c; fi` | $(ANSI2KNR) > xstrdup_.c
|
||||
xstrtol_.c: xstrtol.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/xstrtol.c; then echo $(srcdir)/xstrtol.c; else echo xstrtol.c; fi` xstrtol_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/xstrtol.c; then echo $(srcdir)/xstrtol.c; else echo xstrtol.c; fi` | $(ANSI2KNR) > xstrtol_.c
|
||||
xstrtoul_.c: xstrtoul.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/xstrtoul.c; then echo $(srcdir)/xstrtoul.c; else echo xstrtoul.c; fi` xstrtoul_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/xstrtoul.c; then echo $(srcdir)/xstrtoul.c; else echo xstrtoul.c; fi` | $(ANSI2KNR) > xstrtoul_.c
|
||||
yesno_.c: yesno.c $(ANSI2KNR)
|
||||
$(ANSI2KNR) `if test -f $(srcdir)/yesno.c; then echo $(srcdir)/yesno.c; else echo yesno.c; fi` yesno_.c
|
||||
$(CPP) $(DEFS) $(INCLUDES) $(CPPFLAGS) `if test -f $(srcdir)/yesno.c; then echo $(srcdir)/yesno.c; else echo yesno.c; fi` | $(ANSI2KNR) > yesno_.c
|
||||
addext_.o alloca_.o argmatch_.o backupfile_.o basename_.o chown_.o \
|
||||
closeout_.o dirname_.o error_.o euidaccess_.o exclude_.o fileblocks_.o \
|
||||
filemode_.o fnmatch_.o fsusage_.o ftruncate_.o full-write_.o getdate_.o \
|
||||
getgroups_.o getline_.o getopt_.o getopt1_.o group-member_.o hash_.o \
|
||||
human_.o idcache_.o isdir_.o long-options_.o lstat_.o makepath_.o \
|
||||
malloc_.o memcmp_.o memcpy_.o memset_.o mkdir_.o mktime_.o \
|
||||
human_.o idcache_.o isdir_.o lchown_.o long-options_.o lstat_.o \
|
||||
makepath_.o malloc_.o memcmp_.o memcpy_.o memset_.o mkdir_.o mktime_.o \
|
||||
modechange_.o mountlist_.o obstack_.o path-concat_.o posixtm_.o \
|
||||
quotearg_.o realloc_.o regex_.o rename_.o rmdir_.o rpmatch_.o rx_.o \
|
||||
quotearg_.o realloc_.o regex_.o rename_.o rmdir_.o rpmatch_.o \
|
||||
safe-read_.o save-cwd_.o savedir_.o stat_.o stpcpy_.o strcasecmp_.o \
|
||||
strdup_.o strftime_.o stripslash_.o strndup_.o strstr_.o strtol_.o \
|
||||
strtoul_.o strverscmp_.o userspec_.o xgetcwd_.o xmalloc_.o xstrdup_.o \
|
||||
xstrtol_.o xstrtoul_.o yesno_.o : $(ANSI2KNR)
|
||||
strtoul_.o strverscmp_.o userspec_.o utime_.o xgetcwd_.o xmalloc_.o \
|
||||
xstrdup_.o xstrtol_.o xstrtoul_.o yesno_.o : $(ANSI2KNR)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
@@ -463,8 +469,6 @@ install: install-exec install-data all
|
||||
|
||||
uninstall:
|
||||
|
||||
all: Makefile $(LIBRARIES) $(HEADERS)
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
@@ -502,7 +506,7 @@ maintainer-clean: maintainer-clean-noinstLIBRARIES \
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
|
||||
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
|
||||
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \
|
||||
|
||||
32
lib/TODO
Normal file
32
lib/TODO
Normal file
@@ -0,0 +1,32 @@
|
||||
Things to do to hash.c:
|
||||
|
||||
Always use curly braces around statements in if/else/while/do/etc.
|
||||
that span more than a line -- even around multiline simple statements
|
||||
or single-line simple statements preceded by a comment line.
|
||||
|
||||
Never have lines longer than 80 chars.
|
||||
|
||||
Remove ^L characters. We don't want/need such crutches.
|
||||
Get a good (smart) pagination filter. I have one (a perl script)
|
||||
that usually does a decent job for me -- I called it something
|
||||
like stdc-print and think I sent you an early verison.
|
||||
|
||||
I don't like the name `cursor'. I much prefer short names
|
||||
like `p' for index variables. I doubt I'll change all of them,
|
||||
but thought you should know why some will probably end up changing.
|
||||
|
||||
#define USE_OBSTACK somewhere
|
||||
|
||||
Fix this comment. Depending on system and application...
|
||||
Mention fragmentation.
|
||||
+#if USE_OBSTACK
|
||||
+ /* Whenever obstacks are used, it is possible to allocate all overflowed
|
||||
+ entries into a single stack, so they all can be freed in a single
|
||||
+ operation. It is not clear if the speedup is worth the trouble. */
|
||||
+ struct obstack entry_stack;
|
||||
+#endif
|
||||
|
||||
|
||||
assert (bucket_limit - bucket == n_buckets) ?
|
||||
|
||||
remove.c: s/done/successful or ok
|
||||
120
lib/alloca.c
120
lib/alloca.c
@@ -22,11 +22,11 @@
|
||||
your main control loop, etc. to force garbage collection. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef emacs
|
||||
#include "blockinput.h"
|
||||
# include "blockinput.h"
|
||||
#endif
|
||||
|
||||
/* If compiling with GCC 2, this file's not needed. */
|
||||
@@ -34,39 +34,41 @@
|
||||
|
||||
/* If someone has defined alloca as a macro,
|
||||
there must be some other way alloca is supposed to work. */
|
||||
#ifndef alloca
|
||||
# ifndef alloca
|
||||
|
||||
#ifdef emacs
|
||||
#ifdef static
|
||||
# ifdef emacs
|
||||
# ifdef static
|
||||
/* actually, only want this if static is defined as ""
|
||||
-- this is for usg, in which emacs must undefine static
|
||||
in order to make unexec workable
|
||||
*/
|
||||
#ifndef STACK_DIRECTION
|
||||
# ifndef STACK_DIRECTION
|
||||
you
|
||||
lose
|
||||
-- must know STACK_DIRECTION at compile-time
|
||||
#endif /* STACK_DIRECTION undefined */
|
||||
#endif /* static */
|
||||
#endif /* emacs */
|
||||
# endif /* STACK_DIRECTION undefined */
|
||||
# endif /* static */
|
||||
# endif /* emacs */
|
||||
|
||||
/* If your stack is a linked list of frames, you have to
|
||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
long i00afunc ();
|
||||
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
#else
|
||||
#define ADDRESS_FUNCTION(arg) &(arg)
|
||||
#endif
|
||||
# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
# else
|
||||
# define ADDRESS_FUNCTION(arg) &(arg)
|
||||
# endif
|
||||
|
||||
#if __STDC__
|
||||
# if __STDC__
|
||||
typedef void *pointer;
|
||||
#else
|
||||
# else
|
||||
typedef char *pointer;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#define NULL 0
|
||||
# ifndef NULL
|
||||
# define NULL 0
|
||||
# endif
|
||||
|
||||
/* Different portions of Emacs need to call different versions of
|
||||
malloc. The Emacs executable needs alloca to call xmalloc, because
|
||||
@@ -78,9 +80,9 @@ typedef char *pointer;
|
||||
|
||||
Callers below should use malloc. */
|
||||
|
||||
#ifndef emacs
|
||||
#define malloc xmalloc
|
||||
#endif
|
||||
# ifndef emacs
|
||||
# define malloc xmalloc
|
||||
# endif
|
||||
extern pointer malloc ();
|
||||
|
||||
/* Define STACK_DIRECTION if you know the direction of stack
|
||||
@@ -91,18 +93,18 @@ extern pointer malloc ();
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
|
||||
#ifndef STACK_DIRECTION
|
||||
#define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
#endif
|
||||
# ifndef STACK_DIRECTION
|
||||
# define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
# endif
|
||||
|
||||
#if STACK_DIRECTION != 0
|
||||
# if STACK_DIRECTION != 0
|
||||
|
||||
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
|
||||
#else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
# else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
|
||||
static int stack_dir; /* 1 or -1 once known. */
|
||||
#define STACK_DIR stack_dir
|
||||
# define STACK_DIR stack_dir
|
||||
|
||||
static void
|
||||
find_stack_direction ()
|
||||
@@ -126,7 +128,7 @@ find_stack_direction ()
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* STACK_DIRECTION == 0 */
|
||||
# endif /* STACK_DIRECTION == 0 */
|
||||
|
||||
/* An "alloca header" is used to:
|
||||
(a) chain together all alloca'ed blocks;
|
||||
@@ -135,9 +137,9 @@ find_stack_direction ()
|
||||
It is very important that sizeof(header) agree with malloc
|
||||
alignment chunk size. The following default should work okay. */
|
||||
|
||||
#ifndef ALIGN_SIZE
|
||||
#define ALIGN_SIZE sizeof(double)
|
||||
#endif
|
||||
# ifndef ALIGN_SIZE
|
||||
# define ALIGN_SIZE sizeof(double)
|
||||
# endif
|
||||
|
||||
typedef union hdr
|
||||
{
|
||||
@@ -165,20 +167,20 @@ alloca (size)
|
||||
auto char probe; /* Probes stack depth: */
|
||||
register char *depth = ADDRESS_FUNCTION (probe);
|
||||
|
||||
#if STACK_DIRECTION == 0
|
||||
# if STACK_DIRECTION == 0
|
||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||
find_stack_direction ();
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* Reclaim garbage, defined as all alloca'd storage that
|
||||
was allocated from deeper in the stack than currently. */
|
||||
was allocated from deeper in the stack than currently. */
|
||||
|
||||
{
|
||||
register header *hp; /* Traverses linked list. */
|
||||
|
||||
#ifdef emacs
|
||||
# ifdef emacs
|
||||
BLOCK_INPUT;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
for (hp = last_alloca_header; hp != NULL;)
|
||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||
@@ -195,9 +197,9 @@ alloca (size)
|
||||
|
||||
last_alloca_header = hp; /* -> last valid storage. */
|
||||
|
||||
#ifdef emacs
|
||||
# ifdef emacs
|
||||
UNBLOCK_INPUT;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
@@ -220,15 +222,15 @@ alloca (size)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
|
||||
#ifndef CRAY_STACK
|
||||
#define CRAY_STACK
|
||||
#ifndef CRAY2
|
||||
# ifndef CRAY_STACK
|
||||
# define CRAY_STACK
|
||||
# ifndef CRAY2
|
||||
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
||||
struct stack_control_header
|
||||
{
|
||||
@@ -280,7 +282,7 @@ struct stack_segment_linkage
|
||||
long sss7;
|
||||
};
|
||||
|
||||
#else /* CRAY2 */
|
||||
# else /* CRAY2 */
|
||||
/* The following structure defines the vector of words
|
||||
returned by the STKSTAT library routine. */
|
||||
struct stk_stat
|
||||
@@ -333,12 +335,12 @@ struct stk_trailer
|
||||
long unknown14;
|
||||
};
|
||||
|
||||
#endif /* CRAY2 */
|
||||
#endif /* not CRAY_STACK */
|
||||
# endif /* CRAY2 */
|
||||
# endif /* not CRAY_STACK */
|
||||
|
||||
#ifdef CRAY2
|
||||
# ifdef CRAY2
|
||||
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
||||
I doubt that "lint" will like this much. */
|
||||
I doubt that "lint" will like this much. */
|
||||
|
||||
static long
|
||||
i00afunc (long *address)
|
||||
@@ -407,7 +409,7 @@ i00afunc (long *address)
|
||||
return (result);
|
||||
}
|
||||
|
||||
#else /* not CRAY2 */
|
||||
# else /* not CRAY2 */
|
||||
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
||||
Determine the number of the cell within the stack,
|
||||
given the address of the cell. The purpose of this
|
||||
@@ -452,9 +454,9 @@ i00afunc (long address)
|
||||
|
||||
while (!(this_segment <= address && address <= stkl))
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
||||
#endif
|
||||
# endif
|
||||
if (pseg == 0)
|
||||
break;
|
||||
stkl = stkl - pseg;
|
||||
@@ -473,9 +475,9 @@ i00afunc (long address)
|
||||
|
||||
while (pseg != 0)
|
||||
{
|
||||
#ifdef DEBUG_I00AFUNC
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o\n", pseg, size);
|
||||
#endif
|
||||
# endif
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
@@ -485,8 +487,8 @@ i00afunc (long address)
|
||||
return (result);
|
||||
}
|
||||
|
||||
#endif /* not CRAY2 */
|
||||
#endif /* CRAY */
|
||||
# endif /* not CRAY2 */
|
||||
# endif /* CRAY */
|
||||
|
||||
#endif /* no alloca */
|
||||
# endif /* no alloca */
|
||||
#endif /* not GCC version 2 */
|
||||
|
||||
71
lib/error.c
71
lib/error.c
@@ -1,29 +1,28 @@
|
||||
/* Error handler for noninteractive utilities
|
||||
Copyright (C) 1990,91,92,93,94,95,96,97 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990,91,92,93,94,95,96,97,98 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -51,7 +50,7 @@ void exit ();
|
||||
#include "error.h"
|
||||
|
||||
#ifndef _
|
||||
#define _(String) String
|
||||
# define _(String) String
|
||||
#endif
|
||||
|
||||
/* If NULL, error will flush stdout, then print on stderr the program
|
||||
@@ -69,26 +68,28 @@ unsigned int error_message_count;
|
||||
#ifdef _LIBC
|
||||
/* In the GNU C library, there is a predefined variable for this. */
|
||||
|
||||
#define program_name program_invocation_name
|
||||
#include <errno.h>
|
||||
# define program_name program_invocation_name
|
||||
# include <errno.h>
|
||||
|
||||
/* In GNU libc we want do not want to use the common name `error' directly.
|
||||
Instead make it a weak alias. */
|
||||
#define error __error
|
||||
#define error_at_line __error_at_line
|
||||
# define error __error
|
||||
# define error_at_line __error_at_line
|
||||
|
||||
#else
|
||||
#else /* not _LIBC */
|
||||
|
||||
/* The calling program should define program_name and set it to the
|
||||
name of the executing program. */
|
||||
extern char *program_name;
|
||||
|
||||
#ifndef HAVE_STRERROR_R
|
||||
# if HAVE_STRERROR
|
||||
# ifndef strerror /* On some systems, strerror is a macro */
|
||||
char *strerror ();
|
||||
# endif
|
||||
# ifdef HAVE_STRERROR_R
|
||||
# define __strerror_r strerror_r
|
||||
# else
|
||||
# if HAVE_STRERROR
|
||||
# ifndef strerror /* On some systems, strerror is a macro */
|
||||
char *strerror ();
|
||||
# endif
|
||||
# else
|
||||
static char *
|
||||
private_strerror (errnum)
|
||||
int errnum;
|
||||
@@ -100,10 +101,10 @@ private_strerror (errnum)
|
||||
return _(sys_errlist[errnum]);
|
||||
return _("Unknown system error");
|
||||
}
|
||||
# define strerror private_strerror
|
||||
# endif /* HAVE_STRERROR */
|
||||
#endif /* HAVE_STRERROR_R */
|
||||
#endif /* _LIBC */
|
||||
# define strerror private_strerror
|
||||
# endif /* HAVE_STRERROR */
|
||||
# endif /* HAVE_STRERROR_R */
|
||||
#endif /* not _LIBC */
|
||||
|
||||
/* Print the program name and error message MESSAGE, which is a printf-style
|
||||
format string with optional args.
|
||||
@@ -112,7 +113,7 @@ private_strerror (errnum)
|
||||
/* VARARGS */
|
||||
|
||||
void
|
||||
#if defined(VA_START) && __STDC__
|
||||
#if defined VA_START && __STDC__
|
||||
error (int status, int errnum, const char *message, ...)
|
||||
#else
|
||||
error (status, errnum, message, va_alist)
|
||||
@@ -167,7 +168,7 @@ error (status, errnum, message, va_alist)
|
||||
int error_one_per_line;
|
||||
|
||||
void
|
||||
#if defined(VA_START) && __STDC__
|
||||
#if defined VA_START && __STDC__
|
||||
error_at_line (int status, int errnum, const char *file_name,
|
||||
unsigned int line_number, const char *message, ...)
|
||||
#else
|
||||
@@ -239,8 +240,8 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Make the weak alias. */
|
||||
#undef error
|
||||
#undef error_at_line
|
||||
# undef error
|
||||
# undef error_at_line
|
||||
weak_alias (__error, error)
|
||||
weak_alias (__error_at_line, error_at_line)
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,13 @@
|
||||
#include <sys/stat.h>
|
||||
#include "fsusage.h"
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
int statfs ();
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
@@ -68,9 +75,22 @@ int statvfs ();
|
||||
/* Many space usage primitives use all 1 bits to denote a value that is
|
||||
not applicable or unknown. Propagate this information by returning
|
||||
a uintmax_t value that is all 1 bits if the argument is all 1 bits,
|
||||
even if the argument is unsigned and smaller than unitmax_t. */
|
||||
even if the argument is unsigned and smaller than uintmax_t. */
|
||||
#define PROPAGATE_ALL_ONES(x) ((x) == -1 ? (uintmax_t) -1 : (uintmax_t) (x))
|
||||
|
||||
/* Extract the top bit of X as an uintmax_t value. */
|
||||
#define EXTRACT_TOP_BIT(x) ((x) \
|
||||
& ((uintmax_t) 1 << (sizeof (x) * CHAR_BIT - 1)))
|
||||
|
||||
/* If a value is negative, many space usage primitives store it into an
|
||||
integer variable by assignment, even if the variable's type is unsigned.
|
||||
So, if a space usage variable X's top bit is set, convert X to the
|
||||
uintmax_t value V such that (- (uintmax_t) V) is the negative of
|
||||
the original value. If X's top bit is clear, just yield X.
|
||||
Use PROPAGATE_TOP_BIT if the original value might be negative;
|
||||
otherwise, use PROPAGATE_ALL_ONES. */
|
||||
#define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1))
|
||||
|
||||
int safe_read ();
|
||||
|
||||
/* Fill in the fields of FSP with information about space usage for
|
||||
@@ -107,7 +127,8 @@ get_fs_usage (path, disk, fsp)
|
||||
fsp->fsu_blocksize = 1024;
|
||||
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.fd_req.btot);
|
||||
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.fd_req.bfree);
|
||||
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.fd_req.bfreen);
|
||||
fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.fd_req.bfreen);
|
||||
fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.fd_req.bfreen) != 0;
|
||||
fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.fd_req.gtot);
|
||||
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.fd_req.gfree);
|
||||
|
||||
@@ -141,7 +162,8 @@ get_fs_usage (path, disk, fsp)
|
||||
fsp->fsu_blocksize = (fsd.s_type == Fs2b ? 1024 : 512);
|
||||
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.s_fsize);
|
||||
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.s_tfree);
|
||||
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.s_tfree);
|
||||
fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.s_tfree);
|
||||
fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.s_tfree) != 0;
|
||||
fsp->fsu_files = (fsd.s_isize == -1
|
||||
? (uintmax_t) -1
|
||||
: (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 1));
|
||||
@@ -226,7 +248,8 @@ get_fs_usage (path, disk, fsp)
|
||||
|
||||
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.f_blocks);
|
||||
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.f_bfree);
|
||||
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.f_bavail);
|
||||
fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.f_bavail);
|
||||
fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.f_bavail) != 0;
|
||||
fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.f_files);
|
||||
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.f_ffree);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ struct fs_usage
|
||||
uintmax_t fsu_blocks; /* Total blocks. */
|
||||
uintmax_t fsu_bfree; /* Free blocks available to superuser. */
|
||||
uintmax_t fsu_bavail; /* Free blocks available to non-superuser. */
|
||||
int fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0. */
|
||||
uintmax_t fsu_files; /* Total file nodes. */
|
||||
uintmax_t fsu_ffree; /* Free file nodes. */
|
||||
};
|
||||
|
||||
22
lib/getopt.c
22
lib/getopt.c
@@ -701,16 +701,18 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
else
|
||||
{
|
||||
if (opterr)
|
||||
if (argv[optind - 1][1] == '-')
|
||||
/* --option */
|
||||
fprintf (stderr,
|
||||
_("%s: option `--%s' doesn't allow an argument\n"),
|
||||
argv[0], pfound->name);
|
||||
else
|
||||
/* +option or -option */
|
||||
fprintf (stderr,
|
||||
_("%s: option `%c%s' doesn't allow an argument\n"),
|
||||
argv[0], argv[optind - 1][0], pfound->name);
|
||||
{
|
||||
if (argv[optind - 1][1] == '-')
|
||||
/* --option */
|
||||
fprintf (stderr,
|
||||
_("%s: option `--%s' doesn't allow an argument\n"),
|
||||
argv[0], pfound->name);
|
||||
else
|
||||
/* +option or -option */
|
||||
fprintf (stderr,
|
||||
_("%s: option `%c%s' doesn't allow an argument\n"),
|
||||
argv[0], argv[optind - 1][0], pfound->name);
|
||||
}
|
||||
|
||||
nextchar += strlen (nextchar);
|
||||
|
||||
|
||||
1409
lib/hash.c
1409
lib/hash.c
File diff suppressed because it is too large
Load Diff
266
lib/hash.h
266
lib/hash.h
@@ -1,193 +1,103 @@
|
||||
#ifndef HASH_H
|
||||
# define HASH_H 1
|
||||
/* hash - hashing table processing.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Written by Jim Meyering <meyering@ascend.com>, 1998.
|
||||
|
||||
# if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* A generic hash table package. */
|
||||
|
||||
/* Make sure USE_OBSTACK is defined to 1 if you want the allocator to use
|
||||
obstacks instead of malloc, and recompile `hash.c' with same setting. */
|
||||
|
||||
#ifndef PARAMS
|
||||
# if PROTOTYPES || __STDC__
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
# include <assert.h>
|
||||
typedef unsigned int (*Hash_hasher) PARAMS ((const void *, unsigned int));
|
||||
typedef bool (*Hash_comparator) PARAMS ((const void *, const void *));
|
||||
typedef void (*Hash_data_freer) PARAMS ((void *));
|
||||
typedef bool (*Hash_processor) PARAMS ((void *, void *));
|
||||
|
||||
# ifdef STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
|
||||
# ifndef HAVE_DECL_FREE
|
||||
void free ();
|
||||
# endif
|
||||
|
||||
# ifndef HAVE_DECL_MALLOC
|
||||
char *malloc ();
|
||||
# endif
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# define USE_OBSTACK
|
||||
# ifdef USE_OBSTACK
|
||||
# include "obstack.h"
|
||||
# endif
|
||||
|
||||
# define obstack_chunk_alloc malloc
|
||||
# define obstack_chunk_free free
|
||||
|
||||
struct hash_ent
|
||||
struct hash_entry
|
||||
{
|
||||
void *key;
|
||||
struct hash_ent *next;
|
||||
};
|
||||
typedef struct hash_ent HASH_ENT;
|
||||
|
||||
/* This is particularly useful to cast uses in hash_initialize of the
|
||||
system free function. */
|
||||
typedef void (*Hash_key_freer_type) PARAMS((void *key));
|
||||
|
||||
struct HT
|
||||
{
|
||||
/* User-supplied function for freeing keys. It is specified in
|
||||
hash_initialize. If non-null, it is used by hash_free and
|
||||
hash_clear. You should specify `free' here only if you want
|
||||
these functions to free all of your `key' data. This is typically
|
||||
the case when your key is simply an auxilliary struct that you
|
||||
have malloc'd to aggregate several values. */
|
||||
Hash_key_freer_type hash_key_freer;
|
||||
|
||||
/* User-supplied hash function that hashes entry E to an integer
|
||||
in the range 0..TABLE_SIZE-1. */
|
||||
unsigned int (*hash_hash) PARAMS((const void *e, unsigned int table_size));
|
||||
|
||||
/* User-supplied function that determines whether a new entry is
|
||||
unique by comparing the new entry to entries that hashed to the
|
||||
same bucket index. It should return zero for a pair of entries
|
||||
that compare equal, non-zero otherwise. */
|
||||
|
||||
int (*hash_key_comparator) PARAMS((const void *, const void *));
|
||||
|
||||
HASH_ENT **hash_table;
|
||||
unsigned int hash_table_size;
|
||||
unsigned int hash_n_slots_used;
|
||||
unsigned int hash_max_chain_length;
|
||||
|
||||
/* Gets set when an entry is deleted from a chain of length
|
||||
hash_max_chain_length. Indicates that hash_max_chain_length
|
||||
may no longer be valid. */
|
||||
unsigned int hash_dirty_max_chain_length;
|
||||
|
||||
/* Sum of lengths of all chains (not counting any dummy
|
||||
header entries). */
|
||||
unsigned int hash_n_keys;
|
||||
|
||||
/* A linked list of freed HASH_ENT structs.
|
||||
FIXME: Perhaps this is unnecessary and we should simply free
|
||||
and reallocate such structs. */
|
||||
HASH_ENT *hash_free_entry_list;
|
||||
|
||||
/* FIXME: comment. */
|
||||
# ifdef USE_OBSTACK
|
||||
struct obstack ht_obstack;
|
||||
# endif
|
||||
void *data;
|
||||
struct hash_entry *next;
|
||||
};
|
||||
|
||||
typedef struct HT HT;
|
||||
struct hash_table
|
||||
{
|
||||
/* The array of buckets starts at BUCKET and extends to BUCKET_LIMIT-1,
|
||||
for a possibility of N_BUCKETS. Among those, N_BUCKETS_USED buckets
|
||||
are not empty, there are N_ENTRIES active entries in the table. */
|
||||
struct hash_entry *bucket;
|
||||
struct hash_entry *bucket_limit;
|
||||
unsigned int n_buckets;
|
||||
unsigned int n_buckets_used;
|
||||
unsigned int n_entries;
|
||||
|
||||
unsigned int
|
||||
hash_get_n_slots_used PARAMS((const HT *ht));
|
||||
/* Three functions are given to `hash_initialize', see the documentation
|
||||
block for this function. In a word, HASHER randomizes a user entry
|
||||
into a number up from 0 up to some maximum minus 1; COMPARATOR returns
|
||||
true if two user entries compare equally; and DATA_FREER is the cleanup
|
||||
function for a user entry. */
|
||||
Hash_hasher hasher;
|
||||
Hash_comparator comparator;
|
||||
Hash_data_freer data_freer;
|
||||
|
||||
unsigned int
|
||||
hash_get_max_chain_length PARAMS((HT *ht));
|
||||
/* A linked list of freed struct hash_entry structs. */
|
||||
struct hash_entry *free_entry_list;
|
||||
|
||||
int
|
||||
hash_rehash PARAMS((HT *ht, unsigned int new_table_size));
|
||||
#if USE_OBSTACK
|
||||
/* Whenever obstacks are used, it is possible to allocate all overflowed
|
||||
entries into a single stack, so they all can be freed in a single
|
||||
operation. It is not clear if the speedup is worth the trouble. */
|
||||
struct obstack entry_stack;
|
||||
#endif
|
||||
};
|
||||
|
||||
unsigned int
|
||||
hash_get_table_size PARAMS((const HT *ht));
|
||||
typedef struct hash_table Hash_table;
|
||||
|
||||
HT *
|
||||
hash_initialize PARAMS((unsigned int table_size,
|
||||
void (*key_freer) PARAMS((void *key)),
|
||||
unsigned int (*hash) PARAMS((const void *,
|
||||
unsigned int)),
|
||||
int (*equality_tester) PARAMS((const void *,
|
||||
const void *))));
|
||||
/* Information and lookup. */
|
||||
unsigned int hash_get_n_buckets PARAMS ((const Hash_table *));
|
||||
unsigned int hash_get_n_buckets_used PARAMS ((const Hash_table *));
|
||||
unsigned int hash_get_n_entries PARAMS ((const Hash_table *));
|
||||
unsigned int hash_get_max_bucket_length PARAMS ((const Hash_table *));
|
||||
bool hash_table_ok PARAMS ((const Hash_table *));
|
||||
void hash_print_statistics PARAMS ((const Hash_table *, FILE *));
|
||||
void *hash_lookup PARAMS ((const Hash_table *, const void *));
|
||||
|
||||
unsigned int
|
||||
hash_get_n_keys PARAMS((const HT *ht));
|
||||
/* Walking. */
|
||||
void *hash_get_first PARAMS ((const Hash_table *));
|
||||
void *hash_get_next PARAMS ((const Hash_table *, const void *));
|
||||
unsigned int hash_get_entries PARAMS ((const Hash_table *, void **,
|
||||
unsigned int));
|
||||
unsigned int hash_do_for_each PARAMS ((const Hash_table *, Hash_processor,
|
||||
void *));
|
||||
|
||||
int
|
||||
hash_query_in_table PARAMS((const HT *ht, const void *e));
|
||||
/* Allocation and clean-up. */
|
||||
unsigned int hash_string PARAMS ((const char *, unsigned int));
|
||||
Hash_table *hash_initialize PARAMS ((unsigned int, Hash_hasher,
|
||||
Hash_comparator, Hash_data_freer));
|
||||
void hash_clear PARAMS ((Hash_table *));
|
||||
void hash_free PARAMS ((Hash_table *));
|
||||
|
||||
void *
|
||||
hash_lookup PARAMS((const HT *ht, const void *e));
|
||||
|
||||
void *
|
||||
hash_insert_if_absent PARAMS((HT *ht,
|
||||
const void *e,
|
||||
int *failed));
|
||||
|
||||
void *
|
||||
hash_delete_if_present PARAMS((HT *ht, const void *e));
|
||||
|
||||
void
|
||||
hash_print_statistics PARAMS((const HT *ht, FILE *stream));
|
||||
|
||||
int
|
||||
hash_get_statistics PARAMS((const HT *ht, unsigned int *n_slots_used,
|
||||
unsigned int *n_keys,
|
||||
unsigned int *max_chain_length));
|
||||
|
||||
int
|
||||
hash_table_ok PARAMS((HT *ht));
|
||||
|
||||
void
|
||||
hash_do_for_each PARAMS((HT *ht,
|
||||
void (*f) PARAMS((void *e, void *aux)),
|
||||
void *aux));
|
||||
|
||||
int
|
||||
hash_do_for_each_2 PARAMS((HT *ht,
|
||||
int (*f) PARAMS((void *e, void *aux)),
|
||||
void *aux));
|
||||
|
||||
int
|
||||
hash_do_for_each_in_selected_bucket PARAMS((HT *ht,
|
||||
const void *key,
|
||||
int (*f) PARAMS((const void *bucket_key,
|
||||
void *e,
|
||||
void *aux)),
|
||||
void *aux));
|
||||
|
||||
void
|
||||
hash_clear PARAMS((HT *ht));
|
||||
|
||||
void
|
||||
hash_free PARAMS((HT *ht));
|
||||
|
||||
void
|
||||
hash_get_key_list PARAMS((const HT *ht,
|
||||
unsigned int bufsize,
|
||||
void **buf));
|
||||
|
||||
void *
|
||||
hash_get_first PARAMS((const HT *ht));
|
||||
|
||||
void *
|
||||
hash_get_next PARAMS((const HT *ht, const void *e));
|
||||
|
||||
/* This interface to hash_insert_if_absent is used frequently enough to
|
||||
merit a macro here. */
|
||||
|
||||
# define HASH_INSERT_NEW_ITEM(Ht, Item, Failp) \
|
||||
do \
|
||||
{ \
|
||||
void *_already; \
|
||||
_already = hash_insert_if_absent ((Ht), (Item), Failp); \
|
||||
assert (_already == NULL); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#endif /* HASH_H */
|
||||
/* Insertion and deletion. */
|
||||
bool hash_rehash PARAMS ((Hash_table *, unsigned int));
|
||||
void *hash_insert PARAMS ((Hash_table *, const void *, bool *));
|
||||
void *hash_delete PARAMS ((Hash_table *, const void *));
|
||||
|
||||
125
lib/human.c
125
lib/human.c
@@ -1,5 +1,5 @@
|
||||
/* human.c -- print human readable file size
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -16,9 +16,12 @@
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Originally contributed by lm@sgi.com;
|
||||
--si and large file support added by eggert@twinsun.com. */
|
||||
--si, output block size selection, and large file support
|
||||
added by eggert@twinsun.com. */
|
||||
|
||||
#include <config.h>
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
@@ -34,6 +37,24 @@
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_GETENV
|
||||
char *getenv ();
|
||||
#endif
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
|
||||
#include <argmatch.h>
|
||||
#include <error.h>
|
||||
#include <xstrtoul.h>
|
||||
|
||||
#include "human.h"
|
||||
|
||||
@@ -52,25 +73,32 @@ static const char suffixes[] =
|
||||
|
||||
/* Convert N to a human readable format in BUF.
|
||||
|
||||
N is expressed in units of FROM_UNITS; use units of TO_UNITS in the
|
||||
output number. FROM_UNITS and TO_UNITS must be positive, and one must
|
||||
be a multiple of the other.
|
||||
N is expressed in units of FROM_BLOCK_SIZE. FROM_BLOCK_SIZE must
|
||||
be positive.
|
||||
|
||||
If BASE is nonzero, use a format like "127k" if possible,
|
||||
using powers of BASE; otherwise, use ordinary decimal format.
|
||||
Normally BASE is either 1000 or 1024; it must be at least 2.
|
||||
Most people visually process strings of 3-4 digits effectively,
|
||||
but longer strings of digits are more prone to misinterpretation.
|
||||
Hence, converting to an abbreviated form usually improves readability.
|
||||
Use a suffix indicating which power is being used.
|
||||
For example, assuming BASE is 1024, 8500 would be converted to 8.3k,
|
||||
If OUTPUT_BLOCK_SIZE is positive, use units of OUTPUT_BLOCK_SIZE in
|
||||
the output number. OUTPUT_BLOCK_SIZE must be a multiple of
|
||||
FROM_BLOCK_SIZE or vice versa.
|
||||
|
||||
If OUTPUT_BLOCK_SIZE is negative, use a format like "127k" if
|
||||
possible, using powers of -OUTPUT_BLOCK_SIZE; otherwise, use
|
||||
ordinary decimal format. Normally -OUTPUT_BLOCK_SIZE is either
|
||||
1000 or 1024; it must be at least 2. Most people visually process
|
||||
strings of 3-4 digits effectively, but longer strings of digits are
|
||||
more prone to misinterpretation. Hence, converting to an
|
||||
abbreviated form usually improves readability. Use a suffix
|
||||
indicating which power is being used. For example, assuming
|
||||
-OUTPUT_BLOCK_SIZE is 1024, 8500 would be converted to 8.3k,
|
||||
133456345 to 127M, 56990456345 to 53G, and so on. Numbers smaller
|
||||
than BASE aren't modified. */
|
||||
than -OUTPUT_BLOCK_SIZE aren't modified. */
|
||||
|
||||
char *
|
||||
human_readable (uintmax_t n, char *buf, int from_units, int to_units, int base)
|
||||
human_readable (uintmax_t n, char *buf,
|
||||
int from_block_size, int output_block_size)
|
||||
{
|
||||
uintmax_t amt;
|
||||
int base;
|
||||
int to_block_size;
|
||||
int tenths;
|
||||
int power;
|
||||
char *p;
|
||||
@@ -81,6 +109,17 @@ human_readable (uintmax_t n, char *buf, int from_units, int to_units, int base)
|
||||
3 means AMT.TENTHS + 0.05 < adjusted N < AMT.TENTHS + 0.1. */
|
||||
int rounding;
|
||||
|
||||
if (output_block_size < 0)
|
||||
{
|
||||
base = -output_block_size;
|
||||
to_block_size = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
base = 0;
|
||||
to_block_size = output_block_size;
|
||||
}
|
||||
|
||||
p = buf + LONGEST_HUMAN_READABLE;
|
||||
*p = '\0';
|
||||
|
||||
@@ -89,11 +128,11 @@ human_readable (uintmax_t n, char *buf, int from_units, int to_units, int base)
|
||||
power = 0;
|
||||
#endif
|
||||
|
||||
/* Adjust AMT out of FROM_UNITS units and into TO_UNITS units. */
|
||||
/* Adjust AMT out of FROM_BLOCK_SIZE units and into TO_BLOCK_SIZE units. */
|
||||
|
||||
if (to_units <= from_units)
|
||||
if (to_block_size <= from_block_size)
|
||||
{
|
||||
int multiplier = from_units / to_units;
|
||||
int multiplier = from_block_size / to_block_size;
|
||||
amt = n * multiplier;
|
||||
tenths = rounding = 0;
|
||||
|
||||
@@ -119,7 +158,7 @@ human_readable (uintmax_t n, char *buf, int from_units, int to_units, int base)
|
||||
e *= base;
|
||||
power++;
|
||||
}
|
||||
while (e * base <= amt && power < sizeof suffixes - 1);
|
||||
while (e * base <= damt && power < sizeof suffixes - 1);
|
||||
|
||||
damt /= e;
|
||||
|
||||
@@ -133,7 +172,7 @@ human_readable (uintmax_t n, char *buf, int from_units, int to_units, int base)
|
||||
}
|
||||
else
|
||||
{
|
||||
int divisor = to_units / from_units;
|
||||
int divisor = to_block_size / from_block_size;
|
||||
int r10 = (n % divisor) * 10;
|
||||
int r2 = (r10 % divisor) * 2;
|
||||
amt = n / divisor;
|
||||
@@ -201,3 +240,47 @@ human_readable (uintmax_t n, char *buf, int from_units, int to_units, int base)
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/* The default block size used for output. This number may change in
|
||||
the future as disks get larger. */
|
||||
#ifndef DEFAULT_BLOCK_SIZE
|
||||
# define DEFAULT_BLOCK_SIZE 1024
|
||||
#endif
|
||||
|
||||
static char const *const block_size_args[] = { "human-readable", "si", 0 };
|
||||
static int const block_size_types[] = { -1024, -1000 };
|
||||
|
||||
static strtol_error
|
||||
humblock (char const *spec, int *block_size)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (! spec && ! (spec = getenv ("BLOCK_SIZE")))
|
||||
*block_size = getenv ("POSIXLY_CORRECT") ? 512 : DEFAULT_BLOCK_SIZE;
|
||||
else if (0 <= (i = argmatch (spec, block_size_args)))
|
||||
*block_size = block_size_types[i];
|
||||
else
|
||||
{
|
||||
char *ptr;
|
||||
unsigned long val;
|
||||
strtol_error e = xstrtoul (spec, &ptr, 0, &val, "eEgGkKmMpPtTyYzZ0");
|
||||
if (e != LONGINT_OK)
|
||||
return e;
|
||||
if (*ptr)
|
||||
return LONGINT_INVALID_SUFFIX_CHAR;
|
||||
if ((int) val < 0 || val != (int) val)
|
||||
return LONGINT_OVERFLOW;
|
||||
*block_size = (int) val;
|
||||
}
|
||||
|
||||
return LONGINT_OK;
|
||||
}
|
||||
|
||||
void
|
||||
human_block_size (char const *spec, int report_errors, int *block_size)
|
||||
{
|
||||
strtol_error e = humblock (spec, block_size);
|
||||
if (e != LONGINT_OK && report_errors)
|
||||
STRTOL_FATAL_ERROR (spec, _("block size"), e);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# endif
|
||||
# endif
|
||||
|
||||
char *human_readable PARAMS ((uintmax_t, char *, int, int, int));
|
||||
char *human_readable PARAMS ((uintmax_t, char *, int, int));
|
||||
|
||||
void human_block_size PARAMS ((char const *, int, int *));
|
||||
|
||||
#endif /* HUMAN_H_ */
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef STAT_MACROS_BROKEN
|
||||
#if STAT_MACROS_BROKEN
|
||||
# undef S_ISDIR
|
||||
#endif /* STAT_MACROS_BROKEN. */
|
||||
#endif
|
||||
|
||||
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#if !defined S_ISDIR && defined S_IFDIR
|
||||
# define S_ISDIR(Mode) (((Mode) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
/* If PATH is an existing directory or symbolic link to a directory,
|
||||
|
||||
45
lib/lchown.c
Normal file
45
lib/lchown.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* Provide a stub lchown function for systems that lack it.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* written by Jim Meyering */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
#include "lchown.h"
|
||||
|
||||
/* Work just like chown, except when FILE is a symbolic link.
|
||||
In that case, set errno to ENOSYS and return -1. */
|
||||
|
||||
int
|
||||
lchown (const char *file, uid_t uid, gid_t gid)
|
||||
{
|
||||
struct stat stats;
|
||||
|
||||
if (lstat (file, &stats) == 0 && S_ISLNK (stats.st_mode))
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return chown (file, uid, gid);
|
||||
}
|
||||
9
lib/lchown.h
Normal file
9
lib/lchown.h
Normal file
@@ -0,0 +1,9 @@
|
||||
/* Some systems don't have ENOSYS. */
|
||||
#ifndef ENOSYS
|
||||
# ifdef ENOTSUP
|
||||
# define ENOSYS ENOTSUP
|
||||
# else
|
||||
/* Some systems don't have ENOTSUP either. */
|
||||
# define ENOSYS ENOMSG
|
||||
# endif
|
||||
#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1993, 1995, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1993, 1995, 1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Torbjorn Granlund (tege@sics.se).
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
@@ -325,7 +325,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len)
|
||||
}
|
||||
|
||||
int
|
||||
memcmp (s1, s2, len)
|
||||
rpl_memcmp (s1, s2, len)
|
||||
const __ptr_t s1;
|
||||
const __ptr_t s2;
|
||||
size_t len;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* mktime: convert a `struct tm' to a time_t value
|
||||
/* mktime: convert a `struct tm' to a time_t value zzzzzz
|
||||
Copyright (C) 1993-1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Paul Eggert (eggert@twinsun.com).
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
It is necessary at least when t == time_t. */
|
||||
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
|
||||
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
|
||||
#define TYPE_MAXIMUM(t) (~ (t) 0 - TYPE_MINIMUM (t))
|
||||
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
|
||||
|
||||
#ifndef INT_MIN
|
||||
# define INT_MIN TYPE_MINIMUM (int)
|
||||
|
||||
369
lib/mountlist.c
369
lib/mountlist.c
@@ -42,6 +42,19 @@ char *xrealloc ();
|
||||
char *xstrdup ();
|
||||
void error ();
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
@@ -116,10 +129,10 @@ void error ();
|
||||
/* Return the value of the hexadecimal number represented by CP.
|
||||
No prefix (like '0x') or suffix (like 'h') is expected to be
|
||||
part of CP. */
|
||||
/* FIXME: this can overflow */
|
||||
|
||||
static int
|
||||
xatoi (cp)
|
||||
char *cp;
|
||||
xatoi (char *cp)
|
||||
{
|
||||
int val;
|
||||
|
||||
@@ -140,107 +153,120 @@ xatoi (cp)
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTENT1. */
|
||||
|
||||
#if defined (MOUNTED_GETMNTINFO) && !defined (__NetBSD__) && !defined (__OpenBSD__)
|
||||
#if MOUNTED_GETMNTINFO
|
||||
|
||||
# if ! HAVE_F_FSTYPENAME_IN_STATFS
|
||||
static char *
|
||||
fstype_to_string (t)
|
||||
short t;
|
||||
fstype_to_string (short t)
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
# ifdef MOUNT_PC
|
||||
# ifdef MOUNT_PC
|
||||
case MOUNT_PC:
|
||||
return "pc";
|
||||
# endif
|
||||
# ifdef MOUNT_MFS
|
||||
# endif
|
||||
# ifdef MOUNT_MFS
|
||||
case MOUNT_MFS:
|
||||
return "mfs";
|
||||
# endif
|
||||
# ifdef MOUNT_LO
|
||||
# endif
|
||||
# ifdef MOUNT_LO
|
||||
case MOUNT_LO:
|
||||
return "lo";
|
||||
# endif
|
||||
# ifdef MOUNT_TFS
|
||||
# endif
|
||||
# ifdef MOUNT_TFS
|
||||
case MOUNT_TFS:
|
||||
return "tfs";
|
||||
# endif
|
||||
# ifdef MOUNT_TMP
|
||||
# endif
|
||||
# ifdef MOUNT_TMP
|
||||
case MOUNT_TMP:
|
||||
return "tmp";
|
||||
# endif
|
||||
# ifdef MOUNT_UFS
|
||||
# endif
|
||||
# ifdef MOUNT_UFS
|
||||
case MOUNT_UFS:
|
||||
return "ufs" ;
|
||||
# endif
|
||||
# ifdef MOUNT_NFS
|
||||
# endif
|
||||
# ifdef MOUNT_NFS
|
||||
case MOUNT_NFS:
|
||||
return "nfs" ;
|
||||
# endif
|
||||
# ifdef MOUNT_MSDOS
|
||||
# endif
|
||||
# ifdef MOUNT_MSDOS
|
||||
case MOUNT_MSDOS:
|
||||
return "msdos" ;
|
||||
# endif
|
||||
# ifdef MOUNT_LFS
|
||||
# endif
|
||||
# ifdef MOUNT_LFS
|
||||
case MOUNT_LFS:
|
||||
return "lfs" ;
|
||||
# endif
|
||||
# ifdef MOUNT_LOFS
|
||||
# endif
|
||||
# ifdef MOUNT_LOFS
|
||||
case MOUNT_LOFS:
|
||||
return "lofs" ;
|
||||
# endif
|
||||
# ifdef MOUNT_FDESC
|
||||
# endif
|
||||
# ifdef MOUNT_FDESC
|
||||
case MOUNT_FDESC:
|
||||
return "fdesc" ;
|
||||
# endif
|
||||
# ifdef MOUNT_PORTAL
|
||||
# endif
|
||||
# ifdef MOUNT_PORTAL
|
||||
case MOUNT_PORTAL:
|
||||
return "portal" ;
|
||||
# endif
|
||||
# ifdef MOUNT_NULL
|
||||
# endif
|
||||
# ifdef MOUNT_NULL
|
||||
case MOUNT_NULL:
|
||||
return "null" ;
|
||||
# endif
|
||||
# ifdef MOUNT_UMAP
|
||||
# endif
|
||||
# ifdef MOUNT_UMAP
|
||||
case MOUNT_UMAP:
|
||||
return "umap" ;
|
||||
# endif
|
||||
# ifdef MOUNT_KERNFS
|
||||
# endif
|
||||
# ifdef MOUNT_KERNFS
|
||||
case MOUNT_KERNFS:
|
||||
return "kernfs" ;
|
||||
# endif
|
||||
# ifdef MOUNT_PROCFS
|
||||
# endif
|
||||
# ifdef MOUNT_PROCFS
|
||||
case MOUNT_PROCFS:
|
||||
return "procfs" ;
|
||||
# endif
|
||||
# ifdef MOUNT_AFS
|
||||
# endif
|
||||
# ifdef MOUNT_AFS
|
||||
case MOUNT_AFS:
|
||||
return "afs" ;
|
||||
# endif
|
||||
# ifdef MOUNT_CD9660
|
||||
# endif
|
||||
# ifdef MOUNT_CD9660
|
||||
case MOUNT_CD9660:
|
||||
return "cd9660" ;
|
||||
# endif
|
||||
# ifdef MOUNT_UNION
|
||||
# endif
|
||||
# ifdef MOUNT_UNION
|
||||
case MOUNT_UNION:
|
||||
return "union" ;
|
||||
# endif
|
||||
# ifdef MOUNT_DEVFS
|
||||
# endif
|
||||
# ifdef MOUNT_DEVFS
|
||||
case MOUNT_DEVFS:
|
||||
return "devfs" ;
|
||||
# endif
|
||||
# ifdef MOUNT_EXT2FS
|
||||
# endif
|
||||
# ifdef MOUNT_EXT2FS
|
||||
case MOUNT_EXT2FS:
|
||||
return "ext2fs" ;
|
||||
# endif
|
||||
# endif
|
||||
default:
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
# endif /* ! HAVE_F_FSTYPENAME_IN_STATFS */
|
||||
|
||||
/* __NetBSD__ || BSD_NET2 || __OpenBSD__ */
|
||||
static char *
|
||||
fsp_to_string (const struct statfs *fsp)
|
||||
{
|
||||
# if defined HAVE_F_FSTYPENAME_IN_STATFS
|
||||
return fsp->f_fstypename;
|
||||
# else
|
||||
return fstype_to_string (fsp->f_type);
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif /* MOUNTED_GETMNTINFO */
|
||||
|
||||
#ifdef MOUNTED_VMOUNT /* AIX. */
|
||||
static char *
|
||||
fstype_to_string (t)
|
||||
int t;
|
||||
fstype_to_string (int t)
|
||||
{
|
||||
struct vfs_ent *e;
|
||||
|
||||
@@ -256,21 +282,16 @@ fstype_to_string (t)
|
||||
Add each entry to the tail of the list so that they stay in order.
|
||||
If NEED_FS_TYPE is nonzero, ensure that the filesystem type fields in
|
||||
the returned list are valid. Otherwise, they might not be.
|
||||
If ALL_FS is zero, do not return entries for filesystems that
|
||||
are automounter (dummy) entries. */
|
||||
If ALL_FS is positive, return all entries; if zero, omit entries
|
||||
for filesystems that are automounter (dummy) entries; if negative,
|
||||
also omit non-local filesystems. */
|
||||
|
||||
struct mount_entry *
|
||||
read_filesystem_list (need_fs_type, all_fs)
|
||||
int need_fs_type, all_fs;
|
||||
read_filesystem_list (int need_fs_type, int all_fs)
|
||||
{
|
||||
struct mount_entry *mount_list;
|
||||
struct mount_entry *me;
|
||||
struct mount_entry *mtail;
|
||||
|
||||
/* Start the list off with a dummy entry. */
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
me->me_next = NULL;
|
||||
mount_list = mtail = me;
|
||||
struct mount_entry **mtail = &mount_list;
|
||||
|
||||
#ifdef MOUNTED_LISTMNTENT
|
||||
{
|
||||
@@ -285,18 +306,17 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
|
||||
if(listmntent(&mntlist, KMTAB, NULL, NULL) < 0)
|
||||
return NULL;
|
||||
p = mntlist;
|
||||
while(p){
|
||||
for (p = mntlist; p; p = p->next) {
|
||||
mnt = p->ment;
|
||||
if (all_fs < 0 && REMOTE_FS_TYPE (mnt->mnt_type))
|
||||
continue;
|
||||
me = (struct mount_entry*) xmalloc(sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup(mnt->mnt_fsname);
|
||||
me->me_mountdir = xstrdup(mnt->mnt_dir);
|
||||
me->me_type = xstrdup(mnt->mnt_type);
|
||||
me->me_dev = -1;
|
||||
me->me_next = NULL;
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
p = p->next;
|
||||
*mtail = me;
|
||||
mtail = &me->me_next;
|
||||
}
|
||||
freemntlist(mntlist);
|
||||
}
|
||||
@@ -315,8 +335,10 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
|
||||
while ((mnt = getmntent (fp)))
|
||||
{
|
||||
if (!all_fs && (!strcmp (mnt->mnt_type, "ignore")
|
||||
|| !strcmp (mnt->mnt_type, "auto")))
|
||||
if (all_fs <= 0 && (!strcmp (mnt->mnt_type, "ignore")
|
||||
|| !strcmp (mnt->mnt_type, "auto")))
|
||||
continue;
|
||||
if (all_fs < 0 && REMOTE_FS_TYPE (mnt->mnt_type))
|
||||
continue;
|
||||
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
@@ -333,15 +355,14 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
}
|
||||
else
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
*mtail = me;
|
||||
mtail = &me->me_next;
|
||||
}
|
||||
|
||||
if (endmntent (fp) == 0)
|
||||
return NULL;
|
||||
goto free_then_fail;
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTENT1. */
|
||||
|
||||
@@ -353,23 +374,21 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
entries = getmntinfo (&fsp, MNT_NOWAIT);
|
||||
if (entries < 0)
|
||||
return NULL;
|
||||
while (entries-- > 0)
|
||||
for (; entries-- > 0; fsp++)
|
||||
{
|
||||
char *fs_type = fsp_to_string (fsp);
|
||||
if (all_fs < 0 && REMOTE_FS_TYPE (fs_type))
|
||||
continue;
|
||||
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup (fsp->f_mntfromname);
|
||||
me->me_mountdir = xstrdup (fsp->f_mntonname);
|
||||
# if defined (__NetBSD__) || defined (__OpenBSD__)
|
||||
me->me_type = xstrdup (fsp->f_fstypename);
|
||||
# else
|
||||
me->me_type = fstype_to_string (fsp->f_type);
|
||||
# endif
|
||||
me->me_type = fs_type;
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
fsp++;
|
||||
*mtail = me;
|
||||
mtail = &me->me_next;
|
||||
}
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTINFO */
|
||||
@@ -380,22 +399,25 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
int val;
|
||||
struct fs_data fsd;
|
||||
|
||||
while ((val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
|
||||
(char *) 0)) > 0)
|
||||
while (errno = 0,
|
||||
0 <= (val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
|
||||
(char *) 0)))
|
||||
{
|
||||
if (all_fs < 0 && REMOTE_FS_TYPE (gt_names[fsd.fd_req.fstype]))
|
||||
continue;
|
||||
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup (fsd.fd_req.devname);
|
||||
me->me_mountdir = xstrdup (fsd.fd_req.path);
|
||||
me->me_type = gt_names[fsd.fd_req.fstype];
|
||||
me->me_dev = fsd.fd_req.dev;
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
*mtail = me;
|
||||
mtail = &me->me_next;
|
||||
}
|
||||
if (val < 0)
|
||||
return NULL;
|
||||
goto free_then_fail;
|
||||
}
|
||||
#endif /* MOUNTED_GETMNT. */
|
||||
|
||||
@@ -420,16 +442,18 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
|
||||
for (counter = 0; counter < numsys; counter++)
|
||||
{
|
||||
if (all_fs < 0 && REMOTE_FS_TYPE (mnt_names[stats[counter].f_type]))
|
||||
continue;
|
||||
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup (stats[counter].f_mntfromname);
|
||||
me->me_mountdir = xstrdup (stats[counter].f_mntonname);
|
||||
me->me_type = mnt_names[stats[counter].f_type];
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
*mtail = me;
|
||||
mtail = &me->me_next;
|
||||
}
|
||||
|
||||
free (stats);
|
||||
@@ -448,6 +472,24 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
|
||||
while (fread (&mnt, sizeof mnt, 1, fp) > 0)
|
||||
{
|
||||
char *fs_type = "";
|
||||
|
||||
# ifdef GETFSTYP /* SVR3. */
|
||||
if (need_fs_type || all_fs < 0)
|
||||
{
|
||||
struct statfs fsd;
|
||||
char typebuf[FSTYPSZ];
|
||||
|
||||
if (statfs (mnt.mt_filsys, &fsd, sizeof fsd, 0) != -1
|
||||
&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
|
||||
{
|
||||
if (all_fs < 0 && REMOTE_FS_TYPE (typebuf))
|
||||
continue;
|
||||
fs_type = xstrdup (typebuf);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
# ifdef GETFSTYP /* SVR3. */
|
||||
me->me_devname = xstrdup (mnt.mt_dev);
|
||||
@@ -458,27 +500,23 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
# endif
|
||||
me->me_mountdir = xstrdup (mnt.mt_filsys);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_type = "";
|
||||
# ifdef GETFSTYP /* SVR3. */
|
||||
if (need_fs_type)
|
||||
{
|
||||
struct statfs fsd;
|
||||
char typebuf[FSTYPSZ];
|
||||
|
||||
if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
|
||||
&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
|
||||
me->me_type = xstrdup (typebuf);
|
||||
}
|
||||
# endif
|
||||
me->me_next = NULL;
|
||||
me->me_type = fs_type;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
*mtail = me;
|
||||
mtail = &me->me_next;
|
||||
}
|
||||
|
||||
if (ferror (fp))
|
||||
{
|
||||
int saved_errno = errno;
|
||||
fclose (fp);
|
||||
errno = saved_errno;
|
||||
goto free_then_fail;
|
||||
}
|
||||
|
||||
if (fclose (fp) == EOF)
|
||||
return NULL;
|
||||
goto free_then_fail;
|
||||
}
|
||||
#endif /* MOUNTED_FREAD || MOUNTED_FREAD_FSTYP. */
|
||||
|
||||
@@ -487,16 +525,18 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
struct mntent **mnttbl=getmnttbl(),**ent;
|
||||
for (ent=mnttbl;*ent;ent++)
|
||||
{
|
||||
if (all_fs < 0 && REMOTE_FS_TYPE ((*ent)->mt_fstype))
|
||||
continue;
|
||||
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup ( (*ent)->mt_resource);
|
||||
me->me_mountdir = xstrdup( (*ent)->mt_directory);
|
||||
me->me_type = xstrdup ((*ent)->mt_fstype);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
*mtail = me;
|
||||
mtail = &me->me_next;
|
||||
}
|
||||
endmnttbl();
|
||||
}
|
||||
@@ -508,33 +548,74 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
char *table = MNTTAB;
|
||||
FILE *fp;
|
||||
int ret;
|
||||
int lockfd = -1;
|
||||
|
||||
# if defined F_RDLCK && defined F_SETLKW
|
||||
/* MNTTAB_LOCK is a macro name of our own invention; it's not present in
|
||||
e.g. Solaris 2.6. If the SVR4 folks ever define a macro
|
||||
for this file name, we should use their macro name instead.
|
||||
(Why not just lock MNTTAB directly? We don't know.) */
|
||||
# ifndef MNTTAB_LOCK
|
||||
# define MNTTAB_LOCK "/etc/.mnttab.lock"
|
||||
# endif
|
||||
lockfd = open (MNTTAB_LOCK, O_RDONLY);
|
||||
if (0 <= lockfd)
|
||||
{
|
||||
struct flock flock;
|
||||
flock.l_type = F_RDLCK;
|
||||
flock.l_whence = SEEK_SET;
|
||||
flock.l_start = 0;
|
||||
flock.l_len = 0;
|
||||
while (fcntl (lockfd, F_SETLKW, &flock) == -1)
|
||||
if (errno != EINTR)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
close (lockfd);
|
||||
errno = saved_errno;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (errno != ENOENT)
|
||||
return NULL;
|
||||
# endif
|
||||
|
||||
errno = 0;
|
||||
fp = fopen (table, "r");
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
|
||||
while ((ret = getmntent (fp, &mnt)) == 0)
|
||||
ret = errno;
|
||||
else
|
||||
{
|
||||
/* Don't show automounted filesystems twice on e.g., Solaris. */
|
||||
if (!all_fs && MNT_IGNORE (&mnt))
|
||||
continue;
|
||||
while ((ret = getmntent (fp, &mnt)) == 0)
|
||||
{
|
||||
/* Don't show automounted filesystems twice on e.g., Solaris. */
|
||||
if (all_fs <= 0 && MNT_IGNORE (&mnt))
|
||||
continue;
|
||||
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup (mnt.mnt_special);
|
||||
me->me_mountdir = xstrdup (mnt.mnt_mountp);
|
||||
me->me_type = xstrdup (mnt.mnt_fstype);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
me->me_next = NULL;
|
||||
if (all_fs < 0 && REMOTE_FS_TYPE (mnt.mnt_fstype))
|
||||
continue;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
me->me_devname = xstrdup (mnt.mnt_special);
|
||||
me->me_mountdir = xstrdup (mnt.mnt_mountp);
|
||||
me->me_type = xstrdup (mnt.mnt_fstype);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
|
||||
/* Add to the linked list. */
|
||||
*mtail = me;
|
||||
mtail = &me->me_next;
|
||||
}
|
||||
|
||||
ret = fclose (fp) == EOF ? errno : 0 < ret ? 0 : -1;
|
||||
}
|
||||
|
||||
if (ret > 0)
|
||||
return NULL;
|
||||
if (fclose (fp) == EOF)
|
||||
return NULL;
|
||||
if (0 <= lockfd && close (lockfd) != 0)
|
||||
ret = errno;
|
||||
|
||||
if (0 <= ret)
|
||||
{
|
||||
errno = ret;
|
||||
goto free_then_fail;
|
||||
}
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTENT2. */
|
||||
|
||||
@@ -555,6 +636,8 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
thisent += vmp->vmt_length)
|
||||
{
|
||||
vmp = (struct vmount *) thisent;
|
||||
if (all_fs < 0 && vmp->vmt_flags & MNT_REMOTE)
|
||||
continue;
|
||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||
if (vmp->vmt_flags & MNT_REMOTE)
|
||||
{
|
||||
@@ -576,19 +659,35 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
|
||||
me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype));
|
||||
me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want. */
|
||||
me->me_next = NULL;
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
*mtail = me;
|
||||
mtail = &me->me_next;
|
||||
}
|
||||
free (entries);
|
||||
}
|
||||
#endif /* MOUNTED_VMOUNT. */
|
||||
|
||||
/* Free the dummy head. */
|
||||
me = mount_list;
|
||||
mount_list = mount_list->me_next;
|
||||
free (me);
|
||||
*mtail = NULL;
|
||||
return mount_list;
|
||||
|
||||
|
||||
free_then_fail:
|
||||
{
|
||||
int saved_errno = errno;
|
||||
*mtail = NULL;
|
||||
|
||||
while (mount_list)
|
||||
{
|
||||
me = mount_list->me_next;
|
||||
free (mount_list->me_devname);
|
||||
free (mount_list->me_mountdir);
|
||||
/* FIXME: me_type is not always malloced. */
|
||||
free (mount_list);
|
||||
mount_list = me;
|
||||
}
|
||||
|
||||
errno = saved_errno;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* mountlist.h -- declarations for list of mounted filesystems
|
||||
Copyright (C) 1991, 1992 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 1992, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -25,8 +25,19 @@ struct mount_entry
|
||||
struct mount_entry *me_next;
|
||||
};
|
||||
|
||||
#if __STDC__
|
||||
struct mount_entry *read_filesystem_list (int need_fs_type, int all_fs);
|
||||
#else
|
||||
struct mount_entry *read_filesystem_list ();
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
struct mount_entry *read_filesystem_list PARAMS ((int need_fs_type,
|
||||
int all_fs));
|
||||
|
||||
/* In most environments, by default, a filesystem type is remote if it
|
||||
begins with "nfs". This allows variants like "nfs3". */
|
||||
#ifndef REMOTE_FS_TYPE
|
||||
# define REMOTE_FS_TYPE(t) (!strncmp (t, "nfs", 3))
|
||||
#endif
|
||||
|
||||
@@ -74,36 +74,38 @@ char const *const quoting_style_args[] =
|
||||
"literal", "shell", "shell-always", "c", "escape", 0
|
||||
};
|
||||
|
||||
/* The default quoting options. */
|
||||
static struct quoting_options default_quoting_options;
|
||||
|
||||
/* Allocate a new set of quoting options, with contents initially identical
|
||||
to O if O is not null, or to a default value if O is null.
|
||||
to O if O is not null, or to the default if O is null.
|
||||
It is the caller's responsibility to free the result. */
|
||||
struct quoting_options *
|
||||
clone_quoting_options (struct quoting_options *o)
|
||||
{
|
||||
struct quoting_options *p
|
||||
= (struct quoting_options *) xmalloc (sizeof (struct quoting_options));
|
||||
if (o)
|
||||
*p = *o;
|
||||
else
|
||||
memset (p, 0, sizeof *p);
|
||||
*p = *(o ? o : &default_quoting_options);
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Get the value of O's quoting style. */
|
||||
/* Get the value of O's quoting style. If O is null, use the default. */
|
||||
enum quoting_style
|
||||
get_quoting_style (struct quoting_options *o)
|
||||
{
|
||||
return o->style;
|
||||
return (o ? o : &default_quoting_options)->style;
|
||||
}
|
||||
|
||||
/* In O, set the value of the quoting style to S. */
|
||||
/* In O (or in the default if O is null),
|
||||
set the value of the quoting style to S. */
|
||||
void
|
||||
set_quoting_style (struct quoting_options *o, enum quoting_style s)
|
||||
{
|
||||
o->style = s;
|
||||
(o ? o : &default_quoting_options)->style = s;
|
||||
}
|
||||
|
||||
/* In O, set the value of the quoting options for character C to I.
|
||||
/* In O (or in the default if O is null),
|
||||
set the value of the quoting options for character C to I.
|
||||
Return the old value. Currently, the only values defined for I are
|
||||
0 (the default) and 1 (which means to quote the character even if
|
||||
it would not otherwise be quoted). */
|
||||
@@ -111,22 +113,23 @@ int
|
||||
set_char_quoting (struct quoting_options *o, char c, int i)
|
||||
{
|
||||
unsigned char uc = c;
|
||||
int *p = o->quote_these_too + uc / INT_BITS;
|
||||
int *p = (o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS;
|
||||
int shift = uc % INT_BITS;
|
||||
int r = (*p >> shift) & 1;
|
||||
*p ^= ((i & 1) ^ r) << shift;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Place into buffer BUF (of size BUFSIZE) a quoted version of
|
||||
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
|
||||
argument ARG (of size ARGSIZE), using O to control quoting.
|
||||
If O is null, use the default.
|
||||
Terminate the output with a null character, and return the written
|
||||
size of the output, not counting the terminating null.
|
||||
If BUFSIZE is too small to store the output string, return the
|
||||
value that would have been returned had BUFSIZE been large enough.
|
||||
If BUFFERSIZE is too small to store the output string, return the
|
||||
value that would have been returned had BUFFERSIZE been large enough.
|
||||
If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */
|
||||
size_t
|
||||
quotearg_buffer (char *buf, size_t bufsize,
|
||||
quotearg_buffer (char *buffer, size_t buffersize,
|
||||
char const *arg, size_t argsize,
|
||||
struct quoting_options const *o)
|
||||
{
|
||||
@@ -134,8 +137,16 @@ quotearg_buffer (char *buf, size_t bufsize,
|
||||
size_t i;
|
||||
size_t len;
|
||||
int quote_mark;
|
||||
enum quoting_style quoting_style = o->style;
|
||||
#define STORE(c) do { if (len < bufsize) buf[len] = (c); len++; } while (0)
|
||||
struct quoting_options const *p = o ? o : &default_quoting_options;
|
||||
enum quoting_style quoting_style = p->style;
|
||||
#define STORE(c) \
|
||||
do \
|
||||
{ \
|
||||
if (len < buffersize) \
|
||||
buffer[len] = (c); \
|
||||
len++; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
switch (quoting_style)
|
||||
{
|
||||
@@ -168,7 +179,7 @@ quotearg_buffer (char *buf, size_t bufsize,
|
||||
goto needs_quoting;
|
||||
}
|
||||
|
||||
if (o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))
|
||||
if (p->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))
|
||||
goto needs_quoting;
|
||||
|
||||
STORE (c);
|
||||
@@ -254,7 +265,7 @@ quotearg_buffer (char *buf, size_t bufsize,
|
||||
break;
|
||||
}
|
||||
|
||||
if (! (o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))))
|
||||
if (! (p->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))))
|
||||
goto store_c;
|
||||
|
||||
store_escape:
|
||||
@@ -269,8 +280,8 @@ quotearg_buffer (char *buf, size_t bufsize,
|
||||
STORE (quote_mark);
|
||||
|
||||
done:
|
||||
if (len < bufsize)
|
||||
buf[len] = '\0';
|
||||
if (len < buffersize)
|
||||
buffer[len] = '\0';
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -316,12 +327,10 @@ quotearg_n_options (int n, char const *arg, struct quoting_options *options)
|
||||
}
|
||||
}
|
||||
|
||||
struct quoting_options quotearg_quoting_options;
|
||||
|
||||
char *
|
||||
quotearg_n (int n, char const *arg)
|
||||
{
|
||||
return quotearg_n_options (n, arg, "earg_quoting_options);
|
||||
return quotearg_n_options (n, arg, &default_quoting_options);
|
||||
}
|
||||
|
||||
char *
|
||||
@@ -334,7 +343,7 @@ char *
|
||||
quotearg_char (char const *arg, char ch)
|
||||
{
|
||||
struct quoting_options options;
|
||||
options = quotearg_quoting_options;
|
||||
options = default_quoting_options;
|
||||
set_char_quoting (&options, ch, 1);
|
||||
return quotearg_n_options (0, arg, &options);
|
||||
}
|
||||
|
||||
@@ -39,49 +39,51 @@ extern char const *const quoting_style_args[];
|
||||
struct quoting_options;
|
||||
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# if defined PROTOTYPES || defined __STDC__
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The functions listed below set and use a hidden variable
|
||||
that contains the default quoting style options. */
|
||||
|
||||
/* Allocate a new set of quoting options, with contents initially identical
|
||||
to O if O is not null, or to a default value if O is null.
|
||||
to O if O is not null, or to the default if O is null.
|
||||
It is the caller's responsibility to free the result. */
|
||||
struct quoting_options *clone_quoting_options
|
||||
PARAMS ((struct quoting_options *o));
|
||||
|
||||
/* Get the value of O's quoting style. */
|
||||
/* Get the value of O's quoting style. If O is null, use the default. */
|
||||
enum quoting_style get_quoting_style PARAMS ((struct quoting_options *o));
|
||||
|
||||
/* In O, set the value of the quoting style to S. */
|
||||
/* In O (or in the default if O is null),
|
||||
set the value of the quoting style to S. */
|
||||
void set_quoting_style PARAMS ((struct quoting_options *o,
|
||||
enum quoting_style s));
|
||||
|
||||
/* In O, set the value of the quoting options for character C to I.
|
||||
/* In O (or in the default if O is null),
|
||||
set the value of the quoting options for character C to I.
|
||||
Return the old value. Currently, the only values defined for I are
|
||||
0 (the default) and 1 (which means to quote the character even if
|
||||
it would not otherwise be quoted). */
|
||||
int set_char_quoting PARAMS ((struct quoting_options *o, char c, int i));
|
||||
|
||||
/* Place into buffer BUF (of size BUFSIZE) a quoted version of
|
||||
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
|
||||
argument ARG (of size ARGSIZE), using O to control quoting.
|
||||
If O is null, use the default.
|
||||
Terminate the output with a null character, and return the written
|
||||
size of the output, not counting the terminating null.
|
||||
If BUFSIZE is too small to store the output string, return the
|
||||
value that would have been returned had BUFSIZE been large enough.
|
||||
If BUFFERSIZE is too small to store the output string, return the
|
||||
value that would have been returned had BUFFERSIZE been large enough.
|
||||
If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */
|
||||
size_t quotearg_buffer PARAMS ((char *buf, size_t bufsize,
|
||||
size_t quotearg_buffer PARAMS ((char *buffer, size_t buffersize,
|
||||
char const *arg, size_t argsize,
|
||||
struct quoting_options const *o));
|
||||
|
||||
/* The quoting options used by the convenience functions listed below. */
|
||||
|
||||
extern struct quoting_options quotearg_quoting_options;
|
||||
|
||||
/* Use storage slot N to return a quoted version of the string ARG.
|
||||
The variable quotearg_quoting_options specifies the quoting options.
|
||||
Use the default quoting options.
|
||||
The returned value points to static storage that can be
|
||||
reused by the next call to this function with the same value of N.
|
||||
N must be nonnegative. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* GNU's read utmp module.
|
||||
Copyright (C) 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 92, 93, 94, 95, 96, 1997, 1998 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,8 +34,7 @@ char *xmalloc ();
|
||||
trailing spaces from the copy, NUL terminate it, and return the copy. */
|
||||
|
||||
char *
|
||||
extract_trimmed_name (ut)
|
||||
const STRUCT_UTMP *ut;
|
||||
extract_trimmed_name (const STRUCT_UTMP *ut)
|
||||
{
|
||||
char *p, *trimmed_name;
|
||||
|
||||
@@ -54,11 +53,74 @@ extract_trimmed_name (ut)
|
||||
number of entries read, and return zero. If there is any error,
|
||||
return non-zero and don't modify the parameters. */
|
||||
|
||||
#ifdef HAVE_UTMPNAME
|
||||
|
||||
int
|
||||
read_utmp (filename, n_entries, utmp_buf)
|
||||
const char *filename;
|
||||
int *n_entries;
|
||||
STRUCT_UTMP **utmp_buf;
|
||||
read_utmp (const char *filename, int *n_entries, STRUCT_UTMP **utmp_buf)
|
||||
{
|
||||
int count_utmp = 0;
|
||||
int n_read;
|
||||
STRUCT_UTMP *u;
|
||||
STRUCT_UTMP *uptr;
|
||||
STRUCT_UTMP *utmp_contents;
|
||||
|
||||
if (utmpname (filename))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* FIXME: going through the list twice is wasteful. */
|
||||
|
||||
/* count the entries in utmp */
|
||||
setutent ();
|
||||
while ((u = getutent ()) != NULL)
|
||||
++count_utmp;
|
||||
|
||||
if (count_utmp == 0)
|
||||
return 0;
|
||||
|
||||
utmp_contents = (STRUCT_UTMP *) xmalloc (count_utmp * sizeof (STRUCT_UTMP));
|
||||
|
||||
/* read the entries in utmp */
|
||||
|
||||
/* FIXME: can this fail? */
|
||||
setutent ();
|
||||
|
||||
n_read = 0;
|
||||
uptr = utmp_contents;
|
||||
while ((u = getutent ()) != NULL)
|
||||
{
|
||||
++n_read;
|
||||
if (n_read > count_utmp)
|
||||
{
|
||||
STRUCT_UTMP *old_utmp_contents = utmp_contents;
|
||||
++count_utmp;
|
||||
utmp_contents = (STRUCT_UTMP *) xrealloc (utmp_contents,
|
||||
(count_utmp
|
||||
* sizeof (STRUCT_UTMP)));
|
||||
uptr = utmp_contents + (uptr - old_utmp_contents);
|
||||
}
|
||||
*uptr = *u;
|
||||
++uptr;
|
||||
}
|
||||
|
||||
if (n_read != count_utmp)
|
||||
utmp_contents = (STRUCT_UTMP *) xrealloc (utmp_contents,
|
||||
n_read * sizeof (STRUCT_UTMP));
|
||||
|
||||
/* FIXME: can this fail? */
|
||||
endutent ();
|
||||
|
||||
*n_entries = n_read;
|
||||
*utmp_buf = utmp_contents;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
read_utmp (const char *filename, int *n_entries, STRUCT_UTMP **utmp_buf)
|
||||
{
|
||||
FILE *utmp;
|
||||
struct stat file_stats;
|
||||
@@ -91,3 +153,5 @@ read_utmp (filename, n_entries, utmp_buf)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* HAVE_UTMPNAME */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Declarations for GNU's read utmp module.
|
||||
Copyright (C) 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 92, 93, 94, 95, 96, 1997, 1998 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,6 +20,14 @@
|
||||
#ifndef __READUTMP_H__
|
||||
# define __READUTMP_H__
|
||||
|
||||
# ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# include <stdio.h>
|
||||
# include <sys/types.h>
|
||||
|
||||
|
||||
475
lib/regex.c
475
lib/regex.c
@@ -2,30 +2,28 @@
|
||||
version 0.12.
|
||||
(Implements POSIX draft P1003.2/D11.2, except for some of the
|
||||
internationalization features.)
|
||||
Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the
|
||||
GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
/* AIX requires this to be the first thing in the file. */
|
||||
#if defined (_AIX) && !defined (REGEX_MALLOC)
|
||||
#if defined _AIX && !defined REGEX_MALLOC
|
||||
#pragma alloca
|
||||
#endif
|
||||
|
||||
@@ -33,25 +31,36 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined(STDC_HEADERS) && !defined(emacs)
|
||||
#include <stddef.h>
|
||||
#ifndef PARAMS
|
||||
# if defined __GNUC__ || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(args) args
|
||||
# else
|
||||
# define PARAMS(args) ()
|
||||
# endif /* GCC. */
|
||||
#endif /* Not PARAMS. */
|
||||
|
||||
#if defined STDC_HEADERS && !defined emacs
|
||||
# include <stddef.h>
|
||||
#else
|
||||
/* We need this for `regex.h', and perhaps for the Emacs include files. */
|
||||
#include <sys/types.h>
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#define WIDE_CHAR_SUPPORT \
|
||||
defined _LIBC || (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
|
||||
|
||||
/* For platform which support the ISO C amendement 1 functionality we
|
||||
support user defined character classes. */
|
||||
#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
|
||||
# include <wctype.h>
|
||||
#if WIDE_CHAR_SUPPORT
|
||||
# include <wchar.h>
|
||||
# include <wctype.h>
|
||||
#endif
|
||||
|
||||
/* This is for other GNU distributions with internationalized messages. */
|
||||
#if HAVE_LIBINTL_H || defined (_LIBC)
|
||||
#if HAVE_LIBINTL_H || defined _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# define gettext(msgid) (msgid)
|
||||
@@ -60,83 +69,83 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#ifndef gettext_noop
|
||||
/* This define is so xgettext can find the internationalizable
|
||||
strings. */
|
||||
#define gettext_noop(String) String
|
||||
# define gettext_noop(String) String
|
||||
#endif
|
||||
|
||||
/* The `emacs' switch turns on certain matching commands
|
||||
that make sense only in Emacs. */
|
||||
#ifdef emacs
|
||||
|
||||
#include "lisp.h"
|
||||
#include "buffer.h"
|
||||
#include "syntax.h"
|
||||
# include "lisp.h"
|
||||
# include "buffer.h"
|
||||
# include "syntax.h"
|
||||
|
||||
#else /* not emacs */
|
||||
|
||||
/* If we are not linking with Emacs proper,
|
||||
we can't use the relocating allocator
|
||||
even if config.h says that we can. */
|
||||
#undef REL_ALLOC
|
||||
# undef REL_ALLOC
|
||||
|
||||
#if defined (STDC_HEADERS) || defined (_LIBC)
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
# if defined STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
# else
|
||||
char *malloc ();
|
||||
char *realloc ();
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
|
||||
If nothing else has been done, use the method below. */
|
||||
#ifdef INHIBIT_STRING_HEADER
|
||||
#if !(defined (HAVE_BZERO) && defined (HAVE_BCOPY))
|
||||
#if !defined (bzero) && !defined (bcopy)
|
||||
#undef INHIBIT_STRING_HEADER
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
# ifdef INHIBIT_STRING_HEADER
|
||||
# if !(defined HAVE_BZERO && defined HAVE_BCOPY)
|
||||
# if !defined bzero && !defined bcopy
|
||||
# undef INHIBIT_STRING_HEADER
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* This is the normal way of making sure we have a bcopy and a bzero.
|
||||
This is used in most programs--a few other programs avoid this
|
||||
by defining INHIBIT_STRING_HEADER. */
|
||||
#ifndef INHIBIT_STRING_HEADER
|
||||
#if defined (HAVE_STRING_H) || defined (STDC_HEADERS) || defined (_LIBC)
|
||||
#include <string.h>
|
||||
#ifndef bcmp
|
||||
#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
|
||||
#endif
|
||||
#ifndef bcopy
|
||||
#define bcopy(s, d, n) memcpy ((d), (s), (n))
|
||||
#endif
|
||||
#ifndef bzero
|
||||
#define bzero(s, n) memset ((s), 0, (n))
|
||||
#endif
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#endif
|
||||
# ifndef INHIBIT_STRING_HEADER
|
||||
# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
|
||||
# include <string.h>
|
||||
# if !defined bzero && !defined _LIBC
|
||||
# define bzero(s, n) (memset (s, '\0', n), (s))
|
||||
# endif
|
||||
# else
|
||||
# include <strings.h>
|
||||
# ifndef memcmp
|
||||
# define memcmp(s1, s2, n) bcmp (s1, s2, n)
|
||||
# endif
|
||||
# ifndef memcpy
|
||||
# define memcpy(d, s, n) (bcopy (s, d, n), (d))
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Define the syntax stuff for \<, \>, etc. */
|
||||
|
||||
/* This must be nonzero for the wordchar and notwordchar pattern
|
||||
commands in re_match_2. */
|
||||
#ifndef Sword
|
||||
#define Sword 1
|
||||
#endif
|
||||
# ifndef Sword
|
||||
# define Sword 1
|
||||
# endif
|
||||
|
||||
#ifdef SWITCH_ENUM_BUG
|
||||
#define SWITCH_ENUM_CAST(x) ((int)(x))
|
||||
#else
|
||||
#define SWITCH_ENUM_CAST(x) (x)
|
||||
#endif
|
||||
# ifdef SWITCH_ENUM_BUG
|
||||
# define SWITCH_ENUM_CAST(x) ((int)(x))
|
||||
# else
|
||||
# define SWITCH_ENUM_CAST(x) (x)
|
||||
# endif
|
||||
|
||||
#ifdef SYNTAX_TABLE
|
||||
/* How many characters in the character set. */
|
||||
# define CHAR_SET_SIZE 256
|
||||
|
||||
# ifdef SYNTAX_TABLE
|
||||
|
||||
extern char *re_syntax_table;
|
||||
|
||||
#else /* not SYNTAX_TABLE */
|
||||
|
||||
/* How many characters in the character set. */
|
||||
#define CHAR_SET_SIZE 256
|
||||
# else /* not SYNTAX_TABLE */
|
||||
|
||||
static char re_syntax_table[CHAR_SET_SIZE];
|
||||
|
||||
@@ -165,9 +174,9 @@ init_syntax_once ()
|
||||
done = 1;
|
||||
}
|
||||
|
||||
#endif /* not SYNTAX_TABLE */
|
||||
# endif /* not SYNTAX_TABLE */
|
||||
|
||||
#define SYNTAX(c) re_syntax_table[c]
|
||||
# define SYNTAX(c) re_syntax_table[c]
|
||||
|
||||
#endif /* not emacs */
|
||||
|
||||
@@ -188,23 +197,25 @@ init_syntax_once ()
|
||||
Defining isascii to 1 should let any compiler worth its salt
|
||||
eliminate the && through constant folding." */
|
||||
|
||||
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
|
||||
#define ISASCII(c) 1
|
||||
#undef ISASCII
|
||||
#if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
|
||||
# define ISASCII(c) 1
|
||||
#else
|
||||
#define ISASCII(c) isascii(c)
|
||||
# define ISASCII(c) isascii(c)
|
||||
#endif
|
||||
|
||||
#ifdef isblank
|
||||
#define ISBLANK(c) (ISASCII (c) && isblank (c))
|
||||
# define ISBLANK(c) (ISASCII (c) && isblank (c))
|
||||
#else
|
||||
#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
|
||||
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
|
||||
#endif
|
||||
#ifdef isgraph
|
||||
#define ISGRAPH(c) (ISASCII (c) && isgraph (c))
|
||||
# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
|
||||
#else
|
||||
#define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
|
||||
# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
|
||||
#endif
|
||||
|
||||
#undef ISPRINT
|
||||
#define ISPRINT(c) (ISASCII (c) && isprint (c))
|
||||
#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
|
||||
#define ISALNUM(c) (ISASCII (c) && isalnum (c))
|
||||
@@ -217,7 +228,7 @@ init_syntax_once ()
|
||||
#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
# define NULL (void *)0
|
||||
#endif
|
||||
|
||||
/* We remove any previous definition of `SIGN_EXTEND_CHAR',
|
||||
@@ -226,10 +237,10 @@ init_syntax_once ()
|
||||
(Per Bothner suggested the basic approach.) */
|
||||
#undef SIGN_EXTEND_CHAR
|
||||
#if __STDC__
|
||||
#define SIGN_EXTEND_CHAR(c) ((signed char) (c))
|
||||
# define SIGN_EXTEND_CHAR(c) ((signed char) (c))
|
||||
#else /* not __STDC__ */
|
||||
/* As in Harbison and Steele. */
|
||||
#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
|
||||
# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
|
||||
#endif
|
||||
|
||||
/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
|
||||
@@ -244,74 +255,67 @@ init_syntax_once ()
|
||||
|
||||
#ifdef REGEX_MALLOC
|
||||
|
||||
#define REGEX_ALLOCATE malloc
|
||||
#define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
|
||||
#define REGEX_FREE free
|
||||
# define REGEX_ALLOCATE malloc
|
||||
# define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
|
||||
# define REGEX_FREE free
|
||||
|
||||
#else /* not REGEX_MALLOC */
|
||||
|
||||
/* Emacs already defines alloca, sometimes. */
|
||||
#ifndef alloca
|
||||
# ifndef alloca
|
||||
|
||||
/* Make alloca work the best possible way. */
|
||||
#ifdef __GNUC__
|
||||
#define alloca __builtin_alloca
|
||||
#else /* not __GNUC__ */
|
||||
#if HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#else /* not __GNUC__ or HAVE_ALLOCA_H */
|
||||
#if 0 /* It is a bad idea to declare alloca. We always cast the result. */
|
||||
#ifndef _AIX /* Already did AIX, up at the top. */
|
||||
char *alloca ();
|
||||
#endif /* not _AIX */
|
||||
#endif
|
||||
#endif /* not HAVE_ALLOCA_H */
|
||||
#endif /* not __GNUC__ */
|
||||
# ifdef __GNUC__
|
||||
# define alloca __builtin_alloca
|
||||
# else /* not __GNUC__ */
|
||||
# if HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# endif /* HAVE_ALLOCA_H */
|
||||
# endif /* not __GNUC__ */
|
||||
|
||||
#endif /* not alloca */
|
||||
# endif /* not alloca */
|
||||
|
||||
#define REGEX_ALLOCATE alloca
|
||||
# define REGEX_ALLOCATE alloca
|
||||
|
||||
/* Assumes a `char *destination' variable. */
|
||||
#define REGEX_REALLOCATE(source, osize, nsize) \
|
||||
# define REGEX_REALLOCATE(source, osize, nsize) \
|
||||
(destination = (char *) alloca (nsize), \
|
||||
bcopy (source, destination, osize), \
|
||||
destination)
|
||||
memcpy (destination, source, osize))
|
||||
|
||||
/* No need to do anything to free, after alloca. */
|
||||
#define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */
|
||||
# define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */
|
||||
|
||||
#endif /* not REGEX_MALLOC */
|
||||
|
||||
/* Define how to allocate the failure stack. */
|
||||
|
||||
#if defined (REL_ALLOC) && defined (REGEX_MALLOC)
|
||||
#if defined REL_ALLOC && defined REGEX_MALLOC
|
||||
|
||||
#define REGEX_ALLOCATE_STACK(size) \
|
||||
# define REGEX_ALLOCATE_STACK(size) \
|
||||
r_alloc (&failure_stack_ptr, (size))
|
||||
#define REGEX_REALLOCATE_STACK(source, osize, nsize) \
|
||||
# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
|
||||
r_re_alloc (&failure_stack_ptr, (nsize))
|
||||
#define REGEX_FREE_STACK(ptr) \
|
||||
# define REGEX_FREE_STACK(ptr) \
|
||||
r_alloc_free (&failure_stack_ptr)
|
||||
|
||||
#else /* not using relocating allocator */
|
||||
|
||||
#ifdef REGEX_MALLOC
|
||||
# ifdef REGEX_MALLOC
|
||||
|
||||
#define REGEX_ALLOCATE_STACK malloc
|
||||
#define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize)
|
||||
#define REGEX_FREE_STACK free
|
||||
# define REGEX_ALLOCATE_STACK malloc
|
||||
# define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize)
|
||||
# define REGEX_FREE_STACK free
|
||||
|
||||
#else /* not REGEX_MALLOC */
|
||||
# else /* not REGEX_MALLOC */
|
||||
|
||||
#define REGEX_ALLOCATE_STACK alloca
|
||||
# define REGEX_ALLOCATE_STACK alloca
|
||||
|
||||
#define REGEX_REALLOCATE_STACK(source, osize, nsize) \
|
||||
# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
|
||||
REGEX_REALLOCATE (source, osize, nsize)
|
||||
/* No need to explicitly free anything. */
|
||||
#define REGEX_FREE_STACK(arg)
|
||||
# define REGEX_FREE_STACK(arg)
|
||||
|
||||
#endif /* not REGEX_MALLOC */
|
||||
# endif /* not REGEX_MALLOC */
|
||||
#endif /* not using relocating allocator */
|
||||
|
||||
|
||||
@@ -341,7 +345,12 @@ typedef char boolean;
|
||||
#define false 0
|
||||
#define true 1
|
||||
|
||||
static int re_match_2_internal ();
|
||||
static int re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
|
||||
const char *string1, int size1,
|
||||
const char *string2, int size2,
|
||||
int pos,
|
||||
struct re_registers *regs,
|
||||
int stop));
|
||||
|
||||
/* These are the command codes that appear in compiled regular
|
||||
expressions. Some opcodes are followed by argument bytes. A
|
||||
@@ -523,10 +532,10 @@ extract_number (dest, source)
|
||||
*dest += temp << 8;
|
||||
}
|
||||
|
||||
#ifndef EXTRACT_MACROS /* To debug the macros. */
|
||||
#undef EXTRACT_NUMBER
|
||||
#define EXTRACT_NUMBER(dest, src) extract_number (&dest, src)
|
||||
#endif /* not EXTRACT_MACROS */
|
||||
# ifndef EXTRACT_MACROS /* To debug the macros. */
|
||||
# undef EXTRACT_NUMBER
|
||||
# define EXTRACT_NUMBER(dest, src) extract_number (&dest, src)
|
||||
# endif /* not EXTRACT_MACROS */
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
@@ -551,11 +560,11 @@ extract_number_and_incr (destination, source)
|
||||
*source += 2;
|
||||
}
|
||||
|
||||
#ifndef EXTRACT_MACROS
|
||||
#undef EXTRACT_NUMBER_AND_INCR
|
||||
#define EXTRACT_NUMBER_AND_INCR(dest, src) \
|
||||
# ifndef EXTRACT_MACROS
|
||||
# undef EXTRACT_NUMBER_AND_INCR
|
||||
# define EXTRACT_NUMBER_AND_INCR(dest, src) \
|
||||
extract_number_and_incr (&dest, &src)
|
||||
#endif /* not EXTRACT_MACROS */
|
||||
# endif /* not EXTRACT_MACROS */
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
@@ -568,21 +577,21 @@ extract_number_and_incr (destination, source)
|
||||
#ifdef DEBUG
|
||||
|
||||
/* We use standard I/O for debugging. */
|
||||
#include <stdio.h>
|
||||
# include <stdio.h>
|
||||
|
||||
/* It is useful to test things that ``must'' be true when debugging. */
|
||||
#include <assert.h>
|
||||
# include <assert.h>
|
||||
|
||||
static int debug = 0;
|
||||
|
||||
#define DEBUG_STATEMENT(e) e
|
||||
#define DEBUG_PRINT1(x) if (debug) printf (x)
|
||||
#define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
|
||||
#define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
|
||||
#define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
|
||||
#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
|
||||
# define DEBUG_STATEMENT(e) e
|
||||
# define DEBUG_PRINT1(x) if (debug) printf (x)
|
||||
# define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
|
||||
# define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
|
||||
# define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
|
||||
# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
|
||||
if (debug) print_partial_compiled_pattern (s, e)
|
||||
#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
|
||||
# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
|
||||
if (debug) print_double_string (w, s1, sz1, s2, sz2)
|
||||
|
||||
|
||||
@@ -802,7 +811,7 @@ print_partial_compiled_pattern (start, end)
|
||||
case wordend:
|
||||
printf ("/wordend");
|
||||
|
||||
#ifdef emacs
|
||||
# ifdef emacs
|
||||
case before_dot:
|
||||
printf ("/before_dot");
|
||||
break;
|
||||
@@ -826,7 +835,7 @@ print_partial_compiled_pattern (start, end)
|
||||
mcnt = *p++;
|
||||
printf ("/%d", mcnt);
|
||||
break;
|
||||
#endif /* emacs */
|
||||
# endif /* emacs */
|
||||
|
||||
case wordchar:
|
||||
printf ("/wordchar");
|
||||
@@ -919,16 +928,16 @@ printchar (c)
|
||||
|
||||
#else /* not DEBUG */
|
||||
|
||||
#undef assert
|
||||
#define assert(e)
|
||||
# undef assert
|
||||
# define assert(e)
|
||||
|
||||
#define DEBUG_STATEMENT(e)
|
||||
#define DEBUG_PRINT1(x)
|
||||
#define DEBUG_PRINT2(x1, x2)
|
||||
#define DEBUG_PRINT3(x1, x2, x3)
|
||||
#define DEBUG_PRINT4(x1, x2, x3, x4)
|
||||
#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
|
||||
#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
|
||||
# define DEBUG_STATEMENT(e)
|
||||
# define DEBUG_PRINT1(x)
|
||||
# define DEBUG_PRINT2(x1, x2)
|
||||
# define DEBUG_PRINT3(x1, x2, x3)
|
||||
# define DEBUG_PRINT4(x1, x2, x3, x4)
|
||||
# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
|
||||
# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
|
||||
|
||||
#endif /* not DEBUG */
|
||||
|
||||
@@ -1014,7 +1023,7 @@ static const char *re_error_msgid[] =
|
||||
/* When using GNU C, we are not REALLY using the C alloca, no matter
|
||||
what config.h may say. So don't take precautions for it. */
|
||||
#ifdef __GNUC__
|
||||
#undef C_ALLOCA
|
||||
# undef C_ALLOCA
|
||||
#endif
|
||||
|
||||
/* The match routines may not allocate if (1) they would do it with malloc
|
||||
@@ -1022,8 +1031,8 @@ static const char *re_error_msgid[] =
|
||||
Note that if REL_ALLOC is defined, matching would not use malloc for the
|
||||
failure stack, but we would still use it for the register vectors;
|
||||
so REL_ALLOC should not affect this. */
|
||||
#if (defined (C_ALLOCA) || defined (REGEX_MALLOC)) && defined (emacs)
|
||||
#undef MATCH_MAY_ALLOCATE
|
||||
#if (defined C_ALLOCA || defined REGEX_MALLOC) && defined emacs
|
||||
# undef MATCH_MAY_ALLOCATE
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1036,7 +1045,7 @@ static const char *re_error_msgid[] =
|
||||
when matching. If this number is exceeded, we allocate more
|
||||
space, so it is not a hard limit. */
|
||||
#ifndef INIT_FAILURE_ALLOC
|
||||
#define INIT_FAILURE_ALLOC 5
|
||||
# define INIT_FAILURE_ALLOC 5
|
||||
#endif
|
||||
|
||||
/* Roughly the maximum number of failure points on the stack. Would be
|
||||
@@ -1046,13 +1055,13 @@ static const char *re_error_msgid[] =
|
||||
|
||||
#ifdef INT_IS_16BIT
|
||||
|
||||
#if defined (MATCH_MAY_ALLOCATE)
|
||||
# if defined MATCH_MAY_ALLOCATE
|
||||
/* 4400 was enough to cause a crash on Alpha OSF/1,
|
||||
whose default stack limit is 2mb. */
|
||||
long int re_max_failures = 4000;
|
||||
#else
|
||||
# else
|
||||
long int re_max_failures = 2000;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
union fail_stack_elt
|
||||
{
|
||||
@@ -1071,13 +1080,13 @@ typedef struct
|
||||
|
||||
#else /* not INT_IS_16BIT */
|
||||
|
||||
#if defined (MATCH_MAY_ALLOCATE)
|
||||
# if defined MATCH_MAY_ALLOCATE
|
||||
/* 4400 was enough to cause a crash on Alpha OSF/1,
|
||||
whose default stack limit is 2mb. */
|
||||
int re_max_failures = 20000;
|
||||
#else
|
||||
# else
|
||||
int re_max_failures = 2000;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
union fail_stack_elt
|
||||
{
|
||||
@@ -1105,10 +1114,10 @@ typedef struct
|
||||
Do `return -2' if the alloc fails. */
|
||||
|
||||
#ifdef MATCH_MAY_ALLOCATE
|
||||
#define INIT_FAIL_STACK() \
|
||||
# define INIT_FAIL_STACK() \
|
||||
do { \
|
||||
fail_stack.stack = (fail_stack_elt_t *) \
|
||||
REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \
|
||||
REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \
|
||||
\
|
||||
if (fail_stack.stack == NULL) \
|
||||
return -2; \
|
||||
@@ -1117,14 +1126,14 @@ typedef struct
|
||||
fail_stack.avail = 0; \
|
||||
} while (0)
|
||||
|
||||
#define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
|
||||
# define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
|
||||
#else
|
||||
#define INIT_FAIL_STACK() \
|
||||
# define INIT_FAIL_STACK() \
|
||||
do { \
|
||||
fail_stack.avail = 0; \
|
||||
} while (0)
|
||||
|
||||
#define RESET_FAIL_STACK()
|
||||
# define RESET_FAIL_STACK()
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1185,11 +1194,11 @@ typedef struct
|
||||
|
||||
/* Used to omit pushing failure point id's when we're not debugging. */
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_PUSH PUSH_FAILURE_INT
|
||||
#define DEBUG_POP(item_addr) (item_addr)->integer = POP_FAILURE_INT ()
|
||||
# define DEBUG_PUSH PUSH_FAILURE_INT
|
||||
# define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_INT ()
|
||||
#else
|
||||
#define DEBUG_PUSH(item)
|
||||
#define DEBUG_POP(item_addr)
|
||||
# define DEBUG_PUSH(item)
|
||||
# define DEBUG_POP(item_addr)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1197,8 +1206,8 @@ typedef struct
|
||||
if we ever fail back to it.
|
||||
|
||||
Requires variables fail_stack, regstart, regend, reg_info, and
|
||||
num_regs be declared. DOUBLE_FAIL_STACK requires `destination' be
|
||||
declared.
|
||||
num_regs_pushed be declared. DOUBLE_FAIL_STACK requires `destination'
|
||||
be declared.
|
||||
|
||||
Does `return FAILURE_CODE' if runs out of memory. */
|
||||
|
||||
@@ -1210,7 +1219,7 @@ typedef struct
|
||||
/* Can't be int, since there is not a shred of a guarantee that int \
|
||||
is wide enough to hold a value of something to which pointer can \
|
||||
be assigned */ \
|
||||
s_reg_t this_reg; \
|
||||
active_reg_t this_reg; \
|
||||
\
|
||||
DEBUG_STATEMENT (failure_id++); \
|
||||
DEBUG_STATEMENT (nfailure_points_pushed++); \
|
||||
@@ -1218,7 +1227,7 @@ typedef struct
|
||||
DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\
|
||||
DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\
|
||||
\
|
||||
DEBUG_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \
|
||||
DEBUG_PRINT2 (" slots needed: %ld\n", NUM_FAILURE_ITEMS); \
|
||||
DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
|
||||
\
|
||||
/* Ensure we have enough space allocated for what we will push. */ \
|
||||
@@ -1239,16 +1248,17 @@ typedef struct
|
||||
for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
|
||||
this_reg++) \
|
||||
{ \
|
||||
DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \
|
||||
DEBUG_PRINT2 (" Pushing reg: %lu\n", this_reg); \
|
||||
DEBUG_STATEMENT (num_regs_pushed++); \
|
||||
\
|
||||
DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
|
||||
DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
|
||||
PUSH_FAILURE_POINTER (regstart[this_reg]); \
|
||||
\
|
||||
DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
|
||||
DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
|
||||
PUSH_FAILURE_POINTER (regend[this_reg]); \
|
||||
\
|
||||
DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \
|
||||
DEBUG_PRINT2 (" info: %p\n ", \
|
||||
reg_info[this_reg].word.pointer); \
|
||||
DEBUG_PRINT2 (" match_null=%d", \
|
||||
REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
|
||||
DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
|
||||
@@ -1260,17 +1270,17 @@ typedef struct
|
||||
PUSH_FAILURE_ELT (reg_info[this_reg].word); \
|
||||
} \
|
||||
\
|
||||
DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\
|
||||
DEBUG_PRINT2 (" Pushing low active reg: %ld\n", lowest_active_reg);\
|
||||
PUSH_FAILURE_INT (lowest_active_reg); \
|
||||
\
|
||||
DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\
|
||||
DEBUG_PRINT2 (" Pushing high active reg: %ld\n", highest_active_reg);\
|
||||
PUSH_FAILURE_INT (highest_active_reg); \
|
||||
\
|
||||
DEBUG_PRINT2 (" Pushing pattern 0x%x:\n", pattern_place); \
|
||||
DEBUG_PRINT2 (" Pushing pattern %p:\n", pattern_place); \
|
||||
DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
|
||||
PUSH_FAILURE_POINTER (pattern_place); \
|
||||
\
|
||||
DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \
|
||||
DEBUG_PRINT2 (" Pushing string %p: `", string_place); \
|
||||
DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
|
||||
size2); \
|
||||
DEBUG_PRINT1 ("'\n"); \
|
||||
@@ -1286,9 +1296,9 @@ typedef struct
|
||||
|
||||
/* Individual items aside from the registers. */
|
||||
#ifdef DEBUG
|
||||
#define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
|
||||
# define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
|
||||
#else
|
||||
#define NUM_NONREG_ITEMS 4
|
||||
# define NUM_NONREG_ITEMS 4
|
||||
#endif
|
||||
|
||||
/* We push at most this many items on the stack. */
|
||||
@@ -1322,8 +1332,8 @@ typedef struct
|
||||
|
||||
#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
|
||||
{ \
|
||||
DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \
|
||||
s_reg_t this_reg; \
|
||||
DEBUG_STATEMENT (unsigned failure_id;) \
|
||||
active_reg_t this_reg; \
|
||||
const unsigned char *string_temp; \
|
||||
\
|
||||
assert (!FAIL_STACK_EMPTY ()); \
|
||||
@@ -1345,34 +1355,35 @@ typedef struct
|
||||
if (string_temp != NULL) \
|
||||
str = (const char *) string_temp; \
|
||||
\
|
||||
DEBUG_PRINT2 (" Popping string 0x%x: `", str); \
|
||||
DEBUG_PRINT2 (" Popping string %p: `", str); \
|
||||
DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
|
||||
DEBUG_PRINT1 ("'\n"); \
|
||||
\
|
||||
pat = (unsigned char *) POP_FAILURE_POINTER (); \
|
||||
DEBUG_PRINT2 (" Popping pattern 0x%x:\n", pat); \
|
||||
DEBUG_PRINT2 (" Popping pattern %p:\n", pat); \
|
||||
DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
|
||||
\
|
||||
/* Restore register info. */ \
|
||||
high_reg = (active_reg_t) POP_FAILURE_INT (); \
|
||||
DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \
|
||||
DEBUG_PRINT2 (" Popping high active reg: %ld\n", high_reg); \
|
||||
\
|
||||
low_reg = (active_reg_t) POP_FAILURE_INT (); \
|
||||
DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \
|
||||
DEBUG_PRINT2 (" Popping low active reg: %ld\n", low_reg); \
|
||||
\
|
||||
if (1) \
|
||||
for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
|
||||
{ \
|
||||
DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \
|
||||
DEBUG_PRINT2 (" Popping reg: %ld\n", this_reg); \
|
||||
\
|
||||
reg_info[this_reg].word = POP_FAILURE_ELT (); \
|
||||
DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \
|
||||
DEBUG_PRINT2 (" info: %p\n", \
|
||||
reg_info[this_reg].word.pointer); \
|
||||
\
|
||||
regend[this_reg] = (const char *) POP_FAILURE_POINTER (); \
|
||||
DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \
|
||||
DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
|
||||
\
|
||||
regstart[this_reg] = (const char *) POP_FAILURE_POINTER (); \
|
||||
DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \
|
||||
DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
@@ -1478,7 +1489,7 @@ static reg_errcode_t compile_range _RE_ARGS ((const char **p_ptr,
|
||||
string passed to us by the user to an unsigned char that we can use
|
||||
as an array index (in, e.g., `translate'). */
|
||||
#ifndef PATFETCH
|
||||
#define PATFETCH(c) \
|
||||
# define PATFETCH(c) \
|
||||
do {if (p == pend) return REG_EEND; \
|
||||
c = (unsigned char) *p++; \
|
||||
if (translate) c = (unsigned char) translate[c]; \
|
||||
@@ -1501,7 +1512,7 @@ static reg_errcode_t compile_range _RE_ARGS ((const char **p_ptr,
|
||||
`char *', to avoid warnings when a string constant is passed. But
|
||||
when we use a character as a subscript we must make it unsigned. */
|
||||
#ifndef TRANSLATE
|
||||
#define TRANSLATE(d) \
|
||||
# define TRANSLATE(d) \
|
||||
(translate ? (char) translate[(unsigned char) (d)] : (d))
|
||||
#endif
|
||||
|
||||
@@ -1569,15 +1580,15 @@ static reg_errcode_t compile_range _RE_ARGS ((const char **p_ptr,
|
||||
MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up
|
||||
reallocating to 0 bytes. Such thing is not going to work too well.
|
||||
You have been warned!! */
|
||||
#if defined(_MSC_VER) && !defined(WIN32)
|
||||
#if defined _MSC_VER && !defined WIN32
|
||||
/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes.
|
||||
The REALLOC define eliminates a flurry of conversion warnings,
|
||||
but is not required. */
|
||||
#define MAX_BUF_SIZE 65500L
|
||||
#define REALLOC(p,s) realloc ((p), (size_t) (s))
|
||||
# define MAX_BUF_SIZE 65500L
|
||||
# define REALLOC(p,s) realloc ((p), (size_t) (s))
|
||||
#else
|
||||
#define MAX_BUF_SIZE (1L << 16)
|
||||
#define REALLOC(p,s) realloc ((p), (s))
|
||||
# define MAX_BUF_SIZE (1L << 16)
|
||||
# define REALLOC(p,s) realloc ((p), (s))
|
||||
#endif
|
||||
|
||||
/* Extend the buffer by twice its current size via realloc and
|
||||
@@ -1677,7 +1688,7 @@ typedef struct
|
||||
} \
|
||||
}
|
||||
|
||||
#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
|
||||
#if WIDE_CHAR_SUPPORT
|
||||
/* The GNU C library provides support for user-defined character classes
|
||||
and the functions from ISO C amendement 1. */
|
||||
# ifdef CHARCLASS_NAME_MAX
|
||||
@@ -1864,7 +1875,7 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
/* Always count groups, whether or not bufp->no_sub is set. */
|
||||
bufp->re_nsub = 0;
|
||||
|
||||
#if !defined (emacs) && !defined (SYNTAX_TABLE)
|
||||
#if !defined emacs && !defined SYNTAX_TABLE
|
||||
/* Initialize the syntax table. */
|
||||
init_syntax_once ();
|
||||
#endif
|
||||
@@ -2177,7 +2188,7 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
the leading `:' and `[' (but set bits for them). */
|
||||
if (c == ':' && *p == ']')
|
||||
{
|
||||
#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
|
||||
#if WIDE_CHAR_SUPPORT
|
||||
boolean is_lower = STREQ (str, "lower");
|
||||
boolean is_upper = STREQ (str, "upper");
|
||||
wctype_t wt;
|
||||
@@ -2378,10 +2389,12 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
|
||||
|
||||
if (COMPILE_STACK_EMPTY)
|
||||
if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
goto normal_backslash;
|
||||
else
|
||||
FREE_STACK_RETURN (REG_ERPAREN);
|
||||
{
|
||||
if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
goto normal_backslash;
|
||||
else
|
||||
FREE_STACK_RETURN (REG_ERPAREN);
|
||||
}
|
||||
|
||||
handle_close:
|
||||
if (fixup_alt_jump)
|
||||
@@ -2398,10 +2411,12 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
|
||||
/* See similar code for backslashed left paren above. */
|
||||
if (COMPILE_STACK_EMPTY)
|
||||
if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
goto normal_char;
|
||||
else
|
||||
FREE_STACK_RETURN (REG_ERPAREN);
|
||||
{
|
||||
if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
goto normal_char;
|
||||
else
|
||||
FREE_STACK_RETURN (REG_ERPAREN);
|
||||
}
|
||||
|
||||
/* Since we just checked for an empty stack above, this
|
||||
``can't happen''. */
|
||||
@@ -2841,7 +2856,7 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
{
|
||||
fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS);
|
||||
|
||||
#ifdef emacs
|
||||
# ifdef emacs
|
||||
if (! fail_stack.stack)
|
||||
fail_stack.stack
|
||||
= (fail_stack_elt_t *) xmalloc (fail_stack.size
|
||||
@@ -2851,7 +2866,7 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
= (fail_stack_elt_t *) xrealloc (fail_stack.stack,
|
||||
(fail_stack.size
|
||||
* sizeof (fail_stack_elt_t)));
|
||||
#else /* not emacs */
|
||||
# else /* not emacs */
|
||||
if (! fail_stack.stack)
|
||||
fail_stack.stack
|
||||
= (fail_stack_elt_t *) malloc (fail_stack.size
|
||||
@@ -2861,7 +2876,7 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
= (fail_stack_elt_t *) realloc (fail_stack.stack,
|
||||
(fail_stack.size
|
||||
* sizeof (fail_stack_elt_t)));
|
||||
#endif /* not emacs */
|
||||
# endif /* not emacs */
|
||||
}
|
||||
|
||||
regex_grow_registers (num_regs);
|
||||
@@ -3540,9 +3555,9 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
|
||||
val = re_match_2_internal (bufp, string1, size1, string2, size2,
|
||||
startpos, regs, stop);
|
||||
#ifndef REGEX_MALLOC
|
||||
#ifdef C_ALLOCA
|
||||
# ifdef C_ALLOCA
|
||||
alloca (0);
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
if (val >= 0)
|
||||
@@ -3619,8 +3634,8 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
|
||||
|
||||
/* Free everything we malloc. */
|
||||
#ifdef MATCH_MAY_ALLOCATE
|
||||
#define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
|
||||
#define FREE_VARIABLES() \
|
||||
# define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
|
||||
# define FREE_VARIABLES() \
|
||||
do { \
|
||||
REGEX_FREE_STACK (fail_stack.stack); \
|
||||
FREE_VAR (regstart); \
|
||||
@@ -3634,7 +3649,7 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
|
||||
FREE_VAR (reg_info_dummy); \
|
||||
} while (0)
|
||||
#else
|
||||
#define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */
|
||||
# define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */
|
||||
#endif /* not MATCH_MAY_ALLOCATE */
|
||||
|
||||
/* These values must meet several constraints. They must not be valid
|
||||
@@ -3661,11 +3676,11 @@ re_match (bufp, string, size, pos, regs)
|
||||
{
|
||||
int result = re_match_2_internal (bufp, NULL, 0, string, size,
|
||||
pos, regs, size);
|
||||
#ifndef REGEX_MALLOC
|
||||
#ifdef C_ALLOCA
|
||||
# ifndef REGEX_MALLOC
|
||||
# ifdef C_ALLOCA
|
||||
alloca (0);
|
||||
#endif
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
return result;
|
||||
}
|
||||
#endif /* not emacs */
|
||||
@@ -3707,9 +3722,9 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
|
||||
int result = re_match_2_internal (bufp, string1, size1, string2, size2,
|
||||
pos, regs, stop);
|
||||
#ifndef REGEX_MALLOC
|
||||
#ifdef C_ALLOCA
|
||||
# ifdef C_ALLOCA
|
||||
alloca (0);
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
@@ -4457,7 +4472,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
|
||||
past them. */
|
||||
if (translate
|
||||
? bcmp_translate (d, d2, mcnt, translate)
|
||||
: bcmp (d, d2, mcnt))
|
||||
: memcmp (d, d2, mcnt))
|
||||
goto fail;
|
||||
d += mcnt, d2 += mcnt;
|
||||
|
||||
@@ -4823,7 +4838,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
|
||||
DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
|
||||
/* It doesn't matter what we push for the string here. What
|
||||
the code at `fail' tests is the value for the pattern. */
|
||||
PUSH_FAILURE_POINT (0, 0, -2);
|
||||
PUSH_FAILURE_POINT (NULL, NULL, -2);
|
||||
goto unconditional_jump;
|
||||
|
||||
|
||||
@@ -4836,7 +4851,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
|
||||
DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
|
||||
/* See comments just above at `dummy_failure_jump' about the
|
||||
two zeroes. */
|
||||
PUSH_FAILURE_POINT (0, 0, -2);
|
||||
PUSH_FAILURE_POINT (NULL, NULL, -2);
|
||||
break;
|
||||
|
||||
/* Have to succeed matching what follows at least n times.
|
||||
@@ -5410,7 +5425,7 @@ re_compile_pattern (pattern, length, bufp)
|
||||
/* Entry points compatible with 4.2 BSD regex library. We don't define
|
||||
them unless specifically requested. */
|
||||
|
||||
#if defined (_REGEX_RE_COMP) || defined (_LIBC)
|
||||
#if defined _REGEX_RE_COMP || defined _LIBC
|
||||
|
||||
/* BSD has one and only one pattern buffer. */
|
||||
static struct re_pattern_buffer re_comp_buf;
|
||||
@@ -5684,11 +5699,15 @@ regerror (errcode, preg, errbuf, errbuf_size)
|
||||
{
|
||||
if (msg_size > errbuf_size)
|
||||
{
|
||||
strncpy (errbuf, msg, errbuf_size - 1);
|
||||
#if defined HAVE_MEMPCPY || defined _LIBC
|
||||
*((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
|
||||
#else
|
||||
memcpy (errbuf, msg, errbuf_size - 1);
|
||||
errbuf[errbuf_size - 1] = 0;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
strcpy (errbuf, msg);
|
||||
memcpy (errbuf, msg, msg_size);
|
||||
}
|
||||
|
||||
return msg_size;
|
||||
|
||||
50
lib/regex.h
50
lib/regex.h
@@ -2,24 +2,24 @@
|
||||
expression library, version 0.12.
|
||||
Copyright (C) 1985,89,90,91,92,93,95,96,97 Free Software Foundation, Inc.
|
||||
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the
|
||||
GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA. */
|
||||
|
||||
#ifndef _REGEX_H
|
||||
#define _REGEX_H 1
|
||||
@@ -32,10 +32,10 @@ extern "C" {
|
||||
/* POSIX says that <sys/types.h> must be included (by the caller) before
|
||||
<regex.h>. */
|
||||
|
||||
#if !defined (_POSIX_C_SOURCE) && !defined (_POSIX_SOURCE) && defined (VMS)
|
||||
#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS
|
||||
/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
|
||||
should be there. */
|
||||
#include <stddef.h>
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
/* The following two types have to be signed and unsigned integer type
|
||||
@@ -240,7 +240,7 @@ extern reg_syntax_t re_syntax_options;
|
||||
(erroneously) define this in other header files, but we want our
|
||||
value, so remove any previous define. */
|
||||
#ifdef RE_DUP_MAX
|
||||
#undef RE_DUP_MAX
|
||||
# undef RE_DUP_MAX
|
||||
#endif
|
||||
/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
|
||||
#define RE_DUP_MAX (0x7fff)
|
||||
@@ -283,6 +283,10 @@ extern reg_syntax_t re_syntax_options;
|
||||
`re_error_msg' table in regex.c. */
|
||||
typedef enum
|
||||
{
|
||||
#if (_XOPEN_SOURCE - 0) == 500
|
||||
REG_NOSYS = -1, /* This will never happen for this implementation. */
|
||||
#endif
|
||||
|
||||
REG_NOERROR = 0, /* Success. */
|
||||
REG_NOMATCH, /* Didn't find a match (for regexec). */
|
||||
|
||||
@@ -314,7 +318,7 @@ typedef enum
|
||||
private to the regex routines. */
|
||||
|
||||
#ifndef RE_TRANSLATE_TYPE
|
||||
#define RE_TRANSLATE_TYPE char *
|
||||
# define RE_TRANSLATE_TYPE char *
|
||||
#endif
|
||||
|
||||
struct re_pattern_buffer
|
||||
@@ -405,7 +409,7 @@ struct re_registers
|
||||
`re_match_2' returns information about at least this many registers
|
||||
the first time a `regs' structure is passed. */
|
||||
#ifndef RE_NREGS
|
||||
#define RE_NREGS 30
|
||||
# define RE_NREGS 30
|
||||
#endif
|
||||
|
||||
|
||||
@@ -428,11 +432,11 @@ typedef struct
|
||||
|
||||
#if __STDC__
|
||||
|
||||
#define _RE_ARGS(args) args
|
||||
# define _RE_ARGS(args) args
|
||||
|
||||
#else /* not __STDC__ */
|
||||
|
||||
#define _RE_ARGS(args) ()
|
||||
# define _RE_ARGS(args) ()
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
@@ -503,11 +507,11 @@ extern void re_set_registers
|
||||
unsigned num_regs, regoff_t *starts, regoff_t *ends));
|
||||
|
||||
#ifdef _REGEX_RE_COMP
|
||||
#ifndef _CRAY
|
||||
# ifndef _CRAY
|
||||
/* 4.2 bsd compatibility. */
|
||||
extern char *re_comp _RE_ARGS ((const char *));
|
||||
extern int re_exec _RE_ARGS ((const char *));
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* POSIX compatibility. */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Determine whether string value is affirmation or negative response
|
||||
according to current locale's data.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1998 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
|
||||
@@ -30,11 +30,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#if WITH_REGEX
|
||||
# include <regex.h>
|
||||
#else
|
||||
# include <rx.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* safe-read.c -- an interface to read that retries after interrupts
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1994, 1998 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,17 +31,16 @@
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#include "safe-read.h"
|
||||
|
||||
/* Read LEN bytes at PTR from descriptor DESC, retrying if interrupted.
|
||||
Return the actual number of bytes read, zero for EOF, or negative
|
||||
for an error. */
|
||||
|
||||
int
|
||||
safe_read (desc, ptr, len)
|
||||
int desc;
|
||||
char *ptr;
|
||||
int len;
|
||||
ssize_t
|
||||
safe_read (int desc, void *ptr, size_t len)
|
||||
{
|
||||
int n_chars;
|
||||
ssize_t n_chars;
|
||||
|
||||
if (len <= 0)
|
||||
return len;
|
||||
|
||||
10
lib/safe-read.h
Normal file
10
lib/safe-read.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
ssize_t
|
||||
safe_read PARAMS ((int desc, void *ptr, size_t len));
|
||||
@@ -1,4 +1,5 @@
|
||||
/* Copyright (C) 1992, 1995, 1997 Free Software Foundation, Inc.
|
||||
/* stpcpy.c -- copy a string and return pointer to end of new string
|
||||
Copyright (C) 1992, 1995, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991,92,93,94,95,96,97,98 Free Software Foundation, Inc.
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
@@ -490,7 +490,7 @@ my_strftime (s, maxsize, format, tp)
|
||||
|
||||
for (f = format; *f != '\0'; ++f)
|
||||
{
|
||||
int pad; /* Padding for number ('-', '_', or 0). */
|
||||
int pad = 0; /* Padding for number ('-', '_', or 0). */
|
||||
int modifier; /* Field modifier ('E', 'O', or 0). */
|
||||
int digits; /* Max digits for numeric format. */
|
||||
int number_value; /* Numeric value to be printed. */
|
||||
@@ -580,7 +580,6 @@ my_strftime (s, maxsize, format, tp)
|
||||
#endif /* ! DO_MULTIBYTE */
|
||||
|
||||
/* Check for flags that can modify a format. */
|
||||
pad = 0;
|
||||
while (1)
|
||||
{
|
||||
switch (*++f)
|
||||
|
||||
@@ -85,7 +85,9 @@ struct group *getgrgid ();
|
||||
|
||||
#define isdigit(c) ((c) >= '0' && (c) <= '9')
|
||||
|
||||
#ifndef strdup
|
||||
char *strdup ();
|
||||
#endif
|
||||
|
||||
/* Return nonzero if STR represents an unsigned decimal integer,
|
||||
otherwise return 0. */
|
||||
|
||||
81
lib/utime.c
Normal file
81
lib/utime.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* derived from a function in touch.c */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#undef utime
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_UTIME_H
|
||||
# include <utime.h>
|
||||
#endif
|
||||
|
||||
#include "safe-read.h"
|
||||
|
||||
/* Some systems (even some that do have <utime.h>) don't declare this
|
||||
structure anywhere. */
|
||||
#ifndef HAVE_STRUCT_UTIMBUF
|
||||
struct utimbuf
|
||||
{
|
||||
long actime;
|
||||
long modtime;
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Emulate utime (file, NULL) for systems (like 4.3BSD) that do not
|
||||
interpret it to set the access and modification times of FILE to
|
||||
the current time. Return 0 if successful, -1 if not. */
|
||||
|
||||
static int
|
||||
utime_null (const char *file)
|
||||
{
|
||||
#if HAVE_UTIMES_NULL
|
||||
return utimes (file, 0);
|
||||
#else
|
||||
int fd;
|
||||
char c;
|
||||
int status = 0;
|
||||
struct stat sb;
|
||||
|
||||
fd = open (file, O_RDWR, 0666);
|
||||
if (fd < 0
|
||||
|| fstat (fd, &sb) < 0
|
||||
|| safe_read (fd, &c, sizeof (char)) < 0
|
||||
|| lseek (fd, (off_t) 0, SEEK_SET) < 0
|
||||
|| full_write (fd, &c, sizeof (char)) < 0
|
||||
/* Maybe do this -- it's necessary on SunOS4.1.3 with some combination
|
||||
of patches, but that system doesn't use this code: it has utimes.
|
||||
|| fsync (fd) < 0
|
||||
*/
|
||||
|| ftruncate (fd, st.st_size) < 0
|
||||
|| close (fd) < 0)
|
||||
status = -1;
|
||||
return status;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
rpl_utime (const char *file, const struct utimbuf *times)
|
||||
{
|
||||
if (times)
|
||||
return utime (file, times);
|
||||
|
||||
return utime_null (file);
|
||||
}
|
||||
130
lib/xstrtol.c
130
lib/xstrtol.c
@@ -21,6 +21,8 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
@@ -34,7 +36,12 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define NDEBUG
|
||||
/* Some pre-ANSI implementations (e.g. SunOS 4)
|
||||
need stderr defined if assertion checking is enabled. */
|
||||
#ifndef NDEBUG
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <errno.h>
|
||||
@@ -68,37 +75,44 @@ extern int errno;
|
||||
|
||||
#include "xstrtol.h"
|
||||
|
||||
#define BKM_SCALE(x, scale_factor, error_return) \
|
||||
do \
|
||||
{ \
|
||||
if ((x) > (double) __ZLONG_MAX / (scale_factor)) \
|
||||
return (error_return); \
|
||||
(x) *= (scale_factor); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
__unsigned long int __strtol ();
|
||||
|
||||
static int
|
||||
bkm_scale (__unsigned long int *x, int scale_factor)
|
||||
{
|
||||
__unsigned long int product = *x * scale_factor;
|
||||
if (*x != product / scale_factor)
|
||||
return 1;
|
||||
*x = product;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
bkm_scale_by_power (__unsigned long int *x, int base, int power)
|
||||
{
|
||||
while (power--)
|
||||
if (bkm_scale (x, base))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: comment. */
|
||||
|
||||
strtol_error
|
||||
__xstrtol (s, ptr, base, val, valid_suffixes)
|
||||
const char *s;
|
||||
char **ptr;
|
||||
int base;
|
||||
__unsigned long int *val;
|
||||
const char *valid_suffixes;
|
||||
__xstrtol (const char *s, char **ptr, int strtol_base,
|
||||
__unsigned long int *val, const char *valid_suffixes)
|
||||
{
|
||||
char *t_ptr;
|
||||
char **p;
|
||||
__unsigned long int tmp;
|
||||
|
||||
assert (0 <= base && base <= 36);
|
||||
assert (0 <= strtol_base && strtol_base <= 36);
|
||||
|
||||
p = (ptr ? ptr : &t_ptr);
|
||||
|
||||
errno = 0;
|
||||
tmp = __strtol (s, p, base);
|
||||
tmp = __strtol (s, p, strtol_base);
|
||||
if (errno != 0)
|
||||
return LONGINT_OVERFLOW;
|
||||
if (*p == s)
|
||||
@@ -115,40 +129,92 @@ __xstrtol (s, ptr, base, val, valid_suffixes)
|
||||
|
||||
if (**p != '\0')
|
||||
{
|
||||
int base = 1024;
|
||||
int suffixes = 1;
|
||||
int overflow;
|
||||
|
||||
if (!strchr (valid_suffixes, **p))
|
||||
return LONGINT_INVALID_SUFFIX_CHAR;
|
||||
|
||||
if (strchr (valid_suffixes, '0'))
|
||||
{
|
||||
/* The ``valid suffix'' '0' is a special flag meaning that
|
||||
an optional second suffix is allowed, which can change
|
||||
the base, e.g. "100MD" for 100 megabytes decimal. */
|
||||
|
||||
switch (p[0][1])
|
||||
{
|
||||
case 'B':
|
||||
suffixes++;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
base = 1000;
|
||||
suffixes++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (**p)
|
||||
{
|
||||
case 'b':
|
||||
BKM_SCALE (tmp, 512, LONGINT_OVERFLOW);
|
||||
++(*p);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
++(*p);
|
||||
overflow = bkm_scale (&tmp, 512);
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
case 'k':
|
||||
BKM_SCALE (tmp, 1024, LONGINT_OVERFLOW);
|
||||
++(*p);
|
||||
overflow = bkm_scale (&tmp, 1024);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
BKM_SCALE (tmp, 1024 * 1024, LONGINT_OVERFLOW);
|
||||
++(*p);
|
||||
case 'c':
|
||||
overflow = 0;
|
||||
break;
|
||||
|
||||
case 'E': /* Exa */
|
||||
overflow = bkm_scale_by_power (&tmp, base, 6);
|
||||
break;
|
||||
|
||||
case 'G': /* Giga */
|
||||
overflow = bkm_scale_by_power (&tmp, base, 3);
|
||||
break;
|
||||
|
||||
case 'k': /* kilo */
|
||||
overflow = bkm_scale_by_power (&tmp, base, 1);
|
||||
break;
|
||||
|
||||
case 'M': /* Mega */
|
||||
case 'm': /* 'm' is undocumented; for backward compatibility only */
|
||||
overflow = bkm_scale_by_power (&tmp, base, 2);
|
||||
break;
|
||||
|
||||
case 'P': /* Peta */
|
||||
overflow = bkm_scale_by_power (&tmp, base, 5);
|
||||
break;
|
||||
|
||||
case 'T': /* Tera */
|
||||
overflow = bkm_scale_by_power (&tmp, base, 4);
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
BKM_SCALE (tmp, 2, LONGINT_OVERFLOW);
|
||||
++(*p);
|
||||
overflow = bkm_scale (&tmp, 2);
|
||||
break;
|
||||
|
||||
case 'Y': /* Yotta */
|
||||
overflow = bkm_scale_by_power (&tmp, base, 8);
|
||||
break;
|
||||
|
||||
case 'Z': /* Zetta */
|
||||
overflow = bkm_scale_by_power (&tmp, base, 7);
|
||||
break;
|
||||
|
||||
default:
|
||||
return LONGINT_INVALID_SUFFIX_CHAR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (overflow)
|
||||
return LONGINT_OVERFLOW;
|
||||
|
||||
(*p) += suffixes;
|
||||
}
|
||||
|
||||
*val = tmp;
|
||||
|
||||
@@ -5,12 +5,10 @@
|
||||
# define __xstrtol xstrtoul
|
||||
# define __strtol strtoul
|
||||
# define __unsigned unsigned
|
||||
# define __ZLONG_MAX ULONG_MAX
|
||||
# else
|
||||
# define __xstrtol xstrtol
|
||||
# define __strtol strtol
|
||||
# define __unsigned /* empty */
|
||||
# define __ZLONG_MAX LONG_MAX
|
||||
# endif
|
||||
|
||||
# ifndef PARAMS
|
||||
|
||||
99
m4/ChangeLog
99
m4/ChangeLog
@@ -1,3 +1,102 @@
|
||||
1998-07-25 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* utime.m4 (jm_FUNC_UTIME): New file and macro.
|
||||
* utimes.m4 (jm_FUNC_UTIMES_NULL): New file and macro.
|
||||
|
||||
1998-07-09 Manfred Hollstein <manfred@s-direktnet.de>
|
||||
|
||||
* chown.m4 (jm_FUNC_CHOWN): Add a check to verify that the
|
||||
uid and gid actually remain unchanged.
|
||||
|
||||
1998-07-07 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* jm-glibc-io.m4: Remove fclose_unlocked.
|
||||
|
||||
1998-07-04 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* regex.m4: Use syscmd, ifelse, and sysval. Mainly as an exercise
|
||||
to prove that this macro can be used in packages without regex.c.
|
||||
|
||||
1998-07-02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* gettext.m4 (AM_WITH_NLS): Remove intl/libintl.h if <libintl.h>
|
||||
is to be used.
|
||||
|
||||
1998-07-03 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* gettext.m4: Add -lintl if it's found to be necessary.
|
||||
|
||||
* gettext.m4: New file -- from gettext-0.10.35.
|
||||
* lcmessage.m4: Likewise.
|
||||
* progtest.m4: Likewise.
|
||||
|
||||
* regex.m4 (jm_WITH_REGEX): New file and macro.
|
||||
* jm-macros.m4: Require the new macro.
|
||||
|
||||
1998-06-29 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* fstypename.m4: Include sys/param.h. NetBSD 1.3.1 requires this
|
||||
for the definition of NGROUPS (used in a system header included
|
||||
by sys/mount.h).
|
||||
|
||||
1998-06-28 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* ls-mntd-fs.m4: New file.
|
||||
* fstypename.m4: New file.
|
||||
|
||||
* jm-macros.m4: Require the new macro.
|
||||
* jm-glibc-io.m4: New file.
|
||||
|
||||
1998-05-19 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* jm-macros.m4: Add jm_FUNC_LCHOWN.
|
||||
* lchown.m4: New file.
|
||||
|
||||
* Makefile.am.in: New file.
|
||||
* Makefile.am (Makefile.am): Depend on Makefile.am.in.
|
||||
|
||||
1998-05-14 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add them.
|
||||
* jm-macros.m4: New file.
|
||||
* utimbuf.m4: New file.
|
||||
|
||||
1998-05-12 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add isc-posix.m4.
|
||||
|
||||
1998-05-11 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* isc-posix.m4: New file.
|
||||
|
||||
1998-05-10 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* jm-mktime.m4: Use AM_FUNC_MKTIME, now that it's up to date.
|
||||
|
||||
1998-05-09 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add ssize_t.m4.
|
||||
(EXTRA_DIST): Remove mktime.m4, now that the new version is included
|
||||
with automake.
|
||||
|
||||
* ssize_t.m4: New file.
|
||||
* mktime.m4: Remove file -- the new automake has this now.
|
||||
|
||||
1998-04-26 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* assert.m4: New file.
|
||||
* Makefile.am (EXTRA_DIST): Add assert.m4.
|
||||
|
||||
1998-04-05 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* prereq.m4 (jm_PREREQ_REGEX): New macro.
|
||||
(jm_PREREQ): Use it here.
|
||||
|
||||
1998-03-23 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* inttypes_h.m4: Kludges so I don't have to add HAVE_INTTYPES_H
|
||||
in acconfig.h.
|
||||
|
||||
1998-03-15 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* prereq.m4: New file.
|
||||
|
||||
@@ -1,11 +1,25 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
|
||||
# Generate this list with
|
||||
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
|
||||
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
|
||||
EXTRA_DIST = README \
|
||||
check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 \
|
||||
getgroups.m4 getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 perl.m4 prereq.m4 putenv.m4 \
|
||||
readdir.m4 realloc.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
|
||||
mktime.m4
|
||||
##m4-files-begin
|
||||
EXTRA_DIST = README Makefile.am.in assert.m4 check-decl.m4 chown.m4 \
|
||||
const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 fstypename.m4 getgroups.m4 \
|
||||
getline.m4 getloadavg.m4 gettext.m4 inttypes_h.m4 isc-posix.m4 \
|
||||
jm-glibc-io.m4 jm-macros.m4 jm-mktime.m4 jm-winsz1.m4 jm-winsz2.m4 \
|
||||
lchown.m4 lcmessage.m4 lfs.m4 ls-mntd-fs.m4 lstat.m4 malloc.m4 memcmp.m4 \
|
||||
perl.m4 prereq.m4 progtest.m4 putenv.m4 readdir.m4 realloc.m4 regex.m4 \
|
||||
ssize_t.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 utimbuf.m4 utime.m4 \
|
||||
utimes.m4
|
||||
|
||||
##m4-files-end
|
||||
|
||||
Makefile.am: Makefile.am.in
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##m4-files-begin/p' $< > $@t
|
||||
( echo EXTRA_DIST = README Makefile.am.in; \
|
||||
find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \
|
||||
|fmt | (tr '\012' @; echo) \
|
||||
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
|
||||
>> $@t
|
||||
sed -n '/^##m4-files-end/,$$p' $< >> $@t
|
||||
chmod a-w $@t
|
||||
mv $@t $@
|
||||
|
||||
16
m4/Makefile.am.in
Normal file
16
m4/Makefile.am.in
Normal file
@@ -0,0 +1,16 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||
|
||||
##m4-files-begin
|
||||
##m4-files-end
|
||||
|
||||
Makefile.am: Makefile.am.in
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##m4-files-begin/p' $< > $@t
|
||||
( echo EXTRA_DIST = README Makefile.am.in; \
|
||||
find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \
|
||||
|fmt | (tr '\012' @; echo) \
|
||||
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
|
||||
>> $@t
|
||||
sed -n '/^##m4-files-end/,$$p' $< >> $@t
|
||||
chmod a-w $@t
|
||||
mv $@t $@
|
||||
@@ -1,19 +1,14 @@
|
||||
# Makefile.in generated automatically by automake 1.2f from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# Generate this list with
|
||||
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
|
||||
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
@@ -36,6 +31,8 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@@ -70,6 +67,7 @@ GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
@@ -91,12 +89,14 @@ VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
l = @l@
|
||||
|
||||
EXTRA_DIST = README \
|
||||
check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 \
|
||||
getgroups.m4 getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
|
||||
jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 perl.m4 prereq.m4 putenv.m4 \
|
||||
readdir.m4 realloc.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
|
||||
mktime.m4
|
||||
EXTRA_DIST = README Makefile.am.in assert.m4 check-decl.m4 chown.m4 \
|
||||
const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 fstypename.m4 getgroups.m4 \
|
||||
getline.m4 getloadavg.m4 gettext.m4 inttypes_h.m4 isc-posix.m4 \
|
||||
jm-glibc-io.m4 jm-macros.m4 jm-mktime.m4 jm-winsz1.m4 jm-winsz2.m4 \
|
||||
lchown.m4 lcmessage.m4 lfs.m4 ls-mntd-fs.m4 lstat.m4 malloc.m4 memcmp.m4 \
|
||||
perl.m4 prereq.m4 progtest.m4 putenv.m4 readdir.m4 realloc.m4 regex.m4 \
|
||||
ssize_t.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 utimbuf.m4 utime.m4 \
|
||||
utimes.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@@ -107,13 +107,13 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
default: all
|
||||
all: Makefile
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits m4/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
@@ -153,8 +153,6 @@ install: install-exec install-data all
|
||||
|
||||
uninstall:
|
||||
|
||||
all: Makefile
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
@@ -185,12 +183,24 @@ maintainer-clean: maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default tags distdir info dvi installcheck install-exec \
|
||||
install-data install uninstall all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
.PHONY: tags distdir info dvi installcheck install-exec install-data \
|
||||
install uninstall all installdirs mostlyclean-generic distclean-generic \
|
||||
clean-generic maintainer-clean-generic clean mostlyclean distclean \
|
||||
maintainer-clean
|
||||
|
||||
|
||||
Makefile.am: Makefile.am.in
|
||||
rm -f $@ $@t
|
||||
sed -n '1,/^##m4-files-begin/p' $< > $@t
|
||||
( echo EXTRA_DIST = README Makefile.am.in; \
|
||||
find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \
|
||||
|fmt | (tr '\012' @; echo) \
|
||||
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
|
||||
>> $@t
|
||||
sed -n '/^##m4-files-end/,$$p' $< >> $@t
|
||||
chmod a-w $@t
|
||||
mv $@t $@
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
@@ -2,3 +2,7 @@ These files are used by a program called aclocal (part of the GNU automake
|
||||
package). aclocal uses these files to create aclocal.m4 which is in turn
|
||||
used by autoconf to create the configure script at the the top level in
|
||||
this distribution.
|
||||
|
||||
The Makefile.am file in this directory is automatically generated
|
||||
from the template file, Makefile.am.in. The generation will fail
|
||||
if you don't have all the right tools.
|
||||
|
||||
13
m4/assert.m4
Normal file
13
m4/assert.m4
Normal file
@@ -0,0 +1,13 @@
|
||||
#serial 1
|
||||
dnl based on code from Eleftherios Gkioulekas
|
||||
|
||||
AC_DEFUN(jm_ASSERT,
|
||||
[
|
||||
AC_MSG_CHECKING(whether to enable assertions)
|
||||
AC_ARG_ENABLE(assert,
|
||||
[ --disable-assert turn off assertions],
|
||||
[ AC_MSG_RESULT(no)
|
||||
AC_DEFINE(NDEBUG) ],
|
||||
[ AC_MSG_RESULT(yes) ]
|
||||
)
|
||||
])
|
||||
10
m4/chown.m4
10
m4/chown.m4
@@ -17,6 +17,7 @@ AC_DEFUN(jm_FUNC_CHOWN,
|
||||
AC_CACHE_CHECK([for working chown], jm_cv_func_working_chown,
|
||||
[AC_TRY_RUN([
|
||||
# include <sys/types.h>
|
||||
# include <stat.h>
|
||||
# include <fcntl.h>
|
||||
# ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
@@ -28,7 +29,14 @@ AC_DEFUN(jm_FUNC_CHOWN,
|
||||
char *f = "conftestchown";
|
||||
if (creat (f, 0600) < 0)
|
||||
exit (1);
|
||||
exit (chown (f, (uid_t) -1, (gid_t) -1) == -1 ? 1 : 0);
|
||||
if (stat (f, &before) < 0)
|
||||
exit (1);
|
||||
if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
|
||||
exit (1);
|
||||
if (stat (f, &after) < 0)
|
||||
exit (1);
|
||||
exit ((before.st_uid == after.st_uid
|
||||
&& before.st_gid == after.st_gid) ? 0 : 1);
|
||||
}
|
||||
],
|
||||
jm_cv_func_working_chown=yes,
|
||||
|
||||
42
m4/fstypename.m4
Normal file
42
m4/fstypename.m4
Normal file
@@ -0,0 +1,42 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl
|
||||
dnl See if struct statfs has the f_fstypename member.
|
||||
dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS.
|
||||
dnl
|
||||
|
||||
AC_DEFUN(jm_FSTYPENAME,
|
||||
[
|
||||
AC_CACHE_CHECK([for f_fstypename in struct statfs],
|
||||
fu_cv_sys_f_fstypename_in_statfs,
|
||||
[
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
],
|
||||
[struct statfs s; int i = sizeof s.f_fstypename;],
|
||||
fu_cv_sys_f_fstypename_in_statfs=yes,
|
||||
fu_cv_sys_f_fstypename_in_statfs=no
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
|
||||
if test x = y; then
|
||||
# This code is deliberately never run via ./configure.
|
||||
# FIXME: this is a hack to make autoheader put the corresponding
|
||||
# HAVE_* undef for this symbol in config.h.in. This saves me the
|
||||
# trouble of having to maintain the #undef in acconfig.h manually.
|
||||
AC_CHECK_FUNCS(F_FSTYPENAME_IN_STATFS)
|
||||
fi
|
||||
# Defining it this way (rather than via AC_DEFINE) short-circuits the
|
||||
# autoheader check -- autoheader doesn't know it's already been taken
|
||||
# care of by the hack above.
|
||||
ac_kludge=HAVE_F_FSTYPENAME_IN_STATFS
|
||||
AC_DEFINE_UNQUOTED($ac_kludge)
|
||||
fi
|
||||
]
|
||||
)
|
||||
324
m4/gettext.m4
Normal file
324
m4/gettext.m4
Normal file
@@ -0,0 +1,324 @@
|
||||
# Macro to add for using GNU gettext.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 105
|
||||
|
||||
AC_DEFUN(AM_WITH_NLS,
|
||||
[AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
[ --disable-nls do not use Native Language Support],
|
||||
USE_NLS=$enableval, USE_NLS=yes)
|
||||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS)
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
nls_cv_force_use_gnu_gettext=$withval,
|
||||
nls_cv_force_use_gnu_gettext=no)
|
||||
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
||||
|
||||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||
dnl User does not insist on using GNU NLS library. Figure out what
|
||||
dnl to use. If gettext or catgets are available (in this order) we
|
||||
dnl use this. Else we have to fall back to GNU NLS library.
|
||||
dnl catgets is only used if permitted by option --with-catgets.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
CATOBJEXT=NONE
|
||||
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CACHE_CHECK([for gettext in libintl],
|
||||
gt_cv_func_gettext_libintl,
|
||||
[AC_CHECK_LIB(intl, gettext,
|
||||
gt_cv_func_gettext_libintl=yes,
|
||||
gt_cv_func_gettext_libintl=no)],
|
||||
gt_cv_func_gettext_libintl=no)])
|
||||
|
||||
if test "$gt_cv_func_gettext_libintl" = yes; then
|
||||
LIBS="$LIBS -lintl"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT)
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
if test "$MSGFMT" != "no"; then
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
|
||||
return _nl_msg_cat_cntr],
|
||||
[CATOBJEXT=.gmo
|
||||
DATADIRNAME=share],
|
||||
[CATOBJEXT=.mo
|
||||
DATADIRNAME=lib])
|
||||
INSTOBJEXT=.mo
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
AC_MSG_CHECKING([whether catgets can be used])
|
||||
AC_ARG_WITH(catgets,
|
||||
[ --with-catgets use catgets functions if available],
|
||||
nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
|
||||
AC_MSG_RESULT($nls_cv_use_catgets)
|
||||
|
||||
if test "$nls_cv_use_catgets" = "yes"; then
|
||||
dnl No gettext in C library. Try catgets next.
|
||||
AC_CHECK_LIB(i, main)
|
||||
AC_CHECK_FUNC(catgets,
|
||||
[AC_DEFINE(HAVE_CATGETS)
|
||||
INTLOBJS="\$(CATOBJS)"
|
||||
AC_PATH_PROG(GENCAT, gencat, no)dnl
|
||||
if test "$GENCAT" != "no"; then
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
|
||||
if test "$GMSGFMT" = "no"; then
|
||||
AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
|
||||
fi
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.cat
|
||||
INSTOBJEXT=.cat
|
||||
DATADIRNAME=lib
|
||||
INTLDEPS='$(top_builddir)/intl/libintl.a'
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
dnl Neither gettext nor catgets in included in the C library.
|
||||
dnl Fall back on GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Mark actions used to generate GNU NLS library.
|
||||
INTLOBJS="\$(GETTOBJS)"
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_SUBST(MSGFMT)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.gmo
|
||||
INSTOBJEXT=.mo
|
||||
DATADIRNAME=share
|
||||
INTLDEPS='$(top_builddir)/intl/libintl.a'
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi
|
||||
|
||||
dnl Test whether we really found GNU xgettext.
|
||||
if test "$XGETTEXT" != ":"; then
|
||||
dnl If it is no GNU xgettext we define it as : so that the
|
||||
dnl Makefiles still can work.
|
||||
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
|
||||
: ;
|
||||
else
|
||||
AC_MSG_RESULT(
|
||||
[found xgettext program is not GNU xgettext; ignore it])
|
||||
XGETTEXT=":"
|
||||
fi
|
||||
fi
|
||||
|
||||
# We need to process the po/ directory.
|
||||
POSUB=po
|
||||
else
|
||||
DATADIRNAME=share
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi
|
||||
if test -z "$nsl_cv_header_intl"; then
|
||||
# Clean out junk possibly left behind by a previous configuration.
|
||||
rm -f intl/libintl.h
|
||||
fi
|
||||
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
|
||||
AC_OUTPUT_COMMANDS(
|
||||
[case "$CONFIG_FILES" in *po/Makefile.in*)
|
||||
sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
|
||||
esac])
|
||||
|
||||
|
||||
# If this is used in GNU gettext we have to set USE_NLS to `yes'
|
||||
# because some of the sources are only built for this goal.
|
||||
if test "$PACKAGE" = gettext; then
|
||||
USE_NLS=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl These rules are solely for the distribution goal. While doing this
|
||||
dnl we only have to keep exactly one list of the available catalogs
|
||||
dnl in configure.in.
|
||||
for lang in $ALL_LINGUAS; do
|
||||
GMOFILES="$GMOFILES $lang.gmo"
|
||||
POFILES="$POFILES $lang.po"
|
||||
done
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||
AC_SUBST(CATALOGS)
|
||||
AC_SUBST(CATOBJEXT)
|
||||
AC_SUBST(DATADIRNAME)
|
||||
AC_SUBST(GMOFILES)
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
AC_SUBST(INTLDEPS)
|
||||
AC_SUBST(INTLLIBS)
|
||||
AC_SUBST(INTLOBJS)
|
||||
AC_SUBST(POFILES)
|
||||
AC_SUBST(POSUB)
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_GNU_GETTEXT,
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_C_CONST])dnl
|
||||
AC_REQUIRE([AC_C_INLINE])dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
|
||||
unistd.h sys/param.h])
|
||||
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
|
||||
strdup __argz_count __argz_stringify __argz_next])
|
||||
|
||||
if test "${ac_cv_func_stpcpy+set}" != "set"; then
|
||||
AC_CHECK_FUNCS(stpcpy)
|
||||
fi
|
||||
if test "${ac_cv_func_stpcpy}" = "yes"; then
|
||||
AC_DEFINE(HAVE_STPCPY)
|
||||
fi
|
||||
|
||||
AM_LC_MESSAGES
|
||||
AM_WITH_NLS
|
||||
|
||||
if test "x$CATOBJEXT" != "x"; then
|
||||
if test "x$ALL_LINGUAS" = "x"; then
|
||||
LINGUAS=
|
||||
else
|
||||
AC_MSG_CHECKING(for catalogs to be installed)
|
||||
NEW_LINGUAS=
|
||||
for lang in ${LINGUAS=$ALL_LINGUAS}; do
|
||||
case "$ALL_LINGUAS" in
|
||||
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
|
||||
esac
|
||||
done
|
||||
LINGUAS=$NEW_LINGUAS
|
||||
AC_MSG_RESULT($LINGUAS)
|
||||
fi
|
||||
|
||||
dnl Construct list of names of catalog files to be constructed.
|
||||
if test -n "$LINGUAS"; then
|
||||
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl The reference to <locale.h> in the installed <libintl.h> file
|
||||
dnl must be resolved because we cannot expect the users of this
|
||||
dnl to define HAVE_LOCALE_H.
|
||||
if test $ac_cv_header_locale_h = yes; then
|
||||
INCLUDE_LOCALE_H="#include <locale.h>"
|
||||
else
|
||||
INCLUDE_LOCALE_H="\
|
||||
/* The system does not provide the header <locale.h>. Take care yourself. */"
|
||||
fi
|
||||
AC_SUBST(INCLUDE_LOCALE_H)
|
||||
|
||||
dnl Determine which catalog format we have (if any is needed)
|
||||
dnl For now we know about two different formats:
|
||||
dnl Linux libc-5 and the normal X/Open format
|
||||
test -d intl || mkdir intl
|
||||
if test "$CATOBJEXT" = ".cat"; then
|
||||
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
|
||||
|
||||
dnl Transform the SED scripts while copying because some dumb SEDs
|
||||
dnl cannot handle comments.
|
||||
sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
|
||||
fi
|
||||
dnl po2tbl.sed is always needed.
|
||||
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
|
||||
$srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
|
||||
|
||||
dnl In the intl/Makefile.in we have a special dependency which makes
|
||||
dnl only sense for gettext. We comment this out for non-gettext
|
||||
dnl packages.
|
||||
if test "$PACKAGE" = "gettext"; then
|
||||
GT_NO="#NO#"
|
||||
GT_YES=
|
||||
else
|
||||
GT_NO=
|
||||
GT_YES="#YES#"
|
||||
fi
|
||||
AC_SUBST(GT_NO)
|
||||
AC_SUBST(GT_YES)
|
||||
|
||||
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
|
||||
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
|
||||
dnl Try to locate is.
|
||||
MKINSTALLDIRS=
|
||||
if test -n "$ac_aux_dir"; then
|
||||
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
|
||||
fi
|
||||
if test -z "$MKINSTALLDIRS"; then
|
||||
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
|
||||
fi
|
||||
AC_SUBST(MKINSTALLDIRS)
|
||||
|
||||
dnl *** For now the libtool support in intl/Makefile is not for real.
|
||||
l=
|
||||
AC_SUBST(l)
|
||||
|
||||
dnl Generate list of files to be processed by xgettext which will
|
||||
dnl be included in po/Makefile.
|
||||
test -d po || mkdir po
|
||||
if test "x$srcdir" != "x."; then
|
||||
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
|
||||
posrcprefix="$srcdir/"
|
||||
else
|
||||
posrcprefix="../$srcdir/"
|
||||
fi
|
||||
else
|
||||
posrcprefix="../"
|
||||
fi
|
||||
rm -f po/POTFILES
|
||||
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||
])
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 1
|
||||
#serial 2
|
||||
|
||||
dnl From Paul Eggert.
|
||||
|
||||
@@ -7,6 +7,12 @@ dnl From Paul Eggert.
|
||||
|
||||
AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
|
||||
[
|
||||
if test x = y; then
|
||||
dnl This code is deliberately never run via ./configure.
|
||||
dnl FIXME: this is a gross hack to make autoheader put an entry
|
||||
dnl for `HAVE_INTTYPES_H' in config.h.in.
|
||||
AC_CHECK_FUNCS(INTTYPES_H)
|
||||
fi
|
||||
AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
|
||||
[AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>
|
||||
@@ -15,6 +21,7 @@ AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
|
||||
jm_ac_cv_header_inttypes_h=yes,
|
||||
jm_ac_cv_header_inttypes_h=no)])
|
||||
if test $jm_ac_cv_header_inttypes_h = yes; then
|
||||
AC_DEFINE(HAVE_INTTYPES_H)
|
||||
ac_kludge=HAVE_INTTYPES_H
|
||||
AC_DEFINE_UNQUOTED($ac_kludge)
|
||||
fi
|
||||
])
|
||||
|
||||
16
m4/isc-posix.m4
Normal file
16
m4/isc-posix.m4
Normal file
@@ -0,0 +1,16 @@
|
||||
#serial 1
|
||||
dnl This test replaces the one in autoconf.
|
||||
dnl Currently this macro should have the same name as the autoconf macro
|
||||
dnl because gettext's gettext.m4 (distributed in the automake package)
|
||||
dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
|
||||
dnl give these diagnostics:
|
||||
dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
|
||||
dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
|
||||
|
||||
undefine([AC_ISC_POSIX])
|
||||
AC_DEFUN(AC_ISC_POSIX,
|
||||
[
|
||||
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
|
||||
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
|
||||
]
|
||||
)
|
||||
23
m4/jm-glibc-io.m4
Normal file
23
m4/jm-glibc-io.m4
Normal file
@@ -0,0 +1,23 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl
|
||||
dnl See if the glibc *_unlocked I/O macros are available.
|
||||
dnl
|
||||
|
||||
AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO,
|
||||
[AC_CHECK_FUNCS( \
|
||||
clearerr_unlocked \
|
||||
feof_unlocked \
|
||||
ferror_unlocked \
|
||||
fflush_unlocked \
|
||||
fputc_unlocked \
|
||||
fread_unlocked \
|
||||
fwrite_unlocked \
|
||||
getc_unlocked \
|
||||
getchar_unlocked \
|
||||
putc_unlocked \
|
||||
putchar_unlocked \
|
||||
)
|
||||
]
|
||||
)
|
||||
32
m4/jm-macros.m4
Normal file
32
m4/jm-macros.m4
Normal file
@@ -0,0 +1,32 @@
|
||||
#serial 1
|
||||
|
||||
dnl Misc type-related macros for fileutils, sh-utils, textutils.
|
||||
|
||||
AC_DEFUN(jm_MACROS,
|
||||
[
|
||||
dnl This macro actually runs replacement code. See isc-posix.m4.
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
|
||||
AC_REQUIRE([jm_WITH_REGEX])
|
||||
AC_REQUIRE([jm_ASSERT])
|
||||
AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
|
||||
AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
|
||||
AC_REQUIRE([jm_TYPE_SSIZE_T])
|
||||
AC_REQUIRE([jm_STRUCT_UTIMBUF])
|
||||
AC_REQUIRE([jm_STRUCT_DIRENT_D_TYPE])
|
||||
AC_REQUIRE([jm_STRUCT_DIRENT_D_INO])
|
||||
AC_REQUIRE([jm_CHECK_DECLS])
|
||||
|
||||
AC_REQUIRE([jm_PREREQ])
|
||||
|
||||
AC_REQUIRE([jm_FUNC_LCHOWN])
|
||||
AC_REQUIRE([jm_FUNC_CHOWN])
|
||||
AC_REQUIRE([jm_FUNC_MKTIME])
|
||||
AC_REQUIRE([jm_FUNC_LSTAT])
|
||||
AC_REQUIRE([jm_FUNC_STAT])
|
||||
AC_REQUIRE([jm_FUNC_REALLOC])
|
||||
AC_REQUIRE([jm_FUNC_MALLOC])
|
||||
AC_REQUIRE([jm_FUNC_READDIR])
|
||||
AC_REQUIRE([jm_FUNC_MEMCMP])
|
||||
AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
|
||||
])
|
||||
@@ -1,4 +1,4 @@
|
||||
#serial 2
|
||||
#serial 3
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl If you use this macro in a package, you should
|
||||
@@ -7,12 +7,12 @@ dnl /* Define to rpl_mktime if the replacement function should be used. */
|
||||
dnl #undef mktime
|
||||
dnl
|
||||
AC_DEFUN(jm_FUNC_MKTIME,
|
||||
[AC_REQUIRE([jm_AM_FUNC_MKTIME])dnl
|
||||
[AC_REQUIRE([AM_FUNC_MKTIME])dnl
|
||||
|
||||
dnl mktime.c uses localtime_r if it exists. Check for it.
|
||||
AC_CHECK_FUNCS(localtime_r)
|
||||
|
||||
if test $jm_am_cv_func_working_mktime = no; then
|
||||
if test $am_cv_func_working_mktime = no; then
|
||||
AC_DEFINE_UNQUOTED(mktime, rpl_mktime)
|
||||
fi
|
||||
])
|
||||
|
||||
10
m4/lchown.m4
Normal file
10
m4/lchown.m4
Normal file
@@ -0,0 +1,10 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl Provide lchown on systems that lack it.
|
||||
|
||||
AC_DEFUN(jm_FUNC_LCHOWN,
|
||||
[
|
||||
AC_REQUIRE([AC_TYPE_UID_T])
|
||||
AC_REPLACE_FUNCS(lchown)
|
||||
])
|
||||
19
m4/lcmessage.m4
Normal file
19
m4/lcmessage.m4
Normal file
@@ -0,0 +1,19 @@
|
||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_LC_MESSAGES,
|
||||
[if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||
AC_DEFINE(HAVE_LC_MESSAGES)
|
||||
fi
|
||||
fi])
|
||||
201
m4/ls-mntd-fs.m4
Normal file
201
m4/ls-mntd-fs.m4
Normal file
@@ -0,0 +1,201 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl
|
||||
dnl This is not pretty. I've just taken the autoconf code and wrapped
|
||||
dnl it in an AC_DEFUN.
|
||||
dnl
|
||||
dnl CAUTION: This is very fragile. It relies on several checks that
|
||||
dnl are still in fileutils' configure.in:
|
||||
dnl FIXME: add AC_REQUIRE uses to pull in all definitions required
|
||||
dnl for all uses of $ac_cv_func_* and $ac_cv_header_* variables below.
|
||||
dnl
|
||||
|
||||
AC_DEFUN(jm_LIST_MOUNTED_FILESYSTEMS,
|
||||
[
|
||||
# Determine how to get the list of mounted filesystems.
|
||||
list_mounted_fs=
|
||||
|
||||
# If the getmntent function is available but not in the standard library,
|
||||
# make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
|
||||
AC_FUNC_GETMNTENT
|
||||
|
||||
# This test must precede the ones for getmntent because Unicos-9 is
|
||||
# reported to have the getmntent function, but its support is incompatible
|
||||
# with other getmntent implementations.
|
||||
|
||||
# NOTE: Normally, I wouldn't use a check for system type as I've done for
|
||||
# `CRAY' below since that goes against the whole autoconf philosophy. But
|
||||
# I think there is too great a chance that some non-Cray system has a
|
||||
# function named listmntent to risk the false positive.
|
||||
|
||||
if test -z "$list_mounted_fs"; then
|
||||
# Cray UNICOS 9
|
||||
AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
|
||||
[fu_cv_sys_mounted_cray_listmntent=no
|
||||
AC_EGREP_CPP(yes,
|
||||
[#ifdef _CRAY
|
||||
yes
|
||||
#endif
|
||||
], [test $ac_cv_func_listmntent = yes \
|
||||
&& fu_cv_sys_mounted_cray_listmntent=yes]
|
||||
)
|
||||
]
|
||||
)
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
|
||||
if test $fu_cv_sys_mounted_cray_listmntent = yes; then
|
||||
list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_LISTMNTENT)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $ac_cv_func_getmntent = yes; then
|
||||
|
||||
# This system has the getmntent function.
|
||||
# Determine whether it's the one-argument variant or the two-argument one.
|
||||
|
||||
if test -z "$list_mounted_fs"; then
|
||||
# 4.3BSD, SunOS, HP-UX, Dynix, Irix
|
||||
AC_MSG_CHECKING([for one-argument getmntent function])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
|
||||
[test $ac_cv_header_mntent_h = yes \
|
||||
&& fu_cv_sys_mounted_getmntent1=yes \
|
||||
|| fu_cv_sys_mounted_getmntent1=no])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
|
||||
if test $fu_cv_sys_mounted_getmntent1 = yes; then
|
||||
list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETMNTENT1)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$list_mounted_fs"; then
|
||||
# SVR4
|
||||
AC_MSG_CHECKING([for two-argument getmntent function])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
|
||||
[AC_EGREP_HEADER(getmntent, sys/mnttab.h,
|
||||
fu_cv_sys_mounted_getmntent2=yes,
|
||||
fu_cv_sys_mounted_getmntent2=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
|
||||
if test $fu_cv_sys_mounted_getmntent2 = yes; then
|
||||
list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETMNTENT2)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$list_mounted_fs"; then
|
||||
AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if test -z "$list_mounted_fs"; then
|
||||
# DEC Alpha running OSF/1.
|
||||
AC_MSG_CHECKING([for getfsstat function])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
|
||||
[AC_TRY_LINK([
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/fs_types.h>],
|
||||
[struct statfs *stats;
|
||||
int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
|
||||
fu_cv_sys_mounted_getsstat=yes,
|
||||
fu_cv_sys_mounted_getsstat=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
|
||||
if test $fu_cv_sys_mounted_getsstat = yes; then
|
||||
list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETFSSTAT)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$list_mounted_fs"; then
|
||||
# AIX.
|
||||
AC_MSG_CHECKING([for mntctl function and struct vmount])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
|
||||
[AC_TRY_CPP([#include <fshelp.h>],
|
||||
fu_cv_sys_mounted_vmount=yes,
|
||||
fu_cv_sys_mounted_vmount=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
|
||||
if test $fu_cv_sys_mounted_vmount = yes; then
|
||||
list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_VMOUNT)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$list_mounted_fs"; then
|
||||
# SVR3
|
||||
AC_MSG_CHECKING([for FIXME existence of three headers])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
|
||||
[AC_TRY_CPP([
|
||||
#include <sys/statfs.h>
|
||||
#include <sys/fstyp.h>
|
||||
#include <mnttab.h>],
|
||||
fu_cv_sys_mounted_fread_fstyp=yes,
|
||||
fu_cv_sys_mounted_fread_fstyp=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
|
||||
if test $fu_cv_sys_mounted_fread_fstyp = yes; then
|
||||
list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_FREAD_FSTYP)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$list_mounted_fs"; then
|
||||
# 4.4BSD and DEC OSF/1.
|
||||
AC_MSG_CHECKING([for getmntinfo function])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
|
||||
[
|
||||
ok=
|
||||
if test $ac_cv_func_getmntinfo = yes; then
|
||||
AC_EGREP_HEADER(f_type;, sys/mount.h,
|
||||
ok=yes)
|
||||
fi
|
||||
test -n "$ok" \
|
||||
&& fu_cv_sys_mounted_getmntinfo=yes \
|
||||
|| fu_cv_sys_mounted_getmntinfo=no
|
||||
])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
|
||||
if test $fu_cv_sys_mounted_getmntinfo = yes; then
|
||||
list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETMNTINFO)
|
||||
fi
|
||||
fi
|
||||
|
||||
# FIXME: add a test for netbsd-1.1 here
|
||||
|
||||
if test -z "$list_mounted_fs"; then
|
||||
# Ultrix
|
||||
AC_MSG_CHECKING([for getmnt function])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
|
||||
[AC_TRY_CPP([
|
||||
#include <sys/fs_types.h>
|
||||
#include <sys/mount.h>],
|
||||
fu_cv_sys_mounted_getmnt=yes,
|
||||
fu_cv_sys_mounted_getmnt=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
|
||||
if test $fu_cv_sys_mounted_getmnt = yes; then
|
||||
list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETMNT)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$list_mounted_fs"; then
|
||||
# SVR2
|
||||
AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_fread,
|
||||
[AC_TRY_CPP([#include <mnttab.h>],
|
||||
fu_cv_sys_mounted_fread=yes,
|
||||
fu_cv_sys_mounted_fread=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_fread)
|
||||
if test $fu_cv_sys_mounted_fread = yes; then
|
||||
list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_FREAD)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$list_mounted_fs"; then
|
||||
AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
|
||||
# FIXME -- no need to abort building the whole package
|
||||
# Can't build mountlist.c or anything that needs its functions
|
||||
fi
|
||||
|
||||
])
|
||||
144
m4/mktime.m4
144
m4/mktime.m4
@@ -1,144 +0,0 @@
|
||||
#serial 103
|
||||
dnl FIXME: when this goes back into automake, reset this to a small number
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl FIXME: this should migrate into libit.
|
||||
|
||||
dnl FIXME: when this goes back into automake, remove all jm_ prefixes
|
||||
|
||||
AC_DEFUN(jm_AM_FUNC_MKTIME,
|
||||
[AC_REQUIRE([AC_HEADER_TIME])dnl
|
||||
AC_CHECK_HEADERS(sys/time.h unistd.h)
|
||||
AC_CHECK_FUNCS(alarm)
|
||||
AC_CACHE_CHECK([for working mktime], jm_am_cv_func_working_mktime,
|
||||
[AC_TRY_RUN(
|
||||
changequote(<<, >>)dnl
|
||||
<</* Test program from Paul Eggert (eggert@twinsun.com)
|
||||
and Tony Leneis (tony@plaza.ds.adp.com). */
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# if HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if !HAVE_ALARM
|
||||
# define alarm(X) /* empty */
|
||||
#endif
|
||||
|
||||
/* Work around redefinition to rpl_putenv by other config tests. */
|
||||
#undef putenv
|
||||
|
||||
static time_t time_t_max;
|
||||
|
||||
/* Values we'll use to set the TZ environment variable. */
|
||||
static const char *const tz_strings[] = {
|
||||
(const char *) 0, "GMT0", "JST-9",
|
||||
"EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
|
||||
};
|
||||
#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
|
||||
|
||||
static void
|
||||
mktime_test (now)
|
||||
time_t now;
|
||||
{
|
||||
struct tm *lt;
|
||||
if ((lt = localtime (&now)) && mktime (lt) != now)
|
||||
exit (1);
|
||||
now = time_t_max - now;
|
||||
if ((lt = localtime (&now)) && mktime (lt) != now)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static void
|
||||
irix_6_4_bug ()
|
||||
{
|
||||
/* Based on code from Ariel Faigon. */
|
||||
struct tm tm;
|
||||
tm.tm_year = 96;
|
||||
tm.tm_mon = 3;
|
||||
tm.tm_mday = 0;
|
||||
tm.tm_hour = 0;
|
||||
tm.tm_min = 0;
|
||||
tm.tm_sec = 0;
|
||||
tm.tm_isdst = -1;
|
||||
mktime (&tm);
|
||||
if (tm.tm_mon != 2 || tm.tm_mday != 31)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static void
|
||||
bigtime_test (j)
|
||||
int j;
|
||||
{
|
||||
struct tm tm;
|
||||
time_t now;
|
||||
tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
|
||||
/* This test makes some buggy mktime implementations loop.
|
||||
Give up after 10 seconds. */
|
||||
alarm (10);
|
||||
now = mktime (&tm);
|
||||
alarm (0);
|
||||
if (now != (time_t) -1)
|
||||
{
|
||||
struct tm *lt = localtime (&now);
|
||||
if (! (lt
|
||||
&& lt->tm_year == tm.tm_year
|
||||
&& lt->tm_mon == tm.tm_mon
|
||||
&& lt->tm_mday == tm.tm_mday
|
||||
&& lt->tm_hour == tm.tm_hour
|
||||
&& lt->tm_min == tm.tm_min
|
||||
&& lt->tm_sec == tm.tm_sec
|
||||
&& lt->tm_yday == tm.tm_yday
|
||||
&& lt->tm_wday == tm.tm_wday
|
||||
&& ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
|
||||
== (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
time_t t, delta;
|
||||
int i, j;
|
||||
|
||||
for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
|
||||
continue;
|
||||
time_t_max--;
|
||||
delta = time_t_max / 997; /* a suitable prime number */
|
||||
for (i = 0; i < N_STRINGS; i++)
|
||||
{
|
||||
if (tz_strings[i])
|
||||
putenv (tz_strings[i]);
|
||||
|
||||
for (t = 0; t <= time_t_max - delta; t += delta)
|
||||
mktime_test (t);
|
||||
mktime_test ((time_t) 60 * 60);
|
||||
mktime_test ((time_t) 60 * 60 * 24);
|
||||
|
||||
for (j = 1; 0 < j; j *= 2)
|
||||
bigtime_test (j);
|
||||
bigtime_test (j - 1);
|
||||
}
|
||||
irix_6_4_bug ();
|
||||
exit (0);
|
||||
}
|
||||
>>,
|
||||
changequote([, ])dnl
|
||||
jm_am_cv_func_working_mktime=yes, jm_am_cv_func_working_mktime=no,
|
||||
dnl When crosscompiling, assume mktime is missing or broken.
|
||||
jm_am_cv_func_working_mktime=no)
|
||||
])
|
||||
if test $jm_am_cv_func_working_mktime = no; then
|
||||
LIBOBJS="$LIBOBJS mktime.o"
|
||||
fi
|
||||
])
|
||||
15
m4/prereq.m4
15
m4/prereq.m4
@@ -1,4 +1,4 @@
|
||||
#serial 1
|
||||
#serial 2
|
||||
|
||||
dnl These are the prerequisite macros for files in the lib/
|
||||
dnl directories of the fileutils, sh-utils, and textutils packages.
|
||||
@@ -6,4 +6,17 @@ dnl directories of the fileutils, sh-utils, and textutils packages.
|
||||
AC_DEFUN(jm_PREREQ,
|
||||
[
|
||||
jm_PREREQ_ERROR
|
||||
jm_PREREQ_REGEX
|
||||
])
|
||||
|
||||
dnl FIXME: maybe put this in a separate file
|
||||
AC_DEFUN(jm_PREREQ_REGEX,
|
||||
[
|
||||
dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
|
||||
dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
|
||||
dnl to get them.
|
||||
AC_CHECK_FUNCS(bzero bcopy isascii btowc)
|
||||
AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
|
||||
AC_HEADER_STDC
|
||||
AC_FUNC_ALLOCA
|
||||
])
|
||||
|
||||
47
m4/progtest.m4
Normal file
47
m4/progtest.m4
Normal file
@@ -0,0 +1,47 @@
|
||||
# Search path for a program which passes the given test.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
/*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test -n "[$]$1"; then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
23
m4/regex.m4
Normal file
23
m4/regex.m4
Normal file
@@ -0,0 +1,23 @@
|
||||
#serial 2
|
||||
|
||||
dnl Derived from code in GNU grep.
|
||||
|
||||
AC_DEFUN(jm_WITH_REGEX,
|
||||
[
|
||||
dnl Even packages that don't use regex.c can use this macro.
|
||||
dnl Of course, for them it doesn't do anything.
|
||||
|
||||
syscmd([test -f lib/regex.c])
|
||||
ifelse(sysval, 0,
|
||||
[
|
||||
AC_ARG_WITH(included-regex,
|
||||
[ --without-included-regex don't compile regex (use with caution)],
|
||||
jm_with_regex=$withval,
|
||||
jm_with_regex=yes)
|
||||
if test "$jm_with_regex" = yes; then
|
||||
LIBOBJS="$LIBOBJS regex.o"
|
||||
fi
|
||||
],
|
||||
)
|
||||
]
|
||||
)
|
||||
19
m4/ssize_t.m4
Normal file
19
m4/ssize_t.m4
Normal file
@@ -0,0 +1,19 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering
|
||||
|
||||
# If ssize_t is not defined in sys/types.h, define it to `int'.
|
||||
|
||||
AC_DEFUN(jm_TYPE_SSIZE_T,
|
||||
[AC_CACHE_CHECK(for ssize_t in sys/types.h, jm_ac_cv_type_ssize_t,
|
||||
[
|
||||
AC_EGREP_HEADER(ssize_t, sys/types.h,
|
||||
jm_ac_cv_type_ssize_t=yes,
|
||||
jm_ac_cv_type_ssize_t=no)
|
||||
if test $jm_ac_cv_type_ssize_t = no; then
|
||||
AC_DEFINE(ssize_t, int)
|
||||
fi
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
49
m4/utimbuf.m4
Normal file
49
m4/utimbuf.m4
Normal file
@@ -0,0 +1,49 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering
|
||||
|
||||
dnl Define HAVE_STRUCT_UTIMBUF if `struct utimbuf' is declared --
|
||||
dnl usually in <utime.h>.
|
||||
dnl Some systems have utime.h but don't declare the struct anywhere.
|
||||
|
||||
AC_DEFUN(jm_STRUCT_UTIMBUF,
|
||||
[
|
||||
AC_CHECK_HEADERS(utime.h)
|
||||
AC_REQUIRE([AC_HEADER_TIME])
|
||||
AC_CACHE_CHECK([for struct utimbuf], fu_cv_sys_struct_utimbuf,
|
||||
[AC_TRY_COMPILE(
|
||||
[
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_UTIME_H
|
||||
# include <utime.h>
|
||||
#endif
|
||||
],
|
||||
[static struct utimbuf x; x.actime = x.modtime;],
|
||||
fu_cv_sys_struct_utimbuf=yes,
|
||||
fu_cv_sys_struct_utimbuf=no)
|
||||
])
|
||||
|
||||
if test $fu_cv_sys_struct_utimbuf = yes; then
|
||||
if test x = y; then
|
||||
# This code is deliberately never run via ./configure.
|
||||
# FIXME: this is a hack to make autoheader put the corresponding
|
||||
# HAVE_* undef for this symbol in config.h.in. This saves me the
|
||||
# trouble of having to maintain the #undef in acconfig.h manually.
|
||||
AC_CHECK_FUNCS(STRUCT_UTIMBUF)
|
||||
fi
|
||||
# Defining it this way (rather than via AC_DEFINE) short-circuits the
|
||||
# autoheader check -- autoheader doesn't know it's already been taken
|
||||
# care of by the hack above.
|
||||
ac_kludge=HAVE_STRUCT_UTIMBUF
|
||||
AC_DEFINE_UNQUOTED($ac_kludge)
|
||||
fi
|
||||
])
|
||||
18
m4/utime.m4
Normal file
18
m4/utime.m4
Normal file
@@ -0,0 +1,18 @@
|
||||
#serial 1
|
||||
|
||||
dnl From Jim Meyering
|
||||
dnl Replace the utime function on systems that need it.
|
||||
|
||||
dnl FIXME
|
||||
|
||||
AC_DEFUN(jm_FUNC_UTIME,
|
||||
[
|
||||
AC_CHECK_HEADERS(utime.h)
|
||||
AC_REQUIRE([jm_STRUCT_UTIMBUF])
|
||||
AC_REQUIRE([AC_FUNC_UTIME_NULL])
|
||||
|
||||
if test $ac_cv_func_utime_null = no; then
|
||||
jm_FUNC_UTIMES_NULL
|
||||
AC_REPLACE_FUNCS(utime)
|
||||
fi
|
||||
])
|
||||
34
m4/utimes.m4
Normal file
34
m4/utimes.m4
Normal file
@@ -0,0 +1,34 @@
|
||||
#serial 1
|
||||
|
||||
dnl Shamelessly cloned from acspecific.m4's AC_FUNC_UTIME_NULL.
|
||||
|
||||
AC_DEFUN(jm_FUNC_UTIMES_NULL,
|
||||
[AC_CACHE_CHECK(whether utimes accepts a null argument, ac_cv_func_utimes_null,
|
||||
[rm -f conftestdata; > conftestdata
|
||||
AC_TRY_RUN([#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
main() {
|
||||
struct stat s, t;
|
||||
exit(!(stat ("conftestdata", &s) == 0 && utimes("conftestdata", (long *)0) == 0
|
||||
&& stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime
|
||||
&& t.st_mtime - s.st_mtime < 120));
|
||||
}], ac_cv_func_utimes_null=yes, ac_cv_func_utimes_null=no,
|
||||
ac_cv_func_utimes_null=no)
|
||||
rm -f core core.* *.core])
|
||||
|
||||
if test $ac_cv_func_utimes_null = yes; then
|
||||
if test x = y; then
|
||||
# This code is deliberately never run via ./configure.
|
||||
# FIXME: this is a hack to make autoheader put the corresponding
|
||||
# HAVE_* undef for this symbol in config.h.in. This saves me the
|
||||
# trouble of having to maintain the #undef in acconfig.h manually.
|
||||
AC_CHECK_FUNCS(UTIMES_NULL)
|
||||
fi
|
||||
# Defining it this way (rather than via AC_DEFINE) short-circuits the
|
||||
# autoheader check -- autoheader doesn't know it's already been taken
|
||||
# care of by the hack above.
|
||||
ac_kludge=HAVE_UTIMES_NULL
|
||||
AC_DEFINE_UNQUOTED($ac_kludge)
|
||||
fi
|
||||
]
|
||||
)
|
||||
@@ -1,3 +1,584 @@
|
||||
1998-07-25 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 3.16s.
|
||||
|
||||
* tests/cp/same-file: Skip three more unportable tests.
|
||||
These failed on SunOS4.1.4.
|
||||
|
||||
* src/copy.c (SAME_INODE): Remove definition.
|
||||
* src/sys2.h (SAME_INODE): Define it here instead.
|
||||
|
||||
* src/remove.c (same_file): New function.
|
||||
(remove_dir): Use it to give a better diagnostic when rmdir fails
|
||||
because it can't remove the current directory.
|
||||
|
||||
* src/df.c (long_options): Changes table entries not to use this form:
|
||||
{"all", no_argument, &show_all_fs, 1},
|
||||
but rather this form:
|
||||
{"all", no_argument, NULL, 'a'},
|
||||
Using the latter, all the option handling in one place: the getopt loop.
|
||||
|
||||
* lib/mountlist.c (read_filesystem_list) [MOUNTED_GETMNTINFO]:
|
||||
Use fsp_to_string.
|
||||
(fsp_to_string): Don't xmalloc return value (yet).
|
||||
(xatoi): Ansideclify.
|
||||
(fstype_to_string): Ansideclify.
|
||||
* lib/mountlist.h: Define and use PARAMS macro.
|
||||
|
||||
* lib/utime.c: New file.
|
||||
* src/touch.c (utime_now): Moved into m4/utimes.m4.
|
||||
(touch) [!HAVE_UTIME_NULL]: Remove #ifdef and the use of utime_now
|
||||
in the if-block.
|
||||
|
||||
* configure.in (jm_FUNC_UTIME): Use this, not AC_FUNC_UTIME.
|
||||
|
||||
1998-07-22 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/human.c (human_readable): amt -> damt, to fix typo when
|
||||
computing which power to use after overflow occurs during
|
||||
multiplication.
|
||||
|
||||
* lib/xstrtol.c: Include <stdio.h> if NDEBUG is not defined;
|
||||
needed on SunOS 4.
|
||||
|
||||
1998-07-21 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Add df -l or --local option.
|
||||
* doc/fileutils.texi: Document it.
|
||||
* lib/mountlist.h (REMOTE_FS_TYPE): New macro.
|
||||
* lib/mountlist.c (read_filesystem_list):
|
||||
If all_fs is negative, omit non-local filesytems.
|
||||
|
||||
* src/df.c (show_dev): Omit local devices if show_all_fs is negative.
|
||||
(show_all_fs): If negative, omit non-local filesystems.
|
||||
All uses of (all_fs != 0) changed to (all_fs > 0).
|
||||
(long_options, usage, main): Add -l or --local option.
|
||||
(main): When asking for df of an explicit file name, get all
|
||||
the mount points, so that we're more likely to find it when
|
||||
we look it up.
|
||||
|
||||
1998-07-18 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/copy.c (copy_internal): Add another exclusion from the
|
||||
sameness test: when --force has been specified, the destination
|
||||
is unlinked before any copy.
|
||||
(copy_internal): Add yet another: when both src and dest are symlinks.
|
||||
|
||||
* tests/touch: New subdir.
|
||||
* tests/Makefile.am (SUBDIRS): Add touch.
|
||||
* configure.in (AC_OUTPUT): Add tests/touch/Makefile.
|
||||
|
||||
* tests/mv/into-self-2: New test.
|
||||
* tests/mv/Makefile.am (TESTS): Add into-self-2.
|
||||
|
||||
1998-07-06 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* lib/mountlist.c (read_filesystem_list): Fix more memory leaks on
|
||||
failure.
|
||||
|
||||
1998-07-16 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
Work around failure of chown calls on m68k-motorola-sysv systems.
|
||||
* src/chown.c: Include lchown.h.
|
||||
* lib/Makefile.am (noinst_HEADERS): Add lchown.h.
|
||||
* lib/lchown.h: New file, just to define ENOSYS on systems that lack it.
|
||||
* lib/lchown.c: Include lchown.h.
|
||||
Reported by and with suggestions from Manfred Hollstein.
|
||||
|
||||
1998-07-12 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/df.c (print_header): Print "1k-blocks", not "1.0k-blocks".
|
||||
|
||||
1998-07-07 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/sys2.h [HAVE_FCLOSE_UNLOCKED]: Remove unnecessary block.
|
||||
Suggestion from Ulrich Drepper.
|
||||
|
||||
1998-07-04 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/safe-read.c (safe_read): Change type of pointer parameter to
|
||||
`void' to avoid Irix4 cc errors. Reported by Kaveh Ghazi.
|
||||
* lib/safe-read.h: Update prototype.
|
||||
|
||||
* src/dircolors.c (parse_line): Add casts to avoid errors from
|
||||
Irix4's `cc' C compiler. From Kaveh Ghazi.
|
||||
|
||||
* lib/xstrtol.c: Include stdio.h. Required on some systems when
|
||||
using assert. From Kaveh Ghazi.
|
||||
|
||||
* tests/mv/backup-is-src: Use cmp, not diff.
|
||||
Reported by Kaveh Ghazi.
|
||||
|
||||
1998-07-03 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 3.16r.
|
||||
|
||||
* src/remove.c (remove_dir): Use fprintf (not error) to avoid
|
||||
newline in prompt.
|
||||
|
||||
1998-06-30 Paul Eggert <eggert@shade.twinsun.com>
|
||||
|
||||
* lib/mountlist.c: (read_filesystem_list):
|
||||
Don't leak memory on failure.
|
||||
Don't create a dummy struct mount_entry entry;
|
||||
use the address-of-the-tail-address method instead.
|
||||
Preserve errno if possible on failure, setting it to 0 if inapplicable.
|
||||
Close file descriptor leak if the F_SETLKW failed.
|
||||
Report an error if SVR4 lock file cannot be opened for some reason
|
||||
other than a nonexistent lock file.
|
||||
|
||||
1998-07-03 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in (AM_WITH_REGEX): Remove. Now the replacement
|
||||
macro, jm_WITH_REGEX, is bundled with the rest in jm_MACROS.
|
||||
* acconfig.h (WITH_REGEX): Remove undef.
|
||||
* lib/Makefile.am (noinst_HEADERS): Add regex.h.
|
||||
* lib/rpmatch.c: Remove #ifdef around <regex.h> inclusion.
|
||||
* lib/rx.c: Remove file.
|
||||
* lib/rx.h: Remove file.
|
||||
|
||||
* src/df.c (df_readable): Rename local so as not to shadow global.
|
||||
|
||||
* src/copy.c (SAME_INODE): New macro.
|
||||
Use it to replace open-coded equivalents.
|
||||
(copy_internal): Rename variable and reverse sense of tests
|
||||
to make the code a little clearer.
|
||||
|
||||
1998-07-02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* src/copy.c (copy_internal): Try harder identifying a relative
|
||||
symbolic link in the current directory.
|
||||
|
||||
* src/copy.c (copy_internal): Don't skip test for same file if
|
||||
creating a hardlink from symlink over a non-symlink while making
|
||||
backups.
|
||||
* tests/cp/same-file: Skip tests that depend on link(2) not
|
||||
following symlinks.
|
||||
|
||||
1998-07-02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* src/copy.c (copy_internal): Don't call chown on a symlink.
|
||||
|
||||
1998-07-01 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/xstrtol.c: Don't define NDEBUG here, now that it's done via
|
||||
configure's --disable-assert option.
|
||||
|
||||
1998-06-29 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/mountlist.c (read_filesystem_list):
|
||||
Plug file descriptor leak on failure.
|
||||
Report failure if lock file can't be opened for some reason
|
||||
other than nonexistence.
|
||||
|
||||
1998-06-29 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 3.16q.
|
||||
|
||||
* lib/mountlist.c (read_filesystem_list) [MOUNTED_GETMNTENT2]:
|
||||
Always close stream and file descriptor before returning.
|
||||
|
||||
* src/df.c (main): Move the test of the result of the
|
||||
read_filesystem_list call up out of if-block -- code in the
|
||||
else-block depends on it too.
|
||||
|
||||
1998-06-29 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/mountlist.c: (read_filesystem_list): If SVR4, lock
|
||||
/etc/.mnttab.lock if available, to avoid race conditions
|
||||
(e.g. with the automounter on Solaris 2.6).
|
||||
|
||||
Include <errno.h>, <fcntl.h>, <unistd.h>.
|
||||
|
||||
1998-06-29 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/mountlist.c (fstype_to_string): Guard with
|
||||
#if ! HAVE_F_FSTYPENAME_IN_STATFS.
|
||||
|
||||
1998-06-28 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Add support for new --block-size option and
|
||||
BLOCK_SIZE. DF_BLOCK_SIZE, etc. variables to `df', `du', and `ls'.
|
||||
Adjust df output slightly to accommodate larger filesystems.
|
||||
|
||||
* lib/human.c, lib/human.h (human_readable): Coalesce last two args
|
||||
into one, for convenience. All callers changed.
|
||||
(human_block_size): New function.
|
||||
* lib/human.c: Include <config.h> only if HAVE_CONFIG_H.
|
||||
Include <stdlib.h> if HAVE_STDLIB_H;
|
||||
declare getenv unless HAVE_DECL_GETENV.
|
||||
(_): New macro.
|
||||
Include <argmatch.h>, <error.h>, <xstrtoul.h>.
|
||||
(DEFAULT_BLOCK_SIZE): New macro.
|
||||
(block_size_args, block_size_types): New constants.
|
||||
(humblock): New function.
|
||||
* lib/xstrtol.h (__ZLONG_MAX): Remove.
|
||||
* lib/xstrtol.c (bkm_scale): Don't assume that you can convert
|
||||
unsigned long to double without losing information.
|
||||
(bkm_scale_by_power): New function.
|
||||
|
||||
* lib/xstrtol.c (__xstrtol), src/dd.c (parse_integer):
|
||||
Add support for SI-like suffixes like "GB" and "TD".
|
||||
* src/dd.c (usage): Describe it.
|
||||
|
||||
* src/df.c, src/du.c, src/ls.c (human_readable_base, output_units):
|
||||
Remove; replace with new variable output_block_size. All uses changed.
|
||||
(long_options, usage, main): Add --block-size.
|
||||
(main, decode_switches): Use new human_block_size function to
|
||||
initialize output block size consistently with other programs.
|
||||
|
||||
* src/df.c (print_header, show_dev): Shrink some columns and expand
|
||||
others, to squeeze in support for today's larger filesystems.
|
||||
(print_header): Print output block size using power-of-1024 SI format.
|
||||
(df_readable): Coalesce last two args into one, for convenience.
|
||||
All callers changed.
|
||||
(main): Remove check for portable output format and larger
|
||||
or human-readable block sizes.
|
||||
|
||||
* NEWS, doc/fileutils.texi: Describe above changes.
|
||||
|
||||
1998-06-28 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/ls.c (usage): Make --kilobytes description consistent with
|
||||
that in du and df. From Göran Uddeborg.
|
||||
|
||||
* lib/mountlist.c (fsp_to_string): Clean out some crufty #ifdefs
|
||||
now that we're using the jm_FSTYPENAME autoconf macro.
|
||||
James Tanis reported the old version didn't compile on BSDI3.
|
||||
|
||||
* configure.in: Move big block of list_mounted_fs checks into
|
||||
new jm_LIST_MOUNTED_FILESYSTEMS macro.
|
||||
Use new jm_FSTYPENAME macro.
|
||||
|
||||
* src/sys2.h: Add macro definitions for GNU libc *_unlocked wrappers.
|
||||
* src/ls.c: Add DIRED_ prefix to the macros: PUTCHAR, FPUTS, and
|
||||
FPUTS_LITERAL
|
||||
|
||||
1998-06-27 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/copy.c (copy_reg): Detect identical source and dest here.
|
||||
(copy_internal): Make the test symmetric.
|
||||
|
||||
* tests/cp/same-file: New file.
|
||||
* tests/cp/Makefile.am (TESTS): Add it.
|
||||
|
||||
1998-06-26 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/remove.c (remove_file): Remove `non-directory' part of
|
||||
`removing non-directory FILE' verbose message.
|
||||
|
||||
1998-06-23 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/df.c (show_dev): Increase field width for blocks, used,
|
||||
and available columns from 7 to 8.
|
||||
|
||||
1998-06-21 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* aclocal.m4: Regenerate with fixed gettext.m4 installed.
|
||||
See README-alpha for details.
|
||||
|
||||
1998-06-02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* src/automake-wrap: Quote `&' in sed replacement text.
|
||||
|
||||
1998-05-31 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 3.16p.
|
||||
|
||||
* src/install.c (main): Fix argv-handling bug in my 1998-05-09 change.
|
||||
Reported by Don Parsons.
|
||||
|
||||
1998-05-30 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* tests/ls/time-1: Clean up ctime test. Note that it fails also
|
||||
on Solaris5.5.1 tmpfs file systems.
|
||||
|
||||
Solve the `rm -f rm' problem more cleanly.
|
||||
* src/.rm-warning: Remove file.
|
||||
* src/automake-wrap: New file.
|
||||
* src/Makefile.am (AUTOMAKE): Define to use automake-wrap.
|
||||
(Makefile.in): Depend on automake-wrap.
|
||||
(EXTRA_DIST): Add automake-wrap.
|
||||
(DISTCLEANFILES): Remove definition.
|
||||
(rm_DEPENDENCIES): Likewise.
|
||||
(.rm-warn-stamp): Remove rule.
|
||||
|
||||
1998-05-27 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* tests/ls/Makefile.am (TESTS): s/cr-1/rt-1/
|
||||
* tests/ls/rt-1: New file, renamed from cr-1.
|
||||
|
||||
1998-05-26 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* src/Makefile.am (.rm-warn-stamp): Cope with $(srcdir) != ".".
|
||||
|
||||
* tests/ls/cr-1: Don't use the ctime for testing, it is impossible
|
||||
to set it reliably.
|
||||
|
||||
1998-05-25 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in (_GNU_SOURCE): AC_DEFINE it here.
|
||||
* acconfig.h (_GNU_SOURCE): Remove definition from @TOP@ section.
|
||||
[!_GNU_SOURCE]: Add #undef instead.
|
||||
|
||||
1998-05-24 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 3.16o.
|
||||
|
||||
* src/ansi2knr.c: Use new version from automake-1.3.
|
||||
|
||||
* src/chown.c: Accept new option, --dereference.
|
||||
--no-dereference is now the default.
|
||||
(enum Change_status) [CH_NOT_APPLIED]: New member.
|
||||
(change_symlinks): Enable this by default, now.
|
||||
(describe_change): Handle new case.
|
||||
(change_file_owner): Add new parameter: cmdline_arg. Update callers.
|
||||
Reorganize to reflect changed semantics.
|
||||
(LCHOWN): Remove definitions.
|
||||
|
||||
* lib/lchown.c: New file.
|
||||
|
||||
1998-05-21 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add russian (ru).
|
||||
|
||||
1998-05-16 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/remove.c (hash_compare_strings): Return true or false, not 1/0.
|
||||
(remove_cwd_entries): Use RM_OK, not equivalent literal `1'.
|
||||
|
||||
* lib/hash.c (is_prime): Ansideclify.
|
||||
(next_prime): Ansideclify. Add an assertion.
|
||||
|
||||
* lib/Makefile.am (EXTRA_DIST): Remove. Automake groks the `LIBOBJS='
|
||||
lines from the m4/*.m4 macros, so the hack of including some
|
||||
custom-replaced C source file names here is no longer needed.
|
||||
|
||||
* configure.in (jm_MACROS): New wrapper macro.
|
||||
Remove uses of most jm_* macros.
|
||||
|
||||
* acconfig.h (HAVE_STRUCT_UTIMBUF): Remove #undef. Now it's handled
|
||||
as part of utimbuf.m4.
|
||||
(memcmp): Add #undef.
|
||||
|
||||
1998-05-12 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in: Use my replacement AC_ISC_POSIX rather than
|
||||
open-coding it.
|
||||
|
||||
* src/copy.c (copy_internal): Plug a small leak.
|
||||
|
||||
1998-05-10 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/mv.c (do_move): Remove lots of code that was duplicated in
|
||||
copy.c (copy), now that copy() has better support for mv. This fixes
|
||||
a bug with cross-filesystem `mv -i' whereby you could get two prompts
|
||||
for the same destination file and eventually remove the destination
|
||||
file even though one of the responses was negative.
|
||||
Reported by Dirk Lattermann.
|
||||
|
||||
* src/copy.h: Better support for mv:
|
||||
[struct cp_options] (move_mode): New member.
|
||||
* src/copy.c (copy_internal): Use new move_mode member.
|
||||
Add parameter.
|
||||
(copy): Add parameter.
|
||||
|
||||
* tests/cp/Makefile.am (TESTS): Add backup-is-src.
|
||||
* tests/mv/Makefile.am (TESTS): Likewise.
|
||||
|
||||
* lib/userspec.c: Don't declare strdup if it's defined as a macro.
|
||||
Reported by Lorne Baker.
|
||||
|
||||
* src/Makefile.am (ginstall_SOURCES): Add copy.c and cp-hash.c.
|
||||
|
||||
* src/mv.c (cp_option_init): Initialize new members.
|
||||
* src/cp.c (cp_option_init): Likewise.
|
||||
(main): Set new preserve_* options.
|
||||
|
||||
1998-05-09 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/copy.h: Support for install:
|
||||
[struct cp_options] (failed_unlink_is_fatal): New member.
|
||||
(preserve_owner_and_group): New member.
|
||||
(preserve_chmod_bits): New member.
|
||||
(preserve_timestamps): New member.
|
||||
(preserve): Remove member.
|
||||
(set_mode): New member.
|
||||
(mode): New member.
|
||||
* src/copy.c (new_nondir_mode): New function. Use where appropriate.
|
||||
Use more-specific preserve_* members in place of removed `preserve'.
|
||||
(copy_internal): Honor failed_unlink_is_fatal.
|
||||
|
||||
* src/install.c (main): Rewrite argv-handling to be clearer.
|
||||
(copy_file): Rewrite to use copy.c (copy).
|
||||
(change_attributes): Get rid of now-(with chown wrapper)-unnecessary
|
||||
`no_need_to_chown' parameter. Fix caller.
|
||||
(install_file_in_file): Remove now-unnecessary `to_created' parameter.
|
||||
(cp_option_init): New function.
|
||||
Update several functions to take new parameter specifying copy options.
|
||||
|
||||
* tests/install: New subdir, with one basic test.
|
||||
* tests/Makefile.am (SUBDIRS): Add install.
|
||||
* configure.in (AC_OUTPUT): Add tests/install/Makefile.
|
||||
|
||||
* src/dd.c: Include safe-read.h.
|
||||
Don't declare safe_read.
|
||||
* src/touch.c: Likewise.
|
||||
|
||||
* configure.in (jm_TYPE_SSIZE_T): Use it.
|
||||
* acconfig.h (ssize_t): Add undef.
|
||||
|
||||
1998-05-03 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* po/: Update from gettext-0.10.35.
|
||||
* intl/: Likewise.
|
||||
* configure.in: Remove use of AC_LINK_FILES.
|
||||
(AC_OUTPUT): Remove po/Makefile-generating sed command.
|
||||
|
||||
1998-04-28 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/dircolors.c (parse_line): Use ISSPACE, not isspace.
|
||||
Use unsigned char * pointers, not potentially signed ones, to avoid
|
||||
sign extension.
|
||||
|
||||
1998-04-26 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in: Use jm_ASSERT.
|
||||
* acconfig.h: Add NDEBUG.
|
||||
|
||||
* src/mv.c: Don't define NDEBUG.
|
||||
* src/cp.c: Likewise.
|
||||
|
||||
1998-04-14 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/.rm-warning: New file.
|
||||
* src/Makefile.am (EXTRA_DIST): Add .rm-warning
|
||||
(DISTCLEANFILES): Add .rm-warn-stamp.
|
||||
(rm_DEPENDENCIES): Depend on .rm-warn-stamp.
|
||||
(.rm-warn-stamp): New rule.
|
||||
(rm_prep): Comment out rule.
|
||||
|
||||
* src/df.c (main): Use STREQ in string equality tests, not strcmp.
|
||||
* src/dircolors.c (dc_parse_stream): Likewise.
|
||||
(dc_parse_file): Likewise.
|
||||
* src/du.c (main): Likewise.
|
||||
* src/ls.c (decode_switches): Likewise.
|
||||
* src/remove.c (hash_compare_strings): Likewise.
|
||||
* src/touch.c (main): Likewise.
|
||||
|
||||
1998-04-13 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/Makefile.am (noinst_HEADERS): Add safe-read.h.
|
||||
|
||||
1998-04-11 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/hash.c: Add curly braces around statements in
|
||||
if/else/while/do/etc. that span more than a line -- even around
|
||||
multiline simple statements or single-line simple statements
|
||||
preceded by a comment line.
|
||||
|
||||
1998-04-09 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in: Don't use AC_PATH_PROG to check for perl, now that
|
||||
we use jm_PERL.
|
||||
|
||||
1998-04-06 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/cp-hash.c (cph_hash_insert): Rename from now-conflicting
|
||||
hash_insert. Also declare to be static.
|
||||
* src/cp-hash.h (hash_insert): Remove declaration.
|
||||
|
||||
* lib/hash.c: Lots of minor spec and name changes, and new comments.
|
||||
(hash_rehash): Rewrite to be easier on the allocator.
|
||||
From François Pinard.
|
||||
* lib/hash.h: More comments.
|
||||
* src/remove.c: Change names/usage of hash-related functions to work
|
||||
with the above.
|
||||
|
||||
1998-04-05 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/regex.c (WIDE_CHAR_SUPPORT): Define.
|
||||
This now depends on HAVE_BTOWC so systems that lack btowc (like
|
||||
solaris-2.5.1) don't lose.
|
||||
|
||||
1998-04-04 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* GNUmakefile: Add conditionals so that running `make' in an
|
||||
unconfigured source directory will get a reasonable diagnostic.
|
||||
|
||||
* Makefile.am (ACLOCAL_AMFLAGS): Define this, so automake/aclocal
|
||||
know about the m4/ subdirectory.
|
||||
* Makefile.maint (aclocal-files): Remove now-unnecessary (with
|
||||
automake-1.2h and the above change) aclocal-related rules and includes.
|
||||
|
||||
1998-04-01 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* tests/ls/cr-1: New file.
|
||||
* tests/ls/Makefile.am (TESTS): Add cr-1.
|
||||
|
||||
1998-03-31 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* src/system.h (TYPE_MAXIMUM): Cast result to `(t)' so this macro
|
||||
works with `unsigned char'.
|
||||
From Greg Wooledge.
|
||||
(SCHAR_MIN, SCHAR_MAX, SHRT_MIN, SHRT_MAX, LONG_MAX, ULONG_MAX): Define.
|
||||
|
||||
* lib/xstrtol.c: Merge with the version from textutils.
|
||||
|
||||
* lib/memcmp.c (rpl_memcmp): Rename from memcmp.
|
||||
|
||||
1998-03-30 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* src/ls.c (compare_ctime, rev_cmp_ctime, compare_mtime,
|
||||
rev_cmp_mtime, compare_atime, rev_cmp_atime, compare_size,
|
||||
rev_cmp_size): Use file name as secondary sort key to get
|
||||
consistent sorting.
|
||||
|
||||
1998-03-28 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* src/copy.c: Add copyright.
|
||||
* src/remove.c: Add copyright.
|
||||
[_AIX]: Add #pragma alloca.
|
||||
|
||||
1998-03-27 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* Makefile.maint ($(ACLOCAL_M4)): Replace old rule with this
|
||||
dependency and the := assignment of ACLOCAL to make the default
|
||||
rule use the `-I m4' option.
|
||||
|
||||
* Makefile.am (AUTOMAKE_OPTIONS): Require 1.2h.
|
||||
|
||||
1998-03-23 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* acconfig.h: Remove HAVE_INTTYPES_H, now that m4/inttypes_h.m4
|
||||
automatically handles it.
|
||||
|
||||
1998-03-21 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* lib/quotearg.h: Update from patch-2.5.3.
|
||||
* lib/quotearg.c: Likewise.
|
||||
* src/ls.c (decode_switches): Pass a null pointer instead of address
|
||||
of quotearg_quoting_options.
|
||||
|
||||
1998-03-19 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* lib/fsusage.h (struct fs_usage): New member
|
||||
fsu_bavail_top_bit_set.
|
||||
* lib/fsusage.c: Include <limits.h>.
|
||||
(CHAR_BIT, EXTRACT_TOP_BIT, PROPAGATE_TOP_BIT): New macros.
|
||||
(get_fs_usage): If top bit of system variable corresponding to
|
||||
fsu_bavail is set, then set fsu_bavail_top_bit_set, and
|
||||
sign-extend the value when storing it into fsu_bavail.
|
||||
* src/df.c (show_dev): If fsu_bavail_top_bit_set is nonzero,
|
||||
assume the original value corresponding to fsu_bavail was negative.
|
||||
Reported by Arne Juul.
|
||||
|
||||
1998-03-18 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* src/Makefile.am (rm-prep): Add dependency and rule to save users
|
||||
with `.' too early in their PATH from the `rm: cannot unlink `rm':
|
||||
Text file busy' error. Suggestion from Philippe De Muyter.
|
||||
|
||||
1998-03-15 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* Version 3.16n.
|
||||
|
||||
@@ -1,4 +1,41 @@
|
||||
Changes in release 3.17:
|
||||
[3.16s]
|
||||
* df accept a new option --local (-l)
|
||||
* touch works around a system-specific bug so it now affects existing,
|
||||
zero-length files on certain systems
|
||||
* chown now works even on certain SVR3 systems where it used to fail
|
||||
[3.16r]
|
||||
* include gettext's m4 macros
|
||||
* minor cp bug fixed
|
||||
* non-portable cp tests removed
|
||||
* --without-included-regex now means don't compile regex.c
|
||||
* rx support removed
|
||||
[3.16q]
|
||||
* `df', `du', and `ls' now accept a new option --block-size=SIZE,
|
||||
where SIZE can be a positive integer block size, followed by an
|
||||
optional SI prefix (e.g. `k' for kilo, `M' for Mega), followed by an
|
||||
optional `B' (for ``byte'', indicating powers of 1024, which is the
|
||||
default) or `D' (for ``decimal byte'', indicating powers of 1000).
|
||||
SIZE can also be `human-readable' (for -h or --human-readable
|
||||
behavior) or `si' (for -H or --si behavior).
|
||||
* These suffixes can also be used by `dd'; e.g. `dd bs=1MB' is equivalent
|
||||
to `dd bs=1048576'.
|
||||
* The default block size for the `df' command is now obtained from the
|
||||
DF_BLOCK_SIZE environment variable or, if that is not set, from BLOCK_SIZE.
|
||||
Similarly for `du' and `ls'.
|
||||
* The output columns of `df' have been adjusted slightly to accommodate
|
||||
larger filesystems.
|
||||
* fix gettext-related link failures seen when configuring certain ways
|
||||
[3.16p]
|
||||
* fix install bug introduced in 3.16o
|
||||
* build/test changes only
|
||||
[3.16o]
|
||||
* chown accepts new option, --dereference. --no-dereference is now the default.
|
||||
* install now shares core copying code with mv and cp
|
||||
* mv (between distinct filesystems) now uses more of the core copying code
|
||||
* fixed a bug or two in mv
|
||||
* df once again displays negative numbers when that's what's returned
|
||||
by get_fs_usage
|
||||
[3.16n]
|
||||
* `mv dir dir' once again does *not* remove dir/
|
||||
* ls accepts new options:
|
||||
|
||||
@@ -1,3 +1,168 @@
|
||||
1998-07-16 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/Makefile.am (noinst_HEADERS): Add lchown.h.
|
||||
* lib/lchown.h: New file, just to define ENOSYS on systems that lack it.
|
||||
* lib/lchown.c: Include lchown.h.
|
||||
|
||||
1998-07-15 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/seq.c (check_format): Add `5' to the list of digits.
|
||||
Reported by Donni Erpel.
|
||||
|
||||
1998-07-12 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 1.16f.
|
||||
|
||||
* tests/test: New directory and tests.
|
||||
* tests/Makefile.am (SUBDIRS): Add test.
|
||||
* configure.in (AC_OUTPUT): Add tests/test/Makefile.
|
||||
|
||||
1998-07-04 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/Makefile.am (libsu_a_SOURCES): Remove regex.c, now that it's
|
||||
automatically discovered by automake.
|
||||
(noinst_HEADERS): Remove unused safe-read.h.
|
||||
|
||||
* src/Makefile.am (CLEANFILES): Put $(SCRIPTS) here rather than in
|
||||
DISTCLEANFILES.
|
||||
(CLEANFILES): Add su, since we build it unconditionally, yet it's
|
||||
never put in @OPTIONAL_BIN_PROGS@.
|
||||
|
||||
1998-06-29 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/uptime.c: Include system.h only after error.h and readutmp.h
|
||||
so we don't get redefinition warnings about getc, etc.
|
||||
* src/who.c: Likewise.
|
||||
* src/users.c: Likewise.
|
||||
|
||||
1998-06-28 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/sys2.h: Add macro definitions for GNU libc *_unlocked wrappers.
|
||||
|
||||
1998-06-06 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/test.c (unary_operator): Fail if the operand to -t is not valid.
|
||||
(posixtest): Treat `test -t' the same as `test -t 1'.
|
||||
|
||||
1998-05-26 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/test.c (two_arguments): Don't test argv[pos][2] if it's
|
||||
past end of string.
|
||||
|
||||
1998-05-25 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in (_GNU_SOURCE): AC_DEFINE it here.
|
||||
* acconfig.h (_GNU_SOURCE): Remove definition from @TOP@ section.
|
||||
[!_GNU_SOURCE]: Add #undef instead.
|
||||
|
||||
1998-05-16 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/readutmp.c (read_utmp): Add variant for systems that have
|
||||
the utmpname function.
|
||||
Ansideclify.
|
||||
* configure.in: Check for utmpname.
|
||||
|
||||
* configure.in (jm_MACROS): New wrapper macro.
|
||||
Remove uses of most jm_* macros.
|
||||
|
||||
* acconfig.h: (chown): Add undef.
|
||||
(D_INO_IN_DIRENT): Likewise.
|
||||
(D_TYPE_IN_DIRENT): Likewise.
|
||||
(ssize_t): Likewise.
|
||||
|
||||
* lib/Makefile.am (EXTRA_DIST): Remove. Automake groks the `LIBOBJS='
|
||||
lines from the m4/*.m4 macros, so the hack of including some
|
||||
custom-replaced C source file names here is no longer needed.
|
||||
|
||||
1998-05-03 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* po/: Update from gettext-0.10.35.
|
||||
* intl/: Likewise.
|
||||
* configure.in: Remove use of AC_LINK_FILES.
|
||||
(AC_OUTPUT): Remove po/Makefile-generating sed command.
|
||||
|
||||
1998-05-02 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/seq.c (check_format): Use ISDIGIT, not isdigit.
|
||||
|
||||
1998-04-26 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in: Use jm_ASSERT.
|
||||
* acconfig.h: Add NDEBUG.
|
||||
|
||||
1998-04-13 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* lib/Makefile.am (noinst_HEADERS): Add safe-read.h.
|
||||
|
||||
1998-04-09 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in (AM_MAINTAINER_MODE): Remove it.
|
||||
No longer use AC_PATH_PROG to check for perl.
|
||||
(jm_PERL): Use this instead.
|
||||
|
||||
1998-04-04 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/readutmp.h (PARAMS): Define.
|
||||
|
||||
* tests/Makefile.am (SUBDIRS): Add stty.
|
||||
* tests/stty/row-col-1: New file.
|
||||
* tests/stty: New directory.
|
||||
* configure.in (AC_OUTPUT): Add tests/stty/Makefile.
|
||||
|
||||
* src/stty.c: Use STREQ in place of strcmp everywhere.
|
||||
(valid_options): Indent.
|
||||
Parenthesize assignment in while expr.
|
||||
(main): s/case 'f':/case 'F':/
|
||||
Tweak error messages to make them consistent.
|
||||
Remove #if-0'd block.
|
||||
Move dcl of `fdflags' into scope where it's used.
|
||||
Remove dcl of unused `cp'.
|
||||
Use "%s", not device_name, as the format string, in case the
|
||||
latter contains `%'.
|
||||
|
||||
[1998-03-31 Theodore Ts'o <tytso@rsts-11.mit.edu>]
|
||||
* src/stty.c (valid_options): New function.
|
||||
(main): Fix broken options parsing that worked only
|
||||
by serendipity (getopt_long_only already parsed short options; no
|
||||
need to parse them again manually!). Add support for the --file
|
||||
option, which allows the user to specify the device whose line
|
||||
settings are to be set. This is necessary because POSIX ttys will
|
||||
block waiting for carrier detect to go high if CLOCAL is not set,
|
||||
unless the device is opened with the O_NONBLOCK flag.
|
||||
Unfortunately, the shell doesn't use this flag, so users lose.
|
||||
Opening the device in stty is the easist way to fix this.
|
||||
(speeds): Add support for 230400 and 460800 line speeds, which are
|
||||
supported by Linux.
|
||||
|
||||
* acconfig.h (uintmax_t): Add #undef.
|
||||
|
||||
* configure.in (jm_AC_HEADER_INTTYPES_H): Use it.
|
||||
(jm_AC_TYPE_UINTMAX_T): Use it.
|
||||
(jm_PREREQ): Use it.
|
||||
|
||||
* src/system.h: Sync with system.c from fileutils.
|
||||
|
||||
* Makefile.am (ACLOCAL_AMFLAGS): Define this, so automake/aclocal
|
||||
know about the m4/ subdirectory.
|
||||
* Makefile.maint (aclocal-files): Remove now-unnecessary (with
|
||||
automake-1.2h and the above change) aclocal-related rules and includes.
|
||||
|
||||
1998-04-03 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* lib/closeout.c: New file.
|
||||
* lib/closeout.h: New file.
|
||||
* lib/Makefile.am (libsu_a_SOURCES): Add closeout.c.
|
||||
(noinst_HEADERS): Add closeout.h.
|
||||
|
||||
1998-03-27 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* Makefile.am (AUTOMAKE_OPTIONS): Require 1.2h.
|
||||
|
||||
1998-03-26 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* src/date.c (batch_convert): Remove spurious space in error message.
|
||||
Reported by Karl Berry.
|
||||
|
||||
1998-03-13 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* lib/getugroups.c (getugroups): Don't add a group number if it
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Changes in release 1.17
|
||||
[1.16f]
|
||||
* new autoconf tests detect bugs in vendor mktime from Irix-6.4 and SunOS4.1.4
|
||||
Your executables will be a little larger on such systems because you'll use
|
||||
GNU's mktime function, but date will work more reliably.
|
||||
[1.16f]
|
||||
* hostid: new program
|
||||
* `yes --help' and `yes --version' print those strings when the POSIXLY_CORRECT
|
||||
environment variable is set
|
||||
|
||||
@@ -1,3 +1,224 @@
|
||||
1998-07-16 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 1.22f.
|
||||
|
||||
* src/chown.c: Include lchown.h.
|
||||
* lib/Makefile.am (noinst_HEADERS): Add lchown.h.
|
||||
* lib/lchown.h: New file, just to define ENOSYS on systems that lack it.
|
||||
* lib/lchown.c: Include lchown.h.
|
||||
|
||||
1998-07-04 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in (AM_WITH_REGEX): Remove. Now the replacement
|
||||
macro, jm_WITH_REGEX, is bundled with the rest in jm_MACROS.
|
||||
* acconfig.h (WITH_REGEX): Remove undef.
|
||||
* src/csplit.c: Remove #ifdef around <regex.h> inclusion.
|
||||
* src/nl.c: Likewise.
|
||||
* src/tac.c: Likewise.
|
||||
* src/csplit.c (extract_regexp): Remove #if !WITH_REGEX...#endif block.
|
||||
* lib/Makefile.am (noinst_HEADERS): Remove rx.h.
|
||||
* lib/rx.c: Remove file.
|
||||
* lib/rx.h: Remove file.
|
||||
|
||||
1998-06-29 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/wc.c: Update calls to human_readable -- now there's one fewer arg.
|
||||
|
||||
* lib/Makefile.am (libtu_a_SOURCES): Add argmatch.c.
|
||||
(noinst_HEADERS): Add argmatch.h.
|
||||
|
||||
1998-06-28 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/sys2.h: Add macro definitions for GNU libc *_unlocked wrappers.
|
||||
|
||||
1998-06-27 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* tests/pr/Test.pm: Add two tests for double spacing.
|
||||
* src/pr.c (print_page): If cols_ready_to_print is zero,
|
||||
break out of loop just before the double-space test.
|
||||
Reported by Michael Stutz.
|
||||
|
||||
1998-06-18 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* tests/Makefile.am.in (check): Depend on $(maint_gen) so
|
||||
`make maintainer-clean; ./configure; make check' works.
|
||||
|
||||
1998-05-25 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in (_GNU_SOURCE): AC_DEFINE it here.
|
||||
* acconfig.h (_GNU_SOURCE): Remove definition from @TOP@ section.
|
||||
[!_GNU_SOURCE]: Add #undef instead.
|
||||
|
||||
1998-05-16 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* configure.in (jm_MACROS): New wrapper macro.
|
||||
Remove uses of most jm_* macros.
|
||||
|
||||
* src/tac.c (tac_seekable): Fix error in handling regex separators.
|
||||
* tests/tac/Test.pm (opt-b, opt-s, opt_sb, opt_r): New tests.
|
||||
(opt_br): New test -- exercises above-fixed bug.
|
||||
|
||||
* lib/Makefile.am (EXTRA_DIST): Remove. Automake groks the `LIBOBJS='
|
||||
lines from the m4/*.m4 macros, so the hack of including some
|
||||
custom-replaced C source file names here is no longer needed.
|
||||
|
||||
* acconfig.h (chown): Add undef.
|
||||
(D_INO_IN_DIRENT): Likewise.
|
||||
(D_TYPE_IN_DIRENT): Likewise.
|
||||
(ssize_t): Likewise.
|
||||
|
||||
1998-05-09 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/tac.c (tac_seekable): Rename from tac_stream.
|
||||
Change `FILE *in' parameter to `int input_fd'. Adjust callers.
|
||||
|
||||
1998-05-03 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* po/: Update from gettext-0.10.35.
|
||||
* intl/: Likewise.
|
||||
* configure.in: Remove use of AC_LINK_FILES.
|
||||
(AC_OUTPUT): Remove po/Makefile-generating sed command.
|
||||
|
||||
1998-04-26 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* tests/tail/Test.pm: Disable test f-1, now that it fails.
|
||||
|
||||
* src/sort.c (keycompare) (CMP_WITH_IGNORE): Don't return 0 from inside
|
||||
the keyspec-iterating loop. With this change, test 22a passes.
|
||||
Reported by Zvi Har'El.
|
||||
(strncoll): Remove bogus assertion.
|
||||
* tests/sort/Test.pm: Add tests for the above fix.
|
||||
|
||||
* configure.in: Use jm_ASSERT.
|
||||
* acconfig.h: Add NDEBUG.
|
||||
|
||||
* src/cut.c: Don't define NDEBUG.
|
||||
* src/csplit.c: Likewise.
|
||||
* src/join.c: Likewise.
|
||||
* src/sort.c: Likewise.
|
||||
* src/tr.c: Likewise.
|
||||
|
||||
* src/cut.c: Don't define _GNU_SOURCE (now it's in config.h).
|
||||
* src/expand.c: Likewise.
|
||||
* src/fold.c: Likewise.
|
||||
* src/join.c: Likewise.
|
||||
* src/sort.c: Likewise.
|
||||
* src/tr.c: Likewise.
|
||||
* src/unexpand.c: Likewise.
|
||||
* src/uniq.c: Likewise.
|
||||
|
||||
* src/tail.c (close_fd): New function -- converted from macro.
|
||||
[struct File_spec] (n_stat_calls): New member.
|
||||
[struct File_spec] (n_unchanged_stats): New member.
|
||||
(max_n_unchanged_stats): New global.
|
||||
Initialize new members.
|
||||
(xwrite): New function -- converted from macro.
|
||||
[struct File_spec] (pretty_name): Remove member.
|
||||
(pretty_name): New function.
|
||||
|
||||
* src/md5sum.c (md5_check): Declare local, `md5num' as _unsigned_ char*.
|
||||
(hex_digits): Declare parameter `s' as _unsigned_ char*.
|
||||
(split_3): Declare parameter `u' as _unsigned_ char**.
|
||||
|
||||
1998-04-17 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/fmt.c (check_punctuation): Used unsigned char* pointers to avoid
|
||||
new warning.
|
||||
* src/join.c (xfields): Likewise.
|
||||
|
||||
1998-04-12 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/cat.c: Use STREQ macro rather than strcmp.
|
||||
* src/cksum.c: Likewise.
|
||||
* src/comm.c: Likewise.
|
||||
* src/csplit.c: Likewise.
|
||||
* src/cut.c: Likewise.
|
||||
* src/fmt.c: Likewise.
|
||||
* src/fold.c: Likewise.
|
||||
* src/head.c: Likewise.
|
||||
* src/join.c: Likewise.
|
||||
* src/md5sum.c: Likewise.
|
||||
* src/nl.c: Likewise.
|
||||
* src/paste.c: Likewise.
|
||||
* src/pr.c: Likewise.
|
||||
* src/split.c: Likewise.
|
||||
* src/sum.c: Likewise.
|
||||
* src/tac.c: Likewise.
|
||||
* src/uniq.c: Likewise.
|
||||
* src/wc.c: Likewise.
|
||||
|
||||
1998-04-11 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/safe-read.h: New file.
|
||||
* lib/safe-read.c: Include it.
|
||||
* src/cat.c: Include it instead of merely declaring safe_read.
|
||||
* src/csplit.c: Likewise.
|
||||
* src/head.c: Likewise.
|
||||
* src/split.c: Likewise.
|
||||
* src/sum.c: Likewise.
|
||||
* src/tac.c: Likewise.
|
||||
* src/tail.c: Likewise.
|
||||
* src/tr.c: Likewise.
|
||||
* src/wc.c: Likewise.
|
||||
|
||||
* lib/Makefile.am (noinst_HEADERS): Add safe-read.h.
|
||||
|
||||
* src/wc.c [HAVE_INTTYPES_H]: Include inttypes.h.
|
||||
Declare counters to be of type uintmax_t.
|
||||
(write_counts): Use human_readable to format potentially-long-long
|
||||
numbers. Suggestion from Rogier Wolff.
|
||||
(wc): Declare per-file counters to be of type uintmax_t.
|
||||
Declare bytes_read to be ssize_t.
|
||||
* lib/Makefile.am (libtu_a_SOURCES): Add human.c.
|
||||
(noinst_HEADERS): Add human.h.
|
||||
|
||||
* lib/human.c: New file.
|
||||
* lib/human.h: New file.
|
||||
|
||||
1998-04-04 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* configure.in (jm_AC_HEADER_INTTYPES_H): Use it.
|
||||
(jm_AC_TYPE_UINTMAX_T): Use it.
|
||||
(jm_PREREQ): Use it.
|
||||
|
||||
* Makefile.am (ACLOCAL_AMFLAGS): Define this, so automake/aclocal
|
||||
know about the m4/ subdirectory.
|
||||
* Makefile.maint (aclocal-files): Remove now-unnecessary (with
|
||||
automake-1.2h and the above change) aclocal-related rules and includes.
|
||||
|
||||
1998-04-03 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* lib/closeout.c: New file.
|
||||
* lib/closeout.h: New file.
|
||||
* lib/Makefile.am (libtu_a_SOURCES): Add closeout.c.
|
||||
(noinst_HEADERS): Add closeout.h.
|
||||
|
||||
1998-03-31 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* lib/xstrtol.c: Merge with the version from fileutils.
|
||||
|
||||
1998-03-27 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* Makefile.am (AUTOMAKE_OPTIONS): Require 1.2h.
|
||||
|
||||
1998-03-23 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* acconfig.h: Remove HAVE_INTTYPES_H, now that m4/inttypes_h.m4
|
||||
automatically handles it.
|
||||
|
||||
1998-03-19 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* src/system.h (SCHAR_MIN): Define.
|
||||
(SHRT_MIN): Define.
|
||||
od.c needs these when compiling with NCR's R2.0c C compiler.
|
||||
(TYPE_MAXIMUM): Cast result to `(t)' so this macro works with
|
||||
`unsigned char'.
|
||||
From Greg Wooledge.
|
||||
|
||||
1998-03-15 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* src/tail.c (tail_file): Merge largely-duplicated blocks of code.
|
||||
|
||||
1998-03-03 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/sort.c (xtmpfopen): Open temporary file exclusively, to
|
||||
@@ -12,8 +233,6 @@
|
||||
|
||||
1998-02-06 Jim Meyering <meyering@eng.ascend.com>
|
||||
|
||||
* Version 1.22e.
|
||||
|
||||
* configure.in: Don't use AM_MAINTAINER_MODE or
|
||||
AC_PATH_PROG(PERL, perl).
|
||||
(jm_PERL): Use this.
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
Changes in release 1.23
|
||||
[1.22f]
|
||||
* fix pr bug: pr -td didn't double space
|
||||
* fix tac bug when using -b, -r, and -s SEPARATOR
|
||||
* fix sort bug whereby using key-local `d' option would cause following
|
||||
key specs to be ignored when any two keys (in the `d'-modified test)
|
||||
compared equal.
|
||||
[1.22e]
|
||||
* remove maintainer mode
|
||||
[1.22d]
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
# Makefile for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
@@ -94,9 +85,10 @@ all-no:
|
||||
$(srcdir)/$(PACKAGE).pot: $(POTFILES)
|
||||
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
|
||||
--add-comments --keyword=_ --keyword=N_ \
|
||||
--files-from=$(srcdir)/POTFILES.in
|
||||
rm -f $(srcdir)/$(PACKAGE).pot
|
||||
mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
|
||||
--files-from=$(srcdir)/POTFILES.in \
|
||||
&& test ! -f $(PACKAGE).po \
|
||||
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
|
||||
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
|
||||
|
||||
$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
|
||||
$(srcdir)/stamp-cat-id: $(PACKAGE).pot
|
||||
@@ -118,10 +110,10 @@ install-exec:
|
||||
install-data: install-data-@USE_NLS@
|
||||
install-data-no: all
|
||||
install-data-yes: all
|
||||
if test -r $(MKINSTALLDIRS); then \
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $(datadir); \
|
||||
else \
|
||||
$(top_srcdir)/mkinstalldirs $(datadir); \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
|
||||
fi
|
||||
@catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
@@ -132,10 +124,10 @@ install-data-yes: all
|
||||
esac; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
dir=$$destdir/$$lang/LC_MESSAGES; \
|
||||
if test -r $(MKINSTALLDIRS); then \
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $$dir; \
|
||||
else \
|
||||
$(top_srcdir)/mkinstalldirs $$dir; \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
|
||||
fi; \
|
||||
if test -r $$cat; then \
|
||||
$(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
@@ -160,10 +152,10 @@ install-data-yes: all
|
||||
fi; \
|
||||
done
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
if test -r $(MKINSTALLDIRS); then \
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $(gettextsrcdir); \
|
||||
else \
|
||||
$(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
|
||||
fi; \
|
||||
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
|
||||
$(gettextsrcdir)/Makefile.in.in; \
|
||||
|
||||
106
src/ansi2knr.c
106
src/ansi2knr.c
@@ -1,4 +1,6 @@
|
||||
/* ansi2knr.c */
|
||||
/* Copyright (C) 1989, 1997 Aladdin Enterprises. All rights reserved. */
|
||||
|
||||
/*$Id: ansi2knr.c,v 1.8 1998/05/24 17:43:17 meyering Exp $*/
|
||||
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
|
||||
|
||||
/*
|
||||
@@ -11,9 +13,10 @@ License (the "GPL") for full details.
|
||||
Everyone is granted permission to copy, modify and redistribute ansi2knr,
|
||||
but only under the conditions described in the GPL. A copy of this license
|
||||
is supposed to have been given to you along with ansi2knr so you can know
|
||||
your rights and responsibilities. It should be in a file named COPYLEFT.
|
||||
Among other things, the copyright notice and this notice must be preserved
|
||||
on all copies.
|
||||
your rights and responsibilities. It should be in a file named COPYLEFT,
|
||||
or, if there is no file named COPYLEFT, a file named COPYING. Among other
|
||||
things, the copyright notice and this notice must be preserved on all
|
||||
copies.
|
||||
|
||||
We explicitly state here what we believe is already implied by the GPL: if
|
||||
the ansi2knr program is distributed as a separate set of sources and a
|
||||
@@ -26,7 +29,10 @@ program under the GPL.
|
||||
|
||||
/*
|
||||
* Usage:
|
||||
ansi2knr input_file [output_file]
|
||||
ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
|
||||
* --filename provides the file name for the #line directive in the output,
|
||||
* overriding input_file (if present).
|
||||
* If no input_file is supplied, input is read from stdin.
|
||||
* If no output_file is supplied, output goes to stdout.
|
||||
* There are no error messages.
|
||||
*
|
||||
@@ -49,6 +55,11 @@ program under the GPL.
|
||||
* The original and principal author of ansi2knr is L. Peter Deutsch
|
||||
* <ghost@aladdin.com>. Other authors are noted in the change history
|
||||
* that follows (in reverse chronological order):
|
||||
lpd 97-12-08 made input_file optional; only closes input and/or
|
||||
output file if not stdin or stdout respectively; prints
|
||||
usage message on stderr rather than stdout; adds
|
||||
--filename switch (changes suggested by
|
||||
<ceder@lysator.liu.se>)
|
||||
lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with
|
||||
compilers that don't understand void, as suggested by
|
||||
Tom Lane
|
||||
@@ -169,11 +180,15 @@ int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{ FILE *in, *out;
|
||||
{ FILE *in = stdin;
|
||||
FILE *out = stdout;
|
||||
char *filename = 0;
|
||||
#define bufsize 5000 /* arbitrary size */
|
||||
char *buf;
|
||||
char *line;
|
||||
char *more;
|
||||
char *usage =
|
||||
"Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
|
||||
/*
|
||||
* In previous versions, ansi2knr recognized a --varargs switch.
|
||||
* If this switch was supplied, ansi2knr would attempt to convert
|
||||
@@ -184,42 +199,49 @@ main(argc, argv)
|
||||
*/
|
||||
int convert_varargs = 1;
|
||||
|
||||
if ( argc > 1 && argv[1][0] == '-' )
|
||||
{ if ( !strcmp(argv[1], "--varargs") )
|
||||
{ convert_varargs = 1;
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
else
|
||||
{ fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
while ( argc > 1 && argv[1][0] == '-' ) {
|
||||
if ( !strcmp(argv[1], "--varargs") ) {
|
||||
convert_varargs = 1;
|
||||
argc--;
|
||||
argv++;
|
||||
continue;
|
||||
}
|
||||
if (argc < 2 || argc > 3)
|
||||
if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
|
||||
filename = argv[2];
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
continue;
|
||||
}
|
||||
fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);
|
||||
fprintf(stderr, usage);
|
||||
exit(1);
|
||||
}
|
||||
switch ( argc )
|
||||
{
|
||||
printf("Usage: ansi2knr input_file [output_file]\n");
|
||||
exit(1);
|
||||
}
|
||||
in = fopen(argv[1], "r");
|
||||
if ( in == NULL )
|
||||
{
|
||||
fprintf(stderr, "Cannot open input file %s\n", argv[1]);
|
||||
exit(1);
|
||||
default:
|
||||
fprintf(stderr, usage);
|
||||
exit(0);
|
||||
case 3:
|
||||
out = fopen(argv[2], "w");
|
||||
if ( out == NULL ) {
|
||||
fprintf(stderr, "Cannot open output file %s\n", argv[2]);
|
||||
exit(1);
|
||||
}
|
||||
/* falls through */
|
||||
case 2:
|
||||
in = fopen(argv[1], "r");
|
||||
if ( in == NULL ) {
|
||||
fprintf(stderr, "Cannot open input file %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
if ( filename == 0 )
|
||||
filename = argv[1];
|
||||
/* falls through */
|
||||
case 1:
|
||||
break;
|
||||
}
|
||||
if (argc == 3)
|
||||
{
|
||||
out = fopen(argv[2], "w");
|
||||
if ( out == NULL )
|
||||
{
|
||||
fprintf(stderr, "Cannot open output file %s\n", argv[2]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out = stdout;
|
||||
}
|
||||
fprintf(out, "#line 1 \"%s\"\n", argv[1]);
|
||||
if ( filename )
|
||||
fprintf(out, "#line 1 \"%s\"\n", filename);
|
||||
buf = malloc(bufsize);
|
||||
line = buf;
|
||||
while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
|
||||
@@ -271,8 +293,10 @@ wl: fputs(buf, out);
|
||||
if ( line != buf )
|
||||
fputs(buf, out);
|
||||
free(buf);
|
||||
fclose(out);
|
||||
fclose(in);
|
||||
if ( out != stdout )
|
||||
fclose(out);
|
||||
if ( in != stdin )
|
||||
fclose(in);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
#endif
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "safe-read.h"
|
||||
|
||||
/* Undefine, to avoid warning about redefinition on some systems. */
|
||||
#undef max
|
||||
#define max(h,i) ((h) > (i) ? (h) : (i))
|
||||
|
||||
int full_write ();
|
||||
int safe_read ();
|
||||
|
||||
/* Name under which this program was invoked. */
|
||||
char *program_name;
|
||||
@@ -722,7 +722,7 @@ main (int argc, char **argv)
|
||||
free (inbuf);
|
||||
|
||||
contin:
|
||||
if (strcmp (infile, "-") && close (input_desc) < 0)
|
||||
if (!STREQ (infile, "-") && close (input_desc) < 0)
|
||||
{
|
||||
error (0, errno, "%s", infile);
|
||||
exit_status = 1;
|
||||
|
||||
62
src/chown.c
62
src/chown.c
@@ -39,6 +39,7 @@
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "savedir.h"
|
||||
#include "lchown.h"
|
||||
|
||||
#ifndef _POSIX_VERSION
|
||||
struct passwd *getpwnam ();
|
||||
@@ -50,17 +51,12 @@ struct group *getgrgid ();
|
||||
# define endpwent() ((void) 0)
|
||||
#endif
|
||||
|
||||
#if HAVE_LCHOWN
|
||||
# define LCHOWN(FILE, OWNER, GROUP) lchown (FILE, OWNER, GROUP)
|
||||
#else
|
||||
# define LCHOWN(FILE, OWNER, GROUP) 1
|
||||
#endif
|
||||
|
||||
char *parse_user_spec ();
|
||||
void strip_trailing_slashes ();
|
||||
|
||||
enum Change_status
|
||||
{
|
||||
CH_NOT_APPLIED,
|
||||
CH_SUCCEEDED,
|
||||
CH_FAILED,
|
||||
CH_NO_CHANGE_REQUESTED
|
||||
@@ -86,7 +82,7 @@ char *program_name;
|
||||
|
||||
/* If nonzero, and the systems has support for it, change the ownership
|
||||
of symbolic links rather than any files they point to. */
|
||||
static int change_symlinks;
|
||||
static int change_symlinks = 1;
|
||||
|
||||
/* If nonzero, change the ownership of directories recursively. */
|
||||
static int recurse;
|
||||
@@ -117,6 +113,7 @@ static struct option const long_options[] =
|
||||
{
|
||||
{"recursive", no_argument, 0, 'R'},
|
||||
{"changes", no_argument, 0, 'c'},
|
||||
{"dereference", no_argument, 0, 13},
|
||||
{"no-dereference", no_argument, 0, 'h'},
|
||||
{"quiet", no_argument, 0, 'f'},
|
||||
{"silent", no_argument, 0, 'f'},
|
||||
@@ -134,6 +131,14 @@ static void
|
||||
describe_change (const char *file, enum Change_status changed)
|
||||
{
|
||||
const char *fmt;
|
||||
|
||||
if (changed == CH_NOT_APPLIED)
|
||||
{
|
||||
printf (_("neither symbolic link %s nor referent has been changed\n"),
|
||||
file);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (changed)
|
||||
{
|
||||
case CH_SUCCEEDED:
|
||||
@@ -160,7 +165,7 @@ describe_change (const char *file, enum Change_status changed)
|
||||
Return 0 if successful, 1 if errors occurred. */
|
||||
|
||||
static int
|
||||
change_file_owner (const char *file, uid_t user, gid_t group)
|
||||
change_file_owner (int cmdline_arg, const char *file, uid_t user, gid_t group)
|
||||
{
|
||||
struct stat file_stats;
|
||||
uid_t newuser;
|
||||
@@ -179,14 +184,31 @@ change_file_owner (const char *file, uid_t user, gid_t group)
|
||||
if (newuser != file_stats.st_uid || newgroup != file_stats.st_gid)
|
||||
{
|
||||
int fail;
|
||||
int symlink_changed = 1;
|
||||
|
||||
if (change_symlinks)
|
||||
fail = LCHOWN (file, newuser, newgroup);
|
||||
if (S_ISLNK (file_stats.st_mode) && change_symlinks)
|
||||
{
|
||||
fail = lchown (file, newuser, newgroup);
|
||||
|
||||
/* Ignore the failure if it's due to lack of support (ENOSYS)
|
||||
and this is not a command line argument. */
|
||||
if (!cmdline_arg && fail && errno == ENOSYS)
|
||||
{
|
||||
fail = 0;
|
||||
symlink_changed = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
fail = chown (file, newuser, newgroup);
|
||||
{
|
||||
fail = chown (file, newuser, newgroup);
|
||||
}
|
||||
|
||||
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
|
||||
describe_change (file, (fail ? CH_FAILED : CH_SUCCEEDED));
|
||||
{
|
||||
enum Change_status ch_status = (! symlink_changed ? CH_NOT_APPLIED
|
||||
: (fail ? CH_FAILED : CH_SUCCEEDED));
|
||||
describe_change (file, ch_status);
|
||||
}
|
||||
|
||||
if (fail)
|
||||
{
|
||||
@@ -250,7 +272,7 @@ change_dir_owner (const char *dir, uid_t user, gid_t group, struct stat *statp)
|
||||
path = xrealloc (path, pathlength);
|
||||
}
|
||||
strcpy (path + dirlength, namep);
|
||||
errors |= change_file_owner (path, user, group);
|
||||
errors |= change_file_owner (0, path, user, group);
|
||||
}
|
||||
free (path);
|
||||
free (name_space);
|
||||
@@ -275,6 +297,8 @@ Usage: %s [OPTION]... OWNER[.[GROUP]] FILE...\n\
|
||||
Change the owner and/or group of each FILE to OWNER and/or GROUP.\n\
|
||||
\n\
|
||||
-c, --changes be verbose whenever change occurs\n\
|
||||
--dereference affect the referent of each symbolic link, rather\n\
|
||||
than the symbolic link itself\n\
|
||||
-h, --no-dereference affect symbolic links instead of any referenced file\n\
|
||||
(available only on systems that can change the\n\
|
||||
ownership of a symlink)\n\
|
||||
@@ -320,6 +344,9 @@ main (int argc, char **argv)
|
||||
case 12:
|
||||
reference_file = optarg;
|
||||
break;
|
||||
case 13:
|
||||
change_symlinks = 0;
|
||||
break;
|
||||
case 'R':
|
||||
recurse = 1;
|
||||
break;
|
||||
@@ -356,13 +383,6 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
#if ! HAVE_LCHOWN
|
||||
if (change_symlinks)
|
||||
{
|
||||
error (1, 0, _("--no-dereference (-h) is not supported on this system"));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (reference_file)
|
||||
{
|
||||
struct stat ref_stats;
|
||||
@@ -387,7 +407,7 @@ main (int argc, char **argv)
|
||||
for (; optind < argc; ++optind)
|
||||
{
|
||||
strip_trailing_slashes (argv[optind]);
|
||||
errors |= change_file_owner (argv[optind], user, group);
|
||||
errors |= change_file_owner (1, argv[optind], user, group);
|
||||
}
|
||||
|
||||
if (verbosity != V_off)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* cksum -- calculate and print POSIX.2 checksums and sizes of files
|
||||
Copyright (C) 92, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 92, 95, 96, 1997, 1998 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
|
||||
@@ -202,7 +202,7 @@ cksum (char *file, int print_name)
|
||||
long bytes_read;
|
||||
register FILE *fp;
|
||||
|
||||
if (!strcmp (file, "-"))
|
||||
if (STREQ (file, "-"))
|
||||
{
|
||||
fp = stdin;
|
||||
have_read_stdin = 1;
|
||||
@@ -229,12 +229,12 @@ cksum (char *file, int print_name)
|
||||
if (ferror (fp))
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
if (strcmp (file, "-"))
|
||||
if (!STREQ (file, "-"))
|
||||
fclose (fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strcmp (file, "-") && fclose (fp) == EOF)
|
||||
if (!STREQ (file, "-") && fclose (fp) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
return -1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* comm -- compare two sorted files line by line.
|
||||
Copyright (C) 86, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 86, 90, 91, 95, 96, 1997, 1998 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
|
||||
@@ -148,8 +148,7 @@ compare_files (char **infiles)
|
||||
{
|
||||
initbuffer (&lb1[i]);
|
||||
thisline[i] = &lb1[i];
|
||||
streams[i] = strcmp (infiles[i], "-")
|
||||
? fopen (infiles[i], "r") : stdin;
|
||||
streams[i] = (STREQ (infiles[i], "-") ? stdin : fopen (infiles[i], "r"));
|
||||
if (!streams[i])
|
||||
{
|
||||
error (0, errno, "%s", infiles[i]);
|
||||
|
||||
262
src/copy.c
262
src/copy.c
@@ -1,3 +1,22 @@
|
||||
/* copy.c -- core functions for copying files and directories
|
||||
Copyright (C) 89, 90, 91, 95, 96, 97, 1998 Free Software Foundation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Extracted from cp.c and librarified by Jim Meyering. */
|
||||
|
||||
#ifdef _AIX
|
||||
#pragma alloca
|
||||
#endif
|
||||
@@ -15,13 +34,6 @@
|
||||
#include "cp-hash.h"
|
||||
#include "path-concat.h"
|
||||
|
||||
/* On Linux (from slackware-1.2.13 to 2.0.2?) there is no lchown function.
|
||||
To change ownership of symlinks, you must run chown with an effective
|
||||
UID of 0. */
|
||||
#ifdef __linux__
|
||||
# define ROOT_CHOWN_AFFECTS_SYMLINKS
|
||||
#endif
|
||||
|
||||
#define DO_CHOWN(Chown, File, New_uid, New_gid) \
|
||||
(Chown ((File), (x->myeuid == 0 ? (New_uid) : x->myeuid), (New_gid)) \
|
||||
/* If non-root uses -p, it's ok if we can't preserve ownership. \
|
||||
@@ -39,16 +51,39 @@ struct dir_list
|
||||
int full_write ();
|
||||
int euidaccess ();
|
||||
int yesno ();
|
||||
char *dirname ();
|
||||
|
||||
static int copy_internal PARAMS ((const char *src_path, const char *dst_path,
|
||||
int new_dst, dev_t device,
|
||||
struct dir_list *ancestors,
|
||||
const struct cp_options *x,
|
||||
int *copy_into_self));
|
||||
int move_mode,
|
||||
int *copy_into_self,
|
||||
int *rename_succeeded));
|
||||
|
||||
/* The invocation name of this program. */
|
||||
extern char *program_name;
|
||||
|
||||
/* Encapsulate selection of the file mode to be applied to
|
||||
new non-directories. */
|
||||
|
||||
static mode_t
|
||||
new_nondir_mode (const struct cp_options *option, mode_t mode)
|
||||
{
|
||||
/* In some applications (e.g., install), use precisely the
|
||||
specified mode. */
|
||||
if (option->set_mode)
|
||||
return option->mode;
|
||||
|
||||
/* In others (e.g., cp, mv), apply the user's umask. */
|
||||
return mode & option->umask_kill;
|
||||
}
|
||||
|
||||
/* FIXME: describe */
|
||||
/* FIXME: rewrite this to use a hash table so we avoid the quadratic
|
||||
performance hit that's probably noticeable only on trees deeper
|
||||
than a few hundred levels. See use of active_dir_map in remove.c */
|
||||
|
||||
static int
|
||||
is_ancestor (const struct stat *sb, const struct dir_list *ancestors)
|
||||
{
|
||||
@@ -102,7 +137,7 @@ copy_dir (const char *src_path_in, const char *dst_path_in, int new_dst,
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
|
||||
ret |= copy_internal (src_path, dst_path, new_dst, src_sb->st_dev,
|
||||
ancestors, x, &local_copy_into_self);
|
||||
ancestors, x, 0, &local_copy_into_self, NULL);
|
||||
*copy_into_self |= local_copy_into_self;
|
||||
|
||||
/* Free the memory for `src_path'. The memory for `dst_path'
|
||||
@@ -144,7 +179,16 @@ copy_reg (const char *src_path, const char *dst_path,
|
||||
source_desc = open (src_path, O_RDONLY);
|
||||
if (source_desc < 0)
|
||||
{
|
||||
error (0, errno, "%s", src_path);
|
||||
/* If SRC_PATH doesn't exist, then chances are good that the
|
||||
user did something like this `cp --backup foo foo': and foo
|
||||
existed to start with, but copy_internal renamed DST_PATH
|
||||
with the backup suffix, thus also renaming SRC_PATH. */
|
||||
if (errno == ENOENT)
|
||||
error (0, 0, _("`%s' and `%s' are the same file"),
|
||||
src_path, dst_path);
|
||||
else
|
||||
error (0, errno, "%s", src_path);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -311,8 +355,13 @@ ret2:
|
||||
|
||||
static int
|
||||
copy_internal (const char *src_path, const char *dst_path,
|
||||
int new_dst, dev_t device, struct dir_list *ancestors,
|
||||
const struct cp_options *x, int *copy_into_self)
|
||||
int new_dst,
|
||||
dev_t device,
|
||||
struct dir_list *ancestors,
|
||||
const struct cp_options *x,
|
||||
int move_mode,
|
||||
int *copy_into_self,
|
||||
int *rename_succeeded)
|
||||
{
|
||||
struct stat src_sb;
|
||||
struct stat dst_sb;
|
||||
@@ -322,6 +371,9 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
char *dst_backup = NULL;
|
||||
int fix_mode = 0;
|
||||
|
||||
if (move_mode && rename_succeeded)
|
||||
*rename_succeeded = 0;
|
||||
|
||||
*copy_into_self = 0;
|
||||
if ((*(x->xstat)) (src_path, &src_sb))
|
||||
{
|
||||
@@ -366,7 +418,9 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
new_dst = 1;
|
||||
{
|
||||
new_dst = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -374,20 +428,43 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
|
||||
/* The destination file exists already. */
|
||||
|
||||
same = (src_sb.st_ino == dst_sb.st_ino
|
||||
&& src_sb.st_dev == dst_sb.st_dev);
|
||||
same = (SAME_INODE (src_sb, dst_sb));
|
||||
|
||||
#ifdef S_ISLNK
|
||||
/* If we're preserving symlinks (--no-dereference) and the
|
||||
destination file is a symlink, use stat (not xstat) to
|
||||
see if it points back to the source. */
|
||||
if (!same && !x->dereference && S_ISLNK (dst_sb.st_mode))
|
||||
/* If we're preserving symlinks (--no-dereference) and either
|
||||
file is a symlink, use stat (not xstat) to see if they refer
|
||||
to the same file. */
|
||||
if (!same
|
||||
|
||||
/* If we'll remove DST_PATH first, then this doesn't matter. */
|
||||
&& ! x->force
|
||||
|
||||
/* Allow them to be the same (and don't set `same') if
|
||||
we're in move mode and they're both symlinks. */
|
||||
&& !(move_mode
|
||||
&& S_ISLNK (src_sb.st_mode)
|
||||
&& S_ISLNK (dst_sb.st_mode))
|
||||
|
||||
/* If we're making a backup, we'll detect the problem case in
|
||||
copy_reg because SRC_PATH will no longer exist. Allowing
|
||||
the test to be deferred lets cp do some useful things.
|
||||
But when creating hardlinks and SRC_PATH is a symlink
|
||||
but DST_PATH is not we must test anyway. */
|
||||
&& (x->backup_type == none
|
||||
|| (x->hard_link
|
||||
&& S_ISLNK (src_sb.st_mode)
|
||||
&& !S_ISLNK (dst_sb.st_mode)))
|
||||
&& !x->dereference
|
||||
&& (S_ISLNK (dst_sb.st_mode) || S_ISLNK (src_sb.st_mode)))
|
||||
{
|
||||
struct stat dst2_sb;
|
||||
struct stat src2_sb;
|
||||
if (stat (dst_path, &dst2_sb) == 0
|
||||
&& (src_sb.st_ino == dst2_sb.st_ino &&
|
||||
src_sb.st_dev == dst2_sb.st_dev))
|
||||
same = 1;
|
||||
&& stat (src_path, &src2_sb) == 0
|
||||
&& SAME_INODE (src2_sb, dst2_sb))
|
||||
{
|
||||
same = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -396,9 +473,12 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
if (x->hard_link)
|
||||
return 0;
|
||||
|
||||
error (0, 0, _("`%s' and `%s' are the same file"),
|
||||
src_path, dst_path);
|
||||
return 1;
|
||||
if (x->backup_type == none && !x->force)
|
||||
{
|
||||
error (0, 0, _("`%s' and `%s' are the same file"),
|
||||
src_path, dst_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!S_ISDIR (src_type))
|
||||
@@ -433,6 +513,13 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* In move_mode, DEST may not be an existing directory. */
|
||||
if (move_mode && S_ISDIR (dst_sb.st_mode))
|
||||
{
|
||||
error (0, 0, _("%s: cannot overwrite directory"), dst_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (x->backup_type != none && !S_ISDIR (dst_sb.st_mode))
|
||||
{
|
||||
char *tmp_backup = find_backup_file_name (dst_path,
|
||||
@@ -446,12 +533,15 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
would leave two zero-length files: a and a~. */
|
||||
if (STREQ (tmp_backup, src_path))
|
||||
{
|
||||
error (0, 0,
|
||||
_("backing up `%s' would destroy source; `%s' not copied"),
|
||||
dst_path, src_path);
|
||||
const char *fmt;
|
||||
fmt = (move_mode
|
||||
? _("backing up `%s' would destroy source; `%s' not moved")
|
||||
: _("backing up `%s' would destroy source; `%s' not copied"));
|
||||
error (0, 0, fmt, dst_path, src_path);
|
||||
free (tmp_backup);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
dst_backup = (char *) alloca (strlen (tmp_backup) + 1);
|
||||
strcpy (dst_backup, tmp_backup);
|
||||
free (tmp_backup);
|
||||
@@ -489,9 +579,13 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
{
|
||||
error (0, errno, _("cannot remove old link to `%s'"),
|
||||
dst_path);
|
||||
return 1;
|
||||
if (x->failed_unlink_is_fatal)
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_dst = 1;
|
||||
}
|
||||
new_dst = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -516,6 +610,15 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (move_mode && rename (src_path, dst_path) == 0)
|
||||
{
|
||||
if (x->verbose && S_ISDIR (src_type))
|
||||
printf ("%s -> %s\n", src_path, dst_path);
|
||||
if (rename_succeeded)
|
||||
*rename_succeeded = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (S_ISDIR (src_type))
|
||||
{
|
||||
struct dir_list *dir;
|
||||
@@ -569,25 +672,42 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
#ifdef S_ISLNK
|
||||
else if (x->symbolic_link)
|
||||
{
|
||||
if (*src_path == '/'
|
||||
|| (!strncmp (dst_path, "./", 2) && strchr (dst_path + 2, '/') == 0)
|
||||
|| strchr (dst_path, '/') == 0)
|
||||
if (*src_path != '/')
|
||||
{
|
||||
if (symlink (src_path, dst_path))
|
||||
/* Check that DST_PATH denotes a file in the current directory. */
|
||||
struct stat dot_sb;
|
||||
struct stat dst_parent_sb;
|
||||
char *dst_parent;
|
||||
int in_current_dir;
|
||||
|
||||
dst_parent = dirname (dst_path);
|
||||
if (dst_parent == NULL)
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
|
||||
in_current_dir = (STREQ (".", dst_parent)
|
||||
/* If either stat call fails, it's ok not to report
|
||||
the failure and say dst_path is in the current
|
||||
directory. Other things will fail later. */
|
||||
|| stat (".", &dot_sb)
|
||||
|| stat (dst_parent, &dst_parent_sb)
|
||||
|| SAME_INODE (dot_sb, dst_parent_sb));
|
||||
free (dst_parent);
|
||||
|
||||
if (! in_current_dir)
|
||||
{
|
||||
error (0, errno, "%s", dst_path);
|
||||
error (0, 0,
|
||||
_("%s: can make relative symbolic links only in current directory"),
|
||||
dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
if (symlink (src_path, dst_path))
|
||||
{
|
||||
error (0, 0,
|
||||
_("%s: can make relative symbolic links only in current directory"),
|
||||
dst_path);
|
||||
error (0, errno, "%s", dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
else if (x->hard_link)
|
||||
@@ -613,7 +733,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
#ifdef S_ISFIFO
|
||||
if (S_ISFIFO (src_type))
|
||||
{
|
||||
if (mkfifo (dst_path, src_mode & x->umask_kill))
|
||||
if (mkfifo (dst_path, new_nondir_mode (x, src_mode)))
|
||||
{
|
||||
error (0, errno, _("cannot create fifo `%s'"), dst_path);
|
||||
goto un_backup;
|
||||
@@ -627,7 +747,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (mknod (dst_path, src_mode & x->umask_kill, src_sb.st_rdev))
|
||||
if (mknod (dst_path, new_nondir_mode (x, src_mode), src_sb.st_rdev))
|
||||
{
|
||||
error (0, errno, _("cannot create special file `%s'"), dst_path);
|
||||
goto un_backup;
|
||||
@@ -655,7 +775,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
goto un_backup;
|
||||
}
|
||||
|
||||
if (x->preserve)
|
||||
if (x->preserve_owner_and_group)
|
||||
{
|
||||
/* Preserve the owner and group of the just-`copied'
|
||||
symbolic link, if possible. */
|
||||
@@ -666,26 +786,10 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
goto un_backup;
|
||||
}
|
||||
# else
|
||||
# ifdef ROOT_CHOWN_AFFECTS_SYMLINKS
|
||||
if (x->myeuid == 0)
|
||||
{
|
||||
if (DO_CHOWN (chown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, _("preserving ownership for %s"), dst_path);
|
||||
goto un_backup;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: maybe give a diagnostic: you must be root
|
||||
to preserve ownership and group of symlinks. */
|
||||
}
|
||||
# else
|
||||
/* Can't preserve ownership of symlinks.
|
||||
FIXME: maybe give a warning or even error for symlinks
|
||||
in directories with the sticky bit set -- there, not
|
||||
preserving owner/group is a potential security problem. */
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
|
||||
@@ -710,7 +814,7 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
chown turns off set[ug]id bits for non-root,
|
||||
so do the chmod last. */
|
||||
|
||||
if (x->preserve)
|
||||
if (x->preserve_timestamps)
|
||||
{
|
||||
struct utimbuf utb;
|
||||
|
||||
@@ -723,7 +827,10 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
if (x->require_preserve)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (x->preserve_owner_and_group)
|
||||
{
|
||||
if (DO_CHOWN (chown, dst_path, src_sb.st_uid, src_sb.st_gid))
|
||||
{
|
||||
error (0, errno, _("preserving ownership for %s"), dst_path);
|
||||
@@ -732,8 +839,17 @@ copy_internal (const char *src_path, const char *dst_path,
|
||||
}
|
||||
}
|
||||
|
||||
if ((x->preserve || new_dst)
|
||||
&& (x->copy_as_regular || S_ISREG (src_type) || S_ISDIR (src_type)))
|
||||
if (x->set_mode)
|
||||
{
|
||||
/* This is so install's -m MODE option works. */
|
||||
if (chmod (dst_path, x->mode))
|
||||
{
|
||||
error (0, errno, _("setting permissions for %s"), dst_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if ((x->preserve_chmod_bits || new_dst)
|
||||
&& (x->copy_as_regular || S_ISREG (src_type) || S_ISDIR (src_type)))
|
||||
{
|
||||
if (chmod (dst_path, src_mode & x->umask_kill))
|
||||
{
|
||||
@@ -770,10 +886,15 @@ valid_options (const struct cp_options *co)
|
||||
|
||||
assert (VALID_BACKUP_TYPE (co->backup_type));
|
||||
|
||||
/* FIXME: make sure xstat and dereference are consistent. */
|
||||
assert (co->xstat);
|
||||
/* FIXME: for some reason this assertion always fails,
|
||||
at least on Solaris2.5.1. Just disable it for now. */
|
||||
/* assert (co->xstat == lstat || co->xstat == stat); */
|
||||
|
||||
/* Make sure xstat and dereference are consistent. */
|
||||
/* FIXME */
|
||||
|
||||
assert (VALID_SPARSE_MODE (co->sparse_mode));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -789,9 +910,14 @@ valid_options (const struct cp_options *co)
|
||||
int
|
||||
copy (const char *src_path, const char *dst_path,
|
||||
int nonexistent_dst, const struct cp_options *options,
|
||||
int *copy_into_self)
|
||||
int *copy_into_self, int *rename_succeeded)
|
||||
{
|
||||
/* move_mode is set to the value from the `options' parameter for the
|
||||
first copy_internal call. For all subsequent calls (if any), it must
|
||||
be zero. */
|
||||
int move_mode = options->move_mode;
|
||||
|
||||
assert (valid_options (options));
|
||||
return copy_internal (src_path, dst_path, nonexistent_dst, 0, NULL,
|
||||
options, copy_into_self);
|
||||
options, move_mode, copy_into_self, rename_succeeded);
|
||||
}
|
||||
|
||||
25
src/copy.h
25
src/copy.h
@@ -41,6 +41,13 @@ struct cp_options
|
||||
/* If nonzero, remove existing destination nondirectories. */
|
||||
int force;
|
||||
|
||||
/* Setting this member is meaningful only if FORCE is also set.
|
||||
If nonzero, copy returns nonzero upon failed unlink.
|
||||
Otherwise, the failure still elicits a diagnostic, but it doesn't
|
||||
change copy's return value. This is nonzero for cp and mv, and zero
|
||||
for install. */
|
||||
int failed_unlink_is_fatal;
|
||||
|
||||
/* If nonzero, create hard links instead of copying files.
|
||||
Create destination directories as usual. */
|
||||
int hard_link;
|
||||
@@ -49,6 +56,10 @@ struct cp_options
|
||||
with regular files. */
|
||||
int interactive;
|
||||
|
||||
/* If nonzero, rather than copying, first attempt to use rename.
|
||||
If that fails, then resort to copying. */
|
||||
int move_mode;
|
||||
|
||||
/* This process's effective user ID. */
|
||||
uid_t myeuid;
|
||||
|
||||
@@ -58,7 +69,9 @@ struct cp_options
|
||||
|
||||
/* If nonzero, attempt to give the copies the original files' permissions,
|
||||
owner, group, and timestamps. */
|
||||
int preserve;
|
||||
int preserve_owner_and_group;
|
||||
int preserve_chmod_bits;
|
||||
int preserve_timestamps;
|
||||
|
||||
/* If nonzero and any of the above (for preserve) file attributes cannot
|
||||
be applied to a destination file, treat it as a failure and return
|
||||
@@ -70,6 +83,14 @@ struct cp_options
|
||||
as themselves rather than copying their contents. */
|
||||
int recursive;
|
||||
|
||||
/* If nonzero, set file mode to value of MODE. Otherwise,
|
||||
set it based on current umask modified by UMASK_KILL. */
|
||||
int set_mode;
|
||||
|
||||
/* Set the mode of the destination file to exactly this value
|
||||
if USE_MODE is nonzero. */
|
||||
mode_t mode;
|
||||
|
||||
/* Control creation of sparse files. */
|
||||
enum Sparse_type sparse_mode;
|
||||
|
||||
@@ -95,6 +116,6 @@ struct cp_options
|
||||
int
|
||||
copy PARAMS ((const char *src_path, const char *dst_path,
|
||||
int nonexistent_dst, const struct cp_options *options,
|
||||
int *copy_into_self));
|
||||
int *copy_into_self, int *rename_succeeded));
|
||||
|
||||
#endif
|
||||
|
||||
@@ -48,6 +48,8 @@ struct htab
|
||||
struct htab *htab;
|
||||
char new_file;
|
||||
|
||||
static char *cph_hash_insert PARAMS ((ino_t ino, dev_t dev, const char *node));
|
||||
|
||||
/* Add PATH to the list of files that we have created.
|
||||
Return 0 if successful, 1 if not. */
|
||||
|
||||
@@ -62,7 +64,7 @@ remember_created (const char *path)
|
||||
return 1;
|
||||
}
|
||||
|
||||
hash_insert (sb.st_ino, sb.st_dev, &new_file);
|
||||
cph_hash_insert (sb.st_ino, sb.st_dev, &new_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -73,7 +75,7 @@ remember_created (const char *path)
|
||||
char *
|
||||
remember_copied (const char *node, ino_t ino, dev_t dev)
|
||||
{
|
||||
return hash_insert (ino, dev, node);
|
||||
return cph_hash_insert (ino, dev, node);
|
||||
}
|
||||
|
||||
/* Allocate space for the hash structures, and set the global
|
||||
@@ -165,8 +167,8 @@ hash_insert2 (struct htab *ht, ino_t ino, dev_t dev, const char *node)
|
||||
the same inode and device was not found already.
|
||||
Return NULL if inserted, otherwise non-NULL. */
|
||||
|
||||
char *
|
||||
hash_insert (ino_t ino, dev_t dev, const char *node)
|
||||
static char *
|
||||
cph_hash_insert (ino_t ino, dev_t dev, const char *node)
|
||||
{
|
||||
struct htab *htab_r = htab;
|
||||
|
||||
|
||||
@@ -4,6 +4,5 @@ extern char new_file;
|
||||
|
||||
void hash_init PARAMS ((unsigned int modulus, unsigned int entry_tab_size));
|
||||
void forget_all PARAMS ((void));
|
||||
char *hash_insert PARAMS ((ino_t ino, dev_t dev, const char *node));
|
||||
char *remember_copied PARAMS ((const char *node, ino_t ino, dev_t dev));
|
||||
int remember_created PARAMS ((const char *path));
|
||||
|
||||
37
src/cp.c
37
src/cp.c
@@ -24,13 +24,9 @@
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* FIXME: uncomment for release
|
||||
#define NDEBUG
|
||||
*/
|
||||
#include <assert.h>
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "backupfile.h"
|
||||
#include "argmatch.h"
|
||||
@@ -233,7 +229,7 @@ re_protect (const char *const_dst_path, int src_offset,
|
||||
chown turns off set[ug]id bits for non-root,
|
||||
so do the chmod last. */
|
||||
|
||||
if (x->preserve)
|
||||
if (x->preserve_timestamps)
|
||||
{
|
||||
struct utimbuf utb;
|
||||
|
||||
@@ -245,7 +241,10 @@ re_protect (const char *const_dst_path, int src_offset,
|
||||
error (0, errno, _("preserving times for %s"), dst_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (x->preserve_owner_and_group)
|
||||
{
|
||||
/* If non-root uses -p, it's ok if we can't preserve ownership.
|
||||
But root probably wants to know, e.g. if NFS disallows it,
|
||||
or if the target system doesn't support file ownership. */
|
||||
@@ -257,7 +256,7 @@ re_protect (const char *const_dst_path, int src_offset,
|
||||
}
|
||||
}
|
||||
|
||||
if (x->preserve || p->is_new_dir)
|
||||
if (x->preserve_chmod_bits || p->is_new_dir)
|
||||
{
|
||||
if (chmod (dst_path, src_sb.st_mode & x->umask_kill))
|
||||
{
|
||||
@@ -486,7 +485,7 @@ do_copy (int argc, char **argv, const struct cp_options *x)
|
||||
else
|
||||
{
|
||||
int unused;
|
||||
ret |= copy (arg, dst_path, new_dst, x, &unused);
|
||||
ret |= copy (arg, dst_path, new_dst, x, &unused, NULL);
|
||||
forget_all ();
|
||||
|
||||
if (flag_path)
|
||||
@@ -574,7 +573,7 @@ do_copy (int argc, char **argv, const struct cp_options *x)
|
||||
new_dest = dest;
|
||||
}
|
||||
|
||||
return copy (source, new_dest, new_dst, x, &unused);
|
||||
return copy (source, new_dest, new_dst, x, &unused, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -595,15 +594,23 @@ cp_option_init (struct cp_options *x)
|
||||
x->copy_as_regular = 1;
|
||||
x->dereference = 1;
|
||||
x->force = 0;
|
||||
x->failed_unlink_is_fatal = 1;
|
||||
x->hard_link = 0;
|
||||
x->interactive = 0;
|
||||
x->myeuid = geteuid ();
|
||||
x->move_mode = 0;
|
||||
x->one_file_system = 0;
|
||||
x->preserve = 0;
|
||||
|
||||
x->preserve_owner_and_group = 0;
|
||||
x->preserve_chmod_bits = 0;
|
||||
x->preserve_timestamps = 0;
|
||||
|
||||
x->require_preserve = 0;
|
||||
x->recursive = 0;
|
||||
x->sparse_mode = SPARSE_AUTO;
|
||||
x->symbolic_link = 0;
|
||||
x->set_mode = 0;
|
||||
x->mode = 0;
|
||||
|
||||
/* Find out the current file creation mask, to knock the right bits
|
||||
when using chmod. The creation mask is set to be liberal, so
|
||||
@@ -660,7 +667,9 @@ main (int argc, char **argv)
|
||||
|
||||
case 'a': /* Like -dpR. */
|
||||
x.dereference = 0;
|
||||
x.preserve = 1;
|
||||
x.preserve_owner_and_group = 1;
|
||||
x.preserve_chmod_bits = 1;
|
||||
x.preserve_timestamps = 1;
|
||||
x.require_preserve = 1;
|
||||
x.recursive = 1;
|
||||
x.copy_as_regular = 0;
|
||||
@@ -689,7 +698,9 @@ main (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
x.preserve = 1;
|
||||
x.preserve_owner_and_group = 1;
|
||||
x.preserve_chmod_bits = 1;
|
||||
x.preserve_timestamps = 1;
|
||||
x.require_preserve = 1;
|
||||
break;
|
||||
|
||||
@@ -758,7 +769,7 @@ main (int argc, char **argv)
|
||||
|
||||
x.backup_type = (make_backups ? get_version (version) : none);
|
||||
|
||||
if (x.preserve == 1)
|
||||
if (x.preserve_chmod_bits == 1)
|
||||
x.umask_kill = 0777777;
|
||||
|
||||
/* The key difference between -d (--no-dereference) and not is the version
|
||||
|
||||
18
src/csplit.c
18
src/csplit.c
@@ -21,10 +21,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Disable assertions. Some systems have broken assert macros. */
|
||||
#define NDEBUG 1
|
||||
|
||||
#include <assert.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
@@ -32,15 +28,12 @@
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#if WITH_REGEX
|
||||
# include <regex.h>
|
||||
#else
|
||||
# include <rx.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
|
||||
#include "error.h"
|
||||
#include "xstrtoul.h"
|
||||
#include "xalloc.h"
|
||||
#include "safe-read.h"
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
@@ -126,8 +119,6 @@ struct buffer_record
|
||||
struct buffer_record *next;
|
||||
};
|
||||
|
||||
int safe_read ();
|
||||
|
||||
static void close_output_file PARAMS ((void));
|
||||
static void create_output_file PARAMS ((void));
|
||||
static void delete_all_files PARAMS ((void));
|
||||
@@ -690,7 +681,7 @@ no_more_lines (void)
|
||||
static void
|
||||
set_input_file (const char *name)
|
||||
{
|
||||
if (!strcmp (name, "-"))
|
||||
if (STREQ (name, "-"))
|
||||
input_desc = 0;
|
||||
else
|
||||
{
|
||||
@@ -1155,9 +1146,6 @@ extract_regexp (int argnum, boolean ignore, char *str)
|
||||
p->re_compiled.buffer = (unsigned char *) xmalloc (p->re_compiled.allocated);
|
||||
p->re_compiled.fastmap = xmalloc (256);
|
||||
p->re_compiled.translate = 0;
|
||||
#if !WITH_REGEX
|
||||
p->re_compiled.syntax_parens = 0;
|
||||
#endif
|
||||
err = re_compile_pattern (p->regexpr, len, &p->re_compiled);
|
||||
if (err)
|
||||
{
|
||||
|
||||
17
src/cut.c
17
src/cut.c
@@ -1,5 +1,5 @@
|
||||
/* cut - remove parts of lines of files
|
||||
Copyright (C) 1984, 1997 by David M. Ihnat
|
||||
Copyright (C) 1984, 1997, 1998 by David M. Ihnat
|
||||
|
||||
This program is a total rewrite of the Bell Laboratories Unix(Tm)
|
||||
command of the same name, as of System V. It contains no proprietary
|
||||
@@ -61,14 +61,8 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Get isblank from GNU libc. */
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
@@ -585,7 +579,10 @@ cut_fields (FILE *stream)
|
||||
if (print_kth (field_idx))
|
||||
{
|
||||
if (found_any_selected_field)
|
||||
putchar (delim);
|
||||
{
|
||||
/* FIXME: use output delimiter here */
|
||||
putchar (delim);
|
||||
}
|
||||
found_any_selected_field = 1;
|
||||
|
||||
while ((c = getc (stream)) != delim && c != '\n' && c != EOF)
|
||||
@@ -644,7 +641,7 @@ cut_file (char *file)
|
||||
{
|
||||
FILE *stream;
|
||||
|
||||
if (!strcmp (file, "-"))
|
||||
if (STREQ (file, "-"))
|
||||
{
|
||||
have_read_stdin = 1;
|
||||
stream = stdin;
|
||||
@@ -666,7 +663,7 @@ cut_file (char *file)
|
||||
error (0, errno, "%s", file);
|
||||
return 1;
|
||||
}
|
||||
if (!strcmp (file, "-"))
|
||||
if (STREQ (file, "-"))
|
||||
clearerr (stream); /* Also clear EOF. */
|
||||
else if (fclose (stream) == EOF)
|
||||
{
|
||||
|
||||
@@ -170,7 +170,7 @@ batch_convert (const char *input_filename, const char *format)
|
||||
{
|
||||
if (line[line_length - 1] == '\n')
|
||||
line[line_length - 1] = '\0';
|
||||
error (0, 0, _("invalid date ` %s'"), line);
|
||||
error (0, 0, _("invalid date `%s'"), line);
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
|
||||
67
src/dd.c
67
src/dd.c
@@ -33,6 +33,7 @@
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "safe-read.h"
|
||||
|
||||
#ifndef SIGINFO
|
||||
# define SIGINFO SIGUSR1
|
||||
@@ -62,7 +63,6 @@
|
||||
/* Use separate input and output buffers, and combine partial input blocks. */
|
||||
#define C_TWOBUFS 04000
|
||||
|
||||
int safe_read ();
|
||||
int full_write ();
|
||||
|
||||
/* The name this program was run with. */
|
||||
@@ -304,8 +304,10 @@ Copy a file, converting and formatting according to the options.\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
BYTES may be suffixed: by xM for multiplication by M, by c for x1,\n\
|
||||
by w for x2, by b for x512, by k for x1024. Each KEYWORD may be:\n\
|
||||
BYTES may be followed by the following multiplicative suffixes:\n\
|
||||
xM M, c 1, w 2, b 512, kD 1000, k 1024, MD 1,000,000, M 1,048,576,\n\
|
||||
GD 1,000,000,000, G 1,073,741,824, and so on for T, P, E, Z, Y.\n\
|
||||
Each KEYWORD may be:\n\
|
||||
\n\
|
||||
ascii from EBCDIC to ASCII\n\
|
||||
ebcdic from ASCII to EBCDIC\n\
|
||||
@@ -352,15 +354,15 @@ print_stats (void)
|
||||
{
|
||||
char buf[2][LONGEST_HUMAN_READABLE + 1];
|
||||
fprintf (stderr, _("%s+%s records in\n"),
|
||||
human_readable (r_full, buf[0], 1, 1, 0),
|
||||
human_readable (r_partial, buf[1], 1, 1, 0));
|
||||
human_readable (r_full, buf[0], 1, 1),
|
||||
human_readable (r_partial, buf[1], 1, 1));
|
||||
fprintf (stderr, _("%s+%s records out\n"),
|
||||
human_readable (w_full, buf[0], 1, 1, 0),
|
||||
human_readable (w_partial, buf[1], 1, 1, 0));
|
||||
human_readable (w_full, buf[0], 1, 1),
|
||||
human_readable (w_partial, buf[1], 1, 1));
|
||||
if (r_truncate > 0)
|
||||
{
|
||||
fprintf (stderr, "%s %s\n",
|
||||
human_readable (r_truncate, buf[0], 1, 1, 0),
|
||||
human_readable (r_truncate, buf[0], 1, 1),
|
||||
(r_truncate == 1
|
||||
? _("truncated record")
|
||||
: _("truncated records")));
|
||||
@@ -503,6 +505,12 @@ parse_integer (char *str, int *invalid)
|
||||
for (;;)
|
||||
{
|
||||
uintmax_t multiplier;
|
||||
int power = 0;
|
||||
|
||||
#ifdef lint
|
||||
/* Suppress `used before initialized' warning. */
|
||||
multiplier = 0;
|
||||
#endif
|
||||
|
||||
switch (*p++)
|
||||
{
|
||||
@@ -513,8 +521,23 @@ parse_integer (char *str, int *invalid)
|
||||
break;
|
||||
case 'c':
|
||||
continue;
|
||||
case 'k':
|
||||
multiplier = 1024;
|
||||
case 'E': /* Exa */
|
||||
power = 6;
|
||||
break;
|
||||
case 'G': /* Giga */
|
||||
power = 3;
|
||||
break;
|
||||
case 'k': /* kilo */
|
||||
power = 1;
|
||||
break;
|
||||
case 'M': /* Mega */
|
||||
power = 2;
|
||||
break;
|
||||
case 'P': /* Peta */
|
||||
power = 5;
|
||||
break;
|
||||
case 'T': /* Tera */
|
||||
power = 4;
|
||||
break;
|
||||
case 'w':
|
||||
multiplier = 2;
|
||||
@@ -523,6 +546,12 @@ parse_integer (char *str, int *invalid)
|
||||
multiplier = parse_integer (p, invalid);
|
||||
p = "";
|
||||
break;
|
||||
case 'Y': /* Yotta */
|
||||
power = 8;
|
||||
break;
|
||||
case 'Z': /* Zetta */
|
||||
power = 7;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
*invalid = 1;
|
||||
@@ -530,6 +559,24 @@ parse_integer (char *str, int *invalid)
|
||||
}
|
||||
}
|
||||
|
||||
if (power)
|
||||
{
|
||||
int base = 1024;
|
||||
|
||||
switch (*p)
|
||||
{
|
||||
case 'B': p++; break;
|
||||
case 'D': p++; base = 1000; break;
|
||||
}
|
||||
|
||||
for (multiplier = base; --power; multiplier *= base)
|
||||
if (multiplier * base / base != multiplier)
|
||||
{
|
||||
*invalid = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (multiplier != 0 && n * multiplier / multiplier != n)
|
||||
{
|
||||
*invalid = 1;
|
||||
|
||||
192
src/df.c
192
src/df.c
@@ -47,19 +47,17 @@ char *program_name;
|
||||
/* If nonzero, show inode information. */
|
||||
static int inode_format;
|
||||
|
||||
/* If nonzero, show even filesystems with zero size or
|
||||
uninteresting types. */
|
||||
/* If positive, show all entries; if zero, omit size-zero entries and
|
||||
automounter dummies; if negative, also omit non-local filesystems. */
|
||||
static int show_all_fs;
|
||||
|
||||
/* If nonzero, output data for each filesystem corresponding to a
|
||||
command line argument -- even if it's a dummy (automounter) entry. */
|
||||
static int show_listed_fs;
|
||||
|
||||
/* base used for human style output */
|
||||
static int human_readable_base;
|
||||
|
||||
/* The units to count in. */
|
||||
static int output_units;
|
||||
/* If positive, the units to use when printing sizes;
|
||||
if negative, the human-readable base. */
|
||||
static int output_block_size;
|
||||
|
||||
/* If nonzero, use the POSIX output format. */
|
||||
static int posix_format;
|
||||
@@ -113,18 +111,20 @@ static int print_type;
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"all", no_argument, &show_all_fs, 1},
|
||||
{"inodes", no_argument, &inode_format, 1},
|
||||
{"human-readable", no_argument, 0, 'h'},
|
||||
{"si", no_argument, 0, 'H'},
|
||||
{"kilobytes", no_argument, 0, 'k'},
|
||||
{"megabytes", no_argument, 0, 'm'},
|
||||
{"portability", no_argument, &posix_format, 1},
|
||||
{"print-type", no_argument, &print_type, 1},
|
||||
{"sync", no_argument, 0, 129},
|
||||
{"no-sync", no_argument, 0, 130},
|
||||
{"type", required_argument, 0, 't'},
|
||||
{"exclude-type", required_argument, 0, 'x'},
|
||||
{"all", no_argument, NULL, 'a'},
|
||||
{"block-size", required_argument, NULL, 131},
|
||||
{"inodes", no_argument, NULL, 'i'},
|
||||
{"human-readable", no_argument, NULL, 'h'},
|
||||
{"si", no_argument, NULL, 'H'},
|
||||
{"kilobytes", no_argument, NULL, 'k'},
|
||||
{"local", no_argument, NULL, 'l'},
|
||||
{"megabytes", no_argument, NULL, 'm'},
|
||||
{"portability", no_argument, NULL, 'P'},
|
||||
{"print-type", no_argument, NULL, 'T'},
|
||||
{"sync", no_argument, NULL, 129},
|
||||
{"no-sync", no_argument, NULL, 130},
|
||||
{"type", required_argument, NULL, 't'},
|
||||
{"exclude-type", required_argument, NULL, 'x'},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
{NULL, 0, NULL, 0}
|
||||
@@ -141,15 +141,22 @@ print_header (void)
|
||||
printf (" ");
|
||||
|
||||
if (inode_format)
|
||||
printf (" Inodes IUsed IFree %%IUsed ");
|
||||
printf (" Inodes IUsed IFree IUse%%");
|
||||
else if (output_block_size < 0)
|
||||
printf (" Size Used Avail Use%%");
|
||||
else
|
||||
if (output_units == 1024 * 1024)
|
||||
printf (" MB-blocks Used Available Capacity");
|
||||
else if (human_readable_base)
|
||||
printf (" Size Used Avail Capacity");
|
||||
else
|
||||
printf (" %s Used Available Capacity",
|
||||
output_units == 1024 ? "1024-blocks" : " 512-blocks");
|
||||
{
|
||||
char buf[LONGEST_HUMAN_READABLE + 1];
|
||||
char *p = human_readable (output_block_size, buf, 1, -1024);
|
||||
|
||||
/* Replace e.g. "1.0k" by "1k". */
|
||||
size_t plen = strlen (p);
|
||||
if (3 <= plen && strncmp (p + plen - 3, ".0", 2) == 0)
|
||||
strcpy (p + plen - 3, p + plen - 1);
|
||||
|
||||
printf (" %4s-blocks Used Available Use%%", p);
|
||||
}
|
||||
|
||||
printf (" Mounted on\n");
|
||||
}
|
||||
|
||||
@@ -187,9 +194,11 @@ excluded_fstype (const char *fstype)
|
||||
|
||||
/* Like human_readable, except return "-" if the argument is -1. */
|
||||
static char *
|
||||
df_readable (uintmax_t n, char *buf, int from_units, int to_units, int base)
|
||||
df_readable (uintmax_t n, char *buf,
|
||||
int from_block_size, int t_output_block_size)
|
||||
{
|
||||
return n == -1 ? "-" : human_readable (n, buf, from_units, to_units, base);
|
||||
return (n == -1 ? "-"
|
||||
: human_readable (n, buf, from_block_size, t_output_block_size));
|
||||
}
|
||||
|
||||
/* Display a space listing for the disk device with absolute path DISK.
|
||||
@@ -205,15 +214,18 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
|
||||
struct fs_usage fsu;
|
||||
const char *stat_file;
|
||||
|
||||
if (!selected_fstype (fstype) || excluded_fstype (fstype))
|
||||
return;
|
||||
|
||||
/* If MOUNT_POINT is NULL, then the filesystem is not mounted, and this
|
||||
program reports on the filesystem that the special file is on.
|
||||
It would be better to report on the unmounted filesystem,
|
||||
but statfs doesn't do that on most systems. */
|
||||
stat_file = mount_point ? mount_point : disk;
|
||||
|
||||
if (show_all_fs < 0 && fstype && REMOTE_FS_TYPE (fstype))
|
||||
return;
|
||||
|
||||
if (!selected_fstype (fstype) || excluded_fstype (fstype))
|
||||
return;
|
||||
|
||||
if (get_fs_usage (stat_file, disk, &fsu))
|
||||
{
|
||||
error (0, errno, "%s", stat_file);
|
||||
@@ -221,7 +233,7 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
|
||||
return;
|
||||
}
|
||||
|
||||
if (fsu.fsu_blocks == 0 && !show_all_fs && !show_listed_fs)
|
||||
if (fsu.fsu_blocks == 0 && show_all_fs <= 0 && !show_listed_fs)
|
||||
return;
|
||||
|
||||
if (! disk)
|
||||
@@ -241,6 +253,7 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
|
||||
char buf[3][LONGEST_HUMAN_READABLE + 1];
|
||||
double inodes_percent_used;
|
||||
uintmax_t inodes_used;
|
||||
int inode_units = output_block_size < 0 ? output_block_size : 1;
|
||||
|
||||
if (fsu.fsu_files == -1 || fsu.fsu_files < fsu.fsu_ffree)
|
||||
{
|
||||
@@ -256,19 +269,21 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
|
||||
}
|
||||
|
||||
printf (" %7s %7s %7s ",
|
||||
df_readable (fsu.fsu_files, buf[0], 1, 1, human_readable_base),
|
||||
df_readable (inodes_used, buf[1], 1, 1, human_readable_base),
|
||||
df_readable (fsu.fsu_ffree, buf[2], 1, 1, human_readable_base));
|
||||
df_readable (fsu.fsu_files, buf[0], 1, inode_units),
|
||||
df_readable (inodes_used, buf[1], 1, inode_units),
|
||||
df_readable (fsu.fsu_ffree, buf[2], 1, inode_units));
|
||||
|
||||
if (inodes_percent_used < 0)
|
||||
printf (" - ");
|
||||
printf (" - ");
|
||||
else
|
||||
printf (" %5.0f%%", inodes_percent_used);
|
||||
printf ("%4.0f%%", inodes_percent_used);
|
||||
}
|
||||
else
|
||||
{
|
||||
int w = human_readable_base ? 5 : 7;
|
||||
char buf[3][LONGEST_HUMAN_READABLE + 1];
|
||||
int w = output_block_size < 0 ? 5 : 9;
|
||||
char buf[2][LONGEST_HUMAN_READABLE + 1];
|
||||
char availbuf[LONGEST_HUMAN_READABLE + 2];
|
||||
char *avail;
|
||||
double blocks_percent_used;
|
||||
uintmax_t blocks_used;
|
||||
|
||||
@@ -281,22 +296,35 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
|
||||
{
|
||||
blocks_used = fsu.fsu_blocks - fsu.fsu_bfree;
|
||||
blocks_percent_used =
|
||||
(fsu.fsu_bfree < fsu.fsu_bavail ? -1
|
||||
: (blocks_used + fsu.fsu_bavail) == 0 ? 0
|
||||
((fsu.fsu_bavail == -1
|
||||
|| blocks_used + fsu.fsu_bavail == 0
|
||||
|| (fsu.fsu_bavail_top_bit_set
|
||||
? blocks_used < - fsu.fsu_bavail
|
||||
: fsu.fsu_bfree < fsu.fsu_bavail))
|
||||
? -1
|
||||
: blocks_used * 100.0 / (blocks_used + fsu.fsu_bavail));
|
||||
}
|
||||
|
||||
printf (" %*s %*s %*s ",
|
||||
avail = df_readable ((fsu.fsu_bavail_top_bit_set
|
||||
? - fsu.fsu_bavail
|
||||
: fsu.fsu_bavail),
|
||||
availbuf + 1, fsu.fsu_blocksize,
|
||||
output_block_size);
|
||||
|
||||
if (fsu.fsu_bavail_top_bit_set)
|
||||
*--avail = '-';
|
||||
|
||||
printf (" %*s %*s %*s ",
|
||||
w, df_readable (fsu.fsu_blocks, buf[0], fsu.fsu_blocksize,
|
||||
output_units, human_readable_base),
|
||||
output_block_size),
|
||||
w, df_readable (blocks_used, buf[1], fsu.fsu_blocksize,
|
||||
output_units, human_readable_base),
|
||||
w, df_readable (fsu.fsu_bavail, buf[2], fsu.fsu_blocksize,
|
||||
output_units, human_readable_base));
|
||||
output_block_size),
|
||||
w, avail);
|
||||
|
||||
if (blocks_percent_used < 0)
|
||||
printf (" - ");
|
||||
printf (" - ");
|
||||
else
|
||||
printf (" %5.0f%% ", blocks_percent_used);
|
||||
printf ("%3.0f%%", blocks_percent_used);
|
||||
}
|
||||
|
||||
if (mount_point)
|
||||
@@ -310,7 +338,7 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
|
||||
else if (strncmp ("/tmp_mnt/", mount_point, 9) == 0)
|
||||
mount_point += 8;
|
||||
#endif
|
||||
printf (" %s", mount_point);
|
||||
printf (" %s", mount_point);
|
||||
}
|
||||
putchar ('\n');
|
||||
}
|
||||
@@ -519,11 +547,13 @@ Show information about the filesystem on which each FILE resides,\n\
|
||||
or all filesystems by default.\n\
|
||||
\n\
|
||||
-a, --all include filesystems having 0 blocks\n\
|
||||
--block-size=SIZE use SIZE-byte blocks\n\
|
||||
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\n\
|
||||
-H, --si likewise, but use powers of 1000 not 1024\n\
|
||||
-i, --inodes list inode information instead of block usage\n\
|
||||
-k, --kilobytes use 1024-byte blocks\n\
|
||||
-m, --megabytes use 1048576-byte blocks\n\
|
||||
-k, --kilobytes like --block-size=1024\n\
|
||||
-l, --local limit listing to local filesystems\n\
|
||||
-m, --megabytes like --block-size=1048576\n\
|
||||
--no-sync do not invoke sync before getting usage info (default)\n\
|
||||
-P, --portability use the POSIX output format\n\
|
||||
--sync invoke sync before getting usage info\n\
|
||||
@@ -557,31 +587,13 @@ main (int argc, char **argv)
|
||||
show_all_fs = 0;
|
||||
show_listed_fs = 0;
|
||||
|
||||
if (getenv ("POSIXLY_CORRECT"))
|
||||
output_units = 512;
|
||||
else
|
||||
{
|
||||
char *bs;
|
||||
if ((bs = getenv ("BLOCKSIZE"))
|
||||
&& strncmp (bs, "HUMAN", sizeof ("HUMAN") - 1) == 0)
|
||||
{
|
||||
human_readable_base = 1024;
|
||||
output_units = 1;
|
||||
}
|
||||
else if (bs && strcmp (bs, "SI") == 0)
|
||||
{
|
||||
human_readable_base = 1000;
|
||||
output_units = 1;
|
||||
}
|
||||
else
|
||||
output_units = 1024;
|
||||
}
|
||||
human_block_size (getenv ("DF_BLOCK_SIZE"), 0, &output_block_size);
|
||||
|
||||
print_type = 0;
|
||||
posix_format = 0;
|
||||
exit_status = 0;
|
||||
|
||||
while ((c = getopt_long (argc, argv, "aiF:hHkmPTt:vx:", long_options, NULL))
|
||||
while ((c = getopt_long (argc, argv, "aiF:hHklmPTt:vx:", long_options, NULL))
|
||||
!= -1)
|
||||
{
|
||||
switch (c)
|
||||
@@ -595,20 +607,19 @@ main (int argc, char **argv)
|
||||
inode_format = 1;
|
||||
break;
|
||||
case 'h':
|
||||
human_readable_base = 1024;
|
||||
output_units = 1;
|
||||
output_block_size = -1024;
|
||||
break;
|
||||
case 'H':
|
||||
human_readable_base = 1000;
|
||||
output_units = 1;
|
||||
output_block_size = -1000;
|
||||
break;
|
||||
case 'k':
|
||||
human_readable_base = 0;
|
||||
output_units = 1024;
|
||||
output_block_size = 1024;
|
||||
break;
|
||||
case 'l':
|
||||
show_all_fs = -1;
|
||||
break;
|
||||
case 'm':
|
||||
human_readable_base = 0;
|
||||
output_units = 1024 * 1024;
|
||||
output_block_size = 1024 * 1024;
|
||||
break;
|
||||
case 'T':
|
||||
print_type = 1;
|
||||
@@ -623,6 +634,10 @@ main (int argc, char **argv)
|
||||
require_sync = 0;
|
||||
break;
|
||||
|
||||
case 131:
|
||||
human_block_size (optarg, 1, &output_block_size);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
/* Accept -F as a synonym for -t for compatibility with Solaris. */
|
||||
case 't':
|
||||
@@ -650,15 +665,6 @@ main (int argc, char **argv)
|
||||
if (show_help)
|
||||
usage (0);
|
||||
|
||||
if (posix_format && output_units == 1024 * 1024)
|
||||
error (1, 0, _("the option for counting 1MB blocks may not be used\n\
|
||||
with the portable output format"));
|
||||
|
||||
if (posix_format && human_readable_base)
|
||||
error (1, 0,
|
||||
_("the option for printing with adaptive units may not be used\n\
|
||||
with the portable output format"));
|
||||
|
||||
/* Fail if the same file system type was both selected and excluded. */
|
||||
{
|
||||
int match = 0;
|
||||
@@ -710,15 +716,16 @@ with the portable output format"));
|
||||
read_filesystem_list ((fs_select_list != NULL
|
||||
|| fs_exclude_list != NULL
|
||||
|| print_type),
|
||||
show_all_fs);
|
||||
optind == argc ? show_all_fs : 1);
|
||||
|
||||
if (mount_list == NULL)
|
||||
error (1, errno, _("cannot read table of mounted filesystems"));
|
||||
|
||||
if (require_sync)
|
||||
sync ();
|
||||
|
||||
if (optind == argc)
|
||||
{
|
||||
if (mount_list == NULL)
|
||||
error (1, errno, _("cannot read table of mounted filesystems"));
|
||||
print_header ();
|
||||
show_all_entries ();
|
||||
}
|
||||
@@ -738,4 +745,3 @@ with the portable output format"));
|
||||
close_stdout ();
|
||||
exit (exit_status);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* dircolors - output commands to set the LS_COLOR environment variable
|
||||
Copyright (C) 1994, 1995, 1997 H. Peter Anvin
|
||||
Copyright (C) 1994, 1995, 1997, 1998 H. Peter Anvin
|
||||
Copyright (C) 96, 97, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -151,16 +151,16 @@ guess_shell_syntax (void)
|
||||
}
|
||||
|
||||
static void
|
||||
parse_line (const char *line, char **keyword, char **arg)
|
||||
parse_line (unsigned char const *line, char **keyword, char **arg)
|
||||
{
|
||||
const char *p;
|
||||
const char *keyword_start;
|
||||
const char *arg_start;
|
||||
unsigned char const *p;
|
||||
unsigned char const *keyword_start;
|
||||
unsigned char const *arg_start;
|
||||
|
||||
*keyword = NULL;
|
||||
*arg = NULL;
|
||||
|
||||
for (p = line; isspace (*p); ++p)
|
||||
for (p = line; ISSPACE (*p); ++p)
|
||||
;
|
||||
|
||||
/* Ignore blank lines and shell-style comments. */
|
||||
@@ -169,12 +169,12 @@ parse_line (const char *line, char **keyword, char **arg)
|
||||
|
||||
keyword_start = p;
|
||||
|
||||
while (!isspace (*p) && *p != '\0')
|
||||
while (!ISSPACE (*p) && *p != '\0')
|
||||
{
|
||||
++p;
|
||||
}
|
||||
|
||||
*keyword = xstrndup (keyword_start, p - keyword_start);
|
||||
*keyword = xstrndup ((const char *) keyword_start, p - keyword_start);
|
||||
if (*p == '\0')
|
||||
return;
|
||||
|
||||
@@ -182,7 +182,7 @@ parse_line (const char *line, char **keyword, char **arg)
|
||||
{
|
||||
++p;
|
||||
}
|
||||
while (isspace (*p));
|
||||
while (ISSPACE (*p));
|
||||
|
||||
if (*p == '\0' || *p == '#')
|
||||
return;
|
||||
@@ -192,13 +192,13 @@ parse_line (const char *line, char **keyword, char **arg)
|
||||
while (*p != '\0' && *p != '#')
|
||||
++p;
|
||||
|
||||
for (--p; isspace (*p); --p)
|
||||
for (--p; ISSPACE (*p); --p)
|
||||
{
|
||||
/* empty */
|
||||
}
|
||||
++p;
|
||||
|
||||
*arg = xstrndup (arg_start, p - arg_start);
|
||||
*arg = xstrndup ((const char *) arg_start, p - arg_start);
|
||||
}
|
||||
|
||||
/* FIXME: Write a string to standard out, while watching for "dangerous"
|
||||
@@ -287,7 +287,7 @@ dc_parse_stream (FILE *fp, const char *filename)
|
||||
break;
|
||||
}
|
||||
|
||||
parse_line (line, &keywd, &arg);
|
||||
parse_line ((unsigned char *) line, &keywd, &arg);
|
||||
|
||||
if (keywd == NULL)
|
||||
continue;
|
||||
@@ -295,7 +295,7 @@ dc_parse_stream (FILE *fp, const char *filename)
|
||||
unrecognized = 0;
|
||||
if (strcasecmp (keywd, "TERM") == 0)
|
||||
{
|
||||
if (strcmp (arg, term) == 0)
|
||||
if (STREQ (arg, term))
|
||||
state = ST_TERMSURE;
|
||||
else if (state != ST_TERMSURE)
|
||||
state = ST_TERMNO;
|
||||
@@ -376,7 +376,7 @@ dc_parse_file (const char *filename)
|
||||
FILE *fp;
|
||||
int err;
|
||||
|
||||
if (strcmp (filename, "-") == 0)
|
||||
if (STREQ (filename, "-"))
|
||||
{
|
||||
have_read_stdin = 1;
|
||||
fp = stdin;
|
||||
|
||||
65
src/du.c
65
src/du.c
@@ -26,9 +26,9 @@
|
||||
arguments have been processed. This can be used to find
|
||||
out the disk usage of a directory, with some files excluded.
|
||||
-h Print sizes in human readable format (1k 234M 2G, etc).
|
||||
-k Print sizes in kilobytes instead of 512 byte blocks
|
||||
(the default required by POSIX).
|
||||
-m Print sizes in megabytes instead of 512 byte blocks
|
||||
-H Similar, but use powers of 1000 not 1024.
|
||||
-k Print sizes in kilobytes.
|
||||
-m Print sizes in megabytes.
|
||||
-b Print sizes in bytes.
|
||||
-S Count the size of each directory separately, not including
|
||||
the sizes of subdirectories.
|
||||
@@ -143,11 +143,9 @@ static int opt_dereference_arguments = 0;
|
||||
is at level 0, so `du --max-depth=0' is equivalent to `du -s'. */
|
||||
static int max_depth = INT_MAX;
|
||||
|
||||
/* base used for human style output */
|
||||
static int human_readable_base;
|
||||
|
||||
/* The units to count in. */
|
||||
static int output_units;
|
||||
/* If positive, the units to use when printing sizes;
|
||||
if negative, the human-readable base. */
|
||||
static int output_block_size;
|
||||
|
||||
/* Accumulated path for file or directory being processed. */
|
||||
static String *path;
|
||||
@@ -180,6 +178,7 @@ static uintmax_t tot_size = 0;
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"all", no_argument, &opt_all, 1},
|
||||
{"block-size", required_argument, 0, 129},
|
||||
{"bytes", no_argument, NULL, 'b'},
|
||||
{"count-links", no_argument, &opt_count_all, 1},
|
||||
{"dereference", no_argument, NULL, 'L'},
|
||||
@@ -217,15 +216,16 @@ usage (int status, char *reason)
|
||||
Summarize disk usage of each FILE, recursively for directories.\n\
|
||||
\n\
|
||||
-a, --all write counts for all files, not just directories\n\
|
||||
--block-size=SIZE use SIZE-byte blocks\n\
|
||||
-b, --bytes print size in bytes\n\
|
||||
-c, --total produce a grand total\n\
|
||||
-D, --dereference-args dereference PATHs when symbolic link\n\
|
||||
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\n\
|
||||
-H, --si likewise, but use powers of 1000 not 1024\n\
|
||||
-k, --kilobytes use 1024-byte blocks\n\
|
||||
-k, --kilobytes like --block-size=1024\n\
|
||||
-l, --count-links count sizes many times if hard linked\n\
|
||||
-L, --dereference dereference all symbolic links\n\
|
||||
-m, --megabytes use 1048576-byte blocks\n\
|
||||
-m, --megabytes like --block-size=1048576\n\
|
||||
-S, --separate-dirs do not include size of subdirectories\n\
|
||||
-s, --summarize display only a total for each argument\n\
|
||||
-x, --one-file-system skip directories on different filesystems\n\
|
||||
@@ -249,7 +249,6 @@ main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
char *cwd_only[2];
|
||||
char *bs;
|
||||
int max_depth_specified = 0;
|
||||
|
||||
/* If nonzero, display only a total for each argument. */
|
||||
@@ -266,21 +265,7 @@ main (int argc, char **argv)
|
||||
exclude = new_exclude ();
|
||||
xstat = lstat;
|
||||
|
||||
if (getenv ("POSIXLY_CORRECT"))
|
||||
output_units = 512;
|
||||
else if ((bs = getenv ("BLOCKSIZE"))
|
||||
&& strncmp (bs, "HUMAN", sizeof ("HUMAN") - 1) == 0)
|
||||
{
|
||||
human_readable_base = 1024;
|
||||
output_units = 1;
|
||||
}
|
||||
else if (bs && strcmp (bs, "SI") == 0)
|
||||
{
|
||||
human_readable_base = 1000;
|
||||
output_units = 1;
|
||||
}
|
||||
else
|
||||
output_units = 1024;
|
||||
human_block_size (getenv ("DU_BLOCK_SIZE"), 0, &output_block_size);
|
||||
|
||||
while ((c = getopt_long (argc, argv, "abchHklmsxDLSX:", long_options, NULL))
|
||||
!= -1)
|
||||
@@ -296,8 +281,7 @@ main (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
human_readable_base = 0;
|
||||
output_units = 1;
|
||||
output_block_size = 1;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
@@ -305,18 +289,15 @@ main (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
human_readable_base = 1024;
|
||||
output_units = 1;
|
||||
output_block_size = -1024;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
human_readable_base = 1000;
|
||||
output_units = 1;
|
||||
output_block_size = -1000;
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
human_readable_base = 0;
|
||||
output_units = 1024;
|
||||
output_block_size = 1024;
|
||||
break;
|
||||
|
||||
case 13: /* --max-depth=N */
|
||||
@@ -329,8 +310,7 @@ main (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
human_readable_base = 0;
|
||||
output_units = 1024 * 1024;
|
||||
output_block_size = 1024 * 1024;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
@@ -366,6 +346,10 @@ main (int argc, char **argv)
|
||||
add_exclude (exclude, optarg);
|
||||
break;
|
||||
|
||||
case 129:
|
||||
human_block_size (optarg, 1, &output_block_size);
|
||||
break;
|
||||
|
||||
default:
|
||||
usage (1, (char *) 0);
|
||||
}
|
||||
@@ -413,8 +397,8 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Print N_BLOCKS followed by STRING on a line. NBLOCKS is the number of
|
||||
ST_NBLOCKSIZE-byte blocks; convert it to OUTPUT_UNITS units before
|
||||
printing. If HUMAN_READABLE_BASE is nonzero, use a human readable
|
||||
ST_NBLOCKSIZE-byte blocks; convert it to OUTPUT_BLOCK_SIZE units before
|
||||
printing. If OUTPUT_BLOCK_SIZE is negative, use a human readable
|
||||
notation instead. */
|
||||
|
||||
static void
|
||||
@@ -422,8 +406,7 @@ print_size (uintmax_t n_blocks, const char *string)
|
||||
{
|
||||
char buf[LONGEST_HUMAN_READABLE + 1];
|
||||
printf ("%s\t%s\n",
|
||||
human_readable (n_blocks, buf, ST_NBLOCKSIZE, output_units,
|
||||
human_readable_base),
|
||||
human_readable (n_blocks, buf, ST_NBLOCKSIZE, output_block_size),
|
||||
string);
|
||||
fflush (stdout);
|
||||
}
|
||||
@@ -490,7 +473,7 @@ du_files (char **files)
|
||||
free_cwd (&cwd);
|
||||
}
|
||||
|
||||
/* Print (if appropriate) the size (in units determined by `output_units')
|
||||
/* Print (if appropriate) the size (in units determined by `output_block_size')
|
||||
of file or directory ENT. Return the size of ENT in units of 512-byte
|
||||
blocks. TOP is one for external calls, zero for recursive calls.
|
||||
LAST_DEV is the device that the parent directory of ENT is on.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* expand - convert tabs to spaces
|
||||
Copyright (C) 89, 91, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 91, 95, 96, 1997, 1998 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
|
||||
@@ -35,9 +35,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Get isblank from GNU libc. */
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -400,7 +400,7 @@ main (register int argc, register char **argv)
|
||||
for (; optind < argc; optind++)
|
||||
{
|
||||
char *file = argv[optind];
|
||||
if (strcmp (file, "-") == 0)
|
||||
if (STREQ (file, "-"))
|
||||
fmt (stdin);
|
||||
else
|
||||
{
|
||||
@@ -706,7 +706,7 @@ get_space (FILE *f, register int c)
|
||||
static void
|
||||
check_punctuation (register WORD *w)
|
||||
{
|
||||
register const char *start, *finish;
|
||||
const unsigned char *start, *finish;
|
||||
|
||||
start = w->text;
|
||||
finish = start + (w->length - 1);
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Get isblank from GNU libc. */
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
@@ -123,7 +120,7 @@ fold_file (char *filename, int width)
|
||||
static char *line_out = NULL;
|
||||
static int allocated_out = 0;
|
||||
|
||||
if (!strcmp (filename, "-"))
|
||||
if (STREQ (filename, "-"))
|
||||
{
|
||||
istream = stdin;
|
||||
have_read_stdin = 1;
|
||||
@@ -212,11 +209,11 @@ fold_file (char *filename, int width)
|
||||
if (ferror (istream))
|
||||
{
|
||||
error (0, errno, "%s", filename);
|
||||
if (strcmp (filename, "-"))
|
||||
if (!STREQ (filename, "-"))
|
||||
fclose (istream);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp (filename, "-") && fclose (istream) == EOF)
|
||||
if (!STREQ (filename, "-") && fclose (istream) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", filename);
|
||||
return 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* head -- output first part of file(s)
|
||||
Copyright (C) 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 89, 90, 91, 95, 96, 1997, 1998 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
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "xstrtoul.h"
|
||||
#include "safe-read.h"
|
||||
|
||||
/* FIXME: someday, make this really *be* `long long'. */
|
||||
typedef long int U_LONG_LONG;
|
||||
@@ -51,8 +52,6 @@ enum header_mode
|
||||
multiple_files, always, never
|
||||
};
|
||||
|
||||
int safe_read ();
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
|
||||
@@ -185,7 +184,7 @@ head_file (const char *filename, U_LONG_LONG n_units, int count_lines)
|
||||
{
|
||||
int fd;
|
||||
|
||||
if (!strcmp (filename, "-"))
|
||||
if (STREQ (filename, "-"))
|
||||
{
|
||||
have_read_stdin = 1;
|
||||
filename = _("standard input");
|
||||
|
||||
282
src/install.c
282
src/install.c
@@ -78,6 +78,9 @@
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "xstrtol.h"
|
||||
#include "path-concat.h"
|
||||
#include "cp-hash.h"
|
||||
#include "copy.h"
|
||||
|
||||
#if HAVE_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
@@ -103,6 +106,12 @@ gid_t getgid ();
|
||||
# define endpwent() ((void) 0)
|
||||
#endif
|
||||
|
||||
/* Initial number of entries in each hash table entry's table of inodes. */
|
||||
#define INITIAL_HASH_MODULE 100
|
||||
|
||||
/* Initial number of entries in the inode hash table. */
|
||||
#define INITIAL_ENTRY_TAB_SIZE 70
|
||||
|
||||
/* True if C is an ASCII octal digit. */
|
||||
#define isodigit(c) ((c) >= '0' && c <= '7')
|
||||
|
||||
@@ -119,18 +128,22 @@ gid_t getgid ();
|
||||
|
||||
char *base_name ();
|
||||
char *dirname ();
|
||||
int safe_read ();
|
||||
int full_write ();
|
||||
int isdir ();
|
||||
enum backup_type get_version ();
|
||||
|
||||
int stat ();
|
||||
|
||||
static int change_timestamps PARAMS ((const char *from, const char *to));
|
||||
static int change_attributes PARAMS ((const char *path, int no_need_to_chown));
|
||||
static int change_attributes PARAMS ((const char *path, mode_t mode));
|
||||
static int copy_file PARAMS ((const char *from, const char *to,
|
||||
int *to_created));
|
||||
static int install_file_to_path PARAMS ((const char *from, const char *to));
|
||||
static int install_file_in_dir PARAMS ((const char *from, const char *to_dir));
|
||||
static int install_file_in_file PARAMS ((const char *from, const char *to));
|
||||
const struct cp_options *x));
|
||||
static int install_file_to_path PARAMS ((const char *from, const char *to,
|
||||
const struct cp_options *x));
|
||||
static int install_file_in_dir PARAMS ((const char *from, const char *to_dir,
|
||||
const struct cp_options *x));
|
||||
static int install_file_in_file PARAMS ((const char *from, const char *to,
|
||||
const struct cp_options *x));
|
||||
static void get_ids PARAMS ((void));
|
||||
static void strip PARAMS ((const char *path));
|
||||
static void usage PARAMS ((int status));
|
||||
@@ -155,22 +168,12 @@ static char *group_name;
|
||||
/* The group ID corresponding to `group_name'. */
|
||||
static gid_t group_id;
|
||||
|
||||
/* The permissions to which the files will be set. The umask has
|
||||
no effect. */
|
||||
static int mode;
|
||||
|
||||
/* If nonzero, strip executable files after copying them. */
|
||||
static int strip_files;
|
||||
|
||||
/* If nonzero, preserve timestamps when installing files. */
|
||||
static int preserve_timestamps;
|
||||
|
||||
/* If nonzero, install a directory instead of a regular file. */
|
||||
static int dir_arg;
|
||||
|
||||
/* If nonzero, show what we are doing. */
|
||||
static int verbose;
|
||||
|
||||
/* If nonzero, display usage information and exit. */
|
||||
static int show_help;
|
||||
|
||||
@@ -193,6 +196,36 @@ static struct option const long_options[] =
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
static void
|
||||
cp_option_init (struct cp_options *x)
|
||||
{
|
||||
x->copy_as_regular = 1;
|
||||
x->dereference = 1;
|
||||
x->force = 1;
|
||||
|
||||
/* If unlink fails, try to proceed anyway. */
|
||||
x->failed_unlink_is_fatal = 0;
|
||||
|
||||
x->hard_link = 0;
|
||||
x->interactive = 0;
|
||||
x->move_mode = 0;
|
||||
x->myeuid = geteuid ();
|
||||
x->one_file_system = 0;
|
||||
x->preserve_owner_and_group = 0;
|
||||
x->preserve_chmod_bits = 0;
|
||||
x->preserve_timestamps = 0;
|
||||
x->require_preserve = 0;
|
||||
x->recursive = 0;
|
||||
x->sparse_mode = SPARSE_AUTO;
|
||||
x->symbolic_link = 0;
|
||||
x->set_mode = 1;
|
||||
x->mode = 0755;
|
||||
x->umask_kill = 0;
|
||||
x->update = 0;
|
||||
x->verbose = 0;
|
||||
x->xstat = stat;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@@ -202,19 +235,21 @@ main (int argc, char **argv)
|
||||
int make_backups = 0;
|
||||
char *version;
|
||||
int mkdir_and_install = 0;
|
||||
struct cp_options x;
|
||||
int n_files;
|
||||
char **file;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
cp_option_init (&x);
|
||||
|
||||
owner_name = NULL;
|
||||
group_name = NULL;
|
||||
mode = 0755;
|
||||
strip_files = 0;
|
||||
preserve_timestamps = 0;
|
||||
dir_arg = 0;
|
||||
verbose = 0;
|
||||
umask (0);
|
||||
|
||||
version = getenv ("SIMPLE_BACKUP_SUFFIX");
|
||||
@@ -244,7 +279,7 @@ main (int argc, char **argv)
|
||||
mkdir_and_install = 1;
|
||||
break;
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
x.verbose = 0;
|
||||
break;
|
||||
case 'g':
|
||||
group_name = optarg;
|
||||
@@ -256,7 +291,7 @@ main (int argc, char **argv)
|
||||
owner_name = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
preserve_timestamps = 1;
|
||||
x.preserve_timestamps = 1;
|
||||
break;
|
||||
case 'S':
|
||||
simple_backup_suffix = optarg;
|
||||
@@ -284,9 +319,12 @@ main (int argc, char **argv)
|
||||
error (1, 0,
|
||||
_("the strip option may not be used when installing a directory"));
|
||||
|
||||
backup_type = (make_backups ? get_version (version) : none);
|
||||
x.backup_type = (make_backups ? get_version (version) : none);
|
||||
|
||||
if (optind == argc || (optind == argc - 1 && !dir_arg))
|
||||
n_files = argc - optind;
|
||||
file = argv + optind;
|
||||
|
||||
if (n_files == 0 || (n_files == 1 && !dir_arg))
|
||||
{
|
||||
error (0, 0, _("too few arguments"));
|
||||
usage (1);
|
||||
@@ -299,43 +337,56 @@ main (int argc, char **argv)
|
||||
error (1, 0, _("invalid mode `%s'"), symbolic_mode);
|
||||
else if (change == MODE_MEMORY_EXHAUSTED)
|
||||
error (1, 0, _("virtual memory exhausted"));
|
||||
mode = mode_adjust (0, change);
|
||||
x.mode = mode_adjust (0, change);
|
||||
}
|
||||
|
||||
get_ids ();
|
||||
|
||||
if (dir_arg)
|
||||
{
|
||||
for (; optind < argc; ++optind)
|
||||
int i;
|
||||
for (i = 0; i < n_files; i++)
|
||||
{
|
||||
errors |=
|
||||
make_path (argv[optind], mode, mode, owner_id, group_id, 0,
|
||||
(verbose ? "creating directory `%s'" : NULL));
|
||||
make_path (file[i], x.mode, x.mode, owner_id, group_id, 0,
|
||||
(x.verbose ? "creating directory `%s'" : NULL));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (optind == argc - 2)
|
||||
/* FIXME: it's a little gross that this initialization is
|
||||
required by copy.c::copy. */
|
||||
hash_init (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE);
|
||||
|
||||
if (n_files == 2)
|
||||
{
|
||||
if (mkdir_and_install)
|
||||
errors = install_file_to_path (argv[argc - 2], argv[argc - 1]);
|
||||
else if (!isdir (argv[argc - 1]))
|
||||
errors = install_file_in_file (argv[argc - 2], argv[argc - 1]);
|
||||
errors = install_file_to_path (file[0], file[1], &x);
|
||||
else if (!isdir (file[1]))
|
||||
errors = install_file_in_file (file[0], file[1], &x);
|
||||
else
|
||||
errors = install_file_in_dir (argv[argc - 2], argv[argc - 1]);
|
||||
errors = install_file_in_dir (file[0], file[1], &x);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isdir (argv[argc - 1]))
|
||||
usage (1);
|
||||
for (; optind < argc - 1; ++optind)
|
||||
int i;
|
||||
const char *dest = file[n_files - 1];
|
||||
if (!isdir (dest))
|
||||
{
|
||||
errors |= install_file_in_dir (argv[optind], argv[argc - 1]);
|
||||
error (0, 0,
|
||||
_("installing multiple files, but last argument (%s) \
|
||||
is not a directory"),
|
||||
dest);
|
||||
usage (1);
|
||||
}
|
||||
for (i = 0; i < n_files - 1; i++)
|
||||
{
|
||||
errors |= install_file_in_dir (file[i], dest, &x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
if (x.verbose)
|
||||
close_stdout ();
|
||||
exit (errors);
|
||||
}
|
||||
@@ -344,7 +395,8 @@ main (int argc, char **argv)
|
||||
Return 0 if successful, 1 if an error occurs */
|
||||
|
||||
static int
|
||||
install_file_to_path (const char *from, const char *to)
|
||||
install_file_to_path (const char *from, const char *to,
|
||||
const struct cp_options *x)
|
||||
{
|
||||
char *dest_dir;
|
||||
int fail;
|
||||
@@ -362,12 +414,12 @@ install_file_to_path (const char *from, const char *to)
|
||||
rules, it's not so bad. Maybe use something like this instead:
|
||||
int parent_dir_mode = (mode | (S_IRUGO | S_IXUGO)) & (~SPECIAL_BITS);
|
||||
*/
|
||||
fail = make_path (dest_dir, mode, mode, owner_id, group_id, 0,
|
||||
(verbose ? _("creating directory `%s'") : NULL));
|
||||
fail = make_path (dest_dir, x->mode, x->mode, owner_id, group_id, 0,
|
||||
(x->verbose ? _("creating directory `%s'") : NULL));
|
||||
}
|
||||
else
|
||||
{
|
||||
fail = install_file_in_file (from, to);
|
||||
fail = install_file_in_file (from, to, x);
|
||||
}
|
||||
|
||||
free (dest_dir);
|
||||
@@ -380,21 +432,16 @@ install_file_to_path (const char *from, const char *to)
|
||||
Return 0 if successful, 1 if an error occurs. */
|
||||
|
||||
static int
|
||||
install_file_in_file (const char *from, const char *to)
|
||||
install_file_in_file (const char *from, const char *to,
|
||||
const struct cp_options *x)
|
||||
{
|
||||
int to_created;
|
||||
int no_need_to_chown;
|
||||
|
||||
if (copy_file (from, to, &to_created))
|
||||
if (copy_file (from, to, x))
|
||||
return 1;
|
||||
if (strip_files)
|
||||
strip (to);
|
||||
no_need_to_chown = (to_created
|
||||
&& owner_name == NULL
|
||||
&& group_name == NULL);
|
||||
if (change_attributes (to, no_need_to_chown))
|
||||
if (change_attributes (to, x->mode))
|
||||
return 1;
|
||||
if (preserve_timestamps)
|
||||
if (x->preserve_timestamps)
|
||||
return change_timestamps (from, to);
|
||||
return 0;
|
||||
}
|
||||
@@ -404,151 +451,49 @@ install_file_in_file (const char *from, const char *to)
|
||||
Return 0 if successful, 1 if not. */
|
||||
|
||||
static int
|
||||
install_file_in_dir (const char *from, const char *to_dir)
|
||||
install_file_in_dir (const char *from, const char *to_dir,
|
||||
const struct cp_options *x)
|
||||
{
|
||||
char *from_base;
|
||||
char *to;
|
||||
int ret;
|
||||
|
||||
from_base = base_name (from);
|
||||
to = xmalloc ((unsigned) (strlen (to_dir) + strlen (from_base) + 2));
|
||||
stpcpy (stpcpy (stpcpy (to, to_dir), "/"), from_base);
|
||||
ret = install_file_in_file (from, to);
|
||||
to = path_concat (to_dir, from_base, NULL);
|
||||
ret = install_file_in_file (from, to, x);
|
||||
free (to);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* A chunk of a file being copied. */
|
||||
static char buffer[READ_SIZE];
|
||||
|
||||
/* Copy file FROM onto file TO, creating TO if necessary.
|
||||
Return 0 if the copy is successful, 1 if not. If the copy is
|
||||
successful, set *TO_CREATED to nonzero if TO was created (if it did
|
||||
not exist or did, but was unlinked) and to zero otherwise. If the
|
||||
copy fails, don't modify *TO_CREATED. */
|
||||
Return 0 if the copy is successful, 1 if not. */
|
||||
|
||||
static int
|
||||
copy_file (const char *from, const char *to, int *to_created)
|
||||
copy_file (const char *from, const char *to, const struct cp_options *x)
|
||||
{
|
||||
int fromfd, tofd;
|
||||
int bytes;
|
||||
int ret = 0;
|
||||
struct stat from_stats, to_stats;
|
||||
int target_created = 1;
|
||||
|
||||
if (stat (from, &from_stats))
|
||||
{
|
||||
error (0, errno, "%s", from);
|
||||
return 1;
|
||||
}
|
||||
int fail;
|
||||
int nonexistent_dst = 0;
|
||||
int copy_into_self;
|
||||
|
||||
/* Allow installing from non-regular files like /dev/null.
|
||||
Charles Karney reported that some Sun version of install allows that
|
||||
and that sendmail's installation process relies on the behavior. */
|
||||
if (S_ISDIR (from_stats.st_mode))
|
||||
if (isdir (from))
|
||||
{
|
||||
error (0, 0, _("`%s' is a directory"), from);
|
||||
return 1;
|
||||
}
|
||||
if (stat (to, &to_stats) == 0)
|
||||
{
|
||||
if (!S_ISREG (to_stats.st_mode))
|
||||
{
|
||||
error (0, 0, _("`%s' is not a regular file"), to);
|
||||
return 1;
|
||||
}
|
||||
if (from_stats.st_dev == to_stats.st_dev
|
||||
&& from_stats.st_ino == to_stats.st_ino)
|
||||
{
|
||||
error (0, 0, _("`%s' and `%s' are the same file"), from, to);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* The destination file exists. Try to back it up if required. */
|
||||
if (backup_type != none)
|
||||
{
|
||||
char *tmp_backup = find_backup_file_name (to, backup_type);
|
||||
char *dst_backup;
|
||||
fail = copy (from, to, nonexistent_dst, x, ©_into_self, NULL);
|
||||
|
||||
if (tmp_backup == NULL)
|
||||
error (1, 0, "virtual memory exhausted");
|
||||
dst_backup = (char *) alloca (strlen (tmp_backup) + 1);
|
||||
strcpy (dst_backup, tmp_backup);
|
||||
free (tmp_backup);
|
||||
if (rename (to, dst_backup))
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
error (0, errno, "cannot backup `%s'", to);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If unlink fails, try to proceed anyway. */
|
||||
if (unlink (to))
|
||||
target_created = 0;
|
||||
}
|
||||
|
||||
/* Now it's the time to give some feedback if requested. */
|
||||
if (verbose)
|
||||
printf ("copying `%s' to `%s'\n", from, to);
|
||||
|
||||
fromfd = open (from, O_RDONLY, 0);
|
||||
if (fromfd == -1)
|
||||
{
|
||||
error (0, errno, "%s", from);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Make sure to open the file in a mode that allows writing. */
|
||||
tofd = open (to, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||
if (tofd == -1)
|
||||
{
|
||||
error (0, errno, "%s", to);
|
||||
close (fromfd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ((bytes = safe_read (fromfd, buffer, READ_SIZE)) > 0)
|
||||
if (full_write (tofd, buffer, bytes) < 0)
|
||||
{
|
||||
error (0, errno, "%s", to);
|
||||
goto copy_error;
|
||||
}
|
||||
|
||||
if (bytes == -1)
|
||||
{
|
||||
error (0, errno, "%s", from);
|
||||
goto copy_error;
|
||||
}
|
||||
|
||||
if (close (fromfd) < 0)
|
||||
{
|
||||
error (0, errno, "%s", from);
|
||||
ret = 1;
|
||||
}
|
||||
if (close (tofd) < 0)
|
||||
{
|
||||
error (0, errno, "%s", to);
|
||||
ret = 1;
|
||||
}
|
||||
if (ret == 0)
|
||||
*to_created = target_created;
|
||||
return ret;
|
||||
|
||||
copy_error:
|
||||
close (fromfd);
|
||||
close (tofd);
|
||||
return 1;
|
||||
return fail;
|
||||
}
|
||||
|
||||
/* Set the attributes of file or directory PATH.
|
||||
If NO_NEED_TO_CHOWN is nonzero, don't call chown.
|
||||
Return 0 if successful, 1 if not. */
|
||||
|
||||
static int
|
||||
change_attributes (const char *path, int no_need_to_chown)
|
||||
change_attributes (const char *path, mode_t mode)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
@@ -558,9 +503,6 @@ change_attributes (const char *path, int no_need_to_chown)
|
||||
On System V, users can give away files with chown and then not
|
||||
be able to chmod them. So don't give files away.
|
||||
|
||||
We don't pass -1 to chown to mean "don't change the value"
|
||||
because SVR3 and earlier non-BSD systems don't support that.
|
||||
|
||||
We don't normally ignore errors from chown because the idea of
|
||||
the install command is that the file is supposed to end up with
|
||||
precisely the attributes that the user specified (or defaulted).
|
||||
@@ -568,7 +510,7 @@ change_attributes (const char *path, int no_need_to_chown)
|
||||
want to know. But AFS returns EPERM when you try to change a
|
||||
file's group; thus the kludge. */
|
||||
|
||||
if (!no_need_to_chown && chown (path, owner_id, group_id)
|
||||
if (chown (path, owner_id, group_id)
|
||||
#ifdef AFS
|
||||
&& errno != EPERM
|
||||
#endif
|
||||
|
||||
17
src/join.c
17
src/join.c
@@ -19,11 +19,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Get isblank from GNU libc. */
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#define NDEBUG
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
@@ -195,7 +191,7 @@ static void
|
||||
xfields (struct line *line)
|
||||
{
|
||||
int i;
|
||||
register char *ptr, *lim;
|
||||
unsigned char *ptr, *lim;
|
||||
|
||||
ptr = line->beg;
|
||||
lim = line->lim;
|
||||
@@ -211,7 +207,7 @@ xfields (struct line *line)
|
||||
{
|
||||
if (tab)
|
||||
{
|
||||
char *beg;
|
||||
unsigned char *beg;
|
||||
|
||||
beg = ptr;
|
||||
while (ptr < lim && *ptr != tab)
|
||||
@@ -222,7 +218,7 @@ xfields (struct line *line)
|
||||
}
|
||||
else
|
||||
{
|
||||
char *beg;
|
||||
unsigned char *beg;
|
||||
|
||||
beg = ptr;
|
||||
while (ptr < lim && !ISSPACE (*ptr))
|
||||
@@ -233,7 +229,8 @@ xfields (struct line *line)
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr > line->beg && ((tab && ISSPACE (ptr[-1])) || ptr[-1] == tab))
|
||||
if ((char *) ptr > line->beg
|
||||
&& ((tab && ISSPACE (ptr[-1])) || ptr[-1] == tab))
|
||||
{
|
||||
/* Add one more (empty) field because the last character of the
|
||||
line was a delimiter. */
|
||||
@@ -843,10 +840,10 @@ main (int argc, char **argv)
|
||||
usage (1);
|
||||
}
|
||||
|
||||
fp1 = strcmp (names[0], "-") ? fopen (names[0], "r") : stdin;
|
||||
fp1 = STREQ (names[0], "-") ? stdin : fopen (names[0], "r");
|
||||
if (!fp1)
|
||||
error (EXIT_FAILURE, errno, "%s", names[0]);
|
||||
fp2 = strcmp (names[1], "-") ? fopen (names[1], "r") : stdin;
|
||||
fp2 = STREQ (names[1], "-") ? stdin : fopen (names[1], "r");
|
||||
if (!fp2)
|
||||
error (EXIT_FAILURE, errno, "%s", names[1]);
|
||||
if (fp1 == fp2)
|
||||
|
||||
159
src/ls.c
159
src/ls.c
@@ -317,13 +317,13 @@ int inhibit_group;
|
||||
|
||||
static int numeric_ids;
|
||||
|
||||
/* Nonzero means mention the size in 512 byte blocks of each file. -s */
|
||||
/* Nonzero means mention the size in blocks of each file. -s */
|
||||
|
||||
static int print_block_size;
|
||||
|
||||
/* The units to count blocks in. */
|
||||
|
||||
static int output_units;
|
||||
/* If positive, the units to use when printing sizes;
|
||||
if negative, the human-readable base. */
|
||||
static int output_block_size;
|
||||
|
||||
/* Precede each line of long output (per file) with a string like `m,n:'
|
||||
where M is the number of characters after the `:' and before the
|
||||
@@ -409,10 +409,6 @@ struct col_ext_type *col_ext_list = NULL;
|
||||
/* Buffer for color sequences */
|
||||
static char *color_buf;
|
||||
|
||||
/* base used for human style output */
|
||||
|
||||
static int human_readable_base;
|
||||
|
||||
/* Nonzero means mention the inode number of each file. -i */
|
||||
|
||||
static int print_inode;
|
||||
@@ -532,6 +528,7 @@ static struct option const long_options[] =
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
{"color", optional_argument, 0, 13},
|
||||
{"block-size", required_argument, 0, 17},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -569,14 +566,14 @@ static char const *const time_args[] =
|
||||
and later output themselves. */
|
||||
static size_t dired_pos;
|
||||
|
||||
#define PUTCHAR(c) do {putchar ((c)); ++dired_pos;} while (0)
|
||||
#define DIRED_PUTCHAR(c) do {putchar ((c)); ++dired_pos;} while (0)
|
||||
|
||||
/* Write S to STREAM and increment DIRED_POS by S_LEN. */
|
||||
#define FPUTS(s, stream, s_len) \
|
||||
#define DIRED_FPUTS(s, stream, s_len) \
|
||||
do {fputs ((s), (stream)); dired_pos += s_len;} while (0)
|
||||
|
||||
/* Like FPUTS, but for use when S is a literal string. */
|
||||
#define FPUTS_LITERAL(s, stream) \
|
||||
/* Like DIRED_FPUTS, but for use when S is a literal string. */
|
||||
#define DIRED_FPUTS_LITERAL(s, stream) \
|
||||
do {fputs ((s), (stream)); dired_pos += sizeof((s)) - 1;} while (0)
|
||||
|
||||
#define DIRED_INDENT() \
|
||||
@@ -584,7 +581,7 @@ static size_t dired_pos;
|
||||
{ \
|
||||
/* FIXME: remove the `&& format == long_format' clause. */ \
|
||||
if (dired && format == long_format) \
|
||||
FPUTS_LITERAL (" ", stdout); \
|
||||
DIRED_FPUTS_LITERAL (" ", stdout); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
@@ -753,7 +750,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
print_current_files ();
|
||||
if (pending_dirs)
|
||||
PUTCHAR ('\n');
|
||||
DIRED_PUTCHAR ('\n');
|
||||
}
|
||||
else if (pending_dirs && pending_dirs->next == 0)
|
||||
print_dir_name = 0;
|
||||
@@ -810,13 +807,13 @@ decode_switches (int argc, char **argv)
|
||||
case LS_MULTI_COL:
|
||||
/* This is for the `dir' program. */
|
||||
format = many_per_line;
|
||||
set_quoting_style ("earg_quoting_options, escape_quoting_style);
|
||||
set_quoting_style (NULL, escape_quoting_style);
|
||||
break;
|
||||
|
||||
case LS_LONG_FORMAT:
|
||||
/* This is for the `vdir' program. */
|
||||
format = long_format;
|
||||
set_quoting_style ("earg_quoting_options, escape_quoting_style);
|
||||
set_quoting_style (NULL, escape_quoting_style);
|
||||
break;
|
||||
|
||||
case LS_LS:
|
||||
@@ -843,7 +840,6 @@ decode_switches (int argc, char **argv)
|
||||
sort_reverse = 0;
|
||||
numeric_ids = 0;
|
||||
print_block_size = 0;
|
||||
output_units = getenv ("POSIXLY_CORRECT") ? 512 : 1024;
|
||||
indicator_style = none;
|
||||
print_inode = 0;
|
||||
trace_links = 0;
|
||||
@@ -855,13 +851,9 @@ decode_switches (int argc, char **argv)
|
||||
|
||||
if ((p = getenv ("QUOTING_STYLE"))
|
||||
&& 0 <= (i = argmatch (p, quoting_style_args)))
|
||||
set_quoting_style ("earg_quoting_options, (enum quoting_style) i);
|
||||
set_quoting_style (NULL, (enum quoting_style) i);
|
||||
|
||||
if ((p = getenv ("BLOCKSIZE"))
|
||||
&& strncmp (p, "HUMAN", sizeof ("HUMAN") - 1) == 0)
|
||||
human_readable_base = 1024;
|
||||
else if (p && strcmp (p, "SI") == 0)
|
||||
human_readable_base = 1000;
|
||||
human_block_size (getenv ("LS_BLOCK_SIZE"), 0, &output_block_size);
|
||||
|
||||
line_length = 80;
|
||||
if ((p = getenv ("COLUMNS")) && *p)
|
||||
@@ -921,7 +913,7 @@ decode_switches (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
set_quoting_style ("earg_quoting_options, escape_quoting_style);
|
||||
set_quoting_style (NULL, escape_quoting_style);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
@@ -950,11 +942,11 @@ decode_switches (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
human_readable_base = 1024;
|
||||
output_block_size = -1024;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
human_readable_base = 1000;
|
||||
output_block_size = -1000;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
@@ -962,7 +954,7 @@ decode_switches (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
output_units = 1024;
|
||||
output_block_size = 1024;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
@@ -1058,11 +1050,11 @@ decode_switches (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
set_quoting_style ("earg_quoting_options, literal_quoting_style);
|
||||
set_quoting_style (NULL, literal_quoting_style);
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
set_quoting_style ("earg_quoting_options, c_quoting_style);
|
||||
set_quoting_style (NULL, c_quoting_style);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
@@ -1171,28 +1163,28 @@ decode_switches (int argc, char **argv)
|
||||
invalid_arg (_("quoting style"), optarg, i);
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
set_quoting_style ("earg_quoting_options,
|
||||
(enum quoting_style) i);
|
||||
set_quoting_style (NULL, (enum quoting_style) i);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
qmark_funny_chars = 0;
|
||||
break;
|
||||
|
||||
case 17:
|
||||
human_block_size (optarg, 1, &output_block_size);
|
||||
break;
|
||||
|
||||
default:
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (human_readable_base)
|
||||
output_units = 1;
|
||||
|
||||
filename_quoting_options = clone_quoting_options ("earg_quoting_options);
|
||||
filename_quoting_options = clone_quoting_options (NULL);
|
||||
if (indicator_style != none)
|
||||
for (p = "*=@|" + (int) indicator_style - 1; *p; p++)
|
||||
set_char_quoting (filename_quoting_options, *p, 1);
|
||||
|
||||
dirname_quoting_options = clone_quoting_options ("earg_quoting_options);
|
||||
dirname_quoting_options = clone_quoting_options (NULL);
|
||||
set_char_quoting (dirname_quoting_options, ':', 1);
|
||||
|
||||
return optind;
|
||||
@@ -1599,7 +1591,7 @@ print_dir (const char *name, const char *realname)
|
||||
dired_pos += quote_name (stdout, realname ? realname : name,
|
||||
dirname_quoting_options);
|
||||
PUSH_CURRENT_DIRED_POS (&subdired_obstack);
|
||||
FPUTS_LITERAL (":\n", stdout);
|
||||
DIRED_FPUTS_LITERAL (":\n", stdout);
|
||||
}
|
||||
|
||||
if (format == long_format || print_block_size)
|
||||
@@ -1609,19 +1601,18 @@ print_dir (const char *name, const char *realname)
|
||||
|
||||
DIRED_INDENT ();
|
||||
p = _("total");
|
||||
FPUTS (p, stdout, strlen (p));
|
||||
PUTCHAR (' ');
|
||||
p = human_readable (total_blocks, buf, ST_NBLOCKSIZE, output_units,
|
||||
human_readable_base);
|
||||
FPUTS (p, stdout, strlen (p));
|
||||
PUTCHAR ('\n');
|
||||
DIRED_FPUTS (p, stdout, strlen (p));
|
||||
DIRED_PUTCHAR (' ');
|
||||
p = human_readable (total_blocks, buf, ST_NBLOCKSIZE, output_block_size);
|
||||
DIRED_FPUTS (p, stdout, strlen (p));
|
||||
DIRED_PUTCHAR ('\n');
|
||||
}
|
||||
|
||||
if (files_index)
|
||||
print_current_files ();
|
||||
|
||||
if (pending_dirs)
|
||||
PUTCHAR ('\n');
|
||||
DIRED_PUTCHAR ('\n');
|
||||
}
|
||||
|
||||
/* Add `pattern' to the list of patterns for which files that match are
|
||||
@@ -1803,7 +1794,7 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
|
||||
{
|
||||
char buf[LONGEST_HUMAN_READABLE + 1];
|
||||
int len = strlen (human_readable (blocks, buf, ST_NBLOCKSIZE,
|
||||
output_units, human_readable_base));
|
||||
output_block_size));
|
||||
if (block_size_size < len)
|
||||
block_size_size = len < 7 ? len : 7;
|
||||
}
|
||||
@@ -1991,49 +1982,73 @@ sort_files (void)
|
||||
static int
|
||||
compare_ctime (const struct fileinfo *file1, const struct fileinfo *file2)
|
||||
{
|
||||
return longdiff (file2->stat.st_ctime, file1->stat.st_ctime);
|
||||
int diff = longdiff (file2->stat.st_ctime, file1->stat.st_ctime);
|
||||
if (diff == 0)
|
||||
diff = strcmp (file1->name, file2->name);
|
||||
return diff;
|
||||
}
|
||||
|
||||
static int
|
||||
rev_cmp_ctime (const struct fileinfo *file2, const struct fileinfo *file1)
|
||||
{
|
||||
return longdiff (file2->stat.st_ctime, file1->stat.st_ctime);
|
||||
int diff = longdiff (file2->stat.st_ctime, file1->stat.st_ctime);
|
||||
if (diff == 0)
|
||||
diff = strcmp (file1->name, file2->name);
|
||||
return diff;
|
||||
}
|
||||
|
||||
static int
|
||||
compare_mtime (const struct fileinfo *file1, const struct fileinfo *file2)
|
||||
{
|
||||
return longdiff (file2->stat.st_mtime, file1->stat.st_mtime);
|
||||
int diff = longdiff (file2->stat.st_mtime, file1->stat.st_mtime);
|
||||
if (diff == 0)
|
||||
diff = strcmp (file1->name, file2->name);
|
||||
return diff;
|
||||
}
|
||||
|
||||
static int
|
||||
rev_cmp_mtime (const struct fileinfo *file2, const struct fileinfo *file1)
|
||||
{
|
||||
return longdiff (file2->stat.st_mtime, file1->stat.st_mtime);
|
||||
int diff = longdiff (file2->stat.st_mtime, file1->stat.st_mtime);
|
||||
if (diff == 0)
|
||||
diff = strcmp (file1->name, file2->name);
|
||||
return diff;
|
||||
}
|
||||
|
||||
static int
|
||||
compare_atime (const struct fileinfo *file1, const struct fileinfo *file2)
|
||||
{
|
||||
return longdiff (file2->stat.st_atime, file1->stat.st_atime);
|
||||
int diff = longdiff (file2->stat.st_atime, file1->stat.st_atime);
|
||||
if (diff == 0)
|
||||
diff = strcmp (file1->name, file2->name);
|
||||
return diff;
|
||||
}
|
||||
|
||||
static int
|
||||
rev_cmp_atime (const struct fileinfo *file2, const struct fileinfo *file1)
|
||||
{
|
||||
return longdiff (file2->stat.st_atime, file1->stat.st_atime);
|
||||
int diff = longdiff (file2->stat.st_atime, file1->stat.st_atime);
|
||||
if (diff == 0)
|
||||
diff = strcmp (file1->name, file2->name);
|
||||
return diff;
|
||||
}
|
||||
|
||||
static int
|
||||
compare_size (const struct fileinfo *file1, const struct fileinfo *file2)
|
||||
{
|
||||
return longdiff (file2->stat.st_size, file1->stat.st_size);
|
||||
int diff = longdiff (file2->stat.st_size, file1->stat.st_size);
|
||||
if (diff == 0)
|
||||
diff = strcmp (file1->name, file2->name);
|
||||
return diff;
|
||||
}
|
||||
|
||||
static int
|
||||
rev_cmp_size (const struct fileinfo *file2, const struct fileinfo *file1)
|
||||
{
|
||||
return longdiff (file2->stat.st_size, file1->stat.st_size);
|
||||
int diff = longdiff (file2->stat.st_size, file1->stat.st_size);
|
||||
if (diff == 0)
|
||||
diff = strcmp (file1->name, file2->name);
|
||||
return diff;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -2138,7 +2153,7 @@ print_current_files (void)
|
||||
for (i = 0; i < files_index; i++)
|
||||
{
|
||||
print_long_format (files + i);
|
||||
PUTCHAR ('\n');
|
||||
DIRED_PUTCHAR ('\n');
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2217,7 +2232,7 @@ print_long_format (const struct fileinfo *f)
|
||||
{
|
||||
char hbuf[LONGEST_HUMAN_READABLE + 1];
|
||||
sprintf (p, "%*s ", INODE_DIGITS,
|
||||
human_readable ((uintmax_t) f->stat.st_ino, hbuf, 1, 1, 0));
|
||||
human_readable ((uintmax_t) f->stat.st_ino, hbuf, 1, 1));
|
||||
p += strlen (p);
|
||||
}
|
||||
|
||||
@@ -2226,8 +2241,7 @@ print_long_format (const struct fileinfo *f)
|
||||
char hbuf[LONGEST_HUMAN_READABLE + 1];
|
||||
sprintf (p, "%*s ", block_size_size,
|
||||
human_readable ((uintmax_t) ST_NBLOCKS (f->stat), hbuf,
|
||||
ST_NBLOCKSIZE, output_units,
|
||||
human_readable_base));
|
||||
ST_NBLOCKSIZE, output_block_size));
|
||||
p += strlen (p);
|
||||
}
|
||||
|
||||
@@ -2260,8 +2274,8 @@ print_long_format (const struct fileinfo *f)
|
||||
{
|
||||
char hbuf[LONGEST_HUMAN_READABLE + 1];
|
||||
sprintf (p, "%8s ",
|
||||
human_readable ((uintmax_t) f->stat.st_size,
|
||||
hbuf, 1, 1, human_readable_base));
|
||||
human_readable ((uintmax_t) f->stat.st_size, hbuf, 1,
|
||||
output_block_size < 0 ? output_block_size : 1));
|
||||
}
|
||||
|
||||
p += strlen (p);
|
||||
@@ -2282,7 +2296,7 @@ print_long_format (const struct fileinfo *f)
|
||||
p += s;
|
||||
*p++ = ' ';
|
||||
|
||||
/* NUL-terminate the string -- fputs (via FPUTS) requires it. */
|
||||
/* NUL-terminate the string -- fputs (via DIRED_FPUTS) requires it. */
|
||||
*p = '\0';
|
||||
}
|
||||
else
|
||||
@@ -2294,19 +2308,19 @@ print_long_format (const struct fileinfo *f)
|
||||
|
||||
if (when < 0)
|
||||
{
|
||||
const char *num = human_readable (- (uintmax_t) when, hbuf, 1, 1, 0);
|
||||
const char *num = human_readable (- (uintmax_t) when, hbuf, 1, 1);
|
||||
int sign_width = width - strlen (num);
|
||||
sprintf (p, "%*s%s ", sign_width < 0 ? 0 : sign_width, "-", num);
|
||||
}
|
||||
else
|
||||
sprintf (p, "%*s ", width,
|
||||
human_readable ((uintmax_t) when, hbuf, 1, 1, 0));
|
||||
human_readable ((uintmax_t) when, hbuf, 1, 1));
|
||||
|
||||
p += strlen (p);
|
||||
}
|
||||
|
||||
DIRED_INDENT ();
|
||||
FPUTS (buf, stdout, p - buf);
|
||||
DIRED_FPUTS (buf, stdout, p - buf);
|
||||
print_name_with_quoting (f->name, f->stat.st_mode, f->linkok,
|
||||
&dired_obstack);
|
||||
|
||||
@@ -2314,7 +2328,7 @@ print_long_format (const struct fileinfo *f)
|
||||
{
|
||||
if (f->linkname)
|
||||
{
|
||||
FPUTS_LITERAL (" -> ", stdout);
|
||||
DIRED_FPUTS_LITERAL (" -> ", stdout);
|
||||
print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1,
|
||||
NULL);
|
||||
if (indicator_style != none)
|
||||
@@ -2399,12 +2413,12 @@ print_file_name_and_frills (const struct fileinfo *f)
|
||||
|
||||
if (print_inode)
|
||||
printf ("%*s ", INODE_DIGITS,
|
||||
human_readable ((uintmax_t) f->stat.st_ino, buf, 1, 1, 0));
|
||||
human_readable ((uintmax_t) f->stat.st_ino, buf, 1, 1));
|
||||
|
||||
if (print_block_size)
|
||||
printf ("%*s ", block_size_size,
|
||||
human_readable ((uintmax_t) ST_NBLOCKS (f->stat), buf,
|
||||
ST_NBLOCKSIZE, output_units, human_readable_base));
|
||||
ST_NBLOCKSIZE, output_block_size));
|
||||
|
||||
print_name_with_quoting (f->name, f->stat.st_mode, f->linkok, NULL);
|
||||
|
||||
@@ -2416,26 +2430,26 @@ static void
|
||||
print_type_indicator (unsigned int mode)
|
||||
{
|
||||
if (S_ISDIR (mode))
|
||||
PUTCHAR ('/');
|
||||
DIRED_PUTCHAR ('/');
|
||||
|
||||
#ifdef S_ISLNK
|
||||
if (S_ISLNK (mode))
|
||||
PUTCHAR ('@');
|
||||
DIRED_PUTCHAR ('@');
|
||||
#endif
|
||||
|
||||
#ifdef S_ISFIFO
|
||||
if (S_ISFIFO (mode))
|
||||
PUTCHAR ('|');
|
||||
DIRED_PUTCHAR ('|');
|
||||
#endif
|
||||
|
||||
#ifdef S_ISSOCK
|
||||
if (S_ISSOCK (mode))
|
||||
PUTCHAR ('=');
|
||||
DIRED_PUTCHAR ('=');
|
||||
#endif
|
||||
|
||||
if (S_ISREG (mode) && indicator_style == classify
|
||||
&& (mode & S_IXUGO))
|
||||
PUTCHAR ('*');
|
||||
DIRED_PUTCHAR ('*');
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2845,6 +2859,7 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
|
||||
-a, --all do not hide entries starting with .\n\
|
||||
-A, --almost-all do not list implied . and ..\n\
|
||||
-b, --escape print octal escapes for nongraphic characters\n\
|
||||
--block-size=SIZE use SIZE-byte blocks\n\
|
||||
-B, --ignore-backups do not list implied entries ending with ~\n\
|
||||
-c sort by change time; with -l: show ctime\n\
|
||||
-C list entries by columns\n\
|
||||
@@ -2867,7 +2882,7 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
|
||||
none (default), classify (-F), file-type (-p)\n\
|
||||
-i, --inode print index number of each file\n\
|
||||
-I, --ignore=PATTERN do not list implied entries matching shell PATTERN\n\
|
||||
-k, --kilobytes use 1024 blocks, not 512 despite POSIXLY_CORRECT\n\
|
||||
-k, --kilobytes like --block-size=1024\n\
|
||||
-l use a long listing format\n\
|
||||
-L, --dereference list entries pointed to by symbolic links\n\
|
||||
-m fill width with a comma separated list of entries\n\
|
||||
|
||||
12
src/md5sum.c
12
src/md5sum.c
@@ -1,6 +1,6 @@
|
||||
/* Compute MD5 checksum of files or strings according to the definition
|
||||
of MD5 in RFC 1321 from April 1992.
|
||||
Copyright (C) 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 95, 96, 1997, 1998 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
|
||||
@@ -129,7 +129,7 @@ text), and name for each FILE.\n"),
|
||||
}
|
||||
|
||||
static int
|
||||
split_3 (char *s, size_t s_len, char **u, int *binary, char **w)
|
||||
split_3 (char *s, size_t s_len, unsigned char **u, int *binary, char **w)
|
||||
{
|
||||
size_t i;
|
||||
int filename_has_newline = 0;
|
||||
@@ -219,7 +219,7 @@ split_3 (char *s, size_t s_len, char **u, int *binary, char **w)
|
||||
}
|
||||
|
||||
static int
|
||||
hex_digits (const char *s)
|
||||
hex_digits (unsigned char const *s)
|
||||
{
|
||||
while (*s)
|
||||
{
|
||||
@@ -240,7 +240,7 @@ md5_file (const char *filename, int binary, unsigned char *md5_result)
|
||||
FILE *fp;
|
||||
int err;
|
||||
|
||||
if (strcmp (filename, "-") == 0)
|
||||
if (STREQ (filename, "-"))
|
||||
{
|
||||
have_read_stdin = 1;
|
||||
fp = stdin;
|
||||
@@ -289,7 +289,7 @@ md5_check (const char *checkfile_name)
|
||||
char *line;
|
||||
size_t line_chars_allocated;
|
||||
|
||||
if (strcmp (checkfile_name, "-") == 0)
|
||||
if (STREQ (checkfile_name, "-"))
|
||||
{
|
||||
have_read_stdin = 1;
|
||||
checkfile_name = _("standard input");
|
||||
@@ -312,7 +312,7 @@ md5_check (const char *checkfile_name)
|
||||
{
|
||||
char *filename;
|
||||
int binary;
|
||||
char *md5num;
|
||||
unsigned char *md5num;
|
||||
int err;
|
||||
int line_length;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user