Compare commits
626
Commits
1_1_stable
...
1_2_0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f86a5ba510 | ||
|
|
53702e53ba | ||
|
|
3b0cfb40a5 | ||
|
|
3e4da920bd | ||
|
|
fc2aea1a76 | ||
|
|
f0623a2c98 | ||
|
|
62103757ef | ||
|
|
d893b120ba | ||
|
|
534374755d | ||
|
|
afb94ecf2b | ||
|
|
25c194fd19 | ||
|
|
df822f2606 | ||
|
|
1870737480 | ||
|
|
83169c607b | ||
|
|
91ed1a4a41 | ||
|
|
a4622324dd | ||
|
|
3a9cceb092 | ||
|
|
1f9145c5c3 | ||
|
|
58dda84ecc | ||
|
|
c9c1a41c58 | ||
|
|
801ab14013 | ||
|
|
ab7d9be17c | ||
|
|
2819f757ca | ||
|
|
22d3958d76 | ||
|
|
1cca9484db | ||
|
|
5d8843e451 | ||
|
|
5b88a38157 | ||
|
|
3bfcf3cccc | ||
|
|
cba1b96735 | ||
|
|
acf448d4f6 | ||
|
|
1df45cf8e7 | ||
|
|
ff6e21c2ce | ||
|
|
9ebd1bd468 | ||
|
|
e3324502a5 | ||
|
|
4ae905a31c | ||
|
|
aa516a61b9 | ||
|
|
f296f0b77d | ||
|
|
434ccd9739 | ||
|
|
cf5b80ba32 | ||
|
|
273430aa8d | ||
|
|
c773ac8a79 | ||
|
|
259472e741 | ||
|
|
441bfbf143 | ||
|
|
4eddb42bbc | ||
|
|
c9f423a93d | ||
|
|
63fc1a9e08 | ||
|
|
087b9d640e | ||
|
|
e02706fe45 | ||
|
|
7a8e491dff | ||
|
|
7ccb65f3a4 | ||
|
|
d35ef0f666 | ||
|
|
edd9ca5743 | ||
|
|
53f21e34a7 | ||
|
|
177c9f3128 | ||
|
|
68229837ff | ||
|
|
f350160963 | ||
|
|
01772aea33 | ||
|
|
12d9419273 | ||
|
|
5df6d9f777 | ||
|
|
a526c30cc5 | ||
|
|
ab58d5cf8a | ||
|
|
9c0e4f03d9 | ||
|
|
8bbdb8732f | ||
|
|
cd545287c5 | ||
|
|
00c051e42d | ||
|
|
c340ea191a | ||
|
|
7077ea30f5 | ||
|
|
c5e4ab7fe6 | ||
|
|
a6e6037219 | ||
|
|
db1ab1aeb3 | ||
|
|
ea7c18514b | ||
|
|
cc826d74e4 | ||
|
|
1979d3ccbc | ||
|
|
d879ffb79e | ||
|
|
ed9aec908b | ||
|
|
cddba6c61f | ||
|
|
af12cb39d1 | ||
|
|
22f383e695 | ||
|
|
21302c2b78 | ||
|
|
4137dd783b | ||
|
|
cd68a2e1a8 | ||
|
|
42705abc28 | ||
|
|
ef10d52745 | ||
|
|
cf7577d417 | ||
|
|
11c7a7bed6 | ||
|
|
f087798e8b | ||
|
|
a892bf8284 | ||
|
|
934da82913 | ||
|
|
768945b762 | ||
|
|
641c3537c0 | ||
|
|
e1ee482684 | ||
|
|
c983274565 | ||
|
|
5d9c42aadc | ||
|
|
53433b3ca1 | ||
|
|
1fa4a9448b | ||
|
|
67d4943393 | ||
|
|
135cee3741 | ||
|
|
35492137f8 | ||
|
|
c2ad4f5d27 | ||
|
|
0cc2c2c289 | ||
|
|
dbfb5a3cb7 | ||
|
|
399d45f1c6 | ||
|
|
e5e1a10cd3 | ||
|
|
2d6af16035 | ||
|
|
b049c0ec19 | ||
|
|
b13fee4cbb | ||
|
|
5483de1cb7 | ||
|
|
9fe801e0d2 | ||
|
|
14ff19b28a | ||
|
|
2b8a05a775 | ||
|
|
8437ede6c2 | ||
|
|
5ab8f7de4f | ||
|
|
57c1f73dd5 | ||
|
|
2818b292fb | ||
|
|
2a613d7360 | ||
|
|
352e117c6b | ||
|
|
7a260f01ce | ||
|
|
290fcb4213 | ||
|
|
ea224be6aa | ||
|
|
14d7065ef1 | ||
|
|
b000586d02 | ||
|
|
fe3d844bb1 | ||
|
|
fa61ca7591 | ||
|
|
6d82f94681 | ||
|
|
d9a761d9c3 | ||
|
|
1449a2014a | ||
|
|
747041955e | ||
|
|
f5efa7bfeb | ||
|
|
fd4b61d5f3 | ||
|
|
bc8c50351f | ||
|
|
9947a244d4 | ||
|
|
1761b9dabe | ||
|
|
7011dd0e06 | ||
|
|
42f091a761 | ||
|
|
39218932b1 | ||
|
|
cd82c3c041 | ||
|
|
04b7ef967b | ||
|
|
148734df99 | ||
|
|
22d26fc6ae | ||
|
|
d6e5083d16 | ||
|
|
e2c7d34051 | ||
|
|
597e70e9e4 | ||
|
|
32bf1f9d42 | ||
|
|
f1bd42a305 | ||
|
|
df798b7f58 | ||
|
|
66e3a222cd | ||
|
|
d760560c52 | ||
|
|
a34b48abe5 | ||
|
|
c7ddefc062 | ||
|
|
575c8bacda | ||
|
|
68286770b6 | ||
|
|
f946379599 | ||
|
|
7c7b0d7437 | ||
|
|
18958e9309 | ||
|
|
0960ca7383 | ||
|
|
19a3940f15 | ||
|
|
76ef08c5e3 | ||
|
|
7900b7b9b9 | ||
|
|
c4b673994e | ||
|
|
fd8409f8c5 | ||
|
|
9a1a9de49f | ||
|
|
9a202c9daa | ||
|
|
1dea55d577 | ||
|
|
7b8ff22685 | ||
|
|
2f6a317944 | ||
|
|
f81ac42689 | ||
|
|
a926f8e50a | ||
|
|
081b1ac6b4 | ||
|
|
e5de38497a | ||
|
|
62f9856f54 | ||
|
|
b25f98a417 | ||
|
|
3b1936dcf9 | ||
|
|
44e216f264 | ||
|
|
2d1a6e7c1f | ||
|
|
6ba8bbe88a | ||
|
|
1e23b6fdb5 | ||
|
|
7ba12c6957 | ||
|
|
6ab037872f | ||
|
|
176f2df69b | ||
|
|
9c6f9552ec | ||
|
|
2e7dfc179c | ||
|
|
9be7435203 | ||
|
|
6fb5847faf | ||
|
|
ca70774293 | ||
|
|
373af43bb0 | ||
|
|
2fc534f3f1 | ||
|
|
f915a77386 | ||
|
|
6d8ce170b0 | ||
|
|
5929edc1fa | ||
|
|
301ad67912 | ||
|
|
19008b8373 | ||
|
|
4c5ad2fc90 | ||
|
|
830d258dee | ||
|
|
828d6bb3bc | ||
|
|
62a2c15376 | ||
|
|
e3fdf2431a | ||
|
|
81514ecca3 | ||
|
|
74b29a107f | ||
|
|
55b12105b5 | ||
|
|
bc6584977a | ||
|
|
16d3e4e0af | ||
|
|
ea93f8a397 | ||
|
|
e0387a6ee8 | ||
|
|
0753f4a15e | ||
|
|
eb29d6ce6a | ||
|
|
c44ab02f15 | ||
|
|
280dae74b0 | ||
|
|
2a13175440 | ||
|
|
75c6b7962d | ||
|
|
b306cb767f | ||
|
|
8e640a1043 | ||
|
|
b16b5bb08f | ||
|
|
362dc2bf33 | ||
|
|
12d87550a3 | ||
|
|
bc291dc731 | ||
|
|
1e34731a6a | ||
|
|
213cc00445 | ||
|
|
863073da08 | ||
|
|
395010b1f0 | ||
|
|
1b9d7c9aa9 | ||
|
|
a3d4bf38b0 | ||
|
|
e84f4343b2 | ||
|
|
5084c78cbe | ||
|
|
5f6d67b7d6 | ||
|
|
b1312c9125 | ||
|
|
c89982dcd7 | ||
|
|
deda6a5c0d | ||
|
|
2c351a8f98 | ||
|
|
62558765b9 | ||
|
|
5c0ae06ef1 | ||
|
|
9a990aaba8 | ||
|
|
e15d7573a1 | ||
|
|
ecae66ac16 | ||
|
|
ff97ee9abd | ||
|
|
cf1f2ace39 | ||
|
|
3132e9d830 | ||
|
|
f0327f8e98 | ||
|
|
b5353a20f3 | ||
|
|
d04e9b8130 | ||
|
|
d112f8fa5e | ||
|
|
8fc32d9326 | ||
|
|
317a45cb62 | ||
|
|
9b1857f79f | ||
|
|
d5b9b60fa5 | ||
|
|
0620841758 | ||
|
|
c8b360ebb7 | ||
|
|
b623a542df | ||
|
|
8abbee474c | ||
|
|
9a5686b605 | ||
|
|
dac033e98c | ||
|
|
f9437aaf5b | ||
|
|
8d3a6f7aaf | ||
|
|
f3ac9ebc8e | ||
|
|
595159f38c | ||
|
|
c418d482ba | ||
|
|
507cd755a4 | ||
|
|
3252b625b7 | ||
|
|
b2d42fa6d1 | ||
|
|
4b146e65ad | ||
|
|
7ae1553980 | ||
|
|
a8622e049d | ||
|
|
c58dbf28e0 | ||
|
|
3ab3080bc2 | ||
|
|
752f0a6001 | ||
|
|
f14f7fc5ca | ||
|
|
077368194c | ||
|
|
35e1a077d6 | ||
|
|
76bb97c995 | ||
|
|
49e60b9788 | ||
|
|
0da069d382 | ||
|
|
bbc225e13d | ||
|
|
d2c306e862 | ||
|
|
1ec5b29054 | ||
|
|
a6e131dab3 | ||
|
|
bba7f08d27 | ||
|
|
9755197448 | ||
|
|
0582ee0826 | ||
|
|
15d20a03d6 | ||
|
|
8394729ddf | ||
|
|
4e3aff3425 | ||
|
|
267a0ed9e6 | ||
|
|
81dab2cf83 | ||
|
|
0fbe7ddbdd | ||
|
|
c44bc986b7 | ||
|
|
3f78561d63 | ||
|
|
8fba99f35e | ||
|
|
299a6b4d7b | ||
|
|
d244bc1a57 | ||
|
|
d9872aa0d7 | ||
|
|
95a040fac8 | ||
|
|
8bb50782a5 | ||
|
|
5edc10275e | ||
|
|
d765ee5d0f | ||
|
|
b21d23bd46 | ||
|
|
01d23ade57 | ||
|
|
d29337580e | ||
|
|
781e42d66c | ||
|
|
b180e5a766 | ||
|
|
08421e1d0c | ||
|
|
8379053b11 | ||
|
|
76b82cfd6f | ||
|
|
4ed1f1d99d | ||
|
|
7fca7e3378 | ||
|
|
e28d1d6fdc | ||
|
|
6d0dbeb550 | ||
|
|
e00fc16aaa | ||
|
|
7fd9983c56 | ||
|
|
314c739b07 | ||
|
|
4f93a63467 | ||
|
|
fa6c4844b2 | ||
|
|
9c03cb920a | ||
|
|
3354487393 | ||
|
|
399d2b5c24 | ||
|
|
69d863b6c6 | ||
|
|
5a2997de72 | ||
|
|
ade7f95bd1 | ||
|
|
6cd2250953 | ||
|
|
89a22ea5d9 | ||
|
|
027ea1aeac | ||
|
|
5fc467e758 | ||
|
|
fa6b5e62c2 | ||
|
|
a81cec9192 | ||
|
|
5cd1ccd995 | ||
|
|
9ffd42317b | ||
|
|
c020f5f518 | ||
|
|
4148afe049 | ||
|
|
a1e130f122 | ||
|
|
3c8c0690fd | ||
|
|
30ead9a9b9 | ||
|
|
1a5eb46820 | ||
|
|
ef21629a6b | ||
|
|
9b5a99ad21 | ||
|
|
206f75784b | ||
|
|
19d42df206 | ||
|
|
35017fb4fc | ||
|
|
df4cdaf341 | ||
|
|
80b8ff07ca | ||
|
|
b1629b1b2a | ||
|
|
d8e87a09d1 | ||
|
|
c7801c4634 | ||
|
|
351c832d75 | ||
|
|
a254065e63 | ||
|
|
4ae2f511cf | ||
|
|
cf89c37d08 | ||
|
|
14b1d2930a | ||
|
|
0a8812bdc5 | ||
|
|
14aa06f29c | ||
|
|
e2922e42a0 | ||
|
|
38583fd6f2 | ||
|
|
4009ed91f7 | ||
|
|
d9ed35c8b9 | ||
|
|
a2a647dfc1 | ||
|
|
a85a63f6ee | ||
|
|
e2e56c7c41 | ||
|
|
e3c150bc67 | ||
|
|
42c4259f68 | ||
|
|
3afb070e6d | ||
|
|
d2ccc2ba26 | ||
|
|
7723019c6b | ||
|
|
c27c04c16e | ||
|
|
81369a8b2f | ||
|
|
5371a953ca | ||
|
|
2686d3bc38 | ||
|
|
adde79883f | ||
|
|
34b5319d86 | ||
|
|
d272dc7cb3 | ||
|
|
282a26b8ba | ||
|
|
2f38f27b42 | ||
|
|
d9b6b844e5 | ||
|
|
39440e520c | ||
|
|
2f4d91da75 | ||
|
|
47b1838957 | ||
|
|
d7384296f6 | ||
|
|
f7897ec47b | ||
|
|
525d74badb | ||
|
|
cc848ddbf8 | ||
|
|
0690d1591f | ||
|
|
ac4c92da3b | ||
|
|
9b70093714 | ||
|
|
2ad1e7ce44 | ||
|
|
983d751bc0 | ||
|
|
b73d2bf4bf | ||
|
|
8d2cb8be3b | ||
|
|
d148a94a2a | ||
|
|
be7c539b7a | ||
|
|
e135a5d746 | ||
|
|
b5547fb0b3 | ||
|
|
e92923862e | ||
|
|
49f6afc0a0 | ||
|
|
e3412d8331 | ||
|
|
6143c0719b | ||
|
|
094b9f7e1d | ||
|
|
06b00e8ba7 | ||
|
|
d2c8fd6360 | ||
|
|
772a3467ba | ||
|
|
673c9443ba | ||
|
|
72c4d64d20 | ||
|
|
62ec21d0cf | ||
|
|
731f81cbed | ||
|
|
eba32f429b | ||
|
|
59e46117b1 | ||
|
|
f893250a3b | ||
|
|
c503df5bdd | ||
|
|
2431830018 | ||
|
|
e3f5a3fd82 | ||
|
|
0b65628395 | ||
|
|
92d8b35594 | ||
|
|
45d545890f | ||
|
|
a6b5b60942 | ||
|
|
712ba85b30 | ||
|
|
d61b8d8f9b | ||
|
|
19802563ed | ||
|
|
0ea0aefcb5 | ||
|
|
1b4e1dae71 | ||
|
|
7031f62d9b | ||
|
|
15fe2e11d7 | ||
|
|
17507fa4c5 | ||
|
|
20deab0537 | ||
|
|
63e4c637cb | ||
|
|
baa89b398d | ||
|
|
a336e7cc25 | ||
|
|
a389651115 | ||
|
|
f8a8084267 | ||
|
|
9fb272a222 | ||
|
|
89ede3f586 | ||
|
|
96087332e7 | ||
|
|
42bd987e22 | ||
|
|
c008c7440d | ||
|
|
1781188a9d | ||
|
|
02d8fa48ad | ||
|
|
4e512f1062 | ||
|
|
3958e0a151 | ||
|
|
d8f6601502 | ||
|
|
2c39eee805 | ||
|
|
39cf645ce0 | ||
|
|
2381f702c9 | ||
|
|
49159c7f94 | ||
|
|
0e413e53e9 | ||
|
|
4f7953cc3c | ||
|
|
552b56dfd1 | ||
|
|
3b89039c25 | ||
|
|
846fe0c045 | ||
|
|
b1c3fbc677 | ||
|
|
0c43046fde | ||
|
|
3916b2a560 | ||
|
|
7c94bed234 | ||
|
|
db2ab89b7c | ||
|
|
f76cd964ec | ||
|
|
425e7584a4 | ||
|
|
1801e9cde7 | ||
|
|
035ef5659e | ||
|
|
2584e9b39f | ||
|
|
0f0b645f73 | ||
|
|
c5598177bc | ||
|
|
67d5b8b5b1 | ||
|
|
2631486f1b | ||
|
|
6389ff1115 | ||
|
|
c488f87953 | ||
|
|
73f54702bc | ||
|
|
3ea66a805d | ||
|
|
8a6254994c | ||
|
|
9950cab8e0 | ||
|
|
5bc3f05a23 | ||
|
|
a3e4f38f7b | ||
|
|
5f8b5ecda2 | ||
|
|
e5b281f89e | ||
|
|
2e2d752d49 | ||
|
|
2514042661 | ||
|
|
02fe81033f | ||
|
|
59c6baedf7 | ||
|
|
706f8f6de5 | ||
|
|
f054be12de | ||
|
|
12ef09b818 | ||
|
|
fe6bb3853c | ||
|
|
3737c03630 | ||
|
|
15545b1db9 | ||
|
|
a2d9a1752c | ||
|
|
0e6a3e14e4 | ||
|
|
7e21d5f6b1 | ||
|
|
d5b9428bb6 | ||
|
|
a345dc855f | ||
|
|
fc477f4bc6 | ||
|
|
06a81d368e | ||
|
|
5fe8d5b9c5 | ||
|
|
7818a422bc | ||
|
|
997650b972 | ||
|
|
56fbd21fa7 | ||
|
|
70cbb6e026 | ||
|
|
10f55b1dae | ||
|
|
586ea61284 | ||
|
|
791976490b | ||
|
|
f162183527 | ||
|
|
998dbee6d9 | ||
|
|
5076eb4af9 | ||
|
|
856489b63c | ||
|
|
bbd50b58ea | ||
|
|
e4386342b4 | ||
|
|
18260d5099 | ||
|
|
0c013f5fc7 | ||
|
|
38fc692e38 | ||
|
|
074fe347b7 | ||
|
|
ea46f456d4 | ||
|
|
ba31d27249 | ||
|
|
9b68dbd878 | ||
|
|
54f75ee300 | ||
|
|
2949577981 | ||
|
|
a2e98043d5 | ||
|
|
29ba9796be | ||
|
|
0edbad1a7c | ||
|
|
026147a48f | ||
|
|
8b1f11da52 | ||
|
|
559f7d8e92 | ||
|
|
5c16988910 | ||
|
|
20c22e0883 | ||
|
|
bf2d9905ca | ||
|
|
f8346038e9 | ||
|
|
b66c931fad | ||
|
|
d017d73399 | ||
|
|
af07a00082 | ||
|
|
00d10a94f3 | ||
|
|
f284c767e5 | ||
|
|
3a2b103eea | ||
|
|
dbd8c3b295 | ||
|
|
1a54030445 | ||
|
|
4b7b8a58a1 | ||
|
|
0436b9f482 | ||
|
|
78bd504947 | ||
|
|
b0a2d6c19d | ||
|
|
da0dcd1050 | ||
|
|
e66c7efc31 | ||
|
|
d086b504c3 | ||
|
|
346d6d9af2 | ||
|
|
2ec922eed5 | ||
|
|
6b4377f333 | ||
|
|
c2cb0f32b4 | ||
|
|
4f3d2deaa4 | ||
|
|
34fc71f5a3 | ||
|
|
d9cf7ac781 | ||
|
|
67f641e75b | ||
|
|
2c99851181 | ||
|
|
dac7ff15b7 | ||
|
|
79865bc507 | ||
|
|
fc5f318896 | ||
|
|
cb44816ba3 | ||
|
|
d0ea52ee04 | ||
|
|
a23a6d7819 | ||
|
|
e7f8a32929 | ||
|
|
cc295fb261 | ||
|
|
e0e9886c19 | ||
|
|
91f604771b | ||
|
|
9460f66e4e | ||
|
|
0b257d411d | ||
|
|
f785255a44 | ||
|
|
776fe22756 | ||
|
|
bb5b2ffbc5 | ||
|
|
905a58a303 | ||
|
|
8326d5e31b | ||
|
|
3515f6e043 | ||
|
|
fdf2b50316 | ||
|
|
81c40b39cb | ||
|
|
ca7166fe9d | ||
|
|
4a8d9effca | ||
|
|
0ebecac02e | ||
|
|
ea4c53ca43 | ||
|
|
8ad70871b5 | ||
|
|
c57ec37959 | ||
|
|
998f449375 | ||
|
|
72615752db | ||
|
|
6554de06fe | ||
|
|
a4acf669f4 | ||
|
|
3e72c5931c | ||
|
|
bc14214018 | ||
|
|
5fb0fecc1f | ||
|
|
cc4003f778 | ||
|
|
693a93608a | ||
|
|
8f7d389700 | ||
|
|
e11a01cc34 | ||
|
|
886f6afc8a | ||
|
|
061fd0a353 | ||
|
|
fa939aae81 | ||
|
|
465874f3a3 | ||
|
|
b7b24d61e0 | ||
|
|
19af279d16 | ||
|
|
e104d5fdcb | ||
|
|
9a2dd51237 | ||
|
|
ab8736064b | ||
|
|
3b84dfc2a8 | ||
|
|
dee811a53d | ||
|
|
89aaf4e249 | ||
|
|
2b398bec9c | ||
|
|
421d9e5941 | ||
|
|
101a470068 | ||
|
|
ebd1355828 | ||
|
|
a0f75e2bba | ||
|
|
a38330c366 | ||
|
|
6153629097 | ||
|
|
cfb53dfd5e | ||
|
|
7ab5f4d03d | ||
|
|
9a67ca309c | ||
|
|
7f77810633 | ||
|
|
a1bccc0ba8 | ||
|
|
9457e70357 | ||
|
|
a13cca9cf4 | ||
|
|
819b56b64a | ||
|
|
03e78e75f3 | ||
|
|
20fef96dd8 | ||
|
|
07a637df47 | ||
|
|
b0c5445bf5 | ||
|
|
5dd1236f49 | ||
|
|
81834531aa | ||
|
|
2cf38523a1 | ||
|
|
43ac88849b | ||
|
|
5cf905a871 | ||
|
|
81901a096c | ||
|
|
2766eedde8 | ||
|
|
e47c4cbd4d | ||
|
|
137669449a | ||
|
|
8ea5205726 | ||
|
|
1f6dc6d358 | ||
|
|
214744dba1 | ||
|
|
a8e2760924 | ||
|
|
daa4a6dcbd | ||
|
|
ef81ce620c | ||
|
|
d409c3a2f7 | ||
|
|
abaef6565e | ||
|
|
6018225238 |
No files matched your search
@@ -13,9 +13,26 @@ menu "Busybox Settings"
|
||||
|
||||
menu "General Configuration"
|
||||
|
||||
config CONFIG_NITPICK
|
||||
bool "See lots more (probably unnecessary) configuration options."
|
||||
default n
|
||||
help
|
||||
Some BusyBox applets have more configuration options than anyone
|
||||
will ever care about. To avoid drowining people in complexity, most
|
||||
of the applet features that can be set to a sane default value are
|
||||
hidden, unless you hit the above switch.
|
||||
|
||||
This is better than to telling people to edit the busybox source
|
||||
code, but not by much.
|
||||
|
||||
See http://en.wikipedia.org/wiki/Fibber_McGee_and_Molly#The_Closet
|
||||
|
||||
You have been warned.
|
||||
|
||||
choice
|
||||
prompt "Buffer allocation policy"
|
||||
default CONFIG_FEATURE_BUFFERS_USE_MALLOC
|
||||
depends on CONFIG_NITPICK
|
||||
help
|
||||
There are 3 ways BusyBox can handle buffer allocations:
|
||||
- Use malloc. This costs code size for the call to xmalloc.
|
||||
@@ -37,15 +54,39 @@ config CONFIG_FEATURE_BUFFERS_GO_IN_BSS
|
||||
|
||||
endchoice
|
||||
|
||||
config CONFIG_SHOW_USAGE
|
||||
bool "Show terse applet usage messages"
|
||||
default y
|
||||
help
|
||||
All BusyBox applets will show help messages when invoked with
|
||||
wrong arguments. You can turn off printing these terse usage
|
||||
messages if you say no here.
|
||||
This will save you up to 7k.
|
||||
|
||||
config CONFIG_FEATURE_VERBOSE_USAGE
|
||||
bool "Show verbose applet usage messages"
|
||||
default n
|
||||
select CONFIG_SHOW_USAGE
|
||||
help
|
||||
All BusyBox applets will show more verbose help messages when
|
||||
busybox is invoked with --help. This will add a lot of text to the
|
||||
busybox binary. In the default configuration, this will add about
|
||||
13k, but it can add much more depending on your configuration.
|
||||
|
||||
config CONFIG_FEATURE_COMPRESS_USAGE
|
||||
bool "Store applet usage messages in compressed form"
|
||||
default y
|
||||
depends on CONFIG_SHOW_USAGE && CONFIG_NITPICK
|
||||
help
|
||||
Store usage messages in compressed form, uncompress them on-the-fly
|
||||
when <applet> --help is called.
|
||||
|
||||
If you have a really tiny busybox with few applets enabled (and
|
||||
bunzip2 isn't one of them), the overhead of the decompressor might
|
||||
be noticeable. Also, if you run executables directly from ROM
|
||||
and have very little memory, this might not be a win. Otherwise,
|
||||
you probably want this.
|
||||
|
||||
config CONFIG_FEATURE_INSTALLER
|
||||
bool "Support --install [-s] to install applet links at runtime"
|
||||
default n
|
||||
@@ -62,25 +103,29 @@ config CONFIG_LOCALE_SUPPORT
|
||||
Enable this if your system has locale support and you would like
|
||||
busybox to support locale settings.
|
||||
|
||||
config CONFIG_FEATURE_DEVFS
|
||||
bool "Support for devfs"
|
||||
default n
|
||||
help
|
||||
Enable if you want BusyBox to work with devfs.
|
||||
config CONFIG_GETOPT_LONG
|
||||
bool
|
||||
default y
|
||||
# bool "Enable support for --long-options"
|
||||
# default n
|
||||
# help
|
||||
# Enable this if you want busybox applets to use the gnu --long-option
|
||||
# style, in addition to single character -a -b -c style options.
|
||||
|
||||
config CONFIG_FEATURE_DEVPTS
|
||||
bool "Use the devpts filesystem for Unix98 PTYs"
|
||||
default y if CONFIG_FEATURE_DEVFS
|
||||
default y
|
||||
help
|
||||
Enable if you want BusyBox to use Unix98 PTY support. If enabled,
|
||||
busybox will use /dev/ptmx for the master side of the pseudoterminal
|
||||
and /dev/pts/<number> for the slave side. Otherwise, BSD style
|
||||
/dev/ttyp<number> will be used. To use this option, you should have
|
||||
devpts or devfs mounted.
|
||||
devpts mounted.
|
||||
|
||||
config CONFIG_FEATURE_CLEAN_UP
|
||||
bool "Clean up all memory before exiting (usually not needed)"
|
||||
default n
|
||||
depends on CONFIG_NITPICK
|
||||
help
|
||||
As a size optimization, busybox normally exits without explicitly
|
||||
freeing dynamically allocated memory or closing files. This saves
|
||||
@@ -94,15 +139,25 @@ config CONFIG_FEATURE_SUID
|
||||
bool "Support for SUID/SGID handling"
|
||||
default n
|
||||
help
|
||||
Support SUID and SGID binaries.
|
||||
With this option you can install the busybox binary belonging
|
||||
to root with the suid bit set, and it'll and it'll automatically drop
|
||||
priviledges for applets that don't need root access.
|
||||
|
||||
If you're really paranoid and don't want to do this, build two
|
||||
busybox binaries with different applets in them (and the appropriate
|
||||
symlinks pointing to each binary), and only set the suid bit on the
|
||||
one that needs it. The applets currently marked to need the suid bit
|
||||
are login, passwd, su, ping, traceroute, crontab, dnsd, ipcrm, ipcs,
|
||||
and vlock.
|
||||
|
||||
config CONFIG_FEATURE_SUID_CONFIG
|
||||
bool "Runtime SUID/SGID configuration via /etc/busybox.conf"
|
||||
default n if CONFIG_FEATURE_SUID
|
||||
depends on CONFIG_FEATURE_SUID
|
||||
help
|
||||
Allow the SUID / SGID state of an applet to be determined runtime by
|
||||
checking /etc/busybox.conf. The format of this file is as follows:
|
||||
Allow the SUID / SGID state of an applet to be determined at runtime
|
||||
by checking /etc/busybox.conf. (This is sort of a poor man's sudo.)
|
||||
The format of this file is as follows:
|
||||
|
||||
<applet> = [Ssx-][Ssx-][x-] (<username>|<uid>).(<groupname>|<gid>)
|
||||
|
||||
@@ -129,7 +184,7 @@ config CONFIG_FEATURE_SUID_CONFIG
|
||||
|
||||
config CONFIG_FEATURE_SUID_CONFIG_QUIET
|
||||
bool "Suppress warning message if /etc/busybox.conf is not readable"
|
||||
default n
|
||||
default y
|
||||
depends on CONFIG_FEATURE_SUID_CONFIG
|
||||
help
|
||||
/etc/busybox.conf should be readable by the user needing the SUID, check
|
||||
@@ -155,6 +210,16 @@ config CONFIG_SELINUX
|
||||
|
||||
Most people will leave this set to 'N'.
|
||||
|
||||
config CONFIG_BUSYBOX_EXEC_PATH
|
||||
string "Path to BusyBox executable"
|
||||
default "/proc/self/exe"
|
||||
help
|
||||
When Busybox applets need to run other busybox applets, BusyBox
|
||||
sometimes needs to exec() itself. When the /proc filesystem is
|
||||
mounted, /proc/self/exe always points to the currently running
|
||||
executable. If you haven't got /proc, set this to wherever you
|
||||
want to run BusyBox from.
|
||||
|
||||
endmenu
|
||||
|
||||
menu 'Build Options'
|
||||
@@ -173,21 +238,18 @@ config CONFIG_STATIC
|
||||
|
||||
Most people will leave this set to 'N'.
|
||||
|
||||
# The busybox shared library feature is there so make standalone can produce
|
||||
# smaller applets. Since make standalone isn't in yet, there's nothing using
|
||||
# this yet, and so it's disabled.
|
||||
config CONFIG_DISABLE_SHARED
|
||||
bool
|
||||
default n
|
||||
|
||||
config CONFIG_BUILD_LIBBUSYBOX
|
||||
bool "Build shared libbusybox"
|
||||
default n
|
||||
depends on CONFIG_DISABLE_SHARED
|
||||
help
|
||||
Build a shared library libbusybox.so which contains all
|
||||
libraries used inside busybox.
|
||||
|
||||
This is an experimental feature intended to support the upcoming
|
||||
"make standalone" mode. Enabling it against the one big busybox
|
||||
binary serves no purpose (and increases the size). You should
|
||||
almost certainly say "no" to this right now.
|
||||
|
||||
config CONFIG_FEATURE_FULL_LIBBUSYBOX
|
||||
bool "Feature-complete libbusybox"
|
||||
default n if !CONFIG_FEATURE_SHARED_BUSYBOX
|
||||
@@ -227,33 +289,6 @@ config CONFIG_LFS
|
||||
cp, mount, tar, and many others. If you want to access files larger
|
||||
than 2 Gigabytes, enable this option. Otherwise, leave it set to 'N'.
|
||||
|
||||
config USING_CROSS_COMPILER
|
||||
bool "Do you want to build BusyBox with a Cross Compiler?"
|
||||
default n
|
||||
help
|
||||
Do you want to build BusyBox with a Cross Compiler? If so,
|
||||
then enable this option. Otherwise leave it set to 'N'.
|
||||
|
||||
config CROSS_COMPILER_PREFIX
|
||||
string "Cross Compiler prefix"
|
||||
default "/usr/i386-linux-uclibc/bin/i386-uclibc-"
|
||||
depends on USING_CROSS_COMPILER
|
||||
help
|
||||
If you want to build BusyBox with a cross compiler, then you
|
||||
will need to set this to the cross-compiler prefix. For example,
|
||||
if my cross-compiler is /usr/i386-linux-uclibc/bin/i386-uclibc-gcc
|
||||
then I would enter '/usr/i386-linux-uclibc/bin/i386-uclibc-' here,
|
||||
which will ensure the correct compiler is used.
|
||||
|
||||
config EXTRA_CFLAGS_OPTIONS
|
||||
string "Any extra CFLAGS options for the compiler?"
|
||||
default ""
|
||||
help
|
||||
Do you want to pass any extra CFLAGS options to the compiler as
|
||||
you build BusyBox? If so, this is the option for you... For example,
|
||||
if you want to add some simple compiler switches (like -march=i686),
|
||||
or check for warnings using -Werror, just those options here.
|
||||
|
||||
config CONFIG_BUILD_AT_ONCE
|
||||
bool "Compile all sources at once"
|
||||
default n
|
||||
@@ -278,17 +313,27 @@ endmenu
|
||||
menu 'Debugging Options'
|
||||
|
||||
config CONFIG_DEBUG
|
||||
bool "Build BusyBox with Debugging symbols"
|
||||
bool "Build BusyBox with extra Debugging symbols"
|
||||
default n
|
||||
help
|
||||
Say Y here if you wish to compile BusyBox with debugging symbols.
|
||||
This will allow you to use a debugger to examine BusyBox internals
|
||||
while applets are running. This increases the size of the binary
|
||||
considerably and should only be used when doing development.
|
||||
If you are doing development and want to debug BusyBox, answer Y.
|
||||
Say Y here if you wish to examine BusyBox internals while applets are
|
||||
running. This increases the size of the binary considerably, and
|
||||
should only be used when doing development. If you are doing
|
||||
development and want to debug BusyBox, answer Y.
|
||||
|
||||
Most people should answer N.
|
||||
|
||||
config CONFIG_DEBUG_PESSIMIZE
|
||||
bool "Disable compiler optimizations."
|
||||
default n
|
||||
depends on CONFIG_DEBUG
|
||||
help
|
||||
The compiler's optimization of source code can eliminate and reorder
|
||||
code, resulting in an executable that's hard to understand when
|
||||
stepping through it with a debugger. This switches it off, resulting
|
||||
in a much bigger executable that more closely matches the source
|
||||
code.
|
||||
|
||||
choice
|
||||
prompt "Additional debugging library"
|
||||
default CONFIG_NO_DEBUG_LIB
|
||||
@@ -335,7 +380,7 @@ config CONFIG_DEBUG_YANK_SUSv2
|
||||
bool "Disable obsolete features removed before SUSv3?"
|
||||
default y
|
||||
help
|
||||
This option will disable backwards compatability with SuSv2,
|
||||
This option will disable backwards compatibility with SuSv2,
|
||||
specifically, old-style numeric options ('command -1 <file>')
|
||||
will not be supported in head, tail, and fold. (Note: should
|
||||
yank from renice too.)
|
||||
|
||||
@@ -53,7 +53,7 @@ is run without an existing configuration, make defconfig will run first to
|
||||
create a known starting point.
|
||||
|
||||
Other starting configurations (mostly used for testing purposes) include
|
||||
"make allbaseconfig" (enables all applets but disables all optional features),
|
||||
"make allbareconfig" (enables all applets but disables all optional features),
|
||||
"make allyesconfig" (enables absolutely everything including debug features),
|
||||
and "make randconfig" (produce a random configuration).
|
||||
|
||||
|
||||
@@ -5,14 +5,20 @@
|
||||
# Licensed under GPLv2, see the file LICENSE in this tarball for details.
|
||||
#
|
||||
|
||||
#--------------------------------------------------------------
|
||||
# You shouldn't need to mess with anything beyond this point...
|
||||
#--------------------------------------------------------------
|
||||
noconfig_targets := menuconfig config oldconfig randconfig \
|
||||
# You shouldn't have to edit anything in this file for configuration
|
||||
# purposes, try "make help" or read http://busybox.net/FAQ.html.
|
||||
|
||||
.PHONY: dummy subdirs release distclean clean config oldconfig menuconfig \
|
||||
tags check test depend dep buildtree hosttools _all checkhelp \
|
||||
sizes bloatcheck baseline objsizes
|
||||
|
||||
noconfig_targets := menuconfig config oldconfig randconfig hosttools \
|
||||
defconfig allyesconfig allnoconfig allbareconfig \
|
||||
clean distclean help \
|
||||
release tags
|
||||
|
||||
nocheck_targets := clean distclean help release tags
|
||||
|
||||
# the toplevel sourcedir
|
||||
ifndef top_srcdir
|
||||
top_srcdir=$(CURDIR)
|
||||
@@ -33,27 +39,44 @@ DIRS:=applets archival archival/libunarchive coreutils console-tools \
|
||||
SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS))
|
||||
|
||||
# That's our default target when none is given on the command line
|
||||
.PHONY: _all
|
||||
_all:
|
||||
|
||||
CONFIG_CONFIG_IN = $(top_srcdir)/Config.in
|
||||
|
||||
ifeq ($(KBUILD_SRC),)
|
||||
|
||||
ifeq ($(BUILD_SRC),)
|
||||
ifdef O
|
||||
ifeq ("$(origin O)", "command line")
|
||||
KBUILD_OUTPUT := $(O)
|
||||
BUILD_OUTPUT := $(O)
|
||||
top_builddir := $(O)
|
||||
endif
|
||||
else
|
||||
# If no alternate output-dir was specified, we build in cwd
|
||||
# We are using KBUILD_OUTPUT nevertheless to make sure that we create
|
||||
# We are using BUILD_OUTPUT nevertheless to make sure that we create
|
||||
# Rules.mak and the toplevel Makefile, in case they don't exist.
|
||||
KBUILD_OUTPUT := $(top_builddir)
|
||||
BUILD_OUTPUT := $(top_builddir)
|
||||
endif
|
||||
|
||||
# see if we are in verbose mode
|
||||
BUILD_VERBOSE :=
|
||||
ifdef V
|
||||
ifeq ("$(origin V)", "command line")
|
||||
BUILD_VERBOSE := $(V)
|
||||
endif
|
||||
endif
|
||||
ifdef VERBOSE
|
||||
ifeq ("$(origin VERBOSE)", "command line")
|
||||
BUILD_VERBOSE := $(VERBOSE)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(BUILD_VERBOSE)),)
|
||||
export BUILD_VERBOSE
|
||||
CHECK_VERBOSE := -v
|
||||
# ARFLAGS+=v
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
|
||||
# pull in OS specific commands like cp, mkdir, etc. early
|
||||
# pull in settings early
|
||||
-include $(top_srcdir)/Rules.mak
|
||||
endif
|
||||
|
||||
@@ -64,40 +87,40 @@ all_tree: $(all_tree)
|
||||
$(all_tree):
|
||||
@mkdir -p "$@"
|
||||
|
||||
ifneq ($(KBUILD_OUTPUT),)
|
||||
ifneq ($(BUILD_OUTPUT),)
|
||||
# Invoke a second make in the output directory, passing relevant variables
|
||||
# Check that the output directory actually exists
|
||||
saved-output := $(KBUILD_OUTPUT)
|
||||
KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
|
||||
$(if $(wildcard $(KBUILD_OUTPUT)),, \
|
||||
saved-output := $(BUILD_OUTPUT)
|
||||
BUILD_OUTPUT := $(shell cd $(BUILD_OUTPUT) && /bin/pwd)
|
||||
$(if $(wildcard $(BUILD_OUTPUT)),, \
|
||||
$(error output directory "$(saved-output)" does not exist))
|
||||
|
||||
.PHONY: $(MAKECMDGOALS)
|
||||
|
||||
$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree
|
||||
$(Q)$(MAKE) -C $(KBUILD_OUTPUT) \
|
||||
$(filter-out _all,$(MAKECMDGOALS)) _all: $(BUILD_OUTPUT)/Rules.mak $(BUILD_OUTPUT)/Makefile all_tree
|
||||
$(Q)$(MAKE) -C $(BUILD_OUTPUT) \
|
||||
top_srcdir=$(top_srcdir) \
|
||||
top_builddir=$(top_builddir) \
|
||||
KBUILD_SRC=$(top_srcdir) \
|
||||
BUILD_SRC=$(top_srcdir) \
|
||||
-f $(CURDIR)/Makefile $@
|
||||
|
||||
$(KBUILD_OUTPUT)/Rules.mak:
|
||||
$(BUILD_OUTPUT)/Rules.mak:
|
||||
@echo > $@
|
||||
@echo top_srcdir=$(top_srcdir) >> $@
|
||||
@echo top_builddir=$(KBUILD_OUTPUT) >> $@
|
||||
@echo top_builddir=$(BUILD_OUTPUT) >> $@
|
||||
@echo include $(top_srcdir)/Rules.mak >> $@
|
||||
|
||||
$(KBUILD_OUTPUT)/Makefile:
|
||||
$(BUILD_OUTPUT)/Makefile:
|
||||
@echo > $@
|
||||
@echo top_srcdir=$(top_srcdir) >> $@
|
||||
@echo top_builddir=$(KBUILD_OUTPUT) >> $@
|
||||
@echo KBUILD_SRC='$$(top_srcdir)' >> $@
|
||||
@echo include '$$(KBUILD_SRC)'/Makefile >> $@
|
||||
@echo top_builddir=$(BUILD_OUTPUT) >> $@
|
||||
@echo BUILD_SRC='$$(top_srcdir)' >> $@
|
||||
@echo include '$$(BUILD_SRC)'/Makefile >> $@
|
||||
|
||||
# Leave processing to above invocation of make
|
||||
skip-makefile := 1
|
||||
endif # ifneq ($(KBUILD_OUTPUT),)
|
||||
endif # ifeq ($(KBUILD_SRC),)
|
||||
endif # ifneq ($(BUILD_OUTPUT),)
|
||||
endif # ifeq ($(BUILD_SRC),)
|
||||
|
||||
ifeq ($(skip-makefile),)
|
||||
|
||||
@@ -117,6 +140,7 @@ help:
|
||||
@echo ' all - Executable and documentation'
|
||||
@echo ' busybox - the swiss-army executable'
|
||||
@echo ' doc - docs/BusyBox.{txt,html,1}'
|
||||
@echo ' html - create html-based cross-reference'
|
||||
@echo
|
||||
@echo 'Configuration:'
|
||||
@echo ' allnoconfig - disable all symbols in .config'
|
||||
@@ -126,16 +150,24 @@ help:
|
||||
@echo ' defconfig - set .config to largest generic configuration'
|
||||
@echo ' menuconfig - interactive curses-based configurator'
|
||||
@echo ' oldconfig - resolve any unresolved symbols in .config'
|
||||
@echo ' hosttools - build sed for the host.'
|
||||
@echo ' You can use these commands if the commands on the host'
|
||||
@echo ' is unusable. Afterwards use it like:'
|
||||
@echo ' make SED="$(top_builddir)/sed"'
|
||||
@echo
|
||||
@echo 'Installation:'
|
||||
@echo ' install - install busybox into $(PREFIX)'
|
||||
@echo ' uninstall'
|
||||
@echo
|
||||
@echo 'Development:'
|
||||
@echo ' baseline - create busybox_old for bloatcheck.'
|
||||
@echo ' bloatcheck - show size difference between old and new versions'
|
||||
@echo ' check - run the test suite for all applets'
|
||||
@echo ' checkhelp - check for missing help-entries in Config.in'
|
||||
@echo ' randconfig - generate a random configuration'
|
||||
@echo ' release - create a distribution tarball'
|
||||
@echo ' sizes - show size of all enabled busybox symbols'
|
||||
@echo ' objsizes - show size of each .o object built'
|
||||
@echo
|
||||
|
||||
|
||||
@@ -170,7 +202,7 @@ scripts/config/mconf: scripts/config/Makefile
|
||||
fi
|
||||
|
||||
menuconfig: scripts/config/mconf
|
||||
@[ -f .config ] || make $(MAKEFLAGS) defconfig
|
||||
@[ -f .config ] || $(MAKE) $(MAKEFLAGS) defconfig
|
||||
@./scripts/config/mconf $(CONFIG_CONFIG_IN)
|
||||
|
||||
config: scripts/config/conf
|
||||
@@ -183,29 +215,39 @@ randconfig: scripts/config/conf
|
||||
@./scripts/config/conf -r $(CONFIG_CONFIG_IN)
|
||||
|
||||
allyesconfig: scripts/config/conf
|
||||
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
|
||||
@$(SED) -i -r -e "s/^(USING_CROSS_COMPILER)=.*/# \1 is not set/" .config
|
||||
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
|
||||
@./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null
|
||||
|
||||
allnoconfig: scripts/config/conf
|
||||
@./scripts/config/conf -n $(CONFIG_CONFIG_IN)
|
||||
@./scripts/config/conf -n $(CONFIG_CONFIG_IN) > /dev/null
|
||||
|
||||
# defconfig is allyesconfig minus any features that are specialized enough
|
||||
# or cause enough behavior change that the user really should switch them on
|
||||
# manually if that's what they want. Sort of "maximum sane config".
|
||||
|
||||
defconfig: scripts/config/conf
|
||||
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
|
||||
@$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG.*|STATIC|SELINUX|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config
|
||||
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
|
||||
@./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null
|
||||
@$(SED) -i -r -e "s/^(CONFIG_(DEBUG.*|STATIC|SELINUX|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config
|
||||
@./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null
|
||||
|
||||
|
||||
allbareconfig: scripts/config/conf
|
||||
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
|
||||
@$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config
|
||||
@./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null
|
||||
@$(SED) -i -r -e "s/^(CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config
|
||||
@$(SED) -i -e "/FEATURE/s/=.*//;/^[^#]/s/.*FEATURE.*/# \0 is not set/;" .config
|
||||
@echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config
|
||||
@yes n | ./scripts/config/conf -o $(CONFIG_CONFIG_IN)
|
||||
@yes n | ./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null
|
||||
|
||||
hosttools:
|
||||
$(Q)cp .config .config.bak || noold=yea
|
||||
$(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" allnoconfig
|
||||
$(Q)mv .config .config.in
|
||||
$(Q)(grep -v CONFIG_SED .config.in ; \
|
||||
echo "CONFIG_SED=y" ; ) > .config
|
||||
$(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" oldconfig include/bb_config.h
|
||||
$(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" busybox
|
||||
$(Q)[ -f .config.bak ] && mv .config.bak .config || rm .config
|
||||
mv busybox sed
|
||||
@echo "Now do: $(MAKE) SED=$(top_builddir)/sed <target>"
|
||||
|
||||
else # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
|
||||
|
||||
@@ -258,6 +300,7 @@ LIBBUSYBOX_SONAME:=$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL
|
||||
DO_INSTALL_LIBS:=$(LD_LIBBUSYBOX) \
|
||||
$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
|
||||
$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION)
|
||||
endif # CONFIG_BUILD_LIBBUSYBOX
|
||||
|
||||
ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
|
||||
ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
|
||||
@@ -269,7 +312,6 @@ $(LIBBUSYBOX_SONAME): $(LIBRARY_SRC)
|
||||
else # CONFIG_BUILD_AT_ONCE
|
||||
$(LIBBUSYBOX_SONAME): $(libbusybox-obj)
|
||||
endif # CONFIG_BUILD_AT_ONCE
|
||||
endif # CONFIG_BUILD_LIBBUSYBOX
|
||||
|
||||
ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
|
||||
LDBUSYBOX:=-L$(top_builddir) -lbusybox
|
||||
@@ -280,31 +322,25 @@ $(LIBBUSYBOX_SONAME):
|
||||
ifndef MAJOR_VERSION
|
||||
$(error MAJOR_VERSION needed for $@ is not defined)
|
||||
endif
|
||||
$(do_link) $(LIB_CFLAGS) $(CFLAGS_COMBINE) \
|
||||
$(do_link.so) \
|
||||
-Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
|
||||
-Wl,-z,combreloc $(LIB_LDFLAGS) \
|
||||
-o $(@) \
|
||||
-Wl,--start-group -Wl,--whole-archive \
|
||||
$(LIBRARY_DEFINE) $(^) \
|
||||
-Wl,--no-whole-archive -Wl,--end-group
|
||||
-Wl,-z,combreloc
|
||||
@rm -f $(DO_INSTALL_LIBS)
|
||||
@for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done
|
||||
$(do_strip)
|
||||
|
||||
endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
|
||||
|
||||
busybox_unstripped: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(libraries-y)
|
||||
$(do_link) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \
|
||||
-o $@ -Wl,--start-group \
|
||||
$(APPLETS_DEFINE) $(APPLET_SRC) \
|
||||
$(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \
|
||||
$(LDBUSYBOX) $(LIBRARIES) \
|
||||
-Wl,--end-group
|
||||
busybox_unstripped: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(libraries-y)
|
||||
$(do_link)
|
||||
|
||||
busybox: busybox_unstripped
|
||||
$(Q)cp busybox_unstripped busybox
|
||||
$(do_strip)
|
||||
|
||||
%.bflt: %_unstripped
|
||||
$(do_elf2flt)
|
||||
|
||||
busybox.links: $(top_srcdir)/applets/busybox.mkll include/bb_config.h $(top_srcdir)/include/applets.h
|
||||
$(Q)-$(SHELL) $^ >$@
|
||||
|
||||
@@ -331,24 +367,26 @@ ifneq ($(strip $(DO_INSTALL_LIBS)),n)
|
||||
done
|
||||
endif
|
||||
|
||||
# see if we are in verbose mode
|
||||
KBUILD_VERBOSE :=
|
||||
ifdef V
|
||||
ifeq ("$(origin V)", "command line")
|
||||
KBUILD_VERBOSE := $(V)
|
||||
endif
|
||||
endif
|
||||
ifneq ($(strip $(KBUILD_VERBOSE)),)
|
||||
CHECK_VERBOSE := -v
|
||||
# ARFLAGS+=v
|
||||
endif
|
||||
check test: busybox
|
||||
bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \
|
||||
$(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE)
|
||||
bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite SED="$(SED)" \
|
||||
$(SHELL) $(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE)
|
||||
|
||||
checkhelp:
|
||||
$(Q)$(top_srcdir)/scripts/checkhelp.awk \
|
||||
$(wildcard $(patsubst %,%/Config.in,$(SRC_DIRS) ./))
|
||||
|
||||
sizes: busybox_unstripped
|
||||
$(NM) --size-sort $(<)
|
||||
|
||||
bloatcheck: busybox_old busybox_unstripped
|
||||
@$(top_srcdir)/scripts/bloat-o-meter busybox_old busybox_unstripped
|
||||
|
||||
baseline: busybox_unstripped
|
||||
@mv busybox_unstripped busybox_old
|
||||
|
||||
objsizes: busybox_unstripped
|
||||
$(SHELL) $(top_srcdir)/scripts/objsizes
|
||||
|
||||
# Documentation Targets
|
||||
doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
|
||||
|
||||
@@ -384,20 +422,37 @@ docs/busybox.net/BusyBox.html: docs/busybox.pod
|
||||
|
||||
# The nifty new dependency stuff
|
||||
scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c
|
||||
$(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
|
||||
$(do_link.h)
|
||||
|
||||
DEP_INCLUDES := include/bb_config.h
|
||||
|
||||
ifeq ($(strip $(CONFIG_BBCONFIG)),y)
|
||||
DEP_INCLUDES += include/bbconfigopts.h
|
||||
|
||||
include/bbconfigopts.h: .config
|
||||
include/bbconfigopts.h: .config $(top_srcdir)/scripts/config/mkconfigs
|
||||
$(disp_gen)
|
||||
$(Q)$(top_srcdir)/scripts/config/mkconfigs > $@
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CONFIG_FEATURE_COMPRESS_USAGE)),y)
|
||||
USAGE_BIN:=scripts/usage
|
||||
$(USAGE_BIN): $(top_srcdir)/scripts/usage.c .config \
|
||||
$(top_srcdir)/include/usage.h
|
||||
$(do_link.h)
|
||||
|
||||
DEP_INCLUDES += include/usage_compressed.h
|
||||
|
||||
include/usage_compressed.h: .config $(USAGE_BIN) \
|
||||
$(top_srcdir)/scripts/usage_compressed
|
||||
$(Q)SED="$(SED)" $(SHELL) $(top_srcdir)/scripts/usage_compressed \
|
||||
"$(top_builddir)/scripts" > $@
|
||||
endif # CONFIG_FEATURE_COMPRESS_USAGE
|
||||
|
||||
# workaround alleged bug in make-3.80, make-3.81
|
||||
.NOTPARALLEL: .depend
|
||||
|
||||
depend dep: .depend
|
||||
.depend: scripts/bb_mkdep $(DEP_INCLUDES)
|
||||
.depend: scripts/bb_mkdep $(USAGE_BIN) $(DEP_INCLUDES)
|
||||
$(disp_gen)
|
||||
$(Q)rm -f .depend
|
||||
$(Q)mkdir -p include/config
|
||||
@@ -418,15 +473,18 @@ clean:
|
||||
docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
|
||||
docs/busybox.net/BusyBox.html busybox.links \
|
||||
libbusybox.so* \
|
||||
.config.old busybox busybox_unstripped
|
||||
.config.old busybox busybox_unstripped \
|
||||
include/usage_compressed.h scripts/usage
|
||||
- rm -r -f _install testsuite/links
|
||||
- find . -name .\*.flags -o -name \*.o -o -name \*.om \
|
||||
- find . -name .\*.flags -o -name \*.o -o -name \*.om -o -name \*.syn \
|
||||
-o -name \*.os -o -name \*.osm -o -name \*.a | xargs rm -f
|
||||
|
||||
distclean: clean
|
||||
- rm -f scripts/bb_mkdep
|
||||
- rm -r -f include/config $(DEP_INCLUDES)
|
||||
- find . -name .depend'*' | xargs rm -f
|
||||
rm -f scripts/bb_mkdep scripts/usage
|
||||
rm -r -f include/config include/config.h $(DEP_INCLUDES)
|
||||
find . -name .depend'*' -print0 | xargs -0 rm -f
|
||||
find . -name '*.rej' -print0 | xargs -0 rm -f
|
||||
rm -f .hdepend
|
||||
rm -f .config .config.old .config.cmd
|
||||
|
||||
release: distclean #doc
|
||||
@@ -449,8 +507,17 @@ release: distclean #doc
|
||||
tags:
|
||||
ctags -R .
|
||||
|
||||
# documentation, cross-reference
|
||||
# Modern distributions already ship synopsis packages (e.g. debian)
|
||||
# If you have an old distribution go to http://synopsis.fresco.org/
|
||||
syn_tgt := $(wildcard $(patsubst %,%/*.c,$(SRC_DIRS)))
|
||||
syn := $(patsubst %.c, %.syn, $(syn_tgt))
|
||||
|
||||
%.syn: %.c
|
||||
synopsis -p C -l Comments.SSDFilter,Comments.Previous $(INCS) -Wp,verbose,debug,preprocess,cppflags="'$(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) $(APPLETS_DEFINE) $(BUSYBOX_DEFINE)'" -o $@ $<
|
||||
html: $(syn)
|
||||
synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
|
||||
|
||||
|
||||
endif # ifeq ($(skip-makefile),)
|
||||
|
||||
.PHONY: dummy subdirs release distclean clean config oldconfig \
|
||||
menuconfig tags check test depend dep buildtree
|
||||
@@ -5,12 +5,12 @@ What is busybox:
|
||||
|
||||
BusyBox combines tiny versions of many common UNIX utilities into a single
|
||||
small executable. It provides minimalist replacements for most of the
|
||||
utilities you usually find in bzip2, coreutils, e2fsprogs, file, findutils,
|
||||
gawk, grep, inetutils, less, modutils, net-tools, procps, sed, shadow,
|
||||
sysklogd, sysvinit, tar, util-linux, and vim. The utilities in BusyBox
|
||||
often have fewer options than their full-featured cousins; however, the
|
||||
options that are included provide the expected functionality and behave
|
||||
very much like their larger counterparts.
|
||||
utilities you usually find in bzip2, coreutils, dhcp, diffutils, e2fsprogs,
|
||||
file, findutils, gawk, grep, inetutils, less, modutils, net-tools, procps,
|
||||
sed, shadow, sysklogd, sysvinit, tar, util-linux, and vim. The utilities
|
||||
in BusyBox often have fewer options than their full-featured cousins;
|
||||
however, the options that are included provide the expected functionality
|
||||
and behave very much like their larger counterparts.
|
||||
|
||||
BusyBox has been written with size-optimization and limited resources in
|
||||
mind, both to produce small binaries and to reduce run-time memory usage.
|
||||
@@ -65,11 +65,6 @@ Downloading the current source code:
|
||||
http://busybox.net/downloads/
|
||||
|
||||
You can browse the up to the minute source code and change history online.
|
||||
The "stable" series is at:
|
||||
|
||||
http://www.busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_00_stable/busybox/
|
||||
|
||||
And the development series is at:
|
||||
|
||||
http://www.busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/
|
||||
|
||||
@@ -199,5 +194,5 @@ Supported hardware:
|
||||
|
||||
Please feed suggestions, bug reports, insults, and bribes back to the busybox
|
||||
maintainer:
|
||||
Erik Andersen
|
||||
<andersen@codepoet.org>
|
||||
Rob Landley
|
||||
<rob@landley.net>
|
||||
@@ -13,8 +13,8 @@ endif
|
||||
#--------------------------------------------------------
|
||||
PROG := busybox
|
||||
MAJOR_VERSION :=1
|
||||
MINOR_VERSION :=1
|
||||
SUBLEVEL_VERSION:=1
|
||||
MINOR_VERSION :=2
|
||||
SUBLEVEL_VERSION:=0
|
||||
EXTRAVERSION :=
|
||||
VERSION :=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)$(EXTRAVERSION)
|
||||
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
|
||||
@@ -24,69 +24,47 @@ BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
|
||||
# With a modern GNU make(1) (highly recommended, that's what all the
|
||||
# developers use), all of the following configuration values can be
|
||||
# overridden at the command line. For example:
|
||||
# make CROSS=powerpc-linux- top_srcdir="$HOME/busybox" PREFIX=/mnt/app
|
||||
# make CROSS_COMPILE=powerpc-linux- top_srcdir="$HOME/busybox" PREFIX=/mnt/app
|
||||
#--------------------------------------------------------
|
||||
|
||||
# If you are running a cross compiler, you will want to set 'CROSS'
|
||||
# If you are running a cross compiler, you will want to set CROSS_COMPILE
|
||||
# to something more interesting... Target architecture is determined
|
||||
# by asking the CC compiler what arch it compiles things for, so unless
|
||||
# your compiler is broken, you should not need to specify TARGET_ARCH
|
||||
CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
|
||||
CC = $(CROSS)gcc
|
||||
AR = $(CROSS)ar
|
||||
AS = $(CROSS)as
|
||||
LD = $(CROSS)ld
|
||||
NM = $(CROSS)nm
|
||||
STRIP = $(CROSS)strip
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
AS = $(CROSS_COMPILE)as
|
||||
LD = $(CROSS_COMPILE)ld
|
||||
NM = $(CROSS_COMPILE)nm
|
||||
STRIP = $(CROSS_COMPILE)strip
|
||||
ELF2FLT = $(CROSS_COMPILE)elf2flt
|
||||
CPP = $(CC) -E
|
||||
SED ?= sed
|
||||
BZIP2 ?= bzip2
|
||||
|
||||
|
||||
# What OS are you compiling busybox for? This allows you to include
|
||||
# OS specific things, syscall overrides, etc.
|
||||
TARGET_OS=linux
|
||||
|
||||
# Select the compiler needed to build binaries for your development system
|
||||
HOSTCC = gcc
|
||||
HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
|
||||
|
||||
# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
|
||||
LC_ALL:= C
|
||||
|
||||
# If you want to add some simple compiler switches (like -march=i686),
|
||||
# especially from the command line, use this instead of CFLAGS directly.
|
||||
# For optimization overrides, it's better still to set OPTIMIZATION.
|
||||
CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
|
||||
|
||||
# To compile vs some other alternative libc, you may need to use/adjust
|
||||
# the following lines to meet your needs...
|
||||
#
|
||||
# If you are using Red Hat 6.x with the compatible RPMs (for developing under
|
||||
# Red Hat 5.x and glibc 2.0) uncomment the following. Be sure to read about
|
||||
# using the compatible RPMs (compat-*) at http://www.redhat.com !
|
||||
#LIBCDIR:=/usr/i386-glibc20-linux
|
||||
#
|
||||
# For other libraries, you are on your own. But these may (or may not) help...
|
||||
#LDFLAGS+=-nostdlib
|
||||
#LIBRARIES:=$(LIBCDIR)/lib/libc.a -lgcc
|
||||
#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) -funsigned-char
|
||||
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
|
||||
|
||||
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
|
||||
CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)
|
||||
|
||||
# This must bind late because srcdir is reset for every source subdirectory.
|
||||
INCS:=-I$(top_builddir)/include -I$(top_srcdir)/include
|
||||
CFLAGS=$(INCS) -I$(srcdir) -D_GNU_SOURCE
|
||||
CFLAGS+=$(CHECKED_CFLAGS)
|
||||
ARFLAGS=cru
|
||||
|
||||
|
||||
# gcc centric. Perhaps fiddle with findstring gcc,$(CC) for the rest
|
||||
# get the CC MAJOR/MINOR version
|
||||
CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1))
|
||||
CC_MINOR:=$(shell printf "%02d" $(shell echo __GNUC_MINOR__ | $(CC) -E -xc - | tail -n 1))
|
||||
|
||||
#--------------------------------------------------------
|
||||
export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
|
||||
export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS_COMPILE CC AR AS LD NM STRIP CPP
|
||||
ifeq ($(strip $(TARGET_ARCH)),)
|
||||
TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
|
||||
TARGET_ARCH:=$(shell $(CC) -dumpmachine | $(SED) -e s'/-.*//' \
|
||||
-e 's/i.86/i386/' \
|
||||
-e 's/sparc.*/sparc/' \
|
||||
-e 's/arm.*/arm/g' \
|
||||
@@ -100,22 +78,108 @@ TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
|
||||
)
|
||||
endif
|
||||
|
||||
# A nifty macro to make testing gcc features easier
|
||||
check_gcc=$(shell \
|
||||
if [ "$(1)" != "" ]; then \
|
||||
if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
|
||||
then echo "$(1)"; else echo "$(2)"; fi \
|
||||
# A nifty macro to make testing gcc features easier, but note that everything
|
||||
# that uses this _must_ use := or it will be re-evaluated everytime it is
|
||||
# referenced.
|
||||
ifeq ($(strip $(BUILD_VERBOSE)),2)
|
||||
VERBOSE_CHECK_CC=echo CC=\"$(1)\" check_cc $(2) >&2;
|
||||
endif
|
||||
check_cc=$(shell \
|
||||
$(VERBOSE_CHECK_CC) \
|
||||
if [ "x$(1)" != "x" ] && [ "x$(2)" != "x" ]; then \
|
||||
echo "int i;" > ./conftest.c; \
|
||||
if $(1) $(2) -c -o conftest.o conftest.c > /dev/null 2>&1; \
|
||||
then echo "$(2)"; else echo "$(3)"; fi ; \
|
||||
rm -f conftest.c conftest.o; \
|
||||
fi)
|
||||
|
||||
ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),)
|
||||
check_cc:=
|
||||
endif
|
||||
|
||||
# A not very robust macro to check for available ld flags
|
||||
ifeq ($(strip $(BUILD_VERBOSE)),2)
|
||||
VERBOSE_CHECK_LD=echo LD=\"$(1)\" check_ld $(2) >&2;
|
||||
endif
|
||||
check_ld=$(shell \
|
||||
if [ "x$(1)" != "x" ]; then \
|
||||
$(LD) --help | grep -q "\$(1)" && echo "-Wl,$(1)" ; \
|
||||
$(VERBOSE_CHECK_LD) \
|
||||
if [ "x$(1)" != "x" ] && [ "x$(2)" != "x" ]; then \
|
||||
$(1) -o /dev/null -b binary /dev/null > /dev/null 2>&1 && \
|
||||
echo "-Wl,$(2)" ; \
|
||||
fi)
|
||||
|
||||
CFLAGS+=$(call check_gcc,-funsigned-char,)
|
||||
ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),)
|
||||
check_ld:=
|
||||
endif
|
||||
|
||||
# A not very robust macro to check for available strip flags
|
||||
ifeq ($(strip $(BUILD_VERBOSE)),2)
|
||||
VERBOSE_CHECK_STRIP=echo STRIPCMD=\"$(1)\" check_strip $(2) >&2;
|
||||
endif
|
||||
check_strip=$(shell \
|
||||
$(VERBOSE_CHECK_STRIP) \
|
||||
if [ "x$(1)" != "x" ] && [ "x$(2)" != "x" ]; then \
|
||||
echo "int i;" > ./conftest.c ; \
|
||||
$(CC) -c -o conftest.o conftest.c > /dev/null 2>&1 ; \
|
||||
$(1) $(2) conftest.o > /dev/null 2>&1 && \
|
||||
echo "$(1) $(2)" || echo "$(3)"; \
|
||||
rm -f conftest.c conftest.o > /dev/null 2>&1 ; \
|
||||
fi)
|
||||
|
||||
ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),)
|
||||
check_strip:=
|
||||
endif
|
||||
|
||||
|
||||
# Select the compiler needed to build binaries for your development system
|
||||
HOSTCC = gcc
|
||||
HOSTCFLAGS:=$(call check_cc,$(HOSTCC),-Wall,)
|
||||
HOSTCFLAGS+=$(call check_cc,$(HOSTCC),-Wstrict-prototypes,)
|
||||
HOSTCFLAGS+=$(call check_cc,$(HOSTCC),-O2,)
|
||||
HOSTCFLAGS+=$(call check_cc,$(HOSTCC),-fomit-frame-pointer,)
|
||||
|
||||
LD_WHOLE_ARCHIVE:=$(shell echo "int i;" > conftest.c ; \
|
||||
$(CC) -c -o conftest.o conftest.c ; \
|
||||
echo "int main(void){return 0;}" > conftest_main.c ; \
|
||||
$(CC) -c -o conftest_main.o conftest_main.c ; \
|
||||
$(AR) $(ARFLAGS) conftest.a conftest.o ; \
|
||||
$(CC) -Wl,--whole-archive conftest.a -Wl,--no-whole-archive \
|
||||
conftest_main.o -o conftest > /dev/null 2>&1 \
|
||||
&& echo "-Wl,--whole-archive" ; \
|
||||
rm conftest_main.o conftest_main.c conftest.o conftest.c \
|
||||
conftest.a conftest > /dev/null 2>&1 ; )
|
||||
ifneq ($(findstring whole-archive,$(LD_WHOLE_ARCHIVE)),)
|
||||
LD_NO_WHOLE_ARCHIVE:= -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
LD_START_GROUP:=$(shell echo "int bar(void){return 0;}" > conftest.c ; \
|
||||
$(CC) -c -o conftest.o conftest.c ; \
|
||||
echo "int main(void){return bar();}" > conftest_main.c ; \
|
||||
$(CC) -c -o conftest_main.o conftest_main.c ; \
|
||||
$(AR) $(ARFLAGS) conftest.a conftest.o ; \
|
||||
$(CC) -Wl,--start-group conftest.a conftest_main.o -Wl,--end-group \
|
||||
-o conftest > /dev/null 2>&1 && echo "-Wl,--start-group" ; \
|
||||
rm conftest_main.o conftest_main.c conftest.o conftest.c \
|
||||
conftest.a conftest > /dev/null 2>&1 ; )
|
||||
ifneq ($(findstring start-group,$(LD_START_GROUP)),)
|
||||
LD_END_GROUP:= -Wl,--end-group
|
||||
endif
|
||||
|
||||
CHECKED_LDFLAGS := $(call check_ld,$(LD),--warn-common,)
|
||||
|
||||
# Pin CHECKED_CFLAGS with := so it's only evaluated once.
|
||||
CHECKED_CFLAGS:=$(call check_cc,$(CC),-Wall,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(HOSTCC),-Werror,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wstrict-prototypes,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wshadow,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-funsigned-char,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-mmax-stack-frame=256,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-fno-builtin-strlen)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-finline-limit=0)
|
||||
|
||||
# Preemptively pin this too.
|
||||
PROG_CFLAGS:=
|
||||
|
||||
CFLAGS+=$(call check_gcc,-mmax-stack-frame=256,)
|
||||
|
||||
#--------------------------------------------------------
|
||||
# Arch specific compiler optimization stuff should go here.
|
||||
@@ -123,22 +187,26 @@ CFLAGS+=$(call check_gcc,-mmax-stack-frame=256,)
|
||||
# for OPTIMIZATION...
|
||||
|
||||
# use '-Os' optimization if available, else use -O2
|
||||
OPTIMIZATION:=$(call check_gcc,-Os,-O2)
|
||||
OPTIMIZATION:=$(call check_cc,$(CC),-Os,-O2)
|
||||
|
||||
ifeq ($(CONFIG_BUILD_AT_ONCE),y)
|
||||
# gcc 2.95 exits with 0 for "unrecognized option"
|
||||
ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 3 ] ; echo $$?)),0)
|
||||
CFLAGS_COMBINE:=$(call check_gcc,--combine,)
|
||||
CFLAGS_COMBINE:=$(call check_cc,$(CC),--combine,)
|
||||
endif
|
||||
OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-funit-at-a-time,)
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-fgcse-after-reload,)
|
||||
ifneq ($(CONFIG_BUILD_LIBBUSYBOX),y)
|
||||
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25795
|
||||
#PROG_CFLAGS+=$(call check_gcc,-fwhole-program,)
|
||||
# This prevents us from using -fwhole-program when we build the lib
|
||||
PROG_CFLAGS+=$(call check_cc,$(CC),-fwhole-program,)
|
||||
endif # CONFIG_BUILD_LIBBUSYBOX
|
||||
endif # CONFIG_BUILD_AT_ONCE
|
||||
|
||||
LIB_LDFLAGS:=$(call check_ld,--enable-new-dtags,)
|
||||
#LIB_LDFLAGS+=$(call check_ld,--reduce-memory-overheads,)
|
||||
#LIB_LDFLAGS+=$(call check_ld,--as-needed,)
|
||||
#LIB_LDFLAGS+=$(call check_ld,--warn-shared-textrel,)
|
||||
LIB_LDFLAGS:=$(call check_ld,$(LD),--enable-new-dtags,)
|
||||
#LIB_LDFLAGS+=$(call check_ld,$(LD),--reduce-memory-overheads,)
|
||||
#LIB_LDFLAGS+=$(call check_ld,$(LD),--as-needed,)
|
||||
#LIB_LDFLAGS+=$(call check_ld,$(LD),--warn-shared-textrel,)
|
||||
|
||||
|
||||
# Some nice architecture specific optimizations
|
||||
@@ -146,25 +214,26 @@ ifeq ($(strip $(TARGET_ARCH)),arm)
|
||||
OPTIMIZATION+=-fstrict-aliasing
|
||||
endif
|
||||
ifeq ($(strip $(TARGET_ARCH)),i386)
|
||||
OPTIMIZATION+=$(call check_gcc,-march=i386,)
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-march=i386,)
|
||||
# gcc-4.0 and older seem to benefit from these
|
||||
#ifneq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
|
||||
OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
|
||||
OPTIMIZATION+=$(call check_gcc,-falign-functions=1 -falign-jumps=1 -falign-loops=1,\
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-mpreferred-stack-boundary=2,)
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-falign-functions=1 -falign-jumps=1 -falign-loops=1,\
|
||||
-malign-functions=0 -malign-jumps=0 -malign-loops=0)
|
||||
#endif # gcc-4.0 and older
|
||||
|
||||
# gcc-4.1 and beyond seem to benefit from these
|
||||
ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
|
||||
# turn off flags which hurt -Os
|
||||
OPTIMIZATION+=$(call check_gcc,-fno-tree-loop-optimize,)
|
||||
OPTIMIZATION+=$(call check_gcc,-fno-tree-dominator-opts,)
|
||||
OPTIMIZATION+=$(call check_gcc,-fno-strength-reduce,)
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-fno-tree-loop-optimize,)
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-fno-tree-dominator-opts,)
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-fno-strength-reduce,)
|
||||
|
||||
OPTIMIZATION+=$(call check_gcc,-fno-branch-count-reg,)
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-fno-branch-count-reg,)
|
||||
endif # gcc-4.1 and beyond
|
||||
endif
|
||||
OPTIMIZATIONS:=$(OPTIMIZATION) $(call check_gcc,-fomit-frame-pointer,)
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-fomit-frame-pointer,)
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-ffunction-sections -fdata-sections,)
|
||||
|
||||
#
|
||||
#--------------------------------------------------------
|
||||
@@ -188,27 +257,43 @@ else
|
||||
LIBRARIES:=-lefence
|
||||
endif
|
||||
endif
|
||||
|
||||
# Debugging info
|
||||
|
||||
ifeq ($(strip $(CONFIG_DEBUG)),y)
|
||||
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
|
||||
LDFLAGS += $(call check_ld,--warn-common,)
|
||||
CFLAGS +=-g
|
||||
else
|
||||
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
|
||||
LDFLAGS += $(call check_ld,--warn-common,)
|
||||
LDFLAGS += $(call check_ld,--sort-common,)
|
||||
CFLAGS +=-DNDEBUG
|
||||
CHECKED_LDFLAGS += $(call check_ld,$(LD),--sort-common,)
|
||||
CHECKED_LDFLAGS += $(call check_ld,--gc-sections,)
|
||||
endif
|
||||
STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
|
||||
|
||||
ifneq ($(strip $(CONFIG_DEBUG_PESSIMIZE)),y)
|
||||
CFLAGS += $(OPTIMIZATION)
|
||||
endif
|
||||
|
||||
# warn a bit more verbosely for non-release versions
|
||||
ifneq ($(EXTRAVERSION),)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wstrict-prototypes,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wmissing-prototypes,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wmissing-declarations,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wunused,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Winit-self,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wshadow,)
|
||||
CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wcast-align,)
|
||||
endif
|
||||
STRIPCMD:=$(call check_strip,$(STRIP),-s --remove-section=.note --remove-section=.comment,$(STRIP))
|
||||
ifeq ($(strip $(CONFIG_STATIC)),y)
|
||||
PROG_CFLAGS += $(call check_gcc,-static,)
|
||||
PROG_CFLAGS += $(call check_cc,$(CC),-static,)
|
||||
endif
|
||||
CFLAGS_SHARED += $(call check_gcc,-shared,)
|
||||
CFLAGS_SHARED := $(call check_cc,$(CC),-shared,)
|
||||
LIB_CFLAGS+=$(CFLAGS_SHARED)
|
||||
|
||||
ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
|
||||
CFLAGS_PIC:= $(call check_gcc,-fPIC,)
|
||||
CFLAGS_PIC:= $(call check_cc,$(CC),-fPIC,)
|
||||
LIB_CFLAGS+=$(CFLAGS_PIC)
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(strip $(CONFIG_SELINUX)),y)
|
||||
LIBRARIES += -lselinux
|
||||
endif
|
||||
@@ -217,6 +302,10 @@ ifeq ($(strip $(PREFIX)),)
|
||||
PREFIX:=`pwd`/_install
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(CONFIG_GETOPT_LONG)),y)
|
||||
CFLAGS += -D__need_getopt
|
||||
endif
|
||||
|
||||
# Additional complications due to support for pristine source dir.
|
||||
# Include files in the build directory should take precedence over
|
||||
# the copy in top_srcdir, both during the compilation phase and the
|
||||
@@ -225,14 +314,16 @@ endif
|
||||
|
||||
|
||||
OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
|
||||
CFLAGS += $(CROSS_CFLAGS)
|
||||
CFLAGS += $(CHECKED_CFLAGS) $(CROSS_CFLAGS)
|
||||
LDFLAGS += $(CHECKED_LDFLAGS)
|
||||
|
||||
ifdef BB_INIT_SCRIPT
|
||||
CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
|
||||
endif
|
||||
|
||||
# Put user-supplied flags at the end, where they
|
||||
# have a chance of winning.
|
||||
CFLAGS += $(CFLAGS_EXTRA)
|
||||
-include $(top_builddir)/.config.mak
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Installation options
|
||||
@@ -256,7 +347,7 @@ SECHO := @-false
|
||||
DISP := sil
|
||||
Q := @
|
||||
else
|
||||
ifneq ($(V)$(VERBOSE),)
|
||||
ifneq ($(BUILD_VERBOSE),)
|
||||
SECHO := @-false
|
||||
DISP := ver
|
||||
Q :=
|
||||
@@ -272,33 +363,65 @@ pur_disp_compile.c = echo " "CC $(show_objs)
|
||||
pur_disp_compile.h = echo " "HOSTCC $(show_objs)
|
||||
pur_disp_strip = echo " "STRIP $(show_objs)
|
||||
pur_disp_link = echo " "LINK $(show_objs)
|
||||
pur_disp_link.h = echo " "HOSTLINK $(show_objs)
|
||||
pur_disp_ar = echo " "AR $(ARFLAGS) $(show_objs)
|
||||
pur_disp_elf2flt = echo " "ELF2FLT $(ELF2FLTFLAGS) $(show_objs)
|
||||
sil_disp_compile.c = true
|
||||
sil_disp_compile.h = true
|
||||
sil_disp_strip = true
|
||||
sil_disp_link = true
|
||||
sil_disp_link.h = true
|
||||
sil_disp_ar = true
|
||||
sil_disp_elf2flt = true
|
||||
ver_disp_compile.c = echo $(cmd_compile.c)
|
||||
ver_disp_compile.h = echo $(cmd_compile.h)
|
||||
ver_disp_strip = echo $(cmd_strip)
|
||||
ver_disp_link = echo $(cmd_link)
|
||||
ver_disp_link.h = echo $(cmd_link.h)
|
||||
ver_disp_ar = echo $(cmd_ar)
|
||||
ver_disp_elf2flt = echo $(cmd_elf2flt)
|
||||
disp_compile.c = $($(DISP)_disp_compile.c)
|
||||
disp_compile.h = $($(DISP)_disp_compile.h)
|
||||
disp_strip = $($(DISP)_disp_strip)
|
||||
disp_link = $($(DISP)_disp_link)
|
||||
disp_link.h = $($(DISP)_disp_link.h)
|
||||
disp_ar = $($(DISP)_disp_ar)
|
||||
disp_gen = $(SECHO) " "GEN $@ ; true
|
||||
disp_doc = $(SECHO) " "DOC $(subst docs/,,$@) ; true
|
||||
disp_elf2flt = $($(DISP)_disp_elf2flt)
|
||||
cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
|
||||
cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) -c -o $@ $<
|
||||
cmd_strip = $(STRIPCMD) $@
|
||||
cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS)
|
||||
cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) \
|
||||
$(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \
|
||||
-o $@ $(LD_START_GROUP) \
|
||||
$(APPLETS_DEFINE) $(APPLET_SRC) \
|
||||
$(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \
|
||||
$(LDBUSYBOX) $(LIBRARIES) \
|
||||
$(LD_END_GROUP)
|
||||
cmd_link.so = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) \
|
||||
$(LIB_CFLAGS) $(CFLAGS_COMBINE) $(LIB_LDFLAGS) \
|
||||
-o $(@) $(LD_START_GROUP) $(LD_WHOLE_ARCHIVE) \
|
||||
$(LIBRARY_DEFINE) $(^) \
|
||||
$(LD_NO_WHOLE_ARCHIVE) $(LD_END_GROUP)
|
||||
cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) $< -o $@
|
||||
cmd_ar = $(AR) $(ARFLAGS) $@ $^
|
||||
cmd_elf2flt = $(ELF2FLT) $(ELF2FLTFLAGS) $< -o $@
|
||||
compile.c = @$(disp_compile.c) ; $(cmd_compile.c)
|
||||
compile.h = @$(disp_compile.h) ; $(cmd_compile.h)
|
||||
do_strip = @$(disp_strip) ; $(cmd_strip)
|
||||
do_link = @$(disp_link) ; $(cmd_link)
|
||||
do_link.so = @$(disp_link) ; $(cmd_link.so)
|
||||
do_link.h = @$(disp_link.h) ; $(cmd_link.h)
|
||||
do_ar = @$(disp_ar) ; $(cmd_ar)
|
||||
do_elf2flt = @$(disp_elf2flt) ; $(cmd_elf2flt)
|
||||
|
||||
uppercase = $(shell echo $1 | $(SED) -e "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/")
|
||||
%.a:
|
||||
@if test -z "$($(call uppercase,$*)_DIR)" ; then \
|
||||
echo "Invalid target $@" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
$(Q)$(MAKE) $($(call uppercase,$*)_DIR)$@
|
||||
|
||||
.PHONY: dummy
|
||||
@@ -1,31 +1,138 @@
|
||||
Busybox TODO
|
||||
|
||||
Stuff that needs to be done. All of this is fair game for 1.2.
|
||||
Stuff that needs to be done. This is organized by who plans to get around to
|
||||
doing it eventually, but that doesn't mean they "own" the item. If you want to
|
||||
do one of these bounce an email off the person it's listed under to see if they
|
||||
have any suggestions how they plan to go about it, and to minimize conflicts
|
||||
between your work and theirs. But otherwise, all of these are fair game.
|
||||
|
||||
Rob Landley <rob@landley.net>:
|
||||
Add BB_NOMMU to platform.h and migrate __uClinux__ tests to that.
|
||||
#if defined __UCLIBC__ && !defined __ARCH_USE_MMU__
|
||||
Add a libbb/platform.c
|
||||
Implement fdprintf() for platforms that haven't got one.
|
||||
Implement bb_realpath() that can handle NULL on non-glibc.
|
||||
Cleanup bb_asprintf()
|
||||
|
||||
Migrate calloc() and bb_calloc() occurrences to bb_xzalloc().
|
||||
Remove obsolete _() wrapper crud for internationalization we don't do.
|
||||
Figure out where we need utf8 support, and add it.
|
||||
|
||||
sh
|
||||
The command shell situation is a big mess. We have three or four different
|
||||
shells that don't really share any code, and the "standalone shell" doesn't
|
||||
work all that well (especially not in a chroot environment), due to apps not
|
||||
being reentrant. I'm writing a new shell (bbsh) to unify the various
|
||||
shells and configurably add the minimal set of bash features people
|
||||
actually use. The hardest part is it has to configure down as small as
|
||||
lash while providing lash's features. The rest is easy in comparison.
|
||||
bzip2
|
||||
Compression-side support.
|
||||
init
|
||||
General cleanup (should use ENABLE_FEATURE_INIT_SYSLOG and ENABLE_FEATURE_INIT_DEBUG).
|
||||
depmod
|
||||
busybox lacks a way to update module deps when running from firmware without the
|
||||
use of the depmod.pl (perl is to bloated for most embedded setups) and or orig
|
||||
modutils. The orig depmod is rather pointless to have to add to a firmware image
|
||||
in when we already have a insmod/rmmod and friends.
|
||||
Unify base64 handling.
|
||||
There's base64 encoding and decoding going on in:
|
||||
networking/wget.c:base64enc()
|
||||
coreutils/uudecode.c:read_base64()
|
||||
coreutils/uuencode.c:tbl_base64[]
|
||||
networking/httpd.c:decodeBase64()
|
||||
And probably elsewhere. That needs to be unified into libbb functions.
|
||||
Do a SUSv3 audit
|
||||
Look at the full Single Unix Specification version 3 (available online at
|
||||
"http://www.opengroup.org/onlinepubs/009695399/nfindex.html") and
|
||||
figure out which of our apps are compliant, and what we're missing that
|
||||
we might actually care about.
|
||||
|
||||
Even better would be some kind of automated compliance test harness that
|
||||
exercises each command line option and the various corner cases.
|
||||
Internationalization
|
||||
How much internationalization should we do?
|
||||
|
||||
The low hanging fruit is UTF-8 character set support. We should do this.
|
||||
(Vodz pointed out the shell's cmdedit as needing work here. What else?)
|
||||
|
||||
We also have lots of hardwired english text messages. Consolidating this
|
||||
into some kind of message table not only makes translation easier, but
|
||||
also allows us to consolidate redundant (or close) strings.
|
||||
|
||||
We probably don't want to be bloated with locale support. (Not unless we
|
||||
can cleanly export it from our underlying C library without having to
|
||||
concern ourselves with it directly. Perhaps a few specific things like a
|
||||
config option for "date" are low hanging fruit here?)
|
||||
|
||||
What level should things happen at? How much do we care about
|
||||
internationalizing the text console when X11 and xterms are so much better
|
||||
at it? (There's some infrastructure here we don't implement: The
|
||||
"unicode_start" and "unicode_stop" shell scripts need "vt-is-UTF8" and a
|
||||
--unicode option to loadkeys. That implies a real loadkeys/dumpkeys
|
||||
implementation to replace loadkmap/dumpkmap. Plus messing with console font
|
||||
loading. Is it worth it, or do we just say "use X"?)
|
||||
|
||||
Individual compilation of applets.
|
||||
It would be nice if busybox had the option to compile to individual applets,
|
||||
for people who want an alternate implementation less bloated than the gnu
|
||||
utils (or simply with less political baggage), but without it being one big
|
||||
executable.
|
||||
|
||||
Turning libbb into a real dll is another possibility, especially if libbb
|
||||
could export some of the other library interfaces we've already more or less
|
||||
got the code for (like zlib).
|
||||
buildroot - Make a "dogfood" option
|
||||
Busybox 1.1 will be capable of replacing most gnu packages for real world
|
||||
use, such as developing software or in a live CD. It needs wider testing.
|
||||
|
||||
Busybox should now be able to replace bzip2, coreutils, e2fsprogs, file,
|
||||
findutils, gawk, grep, inetutils, less, modutils, net-tools, patch, procps,
|
||||
sed, shadow, sysklogd, sysvinit, tar, util-linux, and vim. The resulting
|
||||
system should be self-hosting (I.E. able to rebuild itself from source
|
||||
code). This means it would need (at least) binutils, gcc, and make, or
|
||||
equivalents.
|
||||
|
||||
It would be a good "eating our own dogfood" test if buildroot had the option
|
||||
of using a "make allyesconfig" busybox instead of the all of the above
|
||||
packages. Anything that's wrong with the resulting system, we can fix. (It
|
||||
would be nice to be able to upgrade busybox to be able to replace bash and
|
||||
diffutils as well, but we're not there yet.)
|
||||
|
||||
One example of an existing system that does this already is Firmware Linux:
|
||||
http://www.landley.net/code/firmware
|
||||
initramfs
|
||||
Busybox should have a sample initramfs build script. This depends on
|
||||
bbsh, mdev, and switch_root.
|
||||
mkdep
|
||||
Write a mkdep that doesn't segfault if there's a directory it doesn't
|
||||
have permission to read, isn't based on manually editing the output of
|
||||
lexx and yacc, doesn't make such a mess under include/config, etc.
|
||||
Group globals into unions of structures.
|
||||
Go through and turn all the global and static variables into structures,
|
||||
and have all those structures be in a big union shared between processes,
|
||||
so busybox uses less bss. (This is a big win on nommu machines.) See
|
||||
sed.c and mdev.c for examples.
|
||||
Go through bugs.busybox.net and close out all of that somehow.
|
||||
This one's open to everybody, but I'll wind up doing it...
|
||||
|
||||
|
||||
Bernhard Fischer <rep.nop@anon.at>:
|
||||
Makefile stuff:
|
||||
make -j is broken, -j1 is forced atm
|
||||
New debug options:
|
||||
-Wlarger-than-127
|
||||
Collate BUFSIZ IOBUF_SIZE MY_BUF_SIZE PIPE_PROGRESS_SIZE BUFSIZE PIPESIZE
|
||||
Use bb_common_bufsiz1?
|
||||
|
||||
As yet unclaimed:
|
||||
|
||||
build system
|
||||
make -j is broken, -j1 is forced atm
|
||||
Make sure that the flags get pinned in e.g. Rules.mak so when expanding them
|
||||
later on you get the cached result without the need to re-evaluate them.
|
||||
----
|
||||
find
|
||||
doesn't understand (), lots of susv3 stuff.
|
||||
----
|
||||
sh
|
||||
The command shell situation is a big mess. We have three or four different
|
||||
shells that don't really share any code, and the "standalone shell" doesn't
|
||||
work all that well (especially not in a chroot environment), due to apps not
|
||||
being reentrant. Unifying the various shells and figuring out a configurable
|
||||
way of adding the minimal set of bash features a given script uses is a big
|
||||
job, but it would be a big improvement.
|
||||
|
||||
Note: Rob Landley (rob@landley.net) is working on a new unified shell called
|
||||
bbsh, but it's a low priority...
|
||||
---
|
||||
diff
|
||||
We should have a diff -u command. We have patch, we should have diff
|
||||
(we only need to support unified diffs though).
|
||||
|
||||
Also, make sure we handle empty files properly:
|
||||
Make sure we handle empty files properly:
|
||||
From the patch man page:
|
||||
|
||||
you can remove a file by sending out a context diff that compares
|
||||
@@ -48,17 +155,11 @@ man
|
||||
|
||||
(How doclifter might work into this is anybody's guess.)
|
||||
---
|
||||
bzip2
|
||||
Compression-side support.
|
||||
---
|
||||
init
|
||||
General cleanup.
|
||||
---
|
||||
ar
|
||||
Write support?
|
||||
---
|
||||
mdev
|
||||
Micro-udev.
|
||||
crond
|
||||
turn FEATURE_DEBUG_OPT into ENABLE_FEATURE_CROND_DEBUG_OPT
|
||||
|
||||
Architectural issues:
|
||||
|
||||
@@ -74,46 +175,6 @@ bb_close() with fsync()
|
||||
You need to call fsync() if you care about errors that occur after write(),
|
||||
but that can have a big performance impact. So make it a config option.
|
||||
---
|
||||
Unify base64 handling.
|
||||
There's base64 encoding and decoding going on in:
|
||||
networking/wget.c:base64enc()
|
||||
coreutils/uudecode.c:read_base64()
|
||||
coreutils/uuencode.c:tbl_base64[]
|
||||
networking/httpd.c:decodeBase64()
|
||||
And probably elsewhere. That needs to be unified into libbb functions.
|
||||
---
|
||||
Do a SUSv3 audit
|
||||
Look at the full Single Unix Specification version 3 (available online at
|
||||
"http://www.opengroup.org/onlinepubs/009695399/nfindex.html") and
|
||||
figure out which of our apps are compliant, and what we're missing that
|
||||
we might actually care about.
|
||||
|
||||
Even better would be some kind of automated compliance test harness that
|
||||
exercises each command line option and the various corner cases.
|
||||
---
|
||||
Internationalization
|
||||
How much internationalization should we do?
|
||||
|
||||
The low hanging fruit is UTF-8 character set support. We should do this.
|
||||
(Vodz pointed out the shell's cmdedit as needing work here. What else?)
|
||||
|
||||
We also have lots of hardwired english text messages. Consolidating this
|
||||
into some kind of message table not only makes translation easier, but
|
||||
also allows us to consolidate redundant (or close) strings.
|
||||
|
||||
We probably don't want to be bloated with locale support. (Not unless we can
|
||||
cleanly export it from our underlying C library without having to concern
|
||||
ourselves with it directly. Perhaps a few specific things like a config
|
||||
option for "date" are low hanging fruit here?)
|
||||
|
||||
What level should things happen at? How much do we care about
|
||||
internationalizing the text console when X11 and xterms are so much better
|
||||
at it? (There's some infrastructure here we don't implement: The
|
||||
"unicode_start" and "unicode_stop" shell scripts need "vt-is-UTF8" and a
|
||||
--unicode option to loadkeys. That implies a real loadkeys/dumpkeys
|
||||
implementation to replace loadkmap/dumpkmap. Plus messing with console font
|
||||
loading. Is it worth it, or do we just say "use X"?)
|
||||
---
|
||||
Unify archivers
|
||||
Lots of archivers have the same general infrastructure. The directory
|
||||
traversal code should be factored out, and the guts of each archiver could
|
||||
@@ -129,45 +190,12 @@ Text buffer support.
|
||||
a whole file into memory and act on it. There might be an opportunity
|
||||
for shared code in there that could be moved into libbb...
|
||||
---
|
||||
Individual compilation of applets.
|
||||
It would be nice if busybox had the option to compile to individual applets,
|
||||
for people who want an alternate implementation less bloated than the gnu
|
||||
utils (or simply with less political baggage), but without it being one big
|
||||
executable.
|
||||
|
||||
Turning libbb into a real dll is another possibility, especially if libbb
|
||||
could export some of the other library interfaces we've already more or less
|
||||
got the code for (like zlib).
|
||||
---
|
||||
buildroot - Make a "dogfood" option
|
||||
Busybox 1.1 will be capable of replacing most gnu packages for real world use,
|
||||
such as developing software or in a live CD. It needs wider testing.
|
||||
|
||||
Busybox should now be able to replace bzip2, coreutils, e2fsprogs, file,
|
||||
findutils, gawk, grep, inetutils, less, modutils, net-tools, patch, procps,
|
||||
sed, shadow, sysklogd, sysvinit, tar, util-linux, and vim. The resulting
|
||||
system should be self-hosting (I.E. able to rebuild itself from source code).
|
||||
This means it would need (at least) binutils, gcc, and make, or equivalents.
|
||||
|
||||
It would be a good "eating our own dogfood" test if buildroot had the option
|
||||
of using a "make allyesconfig" busybox instead of the all of the above
|
||||
packages. Anything that's wrong with the resulting system, we can fix. (It
|
||||
would be nice to be able to upgrade busybox to be able to replace bash and
|
||||
diffutils as well, but we're not there yet.)
|
||||
|
||||
One example of an existing system that does this already is Firmware Linux:
|
||||
http://www.landley.net/code/firmware
|
||||
---
|
||||
initramfs
|
||||
Busybox should have a sample initramfs build script. This depends on
|
||||
bbsh, mdev, and switch_root.
|
||||
---
|
||||
Memory Allocation
|
||||
We have a CONFIG_BUFFER mechanism that lets us select whether to do memory
|
||||
allocation on the stack or the heap. Unfortunately, we're not using it much.
|
||||
We need to audit our memory allocations and turn a lot of malloc/free calls
|
||||
into RESERVE_CONFIG_BUFFER/RELEASE_CONFIG_BUFFER.
|
||||
For a start, see e.g. make CFLAGS_EXTRA=-Wlarger-than-64
|
||||
For a start, see e.g. make EXTRA_CFLAGS=-Wlarger-than-64
|
||||
|
||||
And while we're at it, many of the CONFIG_FEATURE_CLEAN_UP #ifdefs will be
|
||||
optimized out by the compiler in the stack allocation case (since there's no
|
||||
@@ -247,6 +275,24 @@ Minor stuff:
|
||||
if(!ioctl (fd, WDIOC_GETTIMEOUT, &tmo)) timer_duration = 1 + (tmo / 2);
|
||||
Unfortunately, that needs linux/watchdog.h and that contains unfiltered
|
||||
kernel types on some distros, which breaks the build.
|
||||
---
|
||||
use bb_error_msg where appropriate: See
|
||||
egrep "(printf.*\([[:space:]]*(stderr|2)|[^_]write.*\([[:space:]]*(stderr|2))"
|
||||
---
|
||||
use bb_perror_msg where appropriate: See
|
||||
egrep "[^_]perror"
|
||||
---
|
||||
Remove superfluous fmt occurances: e.g.
|
||||
fprintf(stderr, "%s: %s not found\n", "unalias", *argptr);
|
||||
-> fprintf(stderr, "unalias: %s not found\n", *argptr);
|
||||
---
|
||||
possible code duplication ingroup() and is_a_group_member()
|
||||
---
|
||||
unify itoa: netstat.c, hush.c, lash.c, msh.c
|
||||
Put one single, robust version into e.g. safe_strtol.c
|
||||
---
|
||||
Move __get_hz() to a better place and (re)use it in route.c, ash.c, msh.c
|
||||
---
|
||||
|
||||
|
||||
Code cleanup:
|
||||
@@ -257,4 +303,6 @@ bzero() -> memset()
|
||||
---
|
||||
sigblock(), siggetmask(), sigsetmask(), sigmask() -> sigprocmask et al
|
||||
---
|
||||
vdprintf() -> similar sized functionality
|
||||
---
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ top_builddir=..
|
||||
endif
|
||||
srcdir=$(top_srcdir)/applets
|
||||
APPLETS_DIR:=./
|
||||
include $(top_builddir)/Rules.mak
|
||||
include $(top_srcdir)/Rules.mak
|
||||
include $(top_builddir)/.config
|
||||
include $(srcdir)/Makefile.in
|
||||
all: $(libraries-y)
|
||||
|
||||
+89
-80
@@ -6,48 +6,33 @@
|
||||
* isn't something I'm going to worry about... If you wrote something
|
||||
* here, please feel free to acknowledge your work.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Based in part on code from sash, Copyright (c) 1999 by David I. Bell
|
||||
* Permission has been granted to redistribute this code under the GPL.
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file License in this tarball for details.
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "busybox.h"
|
||||
|
||||
const char usage_messages[] =
|
||||
|
||||
#if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE
|
||||
static const char usage_messages[] =
|
||||
#define MAKE_USAGE
|
||||
#include "usage.h"
|
||||
|
||||
#include "applets.h"
|
||||
|
||||
;
|
||||
|
||||
#undef MAKE_USAGE
|
||||
#else
|
||||
#define usage_messages 0
|
||||
#endif /* ENABLE_SHOW_USAGE */
|
||||
|
||||
#undef APPLET
|
||||
#undef APPLET_NOUSAGE
|
||||
#undef PROTOTYPES
|
||||
#include "applets.h"
|
||||
|
||||
|
||||
static struct BB_applet *applet_using;
|
||||
|
||||
/* The -1 arises because of the {0,NULL,0,-1} entry above. */
|
||||
@@ -56,7 +41,6 @@ const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
|
||||
|
||||
#ifdef CONFIG_FEATURE_SUID_CONFIG
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
#include "pwd_.h"
|
||||
#include "grp_.h"
|
||||
@@ -112,7 +96,7 @@ static char *get_trimmed_slice(char *s, char *e)
|
||||
|
||||
/* Next, advance past all leading space and return a ptr to the
|
||||
* first non-space char; possibly the terminating nul. */
|
||||
return (char *) bb_skip_whitespace(s);
|
||||
return skip_whitespace(s);
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +237,7 @@ static void parse_config_file(void)
|
||||
|
||||
/* Get the specified mode. */
|
||||
|
||||
e = (char *) bb_skip_whitespace(e+1);
|
||||
e = skip_whitespace(e+1);
|
||||
|
||||
for (i=0 ; i < 3 ; i++) {
|
||||
const char *q;
|
||||
@@ -266,7 +250,7 @@ static void parse_config_file(void)
|
||||
|
||||
/* Now get the the user/group info. */
|
||||
|
||||
s = (char *) bb_skip_whitespace(e);
|
||||
s = skip_whitespace(e);
|
||||
|
||||
/* Note: We require whitespace between the mode and the
|
||||
* user/group info. */
|
||||
@@ -359,22 +343,15 @@ static void check_suid (struct BB_applet *applet)
|
||||
bb_error_msg_and_die ("You have no permission to run this applet!");
|
||||
|
||||
if ((sct->m_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { /* *both* have to be set for sgid */
|
||||
if (setegid (sct->m_gid))
|
||||
bb_error_msg_and_die
|
||||
("BusyBox binary has insufficient rights to set proper GID for applet!");
|
||||
} else
|
||||
setgid (rgid); /* no sgid -> drop */
|
||||
xsetgid(sct->m_gid);
|
||||
} else xsetgid(rgid); /* no sgid -> drop */
|
||||
|
||||
if (sct->m_mode & S_ISUID) {
|
||||
if (seteuid (sct->m_uid))
|
||||
bb_error_msg_and_die
|
||||
("BusyBox binary has insufficient rights to set proper UID for applet!");
|
||||
} else
|
||||
setuid (ruid); /* no suid -> drop */
|
||||
if (sct->m_mode & S_ISUID) xsetuid(sct->m_uid);
|
||||
else xsetuid(ruid); /* no suid -> drop */
|
||||
} else {
|
||||
/* default: drop all privileges */
|
||||
setgid (rgid);
|
||||
setuid (ruid);
|
||||
xsetgid(rgid);
|
||||
xsetuid(ruid);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
@@ -390,11 +367,10 @@ static void check_suid (struct BB_applet *applet)
|
||||
#endif
|
||||
|
||||
if (applet->need_suid == _BB_SUID_ALWAYS) {
|
||||
if (geteuid () != 0)
|
||||
bb_error_msg_and_die ("This applet requires root privileges!");
|
||||
if (geteuid()) bb_error_msg_and_die("Applet requires root privileges!");
|
||||
} else if (applet->need_suid == _BB_SUID_NEVER) {
|
||||
setgid (rgid); /* drop all privileges */
|
||||
setuid (ruid);
|
||||
xsetgid(rgid); /* drop all privileges */
|
||||
xsetuid(ruid);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -403,66 +379,99 @@ static void check_suid (struct BB_applet *applet)
|
||||
|
||||
|
||||
|
||||
#if ENABLE_FEATURE_COMPRESS_USAGE
|
||||
|
||||
#include "usage_compressed.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
static const char *unpack_usage_messages(void)
|
||||
{
|
||||
int input[2], output[2], pid;
|
||||
char *buf;
|
||||
|
||||
if(pipe(input) < 0 || pipe(output) < 0)
|
||||
exit(1);
|
||||
|
||||
pid = fork();
|
||||
switch (pid) {
|
||||
case -1: /* error */
|
||||
exit(1);
|
||||
case 0: /* child */
|
||||
close(input[1]);
|
||||
close(output[0]);
|
||||
uncompressStream(input[0], output[1]);
|
||||
exit(0);
|
||||
}
|
||||
/* parent */
|
||||
|
||||
close(input[0]);
|
||||
close(output[1]);
|
||||
pid = fork();
|
||||
switch (pid) {
|
||||
case -1: /* error */
|
||||
exit(1);
|
||||
case 0: /* child */
|
||||
full_write(input[1], packed_usage, sizeof(packed_usage));
|
||||
exit(0);
|
||||
}
|
||||
/* parent */
|
||||
close(input[1]);
|
||||
|
||||
buf = xmalloc(SIZEOF_usage_messages);
|
||||
full_read(output[0], buf, SIZEOF_usage_messages);
|
||||
return buf;
|
||||
}
|
||||
|
||||
#else
|
||||
#define unpack_usage_messages() usage_messages
|
||||
#endif /* ENABLE_FEATURE_COMPRESS_USAGE */
|
||||
|
||||
void bb_show_usage (void)
|
||||
{
|
||||
const char *format_string;
|
||||
const char *usage_string = usage_messages;
|
||||
int i;
|
||||
if (ENABLE_SHOW_USAGE) {
|
||||
const char *format_string;
|
||||
const char *usage_string = unpack_usage_messages();
|
||||
int i;
|
||||
|
||||
for (i = applet_using - applets; i > 0;) {
|
||||
if (!*usage_string++) {
|
||||
--i;
|
||||
for (i = applet_using - applets; i > 0;)
|
||||
if (!*usage_string++) --i;
|
||||
|
||||
format_string = "%s\n\nUsage: %s %s\n\n";
|
||||
if (*usage_string == '\b')
|
||||
format_string = "%s\n\nNo help available.\n\n";
|
||||
fprintf (stderr, format_string, bb_msg_full_version,
|
||||
applet_using->name, usage_string);
|
||||
}
|
||||
}
|
||||
|
||||
format_string = "%s\n\nUsage: %s %s\n\n";
|
||||
if (*usage_string == '\b')
|
||||
format_string = "%s\n\nNo help available.\n\n";
|
||||
fprintf (stderr, format_string, bb_msg_full_version, applet_using->name,
|
||||
usage_string);
|
||||
|
||||
exit (bb_default_error_retval);
|
||||
}
|
||||
|
||||
static int applet_name_compare (const void *x, const void *y)
|
||||
static int applet_name_compare(const void *name, const void *vapplet)
|
||||
{
|
||||
const char *name = x;
|
||||
const struct BB_applet *applet = y;
|
||||
const struct BB_applet *applet = vapplet;
|
||||
|
||||
return strcmp (name, applet->name);
|
||||
return strcmp(name, applet->name);
|
||||
}
|
||||
|
||||
extern const size_t NUM_APPLETS;
|
||||
|
||||
struct BB_applet *find_applet_by_name (const char *name)
|
||||
struct BB_applet *find_applet_by_name(const char *name)
|
||||
{
|
||||
return bsearch (name, applets, NUM_APPLETS, sizeof (struct BB_applet),
|
||||
return bsearch(name, applets, NUM_APPLETS, sizeof(struct BB_applet),
|
||||
applet_name_compare);
|
||||
}
|
||||
|
||||
void run_applet_by_name (const char *name, int argc, char **argv)
|
||||
void run_applet_by_name(const char *name, int argc, char **argv)
|
||||
{
|
||||
if(ENABLE_FEATURE_SUID_CONFIG) parse_config_file ();
|
||||
if (ENABLE_FEATURE_SUID_CONFIG) parse_config_file();
|
||||
|
||||
if(!strncmp(name, "busybox", 7)) busybox_main(argc, argv);
|
||||
if (!strncmp(name, "busybox", 7)) busybox_main(argc, argv);
|
||||
/* Do a binary search to find the applet entry given the name. */
|
||||
applet_using = find_applet_by_name(name);
|
||||
if(applet_using) {
|
||||
if (applet_using) {
|
||||
bb_applet_name = applet_using->name;
|
||||
if(argc==2 && !strcmp(argv[1], "--help")) bb_show_usage ();
|
||||
if(ENABLE_FEATURE_SUID) check_suid (applet_using);
|
||||
exit ((*(applet_using->main)) (argc, argv));
|
||||
if(argc==2 && !strcmp(argv[1], "--help")) bb_show_usage();
|
||||
if(ENABLE_FEATURE_SUID) check_suid(applet_using);
|
||||
exit((*(applet_using->main))(argc, argv));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* END CODE */
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+7
-10
@@ -1,10 +1,15 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* BusyBox' main applet dispatcher.
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
#include "busybox.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
#if ENABLE_LOCALE_SUPPORT
|
||||
#include <locale.h>
|
||||
#else
|
||||
@@ -143,15 +148,7 @@ int busybox_main(int argc, char **argv)
|
||||
printf("\n\n");
|
||||
exit(0);
|
||||
}
|
||||
} else run_applet_by_name(bb_applet_name=argv[1], argc-1, argv+1);
|
||||
} else run_applet_by_name(argv[1], argc-1, argv+1);
|
||||
|
||||
bb_error_msg_and_die("applet not found");
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+40
-16
@@ -5,18 +5,22 @@ export LC_CTYPE=POSIX
|
||||
|
||||
prefix=${1}
|
||||
if [ -z "$prefix" ]; then
|
||||
echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks]"
|
||||
exit 1;
|
||||
echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks]"
|
||||
exit 1;
|
||||
fi
|
||||
h=`sort busybox.links | uniq`
|
||||
cleanup="0"
|
||||
noclobber="0"
|
||||
case "$2" in
|
||||
--hardlinks) linkopts="-f";;
|
||||
--symlinks) linkopts="-fs";;
|
||||
"") h="";;
|
||||
*) echo "Unknown install option: $2"; exit 1;;
|
||||
--hardlinks) linkopts="-f";;
|
||||
--symlinks) linkopts="-fs";;
|
||||
--cleanup) cleanup="1";;
|
||||
--noclobber) noclobber="1";;
|
||||
"") h="";;
|
||||
*) echo "Unknown install option: $2"; exit 1;;
|
||||
esac
|
||||
|
||||
if [ "$DO_INSTALL_LIBS" != "n" ]; then
|
||||
if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then
|
||||
# get the target dir for the libs
|
||||
# assume it starts with lib
|
||||
libdir=$($CC -print-file-name=libc.so | \
|
||||
@@ -34,6 +38,22 @@ if [ "$DO_INSTALL_LIBS" != "n" ]; then
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$cleanup" = "1" ] && [ -e "$prefix/bin/busybox" ]; then
|
||||
inode=`ls -i "$prefix/bin/busybox" | awk '{print $1}'`
|
||||
sub_shell_it=`
|
||||
cd "$prefix"
|
||||
for d in usr/sbin usr/bin sbin bin ; do
|
||||
pd=$PWD
|
||||
if [ -d "$d" ]; then
|
||||
cd $d
|
||||
ls -iL . | grep "^ *$inode" | awk '{print $2}' | env -i xargs rm -f
|
||||
fi
|
||||
cd "$pd"
|
||||
done
|
||||
`
|
||||
fi
|
||||
|
||||
rm -f $prefix/bin/busybox || exit 1
|
||||
mkdir -p $prefix/bin || exit 1
|
||||
install -m 755 busybox $prefix/bin/busybox || exit 1
|
||||
@@ -42,29 +62,33 @@ for i in $h ; do
|
||||
appdir=`dirname $i`
|
||||
mkdir -p $prefix/$appdir || exit 1
|
||||
if [ "$2" = "--hardlinks" ]; then
|
||||
bb_path="$prefix/bin/busybox"
|
||||
bb_path="$prefix/bin/busybox"
|
||||
else
|
||||
case "$appdir" in
|
||||
case "$appdir" in
|
||||
/)
|
||||
bb_path="bin/busybox"
|
||||
bb_path="bin/busybox"
|
||||
;;
|
||||
/bin)
|
||||
bb_path="busybox"
|
||||
bb_path="busybox"
|
||||
;;
|
||||
/sbin)
|
||||
bb_path="../bin/busybox"
|
||||
bb_path="../bin/busybox"
|
||||
;;
|
||||
/usr/bin|/usr/sbin)
|
||||
bb_path="../../bin/busybox"
|
||||
bb_path="../../bin/busybox"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown installation directory: $appdir"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
fi
|
||||
if [ "$noclobber" = "0" ] || [ ! -e "$prefix$i" ]; then
|
||||
echo " $prefix$i -> $bb_path"
|
||||
ln $linkopts $bb_path $prefix$i || exit 1
|
||||
else
|
||||
echo " $prefix$i already exists"
|
||||
fi
|
||||
echo " $prefix$i -> $bb_path"
|
||||
ln $linkopts $bb_path $prefix$i || exit 1
|
||||
done
|
||||
|
||||
exit 0
|
||||
@@ -1,3 +1,10 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Version stuff.
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
|
||||
#ifndef BB_EXTRA_VERSION
|
||||
|
||||
+20
-20
@@ -29,7 +29,7 @@ config CONFIG_AR
|
||||
probably say N here.
|
||||
|
||||
config CONFIG_FEATURE_AR_LONG_FILENAMES
|
||||
bool " Enable support for long filenames (not need for debs)"
|
||||
bool "Enable support for long filenames (not need for debs)"
|
||||
default n
|
||||
depends on CONFIG_AR
|
||||
help
|
||||
@@ -89,7 +89,7 @@ config CONFIG_DPKG_DEB
|
||||
probably say N here.
|
||||
|
||||
config CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||
bool " extract only (-x)"
|
||||
bool "extract only (-x)"
|
||||
default n
|
||||
depends on CONFIG_DPKG_DEB
|
||||
help
|
||||
@@ -106,7 +106,7 @@ config CONFIG_GUNZIP
|
||||
an archive, without decompressing it.
|
||||
|
||||
config CONFIG_FEATURE_GUNZIP_UNCOMPRESS
|
||||
bool " Uncompress support"
|
||||
bool "Uncompress support"
|
||||
default n
|
||||
depends on CONFIG_GUNZIP
|
||||
help
|
||||
@@ -142,7 +142,7 @@ config CONFIG_TAR
|
||||
UNIX archive program.
|
||||
|
||||
config CONFIG_FEATURE_TAR_CREATE
|
||||
bool " Enable archive creation"
|
||||
bool "Enable archive creation"
|
||||
default y
|
||||
depends on CONFIG_TAR
|
||||
help
|
||||
@@ -150,7 +150,7 @@ config CONFIG_FEATURE_TAR_CREATE
|
||||
tar archives using the `-c' option.
|
||||
|
||||
config CONFIG_FEATURE_TAR_BZIP2
|
||||
bool " Enable -j option to handle .tar.bz2 files"
|
||||
bool "Enable -j option to handle .tar.bz2 files"
|
||||
default n
|
||||
depends on CONFIG_TAR
|
||||
help
|
||||
@@ -158,7 +158,7 @@ config CONFIG_FEATURE_TAR_BZIP2
|
||||
archives compressed with bzip2.
|
||||
|
||||
config CONFIG_FEATURE_TAR_LZMA
|
||||
bool " Enable -a option to handle .tar.lzma files"
|
||||
bool "Enable -a option to handle .tar.lzma files"
|
||||
default n
|
||||
depends on CONFIG_TAR
|
||||
help
|
||||
@@ -166,7 +166,7 @@ config CONFIG_FEATURE_TAR_LZMA
|
||||
archives compressed with lzma.
|
||||
|
||||
config CONFIG_FEATURE_TAR_FROM
|
||||
bool " Enable -X (exclude from) and -T (include from) options)"
|
||||
bool "Enable -X (exclude from) and -T (include from) options)"
|
||||
default n
|
||||
depends on CONFIG_TAR
|
||||
help
|
||||
@@ -174,7 +174,7 @@ config CONFIG_FEATURE_TAR_FROM
|
||||
a list of files to include or exclude from an archive.
|
||||
|
||||
config CONFIG_FEATURE_TAR_GZIP
|
||||
bool " Enable -z option"
|
||||
bool "Enable -z option"
|
||||
default y
|
||||
depends on CONFIG_TAR
|
||||
help
|
||||
@@ -182,15 +182,15 @@ config CONFIG_FEATURE_TAR_GZIP
|
||||
when creating or extracting tar gziped archives.
|
||||
|
||||
config CONFIG_FEATURE_TAR_COMPRESS
|
||||
bool " Enable -Z option"
|
||||
bool "Enable -Z option"
|
||||
default n
|
||||
depends on CONFIG_TAR
|
||||
help
|
||||
If you enable this option tar will be able to call uncompress,
|
||||
when extracting .tar.Z archives.
|
||||
|
||||
config CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
|
||||
bool " Enable support for old tar header format"
|
||||
config CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY
|
||||
bool "Enable support for old tar header format"
|
||||
default N
|
||||
depends on CONFIG_TAR
|
||||
help
|
||||
@@ -199,7 +199,7 @@ config CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
|
||||
repacking your ancient archives with the new format.
|
||||
|
||||
config CONFIG_FEATURE_TAR_GNU_EXTENSIONS
|
||||
bool " Enable support for some GNU tar extensions"
|
||||
bool "Enable support for some GNU tar extensions"
|
||||
default y
|
||||
depends on CONFIG_TAR
|
||||
help
|
||||
@@ -207,9 +207,9 @@ config CONFIG_FEATURE_TAR_GNU_EXTENSIONS
|
||||
linknames.
|
||||
|
||||
config CONFIG_FEATURE_TAR_LONG_OPTIONS
|
||||
bool " Enable long options"
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on CONFIG_TAR
|
||||
depends on CONFIG_TAR && CONFIG_GETOPT_LONG
|
||||
help
|
||||
Enable use of long options, increases size by about 400 Bytes
|
||||
|
||||
@@ -236,11 +236,11 @@ config CONFIG_UNLZMA
|
||||
should probably say N here.
|
||||
|
||||
config CONFIG_FEATURE_LZMA_FAST
|
||||
bool " Optimze unlzma for speed"
|
||||
bool "Optimze unlzma for speed"
|
||||
default n
|
||||
depends on CONFIG_UNLZMA
|
||||
help
|
||||
This option reduce decompression time by about 33% at the cost of
|
||||
This option reduces decompression time by about 33% at the cost of
|
||||
a 2K bigger binary.
|
||||
|
||||
config CONFIG_UNZIP
|
||||
@@ -257,7 +257,7 @@ comment "Common options for cpio and tar"
|
||||
depends on CONFIG_CPIO || CONFIG_TAR
|
||||
|
||||
config CONFIG_FEATURE_UNARCHIVE_TAPE
|
||||
bool " Enable tape drive support"
|
||||
bool "Enable tape drive support"
|
||||
default n
|
||||
depends on CONFIG_CPIO || CONFIG_TAR
|
||||
help
|
||||
@@ -267,7 +267,7 @@ comment "Common options for dpkg and dpkg_deb"
|
||||
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
|
||||
|
||||
config CONFIG_FEATURE_DEB_TAR_GZ
|
||||
bool " gzip debian packages (normal)"
|
||||
bool "gzip debian packages (normal)"
|
||||
default y if CONFIG_DPKG || CONFIG_DPKG_DEB
|
||||
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
|
||||
help
|
||||
@@ -276,7 +276,7 @@ config CONFIG_FEATURE_DEB_TAR_GZ
|
||||
If you want compatibility with standard .deb's you should say yes here.
|
||||
|
||||
config CONFIG_FEATURE_DEB_TAR_BZ2
|
||||
bool " bzip2 debian packages"
|
||||
bool "bzip2 debian packages"
|
||||
default n
|
||||
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
|
||||
help
|
||||
@@ -287,7 +287,7 @@ config CONFIG_FEATURE_DEB_TAR_BZ2
|
||||
use an internal control.tar.bz2 or data.tar.bz2.
|
||||
|
||||
config CONFIG_FEATURE_DEB_TAR_LZMA
|
||||
bool " lzma debian packages"
|
||||
bool "lzma debian packages"
|
||||
default n
|
||||
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
|
||||
help
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ top_builddir=..
|
||||
endif
|
||||
ARCHIVAL_DIR:=./
|
||||
srcdir=$(top_srcdir)/archival
|
||||
include $(top_builddir)/Rules.mak
|
||||
include $(top_srcdir)/Rules.mak
|
||||
include $(top_builddir)/.config
|
||||
include $(srcdir)/Makefile.in
|
||||
all: $(libraries-y)
|
||||
|
||||
+3
-15
@@ -7,19 +7,7 @@
|
||||
*
|
||||
* Based in part on BusyBox tar, Debian dpkg-deb and GNU ar.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*
|
||||
* There is no single standard to adhere to so ar may not portable
|
||||
* between different systems
|
||||
@@ -97,10 +85,10 @@ int ar_main(int argc, char **argv)
|
||||
|
||||
while (optind < argc) {
|
||||
archive_handle->filter = filter_accept_list;
|
||||
archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind++]);
|
||||
llist_add_to(&(archive_handle->accept), argv[optind++]);
|
||||
}
|
||||
|
||||
archive_xread_all(archive_handle, magic, 7);
|
||||
xread(archive_handle->src_fd, magic, 7);
|
||||
if (strncmp(magic, "!<arch>", 7) != 0) {
|
||||
bb_error_msg_and_die("Invalid ar magic");
|
||||
}
|
||||
|
||||
+6
-4
@@ -1,8 +1,9 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Modified for busybox by Glenn McGrath <bug1@iinet.net.au>
|
||||
* Added support output to stdout by Thomas Lundquist <thomasez@zelow.no>
|
||||
*
|
||||
* Licensed under GPL v2, see file LICENSE in this tarball for details.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@@ -41,16 +42,18 @@ int bunzip2_main(int argc, char **argv)
|
||||
|
||||
/* Check that the input is sane. */
|
||||
if (isatty(src_fd) && (opt & BUNZIP2_OPT_FORCE) == 0) {
|
||||
bb_error_msg_and_die("compressed data not read from terminal. Use -f to force it.");
|
||||
bb_error_msg_and_die("Compressed data not read from terminal. Use -f to force it.");
|
||||
}
|
||||
|
||||
if (filename) {
|
||||
struct stat stat_buf;
|
||||
char *extension=filename+strlen(filename)-4;
|
||||
if (strcmp(extension, ".bz2") != 0) {
|
||||
bb_error_msg_and_die("Invalid extension");
|
||||
}
|
||||
xstat(filename, &stat_buf);
|
||||
*extension=0;
|
||||
dst_fd = bb_xopen(filename, O_WRONLY | O_CREAT);
|
||||
dst_fd = bb_xopen3(filename, O_WRONLY | O_CREAT, stat_buf.st_mode);
|
||||
} else dst_fd = STDOUT_FILENO;
|
||||
status = uncompressStream(src_fd, dst_fd);
|
||||
if(filename) {
|
||||
@@ -62,4 +65,3 @@ int bunzip2_main(int argc, char **argv)
|
||||
|
||||
return status;
|
||||
}
|
||||
/* vi:set ts=4: */
|
||||
+2
-14
@@ -4,19 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 2001 by Glenn McGrath
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*
|
||||
* Limitations:
|
||||
* Doesn't check CRC's
|
||||
@@ -88,7 +76,7 @@ int cpio_main(int argc, char **argv)
|
||||
|
||||
while (optind < argc) {
|
||||
archive_handle->filter = filter_accept_list;
|
||||
archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind]);
|
||||
llist_add_to(&(archive_handle->accept), argv[optind]);
|
||||
optind++;
|
||||
}
|
||||
|
||||
|
||||
+23
-137
@@ -1,3 +1,4 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini dpkg implementation for busybox.
|
||||
* This is not meant as a replacement for dpkg
|
||||
@@ -7,19 +8,7 @@
|
||||
*
|
||||
* Started life as a busybox implementation of udpkg
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -556,7 +545,7 @@ static unsigned int fill_package_struct(char *control_buffer)
|
||||
"Conflicts", "Suggests", "Recommends", "Enhances", 0
|
||||
};
|
||||
|
||||
common_node_t *new_node = (common_node_t *) xcalloc(1, sizeof(common_node_t));
|
||||
common_node_t *new_node = (common_node_t *) xzalloc(sizeof(common_node_t));
|
||||
char *field_name;
|
||||
char *field_value;
|
||||
int field_start = 0;
|
||||
@@ -677,8 +666,7 @@ static void set_status(const unsigned int status_node_num, const char *new_value
|
||||
bb_error_msg_and_die("DEBUG ONLY: this shouldnt happen");
|
||||
}
|
||||
|
||||
new_status = (char *) xmalloc(want_len + flag_len + status_len + 3);
|
||||
sprintf(new_status, "%s %s %s", name_hashtable[want], name_hashtable[flag], name_hashtable[status]);
|
||||
new_status = bb_xasprintf("%s %s %s", name_hashtable[want], name_hashtable[flag], name_hashtable[status]);
|
||||
status_hashtable[status_node_num]->status = search_name_hashtable(new_status);
|
||||
free(new_status);
|
||||
return;
|
||||
@@ -741,79 +729,6 @@ static void index_status_file(const char *filename)
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0 /* this code is no longer used */
|
||||
char *get_depends_field(common_node_t *package, const int depends_type)
|
||||
{
|
||||
char *depends = NULL;
|
||||
char *old_sep = (char *)xcalloc(1, 3);
|
||||
char *new_sep = (char *)xcalloc(1, 3);
|
||||
int line_size = 0;
|
||||
int depends_size;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < package->num_of_edges; i++) {
|
||||
if ((package->edge[i]->type == EDGE_OR_PRE_DEPENDS) ||
|
||||
(package->edge[i]->type == EDGE_OR_DEPENDS)) {
|
||||
}
|
||||
|
||||
if ((package->edge[i]->type == depends_type) ||
|
||||
(package->edge[i]->type == depends_type + 1)) {
|
||||
/* Check if its the first time through */
|
||||
|
||||
depends_size = 8 + strlen(name_hashtable[package->edge[i]->name])
|
||||
+ strlen(name_hashtable[package->edge[i]->version]);
|
||||
line_size += depends_size;
|
||||
depends = (char *) xrealloc(depends, line_size + 1);
|
||||
|
||||
/* Check to see if this dependency is the type we are looking for
|
||||
* +1 to check for 'extra' types, e.g. ored dependecies */
|
||||
strcpy(old_sep, new_sep);
|
||||
if (package->edge[i]->type == depends_type) {
|
||||
strcpy(new_sep, ", ");
|
||||
}
|
||||
else if (package->edge[i]->type == depends_type + 1) {
|
||||
strcpy(new_sep, "| ");
|
||||
}
|
||||
|
||||
if (depends_size == line_size) {
|
||||
strcpy(depends, "");
|
||||
} else {
|
||||
if ((strcmp(old_sep, "| ") == 0) && (strcmp(new_sep, "| ") == 0)) {
|
||||
strcat(depends, " | ");
|
||||
} else {
|
||||
strcat(depends, ", ");
|
||||
}
|
||||
}
|
||||
|
||||
strcat(depends, name_hashtable[package->edge[i]->name]);
|
||||
if (strcmp(name_hashtable[package->edge[i]->version], "NULL") != 0) {
|
||||
if (package->edge[i]->operator == VER_EQUAL) {
|
||||
strcat(depends, " (= ");
|
||||
}
|
||||
else if (package->edge[i]->operator == VER_LESS) {
|
||||
strcat(depends, " (<< ");
|
||||
}
|
||||
else if (package->edge[i]->operator == VER_LESS_EQUAL) {
|
||||
strcat(depends, " (<= ");
|
||||
}
|
||||
else if (package->edge[i]->operator == VER_MORE) {
|
||||
strcat(depends, " (>> ");
|
||||
}
|
||||
else if (package->edge[i]->operator == VER_MORE_EQUAL) {
|
||||
strcat(depends, " (>= ");
|
||||
} else {
|
||||
strcat(depends, " (");
|
||||
}
|
||||
strcat(depends, name_hashtable[package->edge[i]->version]);
|
||||
strcat(depends, ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
return(depends);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void write_buffer_no_status(FILE *new_status_file, const char *control_buffer)
|
||||
{
|
||||
char *name;
|
||||
@@ -960,9 +875,7 @@ static void write_status_file(deb_file_t **deb_file)
|
||||
/* Create a separate backfile to dpkg */
|
||||
if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) {
|
||||
struct stat stat_buf;
|
||||
if (stat("/var/lib/dpkg/status", &stat_buf) == 0) {
|
||||
bb_error_msg_and_die("Couldnt create backup status file");
|
||||
}
|
||||
xstat("/var/lib/dpkg/status", &stat_buf);
|
||||
/* Its ok if renaming the status file fails because status
|
||||
* file doesnt exist, maybe we are starting from scratch */
|
||||
bb_error_msg("No status file found, creating new one");
|
||||
@@ -1027,11 +940,9 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
|
||||
package_hashtable[package_num]->edge[j]->operator);
|
||||
if (package_hashtable[conflicts_package_num] == NULL) {
|
||||
/* create a new package */
|
||||
common_node_t *new_node = (common_node_t *) xmalloc(sizeof(common_node_t));
|
||||
common_node_t *new_node = (common_node_t *) xzalloc(sizeof(common_node_t));
|
||||
new_node->name = package_hashtable[package_num]->edge[j]->name;
|
||||
new_node->version = package_hashtable[package_num]->edge[j]->version;
|
||||
new_node->num_of_edges = 0;
|
||||
new_node->edge = NULL;
|
||||
package_hashtable[conflicts_package_num] = new_node;
|
||||
}
|
||||
conflicts = xrealloc(conflicts, sizeof(int) * (conflicts_num + 1));
|
||||
@@ -1111,15 +1022,6 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
|
||||
continue;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* This might be needed so we don't complain about
|
||||
* things which are broken but unrelated to the
|
||||
* packages that are currently being installed
|
||||
*/
|
||||
if (state_status == search_name_hashtable("installed"))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
/* This code is tested only for EDGE_DEPENDS, since I
|
||||
* have no suitable pre-depends available. There is no
|
||||
* reason that it shouldn't work though :-)
|
||||
@@ -1279,15 +1181,10 @@ static int run_package_script(const char *package_name, const char *script_type)
|
||||
char *script_path;
|
||||
int result;
|
||||
|
||||
script_path = xmalloc(strlen(package_name) + strlen(script_type) + 21);
|
||||
sprintf(script_path, "/var/lib/dpkg/info/%s.%s", package_name, script_type);
|
||||
script_path = bb_xasprintf("/var/lib/dpkg/info/%s.%s", package_name, script_type);
|
||||
|
||||
/* If the file doesnt exist is isnt a fatal */
|
||||
if (lstat(script_path, &path_stat) < 0) {
|
||||
result = EXIT_SUCCESS;
|
||||
} else {
|
||||
result = system(script_path);
|
||||
}
|
||||
result = lstat(script_path, &path_stat) < 0 ? EXIT_SUCCESS : system(script_path);
|
||||
free(script_path);
|
||||
return(result);
|
||||
}
|
||||
@@ -1301,13 +1198,11 @@ static char **all_control_list(const char *package_name)
|
||||
char **remove_files;
|
||||
|
||||
/* Create a list of all /var/lib/dpkg/info/<package> files */
|
||||
remove_files = xmalloc(sizeof(all_control_files));
|
||||
remove_files = xzalloc(sizeof(all_control_files));
|
||||
while (all_control_files[i]) {
|
||||
remove_files[i] = xmalloc(strlen(package_name) + strlen(all_control_files[i]) + 21);
|
||||
sprintf(remove_files[i], "/var/lib/dpkg/info/%s.%s", package_name, all_control_files[i]);
|
||||
remove_files[i] = bb_xasprintf("/var/lib/dpkg/info/%s.%s", package_name, all_control_files[i]);
|
||||
i++;
|
||||
}
|
||||
remove_files[sizeof(all_control_files)/sizeof(char*) - 1] = NULL;
|
||||
|
||||
return(remove_files);
|
||||
}
|
||||
@@ -1400,11 +1295,9 @@ static void remove_package(const unsigned int package_num, int noisy)
|
||||
free_array(remove_files);
|
||||
|
||||
/* Create a list of files in /var/lib/dpkg/info/<package>.* to keep */
|
||||
exclude_files = xmalloc(sizeof(char*) * 3);
|
||||
exclude_files = xzalloc(sizeof(char*) * 3);
|
||||
exclude_files[0] = bb_xstrdup(conffile_name);
|
||||
exclude_files[1] = xmalloc(package_name_length + 27);
|
||||
sprintf(exclude_files[1], "/var/lib/dpkg/info/%s.postrm", package_name);
|
||||
exclude_files[2] = NULL;
|
||||
exclude_files[1] = bb_xasprintf("/var/lib/dpkg/info/%s.postrm", package_name);
|
||||
|
||||
/* Create a list of all /var/lib/dpkg/info/<package> files */
|
||||
remove_files = all_control_list(package_name);
|
||||
@@ -1440,8 +1333,7 @@ static void purge_package(const unsigned int package_num)
|
||||
sprintf(list_name, "/var/lib/dpkg/info/%s.list", package_name);
|
||||
remove_files = create_list(list_name);
|
||||
|
||||
exclude_files = xmalloc(sizeof(char*));
|
||||
exclude_files[0] = NULL;
|
||||
exclude_files = xzalloc(sizeof(char*));
|
||||
|
||||
/* Some directories cant be removed straight away, so do multiple passes */
|
||||
while (remove_file_array(remove_files, exclude_files));
|
||||
@@ -1484,10 +1376,10 @@ static void init_archive_deb_control(archive_handle_t *ar_handle)
|
||||
|
||||
/* We don't care about data.tar.* or debian-binary, just control.tar.* */
|
||||
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
|
||||
ar_handle->accept = llist_add_to(NULL, "control.tar.gz");
|
||||
llist_add_to(&(ar_handle->accept), "control.tar.gz");
|
||||
#endif
|
||||
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
|
||||
ar_handle->accept = llist_add_to(ar_handle->accept, "control.tar.bz2");
|
||||
llist_add_to(&(ar_handle->accept), "control.tar.bz2");
|
||||
#endif
|
||||
|
||||
/* Assign the tar handle as a subarchive of the ar handle */
|
||||
@@ -1506,10 +1398,10 @@ static void init_archive_deb_data(archive_handle_t *ar_handle)
|
||||
|
||||
/* We don't care about control.tar.* or debian-binary, just data.tar.* */
|
||||
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
|
||||
ar_handle->accept = llist_add_to(NULL, "data.tar.gz");
|
||||
llist_add_to(&(ar_handle->accept), "data.tar.gz");
|
||||
#endif
|
||||
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
|
||||
ar_handle->accept = llist_add_to(ar_handle->accept, "data.tar.bz2");
|
||||
llist_add_to(&(ar_handle->accept), "data.tar.bz2");
|
||||
#endif
|
||||
|
||||
/* Assign the tar handle as a subarchive of the ar handle */
|
||||
@@ -1536,9 +1428,7 @@ static void data_extract_all_prefix(archive_handle_t *archive_handle)
|
||||
|
||||
name_ptr += strspn(name_ptr, "./");
|
||||
if (name_ptr[0] != '\0') {
|
||||
archive_handle->file_header->name = xmalloc(strlen(archive_handle->buffer) + 2 + strlen(name_ptr));
|
||||
strcpy(archive_handle->file_header->name, archive_handle->buffer);
|
||||
strcat(archive_handle->file_header->name, name_ptr);
|
||||
archive_handle->file_header->name = bb_xasprintf("%s%s", archive_handle->buffer, name_ptr);
|
||||
data_extract_all(archive_handle);
|
||||
}
|
||||
return;
|
||||
@@ -1567,15 +1457,13 @@ static void unpack_package(deb_file_t *deb_file)
|
||||
}
|
||||
|
||||
/* Extract control.tar.gz to /var/lib/dpkg/info/<package>.filename */
|
||||
info_prefix = (char *) xmalloc(strlen(package_name) + 20 + 4 + 2);
|
||||
sprintf(info_prefix, "/var/lib/dpkg/info/%s.", package_name);
|
||||
info_prefix = bb_xasprintf("/var/lib/dpkg/info/%s.", package_name);
|
||||
archive_handle = init_archive_deb_ar(deb_file->filename);
|
||||
init_archive_deb_control(archive_handle);
|
||||
|
||||
while(all_control_files[i]) {
|
||||
char *c = (char *) xmalloc(3 + bb_strlen(all_control_files[i]));
|
||||
sprintf(c, "./%s", all_control_files[i]);
|
||||
accept_list= llist_add_to(accept_list, c);
|
||||
char *c = bb_xasprintf("./%s", all_control_files[i]);
|
||||
llist_add_to(&accept_list, c);
|
||||
i++;
|
||||
}
|
||||
archive_handle->sub_archive->accept = accept_list;
|
||||
@@ -1699,13 +1587,13 @@ int dpkg_main(int argc, char **argv)
|
||||
while (optind < argc) {
|
||||
/* deb_count = nb_elem - 1 and we need nb_elem + 1 to allocate terminal node [NULL pointer] */
|
||||
deb_file = xrealloc(deb_file, sizeof(deb_file_t *) * (deb_count + 2));
|
||||
deb_file[deb_count] = (deb_file_t *) xmalloc(sizeof(deb_file_t));
|
||||
deb_file[deb_count] = (deb_file_t *) xzalloc(sizeof(deb_file_t));
|
||||
if (dpkg_opt & dpkg_opt_filename) {
|
||||
archive_handle_t *archive_handle;
|
||||
llist_t *control_list = NULL;
|
||||
|
||||
/* Extract the control file */
|
||||
control_list = llist_add_to(NULL, "./control");
|
||||
llist_add_to(&control_list, "./control");
|
||||
archive_handle = init_archive_deb_ar(argv[optind]);
|
||||
init_archive_deb_control(archive_handle);
|
||||
deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list);
|
||||
@@ -1742,8 +1630,6 @@ int dpkg_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
else if (dpkg_opt & dpkg_opt_package_name) {
|
||||
deb_file[deb_count]->filename = NULL;
|
||||
deb_file[deb_count]->control_file = NULL;
|
||||
deb_file[deb_count]->package = search_package_hashtable(
|
||||
search_name_hashtable(argv[optind]),
|
||||
search_name_hashtable("ANY"), VER_ANY);
|
||||
|
||||
+10
-20
@@ -1,18 +1,8 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU 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.
|
||||
* dpkg-deb packs, unpacks and provides information about Debian archives.
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
@@ -46,13 +36,13 @@ int dpkg_deb_main(int argc, char **argv)
|
||||
ar_archive->filter = filter_accept_list_reassign;
|
||||
|
||||
#ifdef CONFIG_FEATURE_DEB_TAR_GZ
|
||||
ar_archive->accept = llist_add_to(NULL, "data.tar.gz");
|
||||
control_tar_llist = llist_add_to(NULL, "control.tar.gz");
|
||||
llist_add_to(&(ar_archive->accept), "data.tar.gz");
|
||||
llist_add_to(&control_tar_llist, "control.tar.gz");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
|
||||
ar_archive->accept = llist_add_to(ar_archive->accept, "data.tar.bz2");
|
||||
control_tar_llist = llist_add_to(control_tar_llist, "control.tar.bz2");
|
||||
llist_add_to(&(ar_archive->accept), "data.tar.bz2");
|
||||
llist_add_to(&control_tar_llist, "control.tar.bz2");
|
||||
#endif
|
||||
|
||||
bb_opt_complementally = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
|
||||
@@ -75,7 +65,7 @@ int dpkg_deb_main(int argc, char **argv)
|
||||
* it should accept a second argument which specifies a
|
||||
* specific field to print */
|
||||
ar_archive->accept = control_tar_llist;
|
||||
tar_archive->accept = llist_add_to(NULL, "./control");
|
||||
llist_add_to(&(tar_archive->accept), "./control");
|
||||
tar_archive->filter = filter_accept_list;
|
||||
tar_archive->action_data = data_extract_to_stdout;
|
||||
}
|
||||
@@ -99,8 +89,8 @@ int dpkg_deb_main(int argc, char **argv)
|
||||
extract_dir = argv[optind];
|
||||
}
|
||||
if (extract_dir) {
|
||||
mkdir(extract_dir, 0777);
|
||||
chdir(extract_dir);
|
||||
mkdir(extract_dir, 0777); /* bb_make_directory(extract_dir, 0777, 0) */
|
||||
bb_xchdir(extract_dir);
|
||||
}
|
||||
unpack_ar_archive(ar_archive);
|
||||
|
||||
|
||||
+5
-41
@@ -14,20 +14,7 @@
|
||||
* General cleanup to better adhere to the style guide and make use of standard
|
||||
* busybox functions by Glenn McGrath <bug1@iinet.net.au>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*
|
||||
* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
|
||||
* Copyright (C) 1992-1993 Jean-loup Gailly
|
||||
@@ -40,26 +27,6 @@
|
||||
* See the file algorithm.doc for the compression algorithms and file formats.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static char *license_msg[] = {
|
||||
" Copyright (C) 1992-1993 Jean-loup Gailly",
|
||||
" 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., 675 Mass Ave, Cambridge, MA 02139, USA.",
|
||||
0
|
||||
};
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@@ -137,21 +104,18 @@ int gunzip_main(int argc, char **argv)
|
||||
bb_error_msg_and_die("Invalid extension");
|
||||
}
|
||||
|
||||
/* Open output file */
|
||||
dst_fd = bb_xopen(new_path, O_WRONLY | O_CREAT);
|
||||
|
||||
/* Set permissions on the file */
|
||||
chmod(new_path, stat_buf.st_mode);
|
||||
/* Open output file (with correct permissions) */
|
||||
dst_fd = bb_xopen3(new_path, O_WRONLY | O_CREAT, stat_buf.st_mode);
|
||||
|
||||
/* If unzip succeeds remove the old file */
|
||||
delete_path = old_path;
|
||||
}
|
||||
|
||||
/* do the decompression, and cleanup */
|
||||
if (bb_xread_char(src_fd) == 0x1f) {
|
||||
if (xread_char(src_fd) == 0x1f) {
|
||||
unsigned char magic2;
|
||||
|
||||
magic2 = bb_xread_char(src_fd);
|
||||
magic2 = xread_char(src_fd);
|
||||
#ifdef CONFIG_FEATURE_GUNZIP_UNCOMPRESS
|
||||
if (magic2 == 0x9d) {
|
||||
status = uncompress(src_fd, dst_fd);
|
||||
|
||||
+24
-58
@@ -16,11 +16,7 @@
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* These defines are very important for BusyBox. Without these,
|
||||
* huge chunks of ram are pre-allocated making the BusyBox bss
|
||||
* size Freaking Huge(tm), which is a bad thing.*/
|
||||
#define SMALL_MEM
|
||||
#define DYN_ALLOC
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -87,17 +83,11 @@ typedef unsigned long ulg;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef DYN_ALLOC
|
||||
# define DECLARE(type, array, size) static type * array
|
||||
# define ALLOC(type, array, size) { \
|
||||
array = (type*)xcalloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
|
||||
array = (type*)xzalloc((size_t)(((size)+1L)/2) * 2*sizeof(type)); \
|
||||
}
|
||||
# define FREE(array) {free(array), array=NULL;}
|
||||
#else
|
||||
# define DECLARE(type, array, size) static type array[size]
|
||||
# define ALLOC(type, array, size)
|
||||
# define FREE(array)
|
||||
#endif
|
||||
|
||||
#define tab_suffix window
|
||||
#define tab_prefix prev /* hash link (see deflate.c) */
|
||||
@@ -154,15 +144,6 @@ typedef int file_t; /* Do not use stdio */
|
||||
#define put_byte(c) {outbuf[outcnt++]=(uch)(c); if (outcnt==OUTBUFSIZ)\
|
||||
flush_outbuf();}
|
||||
|
||||
|
||||
/* Output a 32 bit value to the bit stream, lsb first */
|
||||
#if 0
|
||||
#define put_long(n) { \
|
||||
put_short((n) & 0xffff); \
|
||||
put_short(((ulg)(n)) >> 16); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define seekable() 0 /* force sequential output */
|
||||
#define translate_eol 0 /* no option -a yet */
|
||||
|
||||
@@ -293,6 +274,7 @@ static int ofd; /* output file descriptor */
|
||||
static unsigned insize; /* valid bytes in inbuf */
|
||||
static unsigned outcnt; /* bytes in output buffer */
|
||||
|
||||
static uint32_t *crc_32_tab;
|
||||
|
||||
/* Output a 16 bit value, lsb first */
|
||||
static void put_short(ush w)
|
||||
@@ -333,7 +315,7 @@ static void write_buf(int fd, void *buf, unsigned cnt)
|
||||
unsigned n;
|
||||
|
||||
while ((n = write(fd, buf, cnt)) != cnt) {
|
||||
if (n == (unsigned) (-1)) bb_error_msg_and_die("can't write");
|
||||
if (n == (unsigned) (-1)) bb_error_msg_and_die(bb_msg_write_error);
|
||||
cnt -= n;
|
||||
buf = (void *) ((char *) buf + n);
|
||||
}
|
||||
@@ -344,32 +326,13 @@ static void write_buf(int fd, void *buf, unsigned cnt)
|
||||
* pointer, then initialize the crc shift register contents instead.
|
||||
* Return the current crc in either case.
|
||||
*/
|
||||
static ulg updcrc(uch * s, unsigned n)
|
||||
static uint32_t updcrc(uch * s, unsigned n)
|
||||
{
|
||||
static ulg crc = (ulg) 0xffffffffL; /* shift register contents */
|
||||
register ulg c; /* temporary variable */
|
||||
static unsigned long crc_32_tab[256];
|
||||
|
||||
if (crc_32_tab[1] == 0x00000000L) {
|
||||
unsigned long csr; /* crc shift register */
|
||||
const unsigned long e = 0xedb88320L; /* polynomial exclusive-or pattern */
|
||||
int i; /* counter for all possible eight bit values */
|
||||
int k; /* byte being shifted into crc apparatus */
|
||||
|
||||
/* Compute table of CRC's. */
|
||||
for (i = 1; i < 256; i++) {
|
||||
csr = i;
|
||||
/* The idea to initialize the register with the byte instead of
|
||||
* zero was stolen from Haruhiko Okumura's ar002
|
||||
*/
|
||||
for (k = 8; k; k--)
|
||||
csr = csr & 1 ? (csr >> 1) ^ e : csr >> 1;
|
||||
crc_32_tab[i] = csr;
|
||||
}
|
||||
}
|
||||
static uint32_t crc = ~0; /* shift register contents */
|
||||
uint32_t c; /* temporary variable */
|
||||
|
||||
if (s == NULL) {
|
||||
c = 0xffffffffL;
|
||||
c = ~0;
|
||||
} else {
|
||||
c = crc;
|
||||
if (n)
|
||||
@@ -378,7 +341,7 @@ static ulg updcrc(uch * s, unsigned n)
|
||||
} while (--n);
|
||||
}
|
||||
crc = c;
|
||||
return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */
|
||||
return ~c;
|
||||
}
|
||||
|
||||
/* bits.c -- output variable-length bit strings
|
||||
@@ -512,7 +475,7 @@ static void send_bits(int value, int length)
|
||||
*/
|
||||
static unsigned bi_reverse(unsigned code, int len)
|
||||
{
|
||||
register unsigned res = 0;
|
||||
unsigned res = 0;
|
||||
|
||||
do {
|
||||
res |= code & 1;
|
||||
@@ -810,7 +773,7 @@ static void check_match(IPos start, IPos match, int length);
|
||||
*/
|
||||
static void lm_init(ush * flags)
|
||||
{
|
||||
register unsigned j;
|
||||
unsigned j;
|
||||
|
||||
/* Initialize the hash table. */
|
||||
memset(head, 0, HASH_SIZE * sizeof(*head));
|
||||
@@ -860,9 +823,9 @@ static void lm_init(ush * flags)
|
||||
static int longest_match(IPos cur_match)
|
||||
{
|
||||
unsigned chain_length = max_chain_length; /* max hash chain length */
|
||||
register uch *scan = window + strstart; /* current string */
|
||||
register uch *match; /* matched string */
|
||||
register int len; /* length of current match */
|
||||
uch *scan = window + strstart; /* current string */
|
||||
uch *match; /* matched string */
|
||||
int len; /* length of current match */
|
||||
int best_len = prev_length; /* best match length so far */
|
||||
IPos limit =
|
||||
strstart > (IPos) MAX_DIST ? strstart - (IPos) MAX_DIST : NIL;
|
||||
@@ -876,9 +839,9 @@ static int longest_match(IPos cur_match)
|
||||
#if HASH_BITS < 8 || MAX_MATCH != 258
|
||||
# error Code too clever
|
||||
#endif
|
||||
register uch *strend = window + strstart + MAX_MATCH;
|
||||
register uch scan_end1 = scan[best_len - 1];
|
||||
register uch scan_end = scan[best_len];
|
||||
uch *strend = window + strstart + MAX_MATCH;
|
||||
uch scan_end1 = scan[best_len - 1];
|
||||
uch scan_end = scan[best_len];
|
||||
|
||||
/* Do not waste too much time if we already have a good match: */
|
||||
if (prev_length >= good_match) {
|
||||
@@ -965,7 +928,7 @@ static void check_match(IPos start, IPos match, int length)
|
||||
*/
|
||||
static void fill_window(void)
|
||||
{
|
||||
register unsigned n, m;
|
||||
unsigned n, m;
|
||||
unsigned more =
|
||||
(unsigned) (window_size - (ulg) lookahead - (ulg) strstart);
|
||||
/* Amount of free space at the end of the window. */
|
||||
@@ -1033,7 +996,7 @@ static ulg deflate(void)
|
||||
IPos prev_match; /* previous match */
|
||||
int flush; /* set if current block must be flushed */
|
||||
int match_available = 0; /* set if previous match exists */
|
||||
register unsigned match_length = MIN_MATCH - 1; /* length of best match */
|
||||
unsigned match_length = MIN_MATCH - 1; /* length of best match */
|
||||
|
||||
/* Process the input block. */
|
||||
while (lookahead != 0) {
|
||||
@@ -1223,6 +1186,9 @@ int gzip_main(int argc, char **argv)
|
||||
ALLOC(uch, window, 2L * WSIZE);
|
||||
ALLOC(ush, tab_prefix, 1L << BITS);
|
||||
|
||||
/* Initialise the CRC32 table */
|
||||
crc_32_tab = bb_crc32_filltable(0);
|
||||
|
||||
clear_bufs();
|
||||
part_nb = 0;
|
||||
|
||||
@@ -1243,8 +1209,8 @@ int gzip_main(int argc, char **argv)
|
||||
inFileNum = STDIN_FILENO;
|
||||
outFileNum = STDOUT_FILENO;
|
||||
} else {
|
||||
inFileNum = open(argv[i], O_RDONLY);
|
||||
if (inFileNum < 0 || fstat(inFileNum, &statBuf) < 0)
|
||||
inFileNum = bb_xopen3(argv[i], O_RDONLY, 0);
|
||||
if (fstat(inFileNum, &statBuf) < 0)
|
||||
bb_perror_msg_and_die("%s", argv[i]);
|
||||
time_stamp = statBuf.st_ctime;
|
||||
ifile_size = statBuf.st_size;
|
||||
@@ -2416,7 +2382,7 @@ static void set_file_type(void)
|
||||
*/
|
||||
|
||||
|
||||
static ulg crc; /* crc on uncompressed file data */
|
||||
static uint32_t crc; /* crc on uncompressed file data */
|
||||
static long header_bytes; /* number of bytes in gzip header */
|
||||
|
||||
static void put_long(ulg n)
|
||||
|
||||
@@ -25,7 +25,7 @@ top_builddir=../..
|
||||
endif
|
||||
srcdir=$(top_srcdir)/archival/libunarchive
|
||||
LIBUNARCHIVE_DIR:=./
|
||||
include $(top_builddir)/Rules.mak
|
||||
include $(top_srcdir)/Rules.mak
|
||||
include $(top_builddir)/.config
|
||||
include $(srcdir)/Makefile.in
|
||||
all: $(libraries-y)
|
||||
|
||||
@@ -29,7 +29,6 @@ LIBUNARCHIVE-y:= \
|
||||
header_list.o \
|
||||
header_verbose_list.o \
|
||||
\
|
||||
archive_xread_all.o \
|
||||
archive_xread_all_eof.o \
|
||||
\
|
||||
seek_by_char.o \
|
||||
@@ -67,6 +66,7 @@ LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz.o
|
||||
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress.o
|
||||
LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o
|
||||
LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES)
|
||||
LIBUNARCHIVE-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o
|
||||
|
||||
|
||||
LIBUNARCHIVE-y:=$(sort $(LIBUNARCHIVE-y))
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "unarchive.h"
|
||||
#include "libbb.h"
|
||||
|
||||
void archive_xread_all(const archive_handle_t *archive_handle, void *buf, const size_t count)
|
||||
{
|
||||
ssize_t size;
|
||||
|
||||
size = bb_full_read(archive_handle->src_fd, buf, count);
|
||||
if (size != count) {
|
||||
bb_error_msg_and_die("Short read");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1,17 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -24,7 +13,7 @@ ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *b
|
||||
{
|
||||
ssize_t size;
|
||||
|
||||
size = bb_full_read(archive_handle->src_fd, buf, count);
|
||||
size = full_read(archive_handle->src_fd, buf, count);
|
||||
if ((size != 0) && (size != count)) {
|
||||
bb_perror_msg_and_die("Short read, read %ld of %ld", (long)size, (long)count);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "libbb.h"
|
||||
@@ -16,7 +20,7 @@ void check_header_gzip(int src_fd)
|
||||
} formated;
|
||||
} header;
|
||||
|
||||
bb_xread_all(src_fd, header.raw, 8);
|
||||
xread(src_fd, header.raw, 8);
|
||||
|
||||
/* Check the compression method */
|
||||
if (header.formated.method != 8) {
|
||||
@@ -28,10 +32,10 @@ void check_header_gzip(int src_fd)
|
||||
/* bit 2 set: extra field present */
|
||||
unsigned char extra_short;
|
||||
|
||||
extra_short = bb_xread_char(src_fd) + (bb_xread_char(src_fd) << 8);
|
||||
extra_short = xread_char(src_fd) + (xread_char(src_fd) << 8);
|
||||
while (extra_short > 0) {
|
||||
/* Ignore extra field */
|
||||
bb_xread_char(src_fd);
|
||||
xread_char(src_fd);
|
||||
extra_short--;
|
||||
}
|
||||
}
|
||||
@@ -39,19 +43,19 @@ void check_header_gzip(int src_fd)
|
||||
/* Discard original name if any */
|
||||
if (header.formated.flags & 0x08) {
|
||||
/* bit 3 set: original file name present */
|
||||
while(bb_xread_char(src_fd) != 0);
|
||||
while(xread_char(src_fd) != 0);
|
||||
}
|
||||
|
||||
/* Discard file comment if any */
|
||||
if (header.formated.flags & 0x10) {
|
||||
/* bit 4 set: file comment present */
|
||||
while(bb_xread_char(src_fd) != 0);
|
||||
while(xread_char(src_fd) != 0);
|
||||
}
|
||||
|
||||
/* Read the header checksum */
|
||||
if (header.formated.flags & 0x02) {
|
||||
bb_xread_char(src_fd);
|
||||
bb_xread_char(src_fd);
|
||||
xread_char(src_fd);
|
||||
xread_char(src_fd);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* Copyright 2002 Glenn McGrath
|
||||
*
|
||||
* 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
@@ -21,8 +12,7 @@ void data_extract_to_buffer(archive_handle_t *archive_handle)
|
||||
{
|
||||
const unsigned int size = archive_handle->file_header->size;
|
||||
|
||||
archive_handle->buffer = xmalloc(size + 1);
|
||||
archive_handle->buffer = xzalloc(size + 1);
|
||||
|
||||
archive_xread_all(archive_handle, archive_handle->buffer, size);
|
||||
archive_handle->buffer[size] = '\0';
|
||||
xread(archive_handle->src_fd, archive_handle->buffer, size);
|
||||
}
|
||||
@@ -1,17 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include "unarchive.h"
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/* Small bzip2 deflate implementation, by Rob Landley (rob@landley.net).
|
||||
/* Small bzip2 deflate implementation, by Rob Landley (rob@landley.net).
|
||||
|
||||
Based on bzip2 decompression code by Julian R Seward (jseward@acm.org),
|
||||
which also acknowledges contributions by Mike Burrows, David Wheeler,
|
||||
Peter Fenwick, Alistair Moffat, Radford Neal, Ian H. Witten,
|
||||
Robert Sedgewick, and Jon L. Bentley.
|
||||
Based on bzip2 decompression code by Julian R Seward (jseward@acm.org),
|
||||
which also acknowledges contributions by Mike Burrows, David Wheeler,
|
||||
Peter Fenwick, Alistair Moffat, Radford Neal, Ian H. Witten,
|
||||
Robert Sedgewick, and Jon L. Bentley.
|
||||
|
||||
This code is licensed under the LGPLv2:
|
||||
LGPL http://www.gnu.org/copyleft/lgpl.html
|
||||
Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -24,7 +23,7 @@
|
||||
I would ask that anyone benefiting from this work, especially those
|
||||
using it in commercial products, consider making a donation to my local
|
||||
non-profit hospice organization (www.hospiceacadiana.com) in the name of
|
||||
the woman I loved, Toni W. Hagan, who passed away Feb. 12, 2003.
|
||||
the woman I loved, Toni W. Hagan, who passed away Feb. 12, 2003.
|
||||
|
||||
Manuel
|
||||
*/
|
||||
@@ -38,6 +37,8 @@
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
#include "unarchive.h"
|
||||
|
||||
/* Constants for Huffman coding */
|
||||
#define MAX_GROUPS 6
|
||||
#define GROUP_SIZE 50 /* 64 would have been more efficient */
|
||||
@@ -82,8 +83,8 @@ typedef struct {
|
||||
|
||||
/* The CRC values stored in the block header and calculated from the data */
|
||||
|
||||
unsigned int crc32Table[256],headerCRC, totalCRC, writeCRC;
|
||||
|
||||
uint32_t headerCRC, totalCRC, writeCRC;
|
||||
uint32_t *crc32Table;
|
||||
/* Intermediate buffer and its size (in bytes) */
|
||||
|
||||
unsigned int *dbuf, dbufSize;
|
||||
@@ -618,7 +619,7 @@ decode_next_byte:
|
||||
bd->writeCount=previous;
|
||||
return (previous!=RETVAL_LAST_BLOCK) ? previous : gotcount;
|
||||
}
|
||||
bd->writeCRC=0xffffffffUL;
|
||||
bd->writeCRC=~0;
|
||||
pos=bd->writePos;
|
||||
current=bd->writeCurrent;
|
||||
goto decode_next_byte;
|
||||
@@ -632,7 +633,7 @@ static int start_bunzip(bunzip_data **bdp, int in_fd, unsigned char *inbuf,
|
||||
int len)
|
||||
{
|
||||
bunzip_data *bd;
|
||||
unsigned int i,j,c;
|
||||
unsigned int i;
|
||||
const unsigned int BZh0=(((unsigned int)'B')<<24)+(((unsigned int)'Z')<<16)
|
||||
+(((unsigned int)'h')<<8)+(unsigned int)'0';
|
||||
|
||||
@@ -643,8 +644,7 @@ static int start_bunzip(bunzip_data **bdp, int in_fd, unsigned char *inbuf,
|
||||
|
||||
/* Allocate bunzip_data. Most fields initialize to zero. */
|
||||
|
||||
bd=*bdp=xmalloc(i);
|
||||
memset(bd,0,sizeof(bunzip_data));
|
||||
bd=*bdp=xzalloc(i);
|
||||
|
||||
/* Setup input buffer */
|
||||
|
||||
@@ -655,12 +655,7 @@ static int start_bunzip(bunzip_data **bdp, int in_fd, unsigned char *inbuf,
|
||||
|
||||
/* Init the CRC32 table (big endian) */
|
||||
|
||||
for(i=0;i<256;i++) {
|
||||
c=i<<24;
|
||||
for(j=8;j;j--)
|
||||
c=c&0x80000000 ? (c<<1)^0x04c11db7 : (c<<1);
|
||||
bd->crc32Table[i]=c;
|
||||
}
|
||||
bd->crc32Table = bb_crc32_filltable(1);
|
||||
|
||||
/* Setup for I/O error handling via longjmp */
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
#include "libbb.h"
|
||||
|
||||
/* uncompress for busybox -- (c) 2002 Robert Griebl
|
||||
@@ -76,7 +77,7 @@ static unsigned char inbuf[IBUFSIZ + 64];
|
||||
static unsigned char outbuf[OBUFSIZ + 2048];
|
||||
|
||||
|
||||
static long int htab[HSIZE];
|
||||
static unsigned char htab[HSIZE];
|
||||
static unsigned short codetab[HSIZE];
|
||||
|
||||
#define htabof(i) htab[i]
|
||||
@@ -115,7 +116,7 @@ int uncompress(int fd_in, int fd_out)
|
||||
|
||||
insize = 0;
|
||||
|
||||
inbuf[0] = bb_xread_char(fd_in);
|
||||
inbuf[0] = xread_char(fd_in);
|
||||
|
||||
maxbits = inbuf[0] & BIT_MASK;
|
||||
block_mode = inbuf[0] & BLOCK_MODE;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Small lzma deflate implementation.
|
||||
* Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
|
||||
@@ -5,29 +6,154 @@
|
||||
* Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/)
|
||||
* Copyright (C) 1999-2005 Igor Pavlov
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <byteswap.h>
|
||||
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
#include "rangecoder.h"
|
||||
#ifdef CONFIG_FEATURE_LZMA_FAST
|
||||
# define speed_inline ATTRIBUTE_ALWAYS_INLINE
|
||||
#else
|
||||
# define speed_inline
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
uint8_t *ptr;
|
||||
uint8_t *buffer;
|
||||
uint8_t *buffer_end;
|
||||
int buffer_size;
|
||||
uint32_t code;
|
||||
uint32_t range;
|
||||
uint32_t bound;
|
||||
} rc_t;
|
||||
|
||||
|
||||
#define RC_TOP_BITS 24
|
||||
#define RC_MOVE_BITS 5
|
||||
#define RC_MODEL_TOTAL_BITS 11
|
||||
|
||||
|
||||
/* Called twice: once at startup and once in rc_normalize() */
|
||||
static void rc_read(rc_t * rc)
|
||||
{
|
||||
rc->buffer_size = read(rc->fd, rc->buffer, rc->buffer_size);
|
||||
if (rc->buffer_size <= 0)
|
||||
bb_error_msg_and_die("unexpected EOF");
|
||||
rc->ptr = rc->buffer;
|
||||
rc->buffer_end = rc->buffer + rc->buffer_size;
|
||||
}
|
||||
|
||||
/* Called once */
|
||||
static void rc_init(rc_t * rc, int fd, int buffer_size)
|
||||
{
|
||||
int i;
|
||||
|
||||
rc->fd = fd;
|
||||
rc->buffer = xmalloc(buffer_size);
|
||||
rc->buffer_size = buffer_size;
|
||||
rc->buffer_end = rc->buffer + rc->buffer_size;
|
||||
rc->ptr = rc->buffer_end;
|
||||
|
||||
rc->code = 0;
|
||||
rc->range = 0xFFFFFFFF;
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (rc->ptr >= rc->buffer_end)
|
||||
rc_read(rc);
|
||||
rc->code = (rc->code << 8) | *rc->ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Called once. TODO: bb_maybe_free() */
|
||||
static ATTRIBUTE_ALWAYS_INLINE void rc_free(rc_t * rc)
|
||||
{
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
free(rc->buffer);
|
||||
}
|
||||
|
||||
/* Called twice, but one callsite is in speed_inline'd rc_is_bit_0_helper() */
|
||||
static void rc_do_normalize(rc_t * rc)
|
||||
{
|
||||
if (rc->ptr >= rc->buffer_end)
|
||||
rc_read(rc);
|
||||
rc->range <<= 8;
|
||||
rc->code = (rc->code << 8) | *rc->ptr++;
|
||||
}
|
||||
static ATTRIBUTE_ALWAYS_INLINE void rc_normalize(rc_t * rc)
|
||||
{
|
||||
if (rc->range < (1 << RC_TOP_BITS)) {
|
||||
rc_do_normalize(rc);
|
||||
}
|
||||
}
|
||||
|
||||
/* Called 9 times */
|
||||
/* Why rc_is_bit_0_helper exists?
|
||||
* Because we want to always expose (rc->code < rc->bound) to optimizer
|
||||
*/
|
||||
static speed_inline uint32_t rc_is_bit_0_helper(rc_t * rc, uint16_t * p)
|
||||
{
|
||||
rc_normalize(rc);
|
||||
rc->bound = *p * (rc->range >> RC_MODEL_TOTAL_BITS);
|
||||
return rc->bound;
|
||||
}
|
||||
static ATTRIBUTE_ALWAYS_INLINE int rc_is_bit_0(rc_t * rc, uint16_t * p)
|
||||
{
|
||||
uint32_t t = rc_is_bit_0_helper(rc, p);
|
||||
return rc->code < t;
|
||||
}
|
||||
|
||||
/* Called ~10 times, but very small, thus inlined */
|
||||
static speed_inline void rc_update_bit_0(rc_t * rc, uint16_t * p)
|
||||
{
|
||||
rc->range = rc->bound;
|
||||
*p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS;
|
||||
}
|
||||
static speed_inline void rc_update_bit_1(rc_t * rc, uint16_t * p)
|
||||
{
|
||||
rc->range -= rc->bound;
|
||||
rc->code -= rc->bound;
|
||||
*p -= *p >> RC_MOVE_BITS;
|
||||
}
|
||||
|
||||
/* Called 4 times in unlzma loop */
|
||||
static int rc_get_bit(rc_t * rc, uint16_t * p, int *symbol)
|
||||
{
|
||||
if (rc_is_bit_0(rc, p)) {
|
||||
rc_update_bit_0(rc, p);
|
||||
*symbol *= 2;
|
||||
return 0;
|
||||
} else {
|
||||
rc_update_bit_1(rc, p);
|
||||
*symbol = *symbol * 2 + 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Called once */
|
||||
static ATTRIBUTE_ALWAYS_INLINE int rc_direct_bit(rc_t * rc)
|
||||
{
|
||||
rc_normalize(rc);
|
||||
rc->range >>= 1;
|
||||
if (rc->code >= rc->range) {
|
||||
rc->code -= rc->range;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Called twice */
|
||||
static speed_inline void
|
||||
rc_bit_tree_decode(rc_t * rc, uint16_t * p, int num_levels, int *symbol)
|
||||
{
|
||||
int i = num_levels;
|
||||
|
||||
*symbol = 1;
|
||||
while (i--)
|
||||
rc_get_bit(rc, p + *symbol, symbol);
|
||||
*symbol -= 1 << num_levels;
|
||||
}
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -119,10 +245,8 @@ int unlzma(int src_fd, int dst_fd)
|
||||
pos_state_mask = (1 << pb) - 1;
|
||||
literal_pos_mask = (1 << lp) - 1;
|
||||
|
||||
#if BB_BIG_ENDIAN
|
||||
header.dict_size = bswap_32(header.dict_size);
|
||||
header.dst_size = bswap_64(header.dst_size);
|
||||
#endif
|
||||
header.dict_size = SWAP_LE32(header.dict_size);
|
||||
header.dst_size = SWAP_LE64(header.dst_size);
|
||||
|
||||
if (header.dict_size == 0)
|
||||
header.dict_size = 1;
|
||||
@@ -344,4 +468,3 @@ int unlzma(int src_fd, int dst_fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vi:set ts=4: */
|
||||
@@ -21,21 +21,6 @@
|
||||
* to free leaked bytebuffer memory (used in unzip.c), and some minor style
|
||||
* guide cleanups by Ed Clark
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
|
||||
* Copyright (C) 1992-1993 Jean-loup Gailly
|
||||
* The unzip code was written and put in the public domain by Mark Adler.
|
||||
@@ -43,38 +28,14 @@
|
||||
* written by Spencer Thomas, Joe Orost, James Woods, Jim McKie, Steve Davies,
|
||||
* Ken Turkowski, Dave Mack and Peter Jannesen.
|
||||
*
|
||||
* See the license_msg below and the file COPYING for the software license.
|
||||
* See the file algorithm.doc for the compression algorithms and file formats.
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static char *license_msg[] = {
|
||||
" Copyright (C) 1992-1993 Jean-loup Gailly",
|
||||
" 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., 675 Mass Ave, Cambridge, MA 02139, USA.",
|
||||
0
|
||||
};
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "libbb.h"
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
typedef struct huft_s {
|
||||
@@ -95,8 +56,8 @@ static unsigned int gunzip_outbuf_count; /* bytes in output buffer */
|
||||
enum { gunzip_wsize = 0x8000 };
|
||||
static unsigned char *gunzip_window;
|
||||
|
||||
static unsigned int *gunzip_crc_table;
|
||||
unsigned int gunzip_crc;
|
||||
static uint32_t *gunzip_crc_table;
|
||||
uint32_t gunzip_crc;
|
||||
|
||||
/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
|
||||
#define BMAX 16 /* maximum bit length of any code (16 for explode) */
|
||||
@@ -155,9 +116,8 @@ static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current
|
||||
/* Leave the first 4 bytes empty so we can always unwind the bitbuffer
|
||||
* to the front of the bytebuffer, leave 4 bytes free at end of tail
|
||||
* so we can easily top up buffer in check_trailer_gzip() */
|
||||
if (!(bytebuffer_size = bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8))) {
|
||||
if (1 > (bytebuffer_size = safe_read(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8)))
|
||||
bb_error_msg_and_die("unexpected end of file");
|
||||
}
|
||||
bytebuffer_size += 4;
|
||||
bytebuffer_offset = 4;
|
||||
}
|
||||
@@ -168,35 +128,6 @@ static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current
|
||||
return(bitbuffer);
|
||||
}
|
||||
|
||||
static void make_gunzip_crc_table(void)
|
||||
{
|
||||
const unsigned int poly = 0xedb88320; /* polynomial exclusive-or pattern */
|
||||
unsigned short i; /* counter for all possible eight bit values */
|
||||
|
||||
/* initial shift register value */
|
||||
gunzip_crc = 0xffffffffL;
|
||||
gunzip_crc_table = (unsigned int *) xmalloc(256 * sizeof(unsigned int));
|
||||
|
||||
/* Compute and print table of CRC's, five per line */
|
||||
for (i = 0; i < 256; i++) {
|
||||
unsigned int table_entry; /* crc shift register */
|
||||
unsigned char k; /* byte being shifted into crc apparatus */
|
||||
|
||||
table_entry = i;
|
||||
/* The idea to initialize the register with the byte instead of
|
||||
* zero was stolen from Haruhiko Okumura's ar002
|
||||
*/
|
||||
for (k = 8; k; k--) {
|
||||
if (table_entry & 1) {
|
||||
table_entry = (table_entry >> 1) ^ poly;
|
||||
} else {
|
||||
table_entry >>= 1;
|
||||
}
|
||||
}
|
||||
gunzip_crc_table[i] = table_entry;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the malloc'ed tables built by huft_build(), which makes a linked
|
||||
* list of the tables it made, with the links in a dummy first entry of
|
||||
@@ -232,6 +163,7 @@ static int huft_free(huft_t * t)
|
||||
* t: result: starting table
|
||||
* m: maximum lookup bits, returns actual
|
||||
*/
|
||||
static
|
||||
int huft_build(unsigned int *b, const unsigned int n,
|
||||
const unsigned int s, const unsigned short *d,
|
||||
const unsigned char *e, huft_t ** t, unsigned int *m)
|
||||
@@ -241,17 +173,17 @@ int huft_build(unsigned int *b, const unsigned int n,
|
||||
unsigned eob_len; /* length of end-of-block code (value 256) */
|
||||
unsigned f; /* i repeats in table every f entries */
|
||||
int g; /* maximum code length */
|
||||
int h; /* table level */
|
||||
register unsigned i; /* counter, current code */
|
||||
register unsigned j; /* counter */
|
||||
register int k; /* number of bits in current code */
|
||||
register unsigned *p; /* pointer into c[], b[], or v[] */
|
||||
register huft_t *q; /* points to current table */
|
||||
int htl; /* table level */
|
||||
unsigned i; /* counter, current code */
|
||||
unsigned j; /* counter */
|
||||
int k; /* number of bits in current code */
|
||||
unsigned *p; /* pointer into c[], b[], or v[] */
|
||||
huft_t *q; /* points to current table */
|
||||
huft_t r; /* table entry for structure assignment */
|
||||
huft_t *u[BMAX]; /* table stack */
|
||||
unsigned v[N_MAX]; /* values in order of bit length */
|
||||
int ws[BMAX+1]; /* bits decoded stack */
|
||||
register int w; /* bits decoded */
|
||||
int w; /* bits decoded */
|
||||
unsigned x[BMAX + 1]; /* bit offsets, then code stack */
|
||||
unsigned *xp; /* pointer into x */
|
||||
int y; /* number of dummy codes added */
|
||||
@@ -312,7 +244,7 @@ int huft_build(unsigned int *b, const unsigned int n,
|
||||
/* Generate the Huffman codes and for each, make the table entries */
|
||||
x[0] = i = 0; /* first Huffman code is zero */
|
||||
p = v; /* grab values in bit order */
|
||||
h = -1; /* no tables yet--level -1 */
|
||||
htl = -1; /* no tables yet--level -1 */
|
||||
w = ws[0] = 0; /* bits decoded */
|
||||
u[0] = (huft_t *) NULL; /* just to keep compilers happy */
|
||||
q = (huft_t *) NULL; /* ditto */
|
||||
@@ -324,8 +256,8 @@ int huft_build(unsigned int *b, const unsigned int n,
|
||||
while (a--) {
|
||||
/* here i is the Huffman code of length k bits for value *p */
|
||||
/* make tables up to required level */
|
||||
while (k > ws[h + 1]) {
|
||||
w = ws[++h];
|
||||
while (k > ws[htl + 1]) {
|
||||
w = ws[++htl];
|
||||
|
||||
/* compute minimum size table less than or equal to *m bits */
|
||||
z = (z = g - w) > *m ? *m : z; /* upper limit on table size */
|
||||
@@ -342,22 +274,22 @@ int huft_build(unsigned int *b, const unsigned int n,
|
||||
}
|
||||
j = (w + j > eob_len && w < eob_len) ? eob_len - w : j; /* make EOB code end at table */
|
||||
z = 1 << j; /* table entries for j-bit table */
|
||||
ws[h+1] = w + j; /* set bits decoded in stack */
|
||||
ws[htl+1] = w + j; /* set bits decoded in stack */
|
||||
|
||||
/* allocate and link in new table */
|
||||
q = (huft_t *) xmalloc((z + 1) * sizeof(huft_t));
|
||||
q = (huft_t *) xzalloc((z + 1) * sizeof(huft_t));
|
||||
*t = q + 1; /* link to list for huft_free() */
|
||||
*(t = &(q->v.t)) = NULL;
|
||||
u[h] = ++q; /* table starts after link */
|
||||
t = &(q->v.t);
|
||||
u[htl] = ++q; /* table starts after link */
|
||||
|
||||
/* connect to last table, if there is one */
|
||||
if (h) {
|
||||
x[h] = i; /* save pattern for backing up */
|
||||
r.b = (unsigned char) (w - ws[h - 1]); /* bits to dump before this table */
|
||||
if (htl) {
|
||||
x[htl] = i; /* save pattern for backing up */
|
||||
r.b = (unsigned char) (w - ws[htl - 1]); /* bits to dump before this table */
|
||||
r.e = (unsigned char) (16 + j); /* bits in this table */
|
||||
r.v.t = q; /* pointer to this table */
|
||||
j = (i & ((1 << w) - 1)) >> ws[h - 1];
|
||||
u[h - 1][j] = r; /* connect to last table */
|
||||
j = (i & ((1 << w) - 1)) >> ws[htl - 1];
|
||||
u[htl - 1][j] = r; /* connect to last table */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,8 +318,8 @@ int huft_build(unsigned int *b, const unsigned int n,
|
||||
i ^= j;
|
||||
|
||||
/* backup over finished tables */
|
||||
while ((i & ((1 << w) - 1)) != x[h]) {
|
||||
w = ws[--h];
|
||||
while ((i & ((1 << w) - 1)) != x[htl]) {
|
||||
w = ws[--htl];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -581,7 +513,7 @@ static int inflate_stored(int my_n, int my_b_stored, int my_k_stored, int setup)
|
||||
static int inflate_block(int *e)
|
||||
{
|
||||
unsigned t; /* block type */
|
||||
register unsigned int b; /* bit buffer */
|
||||
unsigned int b; /* bit buffer */
|
||||
unsigned int k; /* number of bits in bit buffer */
|
||||
|
||||
/* make local bit buffer */
|
||||
@@ -921,14 +853,15 @@ int inflate_unzip(int in, int out)
|
||||
gunzip_bb = 0;
|
||||
|
||||
/* Create the crc table */
|
||||
make_gunzip_crc_table();
|
||||
|
||||
gunzip_crc_table = bb_crc32_filltable(0);
|
||||
gunzip_crc = ~0;
|
||||
|
||||
/* Allocate space for buffer */
|
||||
bytebuffer = xmalloc(bytebuffer_max);
|
||||
|
||||
while(1) {
|
||||
int ret = inflate_get_next_window();
|
||||
nwrote = bb_full_write(out, gunzip_window, gunzip_outbuf_count);
|
||||
nwrote = full_write(out, gunzip_window, gunzip_outbuf_count);
|
||||
if (nwrote == -1) {
|
||||
bb_perror_msg("write");
|
||||
return -1;
|
||||
@@ -954,7 +887,7 @@ int inflate_unzip(int in, int out)
|
||||
|
||||
int inflate_gunzip(int in, int out)
|
||||
{
|
||||
unsigned int stored_crc = 0;
|
||||
uint32_t stored_crc = 0;
|
||||
unsigned int count;
|
||||
|
||||
inflate_unzip(in, out);
|
||||
@@ -962,7 +895,7 @@ int inflate_gunzip(int in, int out)
|
||||
/* top up the input buffer with the rest of the trailer */
|
||||
count = bytebuffer_size - bytebuffer_offset;
|
||||
if (count < 8) {
|
||||
bb_xread_all(in, &bytebuffer[bytebuffer_size], 8 - count);
|
||||
xread(in, &bytebuffer[bytebuffer_size], 8 - count);
|
||||
bytebuffer_size += 8 - count;
|
||||
}
|
||||
for (count = 0; count != 4; count++) {
|
||||
@@ -971,7 +904,7 @@ int inflate_gunzip(int in, int out)
|
||||
}
|
||||
|
||||
/* Validate decompression - crc */
|
||||
if (stored_crc != (gunzip_crc ^ 0xffffffffL)) {
|
||||
if (stored_crc != (~gunzip_crc)) {
|
||||
bb_error_msg("crc error");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1,24 +1,11 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Copyright (C) 2002 by Glenn McGrath
|
||||
* Copyright (C) 2002 by Glenn McGrath
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <fnmatch.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "unarchive.h"
|
||||
|
||||
/* Accept any non-null name, its not really a filter at all */
|
||||
|
||||
@@ -1,24 +1,11 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Copyright (C) 2002 by Glenn McGrath
|
||||
* Copyright (C) 2002 by Glenn McGrath
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <fnmatch.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "unarchive.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Copyright (C) 2002 by Glenn McGrath
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1,24 +1,11 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Copyright (C) 2002 by Glenn McGrath
|
||||
* Copyright (C) 2002 by Glenn McGrath
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <fnmatch.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "unarchive.h"
|
||||
|
||||
/*
|
||||
@@ -27,16 +14,17 @@
|
||||
char filter_accept_reject_list(archive_handle_t *archive_handle)
|
||||
{
|
||||
const char *key = archive_handle->file_header->name;
|
||||
const llist_t *accept_entry = find_list_entry(archive_handle->accept, key);
|
||||
const llist_t *reject_entry = find_list_entry(archive_handle->reject, key);
|
||||
const llist_t *accept_entry;
|
||||
|
||||
/* If the key is in a reject list fail */
|
||||
if (reject_entry) {
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
accept_entry = find_list_entry(archive_handle->accept, key);
|
||||
|
||||
/* Fail if an accept list was specified and the key wasnt in there */
|
||||
if (archive_handle->accept && (accept_entry == NULL)) {
|
||||
if ((accept_entry == NULL) && archive_handle->accept) {
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +1,20 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* Copyright (C) 2002 by Glenn McGrath
|
||||
*
|
||||
* 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <fnmatch.h>
|
||||
#include <stdlib.h>
|
||||
#include "unarchive.h"
|
||||
|
||||
/* Find a string in a list */
|
||||
const llist_t *find_list_entry(const llist_t *list, const char *filename)
|
||||
{
|
||||
while (list) {
|
||||
if (fnmatch(list->data, filename, 0) == 0) {
|
||||
return(list);
|
||||
return (list);
|
||||
}
|
||||
list = list->link;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/* Copyright 2001 Glenn McGrath.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -53,7 +43,7 @@ char get_header_ar(archive_handle_t *archive_handle)
|
||||
if (ar.raw[0] == '\n') {
|
||||
/* fix up the header, we started reading 1 byte too early */
|
||||
memmove(ar.raw, &ar.raw[1], 59);
|
||||
ar.raw[59] = bb_xread_char(archive_handle->src_fd);
|
||||
ar.raw[59] = xread_char(archive_handle->src_fd);
|
||||
archive_handle->offset++;
|
||||
}
|
||||
archive_handle->offset += 60;
|
||||
@@ -78,7 +68,7 @@ char get_header_ar(archive_handle_t *archive_handle)
|
||||
* in static variable long_names for use in future entries */
|
||||
ar_long_name_size = typed->size;
|
||||
ar_long_names = xmalloc(ar_long_name_size);
|
||||
bb_xread_all(archive_handle->src_fd, ar_long_names, ar_long_name_size);
|
||||
xread(archive_handle->src_fd, ar_long_names, ar_long_name_size);
|
||||
archive_handle->offset += ar_long_name_size;
|
||||
/* This ar entries data section only contained filenames for other records
|
||||
* they are stored in the static ar_long_names for future reference */
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/* Copyright 2002 Laurence Anderson
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -85,9 +75,9 @@ char get_header_cpio(archive_handle_t *archive_handle)
|
||||
file_header->size = tmpsize;
|
||||
}
|
||||
|
||||
file_header->name = (char *) xmalloc(namesize + 1);
|
||||
archive_xread_all(archive_handle, file_header->name, namesize); /* Read in filename */
|
||||
file_header->name[namesize] = '\0';
|
||||
file_header->name = (char *) xzalloc(namesize + 1);
|
||||
/* Read in filename */
|
||||
xread(archive_handle->src_fd, file_header->name, namesize);
|
||||
archive_handle->offset += namesize;
|
||||
|
||||
/* Update offset amount and skip padding before file contents */
|
||||
@@ -113,9 +103,8 @@ char get_header_cpio(archive_handle_t *archive_handle)
|
||||
}
|
||||
|
||||
if (S_ISLNK(file_header->mode)) {
|
||||
file_header->link_name = (char *) xmalloc(file_header->size + 1);
|
||||
archive_xread_all(archive_handle, file_header->link_name, file_header->size);
|
||||
file_header->link_name[file_header->size] = '\0';
|
||||
file_header->link_name = (char *) xzalloc(file_header->size + 1);
|
||||
xread(archive_handle->src_fd, file_header->link_name, file_header->size);
|
||||
archive_handle->offset += file_header->size;
|
||||
file_header->size = 0; /* Stop possible seeks in future */
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*
|
||||
* FIXME:
|
||||
@@ -55,11 +56,7 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
/* Align header */
|
||||
data_align(archive_handle, 512);
|
||||
|
||||
if (bb_full_read(archive_handle->src_fd, tar.raw, 512) != 512) {
|
||||
/* Assume end of file */
|
||||
bb_error_msg_and_die("Short header");
|
||||
//return(EXIT_FAILURE);
|
||||
}
|
||||
xread(archive_handle->src_fd, tar.raw, 512);
|
||||
archive_handle->offset += 512;
|
||||
|
||||
/* If there is no filename its an empty header */
|
||||
@@ -68,7 +65,7 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
/* This is the second consecutive empty header! End of archive!
|
||||
* Read until the end to empty the pipe from gz or bz2
|
||||
*/
|
||||
while (bb_full_read(archive_handle->src_fd, tar.raw, 512) == 512);
|
||||
while (full_read(archive_handle->src_fd, tar.raw, 512) == 512);
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
end = 1;
|
||||
@@ -80,7 +77,7 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
* 0's are for the old tar format
|
||||
*/
|
||||
if (strncmp(tar.formated.magic, "ustar", 5) != 0) {
|
||||
#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
|
||||
#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY
|
||||
if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0)
|
||||
#endif
|
||||
bb_error_msg_and_die("Invalid tar magic");
|
||||
@@ -136,15 +133,11 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
case '1':
|
||||
file_header->mode |= S_IFREG;
|
||||
break;
|
||||
case 'x':
|
||||
case 'g':
|
||||
bb_error_msg_and_die("pax is not tar");
|
||||
break;
|
||||
case '7':
|
||||
/* Reserved for high performance files, treat as normal file */
|
||||
case 0:
|
||||
case '0':
|
||||
#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
|
||||
#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY
|
||||
if (last_char_is(file_header->name, '/')) {
|
||||
file_header->mode |= S_IFDIR;
|
||||
} else
|
||||
@@ -168,17 +161,15 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
break;
|
||||
#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
|
||||
case 'L': {
|
||||
longname = xmalloc(file_header->size + 1);
|
||||
archive_xread_all(archive_handle, longname, file_header->size);
|
||||
longname[file_header->size] = '\0';
|
||||
longname = xzalloc(file_header->size + 1);
|
||||
xread(archive_handle->src_fd, longname, file_header->size);
|
||||
archive_handle->offset += file_header->size;
|
||||
|
||||
return(get_header_tar(archive_handle));
|
||||
}
|
||||
case 'K': {
|
||||
linkname = xmalloc(file_header->size + 1);
|
||||
archive_xread_all(archive_handle, linkname, file_header->size);
|
||||
linkname[file_header->size] = '\0';
|
||||
linkname = xzalloc(file_header->size + 1);
|
||||
xread(archive_handle->src_fd, linkname, file_header->size);
|
||||
archive_handle->offset += file_header->size;
|
||||
|
||||
file_header->name = linkname;
|
||||
@@ -189,8 +180,11 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
case 'N': /* Old GNU for names > 100 characters */
|
||||
case 'S': /* Sparse file */
|
||||
case 'V': /* Volume header */
|
||||
bb_error_msg("Ignoring GNU extension type %c", tar.formated.typeflag);
|
||||
#endif
|
||||
case 'g': /* pax global header */
|
||||
case 'x': /* pax extended header */
|
||||
bb_error_msg("Ignoring extension type %c", tar.formated.typeflag);
|
||||
break;
|
||||
default:
|
||||
bb_error_msg("Unknown typeflag: 0x%x", tar.formated.typeflag);
|
||||
}
|
||||
@@ -206,7 +200,7 @@ char get_header_tar(archive_handle_t *archive_handle)
|
||||
archive_handle->action_header(archive_handle->file_header);
|
||||
archive_handle->flags |= ARCHIVE_EXTRACT_QUIET;
|
||||
archive_handle->action_data(archive_handle);
|
||||
archive_handle->passed = llist_add_to(archive_handle->passed, file_header->name);
|
||||
llist_add_to(&(archive_handle->passed), file_header->name);
|
||||
} else {
|
||||
data_skip(archive_handle);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -26,7 +15,7 @@ char get_header_tar_gz(archive_handle_t *archive_handle)
|
||||
/* Cant lseek over pipe's */
|
||||
archive_handle->seek = seek_by_char;
|
||||
|
||||
archive_xread_all(archive_handle, &magic, 2);
|
||||
xread(archive_handle->src_fd, &magic, 2);
|
||||
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
|
||||
bb_error_msg_and_die("Invalid gzip magic");
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Small lzma deflate implementation.
|
||||
* Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
|
||||
@@ -20,4 +21,3 @@ char get_header_tar_lzma(archive_handle_t * archive_handle)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* vi:set ts=4: */
|
||||
@@ -1,3 +1,7 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "unarchive.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "unarchive.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
@@ -24,8 +13,7 @@ archive_handle_t *init_handle(void)
|
||||
archive_handle_t *archive_handle;
|
||||
|
||||
/* Initialise default values */
|
||||
archive_handle = xmalloc(sizeof(archive_handle_t));
|
||||
memset(archive_handle, 0, sizeof(archive_handle_t));
|
||||
archive_handle = xzalloc(sizeof(archive_handle_t));
|
||||
archive_handle->file_header = xmalloc(sizeof(file_header_t));
|
||||
archive_handle->action_header = header_skip;
|
||||
archive_handle->action_data = data_skip;
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -19,6 +8,8 @@
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
#include "unarchive.h"
|
||||
|
||||
/* transformer(), more than meets the eye */
|
||||
int open_transformer(int src_fd, int (*transformer)(int src_fd, int dst_fd))
|
||||
{
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
/*
|
||||
* Small range coder implementation for lzma.
|
||||
* Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
|
||||
*
|
||||
* Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/)
|
||||
* Copyright (c) 1999-2005 Igor Pavlov
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
#ifndef always_inline
|
||||
# if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >0)
|
||||
# define always_inline __attribute__((always_inline)) inline
|
||||
# else
|
||||
# define always_inline inline
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FEATURE_LZMA_FAST
|
||||
# define speed_inline always_inline
|
||||
#else
|
||||
# define speed_inline
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
uint8_t *ptr;
|
||||
uint8_t *buffer;
|
||||
uint8_t *buffer_end;
|
||||
int buffer_size;
|
||||
uint32_t code;
|
||||
uint32_t range;
|
||||
uint32_t bound;
|
||||
} rc_t;
|
||||
|
||||
|
||||
#define RC_TOP_BITS 24
|
||||
#define RC_MOVE_BITS 5
|
||||
#define RC_MODEL_TOTAL_BITS 11
|
||||
|
||||
|
||||
/* Called twice: once at startup and once in rc_normalize() */
|
||||
static void rc_read(rc_t * rc)
|
||||
{
|
||||
rc->buffer_size = read(rc->fd, rc->buffer, rc->buffer_size);
|
||||
if (rc->buffer_size <= 0)
|
||||
bb_error_msg_and_die("unexpected EOF");
|
||||
rc->ptr = rc->buffer;
|
||||
rc->buffer_end = rc->buffer + rc->buffer_size;
|
||||
}
|
||||
|
||||
/* Called once */
|
||||
static always_inline void rc_init(rc_t * rc, int fd, int buffer_size)
|
||||
{
|
||||
int i;
|
||||
|
||||
rc->fd = fd;
|
||||
rc->buffer = malloc(buffer_size);
|
||||
rc->buffer_size = buffer_size;
|
||||
rc->buffer_end = rc->buffer + rc->buffer_size;
|
||||
rc->ptr = rc->buffer_end;
|
||||
|
||||
rc->code = 0;
|
||||
rc->range = 0xFFFFFFFF;
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (rc->ptr >= rc->buffer_end)
|
||||
rc_read(rc);
|
||||
rc->code = (rc->code << 8) | *rc->ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Called once. TODO: bb_maybe_free() */
|
||||
static always_inline void rc_free(rc_t * rc)
|
||||
{
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
free(rc->buffer);
|
||||
}
|
||||
|
||||
/* Called twice, but one callsite is in speed_inline'd rc_is_bit_0_helper() */
|
||||
static void rc_do_normalize(rc_t * rc)
|
||||
{
|
||||
if (rc->ptr >= rc->buffer_end)
|
||||
rc_read(rc);
|
||||
rc->range <<= 8;
|
||||
rc->code = (rc->code << 8) | *rc->ptr++;
|
||||
}
|
||||
static always_inline void rc_normalize(rc_t * rc)
|
||||
{
|
||||
if (rc->range < (1 << RC_TOP_BITS)) {
|
||||
rc_do_normalize(rc);
|
||||
}
|
||||
}
|
||||
|
||||
/* Called 9 times */
|
||||
/* Why rc_is_bit_0_helper exists?
|
||||
* Because we want to always expose (rc->code < rc->bound) to optimizer
|
||||
*/
|
||||
static speed_inline uint32_t rc_is_bit_0_helper(rc_t * rc, uint16_t * p)
|
||||
{
|
||||
rc_normalize(rc);
|
||||
rc->bound = *p * (rc->range >> RC_MODEL_TOTAL_BITS);
|
||||
return rc->bound;
|
||||
}
|
||||
static always_inline int rc_is_bit_0(rc_t * rc, uint16_t * p)
|
||||
{
|
||||
uint32_t t = rc_is_bit_0_helper(rc, p);
|
||||
return rc->code < t;
|
||||
}
|
||||
|
||||
/* Called ~10 times, but very small, thus inlined */
|
||||
static speed_inline void rc_update_bit_0(rc_t * rc, uint16_t * p)
|
||||
{
|
||||
rc->range = rc->bound;
|
||||
*p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS;
|
||||
}
|
||||
static speed_inline void rc_update_bit_1(rc_t * rc, uint16_t * p)
|
||||
{
|
||||
rc->range -= rc->bound;
|
||||
rc->code -= rc->bound;
|
||||
*p -= *p >> RC_MOVE_BITS;
|
||||
}
|
||||
|
||||
/* Called 4 times in unlzma loop */
|
||||
static int rc_get_bit(rc_t * rc, uint16_t * p, int *symbol)
|
||||
{
|
||||
if (rc_is_bit_0(rc, p)) {
|
||||
rc_update_bit_0(rc, p);
|
||||
*symbol *= 2;
|
||||
return 0;
|
||||
} else {
|
||||
rc_update_bit_1(rc, p);
|
||||
*symbol = *symbol * 2 + 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Called once */
|
||||
static always_inline int rc_direct_bit(rc_t * rc)
|
||||
{
|
||||
rc_normalize(rc);
|
||||
rc->range >>= 1;
|
||||
if (rc->code >= rc->range) {
|
||||
rc->code -= rc->range;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Called twice */
|
||||
static speed_inline void
|
||||
rc_bit_tree_decode(rc_t * rc, uint16_t * p, int num_levels, int *symbol)
|
||||
{
|
||||
int i = num_levels;
|
||||
|
||||
*symbol = 1;
|
||||
while (i--)
|
||||
rc_get_bit(rc, p + *symbol, symbol);
|
||||
*symbol -= 1 << num_levels;
|
||||
}
|
||||
|
||||
/* vi:set ts=4: */
|
||||
@@ -1,23 +1,14 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "unarchive.h"
|
||||
#include "busybox.h"
|
||||
#include "libbb.h"
|
||||
|
||||
|
||||
|
||||
/* If we are reading through a pipe(), or from stdin then we cant lseek,
|
||||
* we must read and discard the data to skip over it.
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -1,29 +1,18 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU 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.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "unarchive.h"
|
||||
#include "busybox.h"
|
||||
#include "libbb.h"
|
||||
|
||||
void unpack_ar_archive(archive_handle_t *ar_archive)
|
||||
{
|
||||
char magic[7];
|
||||
|
||||
archive_xread_all(ar_archive, magic, 7);
|
||||
xread(ar_archive->src_fd, magic, 7);
|
||||
if (strncmp(magic, "!<arch>", 7) != 0) {
|
||||
bb_error_msg_and_die("Invalid ar magic");
|
||||
}
|
||||
|
||||
+6
-9
@@ -193,12 +193,12 @@ void extract_cpio_gz(int fd) {
|
||||
archive_handle->src_fd = fd;
|
||||
archive_handle->offset = 0;
|
||||
|
||||
bb_xread_all(archive_handle->src_fd, &magic, 2);
|
||||
xread(archive_handle->src_fd, &magic, 2);
|
||||
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
|
||||
bb_error_msg_and_die("Invalid gzip magic");
|
||||
}
|
||||
check_header_gzip(archive_handle->src_fd);
|
||||
chdir("/"); // Install RPM's to root
|
||||
bb_xchdir("/"); // Install RPM's to root
|
||||
|
||||
archive_handle->src_fd = open_transformer(archive_handle->src_fd, inflate_gunzip);
|
||||
archive_handle->offset = 0;
|
||||
@@ -208,7 +208,7 @@ void extract_cpio_gz(int fd) {
|
||||
|
||||
rpm_index **rpm_gettags(int fd, int *num_tags)
|
||||
{
|
||||
rpm_index **tags = calloc(200, sizeof(struct rpmtag *)); /* We should never need mode than 200, and realloc later */
|
||||
rpm_index **tags = xzalloc(200 * sizeof(struct rpmtag *)); /* We should never need mode than 200, and realloc later */
|
||||
int pass, tagindex = 0;
|
||||
lseek(fd, 96, SEEK_CUR); /* Seek past the unused lead */
|
||||
|
||||
@@ -327,13 +327,10 @@ void fileaction_list(char *filename, int ATTRIBUTE_UNUSED fileref)
|
||||
void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref))
|
||||
{
|
||||
int count = 0;
|
||||
char *filename, *tmp_dirname, *tmp_basename;
|
||||
while (rpm_getstring(filetag, count)) {
|
||||
tmp_dirname = rpm_getstring(RPMTAG_DIRNAMES, rpm_getint(RPMTAG_DIRINDEXES, count)); /* 1st put on the directory */
|
||||
tmp_basename = rpm_getstring(RPMTAG_BASENAMES, count);
|
||||
filename = xmalloc(strlen(tmp_basename) + strlen(tmp_dirname) + 1);
|
||||
strcpy(filename, tmp_dirname); /* First the directory name */
|
||||
strcat(filename, tmp_basename); /* then the filename */
|
||||
char * filename = bb_xasprintf("%s%s",
|
||||
rpm_getstring(RPMTAG_DIRNAMES, rpm_getint(RPMTAG_DIRINDEXES,
|
||||
count)), rpm_getstring(RPMTAG_BASENAMES, count));
|
||||
fileaction(filename, count++);
|
||||
free(filename);
|
||||
}
|
||||
|
||||
+4
-16
@@ -4,19 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 2001 by Laurence Anderson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h> /* For ntohl & htonl function */
|
||||
@@ -52,7 +40,7 @@ static void skip_header(int rpm_fd)
|
||||
{
|
||||
struct rpm_header header;
|
||||
|
||||
bb_xread_all(rpm_fd, &header, sizeof(struct rpm_header));
|
||||
xread(rpm_fd, &header, sizeof(struct rpm_header));
|
||||
if (strncmp((char *) &header.magic, RPM_HEADER_MAGIC, 3) != 0) {
|
||||
bb_error_msg_and_die("Invalid RPM header magic"); /* Invalid magic */
|
||||
}
|
||||
@@ -78,7 +66,7 @@ int rpm2cpio_main(int argc, char **argv)
|
||||
rpm_fd = bb_xopen(argv[1], O_RDONLY);
|
||||
}
|
||||
|
||||
bb_xread_all(rpm_fd, &lead, sizeof(struct rpm_lead));
|
||||
xread(rpm_fd, &lead, sizeof(struct rpm_lead));
|
||||
if (strncmp((char *) &lead.magic, RPM_MAGIC, 4) != 0) {
|
||||
bb_error_msg_and_die("Invalid RPM magic"); /* Just check the magic, the rest is irrelevant */
|
||||
}
|
||||
@@ -90,7 +78,7 @@ int rpm2cpio_main(int argc, char **argv)
|
||||
/* Skip the main header */
|
||||
skip_header(rpm_fd);
|
||||
|
||||
bb_xread_all(rpm_fd, &magic, 2);
|
||||
xread(rpm_fd, &magic, 2);
|
||||
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
|
||||
bb_error_msg_and_die("Invalid gzip magic");
|
||||
}
|
||||
|
||||
+16
-21
@@ -19,9 +19,8 @@
|
||||
*
|
||||
* Based in part on the tar implementation from busybox-0.28
|
||||
* Copyright (C) 1995 Bruce Perens
|
||||
* This is free software under the GNU General Public License.
|
||||
*
|
||||
* Licensed under GPL v2 (or later), see file LICENSE in this tarball.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@@ -43,12 +42,8 @@
|
||||
#ifdef CONFIG_FEATURE_TAR_CREATE
|
||||
|
||||
/* Tar file constants */
|
||||
# define TAR_MAGIC "ustar" /* ustar and a null */
|
||||
# define TAR_VERSION " " /* Be compatable with GNU tar format */
|
||||
|
||||
#define TAR_BLOCK_SIZE 512
|
||||
#define TAR_MAGIC_LEN 6
|
||||
#define TAR_VERSION_LEN 2
|
||||
|
||||
/* POSIX tar Header Block, from POSIX 1003.1-1990 */
|
||||
#define NAME_SIZE 100
|
||||
@@ -209,15 +204,14 @@ static inline int writeTarHeader(struct TarBallInfo *tbInfo,
|
||||
|
||||
memset(&header, 0, size);
|
||||
|
||||
strncpy(header.name, header_name, sizeof(header.name));
|
||||
safe_strncpy(header.name, header_name, sizeof(header.name));
|
||||
|
||||
putOctal(header.mode, sizeof(header.mode), statbuf->st_mode);
|
||||
putOctal(header.uid, sizeof(header.uid), statbuf->st_uid);
|
||||
putOctal(header.gid, sizeof(header.gid), statbuf->st_gid);
|
||||
putOctal(header.size, sizeof(header.size), 0); /* Regular file size is handled later */
|
||||
putOctal(header.mtime, sizeof(header.mtime), statbuf->st_mtime);
|
||||
strncpy(header.magic, TAR_MAGIC TAR_VERSION,
|
||||
TAR_MAGIC_LEN + TAR_VERSION_LEN);
|
||||
strcpy(header.magic, "ustar ");
|
||||
|
||||
/* Enter the user and group names (default to root if it fails) */
|
||||
if (bb_getpwuid(header.uname, statbuf->st_uid, sizeof(header.uname)) == NULL)
|
||||
@@ -275,9 +269,9 @@ static inline int writeTarHeader(struct TarBallInfo *tbInfo,
|
||||
putOctal(header.chksum, 7, chksum);
|
||||
|
||||
/* Now write the header out to disk */
|
||||
if ((size =
|
||||
bb_full_write(tbInfo->tarFd, (char *) &header,
|
||||
sizeof(struct TarHeader))) < 0) {
|
||||
if ((size = full_write(tbInfo->tarFd, (char *) &header,
|
||||
sizeof(struct TarHeader))) < 0)
|
||||
{
|
||||
bb_error_msg(bb_msg_io_error, real_name);
|
||||
return (FALSE);
|
||||
}
|
||||
@@ -481,7 +475,7 @@ static inline int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
while (1) {
|
||||
char buf;
|
||||
|
||||
int n = bb_full_read(gzipStatusPipe[0], &buf, 1);
|
||||
int n = full_read(gzipStatusPipe[0], &buf, 1);
|
||||
|
||||
if (n == 0 && vfork_exec_errno != 0) {
|
||||
errno = vfork_exec_errno;
|
||||
@@ -552,7 +546,7 @@ static llist_t *append_file_list_to_list(llist_t *list)
|
||||
cur = cur->link;
|
||||
free(tmp);
|
||||
while ((line = bb_get_chomped_line_from_file(src_stream)) != NULL)
|
||||
newlist = llist_add_to(newlist, line);
|
||||
llist_add_to(&newlist, line);
|
||||
fclose(src_stream);
|
||||
}
|
||||
return newlist;
|
||||
@@ -568,8 +562,8 @@ static char get_header_tar_Z(archive_handle_t *archive_handle)
|
||||
archive_handle->seek = seek_by_char;
|
||||
|
||||
/* do the decompression, and cleanup */
|
||||
if (bb_xread_char(archive_handle->src_fd) != 0x1f ||
|
||||
bb_xread_char(archive_handle->src_fd) != 0x9d)
|
||||
if (xread_char(archive_handle->src_fd) != 0x1f ||
|
||||
xread_char(archive_handle->src_fd) != 0x9d)
|
||||
{
|
||||
bb_error_msg_and_die("Invalid magic");
|
||||
}
|
||||
@@ -597,7 +591,7 @@ static char get_header_tar_Z(archive_handle_t *archive_handle)
|
||||
#define TAR_OPT_AFTER_START 8
|
||||
|
||||
#define CTX_CREATE (1 << (TAR_OPT_AFTER_START))
|
||||
#define TAR_OPT_DEREFERNCE (1 << (TAR_OPT_AFTER_START + 1))
|
||||
#define TAR_OPT_DEREFERENCE (1 << (TAR_OPT_AFTER_START + 1))
|
||||
#ifdef CONFIG_FEATURE_TAR_CREATE
|
||||
# define TAR_OPT_STR_CREATE "ch"
|
||||
# define TAR_OPT_AFTER_CREATE TAR_OPT_AFTER_START + 2
|
||||
@@ -801,7 +795,7 @@ int tar_main(int argc, char **argv)
|
||||
if (filename_ptr > argv[optind])
|
||||
*filename_ptr = '\0';
|
||||
|
||||
tar_handle->accept = llist_add_to(tar_handle->accept, argv[optind]);
|
||||
llist_add_to(&(tar_handle->accept), argv[optind]);
|
||||
optind++;
|
||||
}
|
||||
|
||||
@@ -834,8 +828,8 @@ int tar_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if ((base_dir) && (chdir(base_dir)))
|
||||
bb_perror_msg_and_die("Couldnt chdir to %s", base_dir);
|
||||
if (base_dir)
|
||||
bb_xchdir(base_dir);
|
||||
|
||||
/* create an archive */
|
||||
if (ENABLE_FEATURE_TAR_CREATE && (opt & CTX_CREATE)) {
|
||||
@@ -852,7 +846,8 @@ int tar_main(int argc, char **argv)
|
||||
{
|
||||
verboseFlag = TRUE;
|
||||
}
|
||||
writeTarFile(tar_handle->src_fd, verboseFlag, opt & TAR_OPT_DEREFERNCE, tar_handle->accept,
|
||||
writeTarFile(tar_handle->src_fd, verboseFlag, opt & TAR_OPT_DEREFERENCE,
|
||||
tar_handle->accept,
|
||||
tar_handle->reject, zipMode);
|
||||
} else {
|
||||
while (get_header_ptr(tar_handle) == EXIT_SUCCESS);
|
||||
|
||||
+6
-20
@@ -2,19 +2,7 @@
|
||||
/*
|
||||
* Uncompress applet for busybox (c) 2002 Glenn McGrath
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -24,7 +12,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "libbb.h"
|
||||
#include "busybox.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
#define GUNZIP_TO_STDOUT 1
|
||||
@@ -73,18 +61,16 @@ int uncompress_main(int argc, char **argv)
|
||||
*extension = '\0';
|
||||
|
||||
/* Open output file */
|
||||
dst_fd = bb_xopen(uncompressed_file, O_WRONLY | O_CREAT);
|
||||
|
||||
/* Set permissions on the file */
|
||||
stat(compressed_file, &stat_buf);
|
||||
chmod(uncompressed_file, stat_buf.st_mode);
|
||||
xstat(compressed_file, &stat_buf);
|
||||
dst_fd = bb_xopen3(uncompressed_file, O_WRONLY | O_CREAT,
|
||||
stat_buf.st_mode);
|
||||
|
||||
/* If unzip succeeds remove the old file */
|
||||
delete_path = compressed_file;
|
||||
}
|
||||
|
||||
/* do the decompression, and cleanup */
|
||||
if ((bb_xread_char(src_fd) != 0x1f) || (bb_xread_char(src_fd) != 0x9d)) {
|
||||
if ((xread_char(src_fd) != 0x1f) || (xread_char(src_fd) != 0x9d)) {
|
||||
bb_error_msg_and_die("Invalid magic");
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -1,3 +1,4 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Small lzma deflate implementation.
|
||||
* Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
|
||||
@@ -41,13 +42,15 @@ int unlzma_main(int argc, char **argv)
|
||||
filename = 0;
|
||||
|
||||
if (filename) {
|
||||
struct stat stat_buf;
|
||||
char *extension = filename + strlen(filename) - 5;
|
||||
|
||||
if (strcmp(extension, ".lzma") != 0) {
|
||||
bb_error_msg_and_die("Invalid extension");
|
||||
}
|
||||
xstat(filename, &stat_buf);
|
||||
*extension = 0;
|
||||
dst_fd = bb_xopen(filename, O_WRONLY | O_CREAT);
|
||||
dst_fd = bb_xopen3(filename, O_WRONLY | O_CREAT, stat_buf.st_mode);
|
||||
} else
|
||||
dst_fd = STDOUT_FILENO;
|
||||
status = unlzma(src_fd, dst_fd);
|
||||
@@ -62,4 +65,3 @@ int unlzma_main(int argc, char **argv)
|
||||
return status;
|
||||
}
|
||||
|
||||
/* vi:set ts=4: */
|
||||
+26
-64
@@ -32,28 +32,10 @@
|
||||
#include "unarchive.h"
|
||||
#include "busybox.h"
|
||||
|
||||
#if BB_BIG_ENDIAN
|
||||
static inline unsigned short
|
||||
__swap16(unsigned short x) {
|
||||
return (((uint16_t)(x) & 0xFF) << 8) | (((uint16_t)(x) & 0xFF00) >> 8);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
__swap32(uint32_t x) {
|
||||
return (((x & 0xFF) << 24) |
|
||||
((x & 0xFF00) << 8) |
|
||||
((x & 0xFF0000) >> 8) |
|
||||
((x & 0xFF000000) >> 24));
|
||||
}
|
||||
#else /* it's little-endian */
|
||||
# define __swap16(x) (x)
|
||||
# define __swap32(x) (x)
|
||||
#endif /* BB_BIG_ENDIAN */
|
||||
|
||||
#define ZIP_FILEHEADER_MAGIC __swap32(0x04034b50)
|
||||
#define ZIP_CDS_MAGIC __swap32(0x02014b50)
|
||||
#define ZIP_CDS_END_MAGIC __swap32(0x06054b50)
|
||||
#define ZIP_DD_MAGIC __swap32(0x08074b50)
|
||||
#define ZIP_FILEHEADER_MAGIC SWAP_LE32(0x04034b50)
|
||||
#define ZIP_CDS_MAGIC SWAP_LE32(0x02014b50)
|
||||
#define ZIP_CDS_END_MAGIC SWAP_LE32(0x06054b50)
|
||||
#define ZIP_DD_MAGIC SWAP_LE32(0x08074b50)
|
||||
|
||||
extern unsigned int gunzip_crc;
|
||||
extern unsigned int gunzip_bytes_out;
|
||||
@@ -83,19 +65,12 @@ static void unzip_skip(int fd, off_t skip)
|
||||
}
|
||||
}
|
||||
|
||||
static void unzip_read(int fd, void *buf, size_t count)
|
||||
{
|
||||
if (bb_xread(fd, buf, count) != count) {
|
||||
bb_error_msg_and_die("Read failure");
|
||||
}
|
||||
}
|
||||
|
||||
static void unzip_create_leading_dirs(char *fn)
|
||||
{
|
||||
/* Create all leading directories */
|
||||
char *name = bb_xstrdup(fn);
|
||||
if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) {
|
||||
bb_error_msg_and_die("Failed to create directory");
|
||||
bb_error_msg_and_die("Exiting"); /* bb_make_directory is noisy */
|
||||
}
|
||||
free(name);
|
||||
}
|
||||
@@ -180,7 +155,7 @@ int unzip_main(int argc, char **argv)
|
||||
|
||||
case 1: /* Include files */
|
||||
if (opt == 1) {
|
||||
zaccept = llist_add_to(zaccept, optarg);
|
||||
llist_add_to(&zaccept, optarg);
|
||||
|
||||
} else if (opt == 'd') {
|
||||
base_dir = optarg;
|
||||
@@ -196,7 +171,7 @@ int unzip_main(int argc, char **argv)
|
||||
|
||||
case 2 : /* Exclude files */
|
||||
if (opt == 1) {
|
||||
zreject = llist_add_to(zreject, optarg);
|
||||
llist_add_to(&zreject, optarg);
|
||||
|
||||
} else if (opt == 'd') { /* Extract to base directory */
|
||||
base_dir = optarg;
|
||||
@@ -236,9 +211,8 @@ int unzip_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Change dir if necessary */
|
||||
if (base_dir && chdir(base_dir)) {
|
||||
bb_perror_msg_and_die("Cannot chdir");
|
||||
}
|
||||
if (base_dir)
|
||||
bb_xchdir(base_dir);
|
||||
|
||||
if (verbosity != v_silent)
|
||||
printf("Archive: %s\n", src_fn);
|
||||
@@ -249,7 +223,7 @@ int unzip_main(int argc, char **argv)
|
||||
unsigned int magic;
|
||||
|
||||
/* Check magic number */
|
||||
unzip_read(src_fd, &magic, 4);
|
||||
xread(src_fd, &magic, 4);
|
||||
if (magic == ZIP_CDS_MAGIC) {
|
||||
break;
|
||||
} else if (magic != ZIP_FILEHEADER_MAGIC) {
|
||||
@@ -257,35 +231,32 @@ int unzip_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Read the file header */
|
||||
unzip_read(src_fd, zip_header.raw, 26);
|
||||
#if BB_BIG_ENDIAN
|
||||
zip_header.formated.version = __swap16(zip_header.formated.version);
|
||||
zip_header.formated.flags = __swap16(zip_header.formated.flags);
|
||||
zip_header.formated.method = __swap16(zip_header.formated.method);
|
||||
zip_header.formated.modtime = __swap16(zip_header.formated.modtime);
|
||||
zip_header.formated.moddate = __swap16(zip_header.formated.moddate);
|
||||
zip_header.formated.crc32 = __swap32(zip_header.formated.crc32);
|
||||
zip_header.formated.cmpsize = __swap32(zip_header.formated.cmpsize);
|
||||
zip_header.formated.ucmpsize = __swap32(zip_header.formated.ucmpsize);
|
||||
zip_header.formated.filename_len = __swap16(zip_header.formated.filename_len);
|
||||
zip_header.formated.extra_len = __swap16(zip_header.formated.extra_len);
|
||||
#endif /* BB_BIG_ENDIAN */
|
||||
xread(src_fd, zip_header.raw, 26);
|
||||
zip_header.formated.version = SWAP_LE32(zip_header.formated.version);
|
||||
zip_header.formated.flags = SWAP_LE32(zip_header.formated.flags);
|
||||
zip_header.formated.method = SWAP_LE32(zip_header.formated.method);
|
||||
zip_header.formated.modtime = SWAP_LE32(zip_header.formated.modtime);
|
||||
zip_header.formated.moddate = SWAP_LE32(zip_header.formated.moddate);
|
||||
zip_header.formated.crc32 = SWAP_LE32(zip_header.formated.crc32);
|
||||
zip_header.formated.cmpsize = SWAP_LE32(zip_header.formated.cmpsize);
|
||||
zip_header.formated.ucmpsize = SWAP_LE32(zip_header.formated.ucmpsize);
|
||||
zip_header.formated.filename_len = SWAP_LE32(zip_header.formated.filename_len);
|
||||
zip_header.formated.extra_len = SWAP_LE32(zip_header.formated.extra_len);
|
||||
if ((zip_header.formated.method != 0) && (zip_header.formated.method != 8)) {
|
||||
bb_error_msg_and_die("Unsupported compression method %d", zip_header.formated.method);
|
||||
}
|
||||
|
||||
/* Read filename */
|
||||
free(dst_fn);
|
||||
dst_fn = xmalloc(zip_header.formated.filename_len + 1);
|
||||
unzip_read(src_fd, dst_fn, zip_header.formated.filename_len);
|
||||
dst_fn[zip_header.formated.filename_len] = 0;
|
||||
dst_fn = xzalloc(zip_header.formated.filename_len + 1);
|
||||
xread(src_fd, dst_fn, zip_header.formated.filename_len);
|
||||
|
||||
/* Skip extra header bytes */
|
||||
unzip_skip(src_fd, zip_header.formated.extra_len);
|
||||
|
||||
if ((verbosity == v_list) && !list_header_done){
|
||||
printf(" Length Date Time Name\n");
|
||||
printf(" -------- ---- ---- ----\n");
|
||||
printf(" Length Date Time Name\n"
|
||||
" -------- ---- ---- ----\n");
|
||||
list_header_done = 1;
|
||||
}
|
||||
|
||||
@@ -323,7 +294,7 @@ int unzip_main(int argc, char **argv)
|
||||
}
|
||||
unzip_create_leading_dirs(dst_fn);
|
||||
if (bb_make_directory(dst_fn, 0777, 0)) {
|
||||
bb_error_msg_and_die("Failed to create directory");
|
||||
bb_error_msg_and_die("Exiting");
|
||||
}
|
||||
} else {
|
||||
if (!S_ISDIR(stat_buf.st_mode)) {
|
||||
@@ -418,12 +389,3 @@ int unzip_main(int argc, char **argv)
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
||||
/* END CODE */
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -65,6 +65,13 @@ config CONFIG_SETCONSOLE
|
||||
This program redirects the system console to another device,
|
||||
like the current tty while logged in via telnet.
|
||||
|
||||
config CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on CONFIG_SET_CONSOLE && CONFIG_GETOPT_LONG
|
||||
help
|
||||
Support long options for the setconsole applet.
|
||||
|
||||
config CONFIG_SETKEYCODES
|
||||
bool "setkeycodes"
|
||||
default n
|
||||
|
||||
@@ -12,7 +12,7 @@ top_builddir=..
|
||||
endif
|
||||
srcdir=$(top_srcdir)/console/tools
|
||||
CONSOLETOOLS_DIR:=./
|
||||
include $(top_builddir)/Rules.mak
|
||||
include $(top_srcdir)/Rules.mak
|
||||
include $(top_builddir)/.config
|
||||
include $(srcdir)/Makefile.in
|
||||
all: $(libraries-y)
|
||||
|
||||
+1
-24
@@ -4,23 +4,9 @@
|
||||
*
|
||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* no options, no getopt */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
@@ -50,12 +36,3 @@ int chvt_main(int argc, char **argv)
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+1
-13
@@ -4,19 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -5,19 +5,7 @@
|
||||
* Copyright (C) 2003 by Tito Ragusa <farmatito@tiscali.it>
|
||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* no options, no getopt */
|
||||
|
||||
@@ -4,19 +4,7 @@
|
||||
*
|
||||
* Copyright (C) Arne Bernin <arne@matrix.loopback.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
@@ -128,11 +127,6 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
|
||||
ud.entry_ct = ct;
|
||||
ud.entries = up;
|
||||
if (ioctl(fd, PIO_UNIMAP, &ud)) {
|
||||
#if 0
|
||||
if (errno == ENOMEM) {
|
||||
/* change advice parameters */
|
||||
}
|
||||
#endif
|
||||
bb_perror_msg_and_die("PIO_UNIMAP");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,19 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 1998 Enrique Zanardi <ezanardi@ull.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -57,15 +45,15 @@ int loadkmap_main(int argc, char **argv)
|
||||
|
||||
fd = bb_xopen(CURRENT_VC, O_RDWR);
|
||||
|
||||
if ((bb_full_read(0, buff, 7) != 7) || (strncmp(buff, BINARY_KEYMAP_MAGIC, 7) != 0))
|
||||
xread(0, buff, 7);
|
||||
if (strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
|
||||
bb_error_msg_and_die("This is not a valid binary keymap.");
|
||||
|
||||
if (bb_full_read(0, flags, MAX_NR_KEYMAPS) != MAX_NR_KEYMAPS)
|
||||
bb_perror_msg_and_die("Error reading keymap flags");
|
||||
xread(0, flags, MAX_NR_KEYMAPS);
|
||||
|
||||
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
|
||||
if (flags[i] == 1) {
|
||||
bb_full_read(0, ibuff, NR_KEYS * sizeof(u_short));
|
||||
xread(0, ibuff, NR_KEYS * sizeof(u_short));
|
||||
for (j = 0; j < NR_KEYS; j++) {
|
||||
ke.kb_index = j;
|
||||
ke.kb_table = i;
|
||||
@@ -75,8 +63,6 @@ int loadkmap_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't bother to close files. Exit does that
|
||||
* automagically, so we can save a few bytes */
|
||||
/* close(fd); */
|
||||
return EXIT_SUCCESS;
|
||||
if (ENABLE_FEATURE_CLEAN_UP) close(fd);
|
||||
return 0;
|
||||
}
|
||||
+1
-21
@@ -5,19 +5,7 @@
|
||||
* busyboxed by Quy Tonthat <quy@signal3.com>
|
||||
* hacked by Tito <farmatito@tiscali.it>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* getopt not needed */
|
||||
@@ -63,11 +51,3 @@ int openvt_main(int argc, char **argv)
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+1
-14
@@ -5,20 +5,7 @@
|
||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||
* Written by Erik Andersen and Kent Robotti <robotti@metconnect.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* no options, no getopt */
|
||||
|
||||
@@ -4,19 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 2004,2005 Enrik Berkhan <Enrik.Berkhan@inka.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
@@ -28,10 +16,12 @@
|
||||
|
||||
#include "busybox.h"
|
||||
|
||||
#if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
|
||||
static const struct option setconsole_long_options[] = {
|
||||
{ "reset", 0, NULL, 'r' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
#endif
|
||||
|
||||
#define OPT_SETCONS_RESET 1
|
||||
|
||||
@@ -40,7 +30,9 @@ int setconsole_main(int argc, char **argv)
|
||||
unsigned long flags;
|
||||
const char *device = CURRENT_TTY;
|
||||
|
||||
#if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
|
||||
bb_applet_long_options = setconsole_long_options;
|
||||
#endif
|
||||
flags = bb_getopt_ulflags(argc, argv, "r");
|
||||
|
||||
if (argc - optind > 1)
|
||||
@@ -60,11 +52,3 @@ int setconsole_main(int argc, char **argv)
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -6,20 +6,7 @@
|
||||
*
|
||||
* Adjusted for BusyBox by Erik Andersen <andersen@codepoet.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* setlogcons: Send kernel messages to the current console or to console N
|
||||
*
|
||||
@@ -27,7 +28,7 @@ extern int setlogcons_main(int argc, char **argv)
|
||||
if (argc == 2)
|
||||
arg.subarg = atoi(argv[1]);
|
||||
|
||||
if (ioctl(bb_xopen("/dev/tty1", O_RDONLY), TIOCLINUX, &arg))
|
||||
if (ioctl(bb_xopen(VC_1, O_RDONLY), TIOCLINUX, &arg))
|
||||
bb_perror_msg_and_die("TIOCLINUX");;
|
||||
|
||||
return 0;
|
||||
|
||||
+125
-29
@@ -26,6 +26,13 @@ config CONFIG_CAT
|
||||
cat is used to concatenate files and print them to the standard
|
||||
output. Enable this option if you wish to enable the 'cat' utility.
|
||||
|
||||
config CONFIG_CATV
|
||||
bool "catv"
|
||||
default n
|
||||
help
|
||||
Display nonprinting characters as escape sequences (like some
|
||||
implementations' cat -v option).
|
||||
|
||||
config CONFIG_CHGRP
|
||||
bool "chgrp"
|
||||
default n
|
||||
@@ -52,6 +59,12 @@ config CONFIG_CHROOT
|
||||
chroot is used to change the root directory and run a command.
|
||||
The default command is `/bin/sh'.
|
||||
|
||||
config CONFIG_CKSUM
|
||||
bool "cksum"
|
||||
default n
|
||||
help
|
||||
cksum is used to calculate the CRC32 checksum of a file.
|
||||
|
||||
config CONFIG_CMP
|
||||
bool "cmp"
|
||||
default n
|
||||
@@ -87,7 +100,7 @@ config CONFIG_DATE
|
||||
current time in the given format.
|
||||
|
||||
config CONFIG_FEATURE_DATE_ISOFMT
|
||||
bool " Enable ISO date format output (-I)"
|
||||
bool "Enable ISO date format output (-I)"
|
||||
default y
|
||||
depends on CONFIG_DATE
|
||||
help
|
||||
@@ -102,6 +115,26 @@ config CONFIG_DD
|
||||
by default) using specific input and output blocksizes,
|
||||
while optionally performing conversions on it.
|
||||
|
||||
config CONFIG_FEATURE_DD_SIGNAL_HANDLING
|
||||
bool "Enable DD signal handling for status reporting"
|
||||
default y
|
||||
depends on CONFIG_DD
|
||||
help
|
||||
sending a SIGUSR1 signal to a running `dd' process makes it
|
||||
print to standard error the number of records read and written
|
||||
so far, then to resume copying.
|
||||
|
||||
$ dd if=/dev/zero of=/dev/null& pid=$! $ kill -USR1 $pid; sleep 1; kill $pid
|
||||
10899206+0 records in 10899206+0 records out
|
||||
|
||||
config CONFIG_FEATURE_DD_IBS_OBS
|
||||
bool "Enable ibs, obs and conv options"
|
||||
default n
|
||||
depends on CONFIG_DD
|
||||
help
|
||||
Enables support for writing a certain number of bytes in and out,
|
||||
at a time, and performing conversions on the data stream.
|
||||
|
||||
config CONFIG_DF
|
||||
bool "df"
|
||||
default n
|
||||
@@ -109,6 +142,38 @@ config CONFIG_DF
|
||||
df reports the amount of disk space used and available
|
||||
on filesystems.
|
||||
|
||||
config CONFIG_DIFF
|
||||
bool "diff"
|
||||
default n
|
||||
help
|
||||
diff compares two files or directories and outputs the
|
||||
differences between them in a form that can be given to
|
||||
the patch command.
|
||||
|
||||
config CONFIG_FEATURE_DIFF_BINARY
|
||||
bool "Enable checks for binary files"
|
||||
default y
|
||||
depends on CONFIG_DIFF
|
||||
help
|
||||
This option enables support for checking for binary files
|
||||
before a comparison is carried out.
|
||||
|
||||
config CONFIG_FEATURE_DIFF_DIR
|
||||
bool "Enable directory support"
|
||||
default y
|
||||
depends on CONFIG_DIFF
|
||||
help
|
||||
This option enables support for directory and subdirectory
|
||||
comparison.
|
||||
|
||||
config CONFIG_FEATURE_DIFF_MINIMAL
|
||||
bool "Enable -d option to find smaller sets of changes"
|
||||
default n
|
||||
depends on CONFIG_DIFF
|
||||
help
|
||||
Enabling this option allows the use of -d to make diff
|
||||
try hard to find the smallest possible set of changes.
|
||||
|
||||
config CONFIG_DIRNAME
|
||||
bool "dirname"
|
||||
default n
|
||||
@@ -127,6 +192,9 @@ config CONFIG_UNIX2DOS
|
||||
bool
|
||||
default y
|
||||
depends on CONFIG_DOS2UNIX
|
||||
help
|
||||
unix2dos is used to convert a text file from UNIX format to
|
||||
DOS format, and vice versa.
|
||||
|
||||
config CONFIG_DU
|
||||
bool "du (default blocksize of 512 bytes)"
|
||||
@@ -135,8 +203,8 @@ config CONFIG_DU
|
||||
du is used to report the amount of disk space used
|
||||
for specified files.
|
||||
|
||||
config CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
|
||||
bool " Use a default blocksize of 1024 bytes (1K)"
|
||||
config CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
|
||||
bool "Use a default blocksize of 1024 bytes (1K)"
|
||||
default y
|
||||
depends on CONFIG_DU
|
||||
help
|
||||
@@ -150,7 +218,7 @@ config CONFIG_ECHO
|
||||
|
||||
# this entry also appears in shell/Config.in, next to the echo builtin
|
||||
config CONFIG_FEATURE_FANCY_ECHO
|
||||
bool " Enable echo options (-n and -e)"
|
||||
bool "Enable echo options (-n and -e)"
|
||||
default y
|
||||
depends on CONFIG_ECHO
|
||||
help
|
||||
@@ -164,6 +232,13 @@ config CONFIG_ENV
|
||||
a command; without options it displays the current
|
||||
environment.
|
||||
|
||||
config CONFIG_FEATURE_ENV_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on CONFIG_ENV && CONFIG_GETOPT_LONG
|
||||
help
|
||||
Support long options for the env applet.
|
||||
|
||||
config CONFIG_EXPR
|
||||
bool "expr"
|
||||
default n
|
||||
@@ -172,7 +247,7 @@ config CONFIG_EXPR
|
||||
to standard output.
|
||||
|
||||
config CONFIG_EXPR_MATH_SUPPORT_64
|
||||
bool " Extend Posix numbers support to 64 bit"
|
||||
bool "Extend Posix numbers support to 64 bit"
|
||||
default n
|
||||
depends on CONFIG_EXPR
|
||||
help
|
||||
@@ -200,7 +275,7 @@ config CONFIG_HEAD
|
||||
from files.
|
||||
|
||||
config CONFIG_FEATURE_FANCY_HEAD
|
||||
bool " Enable head options (-c, -q, and -v)"
|
||||
bool "Enable head options (-c, -q, and -v)"
|
||||
default n
|
||||
depends on CONFIG_HEAD
|
||||
help
|
||||
@@ -225,6 +300,13 @@ config CONFIG_INSTALL
|
||||
help
|
||||
Copy files and set attributes.
|
||||
|
||||
config CONFIG_FEATURE_INSTALL_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on CONFIG_INSTALL && CONFIG_GETOPT_LONG
|
||||
help
|
||||
Support long options for the install applet.
|
||||
|
||||
config CONFIG_LENGTH
|
||||
bool "length"
|
||||
default n
|
||||
@@ -250,56 +332,56 @@ config CONFIG_LS
|
||||
ls is used to list the contents of directories.
|
||||
|
||||
config CONFIG_FEATURE_LS_FILETYPES
|
||||
bool " Enable filetyping options (-p and -F)"
|
||||
bool "Enable filetyping options (-p and -F)"
|
||||
default y
|
||||
depends on CONFIG_LS
|
||||
help
|
||||
Enable the ls options (-p and -F).
|
||||
|
||||
config CONFIG_FEATURE_LS_FOLLOWLINKS
|
||||
bool " Enable symlinks dereferencing (-L)"
|
||||
bool "Enable symlinks dereferencing (-L)"
|
||||
default y
|
||||
depends on CONFIG_LS
|
||||
help
|
||||
Enable the ls option (-L).
|
||||
|
||||
config CONFIG_FEATURE_LS_RECURSIVE
|
||||
bool " Enable recursion (-R)"
|
||||
bool "Enable recursion (-R)"
|
||||
default y
|
||||
depends on CONFIG_LS
|
||||
help
|
||||
Enable the ls option (-R).
|
||||
|
||||
config CONFIG_FEATURE_LS_SORTFILES
|
||||
bool " Sort the file names"
|
||||
bool "Sort the file names"
|
||||
default y
|
||||
depends on CONFIG_LS
|
||||
help
|
||||
Allow ls to sort file names alphabetically.
|
||||
|
||||
config CONFIG_FEATURE_LS_TIMESTAMPS
|
||||
bool " Show file timestamps"
|
||||
bool "Show file timestamps"
|
||||
default y
|
||||
depends on CONFIG_LS
|
||||
help
|
||||
Allow ls to display timestamps for files.
|
||||
|
||||
config CONFIG_FEATURE_LS_USERNAME
|
||||
bool " Show username/groupnames"
|
||||
bool "Show username/groupnames"
|
||||
default y
|
||||
depends on CONFIG_LS
|
||||
help
|
||||
Allow ls to display username/groupname for files.
|
||||
|
||||
config CONFIG_FEATURE_LS_COLOR
|
||||
bool " Allow use of color to identify file types"
|
||||
bool "Allow use of color to identify file types"
|
||||
default y
|
||||
depends on CONFIG_LS
|
||||
depends on CONFIG_LS && CONFIG_GETOPT_LONG
|
||||
help
|
||||
This enables the --color option to ls.
|
||||
|
||||
config CONFIG_FEATURE_LS_COLOR_IS_DEFAULT
|
||||
bool " Produce colored ls output by default"
|
||||
bool "Produce colored ls output by default"
|
||||
default n
|
||||
depends on CONFIG_FEATURE_LS_COLOR
|
||||
help
|
||||
@@ -321,6 +403,13 @@ config CONFIG_MKDIR
|
||||
help
|
||||
mkdir is used to create directories with the specified names.
|
||||
|
||||
config CONFIG_FEATURE_MKDIR_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on CONFIG_MKDIR && CONFIG_GETOPT_LONG
|
||||
help
|
||||
Support long options for the mkdir applet.
|
||||
|
||||
config CONFIG_MKFIFO
|
||||
bool "mkfifo"
|
||||
default n
|
||||
@@ -341,6 +430,13 @@ config CONFIG_MV
|
||||
help
|
||||
mv is used to move or rename files or directories.
|
||||
|
||||
config CONFIG_FEATURE_MV_LONG_OPTIONS
|
||||
bool "Enable long options"
|
||||
default n
|
||||
depends on CONFIG_MV && CONFIG_GETOPT_LONG
|
||||
help
|
||||
Support long options for the mv applet.
|
||||
|
||||
config CONFIG_NICE
|
||||
bool "nice"
|
||||
default n
|
||||
@@ -416,7 +512,7 @@ config CONFIG_SLEEP
|
||||
sleep is used to pause for a specified number of seconds,
|
||||
|
||||
config CONFIG_FEATURE_FANCY_SLEEP
|
||||
bool " Enable multiple integer args and optional time suffixes"
|
||||
bool "Enable multiple integer args and optional time suffixes"
|
||||
default n
|
||||
depends on CONFIG_SLEEP
|
||||
help
|
||||
@@ -429,7 +525,7 @@ config CONFIG_SORT
|
||||
sort is used to sort lines of text in specified files.
|
||||
|
||||
config CONFIG_FEATURE_SORT_BIG
|
||||
bool " full SuSv3 compliant sort (Support -ktcsbdfiozgM)"
|
||||
bool "full SuSv3 compliant sort (Support -ktcsbdfiozgM)"
|
||||
default y
|
||||
depends on CONFIG_SORT
|
||||
help
|
||||
@@ -447,7 +543,7 @@ config CONFIG_STAT
|
||||
display file or filesystem status.
|
||||
|
||||
config CONFIG_FEATURE_STAT_FORMAT
|
||||
bool " Enable custom formats (-c)"
|
||||
bool "Enable custom formats (-c)"
|
||||
default n
|
||||
depends on CONFIG_STAT
|
||||
help
|
||||
@@ -481,7 +577,7 @@ config CONFIG_TAIL
|
||||
from files.
|
||||
|
||||
config CONFIG_FEATURE_FANCY_TAIL
|
||||
bool " Enable extra tail options (-q, -s, and -v)"
|
||||
bool "Enable extra tail options (-q, -s, and -v)"
|
||||
default y
|
||||
depends on CONFIG_TAIL
|
||||
help
|
||||
@@ -496,7 +592,7 @@ config CONFIG_TEE
|
||||
to standard output and files.
|
||||
|
||||
config CONFIG_FEATURE_TEE_USE_BLOCK_IO
|
||||
bool " Enable block i/o (larger/faster) instead of byte i/o."
|
||||
bool "Enable block i/o (larger/faster) instead of byte i/o."
|
||||
default n
|
||||
depends on CONFIG_TEE
|
||||
help
|
||||
@@ -507,11 +603,11 @@ config CONFIG_TEST
|
||||
default n
|
||||
help
|
||||
test is used to check file types and compare values,
|
||||
returning an appropriate exit code. The shells (ash
|
||||
and bash) have test builtin.
|
||||
returning an appropriate exit code. The bash shell
|
||||
has test built in, ash can build it in optionally.
|
||||
|
||||
config CONFIG_FEATURE_TEST_64
|
||||
bool " Extend test to 64 bit"
|
||||
bool "Extend test to 64 bit"
|
||||
default n
|
||||
depends on CONFIG_TEST
|
||||
help
|
||||
@@ -532,7 +628,7 @@ config CONFIG_TR
|
||||
input, writing to standard output.
|
||||
|
||||
config CONFIG_FEATURE_TR_CLASSES
|
||||
bool " Enable character classes (such as [:upper:])"
|
||||
bool "Enable character classes (such as [:upper:])"
|
||||
default n
|
||||
depends on CONFIG_TR
|
||||
help
|
||||
@@ -540,7 +636,7 @@ config CONFIG_FEATURE_TR_CLASSES
|
||||
tr [:upper:] [:lower:] to convert input into lowercase.
|
||||
|
||||
config CONFIG_FEATURE_TR_EQUIV
|
||||
bool " Enable equivalence classes"
|
||||
bool "Enable equivalence classes"
|
||||
default n
|
||||
depends on CONFIG_TR
|
||||
help
|
||||
@@ -633,7 +729,7 @@ comment "Common options for cp and mv"
|
||||
depends on CONFIG_CP || CONFIG_MV
|
||||
|
||||
config CONFIG_FEATURE_PRESERVE_HARDLINKS
|
||||
bool " Preserve hard links"
|
||||
bool "Preserve hard links"
|
||||
default n
|
||||
depends on CONFIG_CP || CONFIG_MV
|
||||
help
|
||||
@@ -643,7 +739,7 @@ comment "Common options for ls, more and telnet"
|
||||
depends on CONFIG_LS || CONFIG_MORE || CONFIG_TELNET
|
||||
|
||||
config CONFIG_FEATURE_AUTOWIDTH
|
||||
bool " Calculate terminal & column widths"
|
||||
bool "Calculate terminal & column widths"
|
||||
default y
|
||||
depends on CONFIG_LS || CONFIG_MORE || CONFIG_TELNET
|
||||
help
|
||||
@@ -657,7 +753,7 @@ comment "Common options for df, du, ls"
|
||||
depends on CONFIG_DF || CONFIG_DU || CONFIG_LS
|
||||
|
||||
config CONFIG_FEATURE_HUMAN_READABLE
|
||||
bool " Support for human readable output (example 13k, 23M, 235G)"
|
||||
bool "Support for human readable output (example 13k, 23M, 235G)"
|
||||
default n
|
||||
depends on CONFIG_DF || CONFIG_DU || CONFIG_LS
|
||||
help
|
||||
@@ -667,7 +763,7 @@ comment "Common options for md5sum, sha1sum"
|
||||
depends on CONFIG_MD5SUM || CONFIG_SHA1SUM
|
||||
|
||||
config CONFIG_FEATURE_MD5_SHA1_SUM_CHECK
|
||||
bool " Enable -c, -s and -w options"
|
||||
bool "Enable -c, -s and -w options"
|
||||
default n
|
||||
depends on CONFIG_MD5SUM || CONFIG_SHA1SUM
|
||||
help
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ top_builddir=..
|
||||
endif
|
||||
srcdir=$(top_srcdir)/coreutils
|
||||
SHELLUTILS_DIR:=./
|
||||
include $(top_builddir)/Rules.mak
|
||||
include $(top_srcdir)/Rules.mak
|
||||
include $(top_builddir)/.config
|
||||
include $(srcdir)/Makefile.in
|
||||
all: $(libraries-y)
|
||||
|
||||
@@ -14,10 +14,12 @@ COREUTILS-y:=
|
||||
COREUTILS-$(CONFIG_BASENAME) += basename.o
|
||||
COREUTILS-$(CONFIG_CAL) += cal.o
|
||||
COREUTILS-$(CONFIG_CAT) += cat.o
|
||||
COREUTILS-$(CONFIG_CATV) += catv.o
|
||||
COREUTILS-$(CONFIG_CHGRP) += chgrp.o
|
||||
COREUTILS-$(CONFIG_CHMOD) += chmod.o
|
||||
COREUTILS-$(CONFIG_CHOWN) += chown.o
|
||||
COREUTILS-$(CONFIG_CHROOT) += chroot.o
|
||||
COREUTILS-$(CONFIG_CKSUM) += cksum.o
|
||||
COREUTILS-$(CONFIG_CMP) += cmp.o
|
||||
COREUTILS-$(CONFIG_COMM) += comm.o
|
||||
COREUTILS-$(CONFIG_CP) += cp.o
|
||||
@@ -25,6 +27,7 @@ COREUTILS-$(CONFIG_CUT) += cut.o
|
||||
COREUTILS-$(CONFIG_DATE) += date.o
|
||||
COREUTILS-$(CONFIG_DD) += dd.o
|
||||
COREUTILS-$(CONFIG_DF) += df.o
|
||||
COREUTILS-$(CONFIG_DIFF) += diff.o
|
||||
COREUTILS-$(CONFIG_DIRNAME) += dirname.o
|
||||
COREUTILS-$(CONFIG_DOS2UNIX) += dos2unix.o
|
||||
COREUTILS-$(CONFIG_DU) += du.o
|
||||
|
||||
+1
-13
@@ -4,19 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
+3
-15
@@ -1,23 +1,11 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Calendar implementation for busybox
|
||||
*
|
||||
* See original copyright at the end of this file
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant with -j and -y extensions (from util-linux). */
|
||||
/* BB_AUDIT BUG: The output of 'cal -j 1752' is incorrect. The upstream
|
||||
|
||||
+2
-29
@@ -4,41 +4,14 @@
|
||||
*
|
||||
* Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file License in this tarball for details.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* This is a new implementation of 'cat' which aims to be SUSv3 compliant.
|
||||
*
|
||||
* Changes from the previous implementation include:
|
||||
* 1) Multiple '-' args are accepted as required by SUSv3. The previous
|
||||
* implementation would close stdin and segfault on a subsequent '-'.
|
||||
* 2) The '-u' options is required by SUSv3. Note that the specified
|
||||
* behavior for '-u' is done by default, so all we need do is accept
|
||||
* the option.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int cat_main(int argc, char **argv)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* cat -v implementation for busybox
|
||||
*
|
||||
* Copyright (C) 2006 Rob Landley <rob@landley.net>
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* See "Cat -v considered harmful" at
|
||||
* http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz */
|
||||
|
||||
#include "busybox.h"
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int catv_main(int argc, char **argv)
|
||||
{
|
||||
int retval = EXIT_SUCCESS, fd, flags;
|
||||
|
||||
flags = bb_getopt_ulflags(argc, argv, "etv");
|
||||
flags ^= 4;
|
||||
|
||||
// Loop through files.
|
||||
|
||||
argv += optind;
|
||||
do {
|
||||
// Read from stdin if there's nothing else to do.
|
||||
|
||||
fd = 0;
|
||||
if (*argv && 0>(fd = bb_xopen(*argv, O_RDONLY))) retval = EXIT_FAILURE;
|
||||
else for(;;) {
|
||||
int i, res;
|
||||
|
||||
res = read(fd, bb_common_bufsiz1, sizeof(bb_common_bufsiz1));
|
||||
if (res < 0) retval = EXIT_FAILURE;
|
||||
if (res <1) break;
|
||||
for (i=0; i<res; i++) {
|
||||
char c=bb_common_bufsiz1[i];
|
||||
|
||||
if (c > 126 && (flags & 4)) {
|
||||
if (c == 127) {
|
||||
printf("^?");
|
||||
continue;
|
||||
} else {
|
||||
printf("M-");
|
||||
c -= 128;
|
||||
}
|
||||
}
|
||||
if (c < 32) {
|
||||
if (c == 10) {
|
||||
if (flags & 1) putchar('$');
|
||||
} else if (flags & (c==9 ? 2 : 4)) {
|
||||
printf("^%c", c+'@');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
putchar(c);
|
||||
}
|
||||
}
|
||||
if (ENABLE_FEATURE_CLEAN_UP && fd) close(fd);
|
||||
} while (*++argv);
|
||||
|
||||
return retval;
|
||||
}
|
||||
+1
-22
@@ -4,20 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 defects - unsupported options -h, -H, -L, and -P. */
|
||||
@@ -71,11 +58,3 @@ int chgrp_main(int argc, char **argv)
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -89,11 +89,3 @@ int chmod_main(int ATTRIBUTE_UNUSED argc, char **argv)
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -76,11 +76,3 @@ int chown_main(int argc, char **argv)
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+3
-15
@@ -4,20 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
|
||||
@@ -35,9 +22,10 @@ int chroot_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
++argv;
|
||||
if (chroot(*argv) || (chdir("/"))) {
|
||||
if (chroot(*argv)) {
|
||||
bb_perror_msg_and_die("cannot change root directory to %s", *argv);
|
||||
}
|
||||
bb_xchdir("/");
|
||||
|
||||
++argv;
|
||||
if (argc == 2) {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* cksum - calculate the CRC32 checksum of a file
|
||||
*
|
||||
* Copyright (C) 2006 by Rob Sullivan, with ideas from code by Walter Harms
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
int cksum_main(int argc, char **argv) {
|
||||
|
||||
uint32_t *crc32_table = bb_crc32_filltable(1);
|
||||
|
||||
FILE *fp;
|
||||
uint32_t crc;
|
||||
long length, filesize;
|
||||
int bytes_read;
|
||||
char *cp;
|
||||
RESERVE_CONFIG_BUFFER(buf, BUFSIZ);
|
||||
int inp_stdin = (argc == optind) ? 1 : 0;
|
||||
|
||||
do {
|
||||
fp = bb_wfopen_input((inp_stdin) ? bb_msg_standard_input : *++argv);
|
||||
|
||||
crc = 0;
|
||||
length = 0;
|
||||
|
||||
while ((bytes_read = fread(buf, 1, BUFSIZ, fp)) > 0) {
|
||||
cp = buf;
|
||||
length += bytes_read;
|
||||
while (bytes_read--)
|
||||
crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ (*cp++)) & 0xffL];
|
||||
}
|
||||
|
||||
filesize = length;
|
||||
|
||||
for (; length; length >>= 8)
|
||||
crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ length) & 0xffL];
|
||||
crc ^= 0xffffffffL;
|
||||
|
||||
if (inp_stdin) {
|
||||
printf("%"PRIu32" %li\n", crc, filesize);
|
||||
break;
|
||||
}
|
||||
|
||||
printf("%"PRIu32" %li %s\n", crc, filesize, *argv);
|
||||
fclose(fp);
|
||||
} while (*(argv+1));
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+1
-14
@@ -4,20 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 2000,2001 by Matt Kraai <kraai@alumni.carnegiemellon.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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 (virtually) compliant -- uses nicer GNU format for -l. */
|
||||
|
||||
+4
-18
@@ -4,21 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 2005 by Robert Sullivan <cogito.ergo.cogito@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -75,16 +61,16 @@ static void cmp_files(char **infiles)
|
||||
fgets(thisline[i], LINE_LEN, streams[i]);
|
||||
}
|
||||
|
||||
while (thisline[0] || thisline[1]) {
|
||||
while (*thisline[0] || *thisline[1]) {
|
||||
int order = 0;
|
||||
|
||||
i = 0;
|
||||
if (feof(streams[0])) i |= BB_EOF_0;
|
||||
if (feof(streams[1])) i |= BB_EOF_1;
|
||||
|
||||
if (!thisline[0])
|
||||
if (!*thisline[0])
|
||||
order = 1;
|
||||
else if (!thisline[1])
|
||||
else if (!*thisline[1])
|
||||
order = -1;
|
||||
else {
|
||||
int tl0_len, tl1_len;
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ int cp_main(int argc, char **argv)
|
||||
}
|
||||
if (flags & 64) {
|
||||
/* Make -r a synonym for -R,
|
||||
* -r was marked as obsolete in SUSv3, but is included for compatability
|
||||
* -r was marked as obsolete in SUSv3, but is included for compatibility
|
||||
*/
|
||||
flags |= FILEUTILS_RECUR;
|
||||
}
|
||||
|
||||
+2
-15
@@ -1,24 +1,11 @@
|
||||
/* vi: set sw=8 ts=8: */
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* cut.c - minimalist version of cut
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Mark Whitley <markw@codepoet.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
+17
-17
@@ -9,15 +9,6 @@
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* This 'date' command supports only 2 time setting formats,
|
||||
all the GNU strftime stuff (its in libc, lets use it),
|
||||
setting time using UTC and displaying int, as well as
|
||||
@@ -29,6 +20,23 @@
|
||||
|
||||
/* Default input handling to save surprising some people */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#define DATE_OPT_RFC2822 0x01
|
||||
#define DATE_OPT_SET 0x02
|
||||
#define DATE_OPT_UTC 0x04
|
||||
#define DATE_OPT_DATE 0x08
|
||||
#define DATE_OPT_REFERENCE 0x10
|
||||
#define DATE_OPT_TIMESPEC 0x20
|
||||
#define DATE_OPT_HINT 0x40
|
||||
|
||||
|
||||
static struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
|
||||
{
|
||||
int nr;
|
||||
@@ -104,14 +112,6 @@ static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
|
||||
return (tm_time);
|
||||
}
|
||||
|
||||
#define DATE_OPT_RFC2822 0x01
|
||||
#define DATE_OPT_SET 0x02
|
||||
#define DATE_OPT_UTC 0x04
|
||||
#define DATE_OPT_DATE 0x08
|
||||
#define DATE_OPT_REFERENCE 0x10
|
||||
#define DATE_OPT_TIMESPEC 0x20
|
||||
#define DATE_OPT_HINT 0x40
|
||||
|
||||
int date_main(int argc, char **argv)
|
||||
{
|
||||
char *date_str = NULL;
|
||||
|
||||
+106
-83
@@ -5,20 +5,7 @@
|
||||
*
|
||||
* Copyright (C) 2000,2001 Matt Kraai
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -28,9 +15,9 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h> // For FEATURE_DD_SIGNAL_HANDLING
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
static const struct suffix_mult dd_suffixes[] = {
|
||||
{ "c", 1 },
|
||||
{ "w", 2 },
|
||||
@@ -44,66 +31,83 @@ static const struct suffix_mult dd_suffixes[] = {
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static size_t out_full;
|
||||
static size_t out_part;
|
||||
static size_t in_full;
|
||||
static size_t in_part;
|
||||
|
||||
static void dd_output_status(int cur_signal)
|
||||
{
|
||||
fprintf(stderr, "%ld+%ld records in\n%ld+%ld records out\n",
|
||||
(long)in_full, (long)in_part,
|
||||
(long)out_full, (long)out_part);
|
||||
}
|
||||
|
||||
int dd_main(int argc, char **argv)
|
||||
{
|
||||
size_t out_full = 0;
|
||||
size_t out_part = 0;
|
||||
size_t in_full = 0;
|
||||
size_t in_part = 0;
|
||||
size_t count = -1;
|
||||
size_t bs = 512;
|
||||
size_t count = -1, oc = 0, ibs = 512, obs = 512;
|
||||
ssize_t n;
|
||||
off_t seek = 0;
|
||||
off_t skip = 0;
|
||||
int sync_flag = FALSE;
|
||||
int noerror = FALSE;
|
||||
int trunc_flag = TRUE;
|
||||
int oflag;
|
||||
int ifd;
|
||||
int ofd;
|
||||
int i;
|
||||
const char *infile = NULL;
|
||||
const char *outfile = NULL;
|
||||
char *buf;
|
||||
off_t seek = 0, skip = 0;
|
||||
int sync_flag = FALSE, noerror = FALSE, trunc_flag = TRUE, twobufs_flag = 0,
|
||||
oflag, ifd, ofd, i;
|
||||
const char *infile = NULL, *outfile = NULL;
|
||||
char *ibuf, *obuf;
|
||||
|
||||
if (ENABLE_FEATURE_DD_SIGNAL_HANDLING)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_handler = dd_output_status;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGUSR1, &sa, 0);
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strncmp("bs=", argv[i], 3) == 0)
|
||||
bs = bb_xparse_number(argv[i]+3, dd_suffixes);
|
||||
else if (strncmp("count=", argv[i], 6) == 0)
|
||||
if (ENABLE_FEATURE_DD_IBS_OBS && !strncmp("ibs=", argv[i], 4)) {
|
||||
ibs = bb_xparse_number(argv[i]+4, dd_suffixes);
|
||||
twobufs_flag++;
|
||||
} else if (ENABLE_FEATURE_DD_IBS_OBS && !strncmp("obs=", argv[i], 4)) {
|
||||
obs = bb_xparse_number(argv[i]+4, dd_suffixes);
|
||||
twobufs_flag++;
|
||||
} else if (!strncmp("bs=", argv[i], 3)) {
|
||||
ibs = obs = bb_xparse_number(argv[i]+3, dd_suffixes);
|
||||
} else if (!strncmp("count=", argv[i], 6))
|
||||
count = bb_xparse_number(argv[i]+6, dd_suffixes);
|
||||
else if (strncmp("seek=", argv[i], 5) == 0)
|
||||
else if (!strncmp("seek=", argv[i], 5))
|
||||
seek = bb_xparse_number(argv[i]+5, dd_suffixes);
|
||||
else if (strncmp("skip=", argv[i], 5) == 0)
|
||||
else if (!strncmp("skip=", argv[i], 5))
|
||||
skip = bb_xparse_number(argv[i]+5, dd_suffixes);
|
||||
else if (strncmp("if=", argv[i], 3) == 0)
|
||||
else if (!strncmp("if=", argv[i], 3))
|
||||
infile = argv[i]+3;
|
||||
else if (strncmp("of=", argv[i], 3) == 0)
|
||||
else if (!strncmp("of=", argv[i], 3))
|
||||
outfile = argv[i]+3;
|
||||
else if (strncmp("conv=", argv[i], 5) == 0) {
|
||||
buf = argv[i]+5;
|
||||
else if (ENABLE_FEATURE_DD_IBS_OBS && !strncmp("conv=", argv[i], 5)) {
|
||||
ibuf = argv[i]+5;
|
||||
while (1) {
|
||||
if (strncmp("notrunc", buf, 7) == 0) {
|
||||
if (!strncmp("notrunc", ibuf, 7)) {
|
||||
trunc_flag = FALSE;
|
||||
buf += 7;
|
||||
} else if (strncmp("sync", buf, 4) == 0) {
|
||||
ibuf += 7;
|
||||
} else if (!strncmp("sync", ibuf, 4)) {
|
||||
sync_flag = TRUE;
|
||||
buf += 4;
|
||||
} else if (strncmp("noerror", buf, 7) == 0) {
|
||||
ibuf += 4;
|
||||
} else if (!strncmp("noerror", ibuf, 7)) {
|
||||
noerror = TRUE;
|
||||
buf += 7;
|
||||
ibuf += 7;
|
||||
} else {
|
||||
bb_error_msg_and_die("invalid conversion `%s'", argv[i]+5);
|
||||
bb_error_msg_and_die(bb_msg_invalid_arg, argv[i]+5, "conv");
|
||||
}
|
||||
if (buf[0] == '\0')
|
||||
break;
|
||||
if (buf[0] == ',')
|
||||
buf++;
|
||||
if (ibuf[0] == '\0') break;
|
||||
if (ibuf[0] == ',') ibuf++;
|
||||
}
|
||||
} else
|
||||
bb_show_usage();
|
||||
}
|
||||
ibuf = xmalloc(ibs);
|
||||
|
||||
buf = xmalloc(bs);
|
||||
if (twobufs_flag) obuf = xmalloc(obs);
|
||||
else obuf = ibuf;
|
||||
|
||||
if (infile != NULL) {
|
||||
ifd = bb_xopen(infile, O_RDONLY);
|
||||
@@ -119,12 +123,10 @@ int dd_main(int argc, char **argv)
|
||||
oflag |= O_TRUNC;
|
||||
}
|
||||
|
||||
if ((ofd = open(outfile, oflag, 0666)) < 0) {
|
||||
bb_perror_msg_and_die("%s", outfile);
|
||||
}
|
||||
ofd = bb_xopen3(outfile, oflag, 0666);
|
||||
|
||||
if (seek && trunc_flag) {
|
||||
if (ftruncate(ofd, seek * bs) < 0) {
|
||||
if (ftruncate(ofd, seek * obs) < 0) {
|
||||
struct stat st;
|
||||
|
||||
if (fstat (ofd, &st) < 0 || S_ISREG (st.st_mode) ||
|
||||
@@ -139,13 +141,19 @@ int dd_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (skip) {
|
||||
if (lseek(ifd, skip * bs, SEEK_CUR) < 0) {
|
||||
bb_perror_msg_and_die("%s", infile);
|
||||
if (lseek(ifd, skip * ibs, SEEK_CUR) < 0) {
|
||||
while (skip-- > 0) {
|
||||
n = safe_read(ifd, ibuf, ibs);
|
||||
if (n < 0)
|
||||
bb_perror_msg_and_die("%s", infile);
|
||||
if (n == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (seek) {
|
||||
if (lseek(ofd, seek * bs, SEEK_CUR) < 0) {
|
||||
if (lseek(ofd, seek * obs, SEEK_CUR) < 0) {
|
||||
bb_perror_msg_and_die("%s", outfile);
|
||||
}
|
||||
}
|
||||
@@ -153,40 +161,57 @@ int dd_main(int argc, char **argv)
|
||||
while (in_full + in_part != count) {
|
||||
if (noerror) {
|
||||
/* Pre-zero the buffer when doing the noerror thing */
|
||||
memset(buf, '\0', bs);
|
||||
memset(ibuf, '\0', ibs);
|
||||
}
|
||||
|
||||
n = safe_read(ifd, ibuf, ibs);
|
||||
if (n == 0) {
|
||||
break;
|
||||
}
|
||||
n = safe_read(ifd, buf, bs);
|
||||
if (n < 0) {
|
||||
if (noerror) {
|
||||
n = bs;
|
||||
n = ibs;
|
||||
bb_perror_msg("%s", infile);
|
||||
} else {
|
||||
bb_perror_msg_and_die("%s", infile);
|
||||
}
|
||||
}
|
||||
if (n == 0) {
|
||||
break;
|
||||
}
|
||||
if ((size_t)n == bs) {
|
||||
if ((size_t)n == ibs) {
|
||||
in_full++;
|
||||
} else {
|
||||
in_part++;
|
||||
if (sync_flag) {
|
||||
memset(ibuf + n, '\0', ibs - n);
|
||||
n = ibs;
|
||||
}
|
||||
}
|
||||
if (sync_flag) {
|
||||
memset(buf + n, '\0', bs - n);
|
||||
n = bs;
|
||||
}
|
||||
n = bb_full_write(ofd, buf, n);
|
||||
if (n < 0) {
|
||||
bb_perror_msg_and_die("%s", outfile);
|
||||
}
|
||||
if ((size_t)n == bs) {
|
||||
out_full++;
|
||||
if (twobufs_flag) {
|
||||
char *tmp = ibuf;
|
||||
while (n) {
|
||||
size_t d = obs - oc;
|
||||
|
||||
if (d > n) d = n;
|
||||
memcpy(obuf + oc, tmp, d);
|
||||
n -= d;
|
||||
tmp += d;
|
||||
oc += d;
|
||||
if (oc == obs) {
|
||||
xwrite(ofd, obuf, obs);
|
||||
out_full++;
|
||||
oc = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out_part++;
|
||||
xwrite(ofd, ibuf, n);
|
||||
if (n == ibs) out_full++;
|
||||
else out_part++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ENABLE_FEATURE_DD_IBS_OBS && oc) {
|
||||
xwrite(ofd, obuf, oc);
|
||||
out_part++;
|
||||
}
|
||||
if (close (ifd) < 0) {
|
||||
bb_perror_msg_and_die("%s", infile);
|
||||
}
|
||||
@@ -195,9 +220,7 @@ int dd_main(int argc, char **argv)
|
||||
bb_perror_msg_and_die("%s", outfile);
|
||||
}
|
||||
|
||||
fprintf(stderr, "%ld+%ld records in\n%ld+%ld records out\n",
|
||||
(long)in_full, (long)in_part,
|
||||
(long)out_full, (long)out_part);
|
||||
dd_output_status(0);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+1
-22
@@ -5,20 +5,7 @@
|
||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||
* based on original code by (I think) Bruce Perens <bruce@pixar.com>.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 _NOT_ compliant -- options -P and -t missing. Also blocksize. */
|
||||
@@ -160,11 +147,3 @@ int df_main(int argc, char **argv)
|
||||
|
||||
bb_fflush_stdout_and_exit(status);
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+1256
File diff suppressed because it is too large.
Load diff
+1
-14
@@ -4,20 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant */
|
||||
|
||||
+40
-41
@@ -1,3 +1,4 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* dos2unix for BusyBox
|
||||
*
|
||||
@@ -8,78 +9,78 @@
|
||||
*
|
||||
* dos2unix filters reading input from stdin and writing output to stdout.
|
||||
*
|
||||
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
|
||||
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#define CT_UNIX2DOS 1
|
||||
#define CT_DOS2UNIX 2
|
||||
#define tempFn bb_common_bufsiz1
|
||||
enum ConvType {
|
||||
CT_UNIX2DOS = 1,
|
||||
CT_DOS2UNIX
|
||||
} ConvType;
|
||||
|
||||
/* if fn is NULL then input is stdin and output is stdout */
|
||||
static int convert(char *fn, int ConvType)
|
||||
static int convert(char *fn)
|
||||
{
|
||||
int c, fd;
|
||||
FILE *in, *out;
|
||||
int i;
|
||||
|
||||
if (fn != NULL) {
|
||||
in = bb_xfopen(fn, "rw");
|
||||
/*
|
||||
The file is then created with mode read/write and
|
||||
permissions 0666 for glibc 2.0.6 and earlier or
|
||||
0600 for glibc 2.0.7 and later.
|
||||
*/
|
||||
snprintf(tempFn, sizeof(tempFn), "%sXXXXXX", fn);
|
||||
The file is then created with mode read/write and
|
||||
permissions 0666 for glibc 2.0.6 and earlier or
|
||||
0600 for glibc 2.0.7 and later.
|
||||
*/
|
||||
snprintf(bb_common_bufsiz1, sizeof(bb_common_bufsiz1), "%sXXXXXX", fn);
|
||||
/*
|
||||
sizeof tempFn is 4096, so it should be big enough to hold the full
|
||||
path. however if the output is truncated the subsequent call to
|
||||
mkstemp would fail.
|
||||
*/
|
||||
if ((fd = mkstemp(&tempFn[0])) == -1 || chmod(tempFn, 0600) == -1) {
|
||||
sizeof bb_common_bufsiz1 is 4096, so it should be big enough to
|
||||
hold the full path. However if the output is truncated the
|
||||
subsequent call to mkstemp would fail.
|
||||
*/
|
||||
if ((i = mkstemp(&bb_common_bufsiz1[0])) == -1
|
||||
|| chmod(bb_common_bufsiz1, 0600) == -1) {
|
||||
bb_perror_nomsg_and_die();
|
||||
}
|
||||
out = fdopen(fd, "w+");
|
||||
out = fdopen(i, "w+");
|
||||
if (!out) {
|
||||
close(fd);
|
||||
remove(tempFn);
|
||||
close(i);
|
||||
remove(bb_common_bufsiz1);
|
||||
}
|
||||
} else {
|
||||
in = stdin;
|
||||
out = stdout;
|
||||
}
|
||||
|
||||
while ((c = fgetc(in)) != EOF) {
|
||||
if (c == '\r')
|
||||
while ((i = fgetc(in)) != EOF) {
|
||||
if (i == '\r')
|
||||
continue;
|
||||
if (c == '\n') {
|
||||
if (i == '\n') {
|
||||
if (ConvType == CT_UNIX2DOS)
|
||||
fputc('\r', out);
|
||||
fputc('\n', out);
|
||||
continue;
|
||||
}
|
||||
fputc(c, out);
|
||||
fputc(i, out);
|
||||
}
|
||||
|
||||
if (fn != NULL) {
|
||||
if (fclose(in) < 0 || fclose(out) < 0) {
|
||||
bb_perror_nomsg();
|
||||
remove(tempFn);
|
||||
remove(bb_common_bufsiz1);
|
||||
return -2;
|
||||
}
|
||||
|
||||
}
|
||||
/* Assume they are both on the same filesystem (which
|
||||
* should be true since we put them into the same directory
|
||||
* so we _should_ be ok, but you never know... */
|
||||
if (rename(tempFn, fn) < 0) {
|
||||
bb_perror_msg("cannot rename '%s' as '%s'", tempFn, fn);
|
||||
* should be true since we put them into the same directory
|
||||
* so we _should_ be ok, but you never know... */
|
||||
if (rename(bb_common_bufsiz1, fn) < 0) {
|
||||
bb_perror_msg("cannot rename '%s' as '%s'", bb_common_bufsiz1, fn);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -87,14 +88,13 @@ static int convert(char *fn, int ConvType)
|
||||
|
||||
int dos2unix_main(int argc, char *argv[])
|
||||
{
|
||||
int ConvType;
|
||||
int o;
|
||||
|
||||
/* See if we are supposed to be doing dos2unix or unix2dos */
|
||||
if (argv[0][0]=='d') {
|
||||
ConvType = CT_DOS2UNIX; /*2*/
|
||||
if (bb_applet_name[0] == 'd') {
|
||||
ConvType = CT_DOS2UNIX; /*2 */
|
||||
} else {
|
||||
ConvType = CT_UNIX2DOS; /*1*/
|
||||
ConvType = CT_UNIX2DOS; /*1 */
|
||||
}
|
||||
/* -u and -d are mutally exclusive */
|
||||
bb_opt_complementally = "?:u--d:d--u";
|
||||
@@ -109,12 +109,11 @@ int dos2unix_main(int argc, char *argv[])
|
||||
ConvType = o;
|
||||
|
||||
if (optind < argc) {
|
||||
while(optind < argc)
|
||||
if ((o = convert(argv[optind++], ConvType)) < 0)
|
||||
while (optind < argc)
|
||||
if ((o = convert(argv[optind++])) < 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
o = convert(NULL, ConvType);
|
||||
} else
|
||||
o = convert(NULL);
|
||||
|
||||
return o;
|
||||
}
|
||||
+6
-20
@@ -6,20 +6,7 @@
|
||||
* Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
|
||||
* Copyright (C) 2002 Edward Betts <edward@debian.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant (unless default blocksize set to 1k) */
|
||||
@@ -44,12 +31,12 @@
|
||||
#include "busybox.h"
|
||||
|
||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||
# ifdef CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
|
||||
# ifdef CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
|
||||
static unsigned long disp_hr = KILOBYTE;
|
||||
# else
|
||||
static unsigned long disp_hr = 512;
|
||||
# endif
|
||||
#elif defined CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
|
||||
#elif defined CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
|
||||
static unsigned int disp_k = 1;
|
||||
#else
|
||||
static unsigned int disp_k; /* bss inits to 0 */
|
||||
@@ -134,9 +121,8 @@ static long du(char *filename)
|
||||
struct dirent *entry;
|
||||
char *newfile;
|
||||
|
||||
dir = opendir(filename);
|
||||
dir = bb_opendir(filename);
|
||||
if (!dir) {
|
||||
bb_perror_msg("%s", filename);
|
||||
status = EXIT_FAILURE;
|
||||
return sum;
|
||||
}
|
||||
@@ -174,7 +160,7 @@ int du_main(int argc, char **argv)
|
||||
char *smax_print_depth;
|
||||
unsigned long opt;
|
||||
|
||||
#ifdef CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
|
||||
#ifdef CONFIG_FEATURE_DU_DEFUALT_BLOCKSIZE_1K
|
||||
if (getenv("POSIXLY_CORRECT")) { /* TODO - a new libbb function? */
|
||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||
disp_hr = 512;
|
||||
@@ -208,7 +194,7 @@ int du_main(int argc, char **argv)
|
||||
#else
|
||||
bb_opt_complementally = "H-L:L-H:s-d:d-s";
|
||||
opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc", &smax_print_depth);
|
||||
#if !defined CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
|
||||
#if !defined CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
|
||||
if((opt & (1 << 2))) {
|
||||
/* -k opt */
|
||||
disp_k = 1;
|
||||
|
||||
+142
-13
@@ -1,29 +1,158 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* echo applet implementation for busybox
|
||||
* echo implementation for busybox
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* 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
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*
|
||||
* Original copyright notice is retained at the end of this file.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 compliant -- unless configured as fancy echo. */
|
||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/echo.html */
|
||||
|
||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||
*
|
||||
* Because of behavioral differences, implemented configurable SUSv3
|
||||
* or 'fancy' gnu-ish behaviors. Also, reduced size and fixed bugs.
|
||||
* 1) In handling '\c' escape, the previous version only suppressed the
|
||||
* trailing newline. SUSv3 specifies _no_ output after '\c'.
|
||||
* 2) SUSv3 specifies that octal escapes are of the form \0{#{#{#}}}.
|
||||
* The previous version version did not allow 4-digit octals.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
|
||||
int bb_echo(int ATTRIBUTE_UNUSED argc, char **argv)
|
||||
{
|
||||
#ifndef CONFIG_FEATURE_FANCY_ECHO
|
||||
#define eflag '\\'
|
||||
++argv;
|
||||
#else
|
||||
const char *p;
|
||||
int nflag = 1;
|
||||
int eflag = 0;
|
||||
|
||||
while (*++argv && (**argv == '-')) {
|
||||
/* If it appears that we are handling options, then make sure
|
||||
* that all of the options specified are actually valid.
|
||||
* Otherwise, the string should just be echoed.
|
||||
*/
|
||||
|
||||
if (!*(p = *argv + 1)) { /* A single '-', so echo it. */
|
||||
goto just_echo;
|
||||
}
|
||||
|
||||
do {
|
||||
if (strrchr("neE", *p) == 0) {
|
||||
goto just_echo;
|
||||
}
|
||||
} while (*++p);
|
||||
|
||||
/* All of the options in this arg are valid, so handle them. */
|
||||
p = *argv + 1;
|
||||
do {
|
||||
if (*p == 'n') {
|
||||
nflag = 0;
|
||||
} else if (*p == 'e') {
|
||||
eflag = '\\';
|
||||
} else {
|
||||
eflag = 0;
|
||||
}
|
||||
} while (*++p);
|
||||
}
|
||||
|
||||
just_echo:
|
||||
#endif
|
||||
while (*argv) {
|
||||
int c;
|
||||
|
||||
while ((c = *(*argv)++)) {
|
||||
if (c == eflag) { /* Check for escape seq. */
|
||||
if (**argv == 'c') {
|
||||
/* '\c' means cancel newline and
|
||||
* ignore all subsequent chars. */
|
||||
return 0;
|
||||
}
|
||||
#ifndef CONFIG_FEATURE_FANCY_ECHO
|
||||
/* SUSv3 specifies that octal escapes must begin with '0'. */
|
||||
if (((unsigned int)(**argv - '1')) >= 7)
|
||||
#endif
|
||||
{
|
||||
/* Since SUSv3 mandates a first digit of 0, 4-digit octals
|
||||
* of the form \0### are accepted. */
|
||||
if ((**argv == '0') && (((unsigned int)(argv[0][1] - '0')) < 8)) {
|
||||
(*argv)++;
|
||||
}
|
||||
/* bb_process_escape_sequence can handle nul correctly */
|
||||
c = bb_process_escape_sequence((const char **) argv);
|
||||
}
|
||||
}
|
||||
putchar(c);
|
||||
}
|
||||
|
||||
if (*++argv) {
|
||||
putchar(' ');
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FEATURE_FANCY_ECHO
|
||||
if (nflag) {
|
||||
putchar('\n');
|
||||
}
|
||||
#else
|
||||
putchar('\n');
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int echo_main(int argc, char** argv)
|
||||
{
|
||||
(void)bb_echo(argc, argv);
|
||||
bb_fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Kenneth Almquist.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
|
||||
* ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
|
||||
*
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)echo.c 8.1 (Berkeley) 5/31/93
|
||||
*/
|
||||
+5
-14
@@ -5,19 +5,7 @@
|
||||
* Copyright (c) 1988, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*
|
||||
* Original copyright notice is retained at the end of this file.
|
||||
*
|
||||
@@ -50,12 +38,13 @@
|
||||
#include <getopt.h> /* struct option */
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
#if ENABLE_FEATURE_ENV_LONG_OPTIONS
|
||||
static const struct option env_long_options[] = {
|
||||
{ "ignore-environment", 0, NULL, 'i' },
|
||||
{ "unset", 1, NULL, 'u' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
#endif
|
||||
|
||||
int env_main(int argc, char** argv)
|
||||
{
|
||||
@@ -67,7 +56,9 @@ int env_main(int argc, char** argv)
|
||||
extern char **environ;
|
||||
|
||||
bb_opt_complementally = "u::";
|
||||
#if ENABLE_FEATURE_ENV_LONG_OPTIONS
|
||||
bb_applet_long_options = env_long_options;
|
||||
#endif
|
||||
|
||||
opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env);
|
||||
|
||||
|
||||
+1
-14
@@ -11,20 +11,7 @@
|
||||
* - reduced 464 bytes.
|
||||
* - 64 math support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* This program evaluates expressions. Each token (operator, operand,
|
||||
|
||||
+1
-1
@@ -1,3 +1,4 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/* fold -- wrap each input line to fit in specified width.
|
||||
|
||||
Written by David MacKenzie, djm@gnu.ai.mit.edu.
|
||||
@@ -158,4 +159,3 @@ rescan:
|
||||
|
||||
bb_fflush_stdout_and_exit(errs);
|
||||
}
|
||||
/* vi: set sw=4 ts=4: */
|
||||
Loaded 100 of 676 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user