Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f23b96cebf | ||
|
|
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 | ||
|
|
5139bd98a7 | ||
|
|
e375e8c732 | ||
|
|
56dd0bff06 | ||
|
|
b256bd334f | ||
|
|
ca087713f2 | ||
|
|
cb8d4319a3 | ||
|
|
24b0a9568d | ||
|
|
fe908fda28 | ||
|
|
dbd91af061 | ||
|
|
92fff34de6 | ||
|
|
f0305b7f75 | ||
|
|
6850017a2f | ||
|
|
f885513940 | ||
|
|
87848d91c7 | ||
|
|
28ff9668d9 | ||
|
|
986ab525b8 | ||
|
|
b3ede5abe2 | ||
|
|
d1f8c1c125 | ||
|
|
164a5be04e | ||
|
|
0949d30638 | ||
|
|
9360f42d32 | ||
|
|
dbf935dae6 | ||
|
|
c370ea89fa | ||
|
|
8416a2d558 | ||
|
|
3570915769 | ||
|
|
4789694372 | ||
|
|
90ece609e6 | ||
|
|
0bafd47e84 | ||
|
|
771b186406 | ||
|
|
2dd13bd25a | ||
|
|
d1968672ef | ||
|
|
787140df39 | ||
|
|
e0fe937593 | ||
|
|
1bb31928d5 | ||
|
|
fb3a631310 | ||
|
|
dce5809ebc | ||
|
|
5fba2505d4 | ||
|
|
13c8327b79 | ||
|
|
e1d41b3102 | ||
|
|
948a09d6f2 | ||
|
|
64bef2ab9c | ||
|
|
ca8d0b029b | ||
|
|
2dd4279959 | ||
|
|
2324a7c9e5 | ||
|
|
a35886c862 | ||
|
|
786988faf7 | ||
|
|
7328c8fdc1 | ||
|
|
cebea726e8 | ||
|
|
06adf5fb47 | ||
|
|
3ea05d3222 | ||
|
|
d049812571 | ||
|
|
8dd4ca787a | ||
|
|
6a776e9558 | ||
|
|
d1ba916167 | ||
|
|
e3f4ab2bc4 | ||
|
|
8caffaa9a9 | ||
|
|
9601a1c8c2 | ||
|
|
19b5b8ff6a | ||
|
|
a6db0eef59 | ||
|
|
28a6afe975 | ||
|
|
c30f445b08 | ||
|
|
e2b428cbb1 | ||
|
|
99a072d524 | ||
|
|
2523da259c | ||
|
|
66753a3850 | ||
|
|
263e75d051 | ||
|
|
9aa7f2005d | ||
|
|
179f417788 | ||
|
|
25f67d419d | ||
|
|
6bc10635f8 | ||
|
|
dcb2122e85 | ||
|
|
eaa34ca5b4 | ||
|
|
aae8b3405e | ||
|
|
5a57821565 | ||
|
|
2824ded677 | ||
|
|
4bb1b04fd1 | ||
|
|
ea9a471acd | ||
|
|
187e352b7f | ||
|
|
330ac853e3 | ||
|
|
31642d75e1 | ||
|
|
386f85eadf | ||
|
|
d221d2137f | ||
|
|
dc0955b603 | ||
|
|
0b22c1c962 | ||
|
|
2f135fc6bf | ||
|
|
ef7ccac9da | ||
|
|
a25d83b282 | ||
|
|
df10094870 | ||
|
|
c5b1d4d6b1 | ||
|
|
965030e35a | ||
|
|
19808fea76 | ||
|
|
9dc6913896 | ||
|
|
e01d746fe9 | ||
|
|
1c60d9762e | ||
|
|
9e094552c8 | ||
|
|
c70240cc1d | ||
|
|
72d59dbd76 | ||
|
|
ead19306f5 | ||
|
|
bc68cd14cc | ||
|
|
dae6aa2859 | ||
|
|
1f305dc0fd | ||
|
|
3a324754f8 | ||
|
|
31e3610c4b | ||
|
|
ac664e07df | ||
|
|
d48633fa6f | ||
|
|
49a5599ae9 | ||
|
|
478a188e85 | ||
|
|
39a9fddb53 | ||
|
|
07a79e75f5 | ||
|
|
874af85d5e | ||
|
|
0f2dd9f4eb | ||
|
|
dfba741457 | ||
|
|
1f5e25bf3e | ||
|
|
2e9cf373a9 | ||
|
|
a59721166a | ||
|
|
56ee779074 | ||
|
|
33b45a09a1 | ||
|
|
688ed0d760 | ||
|
|
d9969ea175 | ||
|
|
06ec8cff83 | ||
|
|
cbd1c85744 | ||
|
|
c05dda4b2d | ||
|
|
7ad83b4e2c | ||
|
|
e3ec99de82 | ||
|
|
c8e278f54b | ||
|
|
9b6b894422 | ||
|
|
022eb311d5 | ||
|
|
c0bb308389 | ||
|
|
cfc5d860e6 | ||
|
|
5d26126b9e | ||
|
|
12c2429a42 | ||
|
|
08abe64d91 | ||
|
|
b7f39732f8 | ||
|
|
e7c43b66d7 | ||
|
|
93f2286e6e | ||
|
|
e8e7811fb4 | ||
|
|
325da7b509 | ||
|
|
5c2b238b3a | ||
|
|
716bbe96d4 | ||
|
|
73804d6f7e | ||
|
|
8bbee85214 | ||
|
|
2fe4eac4ea | ||
|
|
e813ddba18 | ||
|
|
0817313255 | ||
|
|
4217bab02e | ||
|
|
5ba2fb2c9d | ||
|
|
983e0ca89e | ||
|
|
5c06b277ce | ||
|
|
5527b9117e | ||
|
|
736e52532e | ||
|
|
b73451daee | ||
|
|
75cc0cace3 | ||
|
|
883e0e83f2 | ||
|
|
3cb94d2eb3 | ||
|
|
f6ddadc172 | ||
|
|
2b26fd5570 | ||
|
|
5c22c11de2 | ||
|
|
0612b5fa68 | ||
|
|
6b6edf959d | ||
|
|
b21837714a | ||
|
|
73a20f3551 | ||
|
|
ed7bb6278d | ||
|
|
51be57e4df | ||
|
|
0923063ebb | ||
|
|
23ca7253be | ||
|
|
73b4710974 | ||
|
|
992a58c216 | ||
|
|
c6d09a6276 | ||
|
|
0a7c8ef6e2 | ||
|
|
fb16d5c6aa | ||
|
|
e8f504e86d | ||
|
|
d6e14d8bee | ||
|
|
6f2a0b2275 | ||
|
|
87b9573ff8 | ||
|
|
5cf7c2df66 | ||
|
|
a7e3d05208 | ||
|
|
c5789a6e23 | ||
|
|
bf28ed8834 | ||
|
|
0a6b0bfa7a | ||
|
|
ea6360e393 | ||
|
|
57f4cb2867 | ||
|
|
e17c80e604 | ||
|
|
a2841e6d4b | ||
|
|
0d8766a3b1 | ||
|
|
06249fee39 | ||
|
|
dcbad607fc | ||
|
|
7673ccad60 | ||
|
|
081d6d4380 | ||
|
|
b4ec339ac2 | ||
|
|
0c6ff43a0c | ||
|
|
d24d083061 | ||
|
|
4e9deec8bf | ||
|
|
eb00afb2d5 | ||
|
|
dce17c6268 | ||
|
|
294254ce6b | ||
|
|
da2a7d6b20 | ||
|
|
dfd902b7ff | ||
|
|
4b33f7aa41 | ||
|
|
611e085c20 | ||
|
|
a568ef2343 | ||
|
|
ebee0e7705 | ||
|
|
06776b3650 | ||
|
|
b267f13c61 | ||
|
|
efae294b15 | ||
|
|
2c98c40ec8 | ||
|
|
f856eabcde | ||
|
|
27cd85b5be | ||
|
|
eaa3b29a6d | ||
|
|
dd1ccddf1b | ||
|
|
21e68703ce | ||
|
|
cb9b114d35 | ||
|
|
5c1cd5fdd3 | ||
|
|
006fa2d45b | ||
|
|
d1e38c07e6 | ||
|
|
c218a29325 | ||
|
|
9a51540b15 | ||
|
|
6732af2766 | ||
|
|
02794e1516 | ||
|
|
46e351d478 | ||
|
|
5ba53c05fc | ||
|
|
3afdfecf7e | ||
|
|
465300ced9 | ||
|
|
63ca3bfe9d | ||
|
|
a253e7361f | ||
|
|
d05981eaf1 | ||
|
|
b2804551a0 | ||
|
|
90632d021c | ||
|
|
7bfa88f315 | ||
|
|
f251ec6847 | ||
|
|
c29a0f371a | ||
|
|
4926d643ea | ||
|
|
4a1d874e1d | ||
|
|
cc6d8d30ec | ||
|
|
1ab4c3dc25 | ||
|
|
32251b4825 | ||
|
|
271aa40a15 | ||
|
|
27a74e8017 | ||
|
|
0380166916 | ||
|
|
4fcefb9e90 | ||
|
|
30a6bba65f | ||
|
|
ba9c4d1f89 | ||
|
|
f37529d6b6 | ||
|
|
b0ed3d7cc0 | ||
|
|
bec26527a1 | ||
|
|
a421ba8203 | ||
|
|
248d2220f9 | ||
|
|
53d57dbe6b | ||
|
|
5509228a7b | ||
|
|
35cf19d741 | ||
|
|
4fc92206ed | ||
|
|
b38673fb9f | ||
|
|
1f04c9d29c | ||
|
|
73ffd762ca | ||
|
|
b399a96343 | ||
|
|
3038557649 | ||
|
|
87be316149 | ||
|
|
4333a09d65 | ||
|
|
1f17d3287a | ||
|
|
7600eec732 | ||
|
|
57545c810a | ||
|
|
4d57926bd3 | ||
|
|
81b94960a2 | ||
|
|
39e7510664 | ||
|
|
77bb33c474 | ||
|
|
9f4a1e1c75 | ||
|
|
dfe6e74157 | ||
|
|
dd14ca082a | ||
|
|
4ccd2b4697 | ||
|
|
cd98555dfa | ||
|
|
9e275e3450 | ||
|
|
a167ec5e63 | ||
|
|
3496fdc9a5 | ||
|
|
a68ea1cb93 | ||
|
|
9a58b02ec7 | ||
|
|
0cb6f35c33 | ||
|
|
5e678873f9 | ||
|
|
2cdd4d56ff | ||
|
|
d78aea8b8e | ||
|
|
4bf31272ff | ||
|
|
76b24270d4 | ||
|
|
f55289f4b9 | ||
|
|
20f4000086 | ||
|
|
0e8727d93b | ||
|
|
2d604581ef | ||
|
|
51bfa54e46 | ||
|
|
59c4e5cf92 | ||
|
|
676b15e067 | ||
|
|
cd473dd0c1 | ||
|
|
cd5c15d287 | ||
|
|
9b9a920eef | ||
|
|
e75b41d990 | ||
|
|
b1fd52e0b7 | ||
|
|
646129163a | ||
|
|
49576c0018 | ||
|
|
f8fd4db92f | ||
|
|
dd53c24d41 | ||
|
|
03628c8f75 | ||
|
|
b1b3cee831 | ||
|
|
08a1b5095d | ||
|
|
79af7d5deb | ||
|
|
2e33daaed5 | ||
|
|
546a99db1d | ||
|
|
84005af7ef | ||
|
|
5775aa2ef6 | ||
|
|
08c5a1789b | ||
|
|
2e5ee8ed93 | ||
|
|
7b4aa6ffc6 | ||
|
|
8aa9e57149 | ||
|
|
1e98a0705b | ||
|
|
fdb871c498 | ||
|
|
7d501a8673 | ||
|
|
7dd4cbf2bf | ||
|
|
c1ef7bdd8d | ||
|
|
f64ff682a3 | ||
|
|
9ed6ac2bea | ||
|
|
2aba3953d4 | ||
|
|
ab90b9f427 | ||
|
|
8b6063490d | ||
|
|
391a904f46 | ||
|
|
6130b9b160 | ||
|
|
e0ae702b0e | ||
|
|
b757699164 | ||
|
|
9394b232ef | ||
|
|
b70ccd9509 | ||
|
|
e927743bb0 | ||
|
|
86f5c9906b | ||
|
|
2edf52643d | ||
|
|
aaffef4d33 | ||
|
|
f9d40d6815 | ||
|
|
c1d69906a0 | ||
|
|
7a43bd07e6 | ||
|
|
c8e41157a2 | ||
|
|
5a620ea220 | ||
|
|
a901b40464 | ||
|
|
f771d88443 | ||
|
|
96002bba67 | ||
|
|
cfc8f59649 | ||
|
|
b565a12cf8 | ||
|
|
d9679e3af1 | ||
|
|
37dec0e9e9 | ||
|
|
0f9ae1a0d7 | ||
|
|
fb29b46201 | ||
|
|
7ca61b6f33 | ||
|
|
8c9daa12dc | ||
|
|
855f1e1320 | ||
|
|
734a779a42 | ||
|
|
72d1a2357d | ||
|
|
4a1865ca5e | ||
|
|
5a62284972 | ||
|
|
26ea0b7f16 | ||
|
|
853c44b798 | ||
|
|
2677cf1b0a | ||
|
|
dd9dce104d | ||
|
|
eedd1be730 | ||
|
|
d1d23a6e67 | ||
|
|
29e08ffcdf | ||
|
|
1c19deed17 | ||
|
|
bbf4e167f2 | ||
|
|
009765d2ca | ||
|
|
24f819fd74 | ||
|
|
bc059bc7fa | ||
|
|
9e4100bf95 | ||
|
|
71d6ccd801 | ||
|
|
8b0efdb1a1 | ||
|
|
bd67e8074a | ||
|
|
f01e1784e5 | ||
|
|
5184336647 | ||
|
|
fb8c4983a6 | ||
|
|
e569553aa0 | ||
|
|
3d1bbf0a5f | ||
|
|
8bcc6e964b | ||
|
|
e87ae0bd4f | ||
|
|
e885d5300a | ||
|
|
84cb76733f | ||
|
|
251161f75c | ||
|
|
f8ec1b51f3 | ||
|
|
c00411a16a | ||
|
|
5990efb795 | ||
|
|
b92405552f | ||
|
|
f982d86ba7 | ||
|
|
29ed59ee11 | ||
|
|
705fad2964 | ||
|
|
bb12d6f728 | ||
|
|
823f80f5ad | ||
|
|
f00680eb59 | ||
|
|
0bf67e849a | ||
|
|
ce88793698 | ||
|
|
9085467970 | ||
|
|
beb665a376 | ||
|
|
17329745fc | ||
|
|
5d84c2398e | ||
|
|
7b363fd3c9 | ||
|
|
b9620414c1 | ||
|
|
6a24976ceb | ||
|
|
6b903a2d8a | ||
|
|
9a1e25d994 | ||
|
|
c90c8b50e4 | ||
|
|
b3f05a467a | ||
|
|
68eb9dd371 | ||
|
|
553d83d427 | ||
|
|
9bdd742dd2 | ||
|
|
b56c285da5 | ||
|
|
1a78103306 | ||
|
|
ef1f7b5058 | ||
|
|
4b91b88fcb | ||
|
|
199501f2a0 | ||
|
|
a930bd3332 | ||
|
|
ddc280ec43 | ||
|
|
8315cd527f | ||
|
|
9a14bd04f8 | ||
|
|
73bffd4d96 | ||
|
|
42eddbafe7 | ||
|
|
ae50c6d8ee | ||
|
|
e0c418e13b | ||
|
|
164c5c80ba | ||
|
|
5aabf4e415 | ||
|
|
483027f166 | ||
|
|
d42ef28b98 | ||
|
|
17d355cb3c | ||
|
|
e6d88ea2a1 | ||
|
|
e0b8778506 | ||
|
|
5816ccb190 | ||
|
|
ec351c32e3 | ||
|
|
4a9d6d1fe9 | ||
|
|
70f7ef7be3 | ||
|
|
3858bf18d5 | ||
|
|
e919096271 | ||
|
|
126da9ec2d | ||
|
|
b7d5342003 | ||
|
|
10fb2b71f3 | ||
|
|
e422af6bcb | ||
|
|
a75c180e53 | ||
|
|
032e2cbf20 | ||
|
|
cdbae77823 | ||
|
|
37310ea057 | ||
|
|
762bb626c7 | ||
|
|
999af20d3e | ||
|
|
9c32a15220 | ||
|
|
82327f4be4 | ||
|
|
0bd0257fe0 | ||
|
|
d77b781c1f | ||
|
|
377bdaff3b | ||
|
|
cc59aae65f | ||
|
|
07fffc5add | ||
|
|
02bab6869e | ||
|
|
a62b0e7459 | ||
|
|
2f0a5f947a | ||
|
|
d4f15e95d6 | ||
|
|
d1569c215c | ||
|
|
746cfc8bf0 | ||
|
|
b5ca9e0c4e | ||
|
|
bf968f71f1 | ||
|
|
a972c870a8 | ||
|
|
27d42a08c8 | ||
|
|
4a070d1460 | ||
|
|
1d589b2e2d | ||
|
|
70678bc5b6 | ||
|
|
5a5d0fa044 | ||
|
|
004ad11337 | ||
|
|
969af89797 | ||
|
|
d957b9537e | ||
|
|
5a16a89427 | ||
|
|
8c44f0179d | ||
|
|
52219874fe | ||
|
|
350865e339 | ||
|
|
cc34344d91 | ||
|
|
61ff4b3973 | ||
|
|
4eb2fd6826 | ||
|
|
65bb10f253 | ||
|
|
fe25715792 | ||
|
|
c819ca98ee | ||
|
|
b4c823211d | ||
|
|
fae1dc8620 | ||
|
|
4ee2eee2fc | ||
|
|
79e1cab0d1 | ||
|
|
9033453c18 | ||
|
|
5412843e79 | ||
|
|
64a5f96780 | ||
|
|
990025a7d9 | ||
|
|
ecfd1f6a35 | ||
|
|
6f03722448 | ||
|
|
c98a359a16 | ||
|
|
48c6157eb9 | ||
|
|
7ad4b30ed4 | ||
|
|
7b7c99ca33 | ||
|
|
3fc4ad1478 | ||
|
|
21ccbb6c0e | ||
|
|
c2ce2c5b4b | ||
|
|
fc94638330 | ||
|
|
3d283ddecd | ||
|
|
2f30932eca | ||
|
|
dbc608b568 | ||
|
|
c63fe9137f | ||
|
|
7790cd5fad | ||
|
|
d505e3ee67 | ||
|
|
46b77c203e | ||
|
|
62d7acc97e | ||
|
|
4922f2a06f | ||
|
|
7eb8e45348 | ||
|
|
ea97282af1 | ||
|
|
aa87276bed | ||
|
|
30c7de068b | ||
|
|
6973abcfa8 | ||
|
|
1b751c894b | ||
|
|
0f34a821ab | ||
|
|
2454ebd85d | ||
|
|
f3d6c94c7f | ||
|
|
47ea7b7f96 | ||
|
|
ee9cf48620 | ||
|
|
c9c959cc7c | ||
|
|
ab1878245c | ||
|
|
c58fd15db5 | ||
|
|
3c6bfe3e33 | ||
|
|
2d5d88ebc0 | ||
|
|
38d6615ed2 | ||
|
|
1f0262bcdb | ||
|
|
0fa9deda17 | ||
|
|
5cf9a03b3f | ||
|
|
bb20462cb3 | ||
|
|
86ac072b44 | ||
|
|
485d7cbdf1 | ||
|
|
a4d45d423f | ||
|
|
60fe7bfa41 | ||
|
|
7547a6e2f6 | ||
|
|
c961a44e0b | ||
|
|
d3d829aaf0 | ||
|
|
94c3331d47 | ||
|
|
b4b6d26287 | ||
|
|
1f2dc40ede | ||
|
|
b32b1db9d8 | ||
|
|
a2eec6051f | ||
|
|
6f347ef9dc | ||
|
|
84e7511607 | ||
|
|
3ee6c24ea2 | ||
|
|
f704b27b5b | ||
|
|
8c7a7e6e63 | ||
|
|
bb66a6c94e | ||
|
|
309dc2d642 | ||
|
|
046d6e7a95 | ||
|
|
e4164b5666 | ||
|
|
368f66492e | ||
|
|
d20cfbd303 | ||
|
|
6c35c7c976 | ||
|
|
86a1073e0b | ||
|
|
3ade65fc04 | ||
|
|
3ebb895218 | ||
|
|
ab57f76e13 | ||
|
|
1c275de6a2 | ||
|
|
87210b5f4b | ||
|
|
ffe17b51b4 | ||
|
|
f1ab127077 | ||
|
|
f588869696 | ||
|
|
161aae7273 | ||
|
|
064f04e7e2 | ||
|
|
ff567f7943 | ||
|
|
554a9ff7ea | ||
|
|
54cb5c6af3 | ||
|
|
083d3f49c2 | ||
|
|
ff9f2f6fba | ||
|
|
332fc1006c | ||
|
|
d27d3be6cd | ||
|
|
61e45dbb2f | ||
|
|
90372ed51a | ||
|
|
ae907f38f0 | ||
|
|
f1048143ee | ||
|
|
1d62d3b7b9 | ||
|
|
4a7252babd | ||
|
|
45ad0e87d6 | ||
|
|
1ba19d6bf7 | ||
|
|
be5c10314d | ||
|
|
25413bfe00 | ||
|
|
a9d8913bc7 | ||
|
|
b8faa7ea60 | ||
|
|
dfd1eb0387 | ||
|
|
ab52db8d5e | ||
|
|
6c0642d772 | ||
|
|
0b42a6a8cf | ||
|
|
4d63525f76 | ||
|
|
cee605c525 | ||
|
|
81c3a518d3 | ||
|
|
b31cb87fdc | ||
|
|
ba248206fe | ||
|
|
664c6e7ea0 | ||
|
|
d5f2a18e19 | ||
|
|
82338d8460 | ||
|
|
e34e8782a9 | ||
|
|
cf95e0b2d5 | ||
|
|
56b217117a | ||
|
|
14b1c1da9a | ||
|
|
c06e80e1e7 | ||
|
|
f382c0236e | ||
|
|
4a5ce08688 | ||
|
|
b48bfe795e | ||
|
|
83e1884d0c | ||
|
|
d1b6078e5d | ||
|
|
120513c29f | ||
|
|
43fb3fcb2f | ||
|
|
35939d9378 | ||
|
|
7abe709867 | ||
|
|
5c071bcf2f | ||
|
|
dc2510327b | ||
|
|
23fedb3ad4 | ||
|
|
9c44dce304 | ||
|
|
be0ed3d0b9 | ||
|
|
6d6a40cc4b | ||
|
|
5209e18ba7 | ||
|
|
5d3a0e8ed3 | ||
|
|
d128b71820 | ||
|
|
1a2f4d9af7 | ||
|
|
7f782da048 | ||
|
|
9134dff078 | ||
|
|
c31fcbbaf3 | ||
|
|
cb1ce7b974 | ||
|
|
fa17c4b949 | ||
|
|
86a4bfb30a | ||
|
|
91fbdac6ab | ||
|
|
e6d5539ebb | ||
|
|
f24e0f5e6f | ||
|
|
39a841cecf | ||
|
|
6a60c821a8 | ||
|
|
8e1bd4a05b | ||
|
|
bee9eb1a9d | ||
|
|
3e245c9e21 | ||
|
|
6160d45e05 | ||
|
|
74078685e6 | ||
|
|
843c5ef0f9 | ||
|
|
69d728be18 | ||
|
|
747fc5d5fd | ||
|
|
3978e5576e | ||
|
|
16ce8aa412 | ||
|
|
f87b3e30a7 | ||
|
|
67451849de | ||
|
|
de2b93859c | ||
|
|
10a11e23ba | ||
|
|
1c943eb88a | ||
|
|
d24eaac9e6 | ||
|
|
7090800870 | ||
|
|
11d7c52912 | ||
|
|
5f46010ab7 | ||
|
|
5246063a7b | ||
|
|
95544f78cb | ||
|
|
7ad978045d | ||
|
|
de242f6d5f | ||
|
|
1ff789c567 | ||
|
|
3978abd05b | ||
|
|
036f299137 | ||
|
|
b7f88e01a4 | ||
|
|
a630cb15b1 | ||
|
|
7f8797c8ee | ||
|
|
f51d2069ff | ||
|
|
d1c8ae5dc9 | ||
|
|
75aa1928ac | ||
|
|
16722554bf | ||
|
|
5423df9ebc | ||
|
|
62f18e1f20 | ||
|
|
51a43b47fe | ||
|
|
bfe773f471 | ||
|
|
016d6289a1 | ||
|
|
0f8a63896e | ||
|
|
0d65565210 | ||
|
|
0d4ee68be5 | ||
|
|
97b43a7999 | ||
|
|
a1c6a57fea | ||
|
|
9ac178ab40 | ||
|
|
ce0cf1d44b | ||
|
|
3f91d7a9f6 | ||
|
|
30b17863bd | ||
|
|
23bc647b35 | ||
|
|
380ad123ac | ||
|
|
1eb645d8d7 | ||
|
|
b47a74f4e7 | ||
|
|
0a44c17771 | ||
|
|
aaf0e23330 | ||
|
|
bf4497406f | ||
|
|
c96b703ab0 | ||
|
|
cf40d8175b | ||
|
|
b628409b1e | ||
|
|
53ad366fe7 | ||
|
|
b6f71645f4 | ||
|
|
28de951b02 | ||
|
|
2f9c30a2d5 | ||
|
|
ac9731704a | ||
|
|
264e771b8b | ||
|
|
19c370167a | ||
|
|
b8fa7e88f2 | ||
|
|
1f0ac23c20 | ||
|
|
24cca8d958 | ||
|
|
e4baaa2d27 | ||
|
|
007a011647 | ||
|
|
9d7010ca86 | ||
|
|
d4cffd1cc3 | ||
|
|
cef737f038 | ||
|
|
c5280e8885 | ||
|
|
f56b8e4b00 | ||
|
|
d5bd137a24 | ||
|
|
f912ebb740 | ||
|
|
6ab402ce27 | ||
|
|
52d2f4bd90 | ||
|
|
90252bb4c9 | ||
|
|
7fe6520e75 | ||
|
|
6d5aa4539a | ||
|
|
8cbaa45030 | ||
|
|
2f01eb161a | ||
|
|
4a5d95d3fb | ||
|
|
9bfb2fc922 | ||
|
|
bc37480e9c | ||
|
|
b71e6024f9 | ||
|
|
54deebf4e4 | ||
|
|
a0ae6de848 | ||
|
|
4cbe45934e | ||
|
|
9ed109429b | ||
|
|
d57ae8b796 | ||
|
|
07e42dc056 | ||
|
|
a882126fee | ||
|
|
af0dd596a8 | ||
|
|
8d3c40d492 | ||
|
|
38013e394f | ||
|
|
f246dc7f57 | ||
|
|
c350485b18 | ||
|
|
2b306e906f | ||
|
|
8552aec7fd | ||
|
|
2d5e4f6b05 | ||
|
|
0ec71bf4b8 | ||
|
|
9200e79d21 | ||
|
|
bfd94c4331 | ||
|
|
6a65d2f8cc | ||
|
|
84b93f7ef1 | ||
|
|
86097b3f31 | ||
|
|
887a1ad57f | ||
|
|
23f62fc6f3 | ||
|
|
b4f3cff6f5 | ||
|
|
1e07f852e0 | ||
|
|
2d2c868aab | ||
|
|
0c520e03b9 | ||
|
|
570f655ee4 | ||
|
|
b7285001c9 | ||
|
|
7573ac6edf | ||
|
|
2ee82723a8 | ||
|
|
1e51925684 | ||
|
|
db485cf7bc | ||
|
|
bc48ebd86a | ||
|
|
f2de0b7ae4 | ||
|
|
676e95ea3d | ||
|
|
6943a9489e | ||
|
|
68071e46b1 | ||
|
|
bc3d4a175f | ||
|
|
5d38f5ba89 | ||
|
|
2c6b41812f | ||
|
|
b1fe462116 | ||
|
|
5e60dc4a20 | ||
|
|
ba50217281 | ||
|
|
a7e14db495 | ||
|
|
b7128c6236 | ||
|
|
db289b258d | ||
|
|
98ea849623 | ||
|
|
a80b290e30 | ||
|
|
6b00d0d3ca | ||
|
|
415f6c9628 | ||
|
|
ae32016fc9 | ||
|
|
9f0e00fc61 | ||
|
|
230b411de8 | ||
|
|
658d2cf986 | ||
|
|
02eb934b0f | ||
|
|
a70aa86e25 | ||
|
|
20a825aed8 | ||
|
|
90ca6b2878 | ||
|
|
14efdc58ce | ||
|
|
99f61719cb | ||
|
|
45a8ed89c6 | ||
|
|
1443487c92 | ||
|
|
1283a150ae | ||
|
|
9955c45907 | ||
|
|
ecce943e25 | ||
|
|
f6acb660ea | ||
|
|
d0c41a8519 | ||
|
|
f087480da1 | ||
|
|
a8c23aa795 | ||
|
|
27421a1878 | ||
|
|
bef14d7a87 | ||
|
|
10a1fe6169 | ||
|
|
8f99104362 | ||
|
|
d1fa5859d6 | ||
|
|
dbaf97e463 | ||
|
|
cc1669bcde | ||
|
|
8a7a678b03 | ||
|
|
a1a1a9fa2c | ||
|
|
b766c39456 | ||
|
|
9754b91c16 | ||
|
|
f46f1b4d8a | ||
|
|
7f90ae436f | ||
|
|
1689075c99 | ||
|
|
babd3fbba6 | ||
|
|
92255d60b8 | ||
|
|
828548ab56 | ||
|
|
344ea471ef | ||
|
|
f815469a76 | ||
|
|
078bacf1e9 | ||
|
|
e0537f6194 | ||
|
|
37adefc670 | ||
|
|
ac692b2cf7 | ||
|
|
9139770764 | ||
|
|
29ee76cb2b | ||
|
|
c8b8a2d0cf | ||
|
|
c3386a4304 | ||
|
|
7a8f6792f3 | ||
|
|
9a643149de | ||
|
|
cc8885f6f3 | ||
|
|
de55987667 | ||
|
|
d9f7165de1 | ||
|
|
ddddb94f05 | ||
|
|
038b076e55 | ||
|
|
e1d9633e20 | ||
|
|
a937640bff | ||
|
|
f4c684a1ef | ||
|
|
6417564eeb | ||
|
|
d00b3a5e94 | ||
|
|
fc3f048f8f | ||
|
|
b8d004631a | ||
|
|
4306bb13f6 | ||
|
|
6ebbc7414e | ||
|
|
1eef0c4571 | ||
|
|
71224980e1 | ||
|
|
c8e2de6e1b | ||
|
|
de5fd23f25 | ||
|
|
23246f39ed | ||
|
|
6e98521d68 | ||
|
|
58a651b2e5 | ||
|
|
f9bd87b0a7 | ||
|
|
6a6798b8e4 | ||
|
|
0b62158475 | ||
|
|
3f11b1bf63 | ||
|
|
8eeb655661 | ||
|
|
157e8071be | ||
|
|
ff3a61b71d | ||
|
|
4240364098 | ||
|
|
f1dbd4a6f7 | ||
|
|
fcafa4bfc1 | ||
|
|
b831753676 | ||
|
|
156dc41cbc | ||
|
|
fc2256a6ca | ||
|
|
41a72ecd19 | ||
|
|
79c142d938 | ||
|
|
a39bba33c8 | ||
|
|
9d6e0833bc | ||
|
|
d84a35f649 | ||
|
|
15ca58648a | ||
|
|
66c37d1390 | ||
|
|
2e3054f413 | ||
|
|
1c1655a301 | ||
|
|
7e64db23d0 | ||
|
|
e11ff718ac | ||
|
|
6f978dbacd | ||
|
|
08c20362f5 | ||
|
|
de7f9b7332 | ||
|
|
c7a3e1be8f | ||
|
|
e70aa9de7e | ||
|
|
223b887960 | ||
|
|
198ea3c86a | ||
|
|
f28c7ec7e5 | ||
|
|
0d3ca7289e | ||
|
|
cc428da83f | ||
|
|
d6a2d41db2 | ||
|
|
14445fd9a1 | ||
|
|
b953134bba | ||
|
|
69024551bf | ||
|
|
f7eaf5a012 | ||
|
|
bb9a0ad95a | ||
|
|
b3b756dab3 | ||
|
|
c99e2c5f4c | ||
|
|
088ee4134b | ||
|
|
ef8f423e90 | ||
|
|
e5ba382b99 | ||
|
|
193c8c7383 | ||
|
|
77804ce53d | ||
|
|
4d00896d05 | ||
|
|
6fafa5aa9f | ||
|
|
03e827a422 | ||
|
|
dbc049fda4 | ||
|
|
6e05312ba9 | ||
|
|
726b2cb5da | ||
|
|
1429017968 | ||
|
|
37dd6247dd | ||
|
|
7b86134032 | ||
|
|
8de331def0 | ||
|
|
0840b76602 | ||
|
|
f2ddc05ee7 | ||
|
|
1d4c88c8a5 | ||
|
|
4905434b8a | ||
|
|
982d35ffa2 | ||
|
|
94ff9f1010 | ||
|
|
6f267f022f | ||
|
|
01f67987e0 | ||
|
|
379ac89c30 | ||
|
|
5dc0ceeb9e | ||
|
|
77ee52333c | ||
|
|
54690dc0b2 | ||
|
|
c3850c83d9 | ||
|
|
27cbffddd8 | ||
|
|
18433aadf6 | ||
|
|
28069404a4 | ||
|
|
3c12ff7c89 | ||
|
|
c337d29550 | ||
|
|
146e83a60e | ||
|
|
127adc559f | ||
|
|
deac371690 | ||
|
|
3f6f3174e9 | ||
|
|
0a92bbf349 | ||
|
|
574fee4f99 | ||
|
|
b270315b21 | ||
|
|
90161c9213 | ||
|
|
7b71d740b9 | ||
|
|
d13b90b9e8 | ||
|
|
0ef24c672a | ||
|
|
2ada89b60f | ||
|
|
54e57da96a | ||
|
|
1b7058c653 | ||
|
|
e8614dbcd7 | ||
|
|
10427ab528 | ||
|
|
e548bdff96 | ||
|
|
95ef16528c | ||
|
|
72a4c33568 | ||
|
|
b381009740 | ||
|
|
f413e241ba | ||
|
|
8deb686d2e | ||
|
|
a87bb60809 | ||
|
|
8804c6a3b7 | ||
|
|
fc379ba077 | ||
|
|
9e164578f2 | ||
|
|
778ee6da60 | ||
|
|
5043ea1986 | ||
|
|
576db48ef0 | ||
|
|
3efa51d943 | ||
|
|
6eb1e41674 | ||
|
|
df1eda82b9 | ||
|
|
d0615ae73a | ||
|
|
d5826903c1 | ||
|
|
7fde8debc4 | ||
|
|
d1a9d57bd6 | ||
|
|
2401ce5343 | ||
|
|
958fa2a9cc | ||
|
|
0b3fc1a9ac | ||
|
|
16bc6159f3 | ||
|
|
6447ac0ef4 | ||
|
|
174808cedb | ||
|
|
a34f99930d | ||
|
|
7ffce0c119 | ||
|
|
d5624dcc0d | ||
|
|
cae717e1f6 | ||
|
|
f3d28845f8 | ||
|
|
e9903cfa0f | ||
|
|
e037622641 | ||
|
|
f98f5e37cd | ||
|
|
0301ffab3d | ||
|
|
1f96c97984 | ||
|
|
68497c0bd3 | ||
|
|
3968082df4 | ||
|
|
a1c9c66ac0 | ||
|
|
e2c51a8dc6 | ||
|
|
85cffcc83d | ||
|
|
942e137679 | ||
|
|
3d9256225f | ||
|
|
06813d066b | ||
|
|
16cd02e01e | ||
|
|
ed830e8693 | ||
|
|
f3133c4149 | ||
|
|
f7662da2af | ||
|
|
47bc802e9e | ||
|
|
0b1ff5a606 | ||
|
|
8b2d02ed34 | ||
|
|
93850a56b2 | ||
|
|
5797c7f0ef | ||
|
|
1fb7961e08 | ||
|
|
b2312e9901 | ||
|
|
4079b00119 | ||
|
|
9ea8836357 | ||
|
|
1ece21bddd | ||
|
|
0fb397e617 | ||
|
|
867a6080fe | ||
|
|
dad4cf7e63 | ||
|
|
b3a6ec3e62 | ||
|
|
3ba93c0438 | ||
|
|
4d149205c3 | ||
|
|
0d605e98b2 | ||
|
|
a84a512700 | ||
|
|
5b300dd3a9 | ||
|
|
9cc7f3230a | ||
|
|
2acfd7bd26 | ||
|
|
b662f0d58b | ||
|
|
348e84c202 | ||
|
|
55e2cf6533 | ||
|
|
fb6d22c96c | ||
|
|
00e76cb6b9 | ||
|
|
e5d0bde697 | ||
|
|
38a33f91c0 | ||
|
|
1fd98e039d | ||
|
|
b32011943a | ||
|
|
7a121e92eb | ||
|
|
8d929dab60 | ||
|
|
a88d52237b | ||
|
|
507d1f76e5 | ||
|
|
ae38d65e95 | ||
|
|
9dc93ac561 | ||
|
|
540d3f60f3 | ||
|
|
b9dfb8c03f | ||
|
|
0fcd9430ce | ||
|
|
cce1ae2ce5 | ||
|
|
ea338fffb5 | ||
|
|
6adfd349e9 | ||
|
|
548ffd49a3 | ||
|
|
ba3a01f5e0 | ||
|
|
9c85ecdef4 | ||
|
|
7dc7f402a7 | ||
|
|
60a5c38a4b | ||
|
|
4f65360a5f | ||
|
|
918f2ab3d7 | ||
|
|
8b80c71d70 | ||
|
|
15d3f7f143 | ||
|
|
627814bdc3 | ||
|
|
0d38301d85 | ||
|
|
93983040c5 | ||
|
|
60158cb93e | ||
|
|
988a78c61c | ||
|
|
e3752e56a4 | ||
|
|
8445a9ff99 | ||
|
|
6624daeb4d | ||
|
|
ad8071f582 | ||
|
|
55b1efc6de | ||
|
|
3071e2fda3 | ||
|
|
fdc4c203e5 | ||
|
|
70a5a1abde | ||
|
|
fef32b570b | ||
|
|
edb3fbc305 | ||
|
|
d6a8f5f0d0 | ||
|
|
c238a97a9e | ||
|
|
7eb6457c4c | ||
|
|
d2a64d2fc2 | ||
|
|
560047ce86 | ||
|
|
cf131bb328 | ||
|
|
d89e5e6450 | ||
|
|
d89e629e52 | ||
|
|
408ae211ce | ||
|
|
f06c494636 | ||
|
|
058e740d1e | ||
|
|
82e6c0b3db | ||
|
|
964a368e5c | ||
|
|
9b5f71ec02 | ||
|
|
84ab267e22 | ||
|
|
6b05b0ce93 | ||
|
|
3b59821cbd | ||
|
|
0ea3a6f660 | ||
|
|
19d7021d99 | ||
|
|
7202e00b4c | ||
|
|
5b2e27137d | ||
|
|
5cfa5ef6f3 | ||
|
|
de9f1f757a | ||
|
|
2c12d435e5 | ||
|
|
95d3c4503f | ||
|
|
4a2117027f | ||
|
|
6d1d2e59bf | ||
|
|
c0bc9652fd | ||
|
|
78333d0452 | ||
|
|
f547d672cf | ||
|
|
5c9ed9f41a | ||
|
|
618d62f593 | ||
|
|
bae38db8e4 | ||
|
|
2bf88a891f | ||
|
|
91d8f0e892 | ||
|
|
ef614ecca6 | ||
|
|
fa69f110d9 | ||
|
|
77dbe738d2 | ||
|
|
14f5c8d764 | ||
|
|
a77b4f3970 | ||
|
|
63e5e7bf0e | ||
|
|
42e3b00ae5 | ||
|
|
451c0d2828 | ||
|
|
3cd1986195 | ||
|
|
5ba5f4d2e7 | ||
|
|
b31566ef32 | ||
|
|
4e5936ef95 | ||
|
|
5c63a72968 | ||
|
|
3cc01a80a3 | ||
|
|
a9ae74d25b | ||
|
|
afe023d136 | ||
|
|
2ed05ab146 | ||
|
|
75ac42b1ae | ||
|
|
c089ccdb44 | ||
|
|
3603f79ce5 | ||
|
|
540769d566 | ||
|
|
354b527e03 | ||
|
|
a36ac0db67 | ||
|
|
dcc40b7ecc | ||
|
|
9b9e5479e8 | ||
|
|
3b05b80cd7 | ||
|
|
ca1b6fc745 | ||
|
|
df7bfb433e | ||
|
|
0d8c652c46 | ||
|
|
6ddc0d7f6b | ||
|
|
b413a7009e | ||
|
|
5bf4658dea | ||
|
|
bcf27247d1 | ||
|
|
2c511609c4 | ||
|
|
d2fe81706c | ||
|
|
d1e3cbdb5a | ||
|
|
2123b7cded | ||
|
|
8063d5ca25 | ||
|
|
fdab4b1917 | ||
|
|
0762364c59 | ||
|
|
6047ae3379 | ||
|
|
ff4b924d20 | ||
|
|
16b8579f53 | ||
|
|
c0dedd05e8 | ||
|
|
f4bb212d6c | ||
|
|
bc321653d1 | ||
|
|
75a7e195ff | ||
|
|
7d1b3d8685 | ||
|
|
6077d90c26 | ||
|
|
1e4dc96d61 | ||
|
|
1271dbb860 | ||
|
|
63654c1b08 | ||
|
|
6feb2002f0 | ||
|
|
ec4f3d95e7 | ||
|
|
861f0145d3 | ||
|
|
c6fbed5dba | ||
|
|
d824853de3 | ||
|
|
dcc286607c | ||
|
|
a8b98d63e7 | ||
|
|
88da3ef506 | ||
|
|
92271e5a0d | ||
|
|
ce4f0e982b | ||
|
|
332c472865 | ||
|
|
5f9a422cfa | ||
|
|
6302486ce6 |
No files matched your search
@@ -1,7 +0,0 @@
|
||||
busybox
|
||||
busybox.links
|
||||
_install
|
||||
.config
|
||||
.menuconfig.log
|
||||
.config.cmd
|
||||
.config.old
|
||||
@@ -2,12 +2,15 @@ List of the authors of code contained in BusyBox.
|
||||
|
||||
If you have code in BusyBox, you should be listed here. If you should be
|
||||
listed, or the description of what you have done needs more detail, or is
|
||||
incorect, _please_ let me know.
|
||||
incorrect, _please_ let me know.
|
||||
|
||||
-Erik
|
||||
|
||||
-----------
|
||||
|
||||
Peter Willis <psyphreak@phreaker.net>
|
||||
eject
|
||||
|
||||
Emanuele Aina <emanuele.aina@tiscali.it>
|
||||
run-parts
|
||||
|
||||
@@ -23,12 +26,21 @@ Laurence Anderson <l.d.anderson@warwick.ac.uk>
|
||||
Jeff Angielski <jeff@theptrgroup.com>
|
||||
ftpput, ftpget
|
||||
|
||||
Enrik Berkhan <Enrik.Berkhan@inka.de>
|
||||
setconsole
|
||||
|
||||
Jim Bauer <jfbauer@nfr.com>
|
||||
modprobe shell dependency
|
||||
|
||||
Edward Betts <edward@debian.org>
|
||||
expr, hostid, logname, whoami
|
||||
|
||||
John Beppu <beppu@codepoet.org>
|
||||
du, nslookup, sort
|
||||
|
||||
David Brownell <dbrownell@users.sourceforge.net>
|
||||
zcip
|
||||
|
||||
Brian Candler <B.Candler@pobox.com>
|
||||
tiny-ls(ls)
|
||||
|
||||
@@ -69,6 +81,14 @@ Daniel Jacobowitz <dan@debian.org>
|
||||
Matt Kraai <kraai@alumni.cmu.edu>
|
||||
documentation, bugfixes, test suite
|
||||
|
||||
Rob Landley <rob@landley.net>
|
||||
Became busybox maintainer in 2006.
|
||||
|
||||
sed (major rewrite in 2003, and I now maintain the thing)
|
||||
bunzip2 (complete from-scratch rewrite, then mjn3 optimized the result)
|
||||
sort (more or less from scratch rewrite in 2004, I now maintain it)
|
||||
mount (rewrite in 2005, I maintain the new one)
|
||||
|
||||
Stephan Linz <linz@li-pro.net>
|
||||
ipcalc, Red Hat equivalence
|
||||
|
||||
@@ -76,13 +96,14 @@ John Lombardo <john@deltanet.com>
|
||||
tr
|
||||
|
||||
Glenn McGrath <bug1@iinet.net.au>
|
||||
Common unarchving code and unarchiving applets, ifupdown, ftpgetput,
|
||||
nameif, sed, patch, fold, install, uudecode.
|
||||
Various bugfixes, review and apply numerous patches.
|
||||
Common unarchiving code and unarchiving applets, ifupdown, ftpgetput,
|
||||
nameif, sed, patch, fold, install, uudecode.
|
||||
Various bugfixes, review and apply numerous patches.
|
||||
|
||||
Manuel Novoa III <mjn3@codepoet.org>
|
||||
cat, head, mkfifo, mknod, rmdir, sleep, tee, tty, uniq, usleep, wc, yes,
|
||||
mesg, vconfig, make_directory, parse_mode, dirname, mode_string,
|
||||
mesg, vconfig, nice, renice,
|
||||
make_directory, parse_mode, dirname, mode_string,
|
||||
get_last_path_component, simplify_path, and a number trivial libbb routines
|
||||
|
||||
also bug fixes, partial rewrites, and size optimizations in
|
||||
@@ -91,8 +112,9 @@ Manuel Novoa III <mjn3@codepoet.org>
|
||||
interface, dutmp, ifconfig, route
|
||||
|
||||
Vladimir Oleynik <dzo@simtreas.ru>
|
||||
cmdedit; xargs(current), httpd(current);
|
||||
ports: ash, crond, fdisk, inetd, stty, traceroute, top;
|
||||
cmdedit; bb_mkdep, xargs(current), httpd(current);
|
||||
ports: ash, crond, fdisk (initial, unmaintained now), inetd, stty, traceroute,
|
||||
top;
|
||||
locale, various fixes
|
||||
and irreconcilable critic of everything not perfect.
|
||||
|
||||
@@ -100,6 +122,9 @@ Bruce Perens <bruce@pixar.com>
|
||||
Original author of BusyBox in 1995, 1996. Some of his code can
|
||||
still be found hiding here and there...
|
||||
|
||||
Rodney Radford <rradford@mindspring.com>
|
||||
ipcs, ipcrm
|
||||
|
||||
Tim Riker <Tim@Rikers.org>
|
||||
bug fixes, member of fan club
|
||||
|
||||
@@ -115,7 +140,10 @@ Pavel Roskin <proski@gnu.org>
|
||||
Gyepi Sam <gyepi@praxis-sw.com>
|
||||
Remote logging feature for syslogd
|
||||
|
||||
Linus Torvalds <torvalds@transmeta.com>
|
||||
Rob Sullivan <cogito.ergo.cogito@gmail.com>
|
||||
comm
|
||||
|
||||
Linus Torvalds
|
||||
mkswap, fsck.minix, mkfs.minix
|
||||
|
||||
Mark Whitley <markw@codepoet.org>
|
||||
@@ -129,5 +157,17 @@ Enrique Zanardi <ezanardi@ull.es>
|
||||
tarcat (since removed), loadkmap, various fixes, Debian maintenance
|
||||
|
||||
Tito Ragusa <farmatito@tiscali.it>
|
||||
devfsd and size optimizations in strings, openvt, chvt, deallocvt, hdparm and fdformat.
|
||||
devfsd and size optimizations in strings, openvt, chvt, deallocvt, hdparm,
|
||||
fdformat, lsattr, chattr, id and eject.
|
||||
|
||||
Paul Fox <pgf@foxharp.boston.ma.us>
|
||||
vi editing mode for ash, various other patches/fixes
|
||||
|
||||
Roberto A. Foglietta <me@roberto.foglietta.name>
|
||||
port: dnsd
|
||||
|
||||
Bernhard Fischer <rep.nop@aon.at>
|
||||
misc
|
||||
|
||||
Mike Frysinger <vapier@gentoo.org>
|
||||
initial e2fsprogs, printenv, setarch, sum, misc
|
||||
@@ -0,0 +1,457 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see scripts/kbuild/config-language.txt.
|
||||
#
|
||||
|
||||
mainmenu "BusyBox Configuration"
|
||||
|
||||
config HAVE_DOT_CONFIG
|
||||
bool
|
||||
default y
|
||||
|
||||
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.
|
||||
- Put them on stack. For some very small machines with limited stack
|
||||
space, this can be deadly. For most folks, this works just fine.
|
||||
- Put them in BSS. This works beautifully for computers with a real
|
||||
MMU (and OS support), but wastes runtime RAM for uCLinux. This
|
||||
behavior was the only one available for BusyBox versions 0.48 and
|
||||
earlier.
|
||||
|
||||
config CONFIG_FEATURE_BUFFERS_USE_MALLOC
|
||||
bool "Allocate with Malloc"
|
||||
|
||||
config CONFIG_FEATURE_BUFFERS_GO_ON_STACK
|
||||
bool "Allocate on the Stack"
|
||||
|
||||
config CONFIG_FEATURE_BUFFERS_GO_IN_BSS
|
||||
bool "Allocate in the .bss section"
|
||||
|
||||
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
|
||||
help
|
||||
Enable 'busybox --install [-s]' support. This will allow you to use
|
||||
busybox at runtime to create hard links or symlinks for all the
|
||||
applets that are compiled into busybox. This feature requires the
|
||||
/proc filesystem.
|
||||
|
||||
config CONFIG_LOCALE_SUPPORT
|
||||
bool "Enable locale support (system needs locale for this to work)"
|
||||
default n
|
||||
help
|
||||
Enable this if your system has locale support and you would like
|
||||
busybox to support locale settings.
|
||||
|
||||
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
|
||||
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 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
|
||||
space since the OS will clean up for us, but it can confuse debuggers
|
||||
like valgrind, which report tons of memory and resource leaks.
|
||||
|
||||
Don't enable this unless you have a really good reason to clean
|
||||
things up manually.
|
||||
|
||||
config CONFIG_FEATURE_SUID
|
||||
bool "Support for SUID/SGID handling"
|
||||
default n
|
||||
help
|
||||
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 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>)
|
||||
|
||||
An example might help:
|
||||
|
||||
[SUID]
|
||||
su = ssx root.0 # applet su can be run by anyone and runs with euid=0/egid=0
|
||||
su = ssx # exactly the same
|
||||
|
||||
mount = sx- root.disk # applet mount can be run by root and members of group disk
|
||||
# and runs with euid=0
|
||||
|
||||
cp = --- # disable applet cp for everyone
|
||||
|
||||
The file has to be owned by user root, group root and has to be
|
||||
writeable only by root:
|
||||
(chown 0.0 /etc/busybox.conf; chmod 600 /etc/busybox.conf)
|
||||
The busybox executable has to be owned by user root, group
|
||||
root and has to be setuid root for this to work:
|
||||
(chown 0.0 /bin/busybox; chmod 4755 /bin/busybox)
|
||||
|
||||
Robert 'sandman' Griebl has more information here:
|
||||
<url: http://www.softforge.de/bb/suid.html >.
|
||||
|
||||
config CONFIG_FEATURE_SUID_CONFIG_QUIET
|
||||
bool "Suppress warning message if /etc/busybox.conf is not readable"
|
||||
default y
|
||||
depends on CONFIG_FEATURE_SUID_CONFIG
|
||||
help
|
||||
/etc/busybox.conf should be readable by the user needing the SUID, check
|
||||
this option to avoid users to be notified about missing permissions.
|
||||
|
||||
config CONFIG_SELINUX
|
||||
bool "Support NSA Security Enhanced Linux"
|
||||
default n
|
||||
help
|
||||
Enable support for SELinux in applets ls, ps, and id. Also provide
|
||||
the option of compiling in SELinux applets.
|
||||
|
||||
If you do not have a complete SELinux userland installed, this stuff
|
||||
will not compile. Go visit
|
||||
http://www.nsa.gov/selinux/index.html
|
||||
to download the necessary stuff to allow busybox to compile with
|
||||
this option enabled. Specifially, libselinux 1.28 or better is
|
||||
directly required by busybox. If the installation is located in a
|
||||
non-standard directory, provide it by invoking make as follows:
|
||||
CFLAGS=-I<libselinux-include-path> \
|
||||
LDFLAGS=-L<libselinux-lib-path> \
|
||||
make
|
||||
|
||||
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'
|
||||
|
||||
config CONFIG_STATIC
|
||||
bool "Build BusyBox as a static binary (no shared libs)"
|
||||
default n
|
||||
help
|
||||
If you want to build a static BusyBox binary, which does not
|
||||
use or require any shared libraries, then enable this option.
|
||||
This can cause BusyBox to be considerably larger, so you should
|
||||
leave this option false unless you have a good reason (i.e.
|
||||
your target platform does not support shared libraries, or
|
||||
you are building an initrd which doesn't need anything but
|
||||
BusyBox, etc).
|
||||
|
||||
Most people will leave this set to 'N'.
|
||||
|
||||
config CONFIG_BUILD_LIBBUSYBOX
|
||||
bool "Build shared libbusybox"
|
||||
default n
|
||||
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
|
||||
depends on CONFIG_BUILD_LIBBUSYBOX
|
||||
help
|
||||
Build a libbusybox with the complete feature-set, disregarding
|
||||
the actually selected config.
|
||||
|
||||
Normally, libbusybox will only contain the features which are
|
||||
used by busybox itself. If you plan to write a separate
|
||||
standalone application which uses libbusybox say 'Y'.
|
||||
|
||||
Note: libbusybox is GPL, not LGPL, and exports no stable API that
|
||||
might act as a copyright barrier. We can and will modify the
|
||||
exported function set between releases (even minor version number
|
||||
changes), and happily break out-of-tree features.
|
||||
|
||||
Say 'N' if in doubt.
|
||||
|
||||
config CONFIG_FEATURE_SHARED_BUSYBOX
|
||||
bool "Use shared libbusybox for busybox"
|
||||
default y if CONFIG_BUILD_LIBBUSYBOX
|
||||
depends on !CONFIG_STATIC && CONFIG_BUILD_LIBBUSYBOX
|
||||
help
|
||||
Use libbusybox.so also for busybox itself.
|
||||
You need to have a working dynamic linker to use this variant.
|
||||
|
||||
config CONFIG_LFS
|
||||
bool "Build with Large File Support (for accessing files > 2 GB)"
|
||||
default n
|
||||
select FDISK_SUPPORT_LARGE_DISKS
|
||||
help
|
||||
If you want to build BusyBox with large file support, then enable
|
||||
this option. This will have no effect if your kernel or your C
|
||||
library lacks large file support for large files. Some of the
|
||||
programs that can benefit from large file support include dd, gzip,
|
||||
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 CONFIG_BUILD_AT_ONCE
|
||||
bool "Compile all sources at once"
|
||||
default n
|
||||
help
|
||||
Normally each source-file is compiled with one invocation of
|
||||
the compiler.
|
||||
If you set this option, all sources are compiled at once.
|
||||
This gives the compiler more opportunities to optimize which can
|
||||
result in smaller and/or faster binaries.
|
||||
|
||||
Setting this option will consume alot of memory, e.g. if you
|
||||
enable all applets with all features, gcc uses more than 300MB
|
||||
RAM during compilation of busybox.
|
||||
|
||||
This option is most likely only beneficial for newer compilers
|
||||
such as gcc-4.1 and above.
|
||||
|
||||
Say 'N' unless you know what you are doing.
|
||||
|
||||
endmenu
|
||||
|
||||
menu 'Debugging Options'
|
||||
|
||||
config CONFIG_DEBUG
|
||||
bool "Build BusyBox with extra Debugging symbols"
|
||||
default n
|
||||
help
|
||||
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
|
||||
depends on CONFIG_DEBUG
|
||||
help
|
||||
Using an additional debugging library will make BusyBox become
|
||||
considerable larger and will cause it to run more slowly. You
|
||||
should always leave this option disabled for production use.
|
||||
|
||||
dmalloc support:
|
||||
----------------
|
||||
This enables compiling with dmalloc ( http://dmalloc.com/ )
|
||||
which is an excellent public domain mem leak and malloc problem
|
||||
detector. To enable dmalloc, before running busybox you will
|
||||
want to properly set your environment, for example:
|
||||
export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile
|
||||
The 'debug=' value is generated using the following command
|
||||
dmalloc -p log-stats -p log-non-free -p log-bad-space -p log-elapsed-time \
|
||||
-p check-fence -p check-heap -p check-lists -p check-blank \
|
||||
-p check-funcs -p realloc-copy -p allow-free-null
|
||||
|
||||
Electric-fence support:
|
||||
-----------------------
|
||||
This enables compiling with Electric-fence support. Electric
|
||||
fence is another very useful malloc debugging library which uses
|
||||
your computer's virtual memory hardware to detect illegal memory
|
||||
accesses. This support will make BusyBox be considerable larger
|
||||
and run slower, so you should leave this option disabled unless
|
||||
you are hunting a hard to find memory problem.
|
||||
|
||||
|
||||
config CONFIG_NO_DEBUG_LIB
|
||||
bool "None"
|
||||
|
||||
config CONFIG_DMALLOC
|
||||
bool "Dmalloc"
|
||||
|
||||
config CONFIG_EFENCE
|
||||
bool "Electric-fence"
|
||||
|
||||
endchoice
|
||||
|
||||
config CONFIG_DEBUG_YANK_SUSv2
|
||||
bool "Disable obsolete features removed before SUSv3?"
|
||||
default y
|
||||
help
|
||||
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.)
|
||||
|
||||
endmenu
|
||||
|
||||
menu 'Installation Options'
|
||||
|
||||
config CONFIG_INSTALL_NO_USR
|
||||
bool "Don't use /usr"
|
||||
default n
|
||||
help
|
||||
Disable use of /usr. Don't activate this option if you don't know
|
||||
that you really want this behaviour.
|
||||
|
||||
choice
|
||||
prompt "Applets links"
|
||||
default CONFIG_INSTALL_APPLET_SYMLINKS
|
||||
help
|
||||
Choose how you install applets links.
|
||||
|
||||
config CONFIG_INSTALL_APPLET_SYMLINKS
|
||||
bool "as soft-links"
|
||||
help
|
||||
Install applets as soft-links to the busybox binary. This needs some
|
||||
free inodes on the filesystem, but might help with filesystem
|
||||
generators that can't cope with hard-links.
|
||||
|
||||
config CONFIG_INSTALL_APPLET_HARDLINKS
|
||||
bool "as hard-links"
|
||||
help
|
||||
Install applets as hard-links to the busybox binary. This might count
|
||||
on a filesystem with few inodes.
|
||||
|
||||
config CONFIG_INSTALL_APPLET_DONT
|
||||
bool
|
||||
prompt "not installed"
|
||||
depends on CONFIG_FEATURE_INSTALLER || CONFIG_FEATURE_SH_STANDALONE_SHELL
|
||||
help
|
||||
Do not install applets links. Usefull when using the -install feature
|
||||
or a standalone shell for rescue pruposes.
|
||||
|
||||
endchoice
|
||||
|
||||
config PREFIX
|
||||
string "BusyBox installation prefix"
|
||||
default "./_install"
|
||||
help
|
||||
Define your directory to install BusyBox files/subdirs in.
|
||||
|
||||
endmenu
|
||||
|
||||
source libbb/Config.in
|
||||
|
||||
endmenu
|
||||
|
||||
comment "Applets"
|
||||
|
||||
source archival/Config.in
|
||||
source coreutils/Config.in
|
||||
source console-tools/Config.in
|
||||
source debianutils/Config.in
|
||||
source editors/Config.in
|
||||
source findutils/Config.in
|
||||
source init/Config.in
|
||||
source loginutils/Config.in
|
||||
source e2fsprogs/Config.in
|
||||
source modutils/Config.in
|
||||
source util-linux/Config.in
|
||||
source miscutils/Config.in
|
||||
source networking/Config.in
|
||||
source procps/Config.in
|
||||
source shell/Config.in
|
||||
source sysklogd/Config.in
|
||||
@@ -1,20 +1,123 @@
|
||||
1) Run 'make config' or 'make menuconfig' and select the
|
||||
functionality that you wish to enable.
|
||||
Building:
|
||||
=========
|
||||
|
||||
2) Run 'make dep'
|
||||
The BusyBox build process is similar to the Linux kernel build:
|
||||
|
||||
3) Check the Makefile for any Makefile setting you wish
|
||||
to adjust for your system (things like like setting
|
||||
your cross compiler, adjusting optimizations, etc)
|
||||
make menuconfig # This creates a file called ".config"
|
||||
make # This creates the "busybox" executable
|
||||
make install # or make PREFIX=/path/from/root install
|
||||
|
||||
4) Run 'make'
|
||||
The full list of configuration and install options is available by typing:
|
||||
|
||||
5) Go get a drink of water, drink a soda, visit the bathroom,
|
||||
or whatever while it compiles. It doesn't take very
|
||||
long to compile, so you don't really need to waste too
|
||||
much time waiting...
|
||||
make help
|
||||
|
||||
6) Run 'make install' or 'make PREFIX=/target install' to
|
||||
install busybox and all the needed links. Some people
|
||||
will prefer to install using hardlinks and will instead
|
||||
want to run 'make install-hardlinks'....
|
||||
Quick Start:
|
||||
============
|
||||
|
||||
The easy way to try out BusyBox for the first time, without having to install
|
||||
it, is to enable all features and then use "standalone shell" mode with a
|
||||
blank command $PATH.
|
||||
|
||||
To enable all features, use "make defconfig", which produces the largest
|
||||
general-purpose configuration. (It's allyesconfig minus debugging options,
|
||||
optional packaging choices, and a few special-purpose features requiring
|
||||
extra configuration to use.)
|
||||
|
||||
make defconfig
|
||||
make
|
||||
PATH= ./busybox ash
|
||||
|
||||
Standalone shell mode causes busybox's built-in command shell to run
|
||||
any built-in busybox applets directly, without looking for external
|
||||
programs by that name. Supplying an empty command path (as above) means
|
||||
the only commands busybox can find are the built-in ones.
|
||||
|
||||
(Note that the standalone shell currently requires /proc/self/exe to
|
||||
launch new applets.)
|
||||
|
||||
Configuring Busybox:
|
||||
====================
|
||||
|
||||
Busybox is optimized for size, but enabling the full set of functionality
|
||||
still results in a fairly large executable -- more than 1 megabyte when
|
||||
statically linked. To save space, busybox can be configured with only the
|
||||
set of applets needed for each environment. The minimal configuration, with
|
||||
all applets disabled, produces a 4k executable. (It's useless, but very small.)
|
||||
|
||||
The manual configurator "make menuconfig" modifies the existing configuration.
|
||||
(For systems without ncurses, try "make config" instead.) The two most
|
||||
interesting starting configurations are "make allnoconfig" (to start with
|
||||
everything disabled and add just what you need), and "make defconfig" (to
|
||||
start with everything enabled and remove what you don't need). If menuconfig
|
||||
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 allbareconfig" (enables all applets but disables all optional features),
|
||||
"make allyesconfig" (enables absolutely everything including debug features),
|
||||
and "make randconfig" (produce a random configuration).
|
||||
|
||||
Configuring BusyBox produces a file ".config", which can be saved for future
|
||||
use. Run "make oldconfig" to bring a .config file from an older version of
|
||||
busybox up to date.
|
||||
|
||||
Installing Busybox:
|
||||
===================
|
||||
|
||||
Busybox is a single executable that can behave like many different commands,
|
||||
and BusyBox uses the name it was invoked under to determine the desired
|
||||
behavior. (Try "mv busybox ls" and then "./ls -l".)
|
||||
|
||||
Installing busybox consists of creating symlinks (or hardlinks) to the busybox
|
||||
binary for each applet enabled in busybox, and making sure these symlinks are
|
||||
in the shell's command $PATH. Running "make install" creates these symlinks,
|
||||
or "make install-hardlinks" creates hardlinks instead (useful on systems with
|
||||
a limited number of inodes). This install process uses the file
|
||||
"busybox.links" (created by make), which contains the list of enabled applets
|
||||
and the path at which to install them.
|
||||
|
||||
Installing links to busybox is not always necessary. The special applet name
|
||||
"busybox" (or with any optional suffix, such as "busybox-static") uses the
|
||||
first argument to determine which applet to behave as, for example
|
||||
"./busybox cat LICENSE". (Running the busybox applet with no arguments gives
|
||||
a list of all enabled applets.) The standalone shell can also call busybox
|
||||
applets without links to busybox under other names in the filesystem. You can
|
||||
also configure a standaone install capability into the busybox base applet,
|
||||
and then install such links at runtime with one of "busybox --install" (for
|
||||
hardlinks) or "busybox --install -s" (for symlinks).
|
||||
|
||||
If you enabled the busybox shared library feature (libbusybox.so) and want
|
||||
to run tests without installing, set your LD_LIBRARY_PATH accordingly when
|
||||
running the executable:
|
||||
|
||||
LD_LIBRARY_PATH=`pwd` ./busybox
|
||||
|
||||
Building out-of-tree:
|
||||
=====================
|
||||
|
||||
By default, the BusyBox build puts its temporary files in the source tree.
|
||||
Building from a read-only source tree, or building multiple configurations from
|
||||
the same source directory, requires the ability to put the temporary files
|
||||
somewhere else.
|
||||
|
||||
To build out of tree, cd to an empty directory and configure busybox from there:
|
||||
|
||||
make -f /path/to/source/Makefile defconfig
|
||||
make
|
||||
make install
|
||||
|
||||
Alternately, use the O=$BUILDPATH option (with an absolute path) during the
|
||||
configuration step, as in:
|
||||
|
||||
make O=/some/empty/directory allyesconfig
|
||||
cd /some/empty/directory
|
||||
make
|
||||
make PREFIX=. install
|
||||
|
||||
More Information:
|
||||
=================
|
||||
|
||||
Se also the busybox FAQ, under the questions "How can I get started using
|
||||
BusyBox" and "How do I build a BusyBox-based system?" The BusyBox FAQ is
|
||||
available from http://www.busybox.net/FAQ.html or as the file
|
||||
docs/busybox.net/FAQ.html in this tarball.
|
||||
@@ -2,136 +2,353 @@
|
||||
#
|
||||
# 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, 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 \
|
||||
defconfig allyesconfig allnoconfig clean distclean \
|
||||
release tags
|
||||
# You shouldn't have to edit anything in this file for configuration
|
||||
# purposes, try "make help" or read http://busybox.net/FAQ.html.
|
||||
|
||||
ifndef TOPDIR
|
||||
TOPDIR=$(CURDIR)/
|
||||
endif
|
||||
.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)
|
||||
endif
|
||||
# toplevel directory of the object-tree
|
||||
ifndef top_builddir
|
||||
top_builddir=$(CURDIR)
|
||||
endif
|
||||
|
||||
srctree=$(top_srcdir)
|
||||
export srctree=$(top_srcdir)
|
||||
vpath %/Config.in $(srctree)
|
||||
|
||||
include $(top_builddir)/Rules.mak
|
||||
|
||||
DIRS:=applets archival archival/libunarchive coreutils console-tools \
|
||||
debianutils editors findutils init miscutils modutils networking \
|
||||
networking/libiproute networking/udhcp procps loginutils shell \
|
||||
sysklogd util-linux libpwdgrp coreutils/libcoreutils libbb
|
||||
sysklogd util-linux e2fsprogs libpwdgrp coreutils/libcoreutils libbb
|
||||
|
||||
SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS))
|
||||
|
||||
ifeq ($(strip $(CONFIG_SELINUX)),y)
|
||||
CFLAGS += -I/usr/include/selinux
|
||||
LIBRARIES += -lsecure
|
||||
endif
|
||||
# That's our default target when none is given on the command line
|
||||
_all:
|
||||
|
||||
CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in
|
||||
CONFIG_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig
|
||||
|
||||
ALL_DIRS:= $(DIRS) scripts/config
|
||||
ALL_MAKEFILES:=$(patsubst %,%/Makefile,$(ALL_DIRS))
|
||||
|
||||
ifeq ($(KBUILD_SRC),)
|
||||
CONFIG_CONFIG_IN = $(top_srcdir)/Config.in
|
||||
|
||||
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 BUILD_OUTPUT nevertheless to make sure that we create
|
||||
# Rules.mak and the toplevel Makefile, in case they don't exist.
|
||||
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
|
||||
|
||||
# That's our default target when none is given on the command line
|
||||
.PHONY: _all
|
||||
_all:
|
||||
ifneq ($(strip $(BUILD_VERBOSE)),)
|
||||
export BUILD_VERBOSE
|
||||
CHECK_VERBOSE := -v
|
||||
# ARFLAGS+=v
|
||||
endif
|
||||
|
||||
ifneq ($(KBUILD_OUTPUT),)
|
||||
ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
|
||||
# pull in settings early
|
||||
-include $(top_srcdir)/Rules.mak
|
||||
endif
|
||||
|
||||
# All object directories.
|
||||
OBJ_DIRS := $(DIRS)
|
||||
all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include)
|
||||
all_tree: $(all_tree)
|
||||
$(all_tree):
|
||||
@mkdir -p "$@"
|
||||
|
||||
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)),, \
|
||||
# Check that the output directory actually exists
|
||||
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
|
||||
$(MAKE) -C $(KBUILD_OUTPUT) \
|
||||
top_srcdir=$(CURDIR) \
|
||||
top_builddir=$(KBUILD_OUTPUT) \
|
||||
TOPDIR=$(KBUILD_OUTPUT) \
|
||||
KBUILD_SRC=$(CURDIR) \
|
||||
$(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) \
|
||||
BUILD_SRC=$(top_srcdir) \
|
||||
-f $(CURDIR)/Makefile $@
|
||||
|
||||
$(KBUILD_OUTPUT)/Rules.mak:
|
||||
$(BUILD_OUTPUT)/Rules.mak:
|
||||
@echo > $@
|
||||
@echo top_srcdir=$(CURDIR) >> $@
|
||||
@echo top_builddir=$(KBUILD_OUTPUT) >> $@
|
||||
@echo top_srcdir=$(top_srcdir) >> $@
|
||||
@echo top_builddir=$(BUILD_OUTPUT) >> $@
|
||||
@echo include $(top_srcdir)/Rules.mak >> $@
|
||||
|
||||
$(KBUILD_OUTPUT)/Makefile:
|
||||
$(BUILD_OUTPUT)/Makefile:
|
||||
@echo > $@
|
||||
@echo top_srcdir=$(CURDIR) >> $@
|
||||
@echo top_builddir=$(KBUILD_OUTPUT) >> $@
|
||||
@echo KBUILD_SRC='$$(top_srcdir)' >> $@
|
||||
@echo include '$$(KBUILD_SRC)'/Makefile >> $@
|
||||
@echo top_srcdir=$(top_srcdir) >> $@
|
||||
@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),)
|
||||
|
||||
# We only need a copy of the Makefile for the config targets and reuse
|
||||
# the rest from the source directory, i.e. we do not cp ALL_MAKEFILES.
|
||||
scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile
|
||||
cp $< $@
|
||||
|
||||
_all: all
|
||||
|
||||
ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
|
||||
help:
|
||||
@echo 'Cleaning:'
|
||||
@echo ' clean - delete temporary files created by build'
|
||||
@echo ' distclean - delete all non-source files (including .config)'
|
||||
@echo
|
||||
@echo 'Build:'
|
||||
@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'
|
||||
@echo ' allyesconfig - enable all symbols in .config (see defconfig)'
|
||||
@echo ' allbareconfig - enable all applets without any sub-features'
|
||||
@echo ' config - text based configurator (of last resort)'
|
||||
@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
|
||||
|
||||
|
||||
include $(top_srcdir)/Rules.mak
|
||||
|
||||
ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
|
||||
|
||||
# Default target if none was requested explicitly
|
||||
all: menuconfig
|
||||
|
||||
# warn if no configuration exists and we are asked to build a non-config target
|
||||
.config:
|
||||
@echo ""
|
||||
@echo "No $(top_builddir)/$@ found!"
|
||||
@echo "Please refer to 'make help', section Configuration."
|
||||
@echo ""
|
||||
@exit 1
|
||||
|
||||
# configuration
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
scripts/config/conf: scripts/config/Makefile
|
||||
$(Q)$(MAKE) -C scripts/config conf
|
||||
-@if [ ! -f .config ] ; then \
|
||||
touch .config; \
|
||||
fi
|
||||
|
||||
scripts/config/mconf: scripts/config/Makefile
|
||||
$(Q)$(MAKE) -C scripts/config ncurses conf mconf
|
||||
-@if [ ! -f .config ] ; then \
|
||||
touch .config; \
|
||||
fi
|
||||
|
||||
menuconfig: scripts/config/mconf
|
||||
@[ -f .config ] || $(MAKE) $(MAKEFLAGS) defconfig
|
||||
@./scripts/config/mconf $(CONFIG_CONFIG_IN)
|
||||
|
||||
config: scripts/config/conf
|
||||
@./scripts/config/conf $(CONFIG_CONFIG_IN)
|
||||
|
||||
oldconfig: scripts/config/conf
|
||||
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
|
||||
|
||||
randconfig: scripts/config/conf
|
||||
@./scripts/config/conf -r $(CONFIG_CONFIG_IN)
|
||||
|
||||
allyesconfig: scripts/config/conf
|
||||
@./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null
|
||||
@$(SED) -i -r -e "s/^(USING_CROSS_COMPILER)=.*/# \1 is not set/" .config
|
||||
@./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null
|
||||
|
||||
allnoconfig: scripts/config/conf
|
||||
@./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) > /dev/null
|
||||
@$(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) > /dev/null
|
||||
|
||||
|
||||
allbareconfig: scripts/config/conf
|
||||
@./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null
|
||||
@$(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
|
||||
@$(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) > /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)
|
||||
|
||||
all: busybox busybox.links doc
|
||||
|
||||
all_tree: $(ALL_MAKEFILES)
|
||||
|
||||
$(ALL_MAKEFILES): %/Makefile: $(top_srcdir)/%/Makefile
|
||||
d=`dirname $@`; [ -d "$$d" ] || mkdir -p "$$d"; cp $< $@
|
||||
|
||||
# In this section, we need .config
|
||||
-include $(top_builddir)/.config.cmd
|
||||
include $(patsubst %,%/Makefile.in, $(SRC_DIRS))
|
||||
|
||||
endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
|
||||
|
||||
-include $(top_builddir)/.config
|
||||
-include $(top_builddir)/.depend
|
||||
|
||||
busybox: $(ALL_MAKEFILES) .depend include/config.h $(libraries-y)
|
||||
$(CC) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group
|
||||
$(STRIPCMD) $@
|
||||
|
||||
busybox.links: $(top_srcdir)/applets/busybox.mkll include/config.h $(top_srcdir)/include/applets.h
|
||||
- $(SHELL) $^ >$@
|
||||
ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
|
||||
libraries-y:=
|
||||
# Which parts of the internal libs are requested?
|
||||
# Per default we only want what was actually selected.
|
||||
# -a denotes all while -y denotes the selected ones.
|
||||
ifeq ($(strip $(CONFIG_FEATURE_FULL_LIBBUSYBOX)),y)
|
||||
LIBRARY_DEFINE:=$(LIBRARY_DEFINE-a)
|
||||
LIBRARY_SRC :=$(LIBRARY_SRC-a)
|
||||
else # CONFIG_FEATURE_FULL_LIBBUSYBOX
|
||||
LIBRARY_DEFINE:=$(LIBRARY_DEFINE-y)
|
||||
LIBRARY_SRC :=$(LIBRARY_SRC-y)
|
||||
endif # CONFIG_FEATURE_FULL_LIBBUSYBOX
|
||||
APPLET_SRC:=$(APPLET_SRC-y)
|
||||
APPLETS_DEFINE:=$(APPLETS_DEFINE-y)
|
||||
else # CONFIG_BUILD_AT_ONCE
|
||||
# no --combine, build archives out of the individual .o
|
||||
# This was the old way the binary was built.
|
||||
libbusybox-obj:=archival/libunarchive/libunarchive.a \
|
||||
networking/libiproute/libiproute.a \
|
||||
libpwdgrp/libpwdgrp.a \
|
||||
coreutils/libcoreutils/libcoreutils.a \
|
||||
libbb/libbb.a
|
||||
libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj))
|
||||
|
||||
install: applets/install.sh busybox busybox.links
|
||||
$(SHELL) $< $(PREFIX)
|
||||
ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
|
||||
# linking against libbusybox, so don't build the .a already contained in the .so
|
||||
libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y))
|
||||
endif # CONFIG_FEATURE_SHARED_BUSYBOX
|
||||
endif # CONFIG_BUILD_AT_ONCE
|
||||
|
||||
|
||||
ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
|
||||
LD_LIBBUSYBOX:=libbusybox.so
|
||||
LIBBUSYBOX_SONAME:=$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)
|
||||
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)
|
||||
# --combine but not linking against libbusybox, so compile all
|
||||
BUSYBOX_SRC := $(LIBRARY_SRC)
|
||||
BUSYBOX_DEFINE:= $(LIBRARY_DEFINE)
|
||||
endif # !CONFIG_FEATURE_SHARED_BUSYBOX
|
||||
$(LIBBUSYBOX_SONAME): $(LIBRARY_SRC)
|
||||
else # CONFIG_BUILD_AT_ONCE
|
||||
$(LIBBUSYBOX_SONAME): $(libbusybox-obj)
|
||||
endif # CONFIG_BUILD_AT_ONCE
|
||||
|
||||
ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
|
||||
LDBUSYBOX:=-L$(top_builddir) -lbusybox
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
|
||||
$(LIBBUSYBOX_SONAME):
|
||||
ifndef MAJOR_VERSION
|
||||
$(error MAJOR_VERSION needed for $@ is not defined)
|
||||
endif
|
||||
$(do_link.so) \
|
||||
-Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
|
||||
-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) $(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) $^ >$@
|
||||
|
||||
install: $(top_srcdir)/applets/install.sh busybox busybox.links
|
||||
$(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
|
||||
$(SHELL) $< $(PREFIX) $(INSTALL_OPTS)
|
||||
ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
|
||||
@echo
|
||||
@echo
|
||||
@@ -146,170 +363,162 @@ endif
|
||||
uninstall: busybox.links
|
||||
rm -f $(PREFIX)/bin/busybox
|
||||
for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
|
||||
ifneq ($(strip $(DO_INSTALL_LIBS)),n)
|
||||
for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \
|
||||
rm -f $(PREFIX)$$i; \
|
||||
done
|
||||
endif
|
||||
|
||||
install-hardlinks: applets/install.sh busybox busybox.links
|
||||
$(SHELL) $< $(PREFIX) --hardlinks
|
||||
check test: busybox
|
||||
bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite SED="$(SED)" \
|
||||
$(SHELL) $(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE)
|
||||
|
||||
check: busybox
|
||||
bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \
|
||||
$(top_srcdir)/testsuite/runtest
|
||||
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
|
||||
|
||||
docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod
|
||||
-mkdir -p docs
|
||||
- ( cat $(top_srcdir)/docs/busybox_header.pod; \
|
||||
$(top_srcdir)/docs/autodocifier.pl $(top_srcdir)/include/usage.h; \
|
||||
cat $(top_srcdir)/docs/busybox_footer.pod ) > docs/busybox.pod
|
||||
docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod $(top_srcdir)/docs/autodocifier.pl
|
||||
$(disp_doc)
|
||||
$(Q)-mkdir -p docs
|
||||
$(Q)-( cat $(top_srcdir)/docs/busybox_header.pod ; \
|
||||
$(top_srcdir)/docs/autodocifier.pl $(top_srcdir)/include/usage.h ; \
|
||||
cat $(top_srcdir)/docs/busybox_footer.pod ; ) > docs/busybox.pod
|
||||
|
||||
docs/BusyBox.txt: docs/busybox.pod
|
||||
@echo
|
||||
@echo BusyBox Documentation
|
||||
@echo
|
||||
-mkdir -p docs
|
||||
-pod2text $< > $@
|
||||
$(disp_doc)
|
||||
$(Q)-mkdir -p docs
|
||||
$(Q)-pod2text $< > $@
|
||||
|
||||
docs/BusyBox.1: docs/busybox.pod
|
||||
- mkdir -p docs
|
||||
- pod2man --center=BusyBox --release="version $(VERSION)" \
|
||||
$(disp_doc)
|
||||
$(Q)-mkdir -p docs
|
||||
$(Q)-pod2man --center=BusyBox --release="version $(VERSION)" \
|
||||
$< > $@
|
||||
|
||||
docs/BusyBox.html: docs/busybox.net/BusyBox.html
|
||||
- mkdir -p docs
|
||||
-@ rm -f docs/BusyBox.html
|
||||
-@ cp docs/busybox.net/BusyBox.html docs/BusyBox.html
|
||||
$(disp_doc)
|
||||
$(Q)-mkdir -p docs
|
||||
$(Q)-rm -f docs/BusyBox.html
|
||||
$(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
|
||||
|
||||
docs/busybox.net/BusyBox.html: docs/busybox.pod
|
||||
-@ mkdir -p docs/busybox.net
|
||||
- pod2html --noindex $< > \
|
||||
$(Q)-mkdir -p docs/busybox.net
|
||||
$(Q)-pod2html --noindex $< > \
|
||||
docs/busybox.net/BusyBox.html
|
||||
-@ rm -f pod2htm*
|
||||
$(Q)-rm -f pod2htm*
|
||||
|
||||
# The nifty new buildsystem stuff
|
||||
scripts/mkdep: $(top_srcdir)/scripts/mkdep.c
|
||||
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
|
||||
# The nifty new dependency stuff
|
||||
scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c
|
||||
$(do_link.h)
|
||||
|
||||
scripts/split-include: $(top_srcdir)/scripts/split-include.c
|
||||
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
|
||||
DEP_INCLUDES := include/bb_config.h
|
||||
|
||||
.depend: scripts/mkdep
|
||||
rm -f .depend .hdepend;
|
||||
mkdir -p include/config;
|
||||
scripts/mkdep -I include -- \
|
||||
`find $(top_srcdir) -name \*.c -print | sed -e "s,^./,,"` >> .depend;
|
||||
scripts/mkdep -I include -- \
|
||||
`find $(top_srcdir) -name \*.h -print | sed -e "s,^./,,"` >> .hdepend;
|
||||
ifeq ($(strip $(CONFIG_BBCONFIG)),y)
|
||||
DEP_INCLUDES += include/bbconfigopts.h
|
||||
|
||||
depend dep: include/config.h .depend
|
||||
include/bbconfigopts.h: .config $(top_srcdir)/scripts/config/mkconfigs
|
||||
$(disp_gen)
|
||||
$(Q)$(top_srcdir)/scripts/config/mkconfigs > $@
|
||||
endif
|
||||
|
||||
include/config/MARKER: depend scripts/split-include
|
||||
scripts/split-include include/config.h include/config
|
||||
@ touch include/config/MARKER
|
||||
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)
|
||||
|
||||
include/config.h: .config
|
||||
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 $(USAGE_BIN) $(DEP_INCLUDES)
|
||||
$(disp_gen)
|
||||
$(Q)rm -f .depend
|
||||
$(Q)mkdir -p include/config
|
||||
$(Q)scripts/bb_mkdep -I $(top_srcdir)/include $(top_srcdir) > $@.tmp
|
||||
$(Q)mv $@.tmp $@
|
||||
|
||||
include/bb_config.h: .config
|
||||
@if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \
|
||||
$(MAKE) -C scripts/config conf; \
|
||||
fi;
|
||||
@$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN)
|
||||
|
||||
finished2:
|
||||
@echo
|
||||
@echo Finished installing...
|
||||
@echo
|
||||
|
||||
else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
|
||||
|
||||
all: menuconfig
|
||||
|
||||
# configuration
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
$(ALL_MAKEFILES): %/Makefile: $(top_srcdir)/%/Makefile
|
||||
d=`dirname $@`; [ -d "$$d" ] || mkdir -p "$$d"; cp $< $@
|
||||
|
||||
scripts/config/conf: scripts/config/Makefile Rules.mak
|
||||
$(MAKE) -C scripts/config conf
|
||||
-@if [ ! -f .config ] ; then \
|
||||
cp $(CONFIG_DEFCONFIG) .config; \
|
||||
fi
|
||||
|
||||
scripts/config/mconf: scripts/config/Makefile Rules.mak
|
||||
$(MAKE) -C scripts/config ncurses conf mconf
|
||||
-@if [ ! -f .config ] ; then \
|
||||
cp $(CONFIG_DEFCONFIG) .config; \
|
||||
fi
|
||||
|
||||
menuconfig: scripts/config/mconf
|
||||
@./scripts/config/mconf $(CONFIG_CONFIG_IN)
|
||||
|
||||
config: scripts/config/conf
|
||||
@./scripts/config/conf $(CONFIG_CONFIG_IN)
|
||||
|
||||
oldconfig: scripts/config/conf
|
||||
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
|
||||
|
||||
randconfig: scripts/config/conf
|
||||
@./scripts/config/conf -r $(CONFIG_CONFIG_IN)
|
||||
|
||||
allyesconfig: scripts/config/conf
|
||||
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
|
||||
sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
|
||||
sed -i -e "s/^USING_CROSS_COMPILER.*/# USING_CROSS_COMPILER is not set/" .config
|
||||
sed -i -e "s/^CONFIG_STATIC.*/# CONFIG_STATIC is not set/" .config
|
||||
sed -i -e "s/^CONFIG_SELINUX.*/# CONFIG_SELINUX is not set/" .config
|
||||
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
|
||||
|
||||
allnoconfig: scripts/config/conf
|
||||
@./scripts/config/conf -n $(CONFIG_CONFIG_IN)
|
||||
|
||||
defconfig: scripts/config/conf
|
||||
@./scripts/config/conf -d $(CONFIG_CONFIG_IN)
|
||||
|
||||
clean:
|
||||
- $(MAKE) -C scripts/config $@
|
||||
- rm -f docs/busybox.dvi docs/busybox.ps \
|
||||
docs/busybox.pod docs/busybox.net/busybox.html \
|
||||
docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
|
||||
docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
|
||||
docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \
|
||||
.config.old .hdepend busybox
|
||||
- rm -rf _install
|
||||
- find . -name .\*.flags -exec rm -f {} \;
|
||||
- find . -name \*.o -exec rm -f {} \;
|
||||
- find . -name \*.a -exec rm -f {} \;
|
||||
docs/busybox.net/BusyBox.html busybox.links \
|
||||
libbusybox.so* \
|
||||
.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 -o -name \*.syn \
|
||||
-o -name \*.os -o -name \*.osm -o -name \*.a | xargs rm -f
|
||||
|
||||
distclean: clean
|
||||
- rm -f scripts/split-include scripts/mkdep
|
||||
- rm -rf include/config include/config.h
|
||||
- find . -name .depend -exec 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
|
||||
rm -f .hdepend
|
||||
rm -f .config .config.old .config.cmd
|
||||
- $(MAKE) -C scripts/config clean
|
||||
|
||||
release: distclean #doc
|
||||
cd ..; \
|
||||
rm -rf $(PROG)-$(VERSION); \
|
||||
cp -a busybox $(PROG)-$(VERSION); \
|
||||
\
|
||||
find $(PROG)-$(VERSION)/ -type d \
|
||||
-name CVS \
|
||||
-print \
|
||||
-exec rm -rf {} \; ; \
|
||||
\
|
||||
find $(PROG)-$(VERSION)/ -type f \
|
||||
-name .\#* \
|
||||
-print \
|
||||
-exec rm -f {} \; ; \
|
||||
\
|
||||
cd ..; \
|
||||
rm -r -f $(PROG)-$(VERSION); \
|
||||
cp -a busybox $(PROG)-$(VERSION); \
|
||||
\
|
||||
find $(PROG)-$(VERSION)/ -type d \
|
||||
-name .svn \
|
||||
-print \
|
||||
-exec rm -r -f {} \; ; \
|
||||
\
|
||||
find $(PROG)-$(VERSION)/ -type f \
|
||||
-name .\#* \
|
||||
-print \
|
||||
-exec rm -f {} \; ; \
|
||||
\
|
||||
tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
|
||||
|
||||
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 ($(strip $(HAVE_DOT_CONFIG)),y)
|
||||
|
||||
endif # ifeq ($(skip-makefile),)
|
||||
|
||||
.PHONY: dummy subdirs release distclean clean config oldconfig \
|
||||
menuconfig tags check test depend buildtree
|
||||
|
||||
@@ -1,127 +1,198 @@
|
||||
Please see the LICENSE file for details on copying and usage.
|
||||
Please refer to the INSTALL file for instructions on how to build.
|
||||
|
||||
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 GNU coreutils, util-linux, etc. The utilities in BusyBox
|
||||
generally have fewer options than their full-featured GNU cousins; however, the
|
||||
options that are included provide the expected functionality and behave very
|
||||
much like their GNU counterparts.
|
||||
What is busybox:
|
||||
|
||||
BusyBox has been written with size-optimization and limited resources in mind.
|
||||
It is also extremely modular so you can easily include or exclude commands (or
|
||||
features) at compile time. This makes it easy to customize your embedded
|
||||
systems. To create a working system, just add /dev, /etc, and a Linux kernel.
|
||||
BusyBox provides a fairly complete POSIX environment for any small or embedded
|
||||
system.
|
||||
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, 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 is extremely configurable. This allows you to include only the
|
||||
components you need, thereby reducing binary size. Run 'make config' or
|
||||
'make menuconfig' to select the functionality that you wish to enable.
|
||||
BusyBox has been written with size-optimization and limited resources in
|
||||
mind, both to produce small binaries and to reduce run-time memory usage.
|
||||
Busybox is also extremely modular so you can easily include or exclude
|
||||
commands (or features) at compile time. This makes it easy to customize
|
||||
embedded systems; to create a working system, just add /dev, /etc, and a
|
||||
Linux kernel. Busybox (usually together with uClibc) has also been used as
|
||||
a component of "thin client" desktop systems, live-CD distributions, rescue
|
||||
disks, installers, and so on.
|
||||
|
||||
After the build is complete, a busybox.links file is generated. This is
|
||||
used by 'make install' to create symlinks to the BusyBox binary for all
|
||||
compiled in functions. By default, 'make install' will place the symlink
|
||||
forest into `pwd`/_install unless you have defined the PREFIX environment
|
||||
variable (i.e., 'make PREFIX=/tmp/foo install')
|
||||
|
||||
If you wish to install hard links, rather than symlinks, you can use
|
||||
'make PREFIX=/tmp/foo install-hardlinks' instead.
|
||||
BusyBox provides a fairly complete POSIX environment for any small system,
|
||||
both embedded environments and more full featured systems concerned about
|
||||
space. Busybox is slowly working towards implementing the full Single Unix
|
||||
Specification V3 (http://www.opengroup.org/onlinepubs/009695399/), but isn't
|
||||
there yet (and for size reasons will probably support at most UTF-8 for
|
||||
internationalization). We are also interested in passing the Linux Test
|
||||
Project (http://ltp.sourceforge.net).
|
||||
|
||||
----------------
|
||||
|
||||
Supported architectures:
|
||||
Using busybox:
|
||||
|
||||
BusyBox in general will build on any architecture supported by gcc.
|
||||
Kernel module loading for 2.2 and 2.4 Linux kernels is currently
|
||||
limited to ARM, CRIS, H8/300, x86, ia64, x86_64, m68k, MIPS, PowerPC,
|
||||
S390, SH3/4/5, Sparc, v850e, and x86_64 for 2.4.x kernels. For 2.6.x
|
||||
kernels, kernel module loading support should work on all architectures.
|
||||
BusyBox is extremely configurable. This allows you to include only the
|
||||
components and options you need, thereby reducing binary size. Run 'make
|
||||
config' or 'make menuconfig' to select the functionality that you wish to
|
||||
enable. (See 'make help' for more commands.)
|
||||
|
||||
The behavior of busybox is determined by the name it's called under: as
|
||||
"cp" it behaves like cp, as "sed" it behaves like sed, and so on. Called
|
||||
as "busybox" it takes the second argument as the name of the applet to
|
||||
run (I.E. "./busybox ls -l /proc").
|
||||
|
||||
Supported C Libraries:
|
||||
The "standalone shell" mode is an easy way to try out busybox; this is a
|
||||
command shell that calls the builtin applets without needing them to be
|
||||
installed in the path. (Note that this requires /proc to be mounted, if
|
||||
testing from a boot floppy or in a chroot environment.)
|
||||
|
||||
uClibc and glibc are supported. People have been looking at newlib and
|
||||
dietlibc, but they are currently considered unsupported, untested, or
|
||||
worse. Linux-libc5 is no longer supported -- you should probably use uClibc
|
||||
instead if you want a small C library.
|
||||
|
||||
Supported kernels:
|
||||
|
||||
Full functionality requires Linux 2.2.x or better. A large fraction of the
|
||||
code should run on just about anything. While the current code is fairly
|
||||
Linux specific, it should be fairly easy to port the majority of the code
|
||||
to support, say, FreeBSD or Solaris, or Mac OS X, or even Windows (if you
|
||||
are into that sort of thing).
|
||||
The build automatically generates a file "busybox.links", which is used by
|
||||
'make install' to create symlinks to the BusyBox binary for all compiled in
|
||||
commands. This uses the PREFIX environment variable to specify where to
|
||||
install, and installs hardlinks or symlinks depending on the configuration
|
||||
preferences. (You can also manually run the install script at
|
||||
"applets/install.sh").
|
||||
|
||||
----------------
|
||||
|
||||
Getting help:
|
||||
Downloading the current source code:
|
||||
|
||||
When you find you need help, you can check out the BusyBox mailing list
|
||||
archives at http://busybox.net/lists/busybox/ or even join
|
||||
the mailing list if you are interested.
|
||||
Source for the latest released version, as well as daily snapshots, can always
|
||||
be downloaded from
|
||||
|
||||
http://busybox.net/downloads/
|
||||
|
||||
You can browse the up to the minute source code and change history online.
|
||||
|
||||
http://www.busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/
|
||||
|
||||
Anonymous SVN access is available. For instructions, check out:
|
||||
|
||||
http://busybox.net/subversion.html
|
||||
|
||||
For those that are actively contributing and would like to check files in,
|
||||
see:
|
||||
|
||||
http://busybox.net/developer.html
|
||||
|
||||
The developers also have a bug and patch tracking system
|
||||
(http://bugs.busybox.net) although posting a bug/patch to the mailing list
|
||||
is generally a faster way of getting it fixed, and the complete archive of
|
||||
what happened is the subversion changelog.
|
||||
|
||||
----------------
|
||||
|
||||
Bugs:
|
||||
getting help:
|
||||
|
||||
If you find bugs, please submit a detailed bug report to the BusyBox mailing
|
||||
list at busybox@mail.busybox.net. A well-written bug report should include a
|
||||
transcript of a shell session that demonstrates the bad behavior and enables
|
||||
anyone else to duplicate the bug on their own machine. The following is such
|
||||
an example:
|
||||
when you find you need help, you can check out the busybox mailing list
|
||||
archives at http://busybox.net/lists/busybox/ or even join
|
||||
the mailing list if you are interested.
|
||||
|
||||
To: busybox@mail.busybox.net
|
||||
From: diligent@testing.linux.org
|
||||
Subject: /bin/date doesn't work
|
||||
----------------
|
||||
|
||||
Package: BusyBox
|
||||
Version: 1.00
|
||||
bugs:
|
||||
|
||||
When I execute BusyBox 'date' it produces unexpected results.
|
||||
With GNU date I get the following output:
|
||||
if you find bugs, please submit a detailed bug report to the busybox mailing
|
||||
list at busybox@busybox.net. a well-written bug report should include a
|
||||
transcript of a shell session that demonstrates the bad behavior and enables
|
||||
anyone else to duplicate the bug on their own machine. the following is such
|
||||
an example:
|
||||
|
||||
to: busybox@busybox.net
|
||||
from: diligent@testing.linux.org
|
||||
subject: /bin/date doesn't work
|
||||
|
||||
package: busybox
|
||||
version: 1.00
|
||||
|
||||
when i execute busybox 'date' it produces unexpected results.
|
||||
with gnu date i get the following output:
|
||||
|
||||
$ date
|
||||
Fri Oct 8 14:19:41 MDT 2004
|
||||
fri oct 8 14:19:41 mdt 2004
|
||||
|
||||
But when I use BusyBox date I get this instead:
|
||||
but when i use busybox date i get this instead:
|
||||
|
||||
$ date
|
||||
illegal instruction
|
||||
|
||||
I am using Debian unstable, kernel version 2.4.25-vrs2 on a Netwinder,
|
||||
and the latest uClibc from CVS. Thanks for the wonderful program!
|
||||
i am using debian unstable, kernel version 2.4.25-vrs2 on a netwinder,
|
||||
and the latest uclibc from cvs. thanks for the wonderful program!
|
||||
|
||||
-Diligent
|
||||
-diligent
|
||||
|
||||
Note the careful description and use of examples showing not only what BusyBox
|
||||
does, but also a counter example showing what an equivalent GNU app does. Bug
|
||||
reports lacking such detail may never be fixed... Thanks for understanding.
|
||||
note the careful description and use of examples showing not only what
|
||||
busybox does, but also a counter example showing what an equivalent app
|
||||
does (or pointing to the text of a relevant standard). Bug reports lacking
|
||||
such detail may never be fixed... Thanks for understanding.
|
||||
|
||||
----------------
|
||||
|
||||
Downloads:
|
||||
Portability:
|
||||
|
||||
Source for the latest released version, as well as daily snapshots, can always
|
||||
be downloaded from
|
||||
http://busybox.net/downloads/
|
||||
Busybox is developed and tested on Linux 2.4 and 2.6 kernels, compiled
|
||||
with gcc (the unit-at-a-time optimizations in version 3.4 and later are
|
||||
worth upgrading to get, but older versions should work), and linked against
|
||||
uClibc (0.9.27 or greater) or glibc (2.2 or greater). In such an
|
||||
environment, the full set of busybox features should work, and if
|
||||
anything doesn't we want to know about it so we can fix it.
|
||||
|
||||
There are many other environments out there, in which busybox may build
|
||||
and run just fine. We just don't test them. Since busybox consists of a
|
||||
large number of more or less independent applets, portability is a question
|
||||
of which features work where. Some busybox applets (such as cat and rm) are
|
||||
highly portable and likely to work just about anywhere, while others (such as
|
||||
insmod and losetup) require recent Linux kernels with recent C libraries.
|
||||
|
||||
Earlier versions of Linux and glibc may or may not work, for any given
|
||||
configuration. Linux 2.2 or earlier should mostly work (there's still
|
||||
some support code in things like mount.c) but this is no longer regularly
|
||||
tested, and inherently won't support certain features (such as long files
|
||||
and --bind mounts). The same is true for glibc 2.0 and 2.1: expect a higher
|
||||
testing and debugging burden using such old infrastructure. (The busybox
|
||||
developers are not very interested in supporting these older versions, but
|
||||
will probably accept small self-contained patches to fix simple problems.)
|
||||
|
||||
Some environments are not recommended. Early versions of uClibc were buggy
|
||||
and missing many features: upgrade. Linking against libc5 or dietlibc is
|
||||
not supported and not interesting to the busybox developers. (The first is
|
||||
obsolete and has no known size or feature advantages over uClibc, the second
|
||||
has known bugs that its developers have actively refused to fix.) Ancient
|
||||
Linux kernels (2.0.x and earlier) are similarly uninteresting.
|
||||
|
||||
In theory it's possible to use Busybox under other operating systems (such as
|
||||
MacOS X, Solaris, Cygwin, or the BSD Fork Du Jour). This generally involves
|
||||
a different kernel and a different C library at the same time. While it
|
||||
should be possible to port the majority of the code to work in one of
|
||||
these environments, don't be suprised if it doesn't work out of the box. If
|
||||
you're into that sort of thing, start small (selecting just a few applets)
|
||||
and work your way up.
|
||||
|
||||
Shaun Jackman has recently (2005) ported busybox to a combination of newlib
|
||||
and libgloss, and some of his patches have been integrated. This platform
|
||||
may join glibc/uclibc and Linux as a supported combination with the 1.1
|
||||
release, but is not supported in 1.0.
|
||||
|
||||
Supported hardware:
|
||||
|
||||
BusyBox in general will build on any architecture supported by gcc. We
|
||||
support both 32 and 64 bit platforms, and both big and little endian
|
||||
systems.
|
||||
|
||||
Under 2.4 Linux kernels, kernel module loading was implemented in a
|
||||
platform-specific manner. Busybox's insmod utility has been reported to
|
||||
work under ARM, CRIS, H8/300, x86, ia64, x86_64, m68k, MIPS, PowerPC, S390,
|
||||
SH3/4/5, Sparc, v850e, and x86_64. Anything else probably won't work.
|
||||
|
||||
The module loading mechanism for the 2.6 kernel is much more generic, and
|
||||
we believe 2.6.x kernel module loading support should work on all
|
||||
architectures supported by the kernel.
|
||||
|
||||
----------------
|
||||
|
||||
CVS:
|
||||
|
||||
BusyBox now has its own publicly browsable CVS tree at:
|
||||
http://busybox.net/cgi-bin/cvsweb/busybox/
|
||||
|
||||
Anonymous CVS access is available. For instructions, check out:
|
||||
http://busybox.net/cvs_anon.html
|
||||
|
||||
For those that are actively contributing there is even CVS write access:
|
||||
http://busybox.net/cvs_write.html
|
||||
|
||||
----------------
|
||||
|
||||
Please feed suggestions, bug reports, insults, and bribes back to:
|
||||
Erik Andersen
|
||||
<andersen@codepoet.org>
|
||||
|
||||
Please feed suggestions, bug reports, insults, and bribes back to the busybox
|
||||
maintainer:
|
||||
Rob Landley
|
||||
<rob@landley.net>
|
||||
@@ -1,25 +1,22 @@
|
||||
# Rules.make for busybox
|
||||
#
|
||||
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||
# Copyright (C) 1999-2005 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, see the file LICENSE in this tarball for details.
|
||||
#
|
||||
|
||||
# Pull in the user's busybox configuration
|
||||
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
|
||||
-include $(top_builddir)/.config
|
||||
endif
|
||||
|
||||
#--------------------------------------------------------
|
||||
PROG := busybox
|
||||
VERSION := 1.00
|
||||
MAJOR_VERSION :=1
|
||||
MINOR_VERSION :=2
|
||||
SUBLEVEL_VERSION:=1
|
||||
EXTRAVERSION :=
|
||||
VERSION :=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)$(EXTRAVERSION)
|
||||
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
|
||||
|
||||
|
||||
@@ -27,66 +24,49 @@ 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- BB_SRC_DIR=$HOME/busybox PREFIX=/mnt/app
|
||||
# make CROSS=powerpc-linux- top_srcdir="$HOME/busybox" PREFIX=/mnt/app
|
||||
#--------------------------------------------------------
|
||||
|
||||
# If you are running a cross compiler, you will want to set 'CROSS'
|
||||
# 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)))
|
||||
CROSS =$(strip $(subst ",, $(strip $(CROSS_COMPILER_PREFIX))))
|
||||
# be gentle to vi coloring.. "))
|
||||
CC = $(CROSS)gcc
|
||||
AR = $(CROSS)ar
|
||||
AS = $(CROSS)as
|
||||
LD = $(CROSS)ld
|
||||
NM = $(CROSS)nm
|
||||
STRIP = $(CROSS)strip
|
||||
ELF2FLT = $(CROSS)elf2flt
|
||||
CPP = $(CC) -E
|
||||
# MAKEFILES = $(top_builddir)/.config
|
||||
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)))
|
||||
# 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
|
||||
|
||||
# If you have a "pristine" source directory, point BB_SRC_DIR to it.
|
||||
# Experimental and incomplete; tell the mailing list
|
||||
# <busybox@busybox.net> if you do or don't like it so far.
|
||||
BB_SRC_DIR=
|
||||
|
||||
# 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)
|
||||
#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)
|
||||
ARFLAGS=-r
|
||||
# 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 TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
|
||||
export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS 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,14 +80,106 @@ TARGET_ARCH=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
|
||||
)
|
||||
endif
|
||||
|
||||
# Pull in the user's busybox configuration
|
||||
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
|
||||
-include $(top_builddir)/.config
|
||||
# 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 nifty macro to make testing gcc features easier
|
||||
check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
|
||||
then echo "$(1)"; else echo "$(2)"; fi)
|
||||
# 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 \
|
||||
$(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)
|
||||
|
||||
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,$(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)
|
||||
|
||||
# Preemptively pin this too.
|
||||
PROG_CFLAGS:=
|
||||
|
||||
|
||||
#--------------------------------------------------------
|
||||
# Arch specific compiler optimization stuff should go here.
|
||||
@@ -115,20 +187,53 @@ check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1;
|
||||
# for OPTIMIZATION...
|
||||
|
||||
# use '-Os' optimization if available, else use -O2
|
||||
OPTIMIZATION=
|
||||
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_cc,$(CC),--combine,)
|
||||
endif
|
||||
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
|
||||
# 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,$(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
|
||||
ifeq ($(strip $(TARGET_ARCH)),arm)
|
||||
OPTIMIZATION+=-fstrict-aliasing
|
||||
endif
|
||||
ifeq ($(strip $(TARGET_ARCH)),i386)
|
||||
OPTIMIZATION+=$(call check_gcc,-march=i386,)
|
||||
OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
|
||||
OPTIMIZATION+=$(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,\
|
||||
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_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_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_cc,$(CC),-fno-branch-count-reg,)
|
||||
endif # gcc-4.1 and beyond
|
||||
endif
|
||||
OPTIMIZATIONS=$(OPTIMIZATION) -fomit-frame-pointer
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-fomit-frame-pointer,)
|
||||
OPTIMIZATION+=$(call check_cc,$(CC),-ffunction-sections -fdata-sections,)
|
||||
|
||||
#
|
||||
#--------------------------------------------------------
|
||||
@@ -152,45 +257,171 @@ else
|
||||
LIBRARIES:=-lefence
|
||||
endif
|
||||
endif
|
||||
|
||||
# Debugging info
|
||||
|
||||
ifeq ($(strip $(CONFIG_DEBUG)),y)
|
||||
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
|
||||
LDFLAGS +=-Wl,-warn-common
|
||||
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
|
||||
CFLAGS +=-g
|
||||
else
|
||||
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
|
||||
LDFLAGS += -s -Wl,-warn-common
|
||||
STRIPCMD:=$(STRIP) --remove-section=.note --remove-section=.comment
|
||||
CFLAGS +=-DNDEBUG
|
||||
CHECKED_LDFLAGS += $(call check_ld,$(LD),--sort-common,)
|
||||
CHECKED_LDFLAGS += $(call check_ld,--gc-sections,)
|
||||
endif
|
||||
|
||||
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)
|
||||
LDFLAGS += --static
|
||||
PROG_CFLAGS += $(call check_cc,$(CC),-static,)
|
||||
endif
|
||||
CFLAGS_SHARED := $(call check_cc,$(CC),-shared,)
|
||||
LIB_CFLAGS+=$(CFLAGS_SHARED)
|
||||
|
||||
ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
|
||||
CFLAGS_PIC:= $(call check_cc,$(CC),-fPIC,)
|
||||
LIB_CFLAGS+=$(CFLAGS_PIC)
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CONFIG_SELINUX)),y)
|
||||
LIBRARIES += -lselinux
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(PREFIX)),)
|
||||
PREFIX:=`pwd`/_install
|
||||
endif
|
||||
|
||||
# Additional complications due to support for pristine source dir.
|
||||
# Include files in the build directory should take precedence over
|
||||
# the copy in BB_SRC_DIR, both during the compilation phase and the
|
||||
# shell script that finds the list of object files.
|
||||
# Work in progress by <ldoolitt@recycle.lbl.gov>.
|
||||
#
|
||||
ifneq ($(strip $(BB_SRC_DIR)),)
|
||||
VPATH:=$(BB_SRC_DIR)
|
||||
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
|
||||
# shell script that finds the list of object files.
|
||||
# Work in progress by <ldoolitt@recycle.lbl.gov>.
|
||||
|
||||
|
||||
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
|
||||
ifeq ($(strip $(CONFIG_INSTALL_APPLET_HARDLINKS)),y)
|
||||
INSTALL_OPTS=--hardlinks
|
||||
endif
|
||||
ifeq ($(strip $(CONFIG_INSTALL_APPLET_SYMLINKS)),y)
|
||||
INSTALL_OPTS=--symlinks
|
||||
endif
|
||||
ifeq ($(strip $(CONFIG_INSTALL_APPLET_DONT)),y)
|
||||
INSTALL_OPTS=
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Make the output nice and tight
|
||||
MAKEFLAGS += --no-print-directory
|
||||
export MAKE_IS_SILENT=n
|
||||
ifneq ($(findstring s,$(MAKEFLAGS)),)
|
||||
export MAKE_IS_SILENT=y
|
||||
SECHO := @-false
|
||||
DISP := sil
|
||||
Q := @
|
||||
else
|
||||
ifneq ($(BUILD_VERBOSE),)
|
||||
SECHO := @-false
|
||||
DISP := ver
|
||||
Q :=
|
||||
else
|
||||
SECHO := @echo
|
||||
DISP := pur
|
||||
Q := @
|
||||
endif
|
||||
endif
|
||||
|
||||
show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@))
|
||||
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) $(INCS) -c -o $@ $<
|
||||
cmd_strip = $(STRIPCMD) $@
|
||||
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
|
||||
|
||||
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
@@ -1,11 +1,308 @@
|
||||
Busybox TODO
|
||||
|
||||
Stuff that needs to be done
|
||||
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:
|
||||
|
||||
----
|
||||
tr - missing SuS3 features in busybox 1.0pre10
|
||||
|
||||
tr doesnt support [:blank:], [:digit:] or other predefined classes, [=equiv=]
|
||||
support is also missing.
|
||||
find
|
||||
doesn't understand (), lots of susv3 stuff.
|
||||
----
|
||||
|
||||
diff
|
||||
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
|
||||
the file to be deleted with an empty file dated the Epoch. The
|
||||
file will be removed unless patch is conforming to POSIX and the
|
||||
-E or --remove-empty-files option is not given.
|
||||
---
|
||||
patch
|
||||
Should have simple fuzz factor support to apply patches at an offset which
|
||||
shouldn't take up too much space.
|
||||
|
||||
And while we're at it, a new patch filename quoting format is apparently
|
||||
coming soon: http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2
|
||||
---
|
||||
man
|
||||
It would be nice to have a man command. Not one that handles troff or
|
||||
anything, just one that can handle preformatted ascii man pages, possibly
|
||||
compressed. This could probably be a script in the extras directory that
|
||||
calls cat/zcat/bzcat | less
|
||||
|
||||
(How doclifter might work into this is anybody's guess.)
|
||||
---
|
||||
ar
|
||||
Write support?
|
||||
---
|
||||
crond
|
||||
turn FEATURE_DEBUG_OPT into ENABLE_FEATURE_CROND_DEBUG_OPT
|
||||
|
||||
Architectural issues:
|
||||
|
||||
bb_close() with fsync()
|
||||
We should have a bb_close() in place of normal close, with a CONFIG_ option
|
||||
to not just check the return value of close() for an error, but fsync().
|
||||
Close can't reliably report anything useful because if write() accepted the
|
||||
data then it either went out to the network or it's in cache or a pipe
|
||||
buffer. Either way, there's no guarantee it'll make it to its final
|
||||
destination before close() gets called, so there's no guarantee that any
|
||||
error will be reported.
|
||||
|
||||
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 archivers
|
||||
Lots of archivers have the same general infrastructure. The directory
|
||||
traversal code should be factored out, and the guts of each archiver could
|
||||
be some setup code and a series of callbacks for "add this file",
|
||||
"add this directory", "add this symlink" and so on.
|
||||
|
||||
This could clean up tar and zip, and make it cheaper to add cpio and ar
|
||||
write support, and possibly even cheaply add things like mkisofs or
|
||||
mksquashfs someday, if they become relevant.
|
||||
---
|
||||
Text buffer support.
|
||||
Several existing applets (sort, vi, less...) read
|
||||
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...
|
||||
---
|
||||
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 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
|
||||
free for an alloca()), and this means that various cleanup loops that just
|
||||
call free might also be optimized out by the compiler if written right, so
|
||||
we can yank those #ifdefs too, and generally clean up the code.
|
||||
---
|
||||
Switch CONFIG_SYMBOLS to ENABLE_SYMBOLS
|
||||
|
||||
In busybox 1.0 and earlier, configuration was done by CONFIG_SYMBOLS
|
||||
that were either defined or undefined to indicate whether the symbol was
|
||||
selected in the .config file. They were used with #ifdefs, ala:
|
||||
|
||||
#ifdef CONFIG_SYMBOL
|
||||
if (other_test) {
|
||||
do_code();
|
||||
}
|
||||
#endif
|
||||
|
||||
In 1.1, we have new ENABLE_SYMBOLS which are always defined (as 0 or 1),
|
||||
meaning you can still use them for preprocessor tests by replacing
|
||||
"#ifdef CONFIG_SYMBOL" with "#if ENABLE_SYMBOL". But more importantly, we
|
||||
can use them as a true or false test in normal C code:
|
||||
|
||||
if (ENABLE_SYMBOL && other_test) {
|
||||
do_code();
|
||||
}
|
||||
|
||||
(Optimizing away if() statements that resolve to a constant value
|
||||
is known as "dead code elimination", an optimization so old and simple that
|
||||
Turbo Pascal for DOS did it twenty years ago. Even modern mini-compilers
|
||||
like the Tiny C Compiler (tcc) and the Small Device C Compiler (SDCC)
|
||||
perform dead code elimination.)
|
||||
|
||||
Right now, busybox.h is #including both "config.h" (defining the
|
||||
CONFIG_SYMBOLS) and "bb_config.h" (defining the ENABLE_SYMBOLS). At some
|
||||
point in the future, it would be nice to wean ourselves off of the
|
||||
CONFIG versions. (Among other things, some defective build environments
|
||||
leak the Linux kernel's CONFIG_SYMBOLS into the system's standard #include
|
||||
files. We've experienced collisions before.)
|
||||
---
|
||||
FEATURE_CLEAN_UP
|
||||
This is more an unresolved issue than a to-do item. More thought is needed.
|
||||
|
||||
Normally we rely on exit() to free memory, close files, and unmap segments
|
||||
for us. This makes most calls to free(), close(), and unmap() optional in
|
||||
busybox applets that don't intend to run for very long, and optional stuff
|
||||
can be omitted to save size.
|
||||
|
||||
The idea was raised that we could simulate fork/exit with setjmp/longjmp
|
||||
for _really_ brainless embedded systems, or speed up the standalone shell
|
||||
by not forking. Doing so would require a reliable FEATURE_CLEAN_UP.
|
||||
Unfortunately, this isn't as easy as it sounds.
|
||||
|
||||
The problem is, lots of things exit(), sometimes unexpectedly (xmalloc())
|
||||
and sometimes reliably (bb_perror_msg_and_die() or show_usage()). This
|
||||
jumps out of the normal flow control and bypasses any cleanup code we
|
||||
put at the end of our applets.
|
||||
|
||||
It's possible to add hooks to libbb functions like xmalloc() and bb_xopen()
|
||||
to add their entries to a linked list, which could be traversed and
|
||||
freed/closed automatically. (This would need to be able to free just the
|
||||
entries after a checkpoint to be usable for a forkless standalone shell.
|
||||
You don't want to free the shell's own resources.)
|
||||
|
||||
Right now, FEATURE_CLEAN_UP is more or less a debugging aid, to make things
|
||||
like valgrind happy. It's also documentation of _what_ we're trusting
|
||||
exit() to clean up for us. But new infrastructure to auto-free stuff would
|
||||
render the existing FEATURE_CLEAN_UP code redundant.
|
||||
|
||||
For right now, exit() handles it just fine.
|
||||
|
||||
|
||||
|
||||
Minor stuff:
|
||||
watchdog.c could autodetect the timer duration via:
|
||||
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:
|
||||
|
||||
Replace deprecated functions.
|
||||
|
||||
bzero() -> memset()
|
||||
---
|
||||
sigblock(), siggetmask(), sigsetmask(), sigmask() -> sigprocmask et al
|
||||
---
|
||||
vdprintf() -> similar sized functionality
|
||||
---
|
||||
|
||||
+7
-16
@@ -1,27 +1,18 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# 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
|
||||
# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Licensed under the GPL v2, see the file LICENSE in this tarball.
|
||||
|
||||
ifndef top_srcdir
|
||||
top_srcdir=..
|
||||
endif
|
||||
ifndef top_builddir
|
||||
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)
|
||||
|
||||
+10
-21
@@ -1,21 +1,8 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# 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
|
||||
# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Licensed under the GPL v2, see the file LICENSE in this tarball.
|
||||
|
||||
APPLETS_AR:=applets.a
|
||||
ifndef $(APPLETS_DIR)
|
||||
@@ -23,15 +10,17 @@ APPLETS_DIR:=$(top_builddir)/applets/
|
||||
endif
|
||||
srcdir=$(top_srcdir)/applets
|
||||
|
||||
APPLET_SRC:=applets.c busybox.c
|
||||
APPLET_OBJ:= $(patsubst %.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
|
||||
APPLET_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c version.c)
|
||||
APPLET_OBJ:= $(patsubst $(srcdir)/%.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
|
||||
|
||||
APPLET_SRC-y+=$(APPLET_SRC)
|
||||
APPLET_SRC-a+=$(APPLET_SRC)
|
||||
|
||||
libraries-y+=$(APPLETS_DIR)$(APPLETS_AR)
|
||||
|
||||
$(APPLETS_DIR)$(APPLETS_AR): $(APPLET_OBJ)
|
||||
$(AR) -ro $@ $(APPLET_OBJ)
|
||||
$(do_ar)
|
||||
|
||||
$(APPLET_OBJ): $(top_builddir)/.config
|
||||
$(APPLET_OBJ): $(top_builddir)/.config
|
||||
$(APPLET_OBJ): $(APPLETS_DIR)%.o: $(srcdir)/%.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
$(compile.c)
|
||||
+174
-209
@@ -6,71 +6,49 @@
|
||||
* 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. */
|
||||
const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
|
||||
|
||||
|
||||
#ifdef CONFIG_FEATURE_SUID
|
||||
|
||||
static void check_suid (struct BB_applet *app);
|
||||
|
||||
#ifdef CONFIG_FEATURE_SUID_CONFIG
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
#include "pwd_.h"
|
||||
#include "grp_.h"
|
||||
|
||||
static void parse_config_file (void);
|
||||
|
||||
#define CONFIG_FILE "/etc/busybox.conf"
|
||||
|
||||
/* applets [] is const, so we have to define this "override" structure */
|
||||
struct BB_suid_config
|
||||
static struct BB_suid_config
|
||||
{
|
||||
struct BB_applet *m_applet;
|
||||
|
||||
@@ -79,105 +57,12 @@ struct BB_suid_config
|
||||
mode_t m_mode;
|
||||
|
||||
struct BB_suid_config *m_next;
|
||||
};
|
||||
} *suid_config;
|
||||
|
||||
static struct BB_suid_config *suid_config;
|
||||
static int suid_cfg_readable;
|
||||
|
||||
#endif /* CONFIG_FEATURE_SUID_CONFIG */
|
||||
|
||||
#endif /* CONFIG_FEATURE_SUID */
|
||||
|
||||
|
||||
|
||||
extern void
|
||||
bb_show_usage (void)
|
||||
{
|
||||
const char *format_string;
|
||||
const char *usage_string = usage_messages;
|
||||
int 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);
|
||||
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static int
|
||||
applet_name_compare (const void *x, const void *y)
|
||||
{
|
||||
const char *name = x;
|
||||
const struct BB_applet *applet = y;
|
||||
|
||||
return strcmp (name, applet->name);
|
||||
}
|
||||
|
||||
extern const size_t NUM_APPLETS;
|
||||
|
||||
struct BB_applet *
|
||||
find_applet_by_name (const char *name)
|
||||
{
|
||||
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)
|
||||
{
|
||||
static int recurse_level = 0;
|
||||
extern int been_there_done_that; /* From busybox.c */
|
||||
|
||||
#ifdef CONFIG_FEATURE_SUID_CONFIG
|
||||
if (recurse_level == 0)
|
||||
parse_config_file ();
|
||||
#endif
|
||||
|
||||
recurse_level++;
|
||||
/* Do a binary search to find the applet entry given the name. */
|
||||
if ((applet_using = find_applet_by_name (name)) != NULL) {
|
||||
bb_applet_name = applet_using->name;
|
||||
if (argv[1] && strcmp (argv[1], "--help") == 0) {
|
||||
if (strcmp (applet_using->name, "busybox") == 0) {
|
||||
if (argv[2])
|
||||
applet_using = find_applet_by_name (argv[2]);
|
||||
else
|
||||
applet_using = NULL;
|
||||
}
|
||||
if (applet_using)
|
||||
bb_show_usage ();
|
||||
been_there_done_that = 1;
|
||||
busybox_main (0, NULL);
|
||||
}
|
||||
#ifdef CONFIG_FEATURE_SUID
|
||||
check_suid (applet_using);
|
||||
#endif
|
||||
|
||||
exit ((*(applet_using->main)) (argc, argv));
|
||||
}
|
||||
/* Just in case they have renamed busybox - Check argv[1] */
|
||||
if (recurse_level == 1) {
|
||||
run_applet_by_name ("busybox", argc, argv);
|
||||
}
|
||||
recurse_level--;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_FEATURE_SUID
|
||||
|
||||
#ifdef CONFIG_FEATURE_SUID_CONFIG
|
||||
|
||||
/* check if u is member of group g */
|
||||
static int
|
||||
ingroup (uid_t u, gid_t g)
|
||||
static int ingroup (uid_t u, gid_t g)
|
||||
{
|
||||
struct group *grp = getgrgid (g);
|
||||
|
||||
@@ -194,76 +79,6 @@ ingroup (uid_t u, gid_t g)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
check_suid (struct BB_applet *applet)
|
||||
{
|
||||
uid_t ruid = getuid (); /* real [ug]id */
|
||||
uid_t rgid = getgid ();
|
||||
|
||||
#ifdef CONFIG_FEATURE_SUID_CONFIG
|
||||
if (suid_cfg_readable) {
|
||||
struct BB_suid_config *sct;
|
||||
|
||||
for (sct = suid_config; sct; sct = sct->m_next) {
|
||||
if (sct->m_applet == applet)
|
||||
break;
|
||||
}
|
||||
if (sct) {
|
||||
mode_t m = sct->m_mode;
|
||||
|
||||
if (sct->m_uid == ruid) /* same uid */
|
||||
m >>= 6;
|
||||
else if ((sct->m_gid == rgid) || ingroup (ruid, sct->m_gid)) /* same group / in group */
|
||||
m >>= 3;
|
||||
|
||||
if (!(m & S_IXOTH)) /* is x bit not set ? */
|
||||
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 */
|
||||
|
||||
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 */
|
||||
} else {
|
||||
/* default: drop all priviledges */
|
||||
setgid (rgid);
|
||||
setuid (ruid);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
#ifndef CONFIG_FEATURE_SUID_CONFIG_QUIET
|
||||
static int onetime = 0;
|
||||
|
||||
if (!onetime) {
|
||||
onetime = 1;
|
||||
fprintf (stderr, "Using fallback suid method\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (applet->need_suid == _BB_SUID_ALWAYS) {
|
||||
if (geteuid () != 0)
|
||||
bb_error_msg_and_die ("This applet requires root priviledges!");
|
||||
} else if (applet->need_suid == _BB_SUID_NEVER) {
|
||||
setgid (rgid); /* drop all priviledges */
|
||||
setuid (ruid);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FEATURE_SUID_CONFIG
|
||||
|
||||
/* This should probably be a libbb routine. In that case,
|
||||
* I'd probably rename it to something like bb_trimmed_slice.
|
||||
*/
|
||||
@@ -281,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -422,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;
|
||||
@@ -434,8 +249,8 @@ 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. */
|
||||
@@ -498,15 +313,165 @@ static void parse_config_file(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#else
|
||||
#define parse_config_file()
|
||||
#endif /* CONFIG_FEATURE_SUID_CONFIG */
|
||||
|
||||
#ifdef CONFIG_FEATURE_SUID
|
||||
static void check_suid (struct BB_applet *applet)
|
||||
{
|
||||
uid_t ruid = getuid (); /* real [ug]id */
|
||||
uid_t rgid = getgid ();
|
||||
|
||||
#ifdef CONFIG_FEATURE_SUID_CONFIG
|
||||
if (suid_cfg_readable) {
|
||||
struct BB_suid_config *sct;
|
||||
|
||||
for (sct = suid_config; sct; sct = sct->m_next) {
|
||||
if (sct->m_applet == applet)
|
||||
break;
|
||||
}
|
||||
if (sct) {
|
||||
mode_t m = sct->m_mode;
|
||||
|
||||
if (sct->m_uid == ruid) /* same uid */
|
||||
m >>= 6;
|
||||
else if ((sct->m_gid == rgid) || ingroup (ruid, sct->m_gid)) /* same group / in group */
|
||||
m >>= 3;
|
||||
|
||||
if (!(m & S_IXOTH)) /* is x bit not set ? */
|
||||
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 */
|
||||
xsetgid(sct->m_gid);
|
||||
} else xsetgid(rgid); /* no sgid -> drop */
|
||||
|
||||
if (sct->m_mode & S_ISUID) xsetuid(sct->m_uid);
|
||||
else xsetuid(ruid); /* no suid -> drop */
|
||||
} else {
|
||||
/* default: drop all privileges */
|
||||
xsetgid(rgid);
|
||||
xsetuid(ruid);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
#ifndef CONFIG_FEATURE_SUID_CONFIG_QUIET
|
||||
static int onetime = 0;
|
||||
|
||||
if (!onetime) {
|
||||
onetime = 1;
|
||||
fprintf (stderr, "Using fallback suid method\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
if (applet->need_suid == _BB_SUID_ALWAYS) {
|
||||
if (geteuid()) bb_error_msg_and_die("Applet requires root privileges!");
|
||||
} else if (applet->need_suid == _BB_SUID_NEVER) {
|
||||
xsetgid(rgid); /* drop all privileges */
|
||||
xsetuid(ruid);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define check_suid(x)
|
||||
#endif /* CONFIG_FEATURE_SUID */
|
||||
|
||||
/* END CODE */
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
|
||||
|
||||
#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)
|
||||
{
|
||||
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;
|
||||
|
||||
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 *name, const void *vapplet)
|
||||
{
|
||||
const struct BB_applet *applet = vapplet;
|
||||
|
||||
return strcmp(name, applet->name);
|
||||
}
|
||||
|
||||
extern const size_t NUM_APPLETS;
|
||||
|
||||
struct BB_applet *find_applet_by_name(const char *name)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (ENABLE_FEATURE_SUID_CONFIG) parse_config_file();
|
||||
|
||||
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) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
+52
-91
@@ -1,16 +1,22 @@
|
||||
/* 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"
|
||||
#ifdef CONFIG_LOCALE_SUPPORT
|
||||
#if ENABLE_LOCALE_SUPPORT
|
||||
#include <locale.h>
|
||||
#else
|
||||
#define setlocale(x,y)
|
||||
#endif
|
||||
|
||||
int been_there_done_that = 0; /* Also used in applets.c */
|
||||
const char *bb_applet_name;
|
||||
const char *bb_applet_name ATTRIBUTE_EXTERNALLY_VISIBLE;
|
||||
|
||||
#ifdef CONFIG_FEATURE_INSTALLER
|
||||
/*
|
||||
@@ -32,17 +38,6 @@ static const char* const install_dir[] = {
|
||||
/* abstract link() */
|
||||
typedef int (*__link_f)(const char *, const char *);
|
||||
|
||||
/*
|
||||
* Where in the filesystem is this busybox?
|
||||
* [return]
|
||||
* malloc'd string w/ full pathname of busybox's location
|
||||
* NULL on failure
|
||||
*/
|
||||
static inline char *busybox_fullpath(void)
|
||||
{
|
||||
return xreadlink("/proc/self/exe");
|
||||
}
|
||||
|
||||
/* create (sym)links for each applet */
|
||||
static void install_links(const char *busybox, int use_symbolic_links)
|
||||
{
|
||||
@@ -66,47 +61,35 @@ static void install_links(const char *busybox, int use_symbolic_links)
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#define install_links(x,y)
|
||||
#endif /* CONFIG_FEATURE_INSTALLER */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
bb_applet_name = argv[0];
|
||||
bb_applet_name=argv[0];
|
||||
if (*bb_applet_name == '-') bb_applet_name++;
|
||||
for (s = bb_applet_name; *s ;)
|
||||
if (*(s++) == '/') bb_applet_name = s;
|
||||
|
||||
if (bb_applet_name[0] == '-')
|
||||
bb_applet_name++;
|
||||
|
||||
for (s = bb_applet_name; *s != '\0';) {
|
||||
if (*s++ == '/')
|
||||
bb_applet_name = s;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LOCALE_SUPPORT
|
||||
#ifdef CONFIG_INIT
|
||||
if(getpid()!=1) /* Do not set locale for `init' */
|
||||
#endif
|
||||
{
|
||||
/* Set locale for everybody except `init' */
|
||||
if(ENABLE_LOCALE_SUPPORT && getpid() != 1)
|
||||
setlocale(LC_ALL, "");
|
||||
}
|
||||
#endif
|
||||
|
||||
run_applet_by_name(bb_applet_name, argc, argv);
|
||||
bb_error_msg_and_die("applet not found");
|
||||
}
|
||||
|
||||
|
||||
int busybox_main(int argc, char **argv)
|
||||
{
|
||||
int col = 0, len, i;
|
||||
|
||||
#ifdef CONFIG_FEATURE_INSTALLER
|
||||
/*
|
||||
* This style of argument parsing doesn't scale well
|
||||
* in the event that busybox starts wanting more --options.
|
||||
* If someone has a cleaner approach, by all means implement it.
|
||||
*/
|
||||
if (argc > 1 && (strcmp(argv[1], "--install") == 0)) {
|
||||
if (ENABLE_FEATURE_INSTALLER && argc > 1 && !strcmp(argv[1], "--install")) {
|
||||
int use_symbolic_links = 0;
|
||||
int rc = 0;
|
||||
char *busybox;
|
||||
@@ -119,7 +102,7 @@ int busybox_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* link */
|
||||
busybox = busybox_fullpath();
|
||||
busybox = xreadlink("/proc/self/exe");
|
||||
if (busybox) {
|
||||
install_links(busybox, use_symbolic_links);
|
||||
free(busybox);
|
||||
@@ -128,66 +111,44 @@ int busybox_main(int argc, char **argv)
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
#endif /* CONFIG_FEATURE_INSTALLER */
|
||||
|
||||
argc--;
|
||||
/* Deal with --help. (Also print help when called with no arguments) */
|
||||
|
||||
/* If we've already been here once, exit now */
|
||||
if (been_there_done_that == 1 || argc < 1) {
|
||||
const struct BB_applet *a = applets;
|
||||
int output_width = 60;
|
||||
if (argc==1 || !strcmp(argv[1],"--help") ) {
|
||||
if (argc>2) {
|
||||
run_applet_by_name(bb_applet_name=argv[2], 2, argv);
|
||||
} else {
|
||||
const struct BB_applet *a;
|
||||
int col, output_width;
|
||||
|
||||
#ifdef CONFIG_FEATURE_AUTOWIDTH
|
||||
/* Obtain the terminal width. */
|
||||
get_terminal_width_height(0, &output_width, NULL);
|
||||
/* leading tab and room to wrap */
|
||||
output_width -= 20;
|
||||
#endif
|
||||
if (ENABLE_FEATURE_AUTOWIDTH) {
|
||||
/* Obtain the terminal width. */
|
||||
get_terminal_width_height(0, &output_width, NULL);
|
||||
/* leading tab and room to wrap */
|
||||
output_width -= 20;
|
||||
} else output_width = 60;
|
||||
|
||||
fprintf(stderr, "%s\n\n"
|
||||
"Usage: busybox [function] [arguments]...\n"
|
||||
" or: [function] [arguments]...\n\n"
|
||||
"\tBusyBox is a multi-call binary that combines many common Unix\n"
|
||||
"\tutilities into a single executable. Most people will create a\n"
|
||||
"\tlink to busybox for each function they wish to use, and BusyBox\n"
|
||||
"\twill act like whatever it was invoked as.\n"
|
||||
"\nCurrently defined functions:\n", bb_msg_full_version);
|
||||
printf("%s\n\n"
|
||||
"Usage: busybox [function] [arguments]...\n"
|
||||
" or: [function] [arguments]...\n\n"
|
||||
"\tBusyBox is a multi-call binary that combines many common Unix\n"
|
||||
"\tutilities into a single executable. Most people will create a\n"
|
||||
"\tlink to busybox for each function they wish to use and BusyBox\n"
|
||||
"\twill act like whatever it was invoked as!\n"
|
||||
"\nCurrently defined functions:\n", bb_msg_full_version);
|
||||
|
||||
while (a->name != 0) {
|
||||
col +=
|
||||
fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "),
|
||||
(a++)->name);
|
||||
if (col > output_width && a->name != 0) {
|
||||
fprintf(stderr, ",\n");
|
||||
col = 0;
|
||||
col=0;
|
||||
for(a = applets; a->name;) {
|
||||
col += printf("%s%s", (col ? ", " : "\t"), (a++)->name);
|
||||
if (col > output_width && a->name) {
|
||||
printf(",\n");
|
||||
col = 0;
|
||||
}
|
||||
}
|
||||
printf("\n\n");
|
||||
exit(0);
|
||||
}
|
||||
fprintf(stderr, "\n\n");
|
||||
exit(0);
|
||||
}
|
||||
} else run_applet_by_name(argv[1], argc-1, argv+1);
|
||||
|
||||
/* Flag that we've been here already */
|
||||
been_there_done_that = 1;
|
||||
|
||||
/* Move the command line down a notch */
|
||||
/* Preserve pointers so setproctitle() works consistently */
|
||||
len = argv[argc] + strlen(argv[argc]) - argv[1];
|
||||
memmove(argv[0], argv[1], len);
|
||||
memset(argv[0] + len, 0, argv[1] - argv[0]);
|
||||
|
||||
/* Fix up the argv pointers */
|
||||
len = argv[1] - argv[0];
|
||||
memmove(argv, argv + 1, sizeof(char *) * (argc + 1));
|
||||
for (i = 0; i < argc; i++)
|
||||
argv[i] -= len;
|
||||
|
||||
return (main(argc, argv));
|
||||
bb_error_msg_and_die("applet not found");
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -10,9 +10,9 @@
|
||||
export LC_ALL=POSIX
|
||||
export LC_CTYPE=POSIX
|
||||
|
||||
CONFIG_H=${1:-include/config.h}
|
||||
CONFIG_H=${1:-include/bb_config.h}
|
||||
APPLETS_H=${2:-include/applets.h}
|
||||
gcc -E -DMAKE_LINKS -include $CONFIG_H $APPLETS_H |
|
||||
$HOSTCC -E -DMAKE_LINKS -include $CONFIG_H $APPLETS_H |
|
||||
awk '/^[ \t]*LINK/{
|
||||
dir=substr($2,8)
|
||||
gsub("_","/",dir)
|
||||
|
||||
+60
-18
@@ -3,18 +3,56 @@
|
||||
export LC_ALL=POSIX
|
||||
export LC_CTYPE=POSIX
|
||||
|
||||
prefix=$1
|
||||
if [ "$prefix" = "" ]; then
|
||||
echo "No installation directory, aborting."
|
||||
exit 1;
|
||||
fi
|
||||
if [ "$2" = "--hardlinks" ]; then
|
||||
linkopts="-f"
|
||||
else
|
||||
linkopts="-fs"
|
||||
prefix=${1}
|
||||
if [ -z "$prefix" ]; then
|
||||
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";;
|
||||
--cleanup) cleanup="1";;
|
||||
--noclobber) noclobber="1";;
|
||||
"") h="";;
|
||||
*) echo "Unknown install option: $2"; exit 1;;
|
||||
esac
|
||||
|
||||
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 | \
|
||||
sed -n 's%^.*\(/lib[^\/]*\)/libc.so%\1%p')
|
||||
if test -z "$libdir"; then
|
||||
libdir=/lib
|
||||
fi
|
||||
|
||||
mkdir -p $prefix/$libdir || exit 1
|
||||
for i in $DO_INSTALL_LIBS; do
|
||||
rm -f $prefix/$libdir/$i || exit 1
|
||||
if [ -f $i ]; then
|
||||
cp -a $i $prefix/$libdir/ || exit 1
|
||||
chmod 0644 $prefix/$libdir/$i || exit 1
|
||||
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
|
||||
@@ -24,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
|
||||
@@ -0,0 +1,17 @@
|
||||
/* 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
|
||||
#define BANNER "BusyBox v" BB_VER " (" BB_BT ")"
|
||||
#else
|
||||
#define BANNER "BusyBox v" BB_VER " (" BB_EXTRA_VERSION ")"
|
||||
#endif
|
||||
|
||||
const char BB_BANNER[]=BANNER;
|
||||
const char * const bb_msg_full_version = BANNER " multi-call binary";
|
||||
+65
-23
@@ -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
|
||||
@@ -47,10 +47,10 @@ config CONFIG_BUNZIP2
|
||||
is generally considerably better than that achieved by more
|
||||
conventional LZ77/LZ78-based compressors, and approaches the
|
||||
performance of the PPM family of statistical compressors.
|
||||
|
||||
|
||||
The BusyBox bunzip2 applet is limited to de-compression only.
|
||||
On an x86 system, this applet adds about 11K.
|
||||
|
||||
|
||||
Unless you have a specific application which requires bunzip2, you
|
||||
should probably say N here.
|
||||
|
||||
@@ -73,7 +73,7 @@ config CONFIG_DPKG
|
||||
default n
|
||||
help
|
||||
dpkg is a medium-level tool to install, build, remove and manage Debian packages.
|
||||
|
||||
|
||||
This implementation of dpkg has a number of limitations, you should use the
|
||||
official dpkg if possible.
|
||||
|
||||
@@ -82,14 +82,14 @@ config CONFIG_DPKG_DEB
|
||||
default n
|
||||
help
|
||||
dpkg-deb packs, unpacks and provides information about Debian archives.
|
||||
|
||||
|
||||
This implementation of dpkg-deb cannot pack archives.
|
||||
|
||||
|
||||
Unless you have a specific application which requires dpkg-deb, you should
|
||||
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,15 +150,23 @@ 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
|
||||
If you enable this option you'll be able to extract
|
||||
archives compressed with bzip2.
|
||||
|
||||
config CONFIG_FEATURE_TAR_LZMA
|
||||
bool "Enable -a option to handle .tar.lzma files"
|
||||
default n
|
||||
depends on CONFIG_TAR
|
||||
help
|
||||
If you enable this option you'll be able to extract
|
||||
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
|
||||
@@ -166,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
|
||||
@@ -174,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
|
||||
@@ -191,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
|
||||
@@ -199,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
|
||||
|
||||
@@ -212,6 +220,29 @@ config CONFIG_UNCOMPRESS
|
||||
uncompress is used to decompress archives created by compress.
|
||||
Not much used anymore, replaced by gzip/gunzip.
|
||||
|
||||
config CONFIG_UNLZMA
|
||||
bool "unlzma"
|
||||
default n
|
||||
help
|
||||
unlzma is a compression utility using the Lempel-Ziv-Markov chain
|
||||
compression algorithm, and range coding. Compression
|
||||
is generally considerably better than that achieved by the bzip2
|
||||
compressors.
|
||||
|
||||
The BusyBox unlzma applet is limited to de-compression only.
|
||||
On an x86 system, this applet adds about 4K.
|
||||
|
||||
Unless you have a specific application which requires unlzma, you
|
||||
should probably say N here.
|
||||
|
||||
config CONFIG_FEATURE_LZMA_FAST
|
||||
bool "Optimze unlzma for speed"
|
||||
default n
|
||||
depends on CONFIG_UNLZMA
|
||||
help
|
||||
This option reduces decompression time by about 33% at the cost of
|
||||
a 2K bigger binary.
|
||||
|
||||
config CONFIG_UNZIP
|
||||
bool "unzip"
|
||||
default n
|
||||
@@ -226,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
|
||||
@@ -236,23 +267,34 @@ 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
|
||||
This is the default compression method inside the debian ar file.
|
||||
|
||||
|
||||
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
|
||||
This allows dpkg and dpkg-deb to extract deb's that are compressed internally
|
||||
with bzip2 instead of gzip.
|
||||
|
||||
|
||||
You only want this if you are creating your own custom debian packages that
|
||||
use an internal control.tar.bz2 or data.tar.bz2.
|
||||
|
||||
config CONFIG_FEATURE_DEB_TAR_LZMA
|
||||
bool "lzma debian packages"
|
||||
default n
|
||||
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
|
||||
help
|
||||
This allows dpkg and dpkg-deb to extract deb's that are compressed
|
||||
internally with lzma instead of gzip.
|
||||
|
||||
You only want this if you are creating your own custom debian
|
||||
packages that use an internal control.tar.lzma or data.tar.lzma.
|
||||
|
||||
endmenu
|
||||
+7
-16
@@ -1,27 +1,18 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# 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
|
||||
# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Licensed under the GPL v2, see the file LICENSE in this tarball.
|
||||
|
||||
ifndef top_srcdir
|
||||
top_srcdir=..
|
||||
endif
|
||||
ifndef top_builddir
|
||||
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)
|
||||
|
||||
+12
-18
@@ -1,21 +1,8 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# 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
|
||||
# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Licensed under the GPL v2, see the file LICENSE in this tarball.
|
||||
|
||||
ARCHIVAL_AR:=archival.a
|
||||
ifndef $(ARCHIVAL_DIR)
|
||||
@@ -27,6 +14,7 @@ ARCHIVAL-y:=
|
||||
ARCHIVAL-$(CONFIG_APT_GET) +=
|
||||
ARCHIVAL-$(CONFIG_AR) += ar.o
|
||||
ARCHIVAL-$(CONFIG_BUNZIP2) += bunzip2.o
|
||||
ARCHIVAL-$(CONFIG_UNLZMA) += unlzma.o
|
||||
ARCHIVAL-$(CONFIG_CPIO) += cpio.o
|
||||
ARCHIVAL-$(CONFIG_DPKG) += dpkg.o
|
||||
ARCHIVAL-$(CONFIG_DPKG_DEB) += dpkg_deb.o
|
||||
@@ -38,11 +26,17 @@ ARCHIVAL-$(CONFIG_TAR) += tar.o
|
||||
ARCHIVAL-$(CONFIG_UNCOMPRESS) += uncompress.o
|
||||
ARCHIVAL-$(CONFIG_UNZIP) += unzip.o
|
||||
|
||||
ifneq ($(strip $(ARCHIVAL-y)),)
|
||||
libraries-y+=$(ARCHIVAL_DIR)$(ARCHIVAL_AR)
|
||||
endif
|
||||
|
||||
ARCHIVAL_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(ARCHIVAL-y))
|
||||
ARCHIVAL_SRC-a:=$(wildcard $(srcdir)/*.c)
|
||||
APPLET_SRC-y+=$(ARCHIVAL_SRC-y)
|
||||
APPLET_SRC-a+=$(ARCHIVAL_SRC-a)
|
||||
|
||||
$(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
|
||||
$(AR) -ro $@ $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
|
||||
$(do_ar)
|
||||
|
||||
$(ARCHIVAL_DIR)%.o: $(srcdir)/%.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
$(compile.c)
|
||||
+19
-29
@@ -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
|
||||
@@ -27,7 +15,6 @@
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -50,27 +37,27 @@ static void header_verbose_list_ar(const file_header_t *file_header)
|
||||
printf("%s %d/%d%7d %s %s\n", &mode[1], file_header->uid, file_header->gid, (int) file_header->size, &mtime[4], file_header->name);
|
||||
}
|
||||
|
||||
#define AR_CTX_PRINT 0x01
|
||||
#define AR_CTX_LIST 0x02
|
||||
#define AR_CTX_EXTRACT 0x04
|
||||
#define AR_CTX_PRINT 0x01
|
||||
#define AR_CTX_LIST 0x02
|
||||
#define AR_CTX_EXTRACT 0x04
|
||||
#define AR_OPT_PRESERVE_DATE 0x08
|
||||
#define AR_OPT_VERBOSE 0x10
|
||||
#define AR_OPT_CREATE 0x20
|
||||
#define AR_OPT_VERBOSE 0x10
|
||||
#define AR_OPT_CREATE 0x20
|
||||
#define AR_OPT_INSERT 0x40
|
||||
|
||||
extern int ar_main(int argc, char **argv)
|
||||
int ar_main(int argc, char **argv)
|
||||
{
|
||||
archive_handle_t *archive_handle;
|
||||
unsigned long opt;
|
||||
static const char msg_unsupported_err[] =
|
||||
"Archive %s not supported. Install binutils 'ar'.";
|
||||
char magic[8];
|
||||
|
||||
archive_handle = init_handle();
|
||||
|
||||
bb_opt_complementaly = "p~tx:t~px:x~pt";
|
||||
opt = bb_getopt_ulflags(argc, argv, "ptxovc");
|
||||
|
||||
if ((opt & 0x80000000UL) || (optind == argc)) {
|
||||
bb_show_usage();
|
||||
}
|
||||
/* Prepend '-' to the first argument if required */
|
||||
bb_opt_complementally = "--:p:t:x:-1:?:p--tx:t--px:x--pt";
|
||||
opt = bb_getopt_ulflags(argc, argv, "ptxovcr");
|
||||
|
||||
if (opt & AR_CTX_PRINT) {
|
||||
archive_handle->action_data = data_extract_to_stdout;
|
||||
@@ -88,17 +75,20 @@ extern int ar_main(int argc, char **argv)
|
||||
archive_handle->action_header = header_verbose_list_ar;
|
||||
}
|
||||
if (opt & AR_OPT_CREATE) {
|
||||
bb_error_msg_and_die("Archive creation not supported. Install binutils 'ar'.");
|
||||
bb_error_msg_and_die(msg_unsupported_err, "creation");
|
||||
}
|
||||
if (opt & AR_OPT_INSERT) {
|
||||
bb_error_msg_and_die(msg_unsupported_err, "insertion");
|
||||
}
|
||||
|
||||
archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
+25
-49
@@ -1,24 +1,12 @@
|
||||
/* 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>
|
||||
*
|
||||
* 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 <fcntl.h>
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -32,58 +20,46 @@
|
||||
|
||||
int bunzip2_main(int argc, char **argv)
|
||||
{
|
||||
char *compressed_name;
|
||||
/* Note: Ignore the warning about save_name being used uninitialized.
|
||||
* That is not the case, but gcc has trouble working that out... */
|
||||
char *save_name;
|
||||
char *filename;
|
||||
unsigned long opt;
|
||||
int status;
|
||||
int src_fd;
|
||||
int dst_fd;
|
||||
int status, src_fd, dst_fd;
|
||||
|
||||
opt = bb_getopt_ulflags(argc, argv, "cf");
|
||||
|
||||
/* if called as bzcat force the stdout flag */
|
||||
if (bb_applet_name[2] == 'c') {
|
||||
opt |= BUNZIP2_OPT_STDOUT;
|
||||
}
|
||||
|
||||
/* Set input filename and number */
|
||||
compressed_name = argv[optind];
|
||||
if ((compressed_name) && (compressed_name[0] != '-') && (compressed_name[1] != '\0')) {
|
||||
filename = argv[optind];
|
||||
if ((filename) && (filename[0] != '-') && (filename[1] != '\0')) {
|
||||
/* Open input file */
|
||||
src_fd = bb_xopen(compressed_name, O_RDONLY);
|
||||
src_fd = bb_xopen(filename, O_RDONLY);
|
||||
} else {
|
||||
src_fd = STDIN_FILENO;
|
||||
opt |= BUNZIP2_OPT_STDOUT;
|
||||
filename = 0;
|
||||
}
|
||||
|
||||
/* if called as bzcat force the stdout flag */
|
||||
if ((opt & BUNZIP2_OPT_STDOUT) || bb_applet_name[2] == 'c')
|
||||
filename = 0;
|
||||
|
||||
/* 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 (opt & BUNZIP2_OPT_STDOUT) {
|
||||
dst_fd = STDOUT_FILENO;
|
||||
} else {
|
||||
int len = strlen(compressed_name) - 4;
|
||||
if (strcmp(compressed_name + len, ".bz2") != 0) {
|
||||
if (filename) {
|
||||
struct stat stat_buf;
|
||||
char *extension=filename+strlen(filename)-4;
|
||||
if (strcmp(extension, ".bz2") != 0) {
|
||||
bb_error_msg_and_die("Invalid extension");
|
||||
}
|
||||
save_name = bb_xstrndup(compressed_name, len);
|
||||
dst_fd = bb_xopen(save_name, O_WRONLY | O_CREAT);
|
||||
}
|
||||
|
||||
xstat(filename, &stat_buf);
|
||||
*extension=0;
|
||||
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(!(opt & BUNZIP2_OPT_STDOUT)) {
|
||||
char *delete_name;
|
||||
if (status) {
|
||||
delete_name = save_name;
|
||||
} else {
|
||||
delete_name = compressed_name;
|
||||
}
|
||||
if (unlink(delete_name) < 0) {
|
||||
bb_error_msg_and_die("Couldn't remove %s", delete_name);
|
||||
if(filename) {
|
||||
if (!status) filename[strlen(filename)]='.';
|
||||
if (unlink(filename) < 0) {
|
||||
bb_error_msg_and_die("Couldn't remove %s", filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-24
@@ -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
|
||||
@@ -24,22 +12,21 @@
|
||||
*
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "unarchive.h"
|
||||
#include "busybox.h"
|
||||
|
||||
#define CPIO_OPT_EXTRACT 0x01
|
||||
#define CPIO_OPT_TEST 0x02
|
||||
#define CPIO_OPT_UNCONDITIONAL 0x04
|
||||
#define CPIO_OPT_VERBOSE 0x08
|
||||
#define CPIO_OPT_FILE 0x10
|
||||
#define CPIO_OPT_EXTRACT 0x01
|
||||
#define CPIO_OPT_TEST 0x02
|
||||
#define CPIO_OPT_UNCONDITIONAL 0x04
|
||||
#define CPIO_OPT_VERBOSE 0x08
|
||||
#define CPIO_OPT_FILE 0x10
|
||||
#define CPIO_OPT_CREATE_LEADING_DIR 0x20
|
||||
#define CPIO_OPT_PRESERVE_MTIME 0x40
|
||||
#define CPIO_OPT_PRESERVE_MTIME 0x40
|
||||
|
||||
extern int cpio_main(int argc, char **argv)
|
||||
int cpio_main(int argc, char **argv)
|
||||
{
|
||||
archive_handle_t *archive_handle;
|
||||
char *cpio_filename = NULL;
|
||||
@@ -59,7 +46,7 @@ extern int cpio_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (opt & CPIO_OPT_TEST) {
|
||||
/* if both extract and test option are given, ignore extract option */
|
||||
/* if both extract and test options are given, ignore extract option */
|
||||
if (opt & CPIO_OPT_EXTRACT) {
|
||||
opt &= ~CPIO_OPT_EXTRACT;
|
||||
}
|
||||
@@ -79,7 +66,7 @@ extern int cpio_main(int argc, char **argv)
|
||||
archive_handle->action_header = header_list;
|
||||
}
|
||||
}
|
||||
if (cpio_filename) { /* CPIO_OPT_FILE */
|
||||
if (cpio_filename) { /* CPIO_OPT_FILE */
|
||||
archive_handle->src_fd = bb_xopen(cpio_filename, O_RDONLY);
|
||||
archive_handle->seek = seek_by_jump;
|
||||
}
|
||||
@@ -89,7 +76,7 @@ extern 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++;
|
||||
}
|
||||
|
||||
|
||||
+72
-182
@@ -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.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -58,7 +47,7 @@
|
||||
* I estimate it should be at least 50% bigger than PACKAGE_HASH_PRIME,
|
||||
* as there a lot of duplicate version numbers */
|
||||
#define NAME_HASH_PRIME 16381
|
||||
char *name_hashtable[NAME_HASH_PRIME + 1];
|
||||
static char *name_hashtable[NAME_HASH_PRIME + 1];
|
||||
|
||||
/* PACKAGE_HASH_PRIME, Maximum number of unique packages,
|
||||
* It must not be smaller than STATUS_HASH_PRIME,
|
||||
@@ -82,7 +71,7 @@ typedef struct common_node_s {
|
||||
unsigned int num_of_edges:14;
|
||||
edge_t **edge;
|
||||
} common_node_t;
|
||||
common_node_t *package_hashtable[PACKAGE_HASH_PRIME + 1];
|
||||
static common_node_t *package_hashtable[PACKAGE_HASH_PRIME + 1];
|
||||
|
||||
/* Currently it doesnt store packages that have state-status of not-installed
|
||||
* So it only really has to be the size of the maximum number of packages
|
||||
@@ -92,7 +81,7 @@ typedef struct status_node_s {
|
||||
unsigned int package:14; /* has to fit PACKAGE_HASH_PRIME */
|
||||
unsigned int status:14; /* has to fit STATUS_HASH_PRIME */
|
||||
} status_node_t;
|
||||
status_node_t *status_hashtable[STATUS_HASH_PRIME + 1];
|
||||
static status_node_t *status_hashtable[STATUS_HASH_PRIME + 1];
|
||||
|
||||
/* Even numbers are for 'extras', like ored dependencies or null */
|
||||
enum edge_type_e {
|
||||
@@ -137,7 +126,7 @@ typedef struct deb_file_s {
|
||||
} deb_file_t;
|
||||
|
||||
|
||||
void make_hash(const char *key, unsigned int *start, unsigned int *decrement, const int hash_prime)
|
||||
static void make_hash(const char *key, unsigned int *start, unsigned int *decrement, const int hash_prime)
|
||||
{
|
||||
unsigned long int hash_num = key[0];
|
||||
int len = strlen(key);
|
||||
@@ -157,7 +146,7 @@ void make_hash(const char *key, unsigned int *start, unsigned int *decrement, co
|
||||
}
|
||||
|
||||
/* this adds the key to the hash table */
|
||||
int search_name_hashtable(const char *key)
|
||||
static int search_name_hashtable(const char *key)
|
||||
{
|
||||
unsigned int probe_address = 0;
|
||||
unsigned int probe_decrement = 0;
|
||||
@@ -181,7 +170,7 @@ int search_name_hashtable(const char *key)
|
||||
/* this DOESNT add the key to the hashtable
|
||||
* TODO make it consistent with search_name_hashtable
|
||||
*/
|
||||
unsigned int search_status_hashtable(const char *key)
|
||||
static unsigned int search_status_hashtable(const char *key)
|
||||
{
|
||||
unsigned int probe_address = 0;
|
||||
unsigned int probe_decrement = 0;
|
||||
@@ -201,7 +190,7 @@ unsigned int search_status_hashtable(const char *key)
|
||||
}
|
||||
|
||||
/* Need to rethink version comparison, maybe the official dpkg has something i can use ? */
|
||||
int version_compare_part(const char *version1, const char *version2)
|
||||
static int version_compare_part(const char *version1, const char *version2)
|
||||
{
|
||||
int upstream_len1 = 0;
|
||||
int upstream_len2 = 0;
|
||||
@@ -268,7 +257,7 @@ cleanup_version_compare_part:
|
||||
* if ver1 = ver2 return 0,
|
||||
* if ver1 > ver2 return 1,
|
||||
*/
|
||||
int version_compare(const unsigned int ver1, const unsigned int ver2)
|
||||
static int version_compare(const unsigned int ver1, const unsigned int ver2)
|
||||
{
|
||||
char *ch_ver1 = name_hashtable[ver1];
|
||||
char *ch_ver2 = name_hashtable[ver2];
|
||||
@@ -330,7 +319,7 @@ int version_compare(const unsigned int ver1, const unsigned int ver2)
|
||||
return(version_compare_part(deb_ver1, deb_ver2));
|
||||
}
|
||||
|
||||
int test_version(const unsigned int version1, const unsigned int version2, const unsigned int operator)
|
||||
static int test_version(const unsigned int version1, const unsigned int version2, const unsigned int operator)
|
||||
{
|
||||
const int version_result = version_compare(version1, version2);
|
||||
switch(operator) {
|
||||
@@ -366,7 +355,7 @@ int test_version(const unsigned int version1, const unsigned int version2, const
|
||||
}
|
||||
|
||||
|
||||
int search_package_hashtable(const unsigned int name, const unsigned int version, const unsigned int operator)
|
||||
static int search_package_hashtable(const unsigned int name, const unsigned int version, const unsigned int operator)
|
||||
{
|
||||
unsigned int probe_address = 0;
|
||||
unsigned int probe_decrement = 0;
|
||||
@@ -405,7 +394,7 @@ int search_package_hashtable(const unsigned int name, const unsigned int version
|
||||
* FIXME: I don't think this is very efficient, but I thought I'd keep
|
||||
* it simple for now until it proves to be a problem.
|
||||
*/
|
||||
int search_for_provides(int needle, int start_at) {
|
||||
static int search_for_provides(int needle, int start_at) {
|
||||
int i, j;
|
||||
common_node_t *p;
|
||||
for (i = start_at + 1; i < PACKAGE_HASH_PRIME; i++) {
|
||||
@@ -421,7 +410,7 @@ int search_for_provides(int needle, int start_at) {
|
||||
/*
|
||||
* Add an edge to a node
|
||||
*/
|
||||
void add_edge_to_node(common_node_t *node, edge_t *edge)
|
||||
static void add_edge_to_node(common_node_t *node, edge_t *edge)
|
||||
{
|
||||
node->num_of_edges++;
|
||||
node->edge = xrealloc(node->edge, sizeof(edge_t) * (node->num_of_edges + 1));
|
||||
@@ -438,7 +427,7 @@ void add_edge_to_node(common_node_t *node, edge_t *edge)
|
||||
* field contains the number of EDGE nodes which follow as part of
|
||||
* this alternative.
|
||||
*/
|
||||
void add_split_dependencies(common_node_t *parent_node, const char *whole_line, unsigned int edge_type)
|
||||
static void add_split_dependencies(common_node_t *parent_node, const char *whole_line, unsigned int edge_type)
|
||||
{
|
||||
char *line = bb_xstrdup(whole_line);
|
||||
char *line2;
|
||||
@@ -537,24 +526,26 @@ void add_split_dependencies(common_node_t *parent_node, const char *whole_line,
|
||||
return;
|
||||
}
|
||||
|
||||
void free_package(common_node_t *node)
|
||||
static void free_package(common_node_t *node)
|
||||
{
|
||||
unsigned short i;
|
||||
if (node) {
|
||||
for (i = 0; i < node->num_of_edges; i++) {
|
||||
free(node->edge[i]);
|
||||
}
|
||||
if ( node->edge )
|
||||
free(node->edge);
|
||||
free(node->edge);
|
||||
free(node);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int fill_package_struct(char *control_buffer)
|
||||
static unsigned int fill_package_struct(char *control_buffer)
|
||||
{
|
||||
common_node_t *new_node = (common_node_t *) xcalloc(1, sizeof(common_node_t));
|
||||
const char *field_names[] = { "Package", "Version", "Pre-Depends", "Depends",
|
||||
"Replaces", "Provides", "Conflicts", "Suggests", "Recommends", "Enhances", 0};
|
||||
static const char *const field_names[] = { "Package", "Version",
|
||||
"Pre-Depends", "Depends","Replaces", "Provides",
|
||||
"Conflicts", "Suggests", "Recommends", "Enhances", 0
|
||||
};
|
||||
|
||||
common_node_t *new_node = (common_node_t *) xzalloc(sizeof(common_node_t));
|
||||
char *field_name;
|
||||
char *field_value;
|
||||
int field_start = 0;
|
||||
@@ -624,7 +615,7 @@ fill_package_struct_cleanup:
|
||||
}
|
||||
|
||||
/* if num = 1, it returns the want status, 2 returns flag, 3 returns status */
|
||||
unsigned int get_status(const unsigned int status_node, const int num)
|
||||
static unsigned int get_status(const unsigned int status_node, const int num)
|
||||
{
|
||||
char *status_string = name_hashtable[status_hashtable[status_node]->status];
|
||||
char *state_sub_string;
|
||||
@@ -646,7 +637,7 @@ unsigned int get_status(const unsigned int status_node, const int num)
|
||||
return(state_sub_num);
|
||||
}
|
||||
|
||||
void set_status(const unsigned int status_node_num, const char *new_value, const int position)
|
||||
static void set_status(const unsigned int status_node_num, const char *new_value, const int position)
|
||||
{
|
||||
const unsigned int new_value_len = strlen(new_value);
|
||||
const unsigned int new_value_num = search_name_hashtable(new_value);
|
||||
@@ -675,14 +666,13 @@ void set_status(const unsigned int status_node_num, const char *new_value, const
|
||||
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;
|
||||
}
|
||||
|
||||
const char *describe_status(int status_num) {
|
||||
static const char *describe_status(int status_num) {
|
||||
int status_want, status_state ;
|
||||
if ( status_hashtable[status_num] == NULL || status_hashtable[status_num]->status == 0 )
|
||||
return "is not installed or flagged to be installed\n";
|
||||
@@ -707,7 +697,7 @@ const char *describe_status(int status_num) {
|
||||
}
|
||||
|
||||
|
||||
void index_status_file(const char *filename)
|
||||
static void index_status_file(const char *filename)
|
||||
{
|
||||
FILE *status_file;
|
||||
char *control_buffer;
|
||||
@@ -739,80 +729,7 @@ 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
|
||||
|
||||
void write_buffer_no_status(FILE *new_status_file, const char *control_buffer)
|
||||
static void write_buffer_no_status(FILE *new_status_file, const char *control_buffer)
|
||||
{
|
||||
char *name;
|
||||
char *value;
|
||||
@@ -830,7 +747,7 @@ void write_buffer_no_status(FILE *new_status_file, const char *control_buffer)
|
||||
}
|
||||
|
||||
/* This could do with a cleanup */
|
||||
void write_status_file(deb_file_t **deb_file)
|
||||
static void write_status_file(deb_file_t **deb_file)
|
||||
{
|
||||
FILE *old_status_file = bb_xfopen("/var/lib/dpkg/status", "r");
|
||||
FILE *new_status_file = bb_xfopen("/var/lib/dpkg/status.udeb", "w");
|
||||
@@ -850,7 +767,7 @@ void write_status_file(deb_file_t **deb_file)
|
||||
}
|
||||
|
||||
tmp_string += 8;
|
||||
tmp_string += strspn(tmp_string, " \n\t");
|
||||
tmp_string += strspn(tmp_string, " \n\t");
|
||||
package_name = bb_xstrndup(tmp_string, strcspn(tmp_string, "\n\0"));
|
||||
write_flag = FALSE;
|
||||
tmp_string = strstr(control_buffer, "Status:");
|
||||
@@ -958,9 +875,7 @@ 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");
|
||||
@@ -978,7 +893,7 @@ void write_status_file(deb_file_t **deb_file)
|
||||
* which a regular depends can be satisfied by a package which we want
|
||||
* to install.
|
||||
*/
|
||||
int package_satisfies_dependency(int package, int depend_type)
|
||||
static int package_satisfies_dependency(int package, int depend_type)
|
||||
{
|
||||
int status_num = search_status_hashtable(name_hashtable[package_hashtable[package]->name]);
|
||||
|
||||
@@ -989,13 +904,13 @@ int package_satisfies_dependency(int package, int depend_type)
|
||||
return 0;
|
||||
|
||||
switch (depend_type) {
|
||||
case EDGE_PRE_DEPENDS: return get_status(status_num, 3) == search_name_hashtable("installed");
|
||||
case EDGE_DEPENDS: return get_status(status_num, 1) == search_name_hashtable("install");
|
||||
case EDGE_PRE_DEPENDS: return get_status(status_num, 3) == search_name_hashtable("installed");
|
||||
case EDGE_DEPENDS: return get_status(status_num, 1) == search_name_hashtable("install");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
|
||||
static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
|
||||
{
|
||||
int *conflicts = NULL;
|
||||
int conflicts_num = 0;
|
||||
@@ -1025,11 +940,9 @@ 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));
|
||||
@@ -1078,7 +991,7 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check dependendcies */
|
||||
@@ -1109,15 +1022,6 @@ 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 :-)
|
||||
@@ -1125,13 +1029,13 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
|
||||
for (j = 0; j < package_node->num_of_edges; j++) {
|
||||
const edge_t *package_edge = package_node->edge[j];
|
||||
unsigned int package_num;
|
||||
|
||||
|
||||
if ( package_edge->type == EDGE_OR_PRE_DEPENDS ||
|
||||
package_edge->type == EDGE_OR_DEPENDS ) { /* start an EDGE_OR_ list */
|
||||
package_edge->type == EDGE_OR_DEPENDS ) { /* start an EDGE_OR_ list */
|
||||
number_of_alternatives = package_edge->version;
|
||||
root_of_alternatives = package_edge;
|
||||
continue;
|
||||
} else if ( number_of_alternatives == 0 ) { /* not in the middle of an EDGE_OR_ list */
|
||||
} else if ( number_of_alternatives == 0 ) { /* not in the middle of an EDGE_OR_ list */
|
||||
number_of_alternatives = 1;
|
||||
root_of_alternatives = NULL;
|
||||
}
|
||||
@@ -1204,7 +1108,7 @@ int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
char **create_list(const char *filename)
|
||||
static char **create_list(const char *filename)
|
||||
{
|
||||
FILE *list_stream;
|
||||
char **file_list = NULL;
|
||||
@@ -1233,7 +1137,7 @@ char **create_list(const char *filename)
|
||||
}
|
||||
|
||||
/* maybe i should try and hook this into remove_file.c somehow */
|
||||
int remove_file_array(char **remove_names, char **exclude_names)
|
||||
static int remove_file_array(char **remove_names, char **exclude_names)
|
||||
{
|
||||
struct stat path_stat;
|
||||
int match_flag;
|
||||
@@ -1271,46 +1175,39 @@ int remove_file_array(char **remove_names, char **exclude_names)
|
||||
return(remove_flag);
|
||||
}
|
||||
|
||||
int run_package_script(const char *package_name, const char *script_type)
|
||||
static int run_package_script(const char *package_name, const char *script_type)
|
||||
{
|
||||
struct stat path_stat;
|
||||
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);
|
||||
}
|
||||
|
||||
const char *all_control_files[] = {"preinst", "postinst", "prerm", "postrm",
|
||||
static const char *all_control_files[] = {"preinst", "postinst", "prerm", "postrm",
|
||||
"list", "md5sums", "shlibs", "conffiles", "config", "templates", NULL };
|
||||
|
||||
char **all_control_list(const char *package_name)
|
||||
static char **all_control_list(const char *package_name)
|
||||
{
|
||||
unsigned short i = 0;
|
||||
char **remove_files;
|
||||
|
||||
/* Create a list of all /var/lib/dpkg/info/<package> files */
|
||||
remove_files = malloc(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);
|
||||
}
|
||||
|
||||
void free_array(char **array)
|
||||
static void free_array(char **array)
|
||||
{
|
||||
|
||||
if (array) {
|
||||
@@ -1327,9 +1224,9 @@ void free_array(char **array)
|
||||
* the status_hashtable to retrieve the info. This results in smaller code than
|
||||
* scanning the status file. The resulting list, however, is unsorted.
|
||||
*/
|
||||
void list_packages(void)
|
||||
static void list_packages(void)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
printf(" Name Version\n");
|
||||
printf("+++-==============-==============\n");
|
||||
@@ -1364,7 +1261,7 @@ void list_packages(void)
|
||||
}
|
||||
}
|
||||
|
||||
void remove_package(const unsigned int package_num, int noisy)
|
||||
static void remove_package(const unsigned int package_num, int noisy)
|
||||
{
|
||||
const char *package_name = name_hashtable[package_hashtable[package_num]->name];
|
||||
const char *package_version = name_hashtable[package_hashtable[package_num]->version];
|
||||
@@ -1398,11 +1295,9 @@ 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);
|
||||
@@ -1418,7 +1313,7 @@ void remove_package(const unsigned int package_num, int noisy)
|
||||
set_status(status_num, "config-files", 3);
|
||||
}
|
||||
|
||||
void purge_package(const unsigned int package_num)
|
||||
static void purge_package(const unsigned int package_num)
|
||||
{
|
||||
const char *package_name = name_hashtable[package_hashtable[package_num]->name];
|
||||
const char *package_version = name_hashtable[package_hashtable[package_num]->version];
|
||||
@@ -1438,8 +1333,7 @@ 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));
|
||||
@@ -1482,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 */
|
||||
@@ -1504,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 */
|
||||
@@ -1520,6 +1414,7 @@ static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, lli
|
||||
{
|
||||
ar_handle->sub_archive->action_data = data_extract_to_buffer;
|
||||
ar_handle->sub_archive->accept = myaccept;
|
||||
ar_handle->sub_archive->filter = filter_accept_list;
|
||||
|
||||
unpack_ar_archive(ar_handle);
|
||||
close(ar_handle->src_fd);
|
||||
@@ -1533,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;
|
||||
@@ -1564,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;
|
||||
@@ -1614,7 +1505,7 @@ static void unpack_package(deb_file_t *deb_file)
|
||||
free(info_prefix);
|
||||
}
|
||||
|
||||
void configure_package(deb_file_t *deb_file)
|
||||
static void configure_package(deb_file_t *deb_file)
|
||||
{
|
||||
const char *package_name = name_hashtable[package_hashtable[deb_file->package]->name];
|
||||
const char *package_version = name_hashtable[package_hashtable[deb_file->package]->version];
|
||||
@@ -1696,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);
|
||||
@@ -1714,6 +1605,7 @@ int dpkg_main(int argc, char **argv)
|
||||
|
||||
if (package_num == -1) {
|
||||
bb_error_msg("Invalid control file in %s", argv[optind]);
|
||||
optind++;
|
||||
continue;
|
||||
}
|
||||
deb_file[deb_count]->package = (unsigned int) package_num;
|
||||
@@ -1738,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);
|
||||
|
||||
+13
-24
@@ -1,24 +1,13 @@
|
||||
/* 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>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "unarchive.h"
|
||||
#include "busybox.h"
|
||||
@@ -29,7 +18,7 @@
|
||||
#define DPKG_DEB_OPT_EXTRACT 8
|
||||
#define DPKG_DEB_OPT_EXTRACT_VERBOSE 16
|
||||
|
||||
extern int dpkg_deb_main(int argc, char **argv)
|
||||
int dpkg_deb_main(int argc, char **argv)
|
||||
{
|
||||
archive_handle_t *ar_archive;
|
||||
archive_handle_t *tar_archive;
|
||||
@@ -47,16 +36,16 @@ extern 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_complementaly = "c~efXx:e~cfXx:f~ceXx:X~cefx:x~cefX";
|
||||
bb_opt_complementally = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
|
||||
opt = bb_getopt_ulflags(argc, argv, "cefXx");
|
||||
|
||||
if (opt & DPKG_DEB_OPT_CONTENTS) {
|
||||
@@ -76,7 +65,7 @@ extern 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;
|
||||
}
|
||||
@@ -88,7 +77,7 @@ extern int dpkg_deb_main(int argc, char **argv)
|
||||
argcount = 2;
|
||||
}
|
||||
|
||||
if ((optind + argcount != argc) || (opt & 0x80000000UL)) {
|
||||
if ((optind + argcount) != argc) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
@@ -100,8 +89,8 @@ extern 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);
|
||||
|
||||
|
||||
+8
-47
@@ -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,30 +27,9 @@
|
||||
* 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>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
@@ -76,7 +42,7 @@ static char *license_msg[] = {
|
||||
#define GUNZIP_OPT_TEST 4
|
||||
#define GUNZIP_OPT_DECOMPRESS 8
|
||||
|
||||
extern int gunzip_main(int argc, char **argv)
|
||||
int gunzip_main(int argc, char **argv)
|
||||
{
|
||||
char status = EXIT_SUCCESS;
|
||||
unsigned long opt;
|
||||
@@ -104,9 +70,7 @@ extern int gunzip_main(int argc, char **argv)
|
||||
src_fd = bb_xopen(old_path, O_RDONLY);
|
||||
|
||||
/* Get the time stamp on the input file. */
|
||||
if (stat(old_path, &stat_buf) < 0) {
|
||||
bb_error_msg_and_die("Couldn't stat file %s", old_path);
|
||||
}
|
||||
xstat(old_path, &stat_buf);
|
||||
}
|
||||
|
||||
/* Check that the input is sane. */
|
||||
@@ -117,7 +81,7 @@ extern int gunzip_main(int argc, char **argv)
|
||||
|
||||
/* Set output filename and number */
|
||||
if (opt & GUNZIP_OPT_TEST) {
|
||||
dst_fd = bb_xopen("/dev/null", O_WRONLY); /* why does test use filenum 2 ? */
|
||||
dst_fd = bb_xopen(bb_dev_null, O_WRONLY); /* why does test use filenum 2 ? */
|
||||
} else if (opt & GUNZIP_OPT_STDOUT) {
|
||||
dst_fd = STDOUT_FILENO;
|
||||
} else {
|
||||
@@ -140,21 +104,18 @@ extern 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);
|
||||
|
||||
+47
-115
@@ -13,27 +13,10 @@
|
||||
* files as well as stdin/stdout, and to generally behave itself wrt
|
||||
* command line handling.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* 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>
|
||||
@@ -51,12 +34,6 @@
|
||||
#include <time.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#define memzero(s, n) memset ((void *)(s), 0, (n))
|
||||
|
||||
#ifndef RETSIGTYPE
|
||||
# define RETSIGTYPE void
|
||||
#endif
|
||||
|
||||
typedef unsigned char uch;
|
||||
typedef unsigned short ush;
|
||||
typedef unsigned long ulg;
|
||||
@@ -106,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) */
|
||||
@@ -173,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 */
|
||||
|
||||
@@ -214,9 +176,6 @@ typedef int file_t; /* Do not use stdio */
|
||||
static int zip(int in, int out);
|
||||
static int file_read(char *buf, unsigned size);
|
||||
|
||||
/* from gzip.c */
|
||||
static RETSIGTYPE abort_gzip(void);
|
||||
|
||||
/* from deflate.c */
|
||||
static void lm_init(ush * flags);
|
||||
static ulg deflate(void);
|
||||
@@ -243,10 +202,6 @@ static void flush_outbuf(void);
|
||||
* terms of the GNU General Public License, see the file COPYING.
|
||||
*/
|
||||
|
||||
#if !defined(OF) && defined(lint)
|
||||
# include "gzip.h"
|
||||
#endif
|
||||
|
||||
#ifndef BITS
|
||||
# define BITS 16
|
||||
#endif
|
||||
@@ -319,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)
|
||||
@@ -335,7 +291,7 @@ static void put_short(ush w)
|
||||
/* ========================================================================
|
||||
* Signal and error handler.
|
||||
*/
|
||||
static void abort_gzip()
|
||||
static void abort_gzip(int ATTRIBUTE_UNUSED ignored)
|
||||
{
|
||||
exit(ERROR);
|
||||
}
|
||||
@@ -350,13 +306,6 @@ static void clear_bufs(void)
|
||||
bytes_in = 0L;
|
||||
}
|
||||
|
||||
static void write_bb_error_msg(void)
|
||||
{
|
||||
fputc('\n', stderr);
|
||||
bb_perror_nomsg();
|
||||
abort_gzip();
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
* Does the same as write(), but also handles partial pipe writes and checks
|
||||
* for error return.
|
||||
@@ -366,9 +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)) {
|
||||
write_bb_error_msg();
|
||||
}
|
||||
if (n == (unsigned) (-1)) bb_error_msg_and_die(bb_msg_write_error);
|
||||
cnt -= n;
|
||||
buf = (void *) ((char *) buf + n);
|
||||
}
|
||||
@@ -379,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)
|
||||
@@ -413,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
|
||||
@@ -547,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;
|
||||
@@ -559,7 +487,7 @@ static unsigned bi_reverse(unsigned code, int len)
|
||||
/* ===========================================================================
|
||||
* Write out any remaining bits in an incomplete byte.
|
||||
*/
|
||||
static void bi_windup()
|
||||
static void bi_windup(void)
|
||||
{
|
||||
if (bi_valid > 8) {
|
||||
put_short(bi_buf);
|
||||
@@ -767,25 +695,26 @@ static unsigned match_start; /* start of matching string */
|
||||
static int eofile; /* flag set at end of input file */
|
||||
static unsigned lookahead; /* number of valid bytes ahead in window */
|
||||
|
||||
static const unsigned max_chain_length = 4096;
|
||||
enum {
|
||||
max_chain_length = 4096,
|
||||
|
||||
/* To speed up deflation, hash chains are never searched beyond this length.
|
||||
* A higher limit improves compression ratio but degrades the speed.
|
||||
*/
|
||||
|
||||
static const unsigned int max_lazy_match = 258;
|
||||
max_lazy_match = 258,
|
||||
|
||||
/* Attempt to find a better match only when the current match is strictly
|
||||
* smaller than this value. This mechanism is used only for compression
|
||||
* levels >= 4.
|
||||
*/
|
||||
#define max_insert_length max_lazy_match
|
||||
max_insert_length = max_lazy_match,
|
||||
/* Insert new strings in the hash table only if the match length
|
||||
* is not greater than this length. This saves time but degrades compression.
|
||||
* max_insert_length is used only for compression levels <= 3.
|
||||
*/
|
||||
|
||||
static const unsigned good_match = 32;
|
||||
good_match = 32,
|
||||
|
||||
/* Use a faster search when the previous match is longer than this */
|
||||
|
||||
@@ -796,12 +725,13 @@ static const unsigned good_match = 32;
|
||||
* found for specific files.
|
||||
*/
|
||||
|
||||
static const int nice_match = 258; /* Stop searching when current match exceeds this */
|
||||
nice_match = 258 /* Stop searching when current match exceeds this */
|
||||
|
||||
/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
|
||||
* For deflate_fast() (levels <= 3) good is ignored and lazy has a different
|
||||
* meaning.
|
||||
*/
|
||||
};
|
||||
|
||||
#define EQUAL 0
|
||||
/* result of memcmp for equal strings */
|
||||
@@ -843,10 +773,10 @@ 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. */
|
||||
memzero((char *) head, HASH_SIZE * sizeof(*head));
|
||||
memset(head, 0, HASH_SIZE * sizeof(*head));
|
||||
/* prev will be initialized on the fly */
|
||||
|
||||
*flags |= SLOW;
|
||||
@@ -893,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;
|
||||
@@ -909,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) {
|
||||
@@ -996,9 +926,9 @@ static void check_match(IPos start, IPos match, int length)
|
||||
* file reads are performed for at least two bytes (required for the
|
||||
* translate_eol option).
|
||||
*/
|
||||
static void fill_window()
|
||||
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. */
|
||||
@@ -1053,20 +983,20 @@ static void fill_window()
|
||||
*/
|
||||
#define FLUSH_BLOCK(eof) \
|
||||
flush_block(block_start >= 0L ? (char*)&window[(unsigned)block_start] : \
|
||||
(char*)NULL, (long)strstart - block_start, (eof))
|
||||
(char*)NULL, (long)strstart - block_start, (eof))
|
||||
|
||||
/* ===========================================================================
|
||||
* Same as above, but achieves better compression. We use a lazy
|
||||
* evaluation for matches: a match is finally adopted only if there is
|
||||
* no better match at the next window position.
|
||||
*/
|
||||
static ulg deflate()
|
||||
static ulg deflate(void)
|
||||
{
|
||||
IPos hash_head; /* head of hash chain */
|
||||
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) {
|
||||
@@ -1188,8 +1118,6 @@ static ulg deflate()
|
||||
|
||||
typedef struct dirent dir_type;
|
||||
|
||||
typedef RETSIGTYPE(*sig_type) (int);
|
||||
|
||||
/* ======================================================================== */
|
||||
int gzip_main(int argc, char **argv)
|
||||
{
|
||||
@@ -1235,16 +1163,16 @@ int gzip_main(int argc, char **argv)
|
||||
|
||||
foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
|
||||
if (foreground) {
|
||||
(void) signal(SIGINT, (sig_type) abort_gzip);
|
||||
(void) signal(SIGINT, abort_gzip);
|
||||
}
|
||||
#ifdef SIGTERM
|
||||
if (signal(SIGTERM, SIG_IGN) != SIG_IGN) {
|
||||
(void) signal(SIGTERM, (sig_type) abort_gzip);
|
||||
(void) signal(SIGTERM, abort_gzip);
|
||||
}
|
||||
#endif
|
||||
#ifdef SIGHUP
|
||||
if (signal(SIGHUP, SIG_IGN) != SIG_IGN) {
|
||||
(void) signal(SIGHUP, (sig_type) abort_gzip);
|
||||
(void) signal(SIGHUP, abort_gzip);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1258,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;
|
||||
|
||||
@@ -1271,14 +1202,15 @@ int gzip_main(int argc, char **argv)
|
||||
for (i = optind; i < argc; i++) {
|
||||
char *path = NULL;
|
||||
|
||||
clear_bufs();
|
||||
if (strcmp(argv[i], "-") == 0) {
|
||||
time_stamp = 0;
|
||||
ifile_size = -1L;
|
||||
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;
|
||||
@@ -1289,7 +1221,7 @@ int gzip_main(int argc, char **argv)
|
||||
strcat(path, ".gz");
|
||||
|
||||
/* Open output file */
|
||||
#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
|
||||
#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) && defined O_NOFOLLOW
|
||||
outFileNum =
|
||||
open(path, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW);
|
||||
#else
|
||||
@@ -1749,7 +1681,7 @@ static void ct_init(ush * attr, int *methodp)
|
||||
/* ===========================================================================
|
||||
* Initialize a new block.
|
||||
*/
|
||||
static void init_block()
|
||||
static void init_block(void)
|
||||
{
|
||||
int n; /* iterates over tree elements */
|
||||
|
||||
@@ -2162,7 +2094,7 @@ static void send_tree(ct_data * tree, int max_code)
|
||||
* Construct the Huffman tree for the bit lengths and return the index in
|
||||
* bl_order of the last bit length code to send.
|
||||
*/
|
||||
static const int build_bl_tree()
|
||||
static int build_bl_tree(void)
|
||||
{
|
||||
int max_blindex; /* index of last bit length code of non zero freq */
|
||||
|
||||
@@ -2425,7 +2357,7 @@ static void compress_block(ct_data * ltree, ct_data * dtree)
|
||||
* IN assertion: the fields freq of dyn_ltree are set and the total of all
|
||||
* frequencies does not exceed 64K (to fit in an int on 16 bit machines).
|
||||
*/
|
||||
static void set_file_type()
|
||||
static void set_file_type(void)
|
||||
{
|
||||
int n = 0;
|
||||
unsigned ascii_freq = 0;
|
||||
@@ -2450,7 +2382,7 @@ static void set_file_type()
|
||||
*/
|
||||
|
||||
|
||||
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)
|
||||
@@ -2538,7 +2470,7 @@ static int file_read(char *buf, unsigned size)
|
||||
* Write the output buffer outbuf[0..outcnt-1] and update bytes_out.
|
||||
* (used for the compressed data only)
|
||||
*/
|
||||
static void flush_outbuf()
|
||||
static void flush_outbuf(void)
|
||||
{
|
||||
if (outcnt == 0)
|
||||
return;
|
||||
|
||||
@@ -17,11 +17,15 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
ifndef top_srcdir
|
||||
top_srcdir=../..
|
||||
endif
|
||||
ifndef top_builddir
|
||||
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)
|
||||
|
||||
@@ -2,26 +2,17 @@
|
||||
#
|
||||
# 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 the GPL v2 or later, see the file LICENSE in this tarball.
|
||||
|
||||
LIBUNARCHIVE_AR:=libunarchive.a
|
||||
ifndef $(LIBUNARCHIVE_DIR)
|
||||
LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive/
|
||||
LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive
|
||||
endif
|
||||
srcdir=$(top_srcdir)/archvial/libunarchive
|
||||
srcdir=$(top_srcdir)/archival/libunarchive
|
||||
|
||||
LIBUNARCHIVE-obj:=$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR)
|
||||
|
||||
libraries-y+=$(LIBUNARCHIVE-obj)
|
||||
|
||||
LIBUNARCHIVE-y:= \
|
||||
\
|
||||
@@ -38,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 \
|
||||
@@ -58,27 +48,36 @@ DPKG_FILES:= \
|
||||
|
||||
LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o
|
||||
LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2.o
|
||||
LIBUNARCHIVE-$(CONFIG_UNLZMA) += decompress_unlzma.o
|
||||
LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio.o
|
||||
LIBUNARCHIVE-$(CONFIG_DPKG) += $(DPKG_FILES)
|
||||
LIBUNARCHIVE-$(CONFIG_DPKG_DEB) += $(DPKG_FILES)
|
||||
LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_GZ) += $(GUNZIP_FILES) get_header_tar_gz.o
|
||||
LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o
|
||||
LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o
|
||||
LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES)
|
||||
LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o
|
||||
LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o
|
||||
LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o
|
||||
LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o
|
||||
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o
|
||||
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o
|
||||
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
|
||||
|
||||
libraries-y+=$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR)
|
||||
|
||||
$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
|
||||
$(AR) -ro $@ $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
|
||||
LIBUNARCHIVE-y:=$(sort $(LIBUNARCHIVE-y))
|
||||
|
||||
$(LIBUNARCHIVA_DIR)%.o: $(srcdir)/%.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
LIBUNARCHIVE_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBUNARCHIVE-y)))
|
||||
LIBUNARCHIVE_SRC-a:=$(wildcard $(srcdir)/*.c)
|
||||
LIBRARY_SRC-y+=$(LIBUNARCHIVE_SRC-y)
|
||||
LIBRARY_SRC-a+=$(LIBUNARCHIVE_SRC-a)
|
||||
|
||||
$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)/%,$(LIBUNARCHIVE-y))
|
||||
$(do_ar)
|
||||
|
||||
$(LIBUNARCHIVE_DIR)/%.o: $(srcdir)/%.c
|
||||
$(compile.c)
|
||||
@@ -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"
|
||||
|
||||
extern 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>
|
||||
@@ -20,13 +9,13 @@
|
||||
#include "unarchive.h"
|
||||
#include "libbb.h"
|
||||
|
||||
extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *buf, size_t count)
|
||||
ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *buf, size_t count)
|
||||
{
|
||||
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 %d of %d", size, count);
|
||||
bb_perror_msg_and_die("Short read, read %ld of %ld", (long)size, (long)count);
|
||||
}
|
||||
return(size);
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
/* 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"
|
||||
#include "unarchive.h" /* for external decl of check_header_gzip */
|
||||
|
||||
extern void check_header_gzip(int src_fd)
|
||||
void check_header_gzip(int src_fd)
|
||||
{
|
||||
union {
|
||||
unsigned char raw[8];
|
||||
@@ -15,7 +20,7 @@ extern 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) {
|
||||
@@ -27,10 +32,10 @@ extern 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--;
|
||||
}
|
||||
}
|
||||
@@ -38,19 +43,19 @@ extern 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>
|
||||
@@ -22,7 +11,7 @@
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
extern void data_align(archive_handle_t *archive_handle, const unsigned short boundary)
|
||||
void data_align(archive_handle_t *archive_handle, const unsigned short boundary)
|
||||
{
|
||||
const unsigned short skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary;
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -27,7 +16,7 @@
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
extern void data_extract_all(archive_handle_t *archive_handle)
|
||||
void data_extract_all(archive_handle_t *archive_handle)
|
||||
{
|
||||
file_header_t *file_header = archive_handle->file_header;
|
||||
int dst_fd;
|
||||
@@ -111,8 +100,12 @@ extern void data_extract_all(archive_handle_t *archive_handle)
|
||||
}
|
||||
}
|
||||
|
||||
lchown(file_header->name, file_header->uid, file_header->gid);
|
||||
if ((file_header->mode & S_IFMT) != S_IFLNK) {
|
||||
if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_OWN)) {
|
||||
lchown(file_header->name, file_header->uid, file_header->gid);
|
||||
}
|
||||
if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_PERM) &&
|
||||
(file_header->mode & S_IFMT) != S_IFLNK)
|
||||
{
|
||||
chmod(file_header->name, file_header->mode);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +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.
|
||||
* 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"
|
||||
#include "unarchive.h"
|
||||
|
||||
extern void data_extract_to_buffer(archive_handle_t *archive_handle)
|
||||
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,23 +1,12 @@
|
||||
/* 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"
|
||||
#include <unistd.h>
|
||||
|
||||
extern void data_extract_to_stdout(archive_handle_t *archive_handle)
|
||||
void data_extract_to_stdout(archive_handle_t *archive_handle)
|
||||
{
|
||||
bb_copyfd_size(archive_handle->src_fd, STDOUT_FILENO, archive_handle->file_header->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 <sys/types.h>
|
||||
@@ -21,7 +10,7 @@
|
||||
#include "unarchive.h"
|
||||
#include "libbb.h"
|
||||
|
||||
extern void data_skip(archive_handle_t *archive_handle)
|
||||
void data_skip(archive_handle_t *archive_handle)
|
||||
{
|
||||
archive_handle->seek(archive_handle, archive_handle->file_header->size);
|
||||
}
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -23,19 +22,8 @@
|
||||
|
||||
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 in the name of the woman I loved, who
|
||||
passed away Feb. 12, 2003.
|
||||
|
||||
In memory of Toni W. Hagan
|
||||
|
||||
Hospice of Acadiana, Inc.
|
||||
2600 Johnston St., Suite 200
|
||||
Lafayette, LA 70503-3240
|
||||
|
||||
Phone (337) 232-1234 or 1-800-738-2226
|
||||
Fax (337) 232-1297
|
||||
|
||||
http://www.hospiceacadiana.com/
|
||||
non-profit hospice organization (www.hospiceacadiana.com) in the name of
|
||||
the woman I loved, Toni W. Hagan, who passed away Feb. 12, 2003.
|
||||
|
||||
Manuel
|
||||
*/
|
||||
@@ -49,11 +37,13 @@
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
#include "unarchive.h"
|
||||
|
||||
/* Constants for Huffman coding */
|
||||
#define MAX_GROUPS 6
|
||||
#define GROUP_SIZE 50 /* 64 would have been more efficient */
|
||||
#define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */
|
||||
#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */
|
||||
#define GROUP_SIZE 50 /* 64 would have been more efficient */
|
||||
#define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */
|
||||
#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */
|
||||
#define SYMBOL_RUNA 0
|
||||
#define SYMBOL_RUNB 1
|
||||
|
||||
@@ -79,51 +69,73 @@ struct group_data {
|
||||
|
||||
/* Structure holding all the housekeeping data, including IO buffers and
|
||||
memory that persists between calls to bunzip */
|
||||
|
||||
typedef struct {
|
||||
/* State for interrupting output loop */
|
||||
|
||||
int writeCopies,writePos,writeRunCountdown,writeCount,writeCurrent;
|
||||
|
||||
/* I/O tracking data (file handles, buffers, positions, etc.) */
|
||||
|
||||
int in_fd,out_fd,inbufCount,inbufPos /*,outbufPos*/;
|
||||
unsigned char *inbuf /*,*outbuf*/;
|
||||
unsigned int inbufBitCount, inbufBits;
|
||||
|
||||
/* 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;
|
||||
|
||||
/* These things are a bit too big to go on the stack */
|
||||
|
||||
unsigned char selectors[32768]; /* nSelectors=15 bits */
|
||||
struct group_data groups[MAX_GROUPS]; /* Huffman coding tables */
|
||||
|
||||
/* For I/O error handling */
|
||||
|
||||
jmp_buf jmpbuf;
|
||||
} bunzip_data;
|
||||
|
||||
/* Return the next nnn bits of input. All reads from the compressed input
|
||||
are done through this function. All reads are big endian */
|
||||
|
||||
static unsigned int get_bits(bunzip_data *bd, char bits_wanted)
|
||||
{
|
||||
unsigned int bits=0;
|
||||
|
||||
/* If we need to get more data from the byte buffer, do so. (Loop getting
|
||||
one byte at a time to enforce endianness and avoid unaligned access.) */
|
||||
|
||||
while (bd->inbufBitCount<bits_wanted) {
|
||||
|
||||
/* If we need to read more data from file into byte buffer, do so */
|
||||
|
||||
if(bd->inbufPos==bd->inbufCount) {
|
||||
if((bd->inbufCount = read(bd->in_fd, bd->inbuf, IOBUF_SIZE)) <= 0)
|
||||
longjmp(bd->jmpbuf,RETVAL_UNEXPECTED_INPUT_EOF);
|
||||
bd->inbufPos=0;
|
||||
}
|
||||
|
||||
/* Avoid 32-bit overflow (dump bit buffer to top of output) */
|
||||
|
||||
if(bd->inbufBitCount>=24) {
|
||||
bits=bd->inbufBits&((1<<bd->inbufBitCount)-1);
|
||||
bits_wanted-=bd->inbufBitCount;
|
||||
bits<<=bits_wanted;
|
||||
bd->inbufBitCount=0;
|
||||
}
|
||||
|
||||
/* Grab next 8 bits of input from buffer. */
|
||||
|
||||
bd->inbufBits=(bd->inbufBits<<8)|bd->inbuf[bd->inbufPos++];
|
||||
bd->inbufBitCount+=8;
|
||||
}
|
||||
|
||||
/* Calculate result */
|
||||
|
||||
bd->inbufBitCount-=bits_wanted;
|
||||
bits|=(bd->inbufBits>>bd->inbufBitCount)&((1<<bits_wanted)-1);
|
||||
|
||||
@@ -134,8 +146,6 @@ static unsigned int get_bits(bunzip_data *bd, char bits_wanted)
|
||||
|
||||
static int get_next_block(bunzip_data *bd)
|
||||
{
|
||||
/* Note: Ignore the warning about hufGroup, base and limit being used uninitialized.
|
||||
* They will be initialized on the fist pass of the loop. */
|
||||
struct group_data *hufGroup;
|
||||
int dbufCount,nextSym,dbufSize,groupCount,*base,*limit,selector,
|
||||
i,j,k,t,runPos,symCount,symTotal,nSelectors,byteCount[256];
|
||||
@@ -145,26 +155,34 @@ static int get_next_block(bunzip_data *bd)
|
||||
dbuf=bd->dbuf;
|
||||
dbufSize=bd->dbufSize;
|
||||
selectors=bd->selectors;
|
||||
|
||||
/* Reset longjmp I/O error handling */
|
||||
|
||||
i=setjmp(bd->jmpbuf);
|
||||
if(i) return i;
|
||||
|
||||
/* Read in header signature and CRC, then validate signature.
|
||||
(last block signature means CRC is for whole file, return now) */
|
||||
|
||||
i = get_bits(bd,24);
|
||||
j = get_bits(bd,24);
|
||||
bd->headerCRC=get_bits(bd,32);
|
||||
if ((i == 0x177245) && (j == 0x385090)) return RETVAL_LAST_BLOCK;
|
||||
if ((i != 0x314159) || (j != 0x265359)) return RETVAL_NOT_BZIP_DATA;
|
||||
|
||||
/* We can add support for blockRandomised if anybody complains. There was
|
||||
some code for this in busybox 1.0.0-pre3, but nobody ever noticed that
|
||||
it didn't actually work. */
|
||||
|
||||
if(get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT;
|
||||
if((origPtr=get_bits(bd,24)) > dbufSize) return RETVAL_DATA_ERROR;
|
||||
|
||||
/* mapping table: if some byte values are never used (encoding things
|
||||
like ascii text), the compression code removes the gaps to have fewer
|
||||
symbols to deal with, and writes a sparse bitfield indicating which
|
||||
values were present. We make a translation table to convert the symbols
|
||||
back to the corresponding bytes. */
|
||||
|
||||
t=get_bits(bd, 16);
|
||||
symTotal=0;
|
||||
for (i=0;i<16;i++) {
|
||||
@@ -174,60 +192,81 @@ static int get_next_block(bunzip_data *bd)
|
||||
if(k&(1<<(15-j))) symToByte[symTotal++]=(16*i)+j;
|
||||
}
|
||||
}
|
||||
|
||||
/* How many different Huffman coding groups does this block use? */
|
||||
|
||||
groupCount=get_bits(bd,3);
|
||||
if (groupCount<2 || groupCount>MAX_GROUPS) return RETVAL_DATA_ERROR;
|
||||
|
||||
/* nSelectors: Every GROUP_SIZE many symbols we select a new Huffman coding
|
||||
group. Read in the group selector list, which is stored as MTF encoded
|
||||
bit runs. (MTF=Move To Front, as each value is used it's moved to the
|
||||
start of the list.) */
|
||||
|
||||
if(!(nSelectors=get_bits(bd, 15))) return RETVAL_DATA_ERROR;
|
||||
for(i=0; i<groupCount; i++) mtfSymbol[i] = i;
|
||||
for(i=0; i<nSelectors; i++) {
|
||||
|
||||
/* Get next value */
|
||||
|
||||
for(j=0;get_bits(bd,1);j++) if (j>=groupCount) return RETVAL_DATA_ERROR;
|
||||
|
||||
/* Decode MTF to get the next selector */
|
||||
|
||||
uc = mtfSymbol[j];
|
||||
for(;j;j--) mtfSymbol[j] = mtfSymbol[j-1];
|
||||
mtfSymbol[0]=selectors[i]=uc;
|
||||
}
|
||||
|
||||
/* Read the Huffman coding tables for each group, which code for symTotal
|
||||
literal symbols, plus two run symbols (RUNA, RUNB) */
|
||||
|
||||
symCount=symTotal+2;
|
||||
for (j=0; j<groupCount; j++) {
|
||||
unsigned char length[MAX_SYMBOLS],temp[MAX_HUFCODE_BITS+1];
|
||||
int minLen, maxLen, pp;
|
||||
|
||||
/* Read Huffman code lengths for each symbol. They're stored in
|
||||
a way similar to mtf; record a starting value for the first symbol,
|
||||
and an offset from the previous value for everys symbol after that.
|
||||
(Subtracting 1 before the loop and then adding it back at the end is
|
||||
an optimization that makes the test inside the loop simpler: symbol
|
||||
length 0 becomes negative, so an unsigned inequality catches it.) */
|
||||
|
||||
t=get_bits(bd, 5)-1;
|
||||
for (i = 0; i < symCount; i++) {
|
||||
for(;;) {
|
||||
if (((unsigned)t) > (MAX_HUFCODE_BITS-1))
|
||||
return RETVAL_DATA_ERROR;
|
||||
|
||||
/* If first bit is 0, stop. Else second bit indicates whether
|
||||
to increment or decrement the value. Optimization: grab 2
|
||||
bits and unget the second if the first was 0. */
|
||||
|
||||
k = get_bits(bd,2);
|
||||
if (k < 2) {
|
||||
bd->inbufBitCount++;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Add one if second bit 1, else subtract 1. Avoids if/else */
|
||||
|
||||
t+=(((k+1)&2)-1);
|
||||
}
|
||||
|
||||
/* Correct for the initial -1, to get the final symbol length */
|
||||
|
||||
length[i]=t+1;
|
||||
}
|
||||
|
||||
/* Find largest and smallest lengths in this group */
|
||||
|
||||
minLen=maxLen=length[0];
|
||||
for(i = 1; i < symCount; i++) {
|
||||
if(length[i] > maxLen) maxLen = length[i];
|
||||
else if(length[i] < minLen) minLen = length[i];
|
||||
}
|
||||
|
||||
/* Calculate permute[], base[], and limit[] tables from length[].
|
||||
*
|
||||
* permute[] is the lookup table for converting Huffman coded symbols
|
||||
@@ -238,36 +277,47 @@ static int get_next_block(bunzip_data *bd)
|
||||
* number of bits can have. This is how the Huffman codes can vary in
|
||||
* length: each code with a value>limit[length] needs another bit.
|
||||
*/
|
||||
|
||||
hufGroup=bd->groups+j;
|
||||
hufGroup->minLen = minLen;
|
||||
hufGroup->maxLen = maxLen;
|
||||
|
||||
/* Note that minLen can't be smaller than 1, so we adjust the base
|
||||
and limit array pointers so we're not always wasting the first
|
||||
entry. We do this again when using them (during symbol decoding).*/
|
||||
|
||||
base=hufGroup->base-1;
|
||||
limit=hufGroup->limit-1;
|
||||
|
||||
/* Calculate permute[]. Concurently, initialize temp[] and limit[]. */
|
||||
|
||||
pp=0;
|
||||
for(i=minLen;i<=maxLen;i++) {
|
||||
temp[i]=limit[i]=0;
|
||||
for(t=0;t<symCount;t++)
|
||||
if(length[t]==i) hufGroup->permute[pp++] = t;
|
||||
}
|
||||
|
||||
/* Count symbols coded for at each bit length */
|
||||
|
||||
for (i=0;i<symCount;i++) temp[length[i]]++;
|
||||
|
||||
/* Calculate limit[] (the largest symbol-coding value at each bit
|
||||
* length, which is (previous limit<<1)+symbols at this level), and
|
||||
* base[] (number of symbols to ignore at each bit length, which is
|
||||
* limit minus the cumulative count of symbols coded for already). */
|
||||
|
||||
pp=t=0;
|
||||
for (i=minLen; i<maxLen; i++) {
|
||||
pp+=temp[i];
|
||||
|
||||
/* We read the largest possible symbol size and then unget bits
|
||||
after determining how many we need, and those extra bits could
|
||||
be set to anything. (They're noise from future symbols.) At
|
||||
each level we're really only interested in the first few bits,
|
||||
so here we set all the trailing to-be-ignored bits to 1 so they
|
||||
don't affect the value>limit[length] comparison. */
|
||||
|
||||
limit[i]= (pp << (maxLen - i)) - 1;
|
||||
pp<<=1;
|
||||
base[i+1]=pp-(t+=temp[i]);
|
||||
@@ -276,27 +326,34 @@ static int get_next_block(bunzip_data *bd)
|
||||
limit[maxLen]=pp+temp[maxLen]-1;
|
||||
base[minLen]=0;
|
||||
}
|
||||
|
||||
/* We've finished reading and digesting the block header. Now read this
|
||||
block's Huffman coded symbols from the file and undo the Huffman coding
|
||||
and run length encoding, saving the result into dbuf[dbufCount++]=uc */
|
||||
|
||||
/* Initialize symbol occurrence counters and symbol Move To Front table */
|
||||
|
||||
for(i=0;i<256;i++) {
|
||||
byteCount[i] = 0;
|
||||
mtfSymbol[i]=(unsigned char)i;
|
||||
}
|
||||
|
||||
/* Loop through compressed symbols. */
|
||||
runPos=dbufCount=symCount=selector=0;
|
||||
|
||||
runPos=dbufCount=selector=0;
|
||||
for(;;) {
|
||||
/* Determine which Huffman coding group to use. */
|
||||
if(!(symCount--)) {
|
||||
symCount=GROUP_SIZE-1;
|
||||
if(selector>=nSelectors) return RETVAL_DATA_ERROR;
|
||||
hufGroup=bd->groups+selectors[selector++];
|
||||
base=hufGroup->base-1;
|
||||
limit=hufGroup->limit-1;
|
||||
}
|
||||
|
||||
/* fetch next Huffman coding group from list. */
|
||||
|
||||
symCount=GROUP_SIZE-1;
|
||||
if(selector>=nSelectors) return RETVAL_DATA_ERROR;
|
||||
hufGroup=bd->groups+selectors[selector++];
|
||||
base=hufGroup->base-1;
|
||||
limit=hufGroup->limit-1;
|
||||
continue_this_group:
|
||||
|
||||
/* Read next Huffman-coded symbol. */
|
||||
|
||||
/* Note: It is far cheaper to read maxLen bits and back up than it is
|
||||
to read minLen bits and then an additional bit at a time, testing
|
||||
as we go. Because there is a trailing last block (with file CRC),
|
||||
@@ -306,6 +363,7 @@ static int get_next_block(bunzip_data *bd)
|
||||
dry). The following (up to got_huff_bits:) is equivalent to
|
||||
j=get_bits(bd,hufGroup->maxLen);
|
||||
*/
|
||||
|
||||
while (bd->inbufBitCount<hufGroup->maxLen) {
|
||||
if(bd->inbufPos==bd->inbufCount) {
|
||||
j = get_bits(bd,hufGroup->maxLen);
|
||||
@@ -316,27 +374,37 @@ static int get_next_block(bunzip_data *bd)
|
||||
};
|
||||
bd->inbufBitCount-=hufGroup->maxLen;
|
||||
j = (bd->inbufBits>>bd->inbufBitCount)&((1<<hufGroup->maxLen)-1);
|
||||
|
||||
got_huff_bits:
|
||||
|
||||
/* Figure how how many bits are in next symbol and unget extras */
|
||||
|
||||
i=hufGroup->minLen;
|
||||
while(j>limit[i]) ++i;
|
||||
bd->inbufBitCount += (hufGroup->maxLen - i);
|
||||
|
||||
/* Huffman decode value to get nextSym (with bounds checking) */
|
||||
|
||||
if ((i > hufGroup->maxLen)
|
||||
|| (((unsigned)(j=(j>>(hufGroup->maxLen-i))-base[i]))
|
||||
>= MAX_SYMBOLS))
|
||||
return RETVAL_DATA_ERROR;
|
||||
nextSym = hufGroup->permute[j];
|
||||
|
||||
/* We have now decoded the symbol, which indicates either a new literal
|
||||
byte, or a repeated run of the most recent literal byte. First,
|
||||
check if nextSym indicates a repeated run, and if so loop collecting
|
||||
how many times to repeat the last literal. */
|
||||
|
||||
if (((unsigned)nextSym) <= SYMBOL_RUNB) { /* RUNA or RUNB */
|
||||
|
||||
/* If this is the start of a new run, zero out counter */
|
||||
|
||||
if(!runPos) {
|
||||
runPos = 1;
|
||||
t = 0;
|
||||
}
|
||||
|
||||
/* Neat trick that saves 1 symbol: instead of or-ing 0 or 1 at
|
||||
each bit position, add 1 or 2 instead. For example,
|
||||
1011 is 1<<0 + 1<<1 + 2<<2. 1010 is 2<<0 + 2<<1 + 1<<2.
|
||||
@@ -344,14 +412,17 @@ got_huff_bits:
|
||||
the basic or 0/1 method (except all bits 0, which would use no
|
||||
symbols, but a run of length 0 doesn't mean anything in this
|
||||
context). Thus space is saved. */
|
||||
|
||||
t += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */
|
||||
runPos <<= 1;
|
||||
continue;
|
||||
if(runPos < dbufSize) runPos <<= 1;
|
||||
goto end_of_huffman_loop;
|
||||
}
|
||||
|
||||
/* When we hit the first non-run symbol after a run, we now know
|
||||
how many times to repeat the last literal, so append that many
|
||||
copies to our buffer of decoded symbols (dbuf) now. (The last
|
||||
literal used is the one at the head of the mtfSymbol array.) */
|
||||
|
||||
if(runPos) {
|
||||
runPos=0;
|
||||
if(dbufCount+t>=dbufSize) return RETVAL_DATA_ERROR;
|
||||
@@ -360,8 +431,11 @@ got_huff_bits:
|
||||
byteCount[uc] += t;
|
||||
while(t--) dbuf[dbufCount++]=uc;
|
||||
}
|
||||
|
||||
/* Is this the terminating symbol? */
|
||||
|
||||
if(nextSym>symTotal) break;
|
||||
|
||||
/* At this point, nextSym indicates a new literal character. Subtract
|
||||
one to get the position in the MTF array at which this literal is
|
||||
currently to be found. (Note that the result can't be -1 or 0,
|
||||
@@ -369,44 +443,62 @@ got_huff_bits:
|
||||
first symbol in the mtf array, position 0, would have been handled
|
||||
as part of a run above. Therefore 1 unused mtf position minus
|
||||
2 non-literal nextSym values equals -1.) */
|
||||
|
||||
if(dbufCount>=dbufSize) return RETVAL_DATA_ERROR;
|
||||
i = nextSym - 1;
|
||||
uc = mtfSymbol[i];
|
||||
|
||||
/* Adjust the MTF array. Since we typically expect to move only a
|
||||
* small number of symbols, and are bound by 256 in any case, using
|
||||
* memmove here would typically be bigger and slower due to function
|
||||
* call overhead and other assorted setup costs. */
|
||||
|
||||
do {
|
||||
mtfSymbol[i] = mtfSymbol[i-1];
|
||||
} while (--i);
|
||||
mtfSymbol[0] = uc;
|
||||
uc=symToByte[uc];
|
||||
|
||||
/* We have our literal byte. Save it into dbuf. */
|
||||
|
||||
byteCount[uc]++;
|
||||
dbuf[dbufCount++] = (unsigned int)uc;
|
||||
|
||||
/* Skip group initialization if we're not done with this group. Done
|
||||
* this way to avoid compiler warning. */
|
||||
|
||||
end_of_huffman_loop:
|
||||
if(symCount--) goto continue_this_group;
|
||||
}
|
||||
|
||||
/* At this point, we've read all the Huffman-coded symbols (and repeated
|
||||
runs) for this block from the input stream, and decoded them into the
|
||||
intermediate buffer. There are dbufCount many decoded bytes in dbuf[].
|
||||
Now undo the Burrows-Wheeler transform on dbuf.
|
||||
See http://dogma.net/markn/articles/bwt/bwt.htm
|
||||
*/
|
||||
|
||||
/* Turn byteCount into cumulative occurrence counts of 0 to n-1. */
|
||||
|
||||
j=0;
|
||||
for(i=0;i<256;i++) {
|
||||
k=j+byteCount[i];
|
||||
byteCount[i] = j;
|
||||
j=k;
|
||||
}
|
||||
|
||||
/* Figure out what order dbuf would be in if we sorted it. */
|
||||
|
||||
for (i=0;i<dbufCount;i++) {
|
||||
uc=(unsigned char)(dbuf[i] & 0xff);
|
||||
dbuf[byteCount[uc]] |= (i << 8);
|
||||
byteCount[uc]++;
|
||||
}
|
||||
|
||||
/* Decode first byte by hand to initialize "previous" byte. Note that it
|
||||
doesn't get output, and if the first three characters are identical
|
||||
it doesn't qualify as a run (hence writeRunCountdown=5). */
|
||||
|
||||
if(dbufCount) {
|
||||
if(origPtr>=dbufCount) return RETVAL_DATA_ERROR;
|
||||
bd->writePos=dbuf[origPtr];
|
||||
@@ -444,22 +536,32 @@ static int read_bunzip(bunzip_data *bd, char *outbuf, int len)
|
||||
Huffman-decoded a block into the intermediate buffer yet). */
|
||||
|
||||
if (bd->writeCopies) {
|
||||
|
||||
/* Inside the loop, writeCopies means extra copies (beyond 1) */
|
||||
|
||||
--bd->writeCopies;
|
||||
|
||||
/* Loop outputting bytes */
|
||||
|
||||
for(;;) {
|
||||
|
||||
/* If the output buffer is full, snapshot state and return */
|
||||
|
||||
if(gotcount >= len) {
|
||||
bd->writePos=pos;
|
||||
bd->writeCurrent=current;
|
||||
bd->writeCopies++;
|
||||
return len;
|
||||
}
|
||||
|
||||
/* Write next byte into output buffer, updating CRC */
|
||||
|
||||
outbuf[gotcount++] = current;
|
||||
bd->writeCRC=(((bd->writeCRC)<<8)
|
||||
^bd->crc32Table[((bd->writeCRC)>>24)^current]);
|
||||
|
||||
/* Loop now if we're outputting multiple copies of this byte */
|
||||
|
||||
if (bd->writeCopies) {
|
||||
--bd->writeCopies;
|
||||
continue;
|
||||
@@ -471,26 +573,38 @@ decode_next_byte:
|
||||
pos=dbuf[pos];
|
||||
current=pos&0xff;
|
||||
pos>>=8;
|
||||
|
||||
/* After 3 consecutive copies of the same byte, the 4th is a repeat
|
||||
count. We count down from 4 instead
|
||||
* of counting up because testing for non-zero is faster */
|
||||
|
||||
if(--bd->writeRunCountdown) {
|
||||
if(current!=previous) bd->writeRunCountdown=4;
|
||||
} else {
|
||||
|
||||
/* We have a repeated run, this byte indicates the count */
|
||||
|
||||
bd->writeCopies=current;
|
||||
current=previous;
|
||||
bd->writeRunCountdown=5;
|
||||
|
||||
/* Sometimes there are just 3 bytes (run length 0) */
|
||||
|
||||
if(!bd->writeCopies) goto decode_next_byte;
|
||||
|
||||
/* Subtract the 1 copy we'd output anyway to get extras */
|
||||
|
||||
--bd->writeCopies;
|
||||
}
|
||||
}
|
||||
|
||||
/* Decompression of this block completed successfully */
|
||||
|
||||
bd->writeCRC=~bd->writeCRC;
|
||||
bd->totalCRC=((bd->totalCRC<<1) | (bd->totalCRC>>31)) ^ bd->writeCRC;
|
||||
|
||||
/* If this block had a CRC error, force file level CRC error. */
|
||||
|
||||
if(bd->writeCRC!=bd->headerCRC) {
|
||||
bd->totalCRC=bd->headerCRC+1;
|
||||
return RETVAL_LAST_BLOCK;
|
||||
@@ -499,12 +613,13 @@ decode_next_byte:
|
||||
|
||||
/* Refill the intermediate buffer by Huffman-decoding next block of input */
|
||||
/* (previous is just a convenient unused temp variable here) */
|
||||
|
||||
previous=get_next_block(bd);
|
||||
if(previous) {
|
||||
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;
|
||||
@@ -513,41 +628,48 @@ decode_next_byte:
|
||||
/* Allocate the structure, read file header. If in_fd==-1, inbuf must contain
|
||||
a complete bunzip file (len bytes long). If in_fd!=-1, inbuf and len are
|
||||
ignored, and data is read from file handle into temporary buffer. */
|
||||
static int start_bunzip(bunzip_data **bdp, int in_fd, char *inbuf, int len)
|
||||
|
||||
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';
|
||||
|
||||
/* Figure out how much data to allocate */
|
||||
|
||||
i=sizeof(bunzip_data);
|
||||
if(in_fd!=-1) i+=IOBUF_SIZE;
|
||||
|
||||
/* 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 */
|
||||
|
||||
if(-1==(bd->in_fd=in_fd)) {
|
||||
bd->inbuf=inbuf;
|
||||
bd->inbufCount=len;
|
||||
} else bd->inbuf=(unsigned char *)(bd+1);
|
||||
|
||||
/* 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 */
|
||||
|
||||
i=setjmp(bd->jmpbuf);
|
||||
if(i) return i;
|
||||
|
||||
/* Ensure that file starts with "BZh['1'-'9']." */
|
||||
|
||||
i = get_bits(bd,32);
|
||||
if (((unsigned int)(i-BZh0-1)) >= 9) return RETVAL_NOT_BZIP_DATA;
|
||||
|
||||
/* Fourth byte (ascii '1'-'9'), indicates block size in units of 100k of
|
||||
uncompressed data. Allocate intermediate buffer for block. */
|
||||
|
||||
bd->dbufSize=100000*(i-BZh0);
|
||||
|
||||
bd->dbuf=xmalloc(bd->dbufSize * sizeof(int));
|
||||
@@ -556,7 +678,8 @@ static int start_bunzip(bunzip_data **bdp, int in_fd, char *inbuf, int len)
|
||||
|
||||
/* Example usage: decompress src_fd to dst_fd. (Stops at end of bzip data,
|
||||
not end of file.) */
|
||||
extern int uncompressStream(int src_fd, int dst_fd)
|
||||
|
||||
int uncompressStream(int src_fd, int dst_fd)
|
||||
{
|
||||
char *outbuf;
|
||||
bunzip_data *bd;
|
||||
@@ -572,20 +695,21 @@ extern int uncompressStream(int src_fd, int dst_fd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check CRC and release memory */
|
||||
|
||||
if(i==RETVAL_LAST_BLOCK) {
|
||||
if (bd->headerCRC!=bd->totalCRC) {
|
||||
bb_error_msg("Data integrity error when decompressing.");
|
||||
} else {
|
||||
i=RETVAL_OK;
|
||||
}
|
||||
}
|
||||
else if (i==RETVAL_UNEXPECTED_OUTPUT_EOF) {
|
||||
} else if (i==RETVAL_UNEXPECTED_OUTPUT_EOF) {
|
||||
bb_error_msg("Compressed file ends unexpectedly");
|
||||
} else {
|
||||
bb_error_msg("Decompression failed");
|
||||
}
|
||||
if(bd->dbuf) free(bd->dbuf);
|
||||
free(bd->dbuf);
|
||||
free(bd);
|
||||
free(outbuf);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "config.h"
|
||||
/* vi: set sw=4 ts=4: */
|
||||
#include "libbb.h"
|
||||
|
||||
/* uncompress for busybox -- (c) 2002 Robert Griebl
|
||||
@@ -65,23 +65,20 @@
|
||||
#define MAXCODE(n) (1L << (n))
|
||||
|
||||
/* Block compress mode -C compatible with 2.0 */
|
||||
int block_mode = BLOCK_MODE;
|
||||
static int block_mode = BLOCK_MODE;
|
||||
|
||||
/* user settable max # bits/code */
|
||||
int maxbits = BITS;
|
||||
|
||||
/* Exitcode of compress (-1 no file compressed) */
|
||||
int exit_code = -1;
|
||||
static int maxbits = BITS;
|
||||
|
||||
/* Input buffer */
|
||||
unsigned char inbuf[IBUFSIZ + 64];
|
||||
static unsigned char inbuf[IBUFSIZ + 64];
|
||||
|
||||
/* Output buffer */
|
||||
unsigned char outbuf[OBUFSIZ + 2048];
|
||||
static unsigned char outbuf[OBUFSIZ + 2048];
|
||||
|
||||
|
||||
long int htab[HSIZE];
|
||||
unsigned short codetab[HSIZE];
|
||||
static unsigned char htab[HSIZE];
|
||||
static unsigned short codetab[HSIZE];
|
||||
|
||||
#define htabof(i) htab[i]
|
||||
#define codetabof(i) codetab[i]
|
||||
@@ -99,7 +96,7 @@ unsigned short codetab[HSIZE];
|
||||
* with those of the compress() routine. See the definitions above.
|
||||
*/
|
||||
|
||||
extern int uncompress(int fd_in, int fd_out)
|
||||
int uncompress(int fd_in, int fd_out)
|
||||
{
|
||||
unsigned char *stackp;
|
||||
long int code;
|
||||
@@ -119,7 +116,7 @@ extern 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;
|
||||
|
||||
@@ -0,0 +1,470 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Small lzma deflate implementation.
|
||||
* 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
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include "libbb.h"
|
||||
#include "unarchive.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 {
|
||||
uint8_t pos;
|
||||
uint32_t dict_size;
|
||||
uint64_t dst_size;
|
||||
} __attribute__ ((packed)) lzma_header_t;
|
||||
|
||||
|
||||
#define LZMA_BASE_SIZE 1846
|
||||
#define LZMA_LIT_SIZE 768
|
||||
|
||||
#define LZMA_NUM_POS_BITS_MAX 4
|
||||
|
||||
#define LZMA_LEN_NUM_LOW_BITS 3
|
||||
#define LZMA_LEN_NUM_MID_BITS 3
|
||||
#define LZMA_LEN_NUM_HIGH_BITS 8
|
||||
|
||||
#define LZMA_LEN_CHOICE 0
|
||||
#define LZMA_LEN_CHOICE_2 (LZMA_LEN_CHOICE + 1)
|
||||
#define LZMA_LEN_LOW (LZMA_LEN_CHOICE_2 + 1)
|
||||
#define LZMA_LEN_MID (LZMA_LEN_LOW \
|
||||
+ (1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_LOW_BITS)))
|
||||
#define LZMA_LEN_HIGH (LZMA_LEN_MID \
|
||||
+(1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_MID_BITS)))
|
||||
#define LZMA_NUM_LEN_PROBS (LZMA_LEN_HIGH + (1 << LZMA_LEN_NUM_HIGH_BITS))
|
||||
|
||||
#define LZMA_NUM_STATES 12
|
||||
#define LZMA_NUM_LIT_STATES 7
|
||||
|
||||
#define LZMA_START_POS_MODEL_INDEX 4
|
||||
#define LZMA_END_POS_MODEL_INDEX 14
|
||||
#define LZMA_NUM_FULL_DISTANCES (1 << (LZMA_END_POS_MODEL_INDEX >> 1))
|
||||
|
||||
#define LZMA_NUM_POS_SLOT_BITS 6
|
||||
#define LZMA_NUM_LEN_TO_POS_STATES 4
|
||||
|
||||
#define LZMA_NUM_ALIGN_BITS 4
|
||||
|
||||
#define LZMA_MATCH_MIN_LEN 2
|
||||
|
||||
#define LZMA_IS_MATCH 0
|
||||
#define LZMA_IS_REP (LZMA_IS_MATCH + (LZMA_NUM_STATES <<LZMA_NUM_POS_BITS_MAX))
|
||||
#define LZMA_IS_REP_G0 (LZMA_IS_REP + LZMA_NUM_STATES)
|
||||
#define LZMA_IS_REP_G1 (LZMA_IS_REP_G0 + LZMA_NUM_STATES)
|
||||
#define LZMA_IS_REP_G2 (LZMA_IS_REP_G1 + LZMA_NUM_STATES)
|
||||
#define LZMA_IS_REP_0_LONG (LZMA_IS_REP_G2 + LZMA_NUM_STATES)
|
||||
#define LZMA_POS_SLOT (LZMA_IS_REP_0_LONG \
|
||||
+ (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX))
|
||||
#define LZMA_SPEC_POS (LZMA_POS_SLOT \
|
||||
+(LZMA_NUM_LEN_TO_POS_STATES << LZMA_NUM_POS_SLOT_BITS))
|
||||
#define LZMA_ALIGN (LZMA_SPEC_POS \
|
||||
+ LZMA_NUM_FULL_DISTANCES - LZMA_END_POS_MODEL_INDEX)
|
||||
#define LZMA_LEN_CODER (LZMA_ALIGN + (1 << LZMA_NUM_ALIGN_BITS))
|
||||
#define LZMA_REP_LEN_CODER (LZMA_LEN_CODER + LZMA_NUM_LEN_PROBS)
|
||||
#define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS)
|
||||
|
||||
|
||||
int unlzma(int src_fd, int dst_fd)
|
||||
{
|
||||
lzma_header_t header;
|
||||
int lc, pb, lp;
|
||||
uint32_t pos_state_mask;
|
||||
uint32_t literal_pos_mask;
|
||||
uint32_t pos;
|
||||
uint16_t *p;
|
||||
uint16_t *prob;
|
||||
uint16_t *prob_lit;
|
||||
int num_bits;
|
||||
int num_probs;
|
||||
rc_t rc;
|
||||
int i, mi;
|
||||
uint8_t *buffer;
|
||||
uint8_t previous_byte = 0;
|
||||
size_t buffer_pos = 0, global_pos = 0;
|
||||
int len = 0;
|
||||
int state = 0;
|
||||
uint32_t rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
|
||||
|
||||
if (read(src_fd, &header, sizeof(header)) != sizeof(header))
|
||||
bb_error_msg_and_die("can't read header");
|
||||
|
||||
if (header.pos >= (9 * 5 * 5))
|
||||
bb_error_msg_and_die("bad header");
|
||||
mi = header.pos / 9;
|
||||
lc = header.pos % 9;
|
||||
pb = mi / 5;
|
||||
lp = mi % 5;
|
||||
pos_state_mask = (1 << pb) - 1;
|
||||
literal_pos_mask = (1 << lp) - 1;
|
||||
|
||||
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;
|
||||
|
||||
buffer = xmalloc(MIN(header.dst_size, header.dict_size));
|
||||
|
||||
num_probs = LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp));
|
||||
p = xmalloc(num_probs * sizeof(*p));
|
||||
num_probs = LZMA_LITERAL + (LZMA_LIT_SIZE << (lc + lp));
|
||||
for (i = 0; i < num_probs; i++)
|
||||
p[i] = (1 << RC_MODEL_TOTAL_BITS) >> 1;
|
||||
|
||||
rc_init(&rc, src_fd, 0x10000);
|
||||
|
||||
while (global_pos + buffer_pos < header.dst_size) {
|
||||
int pos_state = (buffer_pos + global_pos) & pos_state_mask;
|
||||
|
||||
prob =
|
||||
p + LZMA_IS_MATCH + (state << LZMA_NUM_POS_BITS_MAX) + pos_state;
|
||||
if (rc_is_bit_0(&rc, prob)) {
|
||||
mi = 1;
|
||||
rc_update_bit_0(&rc, prob);
|
||||
prob = (p + LZMA_LITERAL + (LZMA_LIT_SIZE
|
||||
* ((((buffer_pos + global_pos) & literal_pos_mask) << lc)
|
||||
+ (previous_byte >> (8 - lc)))));
|
||||
|
||||
if (state >= LZMA_NUM_LIT_STATES) {
|
||||
int match_byte;
|
||||
|
||||
pos = buffer_pos - rep0;
|
||||
while (pos >= header.dict_size)
|
||||
pos += header.dict_size;
|
||||
match_byte = buffer[pos];
|
||||
do {
|
||||
int bit;
|
||||
|
||||
match_byte <<= 1;
|
||||
bit = match_byte & 0x100;
|
||||
prob_lit = prob + 0x100 + bit + mi;
|
||||
if (rc_get_bit(&rc, prob_lit, &mi)) {
|
||||
if (!bit)
|
||||
break;
|
||||
} else {
|
||||
if (bit)
|
||||
break;
|
||||
}
|
||||
} while (mi < 0x100);
|
||||
}
|
||||
while (mi < 0x100) {
|
||||
prob_lit = prob + mi;
|
||||
rc_get_bit(&rc, prob_lit, &mi);
|
||||
}
|
||||
previous_byte = (uint8_t) mi;
|
||||
|
||||
buffer[buffer_pos++] = previous_byte;
|
||||
if (buffer_pos == header.dict_size) {
|
||||
buffer_pos = 0;
|
||||
global_pos += header.dict_size;
|
||||
write(dst_fd, buffer, header.dict_size);
|
||||
}
|
||||
if (state < 4)
|
||||
state = 0;
|
||||
else if (state < 10)
|
||||
state -= 3;
|
||||
else
|
||||
state -= 6;
|
||||
} else {
|
||||
int offset;
|
||||
uint16_t *prob_len;
|
||||
|
||||
rc_update_bit_1(&rc, prob);
|
||||
prob = p + LZMA_IS_REP + state;
|
||||
if (rc_is_bit_0(&rc, prob)) {
|
||||
rc_update_bit_0(&rc, prob);
|
||||
rep3 = rep2;
|
||||
rep2 = rep1;
|
||||
rep1 = rep0;
|
||||
state = state < LZMA_NUM_LIT_STATES ? 0 : 3;
|
||||
prob = p + LZMA_LEN_CODER;
|
||||
} else {
|
||||
rc_update_bit_1(&rc, prob);
|
||||
prob = p + LZMA_IS_REP_G0 + state;
|
||||
if (rc_is_bit_0(&rc, prob)) {
|
||||
rc_update_bit_0(&rc, prob);
|
||||
prob = (p + LZMA_IS_REP_0_LONG
|
||||
+ (state << LZMA_NUM_POS_BITS_MAX) + pos_state);
|
||||
if (rc_is_bit_0(&rc, prob)) {
|
||||
rc_update_bit_0(&rc, prob);
|
||||
|
||||
state = state < LZMA_NUM_LIT_STATES ? 9 : 11;
|
||||
pos = buffer_pos - rep0;
|
||||
while (pos >= header.dict_size)
|
||||
pos += header.dict_size;
|
||||
previous_byte = buffer[pos];
|
||||
buffer[buffer_pos++] = previous_byte;
|
||||
if (buffer_pos == header.dict_size) {
|
||||
buffer_pos = 0;
|
||||
global_pos += header.dict_size;
|
||||
write(dst_fd, buffer, header.dict_size);
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
rc_update_bit_1(&rc, prob);
|
||||
}
|
||||
} else {
|
||||
uint32_t distance;
|
||||
|
||||
rc_update_bit_1(&rc, prob);
|
||||
prob = p + LZMA_IS_REP_G1 + state;
|
||||
if (rc_is_bit_0(&rc, prob)) {
|
||||
rc_update_bit_0(&rc, prob);
|
||||
distance = rep1;
|
||||
} else {
|
||||
rc_update_bit_1(&rc, prob);
|
||||
prob = p + LZMA_IS_REP_G2 + state;
|
||||
if (rc_is_bit_0(&rc, prob)) {
|
||||
rc_update_bit_0(&rc, prob);
|
||||
distance = rep2;
|
||||
} else {
|
||||
rc_update_bit_1(&rc, prob);
|
||||
distance = rep3;
|
||||
rep3 = rep2;
|
||||
}
|
||||
rep2 = rep1;
|
||||
}
|
||||
rep1 = rep0;
|
||||
rep0 = distance;
|
||||
}
|
||||
state = state < LZMA_NUM_LIT_STATES ? 8 : 11;
|
||||
prob = p + LZMA_REP_LEN_CODER;
|
||||
}
|
||||
|
||||
prob_len = prob + LZMA_LEN_CHOICE;
|
||||
if (rc_is_bit_0(&rc, prob_len)) {
|
||||
rc_update_bit_0(&rc, prob_len);
|
||||
prob_len = (prob + LZMA_LEN_LOW
|
||||
+ (pos_state << LZMA_LEN_NUM_LOW_BITS));
|
||||
offset = 0;
|
||||
num_bits = LZMA_LEN_NUM_LOW_BITS;
|
||||
} else {
|
||||
rc_update_bit_1(&rc, prob_len);
|
||||
prob_len = prob + LZMA_LEN_CHOICE_2;
|
||||
if (rc_is_bit_0(&rc, prob_len)) {
|
||||
rc_update_bit_0(&rc, prob_len);
|
||||
prob_len = (prob + LZMA_LEN_MID
|
||||
+ (pos_state << LZMA_LEN_NUM_MID_BITS));
|
||||
offset = 1 << LZMA_LEN_NUM_LOW_BITS;
|
||||
num_bits = LZMA_LEN_NUM_MID_BITS;
|
||||
} else {
|
||||
rc_update_bit_1(&rc, prob_len);
|
||||
prob_len = prob + LZMA_LEN_HIGH;
|
||||
offset = ((1 << LZMA_LEN_NUM_LOW_BITS)
|
||||
+ (1 << LZMA_LEN_NUM_MID_BITS));
|
||||
num_bits = LZMA_LEN_NUM_HIGH_BITS;
|
||||
}
|
||||
}
|
||||
rc_bit_tree_decode(&rc, prob_len, num_bits, &len);
|
||||
len += offset;
|
||||
|
||||
if (state < 4) {
|
||||
int pos_slot;
|
||||
|
||||
state += LZMA_NUM_LIT_STATES;
|
||||
prob =
|
||||
p + LZMA_POS_SLOT +
|
||||
((len <
|
||||
LZMA_NUM_LEN_TO_POS_STATES ? len :
|
||||
LZMA_NUM_LEN_TO_POS_STATES - 1)
|
||||
<< LZMA_NUM_POS_SLOT_BITS);
|
||||
rc_bit_tree_decode(&rc, prob, LZMA_NUM_POS_SLOT_BITS,
|
||||
&pos_slot);
|
||||
if (pos_slot >= LZMA_START_POS_MODEL_INDEX) {
|
||||
num_bits = (pos_slot >> 1) - 1;
|
||||
rep0 = 2 | (pos_slot & 1);
|
||||
if (pos_slot < LZMA_END_POS_MODEL_INDEX) {
|
||||
rep0 <<= num_bits;
|
||||
prob = p + LZMA_SPEC_POS + rep0 - pos_slot - 1;
|
||||
} else {
|
||||
num_bits -= LZMA_NUM_ALIGN_BITS;
|
||||
while (num_bits--)
|
||||
rep0 = (rep0 << 1) | rc_direct_bit(&rc);
|
||||
prob = p + LZMA_ALIGN;
|
||||
rep0 <<= LZMA_NUM_ALIGN_BITS;
|
||||
num_bits = LZMA_NUM_ALIGN_BITS;
|
||||
}
|
||||
i = 1;
|
||||
mi = 1;
|
||||
while (num_bits--) {
|
||||
if (rc_get_bit(&rc, prob + mi, &mi))
|
||||
rep0 |= i;
|
||||
i <<= 1;
|
||||
}
|
||||
} else
|
||||
rep0 = pos_slot;
|
||||
if (++rep0 == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
len += LZMA_MATCH_MIN_LEN;
|
||||
|
||||
do {
|
||||
pos = buffer_pos - rep0;
|
||||
while (pos >= header.dict_size)
|
||||
pos += header.dict_size;
|
||||
previous_byte = buffer[pos];
|
||||
buffer[buffer_pos++] = previous_byte;
|
||||
if (buffer_pos == header.dict_size) {
|
||||
buffer_pos = 0;
|
||||
global_pos += header.dict_size;
|
||||
write(dst_fd, buffer, header.dict_size);
|
||||
}
|
||||
len--;
|
||||
} while (len != 0 && buffer_pos < header.dst_size);
|
||||
}
|
||||
}
|
||||
|
||||
write(dst_fd, buffer, buffer_pos);
|
||||
rc_free(&rc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -16,20 +16,10 @@
|
||||
*
|
||||
* read_gz interface + associated hacking 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
|
||||
*
|
||||
* Fixed huft_build() so decoding end-of-block code does not grab more bits
|
||||
* than necessary (this is required by unzip applet), added inflate_cleanup()
|
||||
* to free leaked bytebuffer memory (used in unzip.c), and some minor style
|
||||
* guide cleanups by Ed Clark
|
||||
*
|
||||
* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
|
||||
* Copyright (C) 1992-1993 Jean-loup Gailly
|
||||
@@ -38,39 +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 "config.h"
|
||||
#include "busybox.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
typedef struct huft_s {
|
||||
@@ -88,11 +53,11 @@ static unsigned int gunzip_outbuf_count; /* bytes in output buffer */
|
||||
|
||||
/* gunzip_window size--must be a power of two, and
|
||||
* at least 32K for zip's deflate method */
|
||||
static const int gunzip_wsize = 0x8000;
|
||||
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) */
|
||||
@@ -116,26 +81,26 @@ static const unsigned short mask_bits[] = {
|
||||
/* Copy lengths for literal codes 257..285 */
|
||||
static const unsigned short cplens[] = {
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
|
||||
67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
|
||||
67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
|
||||
};
|
||||
|
||||
/* note: see note #13 above about the 258 in this list. */
|
||||
/* Extra bits for literal codes 257..285 */
|
||||
static const unsigned char cplext[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5,
|
||||
5, 5, 5, 0, 99, 99
|
||||
5, 5, 5, 0, 99, 99
|
||||
}; /* 99==invalid */
|
||||
|
||||
/* Copy offsets for distance codes 0..29 */
|
||||
static const unsigned short cpdist[] = {
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513,
|
||||
769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
|
||||
769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
|
||||
};
|
||||
|
||||
/* Extra bits for distance codes */
|
||||
static const unsigned char cpdext[] = {
|
||||
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10,
|
||||
11, 11, 12, 12, 13, 13
|
||||
11, 11, 12, 12, 13, 13
|
||||
};
|
||||
|
||||
/* Tables for deflate from PKZIP's appnote.txt. */
|
||||
@@ -151,7 +116,9 @@ 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() */
|
||||
bytebuffer_size = 4 + 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;
|
||||
}
|
||||
bitbuffer |= ((unsigned int) bytebuffer[bytebuffer_offset]) << *current;
|
||||
@@ -161,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 *) malloc(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
|
||||
@@ -225,70 +163,60 @@ 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, int *m)
|
||||
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)
|
||||
{
|
||||
unsigned a; /* counter for codes of length k */
|
||||
unsigned a; /* counter for codes of length k */
|
||||
unsigned c[BMAX + 1]; /* bit length count table */
|
||||
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 */
|
||||
int l; /* bits per table (returned in m) */
|
||||
register unsigned *p; /* pointer into c[], b[], or v[] */
|
||||
register 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 */
|
||||
register int w; /* bits before this table == (l * h) */
|
||||
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 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 */
|
||||
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 */
|
||||
unsigned z; /* number of entries in current table */
|
||||
unsigned *xp; /* pointer into x */
|
||||
int y; /* number of dummy codes added */
|
||||
unsigned z; /* number of entries in current table */
|
||||
|
||||
/* Length of EOB code, if any */
|
||||
eob_len = n > 256 ? b[256] : BMAX;
|
||||
|
||||
/* Generate counts for each bit length */
|
||||
memset((void *) (c), 0, sizeof(c));
|
||||
memset((void *)c, 0, sizeof(c));
|
||||
p = b;
|
||||
i = n;
|
||||
do {
|
||||
c[*p]++; /* assume all entries <= BMAX */
|
||||
p++; /* Can't combine with above line (Solaris bug) */
|
||||
c[*p]++; /* assume all entries <= BMAX */
|
||||
p++; /* Can't combine with above line (Solaris bug) */
|
||||
} while (--i);
|
||||
if (c[0] == n) { /* null input--all zero length codes */
|
||||
if (c[0] == n) { /* null input--all zero length codes */
|
||||
*t = (huft_t *) NULL;
|
||||
*m = 0;
|
||||
return 0;
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Find minimum and maximum length, bound *m by those */
|
||||
l = *m;
|
||||
for (j = 1; j <= BMAX; j++) {
|
||||
if (c[j]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
k = j; /* minimum code length */
|
||||
if ((unsigned) l < j) {
|
||||
l = j;
|
||||
}
|
||||
for (i = BMAX; i; i--) {
|
||||
if (c[i]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
g = i; /* maximum code length */
|
||||
if ((unsigned) l > i) {
|
||||
l = i;
|
||||
}
|
||||
*m = l;
|
||||
for (j = 1; (c[j] == 0) && (j <= BMAX); j++);
|
||||
k = j; /* minimum code length */
|
||||
for (i = BMAX; (c[i] == 0) && i; i--);
|
||||
g = i; /* maximum code length */
|
||||
*m = (*m < j) ? j : ((*m > i) ? i : *m);
|
||||
|
||||
/* Adjust last length count to fill out codes, if needed */
|
||||
for (y = 1 << j; j < i; j++, y <<= 1) {
|
||||
if ((y -= c[j]) < 0) {
|
||||
return 2; /* bad input: more codes than bits */
|
||||
return 2; /* bad input: more codes than bits */
|
||||
}
|
||||
}
|
||||
if ((y -= c[i]) < 0) {
|
||||
@@ -300,7 +228,7 @@ static int huft_build(unsigned int *b, const unsigned int n,
|
||||
x[1] = j = 0;
|
||||
p = c + 1;
|
||||
xp = x + 2;
|
||||
while (--i) { /* note that i == g from above */
|
||||
while (--i) { /* note that i == g from above */
|
||||
*xp++ = (j += *p++);
|
||||
}
|
||||
|
||||
@@ -314,13 +242,13 @@ static int huft_build(unsigned int *b, const unsigned int n,
|
||||
} while (++i < 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 */
|
||||
w = -l; /* bits decoded == (l * h) */
|
||||
x[0] = i = 0; /* first Huffman code is zero */
|
||||
p = v; /* grab values in bit order */
|
||||
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 */
|
||||
z = 0; /* ditto */
|
||||
z = 0; /* ditto */
|
||||
|
||||
/* go through the bit lengths (k already is bits in shortest code) */
|
||||
for (; k <= g; k++) {
|
||||
@@ -328,52 +256,52 @@ static 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 > w + l) {
|
||||
h++;
|
||||
w += l; /* previous table always l bits */
|
||||
while (k > ws[htl + 1]) {
|
||||
w = ws[++htl];
|
||||
|
||||
/* compute minimum size table less than or equal to l bits */
|
||||
z = (z = g - w) > (unsigned) l ? l : z; /* upper limit on table size */
|
||||
if ((f = 1 << (j = k - w)) > a + 1) { /* try a k-w bit table *//* too few codes for k-w bit table */
|
||||
f -= a + 1; /* deduct codes from patterns left */
|
||||
/* compute minimum size table less than or equal to *m bits */
|
||||
z = (z = g - w) > *m ? *m : z; /* upper limit on table size */
|
||||
if ((f = 1 << (j = k - w)) > a + 1) { /* try a k-w bit table */
|
||||
/* too few codes for k-w bit table */
|
||||
f -= a + 1; /* deduct codes from patterns left */
|
||||
xp = c + k;
|
||||
while (++j < z) { /* try smaller tables up to z bits */
|
||||
while (++j < z) { /* try smaller tables up to z bits */
|
||||
if ((f <<= 1) <= *++xp) {
|
||||
break; /* enough codes to use up j bits */
|
||||
break; /* enough codes to use up j bits */
|
||||
}
|
||||
f -= *xp; /* else deduct codes from patterns */
|
||||
f -= *xp; /* else deduct codes from patterns */
|
||||
}
|
||||
}
|
||||
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[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) l; /* 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 >> (w - l); /* (get around Turbo C bug) */
|
||||
u[h - 1][j] = r; /* connect to last 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[htl - 1];
|
||||
u[htl - 1][j] = r; /* connect to last table */
|
||||
}
|
||||
}
|
||||
|
||||
/* set up table entry in r */
|
||||
r.b = (unsigned char) (k - w);
|
||||
if (p >= v + n) {
|
||||
r.e = 99; /* out of values--invalid code */
|
||||
r.e = 99; /* out of values--invalid code */
|
||||
} else if (*p < s) {
|
||||
r.e = (unsigned char) (*p < 256 ? 16 : 15); /* 256 is end-of-block code */
|
||||
r.v.n = (unsigned short) (*p); /* simple code is just the value */
|
||||
p++; /* one compiler does not like *p++ */
|
||||
r.e = (unsigned char) (*p < 256 ? 16 : 15); /* 256 is EOB code */
|
||||
r.v.n = (unsigned short) (*p++); /* simple code is just the value */
|
||||
} else {
|
||||
r.e = (unsigned char) e[*p - s]; /* non-simple--look up in lists */
|
||||
r.e = (unsigned char) e[*p - s]; /* non-simple--look up in lists */
|
||||
r.v.n = d[*p++ - s];
|
||||
}
|
||||
|
||||
@@ -390,12 +318,15 @@ static int huft_build(unsigned int *b, const unsigned int n,
|
||||
i ^= j;
|
||||
|
||||
/* backup over finished tables */
|
||||
while ((i & ((1 << w) - 1)) != x[h]) {
|
||||
h--; /* don't need to update q */
|
||||
w -= l;
|
||||
while ((i & ((1 << w) - 1)) != x[htl]) {
|
||||
w = ws[--htl];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* return actual size of base table */
|
||||
*m = ws[1];
|
||||
|
||||
/* Return true (1) if we were given an incomplete table */
|
||||
return y != 0 && g != 1;
|
||||
}
|
||||
@@ -443,7 +374,7 @@ static int inflate_codes(huft_t * my_tl, huft_t * my_td, const unsigned int my_b
|
||||
if ((e = (t = tl + ((unsigned) b & ml))->e) > 16)
|
||||
do {
|
||||
if (e == 99) {
|
||||
bb_error_msg_and_die("inflate_codes error 1");;
|
||||
bb_error_msg_and_die("inflate_codes error 1");
|
||||
}
|
||||
b >>= t->b;
|
||||
k -= t->b;
|
||||
@@ -479,7 +410,7 @@ static int inflate_codes(huft_t * my_tl, huft_t * my_td, const unsigned int my_b
|
||||
if ((e = (t = td + ((unsigned) b & md))->e) > 16)
|
||||
do {
|
||||
if (e == 99)
|
||||
bb_error_msg_and_die("inflate_codes error 2");;
|
||||
bb_error_msg_and_die("inflate_codes error 2");
|
||||
b >>= t->b;
|
||||
k -= t->b;
|
||||
e -= 16;
|
||||
@@ -540,7 +471,7 @@ do_copy: do {
|
||||
|
||||
static int inflate_stored(int my_n, int my_b_stored, int my_k_stored, int setup)
|
||||
{
|
||||
static int n, b_stored, k_stored, w;
|
||||
static unsigned int n, b_stored, k_stored, w;
|
||||
if (setup) {
|
||||
n = my_n;
|
||||
b_stored = my_b_stored;
|
||||
@@ -553,7 +484,7 @@ static int inflate_stored(int my_n, int my_b_stored, int my_k_stored, int setup)
|
||||
while (n--) {
|
||||
b_stored = fill_bitbuffer(b_stored, &k_stored, 8);
|
||||
gunzip_window[w++] = (unsigned char) b_stored;
|
||||
if (w == (unsigned int) gunzip_wsize) {
|
||||
if (w == gunzip_wsize) {
|
||||
gunzip_outbuf_count = (w);
|
||||
//flush_gunzip_window();
|
||||
w = 0;
|
||||
@@ -582,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 */
|
||||
@@ -893,7 +824,7 @@ static int inflate_get_next_window(void)
|
||||
}
|
||||
|
||||
/* Initialise bytebuffer, be careful not to overfill the buffer */
|
||||
extern void inflate_init(unsigned int bufsize)
|
||||
void inflate_init(unsigned int bufsize)
|
||||
{
|
||||
/* Set the bytebuffer size, default is same as gunzip_wsize */
|
||||
bytebuffer_max = bufsize + 8;
|
||||
@@ -901,7 +832,12 @@ extern void inflate_init(unsigned int bufsize)
|
||||
bytebuffer_size = 0;
|
||||
}
|
||||
|
||||
extern int inflate_unzip(int in, int out)
|
||||
void inflate_cleanup(void)
|
||||
{
|
||||
free(bytebuffer);
|
||||
}
|
||||
|
||||
int inflate_unzip(int in, int out)
|
||||
{
|
||||
ssize_t nwrote;
|
||||
typedef void (*sig_type) (int);
|
||||
@@ -917,14 +853,15 @@ extern 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;
|
||||
@@ -948,17 +885,17 @@ extern int inflate_unzip(int in, int out)
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int inflate_gunzip(int in, int out)
|
||||
int inflate_gunzip(int in, int out)
|
||||
{
|
||||
unsigned int stored_crc = 0;
|
||||
unsigned char count;
|
||||
uint32_t stored_crc = 0;
|
||||
unsigned int count;
|
||||
|
||||
inflate_unzip(in, 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++) {
|
||||
@@ -967,8 +904,9 @@ extern 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;
|
||||
}
|
||||
|
||||
/* Validate decompression - size */
|
||||
@@ -976,6 +914,7 @@ extern int inflate_gunzip(int in, int out)
|
||||
(bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) |
|
||||
(bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) {
|
||||
bb_error_msg("Incorrect length");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,28 +1,15 @@
|
||||
/* 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 */
|
||||
extern char filter_accept_all(archive_handle_t *archive_handle)
|
||||
char filter_accept_all(archive_handle_t *archive_handle)
|
||||
{
|
||||
if (archive_handle->file_header->name) {
|
||||
return(EXIT_SUCCESS);
|
||||
|
||||
@@ -1,30 +1,17 @@
|
||||
/* 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 names that are in the accept list, ignoring reject list.
|
||||
*/
|
||||
extern char filter_accept_list(archive_handle_t *archive_handle)
|
||||
char filter_accept_list(archive_handle_t *archive_handle)
|
||||
{
|
||||
if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) {
|
||||
return(EXIT_SUCCESS);
|
||||
|
||||
@@ -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>
|
||||
@@ -28,7 +17,7 @@
|
||||
* e.g. if its a .tar.gz modify archive_handle->sub_archive to process a .tar.gz
|
||||
* or if its a .tar.bz2 make archive_handle->sub_archive handle that
|
||||
*/
|
||||
extern char filter_accept_list_reassign(archive_handle_t *archive_handle)
|
||||
char filter_accept_list_reassign(archive_handle_t *archive_handle)
|
||||
{
|
||||
/* Check the file entry is in the accept list */
|
||||
if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) {
|
||||
@@ -50,6 +39,10 @@ extern char filter_accept_list_reassign(archive_handle_t *archive_handle)
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
if (ENABLE_FEATURE_DEB_TAR_LZMA && !strcmp(name_ptr, ".lzma")) {
|
||||
archive_handle->action_data_subarchive = get_header_tar_lzma;
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
@@ -1,42 +1,30 @@
|
||||
/* 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 names that are in the accept list and not in the reject list
|
||||
*/
|
||||
extern char filter_accept_reject_list(archive_handle_t *archive_handle)
|
||||
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"
|
||||
|
||||
extern const llist_t *find_list_entry(const llist_t *list, const char *filename)
|
||||
/* 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>
|
||||
@@ -21,20 +11,20 @@
|
||||
#include "unarchive.h"
|
||||
#include "libbb.h"
|
||||
|
||||
extern char get_header_ar(archive_handle_t *archive_handle)
|
||||
char get_header_ar(archive_handle_t *archive_handle)
|
||||
{
|
||||
file_header_t *typed = archive_handle->file_header;
|
||||
union {
|
||||
char raw[60];
|
||||
struct {
|
||||
char name[16];
|
||||
char date[12];
|
||||
char uid[6];
|
||||
char gid[6];
|
||||
char mode[8];
|
||||
char size[10];
|
||||
char magic[2];
|
||||
} formated;
|
||||
struct {
|
||||
char name[16];
|
||||
char date[12];
|
||||
char uid[6];
|
||||
char gid[6];
|
||||
char mode[8];
|
||||
char size[10];
|
||||
char magic[2];
|
||||
} formated;
|
||||
} ar;
|
||||
#ifdef CONFIG_FEATURE_AR_LONG_FILENAMES
|
||||
static char *ar_long_names;
|
||||
@@ -53,7 +43,7 @@ extern 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 @@ extern 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 */
|
||||
@@ -102,7 +92,7 @@ extern char get_header_ar(archive_handle_t *archive_handle)
|
||||
#endif
|
||||
} else {
|
||||
/* short filenames */
|
||||
typed->name = bb_xstrndup(ar.formated.name, 16);
|
||||
typed->name = bb_xstrndup(ar.formated.name, 16);
|
||||
}
|
||||
|
||||
typed->name[strcspn(typed->name, " /")] = '\0';
|
||||
|
||||
@@ -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>
|
||||
@@ -28,7 +18,7 @@ typedef struct hardlinks_s {
|
||||
struct hardlinks_s *next;
|
||||
} hardlinks_t;
|
||||
|
||||
extern char get_header_cpio(archive_handle_t *archive_handle)
|
||||
char get_header_cpio(archive_handle_t *archive_handle)
|
||||
{
|
||||
static hardlinks_t *saved_hardlinks = NULL;
|
||||
static unsigned short pending_hardlinks = 0;
|
||||
@@ -66,7 +56,7 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
|
||||
/* There can be padding before archive header */
|
||||
data_align(archive_handle, 4);
|
||||
|
||||
if (archive_xread_all_eof(archive_handle, cpio_header, 110) == 0) {
|
||||
if (archive_xread_all_eof(archive_handle, (unsigned char*)cpio_header, 110) == 0) {
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
archive_handle->offset += 110;
|
||||
@@ -85,9 +75,9 @@ extern 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 @@ extern 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,17 +1,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.
|
||||
*
|
||||
* FIXME:
|
||||
* In privileged mode if uname and gname map to a uid and gid then use the
|
||||
@@ -20,12 +7,13 @@
|
||||
* References:
|
||||
* GNU tar and star man pages,
|
||||
* Opengroup's ustar interchange format,
|
||||
* http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html
|
||||
* http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/sysmacros.h> /* For makedev */
|
||||
#include "unarchive.h"
|
||||
#include "libbb.h"
|
||||
|
||||
@@ -34,7 +22,7 @@ static char *longname = NULL;
|
||||
static char *linkname = NULL;
|
||||
#endif
|
||||
|
||||
extern char get_header_tar(archive_handle_t *archive_handle)
|
||||
char get_header_tar(archive_handle_t *archive_handle)
|
||||
{
|
||||
file_header_t *file_header = archive_handle->file_header;
|
||||
union {
|
||||
@@ -62,26 +50,37 @@ extern char get_header_tar(archive_handle_t *archive_handle)
|
||||
} tar;
|
||||
long sum = 0;
|
||||
long i;
|
||||
static int end = 0;
|
||||
|
||||
/* Align header */
|
||||
data_align(archive_handle, 512);
|
||||
|
||||
if (bb_full_read(archive_handle->src_fd, tar.raw, 512) != 512) {
|
||||
/* Assume end of file */
|
||||
return(EXIT_FAILURE);
|
||||
bb_error_msg_and_die("Short header");
|
||||
//return(EXIT_FAILURE);
|
||||
}
|
||||
archive_handle->offset += 512;
|
||||
|
||||
/* If there is no filename its an empty header */
|
||||
if (tar.formated.name[0] == 0) {
|
||||
if (end) {
|
||||
/* 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);
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
end = 1;
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
end = 0;
|
||||
|
||||
/* Check header has valid magic, "ustar" is for the proper tar
|
||||
* 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");
|
||||
@@ -109,10 +108,14 @@ extern char get_header_tar(archive_handle_t *archive_handle)
|
||||
linkname = NULL;
|
||||
} else
|
||||
#endif
|
||||
if (tar.formated.prefix[0] == 0) {
|
||||
file_header->name = strdup(tar.formated.name);
|
||||
} else {
|
||||
file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name);
|
||||
{
|
||||
file_header->name = bb_xstrndup(tar.formated.name,100);
|
||||
|
||||
if (tar.formated.prefix[0]) {
|
||||
char *temp = file_header->name;
|
||||
file_header->name = concat_path_file(tar.formated.prefix, temp);
|
||||
free(temp);
|
||||
}
|
||||
}
|
||||
|
||||
file_header->uid = strtol(tar.formated.uid, NULL, 8);
|
||||
@@ -133,15 +136,11 @@ extern 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
|
||||
@@ -165,17 +164,15 @@ extern char get_header_tar(archive_handle_t *archive_handle)
|
||||
break;
|
||||
#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
|
||||
case 'L': {
|
||||
longname = xmalloc(file_header->size + 1);
|
||||
longname = xzalloc(file_header->size + 1);
|
||||
archive_xread_all(archive_handle, longname, file_header->size);
|
||||
longname[file_header->size] = '\0';
|
||||
archive_handle->offset += file_header->size;
|
||||
|
||||
return(get_header_tar(archive_handle));
|
||||
}
|
||||
case 'K': {
|
||||
linkname = xmalloc(file_header->size + 1);
|
||||
linkname = xzalloc(file_header->size + 1);
|
||||
archive_xread_all(archive_handle, linkname, file_header->size);
|
||||
linkname[file_header->size] = '\0';
|
||||
archive_handle->offset += file_header->size;
|
||||
|
||||
file_header->name = linkname;
|
||||
@@ -186,8 +183,11 @@ extern 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);
|
||||
}
|
||||
@@ -203,7 +203,7 @@ extern 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>
|
||||
@@ -24,7 +13,7 @@
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
extern char get_header_tar_bz2(archive_handle_t *archive_handle)
|
||||
char get_header_tar_bz2(archive_handle_t *archive_handle)
|
||||
{
|
||||
/* Cant lseek over pipe's */
|
||||
archive_handle->seek = seek_by_char;
|
||||
|
||||
@@ -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,14 +8,14 @@
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
extern char get_header_tar_gz(archive_handle_t *archive_handle)
|
||||
char get_header_tar_gz(archive_handle_t *archive_handle)
|
||||
{
|
||||
unsigned char magic[2];
|
||||
|
||||
/* 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");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Small lzma deflate implementation.
|
||||
* Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
|
||||
*
|
||||
* Licensed under GPL v2, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include "unarchive.h"
|
||||
|
||||
char get_header_tar_lzma(archive_handle_t * archive_handle)
|
||||
{
|
||||
/* Can't lseek over pipes */
|
||||
archive_handle->seek = seek_by_char;
|
||||
|
||||
archive_handle->src_fd = open_transformer(archive_handle->src_fd, unlzma);
|
||||
archive_handle->offset = 0;
|
||||
while (get_header_tar(archive_handle) == EXIT_SUCCESS);
|
||||
|
||||
/* Can only do one file at a time */
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
/* 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"
|
||||
|
||||
extern void header_list(const file_header_t *file_header)
|
||||
void header_list(const file_header_t *file_header)
|
||||
{
|
||||
puts(file_header->name);
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
/* 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"
|
||||
|
||||
extern void header_skip(const file_header_t *file_header)
|
||||
void header_skip(const file_header_t *file_header ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1,12 +1,17 @@
|
||||
/* 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>
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
extern void header_verbose_list(const file_header_t *file_header)
|
||||
void header_verbose_list(const file_header_t *file_header)
|
||||
{
|
||||
struct tm *mtime = localtime(&file_header->mtime);
|
||||
struct tm *mtime = localtime(&(file_header->mtime));
|
||||
|
||||
printf("%s %d/%d%10u %4u-%02u-%02u %02u:%02u:%02u %s",
|
||||
bb_mode_string(file_header->mode),
|
||||
|
||||
@@ -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,8 +8,10 @@
|
||||
|
||||
#include "libbb.h"
|
||||
|
||||
#include "unarchive.h"
|
||||
|
||||
/* transformer(), more than meets the eye */
|
||||
extern int open_transformer(int src_fd, int (*transformer)(int src_fd, int dst_fd))
|
||||
int open_transformer(int src_fd, int (*transformer)(int src_fd, int dst_fd))
|
||||
{
|
||||
int fd_pipe[2];
|
||||
int pid;
|
||||
|
||||
@@ -1,30 +1,21 @@
|
||||
/* 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.
|
||||
*
|
||||
* TODO: rename to seek_by_read
|
||||
*/
|
||||
extern void seek_by_char(const archive_handle_t *archive_handle, const unsigned int jump_size)
|
||||
void seek_by_char(const archive_handle_t *archive_handle, const unsigned int jump_size)
|
||||
{
|
||||
if (jump_size) {
|
||||
bb_copyfd_size(archive_handle->src_fd, -1, jump_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 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>
|
||||
@@ -22,7 +11,7 @@
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
extern void seek_by_jump(const archive_handle_t *archive_handle, const unsigned int amount)
|
||||
void seek_by_jump(const archive_handle_t *archive_handle, const unsigned int amount)
|
||||
{
|
||||
if (lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1) {
|
||||
#ifdef CONFIG_FEATURE_UNARCHIVE_TAPE
|
||||
|
||||
@@ -1,30 +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 <getopt.h>
|
||||
#include "unarchive.h"
|
||||
#include "busybox.h"
|
||||
#include "libbb.h"
|
||||
|
||||
extern void unpack_ar_archive(archive_handle_t *ar_archive)
|
||||
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");
|
||||
}
|
||||
|
||||
+20
-32
@@ -4,19 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 2001,2002 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 <stdio.h>
|
||||
@@ -43,7 +31,7 @@
|
||||
#define RPM_STRING_ARRAY_TYPE 8
|
||||
#define RPM_I18NSTRING_TYPE 9
|
||||
|
||||
#define RPMTAG_NAME 1000
|
||||
#define RPMTAG_NAME 1000
|
||||
#define RPMTAG_VERSION 1001
|
||||
#define RPMTAG_RELEASE 1002
|
||||
#define RPMTAG_SUMMARY 1004
|
||||
@@ -143,7 +131,7 @@ int rpm_main(int argc, char **argv)
|
||||
mytags = rpm_gettags(rpm_fd, (int *) &tagcount);
|
||||
offset = lseek(rpm_fd, 0, SEEK_CUR);
|
||||
if (!mytags) { printf("Error reading rpm header\n"); exit(-1); }
|
||||
map = mmap(0, offset > getpagesize() ? (offset + offset % getpagesize()) : getpagesize(), PROT_READ, MAP_SHARED, rpm_fd, 0); // Mimimum is one page
|
||||
map = mmap(0, offset > getpagesize() ? (offset + offset % getpagesize()) : getpagesize(), PROT_READ, MAP_PRIVATE, rpm_fd, 0); // Mimimum is one page
|
||||
if (func & rpm_install) {
|
||||
loop_through_files(RPMTAG_BASENAMES, fileaction_dobackup); /* Backup any config files */
|
||||
extract_cpio_gz(rpm_fd); // Extact the archive
|
||||
@@ -205,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;
|
||||
@@ -220,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 */
|
||||
|
||||
@@ -243,7 +231,7 @@ rpm_index **rpm_gettags(int fd, int *num_tags)
|
||||
storepos = lseek(fd,0,SEEK_CUR) + header.entries * 16;
|
||||
|
||||
while (header.entries--) {
|
||||
tmpindex = tags[tagindex++] = malloc(sizeof(rpm_index));
|
||||
tmpindex = tags[tagindex++] = xmalloc(sizeof(rpm_index));
|
||||
read(fd, tmpindex, sizeof(rpm_index));
|
||||
tmpindex->tag = ntohl(tmpindex->tag); tmpindex->type = ntohl(tmpindex->type); tmpindex->count = ntohl(tmpindex->count);
|
||||
tmpindex->offset = storepos + ntohl(tmpindex->offset);
|
||||
@@ -259,14 +247,15 @@ rpm_index **rpm_gettags(int fd, int *num_tags)
|
||||
|
||||
int bsearch_rpmtag(const void *key, const void *item)
|
||||
{
|
||||
int *tag = (int *)key;
|
||||
rpm_index **tmp = (rpm_index **) item;
|
||||
return ((int) key - tmp[0]->tag);
|
||||
return (*tag - tmp[0]->tag);
|
||||
}
|
||||
|
||||
int rpm_getcount(int tag)
|
||||
{
|
||||
rpm_index **found;
|
||||
found = bsearch((void *) tag, mytags, tagcount, sizeof(struct rpmtag *), bsearch_rpmtag);
|
||||
found = bsearch(&tag, mytags, tagcount, sizeof(struct rpmtag *), bsearch_rpmtag);
|
||||
if (!found) return 0;
|
||||
else return found[0]->count;
|
||||
}
|
||||
@@ -274,7 +263,7 @@ int rpm_getcount(int tag)
|
||||
char *rpm_getstring(int tag, int itemindex)
|
||||
{
|
||||
rpm_index **found;
|
||||
found = bsearch((void *) tag, mytags, tagcount, sizeof(struct rpmtag *), bsearch_rpmtag);
|
||||
found = bsearch(&tag, mytags, tagcount, sizeof(struct rpmtag *), bsearch_rpmtag);
|
||||
if (!found || itemindex >= found[0]->count) return NULL;
|
||||
if (found[0]->type == RPM_STRING_TYPE || found[0]->type == RPM_I18NSTRING_TYPE || found[0]->type == RPM_STRING_ARRAY_TYPE) {
|
||||
int n;
|
||||
@@ -288,7 +277,9 @@ int rpm_getint(int tag, int itemindex)
|
||||
{
|
||||
rpm_index **found;
|
||||
int n, *tmpint;
|
||||
found = bsearch((void *) tag, mytags, tagcount, sizeof(struct rpmtag *), bsearch_rpmtag);
|
||||
/* gcc throws warnings here when sizeof(void*)!=sizeof(int) ...
|
||||
* it's ok to ignore it because tag won't be used as a pointer */
|
||||
found = bsearch(&tag, mytags, tagcount, sizeof(struct rpmtag *), bsearch_rpmtag);
|
||||
if (!found || itemindex >= found[0]->count) return -1;
|
||||
tmpint = (int *) (map + found[0]->offset);
|
||||
if (found[0]->type == RPM_INT32_TYPE) {
|
||||
@@ -323,12 +314,12 @@ void fileaction_dobackup(char *filename, int fileref)
|
||||
void fileaction_setowngrp(char *filename, int fileref)
|
||||
{
|
||||
int uid, gid;
|
||||
uid = my_getpwnam(rpm_getstring(RPMTAG_FILEUSERNAME, fileref));
|
||||
gid = my_getgrnam(rpm_getstring(RPMTAG_FILEGROUPNAME, fileref));
|
||||
uid = bb_xgetpwnam(rpm_getstring(RPMTAG_FILEUSERNAME, fileref));
|
||||
gid = bb_xgetgrnam(rpm_getstring(RPMTAG_FILEGROUPNAME, fileref));
|
||||
chown (filename, uid, gid);
|
||||
}
|
||||
|
||||
void fileaction_list(char *filename, int fileref)
|
||||
void fileaction_list(char *filename, int ATTRIBUTE_UNUSED fileref)
|
||||
{
|
||||
printf("%s\n", filename);
|
||||
}
|
||||
@@ -336,13 +327,10 @@ void fileaction_list(char *filename, int 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);
|
||||
}
|
||||
|
||||
+6
-18
@@ -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 */
|
||||
@@ -48,11 +36,11 @@ struct rpm_header {
|
||||
uint32_t size; /* Size of store (4 bytes) */
|
||||
};
|
||||
|
||||
void skip_header(int rpm_fd)
|
||||
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 */
|
||||
}
|
||||
@@ -66,7 +54,7 @@ void skip_header(int rpm_fd)
|
||||
}
|
||||
|
||||
/* No getopt required */
|
||||
extern int rpm2cpio_main(int argc, char **argv)
|
||||
int rpm2cpio_main(int argc, char **argv)
|
||||
{
|
||||
struct rpm_lead lead;
|
||||
int rpm_fd;
|
||||
@@ -78,7 +66,7 @@ extern 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 @@ extern 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");
|
||||
}
|
||||
|
||||
+235
-256
@@ -19,22 +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.
|
||||
*
|
||||
* 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 <fcntl.h>
|
||||
@@ -56,15 +42,11 @@
|
||||
#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 */
|
||||
|
||||
static const int TAR_BLOCK_SIZE = 512;
|
||||
static const int TAR_MAGIC_LEN = 6;
|
||||
static const int TAR_VERSION_LEN = 2;
|
||||
#define TAR_BLOCK_SIZE 512
|
||||
|
||||
/* POSIX tar Header Block, from POSIX 1003.1-1990 */
|
||||
enum { NAME_SIZE = 100 }; /* because gcc won't let me use 'static const int' */
|
||||
#define NAME_SIZE 100
|
||||
struct TarHeader { /* byte offset */
|
||||
char name[NAME_SIZE]; /* 0-99 */
|
||||
char mode[8]; /* 100-107 */
|
||||
@@ -102,14 +84,14 @@ struct HardLinkInfo {
|
||||
|
||||
/* Some info to be carried along when creating a new tarball */
|
||||
struct TarBallInfo {
|
||||
char *fileName; /* File name of the tarball */
|
||||
int tarFd; /* Open-for-write file descriptor
|
||||
for the tarball */
|
||||
char *fileName; /* File name of the tarball */
|
||||
int tarFd; /* Open-for-write file descriptor
|
||||
for the tarball */
|
||||
struct stat statBuf; /* Stat info for the tarball, letting
|
||||
us know the inode and device that the
|
||||
tarball lives, so we can avoid trying
|
||||
to include the tarball into itself */
|
||||
int verboseFlag; /* Whether to print extra stuff or not */
|
||||
int verboseFlag; /* Whether to print extra stuff or not */
|
||||
const llist_t *excludeList; /* List of files to not include */
|
||||
HardLinkInfo *hlInfoHead; /* Hard Link Tracking Information */
|
||||
HardLinkInfo *hlInfo; /* Hard Link Info for the current file */
|
||||
@@ -213,8 +195,7 @@ static int putOctal(char *cp, int len, long value)
|
||||
|
||||
/* Write out a tar header for the specified file/directory/whatever */
|
||||
static inline int writeTarHeader(struct TarBallInfo *tbInfo,
|
||||
const char *header_name,
|
||||
const char *real_name, struct stat *statbuf)
|
||||
const char *header_name, const char *real_name, struct stat *statbuf)
|
||||
{
|
||||
long chksum = 0;
|
||||
struct TarHeader header;
|
||||
@@ -223,20 +204,19 @@ 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 (my_getpwuid(header.uname, statbuf->st_uid, sizeof(header.uname)) == NULL)
|
||||
if (bb_getpwuid(header.uname, statbuf->st_uid, sizeof(header.uname)) == NULL)
|
||||
strcpy(header.uname, "root");
|
||||
if (my_getgrgid(header.gname, statbuf->st_gid, sizeof(header.gname)) == NULL)
|
||||
if (bb_getgrgid(header.gname, statbuf->st_gid, sizeof(header.gname)) == NULL)
|
||||
strcpy(header.gname, "root");
|
||||
|
||||
if (tbInfo->hlInfo) {
|
||||
@@ -289,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);
|
||||
}
|
||||
@@ -336,6 +316,8 @@ static inline int exclude_file(const llist_t *excluded_files, const char *file)
|
||||
|
||||
return 0;
|
||||
}
|
||||
# else
|
||||
#define exclude_file(excluded_files, file) 0
|
||||
# endif
|
||||
|
||||
static int writeFileToTarball(const char *fileName, struct stat *statbuf,
|
||||
@@ -343,6 +325,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf,
|
||||
{
|
||||
struct TarBallInfo *tbInfo = (struct TarBallInfo *) userData;
|
||||
const char *header_name;
|
||||
int inputFileFd = -1;
|
||||
|
||||
/*
|
||||
** Check to see if we are dealing with a hard link.
|
||||
@@ -392,36 +375,37 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf,
|
||||
if (header_name[0] == '\0')
|
||||
return TRUE;
|
||||
|
||||
# ifdef CONFIG_FEATURE_TAR_FROM
|
||||
if (exclude_file(tbInfo->excludeList, header_name)) {
|
||||
if (ENABLE_FEATURE_TAR_FROM &&
|
||||
exclude_file(tbInfo->excludeList, header_name)) {
|
||||
return SKIP;
|
||||
}
|
||||
# endif /* CONFIG_FEATURE_TAR_FROM */
|
||||
|
||||
if (writeTarHeader(tbInfo, header_name, fileName, statbuf) == FALSE) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* Now, if the file is a regular file, copy it out to the tarball */
|
||||
if ((tbInfo->hlInfo == NULL)
|
||||
&& (S_ISREG(statbuf->st_mode))) {
|
||||
int inputFileFd;
|
||||
ssize_t readSize = 0;
|
||||
/* Is this a regular file? */
|
||||
if ((tbInfo->hlInfo == NULL) && (S_ISREG(statbuf->st_mode))) {
|
||||
|
||||
/* open the file we want to archive, and make sure all is well */
|
||||
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
|
||||
bb_perror_msg("%s: Cannot open", fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add an entry to the tarball */
|
||||
if (writeTarHeader(tbInfo, header_name, fileName, statbuf) == FALSE) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* If it was a regular file, write out the body */
|
||||
if (inputFileFd >= 0 ) {
|
||||
ssize_t readSize = 0;
|
||||
|
||||
/* write the file to the archive */
|
||||
readSize = bb_copyfd_eof(inputFileFd, tbInfo->tarFd);
|
||||
close(inputFileFd);
|
||||
|
||||
/* Pad the file up to the tar block size */
|
||||
for (; (readSize % TAR_BLOCK_SIZE) != 0; readSize++) {
|
||||
for (; (readSize % TAR_BLOCK_SIZE) != 0; readSize++)
|
||||
write(tbInfo->tarFd, "\0", 1);
|
||||
}
|
||||
close(inputFileFd);
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
@@ -431,12 +415,7 @@ static inline int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
const unsigned long dereferenceFlag, const llist_t *include,
|
||||
const llist_t *exclude, const int gzip)
|
||||
{
|
||||
#ifdef CONFIG_FEATURE_TAR_GZIP
|
||||
int gzipDataPipe[2] = { -1, -1 };
|
||||
int gzipStatusPipe[2] = { -1, -1 };
|
||||
pid_t gzipPid = 0;
|
||||
volatile int vfork_exec_errno = 0;
|
||||
#endif
|
||||
|
||||
int errorFlag = FALSE;
|
||||
ssize_t size;
|
||||
@@ -453,11 +432,15 @@ static inline int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0)
|
||||
bb_perror_msg_and_die("Couldnt stat tar file");
|
||||
|
||||
#ifdef CONFIG_FEATURE_TAR_GZIP
|
||||
if (gzip) {
|
||||
if (pipe(gzipDataPipe) < 0 || pipe(gzipStatusPipe) < 0) {
|
||||
bb_perror_msg_and_die("Failed to create gzip pipe");
|
||||
}
|
||||
if ((ENABLE_FEATURE_TAR_GZIP || ENABLE_FEATURE_TAR_BZIP2) && gzip) {
|
||||
int gzipDataPipe[2] = { -1, -1 };
|
||||
int gzipStatusPipe[2] = { -1, -1 };
|
||||
volatile int vfork_exec_errno = 0;
|
||||
char *zip_exec = (gzip == 1) ? "gzip" : "bzip2";
|
||||
|
||||
|
||||
if (pipe(gzipDataPipe) < 0 || pipe(gzipStatusPipe) < 0)
|
||||
bb_perror_msg_and_die("create pipe");
|
||||
|
||||
signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */
|
||||
|
||||
@@ -465,6 +448,7 @@ static inline int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
/* Avoid vfork clobbering */
|
||||
(void) &include;
|
||||
(void) &errorFlag;
|
||||
(void) &zip_exec;
|
||||
# endif
|
||||
|
||||
gzipPid = vfork();
|
||||
@@ -477,9 +461,9 @@ static inline int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
dup2(tbInfo.tarFd, 1);
|
||||
|
||||
close(gzipStatusPipe[0]);
|
||||
fcntl(gzipStatusPipe[1], F_SETFD, FD_CLOEXEC); /* close on exec shows sucess */
|
||||
fcntl(gzipStatusPipe[1], F_SETFD, FD_CLOEXEC); /* close on exec shows success */
|
||||
|
||||
execl("/bin/gzip", "gzip", "-f", 0);
|
||||
execlp(zip_exec, zip_exec, "-f", NULL);
|
||||
vfork_exec_errno = errno;
|
||||
|
||||
close(gzipStatusPipe[1]);
|
||||
@@ -491,11 +475,11 @@ 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;
|
||||
bb_perror_msg_and_die("Could not exec gzip process");
|
||||
bb_perror_msg_and_die("Could not exec %s", zip_exec);
|
||||
} else if ((n < 0) && (errno == EAGAIN || errno == EINTR))
|
||||
continue; /* try it again */
|
||||
break;
|
||||
@@ -503,50 +487,49 @@ static inline int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
close(gzipStatusPipe[0]);
|
||||
|
||||
tbInfo.tarFd = gzipDataPipe[1];
|
||||
} else {
|
||||
bb_perror_msg_and_die("Failed to vfork gzip process");
|
||||
}
|
||||
} else bb_perror_msg_and_die("vfork gzip");
|
||||
}
|
||||
#endif
|
||||
|
||||
tbInfo.excludeList = exclude;
|
||||
|
||||
/* Read the directory/files and iterate over them one at a time */
|
||||
while (include) {
|
||||
if (!recursive_action(include->data, TRUE, dereferenceFlag, FALSE,
|
||||
writeFileToTarball, writeFileToTarball,
|
||||
(void *) &tbInfo)) {
|
||||
if (!recursive_action(include->data, TRUE, dereferenceFlag,
|
||||
FALSE, writeFileToTarball, writeFileToTarball, &tbInfo))
|
||||
{
|
||||
errorFlag = TRUE;
|
||||
}
|
||||
include = include->link;
|
||||
}
|
||||
/* Write two empty blocks to the end of the archive */
|
||||
for (size = 0; size < (2 * TAR_BLOCK_SIZE); size++) {
|
||||
for (size = 0; size < (2 * TAR_BLOCK_SIZE); size++)
|
||||
write(tbInfo.tarFd, "\0", 1);
|
||||
}
|
||||
|
||||
/* To be pedantically correct, we would check if the tarball
|
||||
* is smaller than 20 tar blocks, and pad it if it was smaller,
|
||||
* but that isn't necessary for GNU tar interoperability, and
|
||||
* so is considered a waste of space */
|
||||
|
||||
/* Hang up the tools, close up shop, head home */
|
||||
/* Close so the child process (if any) will exit */
|
||||
close(tbInfo.tarFd);
|
||||
|
||||
/* Hang up the tools, close up shop, head home */
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
freeHardLinkInfo(&tbInfo.hlInfoHead);
|
||||
|
||||
if (errorFlag)
|
||||
bb_error_msg("Error exit delayed from previous errors");
|
||||
|
||||
freeHardLinkInfo(&tbInfo.hlInfoHead);
|
||||
|
||||
#ifdef CONFIG_FEATURE_TAR_GZIP
|
||||
if (gzip && gzipPid) {
|
||||
if (waitpid(gzipPid, NULL, 0) == -1)
|
||||
printf("Couldnt wait ?");
|
||||
}
|
||||
#endif
|
||||
if (gzipPid && waitpid(gzipPid, NULL, 0)==-1)
|
||||
bb_error_msg("Couldnt wait");
|
||||
|
||||
return !errorFlag;
|
||||
}
|
||||
#endif /* tar_create */
|
||||
#else
|
||||
int writeTarFile(const int tar_fd, const int verboseFlag,
|
||||
const unsigned long dereferenceFlag, const llist_t *include,
|
||||
const llist_t *exclude, const int gzip);
|
||||
#endif /* tar_create */
|
||||
|
||||
#ifdef CONFIG_FEATURE_TAR_FROM
|
||||
static llist_t *append_file_list_to_list(llist_t *list)
|
||||
@@ -557,18 +540,19 @@ static llist_t *append_file_list_to_list(llist_t *list)
|
||||
char *line;
|
||||
llist_t *newlist = NULL;
|
||||
|
||||
while(cur) {
|
||||
while (cur) {
|
||||
src_stream = bb_xfopen(cur->data, "r");
|
||||
tmp = cur;
|
||||
cur = cur->link;
|
||||
free(tmp);
|
||||
while((line = bb_get_chomped_line_from_file(src_stream)) != NULL) {
|
||||
newlist = llist_add_to(newlist, line);
|
||||
}
|
||||
fclose(src_stream);
|
||||
while ((line = bb_get_chomped_line_from_file(src_stream)) != NULL)
|
||||
llist_add_to(&newlist, line);
|
||||
fclose(src_stream);
|
||||
}
|
||||
return newlist;
|
||||
}
|
||||
#else
|
||||
#define append_file_list_to_list(x) 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FEATURE_TAR_COMPRESS
|
||||
@@ -578,7 +562,9 @@ 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");
|
||||
}
|
||||
|
||||
@@ -589,99 +575,128 @@ static char get_header_tar_Z(archive_handle_t *archive_handle)
|
||||
/* Can only do one file at a time */
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
#else
|
||||
#define get_header_tar_Z 0
|
||||
#endif
|
||||
|
||||
#define CTX_TEST (1 << 0)
|
||||
#define CTX_EXTRACT (1 << 1)
|
||||
#define TAR_OPT_BASEDIR (1 << 2)
|
||||
#define TAR_OPT_TARNAME (1 << 3)
|
||||
#define TAR_OPT_2STDOUT (1 << 4)
|
||||
#define TAR_OPT_P (1 << 5)
|
||||
#define TAR_OPT_VERBOSE (1 << 6)
|
||||
#define TAR_OPT_KEEP_OLD (1 << 7)
|
||||
#define CTX_TEST (1 << 0)
|
||||
#define CTX_EXTRACT (1 << 1)
|
||||
#define TAR_OPT_BASEDIR (1 << 2)
|
||||
#define TAR_OPT_TARNAME (1 << 3)
|
||||
#define TAR_OPT_2STDOUT (1 << 4)
|
||||
#define TAR_OPT_P (1 << 5)
|
||||
#define TAR_OPT_VERBOSE (1 << 6)
|
||||
#define TAR_OPT_KEEP_OLD (1 << 7)
|
||||
|
||||
#define TAR_OPT_AFTER_START 8
|
||||
|
||||
#define CTX_CREATE (1 << (TAR_OPT_AFTER_START))
|
||||
#define TAR_OPT_DEREFERENCE (1 << (TAR_OPT_AFTER_START + 1))
|
||||
#ifdef CONFIG_FEATURE_TAR_CREATE
|
||||
# define CTX_CREATE (1 << 8)
|
||||
# define TAR_OPT_DEREFERNCE (1 << 9)
|
||||
# define TAR_OPT_STR_CREATE "ch"
|
||||
# define TAR_OPT_FLAG_CREATE 2
|
||||
# define TAR_OPT_STR_CREATE "ch"
|
||||
# define TAR_OPT_AFTER_CREATE TAR_OPT_AFTER_START + 2
|
||||
#else
|
||||
//# define CTX_CREATE 0
|
||||
# define TAR_OPT_STR_CREATE ""
|
||||
# define TAR_OPT_FLAG_CREATE 0
|
||||
# define TAR_OPT_STR_CREATE ""
|
||||
# define TAR_OPT_AFTER_CREATE TAR_OPT_AFTER_START
|
||||
#endif
|
||||
|
||||
#define TAR_OPT_BZIP2 (1 << (TAR_OPT_AFTER_CREATE))
|
||||
#ifdef CONFIG_FEATURE_TAR_BZIP2
|
||||
# define TAR_OPT_BZIP2 (1 << (8 + TAR_OPT_FLAG_CREATE))
|
||||
# define TAR_OPT_STR_BZIP2 "j"
|
||||
# define TAR_OPT_FLAG_BZIP2 1
|
||||
# define TAR_OPT_STR_BZIP2 "j"
|
||||
# define TAR_OPT_AFTER_BZIP2 TAR_OPT_AFTER_CREATE + 1
|
||||
#else
|
||||
# define TAR_OPT_STR_BZIP2 ""
|
||||
# define TAR_OPT_FLAG_BZIP2 0
|
||||
# define TAR_OPT_STR_BZIP2 ""
|
||||
# define TAR_OPT_AFTER_BZIP2 TAR_OPT_AFTER_CREATE
|
||||
#endif
|
||||
|
||||
#define TAR_OPT_LZMA (1 << (TAR_OPT_AFTER_BZIP2))
|
||||
#ifdef CONFIG_FEATURE_TAR_LZMA
|
||||
# define TAR_OPT_STR_LZMA "a"
|
||||
# define TAR_OPT_AFTER_LZMA TAR_OPT_AFTER_BZIP2 + 1
|
||||
#else
|
||||
# define TAR_OPT_STR_LZMA ""
|
||||
# define TAR_OPT_AFTER_LZMA TAR_OPT_AFTER_BZIP2
|
||||
#endif
|
||||
|
||||
#define TAR_OPT_INCLUDE_FROM (1 << (TAR_OPT_AFTER_LZMA))
|
||||
#define TAR_OPT_EXCLUDE_FROM (1 << (TAR_OPT_AFTER_LZMA + 1))
|
||||
#ifdef CONFIG_FEATURE_TAR_FROM
|
||||
# define TAR_OPT_INCLUDE_FROM (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2))
|
||||
# define TAR_OPT_EXCLUDE_FROM (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2 + 1))
|
||||
# define TAR_OPT_STR_FROM "T:X:"
|
||||
# define TAR_OPT_FLAG_FROM 2
|
||||
# define TAR_OPT_STR_FROM "T:X:"
|
||||
# define TAR_OPT_AFTER_FROM TAR_OPT_AFTER_LZMA + 2
|
||||
#else
|
||||
# define TAR_OPT_STR_FROM ""
|
||||
# define TAR_OPT_FLAG_FROM 0
|
||||
# define TAR_OPT_STR_FROM ""
|
||||
# define TAR_OPT_AFTER_FROM TAR_OPT_AFTER_LZMA
|
||||
#endif
|
||||
|
||||
#define TAR_OPT_GZIP (1 << (TAR_OPT_AFTER_FROM))
|
||||
#ifdef CONFIG_FEATURE_TAR_GZIP
|
||||
# define TAR_OPT_GZIP (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2 + TAR_OPT_FLAG_FROM))
|
||||
# define TAR_OPT_STR_GZIP "z"
|
||||
# define TAR_OPT_FLAG_GZIP 1
|
||||
# define TAR_OPT_STR_GZIP "z"
|
||||
# define TAR_OPT_AFTER_GZIP TAR_OPT_AFTER_FROM + 1
|
||||
#else
|
||||
# define TAR_OPT_STR_GZIP ""
|
||||
# define TAR_OPT_FLAG_GZIP 0
|
||||
# define TAR_OPT_STR_GZIP ""
|
||||
# define TAR_OPT_AFTER_GZIP TAR_OPT_AFTER_FROM
|
||||
#endif
|
||||
|
||||
#define TAR_OPT_UNCOMPRESS (1 << (TAR_OPT_AFTER_GZIP))
|
||||
#ifdef CONFIG_FEATURE_TAR_COMPRESS
|
||||
# define TAR_OPT_UNCOMPRESS (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2 + TAR_OPT_FLAG_FROM + TAR_OPT_FLAG_GZIP))
|
||||
# define TAR_OPT_STR_COMPRESS "Z"
|
||||
# define TAR_OPT_STR_COMPRESS "Z"
|
||||
# define TAR_OPT_AFTER_COMPRESS TAR_OPT_AFTER_GZIP + 1
|
||||
#else
|
||||
# define TAR_OPT_STR_COMPRESS ""
|
||||
# define TAR_OPT_STR_COMPRESS ""
|
||||
# define TAR_OPT_AFTER_COMPRESS TAR_OPT_AFTER_GZIP
|
||||
#endif
|
||||
|
||||
#define TAR_OPT_NOPRESERVE_OWN (1 << (TAR_OPT_AFTER_COMPRESS))
|
||||
#define TAR_OPT_NOPRESERVE_PERM (1 << (TAR_OPT_AFTER_COMPRESS + 1))
|
||||
#define TAR_OPT_STR_NOPRESERVE "\203\213"
|
||||
#define TAR_OPT_AFTER_NOPRESERVE TAR_OPT_AFTER_COMPRESS + 2
|
||||
|
||||
static const char tar_options[]="txC:f:Opvk" \
|
||||
TAR_OPT_STR_CREATE \
|
||||
TAR_OPT_STR_BZIP2 \
|
||||
TAR_OPT_STR_LZMA \
|
||||
TAR_OPT_STR_FROM \
|
||||
TAR_OPT_STR_GZIP \
|
||||
TAR_OPT_STR_COMPRESS;
|
||||
TAR_OPT_STR_COMPRESS \
|
||||
TAR_OPT_STR_NOPRESERVE;
|
||||
|
||||
#ifdef CONFIG_FEATURE_TAR_LONG_OPTIONS
|
||||
static const struct option tar_long_options[] = {
|
||||
{ "list", 0, NULL, 't' },
|
||||
{ "extract", 0, NULL, 'x' },
|
||||
{ "directory", 1, NULL, 'C' },
|
||||
{ "file", 1, NULL, 'f' },
|
||||
{ "to-stdout", 0, NULL, 'O' },
|
||||
{ "list", 0, NULL, 't' },
|
||||
{ "extract", 0, NULL, 'x' },
|
||||
{ "directory", 1, NULL, 'C' },
|
||||
{ "file", 1, NULL, 'f' },
|
||||
{ "to-stdout", 0, NULL, 'O' },
|
||||
{ "same-permissions", 0, NULL, 'p' },
|
||||
{ "verbose", 0, NULL, 'v' },
|
||||
{ "keep-old", 0, NULL, 'k' },
|
||||
{ "verbose", 0, NULL, 'v' },
|
||||
{ "keep-old", 0, NULL, 'k' },
|
||||
{ "no-same-owner", 0, NULL, '\203' },
|
||||
{ "no-same-permissions",0, NULL, '\213' },
|
||||
# ifdef CONFIG_FEATURE_TAR_CREATE
|
||||
{ "create", 0, NULL, 'c' },
|
||||
{ "dereference", 0, NULL, 'h' },
|
||||
{ "create", 0, NULL, 'c' },
|
||||
{ "dereference", 0, NULL, 'h' },
|
||||
# endif
|
||||
# ifdef CONFIG_FEATURE_TAR_BZIP2
|
||||
{ "bzip2", 0, NULL, 'j' },
|
||||
{ "bzip2", 0, NULL, 'j' },
|
||||
# endif
|
||||
# ifdef CONFIG_FEATURE_TAR_LZMA
|
||||
{ "lzma", 0, NULL, 'a' },
|
||||
# endif
|
||||
# ifdef CONFIG_FEATURE_TAR_FROM
|
||||
{ "files-from", 1, NULL, 'T' },
|
||||
{ "exclude-from", 1, NULL, 'X' },
|
||||
{ "files-from", 1, NULL, 'T' },
|
||||
{ "exclude-from", 1, NULL, 'X' },
|
||||
{ "exclude", 1, NULL, '\n' },
|
||||
# endif
|
||||
# ifdef CONFIG_FEATURE_TAR_GZIP
|
||||
{ "gzip", 0, NULL, 'z' },
|
||||
{ "gzip", 0, NULL, 'z' },
|
||||
# endif
|
||||
# ifdef CONFIG_FEATURE_TAR_COMPRESS
|
||||
{ "compress", 0, NULL, 'Z' },
|
||||
{ "compress", 0, NULL, 'Z' },
|
||||
# endif
|
||||
{ 0, 0, 0, 0 }
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
#else
|
||||
#define tar_long_options 0
|
||||
#endif
|
||||
|
||||
int tar_main(int argc, char **argv)
|
||||
@@ -691,105 +706,84 @@ int tar_main(int argc, char **argv)
|
||||
char *base_dir = NULL;
|
||||
const char *tar_filename = "-";
|
||||
unsigned long opt;
|
||||
unsigned long ctx_flag = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
/* Prepend '-' to the first argument if required */
|
||||
if (argv[1][0] != '-') {
|
||||
char *tmp;
|
||||
|
||||
bb_xasprintf(&tmp, "-%s", argv[1]);
|
||||
argv[1] = tmp;
|
||||
}
|
||||
llist_t *excludes = NULL;
|
||||
|
||||
/* Initialise default values */
|
||||
tar_handle = init_handle();
|
||||
tar_handle->flags = ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL;
|
||||
|
||||
bb_opt_complementaly = "c~tx:t~cx:x~ct:X*:T*";
|
||||
#ifdef CONFIG_FEATURE_TAR_LONG_OPTIONS
|
||||
bb_applet_long_options = tar_long_options;
|
||||
#endif
|
||||
|
||||
/* Prepend '-' to the first argument if required */
|
||||
bb_opt_complementally = ENABLE_FEATURE_TAR_CREATE ?
|
||||
"--:X::T::\n::c:t:x:?:c--tx:t--cx:x--ct" :
|
||||
"--:X::T::\n::t:x:?:t--x:x--t";
|
||||
if (ENABLE_FEATURE_TAR_LONG_OPTIONS)
|
||||
bb_applet_long_options = tar_long_options;
|
||||
opt = bb_getopt_ulflags(argc, argv, tar_options,
|
||||
&base_dir, /* Change to dir <optarg> */
|
||||
&tar_filename /* archive filename */
|
||||
#ifdef CONFIG_FEATURE_TAR_FROM
|
||||
, &(tar_handle->accept),
|
||||
&(tar_handle->reject)
|
||||
&(tar_handle->reject),
|
||||
&excludes
|
||||
#endif
|
||||
);
|
||||
|
||||
/* Check one and only one context option was given */
|
||||
if(opt & 0x80000000UL) {
|
||||
bb_show_usage();
|
||||
}
|
||||
#ifdef CONFIG_FEATURE_TAR_CREATE
|
||||
ctx_flag = opt & (CTX_CREATE | CTX_TEST | CTX_EXTRACT);
|
||||
#else
|
||||
ctx_flag = opt & (CTX_TEST | CTX_EXTRACT);
|
||||
#endif
|
||||
if (ctx_flag == 0) {
|
||||
bb_show_usage();
|
||||
}
|
||||
if(ctx_flag & CTX_TEST) {
|
||||
if ((tar_handle->action_header == header_list) ||
|
||||
(tar_handle->action_header == header_verbose_list)) {
|
||||
tar_handle->action_header = header_verbose_list;
|
||||
} else {
|
||||
tar_handle->action_header = header_list;
|
||||
}
|
||||
}
|
||||
if(ctx_flag & CTX_EXTRACT) {
|
||||
if (tar_handle->action_data != data_extract_to_stdout)
|
||||
tar_handle->action_data = data_extract_all;
|
||||
}
|
||||
if(opt & TAR_OPT_2STDOUT) {
|
||||
/* To stdout */
|
||||
tar_handle->action_data = data_extract_to_stdout;
|
||||
}
|
||||
if(opt & TAR_OPT_VERBOSE) {
|
||||
if (opt & CTX_TEST) {
|
||||
if ((tar_handle->action_header == header_list) ||
|
||||
(tar_handle->action_header == header_verbose_list))
|
||||
{
|
||||
tar_handle->action_header = header_verbose_list;
|
||||
} else {
|
||||
tar_handle->action_header = header_list;
|
||||
}
|
||||
}
|
||||
if (opt & TAR_OPT_KEEP_OLD) {
|
||||
tar_handle->flags &= ~ARCHIVE_EXTRACT_UNCONDITIONAL;
|
||||
tar_handle->action_header = header_verbose_list;
|
||||
} else tar_handle->action_header = header_list;
|
||||
}
|
||||
if((opt & CTX_EXTRACT) && tar_handle->action_data != data_extract_to_stdout)
|
||||
tar_handle->action_data = data_extract_all;
|
||||
|
||||
#ifdef CONFIG_FEATURE_TAR_GZIP
|
||||
if(opt & TAR_OPT_GZIP) {
|
||||
if (opt & TAR_OPT_2STDOUT)
|
||||
tar_handle->action_data = data_extract_to_stdout;
|
||||
|
||||
if (opt & TAR_OPT_VERBOSE) {
|
||||
if ((tar_handle->action_header == header_list) ||
|
||||
(tar_handle->action_header == header_verbose_list))
|
||||
{
|
||||
tar_handle->action_header = header_verbose_list;
|
||||
} else
|
||||
tar_handle->action_header = header_list;
|
||||
}
|
||||
if (opt & TAR_OPT_KEEP_OLD)
|
||||
tar_handle->flags &= ~ARCHIVE_EXTRACT_UNCONDITIONAL;
|
||||
|
||||
if (opt & TAR_OPT_NOPRESERVE_OWN)
|
||||
tar_handle->flags |= ARCHIVE_NOPRESERVE_OWN;
|
||||
|
||||
if (opt & TAR_OPT_NOPRESERVE_PERM)
|
||||
tar_handle->flags |= ARCHIVE_NOPRESERVE_PERM;
|
||||
|
||||
if (ENABLE_FEATURE_TAR_GZIP && (opt & TAR_OPT_GZIP))
|
||||
get_header_ptr = get_header_tar_gz;
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_FEATURE_TAR_BZIP2
|
||||
if(opt & TAR_OPT_BZIP2) {
|
||||
|
||||
if (ENABLE_FEATURE_TAR_BZIP2 && (opt & TAR_OPT_BZIP2))
|
||||
get_header_ptr = get_header_tar_bz2;
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_FEATURE_TAR_COMPRESS
|
||||
if(opt & TAR_OPT_UNCOMPRESS) {
|
||||
|
||||
if (ENABLE_FEATURE_TAR_LZMA && (opt & TAR_OPT_LZMA))
|
||||
get_header_ptr = get_header_tar_lzma;
|
||||
|
||||
if (ENABLE_FEATURE_TAR_COMPRESS && (opt & TAR_OPT_UNCOMPRESS))
|
||||
get_header_ptr = get_header_tar_Z;
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_FEATURE_TAR_FROM
|
||||
if(opt & TAR_OPT_EXCLUDE_FROM) {
|
||||
|
||||
if (ENABLE_FEATURE_TAR_FROM) {
|
||||
tar_handle->reject = append_file_list_to_list(tar_handle->reject);
|
||||
}
|
||||
if(opt & TAR_OPT_INCLUDE_FROM) {
|
||||
/* Append excludes to reject */
|
||||
while (excludes) {
|
||||
llist_t *temp = excludes->link;
|
||||
excludes->link = tar_handle->reject;
|
||||
tar_handle->reject = excludes;
|
||||
excludes = temp;
|
||||
}
|
||||
tar_handle->accept = append_file_list_to_list(tar_handle->accept);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Check if we are reading from stdin */
|
||||
if ((argv[optind]) && (*argv[optind] == '-')) {
|
||||
if (argv[optind] && *argv[optind] == '-') {
|
||||
/* Default is to read from stdin, so just skip to next arg */
|
||||
optind++;
|
||||
}
|
||||
@@ -798,34 +792,30 @@ int tar_main(int argc, char **argv)
|
||||
/* TODO: This is the same as in ar, separate function ? */
|
||||
while (optind < argc) {
|
||||
char *filename_ptr = last_char_is(argv[optind], '/');
|
||||
if (filename_ptr) {
|
||||
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++;
|
||||
}
|
||||
|
||||
if ((tar_handle->accept) || (tar_handle->reject)) {
|
||||
if ((tar_handle->accept) || (tar_handle->reject))
|
||||
tar_handle->filter = filter_accept_reject_list;
|
||||
}
|
||||
|
||||
/* Open the tar file */
|
||||
{
|
||||
FILE *tar_stream;
|
||||
int flags;
|
||||
|
||||
#ifdef CONFIG_FEATURE_TAR_CREATE
|
||||
if (opt & CTX_CREATE) {
|
||||
if (ENABLE_FEATURE_TAR_CREATE && (opt & CTX_CREATE)) {
|
||||
/* Make sure there is at least one file to tar up. */
|
||||
if (tar_handle->accept == NULL) {
|
||||
bb_error_msg_and_die("Cowardly refusing to create an empty archive");
|
||||
}
|
||||
if (tar_handle->accept == NULL)
|
||||
bb_error_msg_and_die("empty archive");
|
||||
|
||||
tar_stream = stdout;
|
||||
flags = O_WRONLY | O_CREAT | O_EXCL;
|
||||
unlink(tar_filename);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
tar_stream = stdin;
|
||||
flags = O_RDONLY;
|
||||
}
|
||||
@@ -838,54 +828,43 @@ 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);
|
||||
|
||||
#ifdef CONFIG_FEATURE_TAR_CREATE
|
||||
/* create an archive */
|
||||
if (opt & CTX_CREATE) {
|
||||
if (ENABLE_FEATURE_TAR_CREATE && (opt & CTX_CREATE)) {
|
||||
int verboseFlag = FALSE;
|
||||
int gzipFlag = FALSE;
|
||||
int zipMode = 0;
|
||||
|
||||
# ifdef CONFIG_FEATURE_TAR_GZIP
|
||||
if (get_header_ptr == get_header_tar_gz) {
|
||||
gzipFlag = TRUE;
|
||||
}
|
||||
# endif /* CONFIG_FEATURE_TAR_GZIP */
|
||||
# ifdef CONFIG_FEATURE_TAR_BZIP2
|
||||
if (get_header_ptr == get_header_tar_bz2) {
|
||||
bb_error_msg_and_die("Creating bzip2 compressed archives is not currently supported.");
|
||||
}
|
||||
# endif /* CONFIG_FEATURE_TAR_BZIP2 */
|
||||
if (ENABLE_FEATURE_TAR_GZIP && get_header_ptr == get_header_tar_gz)
|
||||
zipMode = 1;
|
||||
if (ENABLE_FEATURE_TAR_BZIP2 && get_header_ptr == get_header_tar_bz2)
|
||||
zipMode = 2;
|
||||
|
||||
if ((tar_handle->action_header == header_list) ||
|
||||
(tar_handle->action_header == header_verbose_list)) {
|
||||
(tar_handle->action_header == header_verbose_list))
|
||||
{
|
||||
verboseFlag = TRUE;
|
||||
}
|
||||
writeTarFile(tar_handle->src_fd, verboseFlag, opt & TAR_OPT_DEREFERNCE, tar_handle->accept,
|
||||
tar_handle->reject, gzipFlag);
|
||||
} else
|
||||
#endif /* CONFIG_FEATURE_TAR_CREATE */
|
||||
{
|
||||
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);
|
||||
|
||||
/* Ckeck that every file that should have been extracted was */
|
||||
/* Check that every file that should have been extracted was */
|
||||
while (tar_handle->accept) {
|
||||
if (find_list_entry(tar_handle->reject, tar_handle->accept->data) == NULL) {
|
||||
if (find_list_entry(tar_handle->passed, tar_handle->accept->data) == NULL) {
|
||||
bb_error_msg_and_die("%s: Not found in archive\n", tar_handle->accept->data);
|
||||
}
|
||||
if (!find_list_entry(tar_handle->reject, tar_handle->accept->data)
|
||||
&& !find_list_entry(tar_handle->passed, tar_handle->accept->data))
|
||||
{
|
||||
bb_error_msg_and_die("%s: Not found in archive", tar_handle->accept->data);
|
||||
}
|
||||
tar_handle->accept = tar_handle->accept->link;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FEATURE_CLEAN_UP
|
||||
if (tar_handle->src_fd != STDIN_FILENO) {
|
||||
if (ENABLE_FEATURE_CLEAN_UP && tar_handle->src_fd != STDIN_FILENO)
|
||||
close(tar_handle->src_fd);
|
||||
}
|
||||
#endif /* CONFIG_FEATURE_CLEAN_UP */
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
+7
-22
@@ -2,36 +2,23 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "libbb.h"
|
||||
#include "busybox.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
#define GUNZIP_TO_STDOUT 1
|
||||
#define GUNZIP_FORCE 2
|
||||
|
||||
extern int uncompress_main(int argc, char **argv)
|
||||
int uncompress_main(int argc, char **argv)
|
||||
{
|
||||
int status = EXIT_SUCCESS;
|
||||
unsigned long flags;
|
||||
@@ -74,18 +61,16 @@ extern 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");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Small lzma deflate implementation.
|
||||
* Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
|
||||
*
|
||||
* Based on bunzip.c from busybox
|
||||
*
|
||||
* Licensed under GPL v2, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "busybox.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
#define UNLZMA_OPT_STDOUT 1
|
||||
|
||||
int unlzma_main(int argc, char **argv)
|
||||
{
|
||||
char *filename;
|
||||
unsigned long opt;
|
||||
int status, src_fd, dst_fd;
|
||||
|
||||
opt = bb_getopt_ulflags(argc, argv, "c");
|
||||
|
||||
/* Set input filename and number */
|
||||
filename = argv[optind];
|
||||
if ((filename) && (filename[0] != '-') && (filename[1] != '\0')) {
|
||||
/* Open input file */
|
||||
src_fd = bb_xopen(filename, O_RDONLY);
|
||||
} else {
|
||||
src_fd = STDIN_FILENO;
|
||||
filename = 0;
|
||||
}
|
||||
|
||||
/* if called as lzmacat force the stdout flag */
|
||||
if ((opt & UNLZMA_OPT_STDOUT) || bb_applet_name[4] == 'c')
|
||||
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_xopen3(filename, O_WRONLY | O_CREAT, stat_buf.st_mode);
|
||||
} else
|
||||
dst_fd = STDOUT_FILENO;
|
||||
status = unlzma(src_fd, dst_fd);
|
||||
if (filename) {
|
||||
if (!status)
|
||||
filename[strlen(filename)] = '.';
|
||||
if (unlink(filename) < 0) {
|
||||
bb_error_msg_and_die("Couldn't remove %s", filename);
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
+306
-162
@@ -2,246 +2,390 @@
|
||||
/*
|
||||
* Mini unzip implementation for busybox
|
||||
*
|
||||
* Copyright (C) 2001 by Laurence Anderson
|
||||
* Copyright (C) 2004 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
|
||||
* Loosely based on original busybox unzip applet by Laurence Anderson.
|
||||
* All options and features should work in this version.
|
||||
*
|
||||
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
|
||||
*/
|
||||
|
||||
/* For reference see
|
||||
* http://www.pkware.com/products/enterprise/white_papers/appnote.txt
|
||||
* http://www.pkware.com/company/standards/appnote/
|
||||
* http://www.info-zip.org/pub/infozip/doc/appnote-iz-latest.zip
|
||||
*/
|
||||
|
||||
/* TODO Endian issues, exclude, should we accept input from stdin ? */
|
||||
/* TODO
|
||||
* Endian issues
|
||||
* Zip64 + other methods
|
||||
* Improve handling of zip format, ie.
|
||||
* - deferred CRC, comp. & uncomp. lengths (zip header flags bit 3)
|
||||
* - unix file permissions, etc.
|
||||
* - central directory
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include "unarchive.h"
|
||||
#include "busybox.h"
|
||||
|
||||
#define ZIP_FILEHEADER_MAGIC 0x04034b50
|
||||
#define ZIP_CDS_MAGIC 0x02014b50
|
||||
#define ZIP_CDS_END_MAGIC 0x06054b50
|
||||
#define ZIP_DD_MAGIC 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;
|
||||
|
||||
static void header_list_unzip(const file_header_t *file_header)
|
||||
{
|
||||
printf(" inflating: %s\n", file_header->name);
|
||||
}
|
||||
typedef union {
|
||||
unsigned char raw[26];
|
||||
struct {
|
||||
unsigned short version; /* 0-1 */
|
||||
unsigned short flags; /* 2-3 */
|
||||
unsigned short method; /* 4-5 */
|
||||
unsigned short modtime; /* 6-7 */
|
||||
unsigned short moddate; /* 8-9 */
|
||||
unsigned int crc32 ATTRIBUTE_PACKED; /* 10-13 */
|
||||
unsigned int cmpsize ATTRIBUTE_PACKED; /* 14-17 */
|
||||
unsigned int ucmpsize ATTRIBUTE_PACKED; /* 18-21 */
|
||||
unsigned short filename_len; /* 22-23 */
|
||||
unsigned short extra_len; /* 24-25 */
|
||||
} formated ATTRIBUTE_PACKED;
|
||||
} zip_header_t;
|
||||
|
||||
static void header_verbose_list_unzip(const file_header_t *file_header)
|
||||
static void unzip_skip(int fd, off_t skip)
|
||||
{
|
||||
unsigned int dostime = (unsigned int) file_header->mtime;
|
||||
|
||||
/* can printf arguments cut of the decade component ? */
|
||||
unsigned short year = 1980 + ((dostime & 0xfe000000) >> 25);
|
||||
while (year >= 100) {
|
||||
year -= 100;
|
||||
if (lseek(fd, skip, SEEK_CUR) == (off_t)-1) {
|
||||
if ((errno != ESPIPE) || (bb_copyfd_size(fd, -1, skip) != skip)) {
|
||||
bb_error_msg_and_die("Seek failure");
|
||||
}
|
||||
}
|
||||
|
||||
printf("%9u %02u-%02u-%02u %02u:%02u %s\n",
|
||||
(unsigned int) file_header->size,
|
||||
(dostime & 0x01e00000) >> 21,
|
||||
(dostime & 0x001f0000) >> 16,
|
||||
year,
|
||||
(dostime & 0x0000f800) >> 11,
|
||||
(dostime & 0x000007e0) >> 5,
|
||||
file_header->name);
|
||||
}
|
||||
|
||||
extern int unzip_main(int argc, char **argv)
|
||||
static void unzip_create_leading_dirs(char *fn)
|
||||
{
|
||||
union {
|
||||
unsigned char raw[26];
|
||||
struct {
|
||||
unsigned short version; /* 0-1 */
|
||||
unsigned short flags; /* 2-3 */
|
||||
unsigned short method; /* 4-5 */
|
||||
unsigned short modtime; /* 6-7 */
|
||||
unsigned short moddate; /* 8-9 */
|
||||
unsigned int crc32 __attribute__ ((packed)); /* 10-13 */
|
||||
unsigned int cmpsize __attribute__ ((packed));; /* 14-17 */
|
||||
unsigned int ucmpsize __attribute__ ((packed));; /* 18-21 */
|
||||
unsigned short filename_len; /* 22-23 */
|
||||
unsigned short extra_len; /* 24-25 */
|
||||
} formated __attribute__ ((packed));
|
||||
} zip_header;
|
||||
/* Create all leading directories */
|
||||
char *name = bb_xstrdup(fn);
|
||||
if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) {
|
||||
bb_error_msg_and_die("Exiting"); /* bb_make_directory is noisy */
|
||||
}
|
||||
free(name);
|
||||
}
|
||||
|
||||
archive_handle_t *archive_handle;
|
||||
static int unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd)
|
||||
{
|
||||
if (zip_header->formated.method == 0) {
|
||||
/* Method 0 - stored (not compressed) */
|
||||
int size = zip_header->formated.ucmpsize;
|
||||
if (size && (bb_copyfd_size(src_fd, dst_fd, size) != size)) {
|
||||
bb_error_msg_and_die("Cannot complete extraction");
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Method 8 - inflate */
|
||||
inflate_init(zip_header->formated.cmpsize);
|
||||
inflate_unzip(src_fd, dst_fd);
|
||||
inflate_cleanup();
|
||||
/* Validate decompression - crc */
|
||||
if (zip_header->formated.crc32 != (gunzip_crc ^ 0xffffffffL)) {
|
||||
bb_error_msg("Invalid compressed data--crc error");
|
||||
return 1;
|
||||
}
|
||||
/* Validate decompression - size */
|
||||
if (zip_header->formated.ucmpsize != gunzip_bytes_out) {
|
||||
bb_error_msg("Invalid compressed data--length error");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int unzip_main(int argc, char **argv)
|
||||
{
|
||||
zip_header_t zip_header;
|
||||
enum {v_silent, v_normal, v_list} verbosity = v_normal;
|
||||
enum {o_prompt, o_never, o_always} overwrite = o_prompt;
|
||||
unsigned int total_size = 0;
|
||||
unsigned int total_entries = 0;
|
||||
int src_fd = -1, dst_fd = -1;
|
||||
char *src_fn = NULL, *dst_fn = NULL;
|
||||
llist_t *zaccept = NULL;
|
||||
llist_t *zreject = NULL;
|
||||
char *base_dir = NULL;
|
||||
int opt = 0;
|
||||
int failed, i, opt, opt_range = 0, list_header_done = 0;
|
||||
char key_buf[512];
|
||||
struct stat stat_buf;
|
||||
|
||||
/* Initialise */
|
||||
archive_handle = init_handle();
|
||||
archive_handle->action_data = NULL;
|
||||
archive_handle->action_header = header_list_unzip;
|
||||
while((opt = getopt(argc, argv, "-d:lnopqx")) != -1) {
|
||||
switch(opt_range) {
|
||||
case 0: /* Options */
|
||||
switch(opt) {
|
||||
case 'l': /* List */
|
||||
verbosity = v_list;
|
||||
break;
|
||||
|
||||
while ((opt = getopt(argc, argv, "lnopqd:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'l': /* list */
|
||||
archive_handle->action_header = header_verbose_list_unzip;
|
||||
archive_handle->action_data = data_skip;
|
||||
case 'n': /* Never overwrite existing files */
|
||||
overwrite = o_never;
|
||||
break;
|
||||
case 'n': /* never overwright existing files */
|
||||
|
||||
case 'o': /* Always overwrite existing files */
|
||||
overwrite = o_always;
|
||||
break;
|
||||
case 'o':
|
||||
archive_handle->flags = ARCHIVE_EXTRACT_UNCONDITIONAL;
|
||||
|
||||
case 'p': /* Extract files to stdout and fall through to set verbosity */
|
||||
dst_fd = STDOUT_FILENO;
|
||||
|
||||
case 'q': /* Be quiet */
|
||||
verbosity = (verbosity == v_normal) ? v_silent : verbosity;
|
||||
break;
|
||||
case 'p': /* extract files to stdout */
|
||||
archive_handle->action_data = data_extract_to_stdout;
|
||||
|
||||
case 1 : /* The zip file */
|
||||
src_fn = bb_xstrndup(optarg, strlen(optarg)+4);
|
||||
opt_range++;
|
||||
break;
|
||||
case 'q': /* Extract files quietly */
|
||||
archive_handle->action_header = header_skip;
|
||||
break;
|
||||
case 'd': /* Extract files to specified base directory*/
|
||||
base_dir = optarg;
|
||||
break;
|
||||
#if 0
|
||||
case 'x': /* Exclude the specified files */
|
||||
archive_handle->filter = filter_accept_reject_list;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
bb_show_usage();
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: /* Include files */
|
||||
if (opt == 1) {
|
||||
llist_add_to(&zaccept, optarg);
|
||||
|
||||
} else if (opt == 'd') {
|
||||
base_dir = optarg;
|
||||
opt_range += 2;
|
||||
|
||||
} else if (opt == 'x') {
|
||||
opt_range++;
|
||||
|
||||
} else {
|
||||
bb_show_usage();
|
||||
}
|
||||
break;
|
||||
|
||||
case 2 : /* Exclude files */
|
||||
if (opt == 1) {
|
||||
llist_add_to(&zreject, optarg);
|
||||
|
||||
} else if (opt == 'd') { /* Extract to base directory */
|
||||
base_dir = optarg;
|
||||
opt_range++;
|
||||
|
||||
} else {
|
||||
bb_show_usage();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
bb_show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (argc == optind) {
|
||||
if (src_fn == NULL) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
printf("Archive: %s\n", argv[optind]);
|
||||
if (archive_handle->action_header == header_verbose_list_unzip) {
|
||||
printf(" Length Date Time Name\n");
|
||||
printf(" -------- ---- ---- ----\n");
|
||||
}
|
||||
/* Open input file */
|
||||
if (strcmp("-", src_fn) == 0) {
|
||||
src_fd = STDIN_FILENO;
|
||||
/* Cannot use prompt mode since zip data is arriving on STDIN */
|
||||
overwrite = (overwrite == o_prompt) ? o_never : overwrite;
|
||||
|
||||
if (*argv[optind] == '-') {
|
||||
archive_handle->src_fd = STDIN_FILENO;
|
||||
archive_handle->seek = seek_by_char;
|
||||
} else {
|
||||
archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
|
||||
static const char *const extn[] = {"", ".zip", ".ZIP"};
|
||||
int orig_src_fn_len = strlen(src_fn);
|
||||
for(i = 0; (i < 3) && (src_fd == -1); i++) {
|
||||
strcpy(src_fn + orig_src_fn_len, extn[i]);
|
||||
src_fd = open(src_fn, O_RDONLY);
|
||||
}
|
||||
if (src_fd == -1) {
|
||||
src_fn[orig_src_fn_len] = 0;
|
||||
bb_error_msg_and_die("Cannot open %s, %s.zip, %s.ZIP", src_fn, src_fn, src_fn);
|
||||
}
|
||||
}
|
||||
|
||||
if ((base_dir) && (chdir(base_dir))) {
|
||||
bb_perror_msg_and_die("Couldnt chdir");
|
||||
}
|
||||
/* Change dir if necessary */
|
||||
if (base_dir)
|
||||
bb_xchdir(base_dir);
|
||||
|
||||
while (optind < argc) {
|
||||
archive_handle->filter = filter_accept_list;
|
||||
archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind]);
|
||||
optind++;
|
||||
}
|
||||
if (verbosity != v_silent)
|
||||
printf("Archive: %s\n", src_fn);
|
||||
|
||||
failed = 0;
|
||||
|
||||
while (1) {
|
||||
unsigned int magic;
|
||||
int dst_fd;
|
||||
|
||||
/* TODO Endian issues */
|
||||
archive_xread_all(archive_handle, &magic, 4);
|
||||
archive_handle->offset += 4;
|
||||
|
||||
/* Check magic number */
|
||||
xread(src_fd, &magic, 4);
|
||||
if (magic == ZIP_CDS_MAGIC) {
|
||||
break;
|
||||
}
|
||||
else if (magic != ZIP_FILEHEADER_MAGIC) {
|
||||
bb_error_msg_and_die("Invlaide zip magic");
|
||||
} else if (magic != ZIP_FILEHEADER_MAGIC) {
|
||||
bb_error_msg_and_die("Invalid zip magic %08X", magic);
|
||||
}
|
||||
|
||||
/* Read the file header */
|
||||
archive_xread_all(archive_handle, zip_header.raw, 26);
|
||||
archive_handle->offset += 26;
|
||||
archive_handle->file_header->mode = S_IFREG | 0777;
|
||||
|
||||
if (zip_header.formated.method != 8) {
|
||||
bb_error_msg_and_die("Unsupported compression method %d\n", zip_header.formated.method);
|
||||
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 */
|
||||
archive_handle->file_header->name = xmalloc(zip_header.formated.filename_len + 1);
|
||||
archive_xread_all(archive_handle, archive_handle->file_header->name, zip_header.formated.filename_len);
|
||||
archive_handle->offset += zip_header.formated.filename_len;
|
||||
archive_handle->file_header->name[zip_header.formated.filename_len] = '\0';
|
||||
free(dst_fn);
|
||||
dst_fn = xzalloc(zip_header.formated.filename_len + 1);
|
||||
xread(src_fd, dst_fn, zip_header.formated.filename_len);
|
||||
|
||||
/* Skip extra header bits */
|
||||
archive_handle->file_header->size = zip_header.formated.extra_len;
|
||||
data_skip(archive_handle);
|
||||
archive_handle->offset += zip_header.formated.extra_len;
|
||||
/* Skip extra header bytes */
|
||||
unzip_skip(src_fd, zip_header.formated.extra_len);
|
||||
|
||||
/* Handle directories */
|
||||
archive_handle->file_header->mode = S_IFREG | 0777;
|
||||
if (last_char_is(archive_handle->file_header->name, '/')) {
|
||||
archive_handle->file_header->mode ^= S_IFREG;
|
||||
archive_handle->file_header->mode |= S_IFDIR;
|
||||
if ((verbosity == v_list) && !list_header_done){
|
||||
printf(" Length Date Time Name\n"
|
||||
" -------- ---- ---- ----\n");
|
||||
list_header_done = 1;
|
||||
}
|
||||
|
||||
/* Data section */
|
||||
archive_handle->file_header->size = zip_header.formated.cmpsize;
|
||||
if (archive_handle->action_data) {
|
||||
archive_handle->action_data(archive_handle);
|
||||
} else {
|
||||
dst_fd = bb_xopen(archive_handle->file_header->name, O_WRONLY | O_CREAT);
|
||||
inflate_init(zip_header.formated.cmpsize);
|
||||
inflate_unzip(archive_handle->src_fd, dst_fd);
|
||||
close(dst_fd);
|
||||
chmod(archive_handle->file_header->name, archive_handle->file_header->mode);
|
||||
/* Filter zip entries */
|
||||
if (find_list_entry(zreject, dst_fn) ||
|
||||
(zaccept && !find_list_entry(zaccept, dst_fn))) { /* Skip entry */
|
||||
i = 'n';
|
||||
|
||||
/* Validate decompression - crc */
|
||||
if (zip_header.formated.crc32 != (gunzip_crc ^ 0xffffffffL)) {
|
||||
bb_error_msg("Invalid compressed data--crc error");
|
||||
}
|
||||
} else { /* Extract entry */
|
||||
total_size += zip_header.formated.ucmpsize;
|
||||
|
||||
/* Validate decompression - size */
|
||||
if (gunzip_bytes_out != zip_header.formated.ucmpsize) {
|
||||
bb_error_msg("Invalid compressed data--length error");
|
||||
if (verbosity == v_list) { /* List entry */
|
||||
unsigned int dostime = zip_header.formated.modtime | (zip_header.formated.moddate << 16);
|
||||
printf("%9u %02u-%02u-%02u %02u:%02u %s\n",
|
||||
zip_header.formated.ucmpsize,
|
||||
(dostime & 0x01e00000) >> 21,
|
||||
(dostime & 0x001f0000) >> 16,
|
||||
(((dostime & 0xfe000000) >> 25) + 1980) % 100,
|
||||
(dostime & 0x0000f800) >> 11,
|
||||
(dostime & 0x000007e0) >> 5,
|
||||
dst_fn);
|
||||
total_entries++;
|
||||
i = 'n';
|
||||
|
||||
} else if (dst_fd == STDOUT_FILENO) { /* Extracting to STDOUT */
|
||||
i = -1;
|
||||
|
||||
} else if (last_char_is(dst_fn, '/')) { /* Extract directory */
|
||||
if (stat(dst_fn, &stat_buf) == -1) {
|
||||
if (errno != ENOENT) {
|
||||
bb_perror_msg_and_die("Cannot stat '%s'",dst_fn);
|
||||
}
|
||||
if (verbosity == v_normal) {
|
||||
printf(" creating: %s\n", dst_fn);
|
||||
}
|
||||
unzip_create_leading_dirs(dst_fn);
|
||||
if (bb_make_directory(dst_fn, 0777, 0)) {
|
||||
bb_error_msg_and_die("Exiting");
|
||||
}
|
||||
} else {
|
||||
if (!S_ISDIR(stat_buf.st_mode)) {
|
||||
bb_error_msg_and_die("'%s' exists but is not directory", dst_fn);
|
||||
}
|
||||
}
|
||||
i = 'n';
|
||||
|
||||
} else { /* Extract file */
|
||||
_check_file:
|
||||
if (stat(dst_fn, &stat_buf) == -1) { /* File does not exist */
|
||||
if (errno != ENOENT) {
|
||||
bb_perror_msg_and_die("Cannot stat '%s'",dst_fn);
|
||||
}
|
||||
i = 'y';
|
||||
|
||||
} else { /* File already exists */
|
||||
if (overwrite == o_never) {
|
||||
i = 'n';
|
||||
|
||||
} else if (S_ISREG(stat_buf.st_mode)) { /* File is regular file */
|
||||
if (overwrite == o_always) {
|
||||
i = 'y';
|
||||
} else {
|
||||
printf("replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ", dst_fn);
|
||||
if (!fgets(key_buf, 512, stdin)) {
|
||||
bb_perror_msg_and_die("Cannot read input");
|
||||
}
|
||||
i = key_buf[0];
|
||||
}
|
||||
|
||||
} else { /* File is not regular file */
|
||||
bb_error_msg_and_die("'%s' exists but is not regular file",dst_fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* local file descriptor section */
|
||||
archive_handle->offset += zip_header.formated.cmpsize;
|
||||
/* This ISNT unix time */
|
||||
archive_handle->file_header->mtime = zip_header.formated.modtime | (zip_header.formated.moddate << 16);
|
||||
archive_handle->file_header->size = zip_header.formated.ucmpsize;
|
||||
total_size += archive_handle->file_header->size;
|
||||
total_entries++;
|
||||
switch (i) {
|
||||
case 'A':
|
||||
overwrite = o_always;
|
||||
case 'y': /* Open file and fall into unzip */
|
||||
unzip_create_leading_dirs(dst_fn);
|
||||
dst_fd = bb_xopen(dst_fn, O_WRONLY | O_CREAT);
|
||||
case -1: /* Unzip */
|
||||
if (verbosity == v_normal) {
|
||||
printf(" inflating: %s\n", dst_fn);
|
||||
}
|
||||
if (unzip_extract(&zip_header, src_fd, dst_fd)) {
|
||||
failed = 1;
|
||||
}
|
||||
if (dst_fd != STDOUT_FILENO) {
|
||||
/* closing STDOUT is potentially bad for future business */
|
||||
close(dst_fd);
|
||||
}
|
||||
break;
|
||||
|
||||
archive_handle->action_header(archive_handle->file_header);
|
||||
case 'N':
|
||||
overwrite = o_never;
|
||||
case 'n':
|
||||
/* Skip entry data */
|
||||
unzip_skip(src_fd, zip_header.formated.cmpsize);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
/* Prompt for new name */
|
||||
printf("new name: ");
|
||||
if (!fgets(key_buf, 512, stdin)) {
|
||||
bb_perror_msg_and_die("Cannot read input");
|
||||
}
|
||||
free(dst_fn);
|
||||
dst_fn = bb_xstrdup(key_buf);
|
||||
chomp(dst_fn);
|
||||
goto _check_file;
|
||||
|
||||
default:
|
||||
printf("error: invalid response [%c]\n",(char)i);
|
||||
goto _check_file;
|
||||
}
|
||||
|
||||
/* Data descriptor section */
|
||||
if (zip_header.formated.flags & 4) {
|
||||
/* skip over duplicate crc, compressed size and uncompressed size */
|
||||
unsigned char data_description[12];
|
||||
archive_xread_all(archive_handle, data_description, 12);
|
||||
archive_handle->offset += 12;
|
||||
unzip_skip(src_fd, 12);
|
||||
}
|
||||
}
|
||||
/* Central directory section */
|
||||
|
||||
if (archive_handle->action_header == header_verbose_list_unzip) {
|
||||
printf(" -------- -------\n");
|
||||
printf("%9d %d files\n", total_size, total_entries);
|
||||
if (verbosity == v_list) {
|
||||
printf(" -------- -------\n"
|
||||
"%9d %d files\n", total_size, total_entries);
|
||||
}
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
return failed;
|
||||
}
|
||||
@@ -0,0 +1,598 @@
|
||||
Various bug fixes that apply to busybox 1.2.0, cherry-picked from the
|
||||
ongoing development branch. This will form the basis for busybox 1.2.1.
|
||||
|
||||
I'll append fixes to this as they come up. (Check the file date, or the bug
|
||||
list below.) This file is basically a concatenation of the following:
|
||||
|
||||
http://busybox.net/downloads/patches/svn-15575.patch
|
||||
http://busybox.net/downloads/patches/svn-15653.patch
|
||||
http://busybox.net/downloads/patches/svn-15656.patch
|
||||
http://busybox.net/downloads/patches/svn-15658.patch
|
||||
http://busybox.net/downloads/patches/svn-15659.patch
|
||||
http://busybox.net/downloads/patches/svn-15660.patch
|
||||
http://busybox.net/downloads/patches/svn-15670.patch
|
||||
http://busybox.net/downloads/patches/svn-15698.patch
|
||||
http://busybox.net/downloads/patches/svn-15700.patch
|
||||
http://busybox.net/downloads/patches/svn-15702.patch
|
||||
http://busybox.net/downloads/patches/svn-15705.patch
|
||||
http://busybox.net/downloads/patches/svn-15727.patch
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r15575 | landley | 2006-07-01 13:19:02 -0400 (Sat, 01 Jul 2006) | 2 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/shell/lash.c
|
||||
|
||||
Patch from Shaun Jackman moving the var=value logic to where it can do some
|
||||
good.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: shell/lash.c
|
||||
===================================================================
|
||||
--- shell/lash.c (revision 15574)
|
||||
+++ shell/lash.c (revision 15575)
|
||||
@@ -1171,12 +1171,6 @@
|
||||
{
|
||||
struct built_in_command *x;
|
||||
|
||||
- /* Check if the command sets an environment variable. */
|
||||
- if( strchr(child->argv[0], '=') != NULL ) {
|
||||
- child->argv[1] = child->argv[0];
|
||||
- _exit(builtin_export(child));
|
||||
- }
|
||||
-
|
||||
/* Check if the command matches any of the non-forking builtins.
|
||||
* Depending on context, this might be redundant. But it's
|
||||
* easier to waste a few CPU cycles than it is to figure out
|
||||
@@ -1300,6 +1294,12 @@
|
||||
* is doomed to failure, and doesn't work on bash, either.
|
||||
*/
|
||||
if (newjob->num_progs == 1) {
|
||||
+ /* Check if the command sets an environment variable. */
|
||||
+ if (strchr(child->argv[0], '=') != NULL) {
|
||||
+ child->argv[1] = child->argv[0];
|
||||
+ return builtin_export(child);
|
||||
+ }
|
||||
+
|
||||
for (x = bltins; x->cmd; x++) {
|
||||
if (strcmp(child->argv[0], x->cmd) == 0 ) {
|
||||
int rcode;
|
||||
------------------------------------------------------------------------
|
||||
r15653 | landley | 2006-07-05 21:09:21 -0400 (Wed, 05 Jul 2006) | 6 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/shell/ash.c
|
||||
|
||||
Bug fix from Vladimir Oleynic via Paul Fox for:
|
||||
echo "+bond0" > /sys/class/net/bonding_masters
|
||||
while true; do
|
||||
echo hello
|
||||
done
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: shell/ash.c
|
||||
===================================================================
|
||||
--- shell/ash.c (revision 15652)
|
||||
+++ shell/ash.c (revision 15653)
|
||||
@@ -3469,6 +3469,7 @@
|
||||
flushall();
|
||||
cmddone:
|
||||
exitstatus |= ferror(stdout);
|
||||
+ clearerr(stdout);
|
||||
commandname = savecmdname;
|
||||
exsig = 0;
|
||||
handler = savehandler;
|
||||
------------------------------------------------------------------------
|
||||
r15656 | landley | 2006-07-06 12:41:56 -0400 (Thu, 06 Jul 2006) | 5 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/util-linux/dmesg.c
|
||||
|
||||
Fix three embarassing thinkos in the new dmesg.c:
|
||||
1) the c argument shouldn't have had a : after that, dunno how that got there.
|
||||
2) the xgetlarg for level was using size
|
||||
3) because xgetlarg's error message _SUCKS_ (it does a show_usage() rather than giving any specific info about the range that was violated) I dropped the range down to 2 bytes. (Which works fine, I dunno why we were nit-picking about that...)
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: util-linux/dmesg.c
|
||||
===================================================================
|
||||
--- util-linux/dmesg.c (revision 15655)
|
||||
+++ util-linux/dmesg.c (revision 15656)
|
||||
@@ -15,16 +15,16 @@
|
||||
int dmesg_main(int argc, char *argv[])
|
||||
{
|
||||
char *size, *level;
|
||||
- int flags = bb_getopt_ulflags(argc, argv, "c:s:n:", &size, &level);
|
||||
+ int flags = bb_getopt_ulflags(argc, argv, "cs:n:", &size, &level);
|
||||
|
||||
if (flags & 4) {
|
||||
- if(klogctl(8, NULL, bb_xgetlarg(size, 10, 0, 10)))
|
||||
+ if(klogctl(8, NULL, bb_xgetlarg(level, 10, 0, 10)))
|
||||
bb_perror_msg_and_die("klogctl");
|
||||
} else {
|
||||
int len;
|
||||
char *buf;
|
||||
|
||||
- len = (flags & 2) ? bb_xgetlarg(size, 10, 4096, INT_MAX) : 16384;
|
||||
+ len = (flags & 2) ? bb_xgetlarg(size, 10, 2, INT_MAX) : 16384;
|
||||
buf = xmalloc(len);
|
||||
if (0 > (len = klogctl(3 + (flags & 1), buf, len)))
|
||||
bb_perror_msg_and_die("klogctl");
|
||||
------------------------------------------------------------------------
|
||||
r15658 | pgf | 2006-07-06 16:00:43 -0400 (Thu, 06 Jul 2006) | 4 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/Makefile
|
||||
|
||||
fix dependencies so that compressed usage gets rebuilt if
|
||||
a) include/usage.h is changed, and
|
||||
b) after "make clean".
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: Makefile
|
||||
===================================================================
|
||||
--- Makefile (revision 15657)
|
||||
+++ Makefile (revision 15658)
|
||||
@@ -436,13 +436,16 @@
|
||||
|
||||
ifeq ($(strip $(CONFIG_FEATURE_COMPRESS_USAGE)),y)
|
||||
USAGE_BIN:=scripts/usage
|
||||
-$(USAGE_BIN): $(top_srcdir)/scripts/usage.c .config
|
||||
+$(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" > $@
|
||||
+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
|
||||
@@ -470,7 +473,8 @@
|
||||
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 -o -name \*.syn \
|
||||
-o -name \*.os -o -name \*.osm -o -name \*.a | xargs rm -f
|
||||
------------------------------------------------------------------------
|
||||
r15659 | landley | 2006-07-06 16:02:47 -0400 (Thu, 06 Jul 2006) | 3 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/libbb/Makefile
|
||||
|
||||
Attempt to address Shaun Jackman's problem adding "busybox: busybox.bflt" to
|
||||
.config.mak.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: libbb/Makefile
|
||||
===================================================================
|
||||
--- libbb/Makefile (revision 15658)
|
||||
+++ libbb/Makefile (revision 15659)
|
||||
@@ -12,6 +12,12 @@
|
||||
endif
|
||||
srcdir=$(top_srcdir)/libbb
|
||||
LIBBB_DIR:=./
|
||||
+
|
||||
+# Ensure "all" is still the default target when make is run by itself in
|
||||
+# libbb, even if the files we include define rules for targets.
|
||||
+
|
||||
+all:
|
||||
+
|
||||
include $(top_srcdir)/Rules.mak
|
||||
include $(top_builddir)/.config
|
||||
include Makefile.in
|
||||
------------------------------------------------------------------------
|
||||
r15660 | landley | 2006-07-06 16:30:19 -0400 (Thu, 06 Jul 2006) | 3 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/archival/libunarchive/get_header_tar.c
|
||||
|
||||
Fix tar so it can extract git-generated tarballs, based on a suggestion
|
||||
from Erik Frederiksen.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: archival/libunarchive/get_header_tar.c
|
||||
===================================================================
|
||||
--- archival/libunarchive/get_header_tar.c (revision 15659)
|
||||
+++ archival/libunarchive/get_header_tar.c (revision 15660)
|
||||
@@ -137,10 +137,6 @@
|
||||
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:
|
||||
@@ -188,8 +184,11 @@
|
||||
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);
|
||||
}
|
||||
------------------------------------------------------------------------
|
||||
r15670 | landley | 2006-07-09 13:03:07 -0400 (Sun, 09 Jul 2006) | 3 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/shell/lash.c
|
||||
|
||||
Bugfix from Shaun Jackman (check that argv[optind] isn't null before
|
||||
dereferencing it) plus a bunch of tweaks from me.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: shell/lash.c
|
||||
===================================================================
|
||||
--- shell/lash.c (revision 15669)
|
||||
+++ shell/lash.c (revision 15670)
|
||||
@@ -1498,6 +1498,8 @@
|
||||
remove_job(&job_list, job_list.fg);
|
||||
}
|
||||
}
|
||||
+#else
|
||||
+void free_memory(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LASH_JOB_CONTROL
|
||||
@@ -1528,7 +1530,7 @@
|
||||
/* Put ourselves in our own process group. */
|
||||
setsid();
|
||||
shell_pgrp = getpid ();
|
||||
- setpgid (shell_pgrp, shell_pgrp);
|
||||
+ setpgid(shell_pgrp, shell_pgrp);
|
||||
|
||||
/* Grab control of the terminal. */
|
||||
tcsetpgrp(shell_terminal, shell_pgrp);
|
||||
@@ -1577,7 +1579,7 @@
|
||||
argv = argv+optind;
|
||||
break;
|
||||
case 'i':
|
||||
- interactive = TRUE;
|
||||
+ interactive++;
|
||||
break;
|
||||
default:
|
||||
bb_show_usage();
|
||||
@@ -1591,18 +1593,18 @@
|
||||
* standard output is a terminal
|
||||
* Refer to Posix.2, the description of the `sh' utility. */
|
||||
if (argv[optind]==NULL && input==stdin &&
|
||||
- isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) {
|
||||
- interactive=TRUE;
|
||||
+ isatty(STDIN_FILENO) && isatty(STDOUT_FILENO))
|
||||
+ {
|
||||
+ interactive++;
|
||||
}
|
||||
setup_job_control();
|
||||
- if (interactive==TRUE) {
|
||||
- //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]);
|
||||
+ if (interactive) {
|
||||
/* Looks like they want an interactive shell */
|
||||
-#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET
|
||||
- printf( "\n\n%s Built-in shell (lash)\n", BB_BANNER);
|
||||
- printf( "Enter 'help' for a list of built-in commands.\n\n");
|
||||
-#endif
|
||||
- } else if (local_pending_command==NULL) {
|
||||
+ if (!ENABLE_FEATURE_SH_EXTRA_QUIET) {
|
||||
+ printf( "\n\n%s Built-in shell (lash)\n", BB_BANNER);
|
||||
+ printf( "Enter 'help' for a list of built-in commands.\n\n");
|
||||
+ }
|
||||
+ } else if (!local_pending_command && argv[optind]) {
|
||||
//printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]);
|
||||
input = bb_xfopen(argv[optind], "r");
|
||||
/* be lazy, never mark this closed */
|
||||
@@ -1614,15 +1616,10 @@
|
||||
if (!cwd)
|
||||
cwd = bb_msg_unknown;
|
||||
|
||||
-#ifdef CONFIG_FEATURE_CLEAN_UP
|
||||
- atexit(free_memory);
|
||||
-#endif
|
||||
+ if (ENABLE_FEATURE_CLEAN_UP) atexit(free_memory);
|
||||
|
||||
-#ifdef CONFIG_FEATURE_COMMAND_EDITING
|
||||
- cmdedit_set_initial_prompt();
|
||||
-#else
|
||||
- PS1 = NULL;
|
||||
-#endif
|
||||
+ if (ENABLE_FEATURE_COMMAND_EDITING) cmdedit_set_initial_prompt();
|
||||
+ else PS1 = NULL;
|
||||
|
||||
return (busy_loop(input));
|
||||
}
|
||||
------------------------------------------------------------------------
|
||||
r15698 | vapier | 2006-07-14 23:59:00 -0400 (Fri, 14 Jul 2006) | 2 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/libbb/obscure.c
|
||||
|
||||
Tito writes: If the gecos field of an user is empty, obscure reports a false "similar to gecos" error.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: libbb/obscure.c
|
||||
===================================================================
|
||||
--- libbb/obscure.c (revision 15697)
|
||||
+++ libbb/obscure.c (revision 15698)
|
||||
@@ -109,7 +109,7 @@
|
||||
return "similar to username";
|
||||
}
|
||||
/* no gecos as-is, as sub-string, reversed, capitalized, doubled */
|
||||
- if (string_checker(new_p, pw->pw_gecos)) {
|
||||
+ if (*pw->pw_gecos && string_checker(new_p, pw->pw_gecos)) {
|
||||
return "similar to gecos";
|
||||
}
|
||||
/* hostname as-is, as sub-string, reversed, capitalized, doubled */
|
||||
------------------------------------------------------------------------
|
||||
r15700 | landley | 2006-07-15 19:00:46 -0400 (Sat, 15 Jul 2006) | 4 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/include/libbb.h
|
||||
M /trunk/busybox/libbb/xfuncs.c
|
||||
|
||||
We need xsetuid() and xsetgid() because per-user process resource limits can
|
||||
prevent a process from switching to a user that has too many processes, and
|
||||
when that happens WE'RE STILL ROOT. See http://lwn.net/Articles/190331/
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: libbb/xfuncs.c
|
||||
===================================================================
|
||||
--- libbb/xfuncs.c (revision 15699)
|
||||
+++ libbb/xfuncs.c (revision 15700)
|
||||
@@ -232,3 +232,15 @@
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+#ifdef L_setuid
|
||||
+void xsetgid(gid_t gid)
|
||||
+{
|
||||
+ if (setgid(gid)) bb_error_msg_and_die("setgid");
|
||||
+}
|
||||
+
|
||||
+void xsetuid(uid_t uid)
|
||||
+{
|
||||
+ if (setuid(uid)) bb_error_msg_and_die("setuid");
|
||||
+}
|
||||
+#endif
|
||||
Index: include/libbb.h
|
||||
===================================================================
|
||||
--- include/libbb.h (revision 15699)
|
||||
+++ include/libbb.h (revision 15700)
|
||||
@@ -185,6 +185,8 @@
|
||||
extern bb_xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen);
|
||||
extern void bb_xlisten(int s, int backlog);
|
||||
extern void bb_xchdir(const char *path);
|
||||
+extern void xsetgid(gid_t gid);
|
||||
+extern void xsetuid(uid_t uid);
|
||||
|
||||
#define BB_GETOPT_ERROR 0x80000000UL
|
||||
extern const char *bb_opt_complementally;
|
||||
------------------------------------------------------------------------
|
||||
r15702 | landley | 2006-07-16 04:06:34 -0400 (Sun, 16 Jul 2006) | 2 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/loginutils/passwd.c
|
||||
M /trunk/busybox/networking/arping.c
|
||||
M /trunk/busybox/networking/ether-wake.c
|
||||
M /trunk/busybox/networking/fakeidentd.c
|
||||
M /trunk/busybox/networking/inetd.c
|
||||
M /trunk/busybox/networking/traceroute.c
|
||||
|
||||
Convert setuid/setgid users to xsetuid/xsetgid.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: networking/fakeidentd.c
|
||||
===================================================================
|
||||
--- networking/fakeidentd.c (revision 15701)
|
||||
+++ networking/fakeidentd.c (revision 15702)
|
||||
@@ -159,8 +159,8 @@
|
||||
|
||||
close(0);
|
||||
inetbind();
|
||||
- if (setgid(nogrp)) bb_error_msg_and_die("Could not setgid()");
|
||||
- if (setuid(nobody)) bb_error_msg_and_die("Could not setuid()");
|
||||
+ xsetgid(nogrp);
|
||||
+ xsetuid(nobody);
|
||||
close(1);
|
||||
close(2);
|
||||
|
||||
Index: networking/ether-wake.c
|
||||
===================================================================
|
||||
--- networking/ether-wake.c (revision 15701)
|
||||
+++ networking/ether-wake.c (revision 15702)
|
||||
@@ -145,7 +145,7 @@
|
||||
s = make_socket();
|
||||
|
||||
/* now that we have a raw socket we can drop root */
|
||||
- setuid(getuid());
|
||||
+ xsetuid(getuid());
|
||||
|
||||
/* look up the dest mac address */
|
||||
get_dest_addr(argv[optind], &eaddr);
|
||||
Index: networking/inetd.c
|
||||
===================================================================
|
||||
--- networking/inetd.c (revision 15701)
|
||||
+++ networking/inetd.c (revision 15702)
|
||||
@@ -1513,11 +1513,11 @@
|
||||
if (sep->se_group) {
|
||||
pwd->pw_gid = grp->gr_gid;
|
||||
}
|
||||
- setgid ((gid_t) pwd->pw_gid);
|
||||
+ xsetgid ((gid_t) pwd->pw_gid);
|
||||
initgroups (pwd->pw_name, pwd->pw_gid);
|
||||
- setuid ((uid_t) pwd->pw_uid);
|
||||
+ xsetuid((uid_t) pwd->pw_uid);
|
||||
} else if (sep->se_group) {
|
||||
- setgid (grp->gr_gid);
|
||||
+ xsetgid(grp->gr_gid);
|
||||
setgroups (1, &grp->gr_gid);
|
||||
}
|
||||
dup2 (ctrl, 0);
|
||||
Index: networking/traceroute.c
|
||||
===================================================================
|
||||
--- networking/traceroute.c (revision 15701)
|
||||
+++ networking/traceroute.c (revision 15702)
|
||||
@@ -941,7 +941,6 @@
|
||||
#endif
|
||||
u_short off = 0;
|
||||
struct IFADDRLIST *al;
|
||||
- int uid = getuid();
|
||||
char *device = NULL;
|
||||
int max_ttl = 30;
|
||||
char *max_ttl_str = NULL;
|
||||
@@ -1010,8 +1009,7 @@
|
||||
* set the ip source address of the outbound
|
||||
* probe (e.g., on a multi-homed host).
|
||||
*/
|
||||
- if (uid)
|
||||
- bb_error_msg_and_die("-s %s: Permission denied", source);
|
||||
+ if (getuid()) bb_error_msg_and_die("-s %s: Permission denied", source);
|
||||
}
|
||||
if(waittime_str)
|
||||
waittime = str2val(waittime_str, "wait time", 2, 24 * 60 * 60);
|
||||
@@ -1160,8 +1158,8 @@
|
||||
sizeof(on));
|
||||
|
||||
/* Revert to non-privileged user after opening sockets */
|
||||
- setgid(getgid());
|
||||
- setuid(uid);
|
||||
+ xsetgid(getgid());
|
||||
+ xsetuid(getuid());
|
||||
|
||||
outip = (struct ip *)xcalloc(1, (unsigned)packlen);
|
||||
|
||||
Index: networking/arping.c
|
||||
===================================================================
|
||||
--- networking/arping.c (revision 15701)
|
||||
+++ networking/arping.c (revision 15702)
|
||||
@@ -262,7 +262,8 @@
|
||||
s = socket(PF_PACKET, SOCK_DGRAM, 0);
|
||||
ifindex = errno;
|
||||
|
||||
- setuid(getuid());
|
||||
+ // Drop suid root privileges
|
||||
+ xsetuid(getuid());
|
||||
|
||||
{
|
||||
unsigned long opt;
|
||||
Index: loginutils/passwd.c
|
||||
===================================================================
|
||||
--- loginutils/passwd.c (revision 15701)
|
||||
+++ loginutils/passwd.c (revision 15702)
|
||||
@@ -227,10 +227,7 @@
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGQUIT, SIG_IGN);
|
||||
umask(077);
|
||||
- if (setuid(0)) {
|
||||
- syslog(LOG_ERR, "can't setuid(0)");
|
||||
- bb_error_msg_and_die( "Cannot change ID to root.\n");
|
||||
- }
|
||||
+ xsetuid(0);
|
||||
if (!update_passwd(pw, crypt_passwd)) {
|
||||
syslog(LOG_INFO, "password for `%s' changed by user `%s'", name,
|
||||
myname);
|
||||
------------------------------------------------------------------------
|
||||
r15705 | landley | 2006-07-16 14:58:18 -0400 (Sun, 16 Jul 2006) | 2 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/loginutils/adduser.c
|
||||
|
||||
Bugfix from Tito to make sure /etc/group gets updated.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: loginutils/adduser.c
|
||||
===================================================================
|
||||
--- loginutils/adduser.c (revision 15704)
|
||||
+++ loginutils/adduser.c (revision 15705)
|
||||
@@ -96,6 +96,7 @@
|
||||
static int adduser(struct passwd *p, unsigned long flags)
|
||||
{
|
||||
FILE *file;
|
||||
+ int addgroup = !p->pw_gid;
|
||||
|
||||
/* make sure everything is kosher and setup uid && gid */
|
||||
file = bb_xfopen(bb_path_passwd_file, "a");
|
||||
@@ -132,9 +133,8 @@
|
||||
/* add to group */
|
||||
/* addgroup should be responsible for dealing w/ gshadow */
|
||||
/* if using a pre-existing group, don't create one */
|
||||
- if (p->pw_gid == 0) {
|
||||
- addgroup_wrapper(p);
|
||||
- }
|
||||
+ if (addgroup) addgroup_wrapper(p);
|
||||
+
|
||||
/* Clear the umask for this process so it doesn't
|
||||
* * screw up the permissions on the mkdir and chown. */
|
||||
umask(0);
|
||||
------------------------------------------------------------------------
|
||||
r15727 | landley | 2006-07-19 17:33:42 -0400 (Wed, 19 Jul 2006) | 4 lines
|
||||
Changed paths:
|
||||
M /trunk/busybox/modutils/modprobe.c
|
||||
|
||||
Patch from Yann Morin to look for modules.conf in the right place on 2.6.
|
||||
Fixes http://bugs.busybox.net/view.php?id=942
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Index: modutils/modprobe.c
|
||||
===================================================================
|
||||
--- modutils/modprobe.c (revision 15726)
|
||||
+++ modutils/modprobe.c (revision 15727)
|
||||
@@ -545,29 +545,37 @@
|
||||
}
|
||||
close ( fd );
|
||||
|
||||
+ /*
|
||||
+ * First parse system-specific options and aliases
|
||||
+ * as they take precedence over the kernel ones.
|
||||
+ */
|
||||
if (!ENABLE_FEATURE_2_6_MODULES
|
||||
|| ( fd = open ( "/etc/modprobe.conf", O_RDONLY )) < 0 )
|
||||
if (( fd = open ( "/etc/modules.conf", O_RDONLY )) < 0 )
|
||||
- if (( fd = open ( "/etc/conf.modules", O_RDONLY )) < 0 )
|
||||
- return first;
|
||||
+ fd = open ( "/etc/conf.modules", O_RDONLY );
|
||||
|
||||
- include_conf (&first, ¤t, buffer, sizeof(buffer), fd);
|
||||
- close(fd);
|
||||
+ if (fd >= 0) {
|
||||
+ include_conf (&first, ¤t, buffer, sizeof(buffer), fd);
|
||||
+ close(fd);
|
||||
+ }
|
||||
|
||||
- filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release);
|
||||
- fd = open ( filename, O_RDONLY );
|
||||
- if (ENABLE_FEATURE_CLEAN_UP)
|
||||
- free(filename);
|
||||
- if (fd < 0) {
|
||||
- /* Ok, that didn't work. Fall back to looking in /lib/modules */
|
||||
- if (( fd = open ( "/lib/modules/modules.alias", O_RDONLY )) < 0 ) {
|
||||
- return first;
|
||||
+ /* Only 2.6 has a modules.alias file */
|
||||
+ if (ENABLE_FEATURE_2_6_MODULES) {
|
||||
+ /* Parse kernel-declared aliases */
|
||||
+ filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release);
|
||||
+ if ((fd = open ( filename, O_RDONLY )) < 0) {
|
||||
+ /* Ok, that didn't work. Fall back to looking in /lib/modules */
|
||||
+ fd = open ( "/lib/modules/modules.alias", O_RDONLY );
|
||||
}
|
||||
+ if (ENABLE_FEATURE_CLEAN_UP)
|
||||
+ free(filename);
|
||||
+
|
||||
+ if (fd >= 0) {
|
||||
+ include_conf (&first, ¤t, buffer, sizeof(buffer), fd);
|
||||
+ close(fd);
|
||||
+ }
|
||||
}
|
||||
|
||||
- include_conf (&first, ¤t, buffer, sizeof(buffer), fd);
|
||||
- close(fd);
|
||||
-
|
||||
return first;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,20 @@ config CONFIG_RESET
|
||||
This program is used to reset the terminal screen, if it
|
||||
gets messed up.
|
||||
|
||||
config CONFIG_SETCONSOLE
|
||||
bool "setconsole"
|
||||
default n
|
||||
help
|
||||
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
|
||||
@@ -65,4 +79,10 @@ config CONFIG_SETKEYCODES
|
||||
This program loads entries into the kernel's scancode-to-keycode
|
||||
map, allowing unusual keyboards to generate usable keycodes.
|
||||
|
||||
config CONFIG_SETLOGCONS
|
||||
bool "setlogcons"
|
||||
default n
|
||||
help
|
||||
This program redirects the output console of kernel messages.
|
||||
|
||||
endmenu
|
||||
+7
-16
@@ -1,27 +1,18 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# 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
|
||||
# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Licensed under the GPL v2, see the file LICENSE in this tarball.
|
||||
|
||||
ifndef top_srcdir
|
||||
top_srcdir=..
|
||||
endif
|
||||
ifndef top_builddir
|
||||
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)
|
||||
|
||||
+23
-29
@@ -1,21 +1,8 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# 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
|
||||
# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Licensed under the GPL v2, see the file LICENSE in this tarball.
|
||||
|
||||
CONSOLETOOLS_AR:=console-tools.a
|
||||
ifndef $(CONSOLETOOLS_DIR)
|
||||
@@ -23,22 +10,29 @@ CONSOLETOOLS_DIR:=$(top_builddir)/console-tools/
|
||||
endif
|
||||
srcdir=$(top_srcdir)/console-tools
|
||||
|
||||
CONSOLETOOLS_DIR-y:=
|
||||
CONSOLETOOLS_DIR-$(CONFIG_CHVT) += chvt.o
|
||||
CONSOLETOOLS_DIR-$(CONFIG_CLEAR) += clear.o
|
||||
CONSOLETOOLS_DIR-$(CONFIG_DEALLOCVT) += deallocvt.o
|
||||
CONSOLETOOLS_DIR-$(CONFIG_DUMPKMAP) += dumpkmap.o
|
||||
CONSOLETOOLS_DIR-$(CONFIG_LOADFONT) += loadfont.o
|
||||
CONSOLETOOLS_DIR-$(CONFIG_LOADKMAP) += loadkmap.o
|
||||
CONSOLETOOLS_DIR-$(CONFIG_OPENVT) += openvt.o
|
||||
CONSOLETOOLS_DIR-$(CONFIG_RESET) += reset.o
|
||||
CONSOLETOOLS_DIR-$(CONFIG_SETKEYCODES) += setkeycodes.o
|
||||
CONSOLETOOLS-y:=
|
||||
CONSOLETOOLS-$(CONFIG_CHVT) += chvt.o
|
||||
CONSOLETOOLS-$(CONFIG_CLEAR) += clear.o
|
||||
CONSOLETOOLS-$(CONFIG_DEALLOCVT) += deallocvt.o
|
||||
CONSOLETOOLS-$(CONFIG_DUMPKMAP) += dumpkmap.o
|
||||
CONSOLETOOLS-$(CONFIG_SETCONSOLE) += setconsole.o
|
||||
CONSOLETOOLS-$(CONFIG_LOADFONT) += loadfont.o
|
||||
CONSOLETOOLS-$(CONFIG_LOADKMAP) += loadkmap.o
|
||||
CONSOLETOOLS-$(CONFIG_OPENVT) += openvt.o
|
||||
CONSOLETOOLS-$(CONFIG_RESET) += reset.o
|
||||
CONSOLETOOLS-$(CONFIG_SETKEYCODES) += setkeycodes.o
|
||||
CONSOLETOOLS-$(CONFIG_SETLOGCONS) += setlogcons.o
|
||||
|
||||
ifneq ($(strip $(CONSOLETOOLS-y)),)
|
||||
libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR)
|
||||
endif
|
||||
CONSOLETOOLS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(CONSOLETOOLS-y))
|
||||
CONSOLETOOLS_SRC-a:=$(wildcard $(srcdir)/*.c)
|
||||
APPLET_SRC-y+=$(CONSOLETOOLS_SRC-y)
|
||||
APPLET_SRC-a+=$(CONSOLETOOLS_SRC-a)
|
||||
|
||||
$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
|
||||
$(AR) -ro $@ $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
|
||||
$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS-y))
|
||||
$(do_ar)
|
||||
|
||||
$(CONSOLETOOLS_DIR)%.o: $(srcdir)/%.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
$(compile.c)
|
||||
+8
-31
@@ -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>
|
||||
@@ -29,8 +15,10 @@
|
||||
#include "busybox.h"
|
||||
|
||||
/* From <linux/vt.h> */
|
||||
static const int VT_ACTIVATE = 0x5606; /* make vt active */
|
||||
static const int VT_WAITACTIVE = 0x5607; /* wait for vt active */
|
||||
enum {
|
||||
VT_ACTIVATE = 0x5606, /* make vt active */
|
||||
VT_WAITACTIVE = 0x5607 /* wait for vt active */
|
||||
};
|
||||
|
||||
int chvt_main(int argc, char **argv)
|
||||
{
|
||||
@@ -42,20 +30,9 @@ int chvt_main(int argc, char **argv)
|
||||
|
||||
fd = get_console_fd();
|
||||
num = bb_xgetlarg(argv[1], 10, 0, INT_MAX);
|
||||
if (ioctl(fd, VT_ACTIVATE, num)) {
|
||||
bb_perror_msg_and_die("VT_ACTIVATE");
|
||||
}
|
||||
if (ioctl(fd, VT_WAITACTIVE, num)) {
|
||||
bb_perror_msg_and_die("VT_WAITACTIVE");
|
||||
if ((-1 == ioctl(fd, VT_ACTIVATE, num))
|
||||
|| (-1 == ioctl(fd, VT_WAITACTIVE, num))) {
|
||||
bb_perror_msg_and_die("ioctl");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+3
-16
@@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -27,8 +15,7 @@
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
extern int clear_main(int argc, char **argv)
|
||||
int clear_main(int argc, char **argv)
|
||||
{
|
||||
printf("\033[H\033[J");
|
||||
return EXIT_SUCCESS;
|
||||
return printf("\033[H\033[J") != 6;
|
||||
}
|
||||
@@ -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 */
|
||||
@@ -30,26 +18,26 @@
|
||||
#include "busybox.h"
|
||||
|
||||
/* From <linux/vt.h> */
|
||||
static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
|
||||
enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */
|
||||
|
||||
int deallocvt_main(int argc, char *argv[])
|
||||
{
|
||||
/* num = 0 deallocate all unused consoles */
|
||||
int num = 0;
|
||||
|
||||
switch(argc)
|
||||
{
|
||||
switch (argc) {
|
||||
case 2:
|
||||
if((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0)
|
||||
if ((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0) {
|
||||
bb_error_msg_and_die("0: illegal VT number");
|
||||
/* Falltrough */
|
||||
}
|
||||
/* Fallthrough */
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
if (ioctl( get_console_fd(), VT_DISALLOCATE, num )) {
|
||||
if (-1 == ioctl(get_console_fd(), VT_DISALLOCATE, num)) {
|
||||
bb_perror_msg_and_die("VT_DISALLOCATE");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
+19
-38
@@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -35,11 +23,11 @@ struct kbentry {
|
||||
unsigned char kb_index;
|
||||
unsigned short kb_value;
|
||||
};
|
||||
static const int KDGKBENT = 0x4B46; /* gets one entry in translation table */
|
||||
#define KDGKBENT 0x4B46 /* gets one entry in translation table */
|
||||
|
||||
/* From <linux/keyboard.h> */
|
||||
static const int NR_KEYS = 128;
|
||||
static const int MAX_NR_KEYMAPS = 256;
|
||||
#define NR_KEYS 128
|
||||
#define MAX_NR_KEYMAPS 256
|
||||
|
||||
int dumpkmap_main(int argc, char **argv)
|
||||
{
|
||||
@@ -47,28 +35,21 @@ int dumpkmap_main(int argc, char **argv)
|
||||
int i, j, fd;
|
||||
char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap";
|
||||
|
||||
if (argc>=2 && *argv[1]=='-') {
|
||||
if (argc >= 2 && *argv[1] == '-')
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
fd=bb_xopen(CURRENT_VC, O_RDWR);
|
||||
fd = bb_xopen(CURRENT_VC, O_RDWR);
|
||||
|
||||
write(1, magic, 7);
|
||||
|
||||
for (i=0; i < MAX_NR_KEYMAPS; i++) flags[i]=0;
|
||||
flags[0]=1;
|
||||
flags[1]=1;
|
||||
flags[2]=1;
|
||||
flags[4]=1;
|
||||
flags[5]=1;
|
||||
flags[6]=1;
|
||||
flags[8]=1;
|
||||
flags[9]=1;
|
||||
flags[10]=1;
|
||||
flags[12]=1;
|
||||
/* Here we want to set everything to 0 except for indexes:
|
||||
* [0-2] [4-6] [8-10] [12] */
|
||||
memset(flags, 0x00, MAX_NR_KEYMAPS);
|
||||
memset(flags, 0x01, 13);
|
||||
flags[3] = flags[7] = flags[11] = 0;
|
||||
|
||||
/* dump flags */
|
||||
for (i=0; i < MAX_NR_KEYMAPS; i++) write(1,&flags[i],1);
|
||||
write(1, flags, MAX_NR_KEYMAPS);
|
||||
|
||||
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
|
||||
if (flags[i] == 1) {
|
||||
@@ -76,13 +57,13 @@ int dumpkmap_main(int argc, char **argv)
|
||||
ke.kb_index = j;
|
||||
ke.kb_table = i;
|
||||
if (ioctl(fd, KDGKBENT, &ke) < 0) {
|
||||
|
||||
bb_error_msg("ioctl returned: %m, %s, %s, %xqq", (char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
|
||||
}
|
||||
else {
|
||||
write(1,(void*)&ke.kb_value,2);
|
||||
}
|
||||
|
||||
bb_perror_msg("ioctl failed with %s, %s, %p",
|
||||
(char *)&ke.kb_index,
|
||||
(char *)&ke.kb_table,
|
||||
&ke.kb_value);
|
||||
} else {
|
||||
write(1, (void*)&ke.kb_value, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-15
@@ -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>
|
||||
@@ -21,13 +20,15 @@
|
||||
#include <endian.h>
|
||||
#include "busybox.h"
|
||||
|
||||
static const int PSF_MAGIC1 = 0x36;
|
||||
static const int PSF_MAGIC2 = 0x04;
|
||||
enum{
|
||||
PSF_MAGIC1 = 0x36,
|
||||
PSF_MAGIC2 = 0x04,
|
||||
|
||||
static const int PSF_MODE512 = 0x01;
|
||||
static const int PSF_MODEHASTAB = 0x02;
|
||||
static const int PSF_MAXMODE = 0x03;
|
||||
static const int PSF_SEPARATOR = 0xFFFF;
|
||||
PSF_MODE512 = 0x01,
|
||||
PSF_MODEHASTAB = 0x02,
|
||||
PSF_MAXMODE = 0x03,
|
||||
PSF_SEPARATOR = 0xFFFF
|
||||
};
|
||||
|
||||
struct psf_header {
|
||||
unsigned char magic1, magic2; /* Magic number */
|
||||
@@ -39,7 +40,7 @@ struct psf_header {
|
||||
|
||||
static void loadnewfont(int fd);
|
||||
|
||||
extern int loadfont_main(int argc, char **argv)
|
||||
int loadfont_main(int argc, char **argv)
|
||||
{
|
||||
int fd;
|
||||
|
||||
@@ -52,7 +53,7 @@ extern int loadfont_main(int argc, char **argv)
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
|
||||
static void do_loadfont(int fd, unsigned char *inbuf, int unit, int fontsize)
|
||||
{
|
||||
char buf[16384];
|
||||
int i;
|
||||
@@ -126,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");
|
||||
}
|
||||
}
|
||||
@@ -138,7 +134,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
|
||||
static void loadnewfont(int fd)
|
||||
{
|
||||
int unit;
|
||||
char inbuf[32768]; /* primitive */
|
||||
unsigned char inbuf[32768]; /* primitive */
|
||||
unsigned int inputlth, offset;
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
+11
-42
@@ -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 */
|
||||
@@ -35,28 +23,19 @@
|
||||
int openvt_main(int argc, char **argv)
|
||||
{
|
||||
int fd;
|
||||
char vtname[sizeof VC_FORMAT + 2];
|
||||
char vtname[sizeof(VC_FORMAT) + 2];
|
||||
|
||||
|
||||
if (argc < 3)
|
||||
bb_show_usage();
|
||||
|
||||
if (argc < 3) {
|
||||
bb_show_usage();
|
||||
}
|
||||
/* check for Illegal vt number: < 1 or > 12 */
|
||||
sprintf(vtname, VC_FORMAT,(int)bb_xgetlarg(argv[1], 10, 1, 12));
|
||||
sprintf(vtname, VC_FORMAT, (int)bb_xgetlarg(argv[1], 10, 1, 12));
|
||||
|
||||
argv+=2;
|
||||
argc-=2;
|
||||
|
||||
if(fork() == 0) {
|
||||
if (fork() == 0) {
|
||||
/* leave current vt */
|
||||
|
||||
#ifdef ESIX_5_3_2_D
|
||||
if (setpgrp() < 0) {
|
||||
#else
|
||||
if (setsid() < 0) {
|
||||
#endif
|
||||
|
||||
bb_perror_msg_and_die("Unable to set new session");
|
||||
bb_perror_msg_and_die("setsid");
|
||||
}
|
||||
close(0); /* so that new vt becomes stdin */
|
||||
|
||||
@@ -64,21 +43,11 @@ int openvt_main(int argc, char **argv)
|
||||
fd = bb_xopen(vtname, O_RDWR);
|
||||
|
||||
/* Reassign stdout and sterr */
|
||||
close(1);
|
||||
close(2);
|
||||
dup(fd);
|
||||
dup(fd);
|
||||
dup2(fd, STDOUT_FILENO);
|
||||
dup2(fd, STDERR_FILENO);
|
||||
|
||||
execvp(argv[0], argv);
|
||||
execvp(argv[2], &argv[2]);
|
||||
_exit(1);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+4
-17
@@ -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 */
|
||||
@@ -28,14 +15,14 @@
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int reset_main(int argc, char **argv)
|
||||
int reset_main(int argc, char **argv)
|
||||
{
|
||||
if (isatty(0) || isatty(0) || isatty(0)) {
|
||||
if (isatty(1)) {
|
||||
/* See 'man 4 console_codes' for details:
|
||||
* "ESC c" -- Reset
|
||||
* "ESC ( K" -- Select user mapping
|
||||
* "ESC [ J" -- Erase display
|
||||
* "ESC [ 0 m" -- Reset all Graphics Rendition display attributes
|
||||
* "ESC [ 0 m" -- Reset all display attributes
|
||||
* "ESC [ ? 25 h" -- Make cursor visible.
|
||||
*/
|
||||
printf("\033c\033(K\033[J\033[0m\033[?25h");
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* setconsole.c - redirect system console output
|
||||
*
|
||||
* Copyright (C) 2004,2005 Enrik Berkhan <Enrik.Berkhan@inka.de>
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <getopt.h> /* struct option */
|
||||
|
||||
#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
|
||||
|
||||
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)
|
||||
bb_show_usage();
|
||||
|
||||
if (argc - optind == 1) {
|
||||
if (flags & OPT_SETCONS_RESET)
|
||||
bb_show_usage();
|
||||
device = argv[optind];
|
||||
} else {
|
||||
if (flags & OPT_SETCONS_RESET)
|
||||
device = CONSOLE_DEV;
|
||||
}
|
||||
|
||||
if (-1 == ioctl(bb_xopen(device, O_RDONLY), TIOCCONS)) {
|
||||
bb_perror_msg_and_die("TIOCCONS");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -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>
|
||||
@@ -33,7 +20,9 @@
|
||||
struct kbkeycode {
|
||||
unsigned int scancode, keycode;
|
||||
};
|
||||
static const int KDSETKEYCODE = 0x4B4D; /* write kernel keycode table entry */
|
||||
enum {
|
||||
KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */
|
||||
};
|
||||
|
||||
extern int
|
||||
setkeycodes_main(int argc, char** argv)
|
||||
@@ -45,7 +34,7 @@ setkeycodes_main(int argc, char** argv)
|
||||
if (argc % 2 != 1 || argc < 2) {
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
|
||||
fd = get_console_fd();
|
||||
|
||||
while (argc > 2) {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* setlogcons: Send kernel messages to the current console or to console N
|
||||
*
|
||||
* Copyright (C) 2006 by Jan Kiszka <jan.kiszka@web.de>
|
||||
*
|
||||
* Based on setlogcons (kbd-1.12) by Andries E. Brouwer
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int setlogcons_main(int argc, char **argv)
|
||||
{
|
||||
struct {
|
||||
char fn;
|
||||
char subarg;
|
||||
} arg;
|
||||
|
||||
arg.fn = 11; /* redirect kernel messages */
|
||||
arg.subarg = 0; /* to specified console (current as default) */
|
||||
|
||||
if (argc == 2)
|
||||
arg.subarg = atoi(argv[1]);
|
||||
|
||||
if (ioctl(bb_xopen(VC_1, O_RDONLY), TIOCLINUX, &arg))
|
||||
bb_perror_msg_and_die("TIOCLINUX");;
|
||||
|
||||
return 0;
|
||||
}
|
||||
+250
-88
@@ -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
|
||||
@@ -59,6 +72,13 @@ config CONFIG_CMP
|
||||
cmp is used to compare two files and returns the result
|
||||
to standard output.
|
||||
|
||||
config CONFIG_COMM
|
||||
bool "comm"
|
||||
default n
|
||||
help
|
||||
comm is used to compare two files line by line and return
|
||||
a three-column output.
|
||||
|
||||
config CONFIG_CP
|
||||
bool "cp"
|
||||
default n
|
||||
@@ -72,23 +92,15 @@ config CONFIG_CUT
|
||||
cut is used to print selected parts of lines from
|
||||
each file to stdout.
|
||||
|
||||
if CONFIG_WATCH
|
||||
config CONFIG_DATE
|
||||
default y
|
||||
comment "date (forced enabled for use with watch)"
|
||||
endif
|
||||
|
||||
if !CONFIG_WATCH
|
||||
config CONFIG_DATE
|
||||
bool "date"
|
||||
default n
|
||||
help
|
||||
date is used to set the system date or display the
|
||||
current time in the given format.
|
||||
endif
|
||||
config CONFIG_DATE
|
||||
bool "date"
|
||||
default n
|
||||
help
|
||||
date is used to set the system date or display the
|
||||
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
|
||||
@@ -103,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
|
||||
@@ -110,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
|
||||
@@ -128,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)"
|
||||
@@ -136,21 +203,22 @@ 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
|
||||
Use a blocksize of (1K) instead of the default 512b.
|
||||
|
||||
config CONFIG_ECHO
|
||||
bool "echo (basic SUSv3 version taking no options)"
|
||||
bool "echo (basic SuSv3 version taking no options)"
|
||||
default n
|
||||
help
|
||||
echo is used to print a specified string to stdout.
|
||||
|
||||
# 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
|
||||
@@ -171,19 +246,20 @@ config CONFIG_EXPR
|
||||
expr is used to calculate numbers and print the result
|
||||
to standard output.
|
||||
|
||||
if CONFIG_HUSH || CONFIG_LASH || CONFIG_MSH
|
||||
config CONFIG_FALSE
|
||||
default y
|
||||
comment "false (forced enabled for use with shell)"
|
||||
endif
|
||||
config CONFIG_EXPR_MATH_SUPPORT_64
|
||||
bool "Extend Posix numbers support to 64 bit"
|
||||
default n
|
||||
depends on CONFIG_EXPR
|
||||
help
|
||||
Enable 64-bit math support in the expr applet. This will make
|
||||
the applet slightly larger, but will allow computation with very
|
||||
large numbers.
|
||||
|
||||
if !CONFIG_HUSH && !CONFIG_LASH && !CONFIG_MSH
|
||||
config CONFIG_FALSE
|
||||
bool "false"
|
||||
default n
|
||||
help
|
||||
false returns an exit code of FALSE (1).
|
||||
endif
|
||||
config CONFIG_FALSE
|
||||
bool "false"
|
||||
default n
|
||||
help
|
||||
false returns an exit code of FALSE (1).
|
||||
|
||||
config CONFIG_FOLD
|
||||
bool "fold"
|
||||
@@ -199,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
|
||||
@@ -224,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
|
||||
@@ -249,53 +332,64 @@ 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 " Use 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
|
||||
Allow ls to use color when displaying files.
|
||||
This enables the --color option to ls.
|
||||
|
||||
config CONFIG_FEATURE_LS_COLOR_IS_DEFAULT
|
||||
bool "Produce colored ls output by default"
|
||||
default n
|
||||
depends on CONFIG_FEATURE_LS_COLOR
|
||||
help
|
||||
Saying yes here will turn coloring on by default,
|
||||
even if no "--color" option is given to the ls command.
|
||||
This is not recommended, since the colors are not
|
||||
configurable, and the output may not be legible on
|
||||
many output screens.
|
||||
|
||||
config CONFIG_MD5SUM
|
||||
bool "md5sum"
|
||||
@@ -309,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
|
||||
@@ -329,12 +430,37 @@ 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
|
||||
help
|
||||
nice runs a program with modified scheduling priority.
|
||||
|
||||
config CONFIG_NOHUP
|
||||
bool "nohup"
|
||||
default n
|
||||
help
|
||||
run a command immune to hangups, with output to a non-tty.
|
||||
|
||||
config CONFIG_OD
|
||||
bool "od"
|
||||
default n
|
||||
help
|
||||
od is used to dump binary files in octal and other formats.
|
||||
|
||||
config CONFIG_PRINTENV
|
||||
bool "printenv"
|
||||
default n
|
||||
help
|
||||
printenv is used to print all or part of environment.
|
||||
|
||||
config CONFIG_PRINTF
|
||||
bool "printf"
|
||||
default n
|
||||
@@ -386,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
|
||||
@@ -398,12 +524,45 @@ config CONFIG_SORT
|
||||
help
|
||||
sort is used to sort lines of text in specified files.
|
||||
|
||||
config CONFIG_FEATURE_SORT_BIG
|
||||
bool "full SuSv3 compliant sort (Support -ktcsbdfiozgM)"
|
||||
default y
|
||||
depends on CONFIG_SORT
|
||||
help
|
||||
Without this, sort only supports -r, -u, and an integer version
|
||||
of -n. Selecting this adds sort keys, floating point support, and
|
||||
more. This adds a little over 3k to a nonstatic build on x86.
|
||||
|
||||
The SuSv3 sort standard is available at:
|
||||
http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
|
||||
|
||||
config CONFIG_STAT
|
||||
bool "stat"
|
||||
default n
|
||||
help
|
||||
display file or filesystem status.
|
||||
|
||||
config CONFIG_FEATURE_STAT_FORMAT
|
||||
bool "Enable custom formats (-c)"
|
||||
default n
|
||||
depends on CONFIG_STAT
|
||||
help
|
||||
Without this, stat will not support the '-c format' option where
|
||||
users can pass a custom format string for output. This adds about
|
||||
7k to a nonstatic build on amd64.
|
||||
|
||||
config CONFIG_STTY
|
||||
bool "stty"
|
||||
default n
|
||||
help
|
||||
stty is used to change and print terminal line settings.
|
||||
|
||||
config CONFIG_SUM
|
||||
bool "sum"
|
||||
default n
|
||||
help
|
||||
checksum and count the blocks in a file
|
||||
|
||||
config CONFIG_SYNC
|
||||
bool "sync"
|
||||
default n
|
||||
@@ -418,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
|
||||
@@ -433,30 +592,22 @@ 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
|
||||
Enable this option for a faster tee, at expense of size.
|
||||
|
||||
if CONFIG_ASH || CONFIG_HUSH || CONFIG_LASH || CONFIG_MSH
|
||||
config CONFIG_TEST
|
||||
default y
|
||||
comment "test (forced enabled for use with shell)"
|
||||
endif
|
||||
|
||||
if !CONFIG_ASH && !CONFIG_HUSH && !CONFIG_LASH && !CONFIG_MSH
|
||||
config CONFIG_TEST
|
||||
bool "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.
|
||||
endif
|
||||
config CONFIG_TEST
|
||||
bool "test"
|
||||
default n
|
||||
help
|
||||
test is used to check file types and compare values,
|
||||
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
|
||||
@@ -476,20 +627,30 @@ config CONFIG_TR
|
||||
tr is used to squeeze, and/or delete characters from standard
|
||||
input, writing to standard output.
|
||||
|
||||
if CONFIG_HUSH || CONFIG_LASH || CONFIG_MSH
|
||||
config CONFIG_TRUE
|
||||
default y
|
||||
comment "true (forced enabled for use with shell)"
|
||||
endif
|
||||
config CONFIG_FEATURE_TR_CLASSES
|
||||
bool "Enable character classes (such as [:upper:])"
|
||||
default n
|
||||
depends on CONFIG_TR
|
||||
help
|
||||
Enable character classes, enabling commands such as:
|
||||
tr [:upper:] [:lower:] to convert input into lowercase.
|
||||
|
||||
if !CONFIG_HUSH && !CONFIG_LASH && !CONFIG_MSH
|
||||
config CONFIG_TRUE
|
||||
bool "true"
|
||||
default n
|
||||
help
|
||||
true returns an exit code of TRUE (0).
|
||||
config CONFIG_FEATURE_TR_EQUIV
|
||||
bool "Enable equivalence classes"
|
||||
default n
|
||||
depends on CONFIG_TR
|
||||
help
|
||||
Enable equivalence classes, which essentially add the enclosed
|
||||
character to the current set. For instance, tr [=a=] xyz would
|
||||
replace all instances of 'a' with 'xyz'. This option is mainly
|
||||
useful for cases when no other way of expressing a character
|
||||
is possible.
|
||||
|
||||
endif
|
||||
config CONFIG_TRUE
|
||||
bool "true"
|
||||
default n
|
||||
help
|
||||
true returns an exit code of TRUE (0).
|
||||
|
||||
config CONFIG_TTY
|
||||
bool "tty"
|
||||
@@ -531,6 +692,7 @@ config CONFIG_UUENCODE
|
||||
config CONFIG_WATCH
|
||||
bool "watch"
|
||||
default n
|
||||
select CONFIG_DATE
|
||||
help
|
||||
watch is used to execute a program periodically, showing
|
||||
output to the screen.
|
||||
@@ -545,7 +707,7 @@ config CONFIG_WC
|
||||
config CONFIG_WHO
|
||||
bool "who"
|
||||
default n
|
||||
select CONFIG_FEATURE_U_W_TMP
|
||||
select CONFIG_FEATURE_UTMP
|
||||
help
|
||||
who is used to show who is logged on.
|
||||
|
||||
@@ -564,44 +726,44 @@ config CONFIG_YES
|
||||
the default string `y'.
|
||||
|
||||
comment "Common options for cp and mv"
|
||||
depends on CONFIG_CP || CONFIG_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
|
||||
Allow cp and mv to preserve hard links.
|
||||
|
||||
comment "Common options for ls and more"
|
||||
depends on CONFIG_LS || CONFIG_MORE
|
||||
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
|
||||
depends on CONFIG_LS || CONFIG_MORE || CONFIG_TELNET
|
||||
help
|
||||
This option allows utilities such as 'ls' and 'more' to determine the
|
||||
width of the screen, which can allow them to display additional text
|
||||
or avoid wrapping text onto the next line. If you leave this
|
||||
disabled, your utilities will be especially primitive and will be
|
||||
unable to determine the current screen width.
|
||||
This option allows utilities such as 'ls', 'more' and 'telnet'
|
||||
to determine the width of the screen, which can allow them to
|
||||
display additional text or avoid wrapping text onto the next line.
|
||||
If you leave this disabled, your utilities will be especially
|
||||
primitive and will be unable to determine the current screen width.
|
||||
|
||||
comment "Common options for df, du, ls"
|
||||
depends on CONFIG_DF || CONFIG_DU || CONFIG_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
|
||||
Allow df, du, and ls to have human readable output.
|
||||
|
||||
comment "Common options for md5sum, sha1sum"
|
||||
depends on CONFIG_MD5SUM || CONFIG_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
|
||||
|
||||
+7
-16
@@ -1,27 +1,18 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# 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
|
||||
# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Licensed under the GPL v2, see the file LICENSE in this tarball.
|
||||
|
||||
ifndef top_srcdir
|
||||
top_srcdir=..
|
||||
endif
|
||||
ifndef top_builddir
|
||||
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)
|
||||
|
||||
+85
-81
@@ -1,21 +1,8 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# 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
|
||||
# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Licensed under the GPL v2, see the file LICENSE in this tarball.
|
||||
|
||||
COREUTILS_AR:=coreutils.a
|
||||
ifndef $(COREUTILS_DIR)
|
||||
@@ -24,75 +11,92 @@ endif
|
||||
srcdir=$(top_srcdir)/coreutils
|
||||
|
||||
COREUTILS-y:=
|
||||
COREUTILS-$(CONFIG_BASENAME) += basename.o
|
||||
COREUTILS-$(CONFIG_CAL) += cal.o
|
||||
COREUTILS-$(CONFIG_CAT) += cat.o
|
||||
COREUTILS-$(CONFIG_CHGRP) += chgrp.o
|
||||
COREUTILS-$(CONFIG_CHMOD) += chmod.o
|
||||
COREUTILS-$(CONFIG_CHOWN) += chown.o
|
||||
COREUTILS-$(CONFIG_CHROOT) += chroot.o
|
||||
COREUTILS-$(CONFIG_CMP) += cmp.o
|
||||
COREUTILS-$(CONFIG_CP) += cp.o
|
||||
COREUTILS-$(CONFIG_CUT) += cut.o
|
||||
COREUTILS-$(CONFIG_DATE) += date.o
|
||||
COREUTILS-$(CONFIG_DD) += dd.o
|
||||
COREUTILS-$(CONFIG_DF) += df.o
|
||||
COREUTILS-$(CONFIG_DIRNAME) += dirname.o
|
||||
COREUTILS-$(CONFIG_DOS2UNIX) += dos2unix.o
|
||||
COREUTILS-$(CONFIG_DU) += du.o
|
||||
COREUTILS-$(CONFIG_ECHO) += echo.o
|
||||
COREUTILS-$(CONFIG_ENV) += env.o
|
||||
COREUTILS-$(CONFIG_EXPR) += expr.o
|
||||
COREUTILS-$(CONFIG_FALSE) += false.o
|
||||
COREUTILS-$(CONFIG_FOLD) += fold.o
|
||||
COREUTILS-$(CONFIG_HEAD) += head.o
|
||||
COREUTILS-$(CONFIG_HOSTID) += hostid.o
|
||||
COREUTILS-$(CONFIG_ID) += id.o
|
||||
COREUTILS-$(CONFIG_INSTALL) += install.o
|
||||
COREUTILS-$(CONFIG_LENGTH) += length.o
|
||||
COREUTILS-$(CONFIG_LN) += ln.o
|
||||
COREUTILS-$(CONFIG_LOGNAME) += logname.o
|
||||
COREUTILS-$(CONFIG_LS) += ls.o
|
||||
COREUTILS-$(CONFIG_MD5SUM) += md5_sha1_sum.o
|
||||
COREUTILS-$(CONFIG_MKDIR) += mkdir.o
|
||||
COREUTILS-$(CONFIG_MKFIFO) += mkfifo.o
|
||||
COREUTILS-$(CONFIG_MKNOD) += mknod.o
|
||||
COREUTILS-$(CONFIG_MV) += mv.o
|
||||
COREUTILS-$(CONFIG_OD) += od.o
|
||||
COREUTILS-$(CONFIG_PRINTF) += printf.o
|
||||
COREUTILS-$(CONFIG_PWD) += pwd.o
|
||||
COREUTILS-$(CONFIG_REALPATH) += realpath.o
|
||||
COREUTILS-$(CONFIG_RM) += rm.o
|
||||
COREUTILS-$(CONFIG_RMDIR) += rmdir.o
|
||||
COREUTILS-$(CONFIG_SEQ) += seq.o
|
||||
COREUTILS-$(CONFIG_SHA1SUM) += md5_sha1_sum.o
|
||||
COREUTILS-$(CONFIG_SLEEP) += sleep.o
|
||||
COREUTILS-$(CONFIG_SORT) += sort.o
|
||||
COREUTILS-$(CONFIG_STTY) += stty.o
|
||||
COREUTILS-$(CONFIG_SYNC) += sync.o
|
||||
COREUTILS-$(CONFIG_TAIL) += tail.o
|
||||
COREUTILS-$(CONFIG_TEE) += tee.o
|
||||
COREUTILS-$(CONFIG_TEST) += test.o
|
||||
COREUTILS-$(CONFIG_TOUCH) += touch.o
|
||||
COREUTILS-$(CONFIG_TR) += tr.o
|
||||
COREUTILS-$(CONFIG_TRUE) += true.o
|
||||
COREUTILS-$(CONFIG_TTY) += tty.o
|
||||
COREUTILS-$(CONFIG_UNAME) += uname.o
|
||||
COREUTILS-$(CONFIG_UNIQ) += uniq.o
|
||||
COREUTILS-$(CONFIG_USLEEP) += usleep.o
|
||||
COREUTILS-$(CONFIG_UUDECODE) += uudecode.o
|
||||
COREUTILS-$(CONFIG_UUENCODE) += uuencode.o
|
||||
COREUTILS-$(CONFIG_WATCH) += watch.o
|
||||
COREUTILS-$(CONFIG_WC) += wc.o
|
||||
COREUTILS-$(CONFIG_WHO) += who.o
|
||||
COREUTILS-$(CONFIG_WHOAMI) += whoami.o
|
||||
COREUTILS-$(CONFIG_YES) += yes.o
|
||||
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
|
||||
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
|
||||
COREUTILS-$(CONFIG_ECHO) += echo.o
|
||||
COREUTILS-$(CONFIG_ENV) += env.o
|
||||
COREUTILS-$(CONFIG_EXPR) += expr.o
|
||||
COREUTILS-$(CONFIG_FALSE) += false.o
|
||||
COREUTILS-$(CONFIG_FOLD) += fold.o
|
||||
COREUTILS-$(CONFIG_HEAD) += head.o
|
||||
COREUTILS-$(CONFIG_HOSTID) += hostid.o
|
||||
COREUTILS-$(CONFIG_ID) += id.o
|
||||
COREUTILS-$(CONFIG_INSTALL) += install.o
|
||||
COREUTILS-$(CONFIG_LENGTH) += length.o
|
||||
COREUTILS-$(CONFIG_LN) += ln.o
|
||||
COREUTILS-$(CONFIG_LOGNAME) += logname.o
|
||||
COREUTILS-$(CONFIG_LS) += ls.o
|
||||
COREUTILS-$(CONFIG_MD5SUM) += md5_sha1_sum.o
|
||||
COREUTILS-$(CONFIG_MKDIR) += mkdir.o
|
||||
COREUTILS-$(CONFIG_MKFIFO) += mkfifo.o
|
||||
COREUTILS-$(CONFIG_MKNOD) += mknod.o
|
||||
COREUTILS-$(CONFIG_MV) += mv.o
|
||||
COREUTILS-$(CONFIG_NICE) += nice.o
|
||||
COREUTILS-$(CONFIG_NOHUP) += nohup.o
|
||||
COREUTILS-$(CONFIG_OD) += od.o
|
||||
COREUTILS-$(CONFIG_PRINTENV) += printenv.o
|
||||
COREUTILS-$(CONFIG_PRINTF) += printf.o
|
||||
COREUTILS-$(CONFIG_PWD) += pwd.o
|
||||
COREUTILS-$(CONFIG_REALPATH) += realpath.o
|
||||
COREUTILS-$(CONFIG_RM) += rm.o
|
||||
COREUTILS-$(CONFIG_RMDIR) += rmdir.o
|
||||
COREUTILS-$(CONFIG_SEQ) += seq.o
|
||||
COREUTILS-$(CONFIG_SHA1SUM) += md5_sha1_sum.o
|
||||
COREUTILS-$(CONFIG_SLEEP) += sleep.o
|
||||
COREUTILS-$(CONFIG_SORT) += sort.o
|
||||
COREUTILS-$(CONFIG_STAT) += stat.o
|
||||
COREUTILS-$(CONFIG_STTY) += stty.o
|
||||
COREUTILS-$(CONFIG_SUM) += sum.o
|
||||
COREUTILS-$(CONFIG_SYNC) += sync.o
|
||||
COREUTILS-$(CONFIG_TAIL) += tail.o
|
||||
COREUTILS-$(CONFIG_TEE) += tee.o
|
||||
COREUTILS-$(CONFIG_TEST) += test.o
|
||||
COREUTILS-$(CONFIG_TOUCH) += touch.o
|
||||
COREUTILS-$(CONFIG_TR) += tr.o
|
||||
COREUTILS-$(CONFIG_TRUE) += true.o
|
||||
COREUTILS-$(CONFIG_TTY) += tty.o
|
||||
COREUTILS-$(CONFIG_UNAME) += uname.o
|
||||
COREUTILS-$(CONFIG_UNIQ) += uniq.o
|
||||
COREUTILS-$(CONFIG_USLEEP) += usleep.o
|
||||
COREUTILS-$(CONFIG_UUDECODE) += uudecode.o
|
||||
COREUTILS-$(CONFIG_UUENCODE) += uuencode.o
|
||||
COREUTILS-$(CONFIG_WATCH) += watch.o
|
||||
COREUTILS-$(CONFIG_WC) += wc.o
|
||||
COREUTILS-$(CONFIG_WHO) += who.o
|
||||
COREUTILS-$(CONFIG_WHOAMI) += whoami.o
|
||||
COREUTILS-$(CONFIG_YES) += yes.o
|
||||
|
||||
COREUTILS-y:=$(sort $(COREUTILS-y))
|
||||
|
||||
ifneq ($(strip $(COREUTILS-y)),)
|
||||
libraries-y+=$(COREUTILS_DIR)$(COREUTILS_AR)
|
||||
endif
|
||||
|
||||
COREUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(COREUTILS-y))
|
||||
COREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
|
||||
APPLET_SRC-y+=$(COREUTILS_SRC-y)
|
||||
APPLET_SRC-a+=$(COREUTILS_SRC-a)
|
||||
|
||||
$(COREUTILS_DIR)$(COREUTILS_AR): $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
|
||||
$(AR) -ro $@ $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
|
||||
$(do_ar)
|
||||
|
||||
$(COREUTILS_DIR)%.o: $(srcdir)/%.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
$(compile.c)
|
||||
+2
-14
@@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -37,7 +25,7 @@
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int basename_main(int argc, char **argv)
|
||||
int basename_main(int argc, char **argv)
|
||||
{
|
||||
size_t m, n;
|
||||
char *s;
|
||||
|
||||
+13
-25
@@ -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
|
||||
@@ -31,7 +19,6 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -45,10 +32,10 @@
|
||||
#endif
|
||||
|
||||
#define THURSDAY 4 /* for reformation */
|
||||
#define SATURDAY 6 /* 1 Jan 1 was a Saturday */
|
||||
#define SATURDAY 6 /* 1 Jan 1 was a Saturday */
|
||||
|
||||
#define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */
|
||||
#define NUMBER_MISSING_DAYS 11 /* 11 day correction */
|
||||
#define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */
|
||||
#define NUMBER_MISSING_DAYS 11 /* 11 day correction */
|
||||
|
||||
#define MAXDAYS 42 /* max slots in a month array */
|
||||
#define SPACE -1 /* used in day array */
|
||||
@@ -89,9 +76,9 @@ static int is_leap_year(int year)
|
||||
#define leap_years_since_year_1(yr) \
|
||||
((yr) / 4 - centuries_since_1700(yr) + quad_centuries_since_1700(yr))
|
||||
|
||||
static void center __P((char *, int, int));
|
||||
static void day_array __P((int, int, int *));
|
||||
static void trim_trailing_spaces_and_print __P((char *));
|
||||
static void center (char *, int, int);
|
||||
static void day_array (int, int, int *);
|
||||
static void trim_trailing_spaces_and_print (char *);
|
||||
|
||||
static void blank_string(char *buf, size_t buflen);
|
||||
static char *build_row(char *p, int *dp);
|
||||
@@ -231,11 +218,12 @@ static void day_array(int month, int year, int *days)
|
||||
memset(days, SPACE, MAXDAYS * sizeof(int));
|
||||
|
||||
if ((month == 9) && (year == 1752)) {
|
||||
size_t oday = 0;
|
||||
|
||||
j_offset = julian * 244;
|
||||
i = 0;
|
||||
do {
|
||||
days[i+2] = sep1752[i] + j_offset;
|
||||
} while (++i < sizeof(sep1752));
|
||||
days[oday+2] = sep1752[oday] + j_offset;
|
||||
} while (++oday < sizeof(sep1752));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
+3
-30
@@ -4,43 +4,16 @@
|
||||
*
|
||||
* 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>
|
||||
|
||||
extern int cat_main(int argc, char **argv)
|
||||
int cat_main(int argc, char **argv)
|
||||
{
|
||||
FILE *f;
|
||||
int retval = EXIT_SUCCESS;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
+2
-23
@@ -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. */
|
||||
@@ -58,7 +45,7 @@ int chgrp_main(int argc, char **argv)
|
||||
argv += optind;
|
||||
|
||||
/* Find the selected group */
|
||||
gid = get_ug_id(*argv, my_getgrnam);
|
||||
gid = get_ug_id(*argv, bb_xgetgrnam);
|
||||
++argv;
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
@@ -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:
|
||||
*/
|
||||
+3
-24
@@ -7,20 +7,7 @@
|
||||
* Reworked by (C) 2002 Vladimir Oleynik <dzo@simtreas.ru>
|
||||
* to correctly parse '-rwxgoa'
|
||||
*
|
||||
* 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 */
|
||||
@@ -44,7 +31,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
int chmod_main(int argc, char **argv)
|
||||
int chmod_main(int ATTRIBUTE_UNUSED argc, char **argv)
|
||||
{
|
||||
int retval = EXIT_SUCCESS;
|
||||
int recursiveFlag = FALSE;
|
||||
@@ -94,7 +81,7 @@ int chmod_main(int argc, char **argv)
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
do {
|
||||
if (! recursive_action (*argv, recursiveFlag, FALSE, FALSE,
|
||||
if (! recursive_action (*argv, recursiveFlag, TRUE, FALSE,
|
||||
fileAction, fileAction, smode)) {
|
||||
retval = EXIT_FAILURE;
|
||||
}
|
||||
@@ -102,11 +89,3 @@ int chmod_main(int argc, char **argv)
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+14
-41
@@ -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. */
|
||||
@@ -30,24 +17,21 @@
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* Don't use lchown for glibc older then 2.1.x */
|
||||
#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
|
||||
#define lchown chown
|
||||
#endif
|
||||
|
||||
static long uid;
|
||||
static long gid;
|
||||
static uid_t uid = -1;
|
||||
static gid_t gid = -1;
|
||||
|
||||
static int (*chown_func)(const char *, uid_t, gid_t) = chown;
|
||||
|
||||
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
static int fileAction(const char *fileName, struct stat *statbuf,
|
||||
void ATTRIBUTE_UNUSED *junk)
|
||||
{
|
||||
if (chown_func(fileName, uid, (gid == -1) ? statbuf->st_gid : gid) == 0) {
|
||||
chmod(fileName, statbuf->st_mode);
|
||||
return (TRUE);
|
||||
if (!chown_func(fileName,
|
||||
(uid == (uid_t)-1) ? statbuf->st_uid : uid,
|
||||
(gid == (gid_t)-1) ? statbuf->st_gid : gid)) {
|
||||
return TRUE;
|
||||
}
|
||||
bb_perror_msg("%s", fileName); /* Avoid multibyte problems. */
|
||||
return (FALSE);
|
||||
bb_perror_msg("%s", fileName); /* A filename could have % in it... */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define FLAG_R 1
|
||||
@@ -74,15 +58,12 @@ int chown_main(int argc, char **argv)
|
||||
groupName = strchr(*argv, ':');
|
||||
}
|
||||
|
||||
gid = -1;
|
||||
/* Check for the username and groupname */
|
||||
if (groupName) {
|
||||
*groupName++ = '\0';
|
||||
gid = get_ug_id(groupName, my_getgrnam);
|
||||
gid = get_ug_id(groupName, bb_xgetgrnam);
|
||||
}
|
||||
|
||||
/* Now check for the username */
|
||||
uid = get_ug_id(*argv, my_getpwnam);
|
||||
|
||||
if (--groupName != *argv) uid = get_ug_id(*argv, bb_xgetpwnam);
|
||||
++argv;
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
@@ -95,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;
|
||||
}
|
||||
+3
-19
@@ -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. */
|
||||
@@ -52,11 +39,8 @@ static FILE *cmp_xfopen_input(const char *filename)
|
||||
|
||||
static const char fmt_eof[] = "cmp: EOF on %s\n";
|
||||
static const char fmt_differ[] = "%s %s differ: char %d, line %d\n";
|
||||
#if 0
|
||||
static const char fmt_l_opt[] = "%.0s%.0s%d %o %o\n"; /* SUSv3 format */
|
||||
#else
|
||||
static const char fmt_l_opt[] = "%.0s%.0s%d %3o %3o\n"; /* nicer gnu format */
|
||||
#endif
|
||||
// This fmt_l_opt uses gnu-isms. SUSv3 would be "%.0s%.0s%d %o %o\n"
|
||||
static const char fmt_l_opt[] = "%.0s%.0s%d %3o %3o\n";
|
||||
|
||||
static const char opt_chars[] = "sl";
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini comm implementation for busybox
|
||||
*
|
||||
* Copyright (C) 2005 by Robert Sullivan <cogito.ergo.cogito@gmail.com>
|
||||
*
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#define COMM_OPT_1 0x01
|
||||
#define COMM_OPT_2 0x02
|
||||
#define COMM_OPT_3 0x04
|
||||
|
||||
/* These three variables control behaviour if non-zero */
|
||||
|
||||
static int only_file_1;
|
||||
static int only_file_2;
|
||||
static int both;
|
||||
|
||||
/* writeline outputs the input given, appropriately aligned according to class */
|
||||
static void writeline(char *line, int class)
|
||||
{
|
||||
if (class == 0) {
|
||||
if (!only_file_1)
|
||||
return;
|
||||
} else if (class == 1) {
|
||||
if (!only_file_2)
|
||||
return;
|
||||
if (only_file_1)
|
||||
putchar('\t');
|
||||
}
|
||||
else /*if (class == 2)*/ {
|
||||
if (!both)
|
||||
return;
|
||||
if (only_file_1)
|
||||
putchar('\t');
|
||||
if (only_file_2)
|
||||
putchar('\t');
|
||||
}
|
||||
fputs(line, stdout);
|
||||
}
|
||||
|
||||
/* This is the real core of the program - lines are compared here */
|
||||
static void cmp_files(char **infiles)
|
||||
{
|
||||
#define LINE_LEN 100
|
||||
#define BB_EOF_0 0x1
|
||||
#define BB_EOF_1 0x2
|
||||
char thisline[2][LINE_LEN];
|
||||
FILE *streams[2];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 2; ++i) {
|
||||
streams[i] = ((infiles[i][0] == '=' && infiles[i][1]) ? stdin : bb_xfopen(infiles[i], "r"));
|
||||
fgets(thisline[i], LINE_LEN, streams[i]);
|
||||
}
|
||||
|
||||
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])
|
||||
order = 1;
|
||||
else if (!*thisline[1])
|
||||
order = -1;
|
||||
else {
|
||||
int tl0_len, tl1_len;
|
||||
tl0_len = strlen(thisline[0]);
|
||||
tl1_len = strlen(thisline[1]);
|
||||
order = memcmp(thisline[0], thisline[1], tl0_len < tl1_len ? tl0_len : tl1_len);
|
||||
if (!order)
|
||||
order = tl0_len < tl1_len ? -1 : tl0_len != tl1_len;
|
||||
}
|
||||
|
||||
if (order == 0 && !i)
|
||||
writeline(thisline[1], 2);
|
||||
else if (order > 0 && !(i & BB_EOF_1))
|
||||
writeline(thisline[1], 1);
|
||||
else if (order < 0 && !(i & BB_EOF_0))
|
||||
writeline(thisline[0], 0);
|
||||
|
||||
if (i & BB_EOF_0 & BB_EOF_1) {
|
||||
break;
|
||||
|
||||
} else if (i) {
|
||||
i = (i & BB_EOF_0 ? 1 : 0);
|
||||
while (!feof(streams[i])) {
|
||||
if ((order < 0 && i) || (order > 0 && !i))
|
||||
writeline(thisline[i], i);
|
||||
fgets(thisline[i], LINE_LEN, streams[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
} else {
|
||||
if (order >= 0)
|
||||
fgets(thisline[1], LINE_LEN, streams[1]);
|
||||
if (order <= 0)
|
||||
fgets(thisline[0], LINE_LEN, streams[0]);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(streams[0]);
|
||||
fclose(streams[1]);
|
||||
}
|
||||
|
||||
int comm_main(int argc, char **argv)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
flags = bb_getopt_ulflags(argc, argv, "123");
|
||||
|
||||
if (optind + 2 != argc)
|
||||
bb_show_usage();
|
||||
|
||||
only_file_1 = !(flags & COMM_OPT_1);
|
||||
only_file_2 = !(flags & COMM_OPT_2);
|
||||
both = !(flags & COMM_OPT_3);
|
||||
|
||||
cmp_files(argv + optind);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
+22
-31
@@ -4,20 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 2000 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 GPL v2 or later, see file LICENSE in this tarball for details.
|
||||
*/
|
||||
|
||||
/* BB_AUDIT SUSv3 defects - unsupported options -H, -L, and -P. */
|
||||
@@ -41,10 +28,7 @@
|
||||
#include "busybox.h"
|
||||
#include "libcoreutils/coreutils.h"
|
||||
|
||||
/* WARNING!! ORDER IS IMPORTANT!! */
|
||||
static const char cp_opts[] = "pdRfiar";
|
||||
|
||||
extern int cp_main(int argc, char **argv)
|
||||
int cp_main(int argc, char **argv)
|
||||
{
|
||||
struct stat source_stat;
|
||||
struct stat dest_stat;
|
||||
@@ -55,24 +39,31 @@ extern int cp_main(int argc, char **argv)
|
||||
int flags;
|
||||
int status = 0;
|
||||
|
||||
/* Since these are enums, #if tests will not work. So use assert()s. */
|
||||
assert(FILEUTILS_PRESERVE_STATUS == 1);
|
||||
assert(FILEUTILS_DEREFERENCE == 2);
|
||||
assert(FILEUTILS_RECUR == 4);
|
||||
assert(FILEUTILS_FORCE == 8);
|
||||
assert(FILEUTILS_INTERACTIVE == 16);
|
||||
|
||||
flags = bb_getopt_ulflags(argc, argv, cp_opts);
|
||||
flags = bb_getopt_ulflags(argc, argv, "pdRfiarPHL");
|
||||
|
||||
if (flags & 32) {
|
||||
flags |= (FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR | FILEUTILS_DEREFERENCE);
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (flags & 128) {
|
||||
/* Make -P a synonym for -d,
|
||||
* -d is the GNU option while -P is the POSIX 2003 option
|
||||
*/
|
||||
flags |= FILEUTILS_DEREFERENCE;
|
||||
}
|
||||
/* Default behavior of cp is to dereference, so we don't have to do
|
||||
* anything special when we are given -L.
|
||||
* The behavior of -H is *almost* like -L, but not quite, so let's
|
||||
* just ignore it too for fun.
|
||||
if (flags & 256 || flags & 512) {
|
||||
;
|
||||
}
|
||||
*/
|
||||
|
||||
flags ^= FILEUTILS_DEREFERENCE; /* The sense of this flag was reversed. */
|
||||
|
||||
@@ -86,7 +77,7 @@ extern int cp_main(int argc, char **argv)
|
||||
/* If there are only two arguments and... */
|
||||
if (optind + 2 == argc) {
|
||||
s_flags = cp_mv_stat2(*argv, &source_stat,
|
||||
(flags & FILEUTILS_DEREFERENCE) ? stat : lstat);
|
||||
(flags & FILEUTILS_DEREFERENCE) ? stat : lstat);
|
||||
if ((s_flags < 0) || ((d_flags = cp_mv_stat(last, &dest_stat)) < 0)) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -98,8 +89,8 @@ extern int cp_main(int argc, char **argv)
|
||||
((((flags & FILEUTILS_RECUR) >> 1) & s_flags) && !d_flags)
|
||||
) {
|
||||
/* ...do a simple copy. */
|
||||
dest = last;
|
||||
goto DO_COPY; /* Note: optind+2==argc implies argv[1]==last below. */
|
||||
dest = last;
|
||||
goto DO_COPY; /* Note: optind+2==argc implies argv[1]==last below. */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-22
@@ -1,29 +1,15 @@
|
||||
/* 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>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
@@ -46,9 +32,11 @@ struct cut_list {
|
||||
int endpos;
|
||||
};
|
||||
|
||||
static const int BOL = 0;
|
||||
static const int EOL = INT_MAX;
|
||||
static const int NON_RANGE = -1;
|
||||
enum {
|
||||
BOL = 0,
|
||||
EOL = INT_MAX,
|
||||
NON_RANGE = -1
|
||||
};
|
||||
|
||||
static struct cut_list *cut_lists = NULL; /* growable array holding a series of lists */
|
||||
static unsigned int nlists = 0; /* number of elements in above list */
|
||||
@@ -290,17 +278,17 @@ static void cut_file(FILE *file)
|
||||
}
|
||||
|
||||
|
||||
extern int cut_main(int argc, char **argv)
|
||||
int cut_main(int argc, char **argv)
|
||||
{
|
||||
unsigned long opt;
|
||||
char *sopt, *sdopt;
|
||||
|
||||
bb_opt_complementaly = "b~bcf:c~bcf:f~bcf";
|
||||
bb_opt_complementally = "b--bcf:c--bcf:f--bcf";
|
||||
opt = bb_getopt_ulflags(argc, argv, optstring, &sopt, &sopt, &sopt, &sdopt);
|
||||
part = opt & (OPT_BYTE_FLGS|OPT_CHAR_FLGS|OPT_FIELDS_FLGS);
|
||||
if(part == 0)
|
||||
bb_error_msg_and_die("you must specify a list of bytes, characters, or fields");
|
||||
if(opt & 0x80000000UL)
|
||||
if(opt & BB_GETOPT_ERROR)
|
||||
bb_error_msg_and_die("only one type of list may be specified");
|
||||
parse_lists(sopt);
|
||||
if((opt & (OPT_DELIM_FLGS))) {
|
||||
|
||||
+79
-126
@@ -6,33 +6,9 @@
|
||||
*
|
||||
* iso-format handling added by Robert Griebl <griebl@gmx.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 <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <getopt.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
|
||||
@@ -44,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;
|
||||
@@ -85,35 +78,31 @@ static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
|
||||
|
||||
/* Parse input and assign appropriately to tm_time */
|
||||
|
||||
if (t =
|
||||
*tm_time, sscanf(t_string, "%d:%d:%d", &t.tm_hour, &t.tm_min,
|
||||
if (t = *tm_time, sscanf(t_string, "%d:%d:%d", &t.tm_hour, &t.tm_min,
|
||||
&t.tm_sec) == 3) {
|
||||
/* no adjustments needed */
|
||||
} else if (t =
|
||||
*tm_time, sscanf(t_string, "%d:%d", &t.tm_hour,
|
||||
} else if (t = *tm_time, sscanf(t_string, "%d:%d", &t.tm_hour,
|
||||
&t.tm_min) == 2) {
|
||||
/* no adjustments needed */
|
||||
} else if (t =
|
||||
*tm_time, sscanf(t_string, "%d.%d-%d:%d:%d", &t.tm_mon,
|
||||
&t.tm_mday, &t.tm_hour, &t.tm_min,
|
||||
&t.tm_sec) == 5) {
|
||||
} else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d:%d", &t.tm_mon,
|
||||
&t.tm_mday, &t.tm_hour,
|
||||
&t.tm_min, &t.tm_sec) == 5) {
|
||||
/* Adjust dates from 1-12 to 0-11 */
|
||||
t.tm_mon -= 1;
|
||||
} else if (t =
|
||||
*tm_time, sscanf(t_string, "%d.%d-%d:%d", &t.tm_mon,
|
||||
&t.tm_mday, &t.tm_hour, &t.tm_min) == 4) {
|
||||
} else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d", &t.tm_mon,
|
||||
&t.tm_mday,
|
||||
&t.tm_hour, &t.tm_min) == 4) {
|
||||
/* Adjust dates from 1-12 to 0-11 */
|
||||
t.tm_mon -= 1;
|
||||
} else if (t =
|
||||
*tm_time, sscanf(t_string, "%d.%d.%d-%d:%d:%d", &t.tm_year,
|
||||
&t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min,
|
||||
&t.tm_sec) == 6) {
|
||||
} else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d:%d", &t.tm_year,
|
||||
&t.tm_mon, &t.tm_mday,
|
||||
&t.tm_hour, &t.tm_min,
|
||||
&t.tm_sec) == 6) {
|
||||
t.tm_year -= 1900; /* Adjust years */
|
||||
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
} else if (t =
|
||||
*tm_time, sscanf(t_string, "%d.%d.%d-%d:%d", &t.tm_year,
|
||||
&t.tm_mon, &t.tm_mday, &t.tm_hour,
|
||||
&t.tm_min) == 5) {
|
||||
} else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d", &t.tm_year,
|
||||
&t.tm_mon, &t.tm_mday,
|
||||
&t.tm_hour, &t.tm_min) == 5) {
|
||||
t.tm_year -= 1900; /* Adjust years */
|
||||
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
} else {
|
||||
@@ -123,78 +112,47 @@ 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
|
||||
#ifdef CONFIG_FEATURE_DATE_ISOFMT
|
||||
# define DATE_OPT_TIMESPEC 0x20
|
||||
#endif
|
||||
|
||||
int date_main(int argc, char **argv)
|
||||
{
|
||||
char *date_str = NULL;
|
||||
char *date_fmt = NULL;
|
||||
char *t_buff;
|
||||
int set_time;
|
||||
int utc;
|
||||
int use_arg = 0;
|
||||
time_t tm;
|
||||
unsigned long opt;
|
||||
struct tm tm_time;
|
||||
char *filename = NULL;
|
||||
|
||||
#ifdef CONFIG_FEATURE_DATE_ISOFMT
|
||||
int ifmt = 0;
|
||||
char *isofmt_arg;
|
||||
char *hintfmt_arg;
|
||||
|
||||
# define GETOPT_ISOFMT "I::"
|
||||
#else
|
||||
# define GETOPT_ISOFMT
|
||||
#endif
|
||||
bb_opt_complementaly = "d~ds:s~ds";
|
||||
opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:" GETOPT_ISOFMT,
|
||||
bb_opt_complementally = "?:d--s:s--d";
|
||||
opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:"
|
||||
USE_FEATURE_DATE_ISOFMT("I::D:"),
|
||||
&date_str, &date_str, &filename
|
||||
#ifdef CONFIG_FEATURE_DATE_ISOFMT
|
||||
, &isofmt_arg
|
||||
#endif
|
||||
);
|
||||
USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg));
|
||||
set_time = opt & DATE_OPT_SET;
|
||||
utc = opt & DATE_OPT_UTC;
|
||||
if ((utc) && (putenv("TZ=UTC0") != 0)) {
|
||||
if (utc && putenv("TZ=UTC0") != 0) {
|
||||
bb_error_msg_and_die(bb_msg_memory_exhausted);
|
||||
}
|
||||
use_arg = opt & DATE_OPT_DATE;
|
||||
if(opt & 0x80000000UL)
|
||||
bb_show_usage();
|
||||
#ifdef CONFIG_FEATURE_DATE_ISOFMT
|
||||
if(opt & DATE_OPT_TIMESPEC) {
|
||||
|
||||
if(ENABLE_FEATURE_DATE_ISOFMT && (opt & DATE_OPT_TIMESPEC)) {
|
||||
if (!isofmt_arg) {
|
||||
ifmt = 1;
|
||||
} else {
|
||||
int ifmt_len = bb_strlen(isofmt_arg);
|
||||
|
||||
if ((ifmt_len <= 4)
|
||||
&& (strncmp(isofmt_arg, "date", ifmt_len) == 0)) {
|
||||
ifmt = 1;
|
||||
} else if ((ifmt_len <= 5)
|
||||
&& (strncmp(isofmt_arg, "hours", ifmt_len) == 0)) {
|
||||
ifmt = 2;
|
||||
} else if ((ifmt_len <= 7)
|
||||
&& (strncmp(isofmt_arg, "minutes", ifmt_len) == 0)) {
|
||||
ifmt = 3;
|
||||
} else if ((ifmt_len <= 7)
|
||||
&& (strncmp(isofmt_arg, "seconds", ifmt_len) == 0)) {
|
||||
ifmt = 4;
|
||||
}
|
||||
char *isoformats[]={"date","hours","minutes","seconds"};
|
||||
for(ifmt = 4; ifmt;)
|
||||
if(!strcmp(isofmt_arg,isoformats[--ifmt]))
|
||||
break;
|
||||
}
|
||||
if (!ifmt) {
|
||||
bb_show_usage();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* XXX, date_fmt == NULL from this always */
|
||||
if ((date_fmt == NULL) && (optind < argc) && (argv[optind][0] == '+')) {
|
||||
date_fmt = &argv[optind][1]; /* Skip over the '+' */
|
||||
} else if (date_str == NULL) {
|
||||
@@ -207,8 +165,7 @@ int date_main(int argc, char **argv)
|
||||
|
||||
if(filename) {
|
||||
struct stat statbuf;
|
||||
if(stat(filename,&statbuf))
|
||||
bb_perror_msg_and_die("File '%s' not found.\n",filename);
|
||||
xstat(filename,&statbuf);
|
||||
tm=statbuf.st_mtime;
|
||||
} else time(&tm);
|
||||
memcpy(&tm_time, localtime(&tm), sizeof(tm_time));
|
||||
@@ -219,7 +176,9 @@ int date_main(int argc, char **argv)
|
||||
tm_time.tm_hour = 0;
|
||||
|
||||
/* Process any date input to UNIX time since 1 Jan 1970 */
|
||||
if (strchr(date_str, ':') != NULL) {
|
||||
if (ENABLE_FEATURE_DATE_ISOFMT && (opt & DATE_OPT_HINT)) {
|
||||
strptime(date_str, hintfmt_arg, &tm_time);
|
||||
} else if (strchr(date_str, ':') != NULL) {
|
||||
date_conv_ftime(&tm_time, date_str);
|
||||
} else {
|
||||
date_conv_time(&tm_time, date_str);
|
||||
@@ -231,12 +190,12 @@ int date_main(int argc, char **argv)
|
||||
if (tm < 0) {
|
||||
bb_error_msg_and_die(bb_msg_invalid_date, date_str);
|
||||
}
|
||||
if (utc && (putenv("TZ=UTC0") != 0)) {
|
||||
if (utc && putenv("TZ=UTC0") != 0) {
|
||||
bb_error_msg_and_die(bb_msg_memory_exhausted);
|
||||
}
|
||||
|
||||
/* if setting time, set it */
|
||||
if (set_time && (stime(&tm) < 0)) {
|
||||
if (set_time && stime(&tm) < 0) {
|
||||
bb_perror_msg("cannot set date");
|
||||
}
|
||||
}
|
||||
@@ -245,48 +204,42 @@ int date_main(int argc, char **argv)
|
||||
|
||||
/* Deal with format string */
|
||||
if (date_fmt == NULL) {
|
||||
#ifdef CONFIG_FEATURE_DATE_ISOFMT
|
||||
switch (ifmt) {
|
||||
case 4:
|
||||
date_fmt = utc ? "%Y-%m-%dT%H:%M:%SZ" : "%Y-%m-%dT%H:%M:%S%z";
|
||||
break;
|
||||
case 3:
|
||||
date_fmt = utc ? "%Y-%m-%dT%H:%MZ" : "%Y-%m-%dT%H:%M%z";
|
||||
break;
|
||||
case 2:
|
||||
date_fmt = utc ? "%Y-%m-%dT%HZ" : "%Y-%m-%dT%H%z";
|
||||
break;
|
||||
case 1:
|
||||
date_fmt = "%Y-%m-%d";
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
#endif
|
||||
date_fmt = (opt & DATE_OPT_RFC2822 ?
|
||||
/* Start with the default case */
|
||||
|
||||
date_fmt = (opt & DATE_OPT_RFC2822 ?
|
||||
(utc ? "%a, %d %b %Y %H:%M:%S GMT" :
|
||||
"%a, %d %b %Y %H:%M:%S %z") :
|
||||
"%a %b %e %H:%M:%S %Z %Y");
|
||||
|
||||
#ifdef CONFIG_FEATURE_DATE_ISOFMT
|
||||
break;
|
||||
if (ENABLE_FEATURE_DATE_ISOFMT) {
|
||||
if (ifmt == 4)
|
||||
date_fmt = utc ? "%Y-%m-%dT%H:%M:%SZ" : "%Y-%m-%dT%H:%M:%S%z";
|
||||
else if (ifmt == 3)
|
||||
date_fmt = utc ? "%Y-%m-%dT%H:%MZ" : "%Y-%m-%dT%H:%M%z";
|
||||
else if (ifmt == 2)
|
||||
date_fmt = utc ? "%Y-%m-%dT%HZ" : "%Y-%m-%dT%H%z";
|
||||
else if (ifmt == 1)
|
||||
date_fmt = "%Y-%m-%d";
|
||||
}
|
||||
#endif
|
||||
} else if (*date_fmt == '\0') {
|
||||
/* Imitate what GNU 'date' does with NO format string! */
|
||||
printf("\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
if (*date_fmt == '\0') {
|
||||
|
||||
/* Handle special conversions */
|
||||
/* With no format string, just print a blank line */
|
||||
|
||||
*bb_common_bufsiz1=0;
|
||||
} else {
|
||||
|
||||
if (strncmp(date_fmt, "%f", 2) == 0) {
|
||||
date_fmt = "%Y.%m.%d-%H:%M:%S";
|
||||
/* Handle special conversions */
|
||||
|
||||
if (strncmp(date_fmt, "%f", 2) == 0) {
|
||||
date_fmt = "%Y.%m.%d-%H:%M:%S";
|
||||
}
|
||||
|
||||
/* Generate output string */
|
||||
strftime(bb_common_bufsiz1, 200, date_fmt, &tm_time);
|
||||
}
|
||||
|
||||
/* Print OUTPUT (after ALL that!) */
|
||||
t_buff = xmalloc(201);
|
||||
strftime(t_buff, 200, date_fmt, &tm_time);
|
||||
puts(t_buff);
|
||||
puts(bb_common_bufsiz1);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+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 (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 (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;
|
||||
}
|
||||
+6
-27
@@ -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. */
|
||||
@@ -46,7 +33,7 @@ static long kscale(long b, long bs)
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int df_main(int argc, char **argv)
|
||||
int df_main(int argc, char **argv)
|
||||
{
|
||||
long blocks_used;
|
||||
long blocks_percent_used;
|
||||
@@ -62,7 +49,7 @@ extern int df_main(int argc, char **argv)
|
||||
const char *disp_units_hdr = hdr_1k;
|
||||
|
||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||
bb_opt_complementaly = "h-km:k-hm:m-hk";
|
||||
bb_opt_complementally = "h-km:k-hm:m-hk";
|
||||
opt = bb_getopt_ulflags(argc, argv, "hmk");
|
||||
if(opt & 1) {
|
||||
df_disp_hr = 0;
|
||||
@@ -130,13 +117,13 @@ extern int df_main(int argc, char **argv)
|
||||
} else if (strcmp(device, "/dev/root") == 0) {
|
||||
/* Adjusts device to be the real root device,
|
||||
* or leaves device alone if it can't find it */
|
||||
if ((device = find_real_root_device_name()) == NULL) {
|
||||
if ((device = find_block_device("/")) == NULL) {
|
||||
goto SET_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||
bb_printf("%-21s%9s ", device,
|
||||
bb_printf("%-20s %9s ", device,
|
||||
make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr));
|
||||
|
||||
bb_printf("%9s ",
|
||||
@@ -147,7 +134,7 @@ extern int df_main(int argc, char **argv)
|
||||
make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr),
|
||||
blocks_percent_used, mount_point);
|
||||
#else
|
||||
bb_printf("%-21s%9ld %9ld %9ld %3ld%% %s\n",
|
||||
bb_printf("%-20s %9ld %9ld %9ld %3ld%% %s\n",
|
||||
device,
|
||||
kscale(s.f_blocks, s.f_bsize),
|
||||
kscale(s.f_blocks-s.f_bfree, s.f_bsize),
|
||||
@@ -160,11 +147,3 @@ extern 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
Loaded 100 of 814 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user