Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db1df5ebeb | ||
|
|
fda2b7ff47 | ||
|
|
12f834ccfc | ||
|
|
18921bd00d | ||
|
|
5ad22c933c | ||
|
|
09da627a23 | ||
|
|
080ddc1c19 | ||
|
|
5e02c67331 | ||
|
|
fe5b1a9f3c | ||
|
|
72e1212ad8 | ||
|
|
f02c26f1ef | ||
|
|
f6f7bfb8e0 | ||
|
|
44608e9693 | ||
|
|
1887b0478f | ||
|
|
5956028f6f | ||
|
|
9ffd5776eb | ||
|
|
0d53ebdc52 | ||
|
|
4298e87fa5 | ||
|
|
61b7904afd | ||
|
|
c5c1a8a112 | ||
|
|
05fa661123 | ||
|
|
25bca9566d | ||
|
|
98f824aa22 | ||
|
|
934805aec1 | ||
|
|
2a2ab1479c | ||
|
|
431a18497d | ||
|
|
31f9747a23 | ||
|
|
d69e31fb93 | ||
|
|
1977a60de4 | ||
|
|
61fb48930f | ||
|
|
9060a73159 | ||
|
|
e8a90fb2bc | ||
|
|
71ae64bdc6 | ||
|
|
fdfe298a96 | ||
|
|
d274b53c1d | ||
|
|
1bb1e83454 | ||
|
|
adb058b0de | ||
|
|
a39342b131 | ||
|
|
528649463f | ||
|
|
2983330512 | ||
|
|
e0f5500bb5 | ||
|
|
506177df7f | ||
|
|
08a72209c9 | ||
|
|
02e6ba91e8 | ||
|
|
a6f6e06107 | ||
|
|
ad082987d0 | ||
|
|
d9d47c3078 | ||
|
|
aa1d6ccbfb | ||
|
|
6a9799020b | ||
|
|
e4d2a43951 | ||
|
|
5c99581880 | ||
|
|
924f93e848 | ||
|
|
891ee641cb | ||
|
|
8132e933e6 | ||
|
|
92052e3945 | ||
|
|
2e41d0cb77 | ||
|
|
a47a3eada6 | ||
|
|
6f2ebcaa01 | ||
|
|
a920871c3a | ||
|
|
5a66b640f9 | ||
|
|
69eab26401 | ||
|
|
7ca04f328e | ||
|
|
ecfa290cfd | ||
|
|
b3f7261ffe | ||
|
|
3a1d8377ab | ||
|
|
19feada06f | ||
|
|
7695b7b5f4 | ||
|
|
d499330e9e | ||
|
|
06c35da6af | ||
|
|
420b208a45 | ||
|
|
793c3b4a7d | ||
|
|
dc180d1442 | ||
|
|
6c32a8add4 | ||
|
|
60943c5d5c | ||
|
|
39ad2833c0 | ||
|
|
871d93c462 | ||
|
|
927c3bdc18 | ||
|
|
a9a220b92a | ||
|
|
bf8bf105fb | ||
|
|
34fd00af5f | ||
|
|
7365c58783 | ||
|
|
bdff6a4c59 | ||
|
|
d4ee98940b | ||
|
|
02b8dfc524 | ||
|
|
403a73a351 | ||
|
|
18b76e6f80 | ||
|
|
8fede28c74 | ||
|
|
a9cc8961ed | ||
|
|
e18cb71e0c | ||
|
|
c38678d14b | ||
|
|
166fa4684f | ||
|
|
061c900176 | ||
|
|
ebdc8b48a5 | ||
|
|
ec0c48cb29 | ||
|
|
6714862bdd | ||
|
|
7a32aaacd0 | ||
|
|
b3c4e9add5 | ||
|
|
186685d46f | ||
|
|
4d0884a1ea | ||
|
|
7829b8d067 | ||
|
|
2a1eb31f18 | ||
|
|
2bec97c076 | ||
|
|
1130976f8e | ||
|
|
c3b7f7d6e7 | ||
|
|
193697db4e | ||
|
|
210aa14916 | ||
|
|
abac53b33c | ||
|
|
1ee52e8b14 | ||
|
|
933d10d308 | ||
|
|
fbef225c4b | ||
|
|
192ff35d9c | ||
|
|
0be933b505 | ||
|
|
50812fff21 | ||
|
|
de9e803149 | ||
|
|
e599b6d96e | ||
|
|
7dd2cec2fd | ||
|
|
84878fe20e | ||
|
|
0df910af49 | ||
|
|
5d3cb7cc1f | ||
|
|
8042f65398 | ||
|
|
acfc0d872e | ||
|
|
03195fc16f | ||
|
|
a199b17253 | ||
|
|
14dad7028b | ||
|
|
1ed9dd9d06 | ||
|
|
4534af2763 | ||
|
|
0775a07d87 | ||
|
|
4cc2e5e944 | ||
|
|
9fef17dec3 | ||
|
|
7c58e9be69 | ||
|
|
baf55a85fc | ||
|
|
e3906fcd94 | ||
|
|
99b12543cf | ||
|
|
242e3b6bde | ||
|
|
60a22addea | ||
|
|
a0ee881ba4 | ||
|
|
4176972db5 | ||
|
|
d827e8b665 | ||
|
|
b37367aa77 | ||
|
|
f853db54f9 | ||
|
|
75762705a3 | ||
|
|
419eed7501 | ||
|
|
5f8f32a41c | ||
|
|
8fc5d6d2da | ||
|
|
6fdacc74f0 | ||
|
|
a95e99e6f3 | ||
|
|
d9768d7cb9 | ||
|
|
1ff58b6570 | ||
|
|
8eb0dc1d10 | ||
|
|
3d184586a7 | ||
|
|
938e982c4d | ||
|
|
1d23f3a492 | ||
|
|
6069441bd2 | ||
|
|
91a0aac110 | ||
|
|
2ab6ff95e0 | ||
|
|
65d415d847 | ||
|
|
00f5ecb141 | ||
|
|
7940147e25 | ||
|
|
edcac5572f | ||
|
|
f8277ca992 | ||
|
|
74b007f7cc | ||
|
|
c59716ff4c | ||
|
|
6859d761d3 | ||
|
|
0d833ca7fd | ||
|
|
49c024addd | ||
|
|
e85dbfdd80 | ||
|
|
a71389bfe8 | ||
|
|
7373e485d3 | ||
|
|
87715170cc | ||
|
|
b230159958 | ||
|
|
df03932b7e | ||
|
|
70112da81a | ||
|
|
e707806894 | ||
|
|
3bc2b206b0 | ||
|
|
aead70b4d1 | ||
|
|
d0dd3d31e2 | ||
|
|
2a4a8d8ffb | ||
|
|
31a2e20bd3 | ||
|
|
41369af3f2 | ||
|
|
80cd3cfdbc | ||
|
|
f2f26e7fdd | ||
|
|
967c3d4406 | ||
|
|
1cd0445495 | ||
|
|
fc78b79575 | ||
|
|
efd4983eb1 | ||
|
|
d378c3149c | ||
|
|
88947dd05e | ||
|
|
2c0d0f0051 | ||
|
|
e4f9f3a960 | ||
|
|
0fe3e62e2c | ||
|
|
d2fd0d5869 | ||
|
|
acc257e994 | ||
|
|
e8fcf4bd69 | ||
|
|
2276d83639 | ||
|
|
cafc103230 | ||
|
|
1785ddcae2 | ||
|
|
8e139871fe | ||
|
|
0826b6b0b3 | ||
|
|
887ca79f04 | ||
|
|
360e254954 | ||
|
|
0b31586c71 | ||
|
|
51b8bd68bb | ||
|
|
599e3ce163 | ||
|
|
935daf2d0d | ||
|
|
7f90ed4460 | ||
|
|
796446718d | ||
|
|
8c4025e708 | ||
|
|
5222d31a15 | ||
|
|
549df2ebc3 | ||
|
|
7234c3a0b6 | ||
|
|
009ae1f17d | ||
|
|
abc9568690 | ||
|
|
b493dec91e | ||
|
|
69d4178708 | ||
|
|
9031481ac3 | ||
|
|
ed11993900 | ||
|
|
8c26fbe537 | ||
|
|
5b0f9e417e | ||
|
|
27f64e1f4e | ||
|
|
0fbff134f4 | ||
|
|
b0c39a8a8d | ||
|
|
3ece93ba0f | ||
|
|
8b1aa4d749 | ||
|
|
61f83059c1 | ||
|
|
9f92d5f2a2 | ||
|
|
2d34215456 | ||
|
|
b0fd2b06a3 | ||
|
|
a7d0b41c08 | ||
|
|
47abc49c4a | ||
|
|
3ad88ccf2d | ||
|
|
9ef2ea27d4 | ||
|
|
360060252a | ||
|
|
0c789a4255 | ||
|
|
fe1ef2bc62 | ||
|
|
6fb4e4877a | ||
|
|
0d2d1eb599 | ||
|
|
8610f91ebf | ||
|
|
27d3766e0d | ||
|
|
ad79c0b629 | ||
|
|
77d22c4abd | ||
|
|
1a92376f00 | ||
|
|
e90e741b1e | ||
|
|
fc059090b6 | ||
|
|
ff7661d9de | ||
|
|
1fca558799 | ||
|
|
ea1a63a201 | ||
|
|
c9aca4561d | ||
|
|
bc28f7a1e1 | ||
|
|
c06391be0d | ||
|
|
3b79370a7d | ||
|
|
b99cb64b80 | ||
|
|
a94a06a38e | ||
|
|
1d4ef2a9e9 | ||
|
|
53146cc9ec | ||
|
|
8302c43265 | ||
|
|
cffd5022c5 | ||
|
|
d11edf9809 | ||
|
|
236abbfd71 | ||
|
|
94a6a956f0 | ||
|
|
c6def44cfc | ||
|
|
13c26fc1a5 | ||
|
|
c30c5e89cf | ||
|
|
d8636cad4d | ||
|
|
f6495eb767 | ||
|
|
7ac868460a | ||
|
|
081df62b92 | ||
|
|
52e8d060a9 | ||
|
|
d77601178d | ||
|
|
64f70cc755 | ||
|
|
8187bb4394 | ||
|
|
820098fd61 | ||
|
|
aa385d4015 | ||
|
|
f63a20ad7b | ||
|
|
864b79791a | ||
|
|
26920c6c94 | ||
|
|
c088c582bf | ||
|
|
95bf6da637 | ||
|
|
a4a65e7f99 | ||
|
|
051e4c15db | ||
|
|
d598d41110 | ||
|
|
1372780662 | ||
|
|
3a01f8cae2 | ||
|
|
ef38b39262 | ||
|
|
aba75460e4 | ||
|
|
1323c940fd | ||
|
|
00a6a75035 | ||
|
|
1c31501b1b | ||
|
|
416340642d | ||
|
|
8db361b3e5 | ||
|
|
ed8e036360 | ||
|
|
86c76a9c2a | ||
|
|
0e28e1fa05 | ||
|
|
60e56f5292 | ||
|
|
54c14d7850 | ||
|
|
ae1036185e | ||
|
|
5f6873621d | ||
|
|
272a95524f | ||
|
|
a0782684fd | ||
|
|
744ec1d549 | ||
|
|
9fe5f98de4 | ||
|
|
c8459a5a8f | ||
|
|
19732c6226 | ||
|
|
4e116823f4 | ||
|
|
fb24eb4f47 | ||
|
|
defd998c42 | ||
|
|
1f30a41abe | ||
|
|
5d8d4a674b | ||
|
|
65a0730c9f | ||
|
|
3e6908b586 | ||
|
|
db7d5fca5f | ||
|
|
4c9b68f0e0 | ||
|
|
a66a43e8ef | ||
|
|
d75ac02a4f | ||
|
|
114de55668 | ||
|
|
1d1d2f9b18 | ||
|
|
497a88506e | ||
|
|
85208e2ab9 | ||
|
|
b1591d1f8b | ||
|
|
a3603e845e | ||
|
|
265d229427 | ||
|
|
fcffa2cc1a | ||
|
|
50e4d660ac | ||
|
|
45673d2cc0 | ||
|
|
5c69cd84ff | ||
|
|
75ce8d7c88 | ||
|
|
130bec5ad8 | ||
|
|
ae28b04ff2 | ||
|
|
c57e42b8f0 | ||
|
|
8a8308f129 | ||
|
|
66388f89a5 | ||
|
|
50aec98e1c | ||
|
|
6feaeace86 | ||
|
|
cf32ac543c | ||
|
|
35d60421b4 | ||
|
|
9cdb0601eb | ||
|
|
fa15f702d2 | ||
|
|
ef8b112d77 | ||
|
|
b88868276c | ||
|
|
83788da250 | ||
|
|
27eff033d2 | ||
|
|
c7a3fb96d0 | ||
|
|
b0cc0a6ca8 | ||
|
|
889a301a0c | ||
|
|
900c24dc4e | ||
|
|
5a40651046 | ||
|
|
89de1e7930 | ||
|
|
b5474c48b1 | ||
|
|
b159146fa6 | ||
|
|
3ad0bd9563 | ||
|
|
3ec5c692ec | ||
|
|
aee53f4604 | ||
|
|
b3de66869b | ||
|
|
0efab3319d | ||
|
|
3b1cbd7bec | ||
|
|
38ddbed4c1 | ||
|
|
08ed1a73f1 | ||
|
|
806c74fe19 | ||
|
|
f64c1cd26d | ||
|
|
a1bbde71bf | ||
|
|
3bd31ebc9a | ||
|
|
372f91f07c | ||
|
|
bc12fb79fd | ||
|
|
1b17b01584 | ||
|
|
0298be88ae | ||
|
|
684d745bf3 | ||
|
|
02a4ed9264 | ||
|
|
49da8a83ad | ||
|
|
a99b194336 | ||
|
|
eed9451cf6 | ||
|
|
fa144713b8 | ||
|
|
6b140ea5a9 | ||
|
|
7c71822809 | ||
|
|
b5b757eb8d | ||
|
|
6be2319873 | ||
|
|
ad6faf6497 | ||
|
|
4271d438e2 | ||
|
|
d4574f1b61 | ||
|
|
c00e4ff8e5 | ||
|
|
3b7767abe6 | ||
|
|
796245b554 | ||
|
|
8fd6e1fb0f | ||
|
|
d7f7bd0445 | ||
|
|
02a415606c | ||
|
|
8833a51781 | ||
|
|
9bd49d6a22 | ||
|
|
592a3e63ee | ||
|
|
273af73317 | ||
|
|
eb83478528 | ||
|
|
369da77d5e | ||
|
|
20d739adf7 | ||
|
|
53a2299230 | ||
|
|
467a18b1d9 | ||
|
|
a3181dd833 | ||
|
|
ba552523fa | ||
|
|
d35c5df08c | ||
|
|
b75b6e2c35 | ||
|
|
038cbc7442 | ||
|
|
c94e89d81f | ||
|
|
db2b9f37d4 | ||
|
|
8ec99dfa05 | ||
|
|
d402f971a5 | ||
|
|
eeba178d3a | ||
|
|
7d957c6573 | ||
|
|
665b4e69ed | ||
|
|
7875f5b72a | ||
|
|
55ed17747f | ||
|
|
4fa2bb5e95 | ||
|
|
9eaf059d28 | ||
|
|
5ed78adca5 | ||
|
|
d299563257 | ||
|
|
9758e7d58d | ||
|
|
f3fbe20c35 | ||
|
|
01d2ea908b | ||
|
|
39fcb5a750 | ||
|
|
0733e840bd | ||
|
|
d21735de2d | ||
|
|
87ac7028e0 | ||
|
|
438803311b | ||
|
|
9a218bf979 | ||
|
|
1a6986699f | ||
|
|
eec2bbb9bf | ||
|
|
2aef3a6bb9 | ||
|
|
95877b6756 | ||
|
|
79a466f128 | ||
|
|
6d13964714 | ||
|
|
e7dd383f67 | ||
|
|
b9c0b99e51 | ||
|
|
70624846fd | ||
|
|
1fcc66e685 | ||
|
|
ceef50b280 | ||
|
|
f1f2bd0b0a | ||
|
|
9910cd2869 | ||
|
|
1f0c43668a | ||
|
|
31c73af656 | ||
|
|
2b1effdbbc | ||
|
|
c5b5cab37d | ||
|
|
38c15becf6 | ||
|
|
5a841adf5d | ||
|
|
fb74a45088 | ||
|
|
f3f9062ecf | ||
|
|
730f826f25 | ||
|
|
ace02dc9cd | ||
|
|
46ea0e4696 | ||
|
|
6925d50176 | ||
|
|
de2a342289 | ||
|
|
e62dc86bc7 | ||
|
|
04ae328851 | ||
|
|
14b7c5d12b | ||
|
|
741f40b58e | ||
|
|
72812d3143 | ||
|
|
a2e6908165 | ||
|
|
90c2abd212 | ||
|
|
dec43433e5 | ||
|
|
2423b12dae | ||
|
|
05b5addcaa | ||
|
|
07a37aebf5 | ||
|
|
dba11452cb | ||
|
|
1a781a499f | ||
|
|
603557b466 | ||
|
|
089db51fbe | ||
|
|
3eeab3b23f | ||
|
|
6834ee941a | ||
|
|
54805af092 | ||
|
|
c98c06233e | ||
|
|
b24d65659f | ||
|
|
06656f363d | ||
|
|
db930948a9 | ||
|
|
463304edfd | ||
|
|
356b6dbf86 | ||
|
|
0ee0a8d539 | ||
|
|
b6ecbdc07d | ||
|
|
ebd8065f38 | ||
|
|
2dd2d7a37d | ||
|
|
b9df470c4d | ||
|
|
249f39a265 | ||
|
|
ef03dbcd4d | ||
|
|
aad44fb37a | ||
|
|
3280f9a3fc | ||
|
|
6509f92a3b | ||
|
|
1dbbd2fe34 | ||
|
|
ed8a9be287 | ||
|
|
c3657428d3 | ||
|
|
38288bbf4c | ||
|
|
8a35c9a557 | ||
|
|
9e6c9f7311 | ||
|
|
74afa9aed1 | ||
|
|
c29ab97094 | ||
|
|
1477ad8e83 | ||
|
|
02d090d3d2 | ||
|
|
2480e3a30a | ||
|
|
1dbd6ff80f | ||
|
|
585f657e2d | ||
|
|
0c390a76fe | ||
|
|
fd3f1be57f | ||
|
|
355a61b56f | ||
|
|
66c22051f9 | ||
|
|
dbdc0d5da9 | ||
|
|
4d7f9c3d99 | ||
|
|
4b8a1e89a5 | ||
|
|
f435a918fa | ||
|
|
81ee96fe62 | ||
|
|
c36642195c | ||
|
|
edc6e0248c | ||
|
|
372f12678e | ||
|
|
efd7f03657 | ||
|
|
4e05da89f3 | ||
|
|
36c613a443 | ||
|
|
9dfe508a3f | ||
|
|
c2d6ca0922 | ||
|
|
03bb3088b0 | ||
|
|
6f8b7ea452 | ||
|
|
55805bcba4 | ||
|
|
d81891a2e6 | ||
|
|
43626d7671 | ||
|
|
cc05ce64e9 | ||
|
|
fff11f1ab7 | ||
|
|
fedce06b7f | ||
|
|
9c6b5fcb0a | ||
|
|
bff7a60f63 | ||
|
|
80f5ac7016 | ||
|
|
26f8e95d2d | ||
|
|
5c2bbb55d7 | ||
|
|
6c5fdfaf56 | ||
|
|
a21c24bf03 | ||
|
|
c8227639db | ||
|
|
357cfc739e | ||
|
|
9fb38f600c | ||
|
|
a5f09c668e | ||
|
|
c5f9a9dd0c | ||
|
|
31ac3b7764 | ||
|
|
45784febaf | ||
|
|
dba4e6f046 | ||
|
|
c223ced0ea | ||
|
|
282671bf76 | ||
|
|
30fcef430c | ||
|
|
cd8c436d81 | ||
|
|
94f19a8385 | ||
|
|
744a194f53 | ||
|
|
c52a6b0f10 | ||
|
|
e5d58c3dcc | ||
|
|
882cbcdfa1 | ||
|
|
7131213460 | ||
|
|
df23302cb5 | ||
|
|
5abdaa9a16 | ||
|
|
3c513e3858 | ||
|
|
0a25b35c66 | ||
|
|
55b2deda08 | ||
|
|
60281118d0 | ||
|
|
b89637a037 | ||
|
|
5447f17ef9 | ||
|
|
f419855300 | ||
|
|
bb0088e980 | ||
|
|
8fc0589777 | ||
|
|
f46999f8bc | ||
|
|
1552ff7efb | ||
|
|
ec07469a3e | ||
|
|
31a0ece3a7 | ||
|
|
7d6829096d | ||
|
|
eaecbf33f7 | ||
|
|
69a20f0aca | ||
|
|
6cf47a79ac | ||
|
|
2bc4dec7a1 | ||
|
|
a58f040a37 | ||
|
|
85dd4b3b27 | ||
|
|
ccd96f1972 | ||
|
|
3d61b10595 | ||
|
|
950d8b496f | ||
|
|
2c669dd108 | ||
|
|
ce22feea01 | ||
|
|
3889078dbe | ||
|
|
999623e973 | ||
|
|
b5f2516e3f | ||
|
|
813d88cf78 | ||
|
|
4acf8f8481 | ||
|
|
72f9a4277f | ||
|
|
9af363fe20 | ||
|
|
7134d6581b | ||
|
|
8e392922b0 | ||
|
|
c265b17550 | ||
|
|
087bc82bb0 | ||
|
|
ee28362597 | ||
|
|
107c796e79 | ||
|
|
9f2f8540c5 | ||
|
|
e9fc781570 | ||
|
|
633f153808 | ||
|
|
ef0eab514d | ||
|
|
0d2fb76c11 | ||
|
|
95ebf618b7 | ||
|
|
8eaa7b3698 | ||
|
|
2293b96f42 | ||
|
|
9ae7ebd0fd | ||
|
|
258bd3d971 | ||
|
|
3c2f27d9f1 | ||
|
|
99702ab221 | ||
|
|
b78d9b56eb | ||
|
|
1a10eec178 | ||
|
|
bfebd35bea | ||
|
|
a49b025b19 | ||
|
|
a3483db55f | ||
|
|
3cd2760ba1 | ||
|
|
b36e684fd7 | ||
|
|
28593a085b | ||
|
|
ca38a29c81 | ||
|
|
9b5a953a98 | ||
|
|
4bcdd72142 | ||
|
|
bdfd0d78bc | ||
|
|
9260fc5552 | ||
|
|
1c9cebc8df | ||
|
|
8470b9a85c | ||
|
|
6ccdd8c122 | ||
|
|
c2e5b977ab | ||
|
|
68ca35c90f | ||
|
|
9c93721ea5 | ||
|
|
d63dee4019 | ||
|
|
f4c208937c | ||
|
|
c2af1ee036 | ||
|
|
bcca3317b5 | ||
|
|
a7512d74fa | ||
|
|
3dd4f5ed69 | ||
|
|
a0f0ae5a7a | ||
|
|
74400ccfd0 | ||
|
|
8acbf1d307 | ||
|
|
11fdb8a4c7 | ||
|
|
1bf25f0307 | ||
|
|
4bef7b4186 | ||
|
|
051eee6ed3 | ||
|
|
d642a67928 | ||
|
|
527880e5cf | ||
|
|
b5937d3eea | ||
|
|
0e766183ee | ||
|
|
f86bbfaddd | ||
|
|
9b2589dafd | ||
|
|
dfa7b0eff6 | ||
|
|
30f68908ef | ||
|
|
f28d819554 | ||
|
|
3550753445 | ||
|
|
1d098cefe2 | ||
|
|
bf265daa47 | ||
|
|
ad117d8a21 | ||
|
|
24e2833cdf | ||
|
|
2e772edacf | ||
|
|
4c557bf576 | ||
|
|
54a992d81e | ||
|
|
b0a0fc8944 | ||
|
|
a8412dbf39 | ||
|
|
fd35de564e | ||
|
|
371ca19f53 | ||
|
|
f0a4ac8216 | ||
|
|
35636540ea | ||
|
|
5c72104a85 | ||
|
|
c9fc633f9e | ||
|
|
524fcb9e01 | ||
|
|
95bfe631a4 | ||
|
|
63ae66198d | ||
|
|
b67adb0d83 | ||
|
|
c5bd149261 | ||
|
|
dece3c5684 | ||
|
|
b8f5adb64f | ||
|
|
3be34309e3 | ||
|
|
f8f6e624bb | ||
|
|
48cc89b738 | ||
|
|
e73866181f | ||
|
|
4c67c596d1 | ||
|
|
8d0afde412 | ||
|
|
6a9d1f652b | ||
|
|
f6ecaccf92 | ||
|
|
886b84211e | ||
|
|
5bb1677f1d | ||
|
|
88cec25e99 | ||
|
|
1644db9a2b | ||
|
|
b9408504f5 | ||
|
|
3b1525e444 | ||
|
|
1350666498 | ||
|
|
5171bf6d40 | ||
|
|
dcbca62e89 | ||
|
|
5078919981 | ||
|
|
28d0ac13d1 | ||
|
|
91631011cc | ||
|
|
863a3e15d6 | ||
|
|
ab3d839ef4 | ||
|
|
861e624e15 | ||
|
|
449377aa6a | ||
|
|
80f6d55836 | ||
|
|
ac20ce1924 | ||
|
|
2a953aed38 | ||
|
|
a0065d5955 | ||
|
|
31b35a16e0 | ||
|
|
a3c8481a33 | ||
|
|
b76cb68979 | ||
|
|
1071ccfd25 | ||
|
|
c0f9d0dce7 | ||
|
|
5d60a46269 | ||
|
|
ac5dbd193b | ||
|
|
59443965ad | ||
|
|
d36cdd25a5 | ||
|
|
39eb040757 | ||
|
|
a07c902648 | ||
|
|
75220b55ff | ||
|
|
994c6ffd3b | ||
|
|
c61804ed59 | ||
|
|
f349e978c4 | ||
|
|
a3e4f455ac | ||
|
|
54eceffcae | ||
|
|
76fa8ea790 | ||
|
|
bac490fe53 | ||
|
|
b6ec78161d | ||
|
|
0a68590314 | ||
|
|
c639a35f50 | ||
|
|
dd9173c07f | ||
|
|
16815d4b45 | ||
|
|
80dd0863e2 | ||
|
|
e20b7d844a | ||
|
|
a7cecbc917 | ||
|
|
4fb0b51703 | ||
|
|
6c4250c0dc | ||
|
|
d0b5be6da8 | ||
|
|
2338d3176b | ||
|
|
063c1f54ea | ||
|
|
69edfecfb9 | ||
|
|
b373a8d0ca | ||
|
|
0b7d70c822 | ||
|
|
8aa0b62a88 | ||
|
|
9e6089ee0f | ||
|
|
c9dd5f945b | ||
|
|
be0c36009a | ||
|
|
23b1e5c7df | ||
|
|
879d6c85af | ||
|
|
8a915880e7 | ||
|
|
95b520110d | ||
|
|
deba6dea03 | ||
|
|
46bf7de5f6 | ||
|
|
ff9b4a8981 | ||
|
|
fdbac35b33 | ||
|
|
842757dc96 | ||
|
|
3450636169 | ||
|
|
2d91deba45 | ||
|
|
0034443140 | ||
|
|
af6b40a1ea | ||
|
|
f672c9e62f | ||
|
|
bb9579ffc3 | ||
|
|
fa1c5aac51 | ||
|
|
73f6a1b058 | ||
|
|
221b2ea6c4 | ||
|
|
9a53feaa76 | ||
|
|
57c82fe7c4 | ||
|
|
51038a3f42 | ||
|
|
74bcd16425 | ||
|
|
dc6647201d | ||
|
|
c126f8ffb6 | ||
|
|
3555fd006e | ||
|
|
13cb842773 | ||
|
|
547e102082 | ||
|
|
7499918f30 | ||
|
|
14d7ea460f | ||
|
|
b6071b6341 | ||
|
|
eba260587a | ||
|
|
4e664ac51d | ||
|
|
089decab65 | ||
|
|
220238305f | ||
|
|
26eeb0c9da | ||
|
|
f9d6aa0a86 | ||
|
|
4db35647dd | ||
|
|
2835efe3da | ||
|
|
1b06419e60 | ||
|
|
655584b07a | ||
|
|
6c7ac21f3a | ||
|
|
096b151f76 | ||
|
|
439e3df653 | ||
|
|
0139ca92ff | ||
|
|
8d79ce8320 | ||
|
|
20aab260e2 | ||
|
|
0382eb8865 | ||
|
|
e92895c038 | ||
|
|
c8eae6684b | ||
|
|
c1cda4a609 | ||
|
|
81108e7653 | ||
|
|
c3fbec73fb | ||
|
|
8d3b0497a4 | ||
|
|
778041f8d1 | ||
|
|
b9e4ce99d8 | ||
|
|
ed4492a697 | ||
|
|
7b0241579c | ||
|
|
6fc92a506a | ||
|
|
4cdc607f72 | ||
|
|
bc4c030023 | ||
|
|
044228d5ec | ||
|
|
51ded05b3b | ||
|
|
a868ec89e8 | ||
|
|
58a5bd187d | ||
|
|
06ef16563b | ||
|
|
ccd65c9be6 | ||
|
|
3d46224b78 | ||
|
|
cfeb08a193 | ||
|
|
5e66a26eaa | ||
|
|
26a0d9a945 | ||
|
|
b028e08d35 | ||
|
|
7467c8d3b6 | ||
|
|
f69bfc76fa | ||
|
|
ab6526c8b3 | ||
|
|
3e94f729a5 | ||
|
|
c127008840 | ||
|
|
481d19b38e | ||
|
|
daf0b78e1a | ||
|
|
93febe672a | ||
|
|
c59fa37d40 | ||
|
|
248c57ca43 | ||
|
|
59e50f634a | ||
|
|
8c145dc31b | ||
|
|
55522080c6 | ||
|
|
5c58d283bb | ||
|
|
91b84603d3 | ||
|
|
2a46634617 | ||
|
|
5710f9f690 | ||
|
|
654944fc36 | ||
|
|
c3d2f1287e | ||
|
|
6199fa90e5 | ||
|
|
6248355c6f | ||
|
|
5a4a46a251 | ||
|
|
f52947ba71 | ||
|
|
aa64ba459f | ||
|
|
ceece81414 | ||
|
|
d0e5f86a10 | ||
|
|
d0b4d3dabf | ||
|
|
7b2dfc623b | ||
|
|
40ecf7da88 | ||
|
|
5c3070b29c | ||
|
|
807bda4a24 | ||
|
|
7cd5075908 | ||
|
|
48dfc56b4a | ||
|
|
d9d75555ba | ||
|
|
9137f2a2d1 | ||
|
|
5a071bcbf2 | ||
|
|
934c8ecb88 | ||
|
|
1c03923b0b | ||
|
|
b7e6f13b3c | ||
|
|
0279505e8c | ||
|
|
d28cb03819 | ||
|
|
c308847274 | ||
|
|
00e56ada9c | ||
|
|
3bbcc95ac9 | ||
|
|
d22b78ff05 | ||
|
|
77b68e6f42 | ||
|
|
3102ac4b58 | ||
|
|
5009f90ea2 | ||
|
|
44edeff025 | ||
|
|
8e75f6daa6 | ||
|
|
332394b577 | ||
|
|
d50a61956c | ||
|
|
94f3a570e1 | ||
|
|
8df319b213 | ||
|
|
ed8495990a | ||
|
|
bbac261402 | ||
|
|
7f3cbdd7fd | ||
|
|
623cfa99e5 | ||
|
|
dd8500bce7 | ||
|
|
3073dfbf30 | ||
|
|
22ecf049b6 | ||
|
|
2870d964f8 | ||
|
|
8f6978405d | ||
|
|
10175a43ee | ||
|
|
0159597bd6 | ||
|
|
7e516797f9 | ||
|
|
8fa1bf7cd6 | ||
|
|
8f01839386 | ||
|
|
a77cfbfd0c | ||
|
|
d877d44d12 | ||
|
|
db15cb72e2 | ||
|
|
a2949aa217 | ||
|
|
ff9eee475f | ||
|
|
66ca9480c8 | ||
|
|
029b4a0422 | ||
|
|
ec23c4920f | ||
|
|
df82f611c8 | ||
|
|
cb57d551a2 | ||
|
|
184d73636d | ||
|
|
028b65b060 | ||
|
|
07abfe2092 | ||
|
|
0d8cc1670c | ||
|
|
4b6b5e4314 | ||
|
|
5c66d06104 | ||
|
|
0392b8638e | ||
|
|
a90f20b1c3 | ||
|
|
d98337a7b4 | ||
|
|
91a6318d55 | ||
|
|
5ef5614c31 | ||
|
|
ce98c19dfe | ||
|
|
78b0e379d7 | ||
|
|
addabd6f16 | ||
|
|
f8736d251e | ||
|
|
6c947d289f | ||
|
|
24982c589b | ||
|
|
2d848a476a | ||
|
|
2e6d3cfa82 | ||
|
|
1557626897 | ||
|
|
e0c0757d09 | ||
|
|
d9c8acec37 | ||
|
|
8f5b63edea | ||
|
|
52a97ca00c | ||
|
|
c798b07762 | ||
|
|
a0105713e8 | ||
|
|
764303f980 | ||
|
|
30f1eafaaa | ||
|
|
6b03504441 | ||
|
|
76ce7549ce | ||
|
|
9f832deecf | ||
|
|
7387240ef0 | ||
|
|
837097648e | ||
|
|
fbbd360b3c | ||
|
|
8071c02131 | ||
|
|
ceeff73819 | ||
|
|
091781e20e | ||
|
|
8a646dd293 | ||
|
|
ea4abff595 | ||
|
|
075228a461 | ||
|
|
02c40a72b8 | ||
|
|
fa2661f2e5 | ||
|
|
aff5e2eaef | ||
|
|
06a71cced2 | ||
|
|
8e74bf94f3 | ||
|
|
eb1c94078f | ||
|
|
b4a26e6fc0 | ||
|
|
74c97cdba6 | ||
|
|
32574a41b4 | ||
|
|
bd4b621e91 | ||
|
|
6bad1fa1fd | ||
|
|
f429baca86 | ||
|
|
17822cd60a | ||
|
|
9aff903603 | ||
|
|
dab3d46b9d | ||
|
|
583e3ca456 | ||
|
|
7bd773c9fe | ||
|
|
0915c4b985 | ||
|
|
bf0a010cf7 | ||
|
|
5246225596 | ||
|
|
04407e522b | ||
|
|
4f3e24979b | ||
|
|
817e73cb63 | ||
|
|
12422ffe3e | ||
|
|
c616e53ca2 | ||
|
|
f4dd6e3d1a | ||
|
|
cb2a372c9f | ||
|
|
67a4640333 | ||
|
|
62ebe2e443 | ||
|
|
cda5cf1c2f | ||
|
|
9344f7575e | ||
|
|
8b113f93b9 | ||
|
|
4f6753e586 | ||
|
|
4f990533e3 | ||
|
|
f12cc4ee68 | ||
|
|
86f0167e39 | ||
|
|
6e9e136fcb | ||
|
|
4f6aea807b | ||
|
|
8b7a0d807a | ||
|
|
0a4f578fdc | ||
|
|
fa43e54b6f | ||
|
|
04052f96e1 | ||
|
|
a813afc24f | ||
|
|
5a9d441b2c | ||
|
|
1c1f5d3047 | ||
|
|
a15dc15f12 | ||
|
|
bf7df04ec1 | ||
|
|
77d9268892 | ||
|
|
bdd4eced84 | ||
|
|
774d135b66 | ||
|
|
3200f5ac68 | ||
|
|
57e6a49e5b | ||
|
|
9978576f15 | ||
|
|
aeb44c4da6 | ||
|
|
816867858b | ||
|
|
94ac244dea | ||
|
|
1eb4acfc23 | ||
|
|
edc806507c | ||
|
|
117231c44f | ||
|
|
7f7348b7b2 | ||
|
|
1d9d41150b | ||
|
|
004015e9c4 | ||
|
|
abec344ab7 | ||
|
|
317827d9e5 | ||
|
|
73991ff925 | ||
|
|
ada18ff0f5 | ||
|
|
8ae319a322 | ||
|
|
2f6e1f880b | ||
|
|
13a70ac2ab | ||
|
|
9ffb7dd9a4 | ||
|
|
6197c51834 | ||
|
|
b6967635eb | ||
|
|
1844770fec | ||
|
|
d6ef07406d | ||
|
|
6943815400 | ||
|
|
231f998aba | ||
|
|
7cedac567c | ||
|
|
bc0f783a5f | ||
|
|
233817437d | ||
|
|
bfae2529b8 | ||
|
|
2439a59828 | ||
|
|
8f7a4ad442 | ||
|
|
bf381a0ad8 | ||
|
|
c55b8d41c1 | ||
|
|
59df6f7398 | ||
|
|
bc604a2f41 | ||
|
|
f72f562b2f | ||
|
|
9abfe85e96 | ||
|
|
50ae3102fb | ||
|
|
55f9872616 | ||
|
|
c911a4389b | ||
|
|
15649c11f3 | ||
|
|
20a69a77d2 | ||
|
|
78a7c99f7f | ||
|
|
be9f44a7df | ||
|
|
336480fe6f | ||
|
|
d928accbbd | ||
|
|
2416dfc3c9 | ||
|
|
dd527d3c62 | ||
|
|
9de2659264 | ||
|
|
35e59bed97 | ||
|
|
452cc1f293 | ||
|
|
9496466044 | ||
|
|
14d354312a | ||
|
|
cb378a5267 | ||
|
|
a17b3631fe | ||
|
|
95a349f427 | ||
|
|
ddb00545b7 | ||
|
|
4819c3d477 | ||
|
|
1f3b9f297e | ||
|
|
cfa88ecb72 | ||
|
|
5f265b755a | ||
|
|
9d94deabd3 | ||
|
|
238da24620 | ||
|
|
2b02ab9606 | ||
|
|
eb5f433736 | ||
|
|
c96381be40 | ||
|
|
5b44f48afc | ||
|
|
f3e79ba6e3 | ||
|
|
6e91f69a0d | ||
|
|
854125f6e6 | ||
|
|
d283e1cfe9 | ||
|
|
1a6d39b259 | ||
|
|
0a36de0580 | ||
|
|
45e92ba2ce | ||
|
|
8cd16d8fd3 | ||
|
|
186bf1defc | ||
|
|
de0ca0cd9e | ||
|
|
f3f9f3efa7 | ||
|
|
4ad13e5d95 | ||
|
|
c33ebc9741 | ||
|
|
04b0354d8e | ||
|
|
8f3e51b4ad | ||
|
|
8d35134ad8 | ||
|
|
83a2ae2184 | ||
|
|
7e1273edf7 | ||
|
|
238bc4090d | ||
|
|
da7f095c12 | ||
|
|
28355a36da | ||
|
|
822c3837f9 | ||
|
|
713b398700 | ||
|
|
5bcfc9ba1a | ||
|
|
cc0aa0f2d7 | ||
|
|
1b62619446 | ||
|
|
3aae10014c | ||
|
|
2e6c878763 | ||
|
|
6b8c550d88 | ||
|
|
2dcfba7117 | ||
|
|
044a72d0d5 | ||
|
|
a0ba9f45fb | ||
|
|
d24f878546 | ||
|
|
7526f035f4 | ||
|
|
e5ffb911e8 | ||
|
|
e6bf66eada | ||
|
|
b0aca921be | ||
|
|
87d893c04b | ||
|
|
6689140597 | ||
|
|
80abc45182 | ||
|
|
adcbc12d85 | ||
|
|
3425111bb9 | ||
|
|
0fcd447d59 | ||
|
|
20a3069ec0 | ||
|
|
19ec9ee91e | ||
|
|
9f8caf134f | ||
|
|
bafd94f154 | ||
|
|
1c8a59ab95 | ||
|
|
f162e7d09d | ||
|
|
e67c3ce327 | ||
|
|
e0244b0642 | ||
|
|
b9f5b82339 | ||
|
|
6d553ef200 | ||
|
|
abde065935 | ||
|
|
4ed5e37d4b | ||
|
|
3f99b567b8 | ||
|
|
aac75e5a78 | ||
|
|
0e9aef36fa | ||
|
|
8a633268ef | ||
|
|
6f34394454 | ||
|
|
65504ac12c | ||
|
|
defa4f93c2 | ||
|
|
218aa370b4 | ||
|
|
43ca13714b | ||
|
|
24abecc349 | ||
|
|
af166e7ce0 | ||
|
|
2bf4dad7ec | ||
|
|
07e462fd6d | ||
|
|
72ab975a6b | ||
|
|
088875fec4 | ||
|
|
af44a0e8f4 | ||
|
|
0081466925 | ||
|
|
0f9426edb0 | ||
|
|
25f2703015 | ||
|
|
a1dbc22469 | ||
|
|
924ab5b7d3 | ||
|
|
7f3b86e7bf | ||
|
|
6aabfd5e30 | ||
|
|
ca85cdbe4c | ||
|
|
468f504fd7 | ||
|
|
c1bdffe99b | ||
|
|
3c3277f0bd | ||
|
|
30592a5451 | ||
|
|
e55987896a | ||
|
|
2789906aad | ||
|
|
207587a9b4 | ||
|
|
c29c44c00e | ||
|
|
4f4bcfcd1a | ||
|
|
c57a75d896 | ||
|
|
4b541a8817 | ||
|
|
67d7fe66e7 | ||
|
|
4f3558af17 | ||
|
|
04095e58fb | ||
|
|
3676374915 | ||
|
|
f227815c3a | ||
|
|
8810bdbba3 | ||
|
|
9f0fedb8f6 | ||
|
|
3a4aef5a4c | ||
|
|
01441036e9 | ||
|
|
9ff9325e60 | ||
|
|
af030496fa | ||
|
|
de1b262942 | ||
|
|
91b2855ba8 | ||
|
|
4e9267d76c | ||
|
|
4b66dabc76 | ||
|
|
8a24a65d2f | ||
|
|
ed424dbf1d | ||
|
|
d8862928c2 | ||
|
|
f5c358bc98 | ||
|
|
782ab3ccf8 | ||
|
|
ee0d93ed04 | ||
|
|
89dc02d944 | ||
|
|
56c14a6473 | ||
|
|
497ef46587 | ||
|
|
3e310ac309 | ||
|
|
6ebd633829 | ||
|
|
46cd74b9e3 | ||
|
|
3ce79338e6 | ||
|
|
0a3bda2c53 | ||
|
|
b5ec61e4f5 | ||
|
|
53265546a6 | ||
|
|
96dcd19b8a | ||
|
|
54652230d4 | ||
|
|
b181056e06 | ||
|
|
bcfeb2ac44 | ||
|
|
2771d1a574 | ||
|
|
fccaa3629b | ||
|
|
6e808ca354 | ||
|
|
30ac01cca7 | ||
|
|
3828dbed57 | ||
|
|
31868b85be | ||
|
|
59a86cad67 | ||
|
|
5d81768cf1 | ||
|
|
a3045dfd25 | ||
|
|
1240082e37 | ||
|
|
24ed3bee0c | ||
|
|
3d406da0c9 | ||
|
|
1c0d311ff4 | ||
|
|
ae1c704c44 | ||
|
|
33431ebb9a | ||
|
|
3136904ff6 | ||
|
|
685f5fd6f4 | ||
|
|
a529d885d2 | ||
|
|
5faef74bae | ||
|
|
65708e4cd1 | ||
|
|
4a2e463525 | ||
|
|
0f50bca9aa | ||
|
|
445fb952b8 | ||
|
|
1e04ea388f | ||
|
|
d6cde0bcf4 | ||
|
|
4ef40c02f4 | ||
|
|
8fc364ebd5 | ||
|
|
6ba1a80c26 | ||
|
|
5a65413c04 | ||
|
|
47fd219c95 | ||
|
|
be66ad3212 | ||
|
|
3e2ab88ee2 | ||
|
|
c9cac5be23 | ||
|
|
6785b51280 | ||
|
|
359c106871 | ||
|
|
46079a1d77 | ||
|
|
327175137f | ||
|
|
a6ce670a87 | ||
|
|
2709297f3b | ||
|
|
50b787cac5 | ||
|
|
a283157c38 | ||
|
|
c8d9e0604a | ||
|
|
da160c0da5 | ||
|
|
90d7f696d6 | ||
|
|
65317ea27f | ||
|
|
ed897e5415 | ||
|
|
2975a34f23 | ||
|
|
b3f23d4c6a | ||
|
|
988be100e2 | ||
|
|
4949faf4b2 | ||
|
|
5b20d02ea9 | ||
|
|
9e966ffed4 | ||
|
|
f70f6cef39 | ||
|
|
48081f81bd | ||
|
|
7dc8d227a5 | ||
|
|
528ef50a4a | ||
|
|
a12131966c | ||
|
|
7fd92949d0 | ||
|
|
d22e560ad6 | ||
|
|
9d53c8ab74 | ||
|
|
93ffa950bf | ||
|
|
efcfe874ea | ||
|
|
0958093be6 | ||
|
|
3c3430502a | ||
|
|
b04d744a47 | ||
|
|
e703f7ed42 | ||
|
|
b9af894264 | ||
|
|
6d7fa438a7 | ||
|
|
fd402941a7 | ||
|
|
4e853560f5 | ||
|
|
2f2da90fd4 | ||
|
|
b6b519b416 | ||
|
|
d3f97f1971 | ||
|
|
303dd28bb0 | ||
|
|
4391a16c92 | ||
|
|
e5dfced23a | ||
|
|
a75e286743 | ||
|
|
59aa5703ae | ||
|
|
fc994d1cb4 | ||
|
|
7cf9fed83f | ||
|
|
3f8688b406 | ||
|
|
5d6f3440e6 | ||
|
|
305fdfa755 | ||
|
|
37849f3320 | ||
|
|
13e9c7ad82 | ||
|
|
0e757a2f3f | ||
|
|
f608da4288 | ||
|
|
e5f3957665 | ||
|
|
8a9b2c6448 | ||
|
|
aa21e0f913 | ||
|
|
250a221768 | ||
|
|
83f173b61e | ||
|
|
c270ec1fa2 | ||
|
|
831ed16efc | ||
|
|
79757c9c37 | ||
|
|
ea9065072c | ||
|
|
79359d87e8 | ||
|
|
94e505485e | ||
|
|
5bca0afb31 | ||
|
|
9a1395b9fd | ||
|
|
4e2439ad27 | ||
|
|
911af57ff8 | ||
|
|
64c8b1762c | ||
|
|
acc7757312 | ||
|
|
a2a978ae23 | ||
|
|
fdefbbbe85 | ||
|
|
e76c3b08e1 | ||
|
|
3c0364f391 | ||
|
|
4fd382ea29 | ||
|
|
06070532ba | ||
|
|
d402edfd63 | ||
|
|
14fe392dde | ||
|
|
b2e3e9b0c9 | ||
|
|
2129f97cd9 | ||
|
|
3f98040554 | ||
|
|
91c9388715 | ||
|
|
24073c7665 | ||
|
|
60b2d8d2c8 | ||
|
|
c97ec34370 | ||
|
|
0f0c0b41ce | ||
|
|
c0c502e172 | ||
|
|
c4cef5ab06 | ||
|
|
f77d88641d | ||
|
|
1e117b4752 | ||
|
|
84e229cfbe | ||
|
|
e5c24dfd01 | ||
|
|
3a6da8c183 | ||
|
|
5f2ef46d6d | ||
|
|
ed7a776538 | ||
|
|
ae8ad35590 | ||
|
|
e0a7f917c2 | ||
|
|
c835567914 | ||
|
|
d98e574d41 | ||
|
|
7cd0cfeab6 | ||
|
|
f957c77910 | ||
|
|
02cebebc3b | ||
|
|
9233959940 | ||
|
|
018e9e6799 | ||
|
|
ee79ca1ba6 | ||
|
|
0cbc8cf4c9 | ||
|
|
58e42d5356 | ||
|
|
f58efb57d1 | ||
|
|
a2e68fc233 | ||
|
|
5b8939b147 | ||
|
|
9a2144663a | ||
|
|
cc7b4f39fc | ||
|
|
bff6b18bf9 | ||
|
|
2b549c3be0 | ||
|
|
5cd2a2d53e | ||
|
|
a82a00397f | ||
|
|
1c6581a865 | ||
|
|
af633757d3 | ||
|
|
049dc25fe7 | ||
|
|
36eff9ac55 | ||
|
|
6f3240abf9 | ||
|
|
6b2c23d847 | ||
|
|
21af752b04 | ||
|
|
f6aa13d403 | ||
|
|
82ab8da245 | ||
|
|
8ffaf8d139 | ||
|
|
c54f9530ee | ||
|
|
08ff8a49ba | ||
|
|
0b4d73a53c | ||
|
|
82bb8a2bf8 | ||
|
|
851895ab80 | ||
|
|
1ca20a7747 | ||
|
|
7447642a47 | ||
|
|
6f93277f56 | ||
|
|
ba372620c2 | ||
|
|
7ef1a5beb2 | ||
|
|
4ef37d0c17 | ||
|
|
92d23245c9 | ||
|
|
40eaa9f0bb | ||
|
|
8269396491 | ||
|
|
2ccfef2004 | ||
|
|
23c1a18126 | ||
|
|
7ef54de672 | ||
|
|
b183dfad2d | ||
|
|
cc165b9083 | ||
|
|
00b0496e69 | ||
|
|
16f7015722 | ||
|
|
7c25441792 | ||
|
|
c75586e06d | ||
|
|
61173a5371 | ||
|
|
fa513aab48 | ||
|
|
8b96032139 | ||
|
|
341744781a | ||
|
|
1a6f8cfadf | ||
|
|
8a6dbf6709 | ||
|
|
e2a3cd15a8 | ||
|
|
aad1a88c76 | ||
|
|
dfba13d199 | ||
|
|
704b2c2122 | ||
|
|
53b55ac08d | ||
|
|
c36c2ba598 | ||
|
|
7f1978570f | ||
|
|
4aaefc2a50 | ||
|
|
c5b3242d3d | ||
|
|
056960d8dc | ||
|
|
0d5051def0 | ||
|
|
3a0057e2c5 | ||
|
|
f71378c4ad | ||
|
|
0a6f1d31e7 | ||
|
|
e708cb5f9a | ||
|
|
a4edd0e946 | ||
|
|
f9ff8a7d90 | ||
|
|
af9e533a54 | ||
|
|
48dcc16548 | ||
|
|
730cdb1904 | ||
|
|
0d4e51d390 | ||
|
|
0b57e28373 | ||
|
|
b0c2b7dfe3 | ||
|
|
2825ee8c2c | ||
|
|
a8035a51be | ||
|
|
7384d7dce0 | ||
|
|
0d3a02eba7 | ||
|
|
670bea210e | ||
|
|
d8adaa279e | ||
|
|
3bf60aa723 | ||
|
|
e110ccb672 | ||
|
|
0e0883e0e9 | ||
|
|
038c8eb5a9 | ||
|
|
7ddaf7caae | ||
|
|
bac75ac2d5 | ||
|
|
1ef92685cf | ||
|
|
ce4a586edb | ||
|
|
40e5e7c7ea | ||
|
|
20f61d35de | ||
|
|
44a9914709 | ||
|
|
2892c35bdb | ||
|
|
82d8502409 | ||
|
|
53f5061c7e | ||
|
|
bdc8db9685 | ||
|
|
741f2c9898 | ||
|
|
b9a1e56a80 | ||
|
|
2b1c367a98 | ||
|
|
3c0b425cde | ||
|
|
14e9e9d1ca | ||
|
|
9c09e0eeaa | ||
|
|
c319601db5 | ||
|
|
4e7244e6b2 | ||
|
|
8658816f71 | ||
|
|
f594986b37 | ||
|
|
c75f83d874 | ||
|
|
b3d6e2df95 | ||
|
|
798ab301c7 | ||
|
|
f6ba2da29f | ||
|
|
e0bf91d7c6 | ||
|
|
53737c5421 | ||
|
|
6bff9cc487 | ||
|
|
bd2e42f162 | ||
|
|
94fd480bab | ||
|
|
6317c4baf7 | ||
|
|
4987bbf979 | ||
|
|
5ec5415402 | ||
|
|
1a49fc5e92 | ||
|
|
fe4e13fb97 | ||
|
|
22b889a998 | ||
|
|
68ea1d0325 | ||
|
|
1365bb7861 | ||
|
|
78f57460f2 | ||
|
|
d2117e9c82 | ||
|
|
09f4af5afd | ||
|
|
827e45c518 | ||
|
|
fa45f22e50 | ||
|
|
d92168486b | ||
|
|
4aaf89f49f | ||
|
|
f90c28dd1e | ||
|
|
8d4c397d9d | ||
|
|
3e6ff9017f | ||
|
|
dd91724aa0 | ||
|
|
74e056bfc8 | ||
|
|
3c7361f53a | ||
|
|
ce89871ff7 | ||
|
|
195743f195 | ||
|
|
eba8ed71f0 | ||
|
|
9ba5bce06f | ||
|
|
01658a3eec | ||
|
|
3dbf1e877a | ||
|
|
afffbfe8c4 | ||
|
|
b180dd9e50 | ||
|
|
13d1fa1d01 | ||
|
|
df351d6109 | ||
|
|
39eea898c4 | ||
|
|
7e5291f111 | ||
|
|
32f8c170b0 | ||
|
|
ca6045955d | ||
|
|
e2c44fc966 | ||
|
|
5de909873a | ||
|
|
4cc8f31ffe | ||
|
|
ae5612ca6e | ||
|
|
ae20128e9f | ||
|
|
26d53eb197 | ||
|
|
ec9fad9a49 | ||
|
|
a7db19bb81 | ||
|
|
11ae573320 | ||
|
|
7850f1e2ac | ||
|
|
5986f8d1c6 | ||
|
|
651f8c04ef | ||
|
|
6c563bc1a1 | ||
|
|
8b728a25a3 | ||
|
|
702ec5926f | ||
|
|
8bb7df49c2 | ||
|
|
0f430e34af | ||
|
|
36278b9576 | ||
|
|
54851d3c65 | ||
|
|
07f2f3917a | ||
|
|
1a046d5f9d | ||
|
|
138ece09b5 | ||
|
|
e6c4de03c6 | ||
|
|
f15d4dad66 | ||
|
|
5efa2291aa | ||
|
|
c27b9544b6 | ||
|
|
47cdcdd359 | ||
|
|
21b7459add | ||
|
|
afbff22e6e | ||
|
|
452fd33ffa | ||
|
|
076cdc24fc | ||
|
|
9ead68975c | ||
|
|
323434be42 | ||
|
|
446dd27843 | ||
|
|
42ab250709 | ||
|
|
3b565cdf91 | ||
|
|
85adecb668 | ||
|
|
450736cd3c | ||
|
|
016771834a | ||
|
|
39842defda | ||
|
|
de4406747b | ||
|
|
7b91f02021 | ||
|
|
93ba60f01d | ||
|
|
1b6cff3df4 | ||
|
|
4f76bb6f3e | ||
|
|
4142d4dc66 | ||
|
|
e677dfedd1 | ||
|
|
d11578f916 | ||
|
|
2bf658d5cd | ||
|
|
afeb96547f | ||
|
|
d160a27ec1 | ||
|
|
dc12190ba2 | ||
|
|
37977622c4 | ||
|
|
7d597c4833 | ||
|
|
dbfff6cbde | ||
|
|
e6967b20cb | ||
|
|
3757f98d86 | ||
|
|
8373e70c55 | ||
|
|
7a9cc2dcdd | ||
|
|
15f9b92127 | ||
|
|
df1e9daf30 | ||
|
|
ed0d958c3e | ||
|
|
2498b155fd | ||
|
|
a0cfe94c4e | ||
|
|
b83ffafc15 | ||
|
|
56082dc2ae | ||
|
|
68c1d8400c | ||
|
|
b249fbb1dc | ||
|
|
8c16bc5012 | ||
|
|
4a25d8c9c3 | ||
|
|
0ed9923887 | ||
|
|
3574b70efc | ||
|
|
8079b155c2 | ||
|
|
bbc8e4789f | ||
|
|
2f3105725f | ||
|
|
5723934f7c | ||
|
|
41492d6c23 | ||
|
|
c163e5107f | ||
|
|
544891dd26 | ||
|
|
adea7a6101 | ||
|
|
4b2e69a1cf | ||
|
|
e13bc0bc68 | ||
|
|
ffc40bf3de | ||
|
|
b2007bffc5 | ||
|
|
5d9cad0253 | ||
|
|
7aa1f5c42a | ||
|
|
dbcd8ce464 | ||
|
|
7e9276b50a | ||
|
|
8fc300976f | ||
|
|
be30a6b8b0 | ||
|
|
54006bce25 | ||
|
|
7c3e7ac940 | ||
|
|
8d7bdc9deb | ||
|
|
9e37007edb | ||
|
|
90fe7fea10 | ||
|
|
477aedd77f | ||
|
|
5165fbed63 | ||
|
|
caeeb36784 | ||
|
|
a183f05825 | ||
|
|
f1142c5b11 | ||
|
|
cbe31dace5 | ||
|
|
94456f5984 | ||
|
|
12dceb1147 | ||
|
|
963791a9e9 | ||
|
|
f1bbb22dca | ||
|
|
f57a832063 | ||
|
|
b50da53e0c | ||
|
|
3d20f772c2 | ||
|
|
966b3a6f79 | ||
|
|
1cf8166329 | ||
|
|
47aea4ee71 | ||
|
|
19f86207f5 | ||
|
|
69c8572f29 | ||
|
|
f6a7227fd6 | ||
|
|
28a78ab62c | ||
|
|
6faae7deb4 | ||
|
|
361ee514c6 | ||
|
|
ca0f458ada | ||
|
|
733c4ad6eb | ||
|
|
fa4f146d7d | ||
|
|
5f2c79d8c7 | ||
|
|
af12bc6de4 | ||
|
|
3f5bcbfa3c | ||
|
|
a9c69762ba | ||
|
|
825ae5a166 | ||
|
|
99806ad2bd | ||
|
|
11b7a1deb7 | ||
|
|
d69d2da165 | ||
|
|
b50d707633 | ||
|
|
02b9f42a27 | ||
|
|
81bcc92c32 | ||
|
|
8305006f7c | ||
|
|
c1c43113b4 | ||
|
|
3ec8ffb121 | ||
|
|
67991cf824 | ||
|
|
68be2ab914 | ||
|
|
98e599ca06 | ||
|
|
ec45595300 | ||
|
|
88a5ceb450 | ||
|
|
fc83c4c353 | ||
|
|
6fd8c664c1 | ||
|
|
3af1f88725 | ||
|
|
dadf9c6dcd | ||
|
|
821fbf0f42 | ||
|
|
bc9afadecd | ||
|
|
728875f340 | ||
|
|
631064613f | ||
|
|
0c9d77ccfd | ||
|
|
de556615dc | ||
|
|
510f0ddafa | ||
|
|
649968ceb1 | ||
|
|
af8c65deaa | ||
|
|
c900575dc4 | ||
|
|
c30ab0f4a8 | ||
|
|
e78fd0f721 | ||
|
|
2fd52989f7 | ||
|
|
d238a7bcc8 | ||
|
|
1d70267450 | ||
|
|
df8ccb6350 | ||
|
|
096370d349 | ||
|
|
a164c647ac | ||
|
|
925edb828d | ||
|
|
c3fc3c5e7a | ||
|
|
29cff26f32 | ||
|
|
76c5e60d54 | ||
|
|
af4ac77d9d | ||
|
|
b5c29850e3 | ||
|
|
065c7e779a | ||
|
|
9b300d0b1f | ||
|
|
f2cc2762bb | ||
|
|
05e782ddd3 | ||
|
|
bd018b1bab | ||
|
|
dd19c69904 | ||
|
|
63ec273245 | ||
|
|
82d5e59ea2 | ||
|
|
79e898ac0e | ||
|
|
65225df2dc | ||
|
|
53cfb7e231 | ||
|
|
704d2a6c43 | ||
|
|
39573f7130 | ||
|
|
18d5064c47 | ||
|
|
9ba0daf4ba | ||
|
|
93a8e2e64b | ||
|
|
306f4fe480 | ||
|
|
22332fd26f | ||
|
|
ac21e93a3f | ||
|
|
4bbdd788e0 | ||
|
|
30f64c3aa2 | ||
|
|
8526067336 | ||
|
|
e57d54b456 | ||
|
|
201dc0d5a9 | ||
|
|
ceade5c856 |
No files matched your search
+2
-1
@@ -1,4 +1,5 @@
|
||||
busybox
|
||||
busybox.links
|
||||
_install
|
||||
loop.h
|
||||
.config
|
||||
.menuconfig.log
|
||||
@@ -8,7 +8,7 @@ incorect, _please_ let me know.
|
||||
|
||||
-----------
|
||||
|
||||
Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
Erik Andersen <andersen@codepoet.org>, <andersee@debian.org>
|
||||
Tons of new stuff, major rewrite of most of the
|
||||
core apps, tons of new apps as noted in header files.
|
||||
|
||||
@@ -28,27 +28,43 @@ Dave Cinege <dcinege@psychosis.com>
|
||||
more(v2), makedevs, dutmp, modularization, auto links file,
|
||||
various fixes, Linux Router Project maintenance
|
||||
|
||||
Magnus Damm <damm@opensource.se>
|
||||
tftp client
|
||||
insmod powerpc support
|
||||
|
||||
Larry Doolittle <ldoolitt@recycle.lbl.gov>
|
||||
pristine source directory compilation, lots of patches and fixes.
|
||||
|
||||
Gennady Feldman <gfeldman@cachier.com>
|
||||
Sysklogd (single threaded syslogd, IPC Circular buffer support,
|
||||
logread), various fixes.
|
||||
|
||||
Karl M. Hegbloom <karlheg@debian.org>
|
||||
cp_mv.c, the test suite, various fixes to utility.c, &c.
|
||||
|
||||
Daniel Jacobowitz <dan@debian.org>
|
||||
mktemp.c
|
||||
|
||||
Matt Kraai <kraai@alumni.carnegiemellon.edu>
|
||||
documentation, bugfixes
|
||||
Matt Kraai <kraai@alumni.cmu.edu>
|
||||
documentation, bugfixes, test suite
|
||||
|
||||
John Lombardo <john@deltanet.com>
|
||||
dirname, tr
|
||||
|
||||
Glenn McGrath <bug1@netconnect.com.au>
|
||||
ar.c
|
||||
Glenn McGrath <bug1@optushome.com.au>
|
||||
ar, dpkg, dpkg-deb
|
||||
|
||||
Vladimir Oleynik <dzo@simtreas.ru>
|
||||
cmdedit; ports: ash, crond, stty, traceroute, telnetd, top;
|
||||
locale, various fixes
|
||||
and irreconcilable critic of everything not perfect.
|
||||
|
||||
Bruce Perens <bruce@pixar.com>
|
||||
Original author of BusyBox. His code is still in many apps.
|
||||
|
||||
Tim Riker <Tim@Rikers.org>
|
||||
bug fixes, member of fan club
|
||||
|
||||
Kent Robotti <robotti@metconnect.com>
|
||||
reset, tons and tons of bug reports and patchs.
|
||||
|
||||
@@ -73,3 +89,6 @@ Charles P. Wright <cpwright@villagenet.com>
|
||||
Enrique Zanardi <ezanardi@ull.es>
|
||||
tarcat (since removed), loadkmap, various fixes, Debian maintenance
|
||||
|
||||
Emanuele Aina <emanuele.aina@tiscali.it>
|
||||
run-parts
|
||||
|
||||
@@ -1,3 +1,423 @@
|
||||
0.61.pre
|
||||
|
||||
Development Version
|
||||
|
||||
|
||||
|
||||
New Applets:
|
||||
* Erik Andersen -- Merged several applets from tinylogin,
|
||||
namely adduser, addgroup, deluser, delgroup, getty.
|
||||
* Robert Griebl <sandman@handhelds.org>
|
||||
-- reimplemented tinylogin applets: su, login
|
||||
-- added hwclock
|
||||
-- added uncompress
|
||||
|
||||
Other Changes:
|
||||
|
||||
* Vladimir Oleynik, Manuel Novoa III, Aaron Lehmann
|
||||
-- a whole bunch of ash size optimizations
|
||||
-- Fix for ash leading redirections (i.e. '2>/dev/null ls rubbish')
|
||||
* Rodney Brown <RDBrown@mira.net>
|
||||
-- Optimized gzip.c, shrinking it by ~1.5k
|
||||
* Matt Kraai
|
||||
-- Fix sed s/[/]// handling (closes: #1208).
|
||||
-- Fix `-/bin/sh' invocation (closes: #1209).
|
||||
-- Fix ash exec (noted by Arne Bernin).
|
||||
-- Fix tar segfault when include list is empty and exclude list is
|
||||
not.
|
||||
-- Fix sed s/$/@/ handling (noted by Joshua Hudson).
|
||||
-- Fix opt type in dpkg (closes: #118975).
|
||||
* Magick
|
||||
-- made init run inittab command's in the order they show up
|
||||
in the inittab file (FIFO instead of LIFO).
|
||||
* Vladimir Oleynik
|
||||
-- reverse resolve network name and cache in route and ifconfig
|
||||
applets, fix print nslookup server name if compile without
|
||||
uClibc, fix route crashe 'route add', fix warnings compile
|
||||
networking and pwd_grp applets
|
||||
* Tim Riker <Tim@Rikers.org>
|
||||
-- fix and shrink uuencode
|
||||
-- allow tty* in inittab if exist, serial console is not the issue
|
||||
* Robert Griebl <sandman@handhelds.org>
|
||||
-- added suid/sgid handling with 3 modes to busybox:
|
||||
1) completly disabled
|
||||
2) tinylogin like
|
||||
3) runtime configureable via /etc/busybox.conf
|
||||
|
||||
-- modprobe: complete rewrite, supports modules.dep, parses
|
||||
modules.conf for alias and options and can be called
|
||||
from the kernel.
|
||||
-- tar: support for -z when creating archives
|
||||
-- wget: support for -Y|--proxy=on/off and --passive-ftp
|
||||
-- vi: support for ":x"
|
||||
-- date: support for -I (ISO format)
|
||||
-- find: support for -xdev
|
||||
-- mount: support for -t in list mode, parsing of /etc/filesystems
|
||||
-- ash: support for --login (bash like)
|
||||
-- route: support for -e
|
||||
-- netstat: support for -e and -r
|
||||
-- head/tail: support for old style -[0-9] options
|
||||
-- sed: support for ! and \CregexpC
|
||||
-- pidof: support for -s
|
||||
-- nslookup: support for user specified name server
|
||||
|
||||
-- logger: fixed logging of '<' characters
|
||||
-- ash: fixed crash when run in a rxvt window
|
||||
|
||||
-Erik Andersen, --not yet released--
|
||||
|
||||
|
||||
|
||||
0.60.1
|
||||
|
||||
Stable Release
|
||||
|
||||
|
||||
New Applets & New Features:
|
||||
none. :)
|
||||
|
||||
Known Problems (to be fixed in 0.60.2)
|
||||
* msh can segfault on constructs such as
|
||||
for i in `ls *.c` ; do echo $i ; done
|
||||
due to a memory allocation problem. This only seems to cause
|
||||
problems when the backtick expands to be several k in size.
|
||||
|
||||
|
||||
Bugfixes:
|
||||
* Matt Kraai
|
||||
-- Fixed msh to support underscores in variable names.
|
||||
-- Fixed a sed problem with unsatisfied backrefs (the problem was
|
||||
noted by Martin Bene).
|
||||
-- Removed CONFIG_SH define entirely. Now one simply picks the shell
|
||||
or shells they want as CONFIG_<foo> in Config.h
|
||||
-- Fixed head to use ferror(3) to check for errors, not errno.
|
||||
* Shu-Hao Chang <shuhao_chang@trend.com.tw>
|
||||
-- Fixed sed handling of multiple -e commands
|
||||
* Magick <magick@linux-fan.com>
|
||||
-- Fixed an init bug with AskFirst and /dev/null
|
||||
* Jaspreet Singh <jsingh@somanetworks.com>
|
||||
-- Fixed both a segfault and cosmetic bug in route
|
||||
* Erik Andersen
|
||||
-- Made the insmod options CONFIG_FEATURE_NEW_MODULE_INTERFACE and
|
||||
CONFIG_FEATURE_OLD_MODULE_INTERFACE mutually exclusive
|
||||
-- xgetcwd.c now includes sys/param.h to ensure PATH_MAX is defined
|
||||
-- Fixed a potential segfault with lash + CONFIG_FEATURE_CLEAN_UP
|
||||
-- Removed uint64_t from dos2unix, avoiding C lib compat. problems.
|
||||
* Glenn McGrath
|
||||
-- Rewrite of tftp (commands match atftp, accepts -b, can use
|
||||
non-standard ports, and is smaller).
|
||||
-- Fixed unarchive exclude list handling
|
||||
* Manuel Novoa III
|
||||
-- rewrite of simplify_path so it behaves itself (fixing some
|
||||
problems with mount and other applets).
|
||||
-- Fixed ifconfig 'broadcast +' handling and disabled it by default
|
||||
* Matthias ? <matthias@corelatus.com>
|
||||
-- Fixed syslogd to log all messages from a single connection, not
|
||||
just the first.
|
||||
|
||||
|
||||
-Erik Andersen, 23 August 2001
|
||||
|
||||
|
||||
0.60.0
|
||||
|
||||
Note:
|
||||
|
||||
For this release I have bumped the version number to 0.60.0. This
|
||||
reflects the fact that this release is intended to form a new stable
|
||||
BusyBox release series. If you need to rely on a stable version of
|
||||
BusyBox, you should plan on using the stable 0.60.x series. If bugs
|
||||
show up then I will release 0.60.1, then 0.60.2, etc... This is also
|
||||
intended to deal with the fact that the BusyBox build system will be
|
||||
getting a major overhaul for the next release and I don't want that to
|
||||
break products that people are shipping. To avoid that, the new build
|
||||
system will be released as part of a new BusyBox development series
|
||||
that will have some not-yet-decided-on odd version number. Once things
|
||||
stabablize and the new build system is working for everyone, then I
|
||||
will release that as a new stable release series.
|
||||
|
||||
Critical Bugfixes:
|
||||
* Matt Kraai
|
||||
-- Fixed wget output file opening (wget failed in 0.52).
|
||||
-- Fixed a memory leak in syslogd (found by Adam Slattery).
|
||||
* Vladimir Oleynik, Matt Kraai, Erik Andersen
|
||||
-- several nasty bugs in ash and msh. msh could not assign
|
||||
any variables and had debug code still enabled. ash
|
||||
had several compile errors (depending on selected options)
|
||||
and variable assignment problems as well.
|
||||
|
||||
New Applets:
|
||||
* David McCullough <davidm@lineo.com> -- modprobe
|
||||
* Vladimir Oleynik -- traceroute
|
||||
* Erik Andersen -- pidof
|
||||
|
||||
New Scripts:
|
||||
* David Schleef, Erik Andersen, Stuart Hughes -- depmod.pl
|
||||
This is a replacement for the depmod program from the modutils
|
||||
package, but is fully cross platform and is designed to run on
|
||||
your host system (not on the target).
|
||||
|
||||
Other Changes:
|
||||
* Erik Andersen
|
||||
-- fixed busybox.spec so it should now work on redhat systems
|
||||
-- fixed dos2unix and unix2dos so they should work once again
|
||||
-- Adjustments to make busybox more uClinux friendly. Busybox
|
||||
should now work on uClinux systems without needing and source
|
||||
code changes (applets that won't work on uClinux systems are
|
||||
now automagicaly disabled).
|
||||
-- various things (cleanups, libc compatibility work, etc, etc)
|
||||
* Jim Gleason <jimg@lineo.com>
|
||||
-- Fixed for sed, where it failed to preserve whether or not the
|
||||
line was previously altered when running a subst command.
|
||||
* Matt Kraai
|
||||
-- Made tar read 20 512byte blocks at a time (like GNU tar)
|
||||
-- Allow msh.c assignments with the export and readonly commands.
|
||||
-- Added CONFIG_FEATURE_DEVFS to enable devfs device names.
|
||||
-- Better devfs support
|
||||
-- Don't save/restore vi readonly flag if vi is compiled read-only.
|
||||
-- Reworked rdate option handling (is now smaller).
|
||||
-- Size reduction in ping
|
||||
-- Always write dd counts to stderr
|
||||
-- Allow multiple shells to be enabled
|
||||
* Aaron Lehmann
|
||||
-- slimmed down md5sum
|
||||
-- contributed a nice new (hand written, not lex/yacc) Posix math
|
||||
support for ash, which is once again a full posix shell.
|
||||
* Felix von Leitner <leitner@convergence.de> -- patches to make busybox
|
||||
work with dietlibc.
|
||||
* David McCullough
|
||||
-- Adjustments to make busybox more uClinux friendly
|
||||
* Glenn McGrath
|
||||
-- Fixed gzip so when a filename is '-' it will use stdin/stdout
|
||||
-- dpkg rewrite. Should now be compatable with the real dpkg,
|
||||
but needs more testing.
|
||||
-- Updates to archiving tools (gunzip/gzip/cpio/ar/etc)
|
||||
-- Rewrote uuencode, will allow base64 encoding to be used by wget
|
||||
* Vladimir Oleynik
|
||||
-- Fixed tr to support 'tr a-z A-Z' syntax,
|
||||
-- Many ash corrections, optimizations, and cleanups.
|
||||
-- optimizations for traceroute, md5sum, chown, ping
|
||||
-- cmdedit updates and API change
|
||||
-- Namespace cleanup (i.e. adding 'static' private function calls)
|
||||
-- added "stopped jobs" warning to ash on exit
|
||||
* Adam Slattery
|
||||
-- Fixed ping compile problem
|
||||
* Robert J. Osborne <rj@resourceinternational.com>
|
||||
-- fixed a vi bug with delete and escape sequences on empty files.
|
||||
|
||||
|
||||
-Erik Andersen, 31 July 2001
|
||||
|
||||
|
||||
|
||||
0.52
|
||||
|
||||
Critical Bugfixes:
|
||||
* Glenn McGrath -- Fixed gunzip, zcat when reading from stdin
|
||||
* Marc Karasek and Kanoj (kernel serial.c maintainer) -- fixed init
|
||||
problem on serial consoles with 2.4.3+ kernels.
|
||||
|
||||
New Applets:
|
||||
* Laurence Anderson -- rpm2cpio applet, this obsoletes rpmunpack
|
||||
which has now been removed from BusyBox
|
||||
* Laurence Anderson and Glenn McGrath -- cpio applet, currently
|
||||
only supports unpacking the ascii cpio format.
|
||||
* Vladimir Oleynik and Erik Andersen -- added ash, the most correct
|
||||
busybox shell.
|
||||
* Larry Doolittle -- hush, small shell designed specifically
|
||||
for busybox. Quite usable but still a work in progress.
|
||||
* Erik Andersen -- msh, minix shell. A very small but capable shell
|
||||
that only uses vfork, so it can be used on uClinux systems.
|
||||
|
||||
Other Changes:
|
||||
* Sterling Huxley -- Several bugfixes for the vi applet.
|
||||
* Glenn McGrath -- Restructure unarchiving code to make more code
|
||||
common to the ar, cpio, dpkg, dpkg-deb applets.
|
||||
tar applet has not yet been assimilated...
|
||||
* Matt Kraai -- Rewrote cp, dirname, mkdir, mv, and rm.
|
||||
* Paul J.Y. Lahaie <pjlahaie@linuxcare.com> -- Fixed an endian-ness
|
||||
bug in md5sum (in 0.51, md5sum on big endian machines was broken)
|
||||
* Mark Whitley -- rewrote cut, major updates to grep and sed.
|
||||
* Erik Andersen -- bunches of insmod fixes. It should now always
|
||||
work (no more segfault or missing symbols problems).
|
||||
* Bernhard Kuhn <kuhn@lpr.e-technik.tu-muenchen.de> and Jinux Kim
|
||||
added uClinux/m68k insmod support.
|
||||
* Manuel Novoa III -- rewrote make_human_readable so ls, du, and df
|
||||
should work as expected. Eliminated use of floats.
|
||||
* Aaron Lehmann <aaronl@vitelus.com> -- Scrubbed gzip.c
|
||||
* Alan Modra <amodra@bigpond.net.au> -- fixed an hard to spot
|
||||
bug breaking gunzip checksum checking.
|
||||
* Gennady Feldman -- Fixed 'syslog -C'
|
||||
* Gernot Poerner <gp@it-netservice.de> -- Added mount bind support.
|
||||
* Adam Heath <doogie@debian.org> -- wget arbitrary header support
|
||||
* John Beppu -- updated the automagical doc generator
|
||||
* Zillions of other bugfixes, optimizations, and cleanups.
|
||||
|
||||
|
||||
|
||||
-Erik Andersen, 7 July 2001
|
||||
|
||||
|
||||
0.51
|
||||
Critical Bugfixes:
|
||||
* Erik Andersen -- Fixed a bug that could crash the shell in 0.50
|
||||
when pressing <Enter> on an empty line.
|
||||
* Gennady Feldman -- Fixed a bug that could crash the shell in 0.50
|
||||
when performing an 'export' in the shell.
|
||||
* Gennady Feldman -- fixed a syslogd bug where syslogd could cause
|
||||
the init process to block (which can break systems badly).
|
||||
|
||||
New Applets:
|
||||
* Sterling Huxley -- contributed a new vi applet! This is a very
|
||||
functional vi implementation in Only 22k.
|
||||
* Erik Andersen -- added env applet
|
||||
|
||||
Other changes:
|
||||
* Erik Andersen -- Split utility.c into libbb, which provides a
|
||||
much cleaner was for us to include shared functionality.
|
||||
* Erik Andersen -- Reorganized how and when busybox includes
|
||||
syscalls, aiding portability and (in this case) making the
|
||||
busybox work on ia64 systems.
|
||||
* Erik Andersen -- dpkg.c cleanup to use the updated gunzip interface.
|
||||
* Erik Andersen -- Cleanups for libc5, glibc, and uClibc.
|
||||
* Erik Andersen and Matt Kraai -- Cleanups for the human-readable
|
||||
output from ls, du, and df.
|
||||
* Laurence Anderson <laurence@zxmail.com> -- Fixed wget HTTP 1.1
|
||||
support and added chunked encoding so it is now RFC compliant.
|
||||
* John Beppu -- The busybox.pod documentation is now automagically
|
||||
generated from the source code. This makes it _much_ simpler.
|
||||
Now to update the docs, just update the usage message...
|
||||
* Dirk Behme <dirk.behme@de.bosch.com> -- Adjusted MIPS insmod
|
||||
support a bit for Mips RS3.
|
||||
* Christophe Boyanique -- egrep invoked the "init" applet in 0.50!
|
||||
* Larry Doolittle -- Added -Wshadow and fixed a number of shadowed
|
||||
variables
|
||||
* David Douthitt -- fixed 'find -print'
|
||||
* Gennady Feldman -- fixes for the syslogd circular buffer code
|
||||
* Jeff Garzik -- a number of structural cleanups, fixes for -Wshadow
|
||||
bugs, and similar problems.
|
||||
* Matt Kraai -- Added a new 'shutdown' action to busybox init. Now
|
||||
you can specify arbitrary behavior for 'ctrlaltdel' so now
|
||||
pressing CTL-ALT-DEL can do something else (or nothing).
|
||||
* Andreas Neuhaus <andy@fasta.fh-dortmund.de> -- fix for merging
|
||||
kernel command line environment variables into child environment
|
||||
for init.c
|
||||
* Glenn McGrath -- Fixed problems with dpkg and dpkg-deb applets
|
||||
* Glenn McGrath -- Don't try to automount devfs
|
||||
* Vladimir Oleynik -- optimizations for more.c
|
||||
* Vladimir Oleynik -- Added locale support to the shell, and fixed
|
||||
locale support in several other places
|
||||
* Vladimir Oleynik -- moved struct applet from busybox.c to applets.c
|
||||
* Vladimir Oleynik -- A size optimization for rdate
|
||||
* Vladimir Oleynik -- Fixed printf applets's locale handling
|
||||
* Vladimir Oleynik -- More cmdedit updates
|
||||
* Vladimir Oleynik -- Fixed `du' applet so it continues running
|
||||
after permission errors.
|
||||
* Vladimir Oleynik -- Reduced stack usage in recursive_action()
|
||||
* Pierre Peiffer <pierre.peiffer@sxb.bsf.alcatel.fr> -- made
|
||||
find_pid_by_name() cope with swapped out processes.
|
||||
* Jari Ruusu <jari.ruusu@pp.inet.fi> -- updates so that setting
|
||||
D_FILE_OFFSET_BITS=64 now works as expected.
|
||||
* Anthony Towns <aj@azure.humbug.org.au> -- fixed a bug with
|
||||
sed address range handling
|
||||
* Dmitry Zakharov <dmit@crp.bank.gov.ua> -- a number of updates
|
||||
to wget: support for ftp downloads, basic HTTP basic auth, handling
|
||||
of http redirects, when attempting to continue an aborted download
|
||||
but server doesn't support restarts then reopen output file in
|
||||
write mode, bugfix: when content-length not given, wget didn't
|
||||
download anything, if -c is not specified, it no longer default to
|
||||
restarting an aborted download.
|
||||
|
||||
|
||||
-Erik Andersen, 10 April 2001
|
||||
|
||||
|
||||
0.50
|
||||
* Erik Andersen -- added ifconfig interface status reporting
|
||||
* Erik Andersen -- Debian packaging updates
|
||||
* Erik Andersen -- lash environment variable expansion rewritten,
|
||||
with lots of help/fixes/testing from Larry Doolittle.
|
||||
* Erik Andersen -- Fix use of busybox with dmalloc debugging lib
|
||||
* Erik Andersen -- fixed ls behavior for broken or very narrow terminals
|
||||
* Erik Andersen -- stub umount2 and pivot_root if they are not available
|
||||
* Erik Andersen -- libc5 fixes
|
||||
* Erik Andersen -- make init work with devfsd
|
||||
* Erik Andersen -- fixed df for nfs and dos where blksize = 512
|
||||
* Erik Andersen -- Make sure libpwd.a is linked _last_ so it
|
||||
overrides the system pwd/grp
|
||||
* Christophe Boyanique -- added an optional egrep alias for grep.
|
||||
* Christophe Boyanique -- added optional 'rm -i' support.
|
||||
* Kenneth Chalmers and Erik Andersen -- fixed ln so it
|
||||
behaves when given no arguments (prints usage) and when
|
||||
given just one arg (tries to make a link in the cwd).
|
||||
* Magnus Damm -- added a tftp applet
|
||||
* Magnus Damm -- powerpc support for busybox insmod.
|
||||
* David Douthitt -- fixed a build error in df.c when
|
||||
CONFIG_FEATURE_HUMAN_READABLE was disabled
|
||||
* John Beppu -- wrote autodocifier.pl, which will be used to auto-
|
||||
generate the documentation from the source code, making life
|
||||
much simpler for all.
|
||||
* Magnus Damm <damm@opensource.se> -- Fixed an 'inner scope var
|
||||
masking outer scope var with same name' bug that prevented
|
||||
the loopback device from being unmounted if mount() failed.
|
||||
* Larry Doolittle -- rewrote ifconfig to make it smaller
|
||||
* Larry Doolittle and Erik Andersen -- cleanups to pristine source
|
||||
* Larry Doolittle -- many bugfixes resulting from regression testing
|
||||
* Gennady Feldman -- split syslogd.c into syslogd and klogd
|
||||
* Gennady Feldman -- make syslogd single threaded -- no more forking
|
||||
* Jeff Garzik -- getopt-ified rmmod.
|
||||
* Jeff Garzik -- glibc 2.2 warning cleanups
|
||||
* Jeff Garzik -- namespace pollution cleanup (staticified variables).
|
||||
* Erik Gustavsson <cyrano@algonet.se> -- allow env variables set on the
|
||||
kernel command line to be inherited into init and its children.
|
||||
* Erik Habbinga -- fixed an uninitialized substitution delimiter in sed.
|
||||
* Chris Jaeger -- Makefile cleanup to make option setting less error-prone
|
||||
* Chris Jaeger <cjaeger@ensim.com> -- Carefully check NFS_MOUNT_VERSION
|
||||
depending on what kernel is being used.
|
||||
* Quinn Jensen <jensenq@lineo.com> -- MIPS support for busybox insmod.
|
||||
* Evin Robertson -- new pivot_root applet
|
||||
* Kent Robotti -- usage message cleanups
|
||||
* Kent Robotti -- reworked dos2unix/unix2dos
|
||||
* Evin Robertson and Manuel Novoa III -- reworked how usage messages
|
||||
are stored to save several k of space.
|
||||
* Matt Kraai -- Keep trying if an NFS mount fails
|
||||
* Matt Kraai -- fixed insmod so it won't try to insmod directories.
|
||||
* Matt Kraai -- added nc listening support
|
||||
* Matt Kraai and David Douthitt -- reworked fine to support -type,
|
||||
-perm, -mtime, and other improvements.
|
||||
* Matt Kraai -- added find_applet_by_name and saved some memory thereby
|
||||
* Matt Kraai -- added chomp to reduce redundant code elsewhere
|
||||
* Matt Kraai -- Removed trailing \n chars from error_msg{,_and_die} messages.
|
||||
* John Lombardo -- fixed OOM in insmod.
|
||||
* Glenn McGrath -- bypass /proc in mount, now uses sysfs.
|
||||
* Glenn McGrath -- several updates to dpkg and dpkg-deb.
|
||||
* Manuel Novoa III -- several size optimizations: parse_mode,
|
||||
process_escape_sequence, format, and get_kernel_revision.
|
||||
* Manuel Novoa III -- rewrote ifconfig again to make it smaller still
|
||||
* Manuel Novoa III -- added ifconfig -a, updated interface reporting
|
||||
* Vladimir N. Oleynik -- Fixed a bug where init set PATH incorrectly
|
||||
* Vladimir N. Oleynik -- cleanups to route, cmdedit, mkdir,
|
||||
mkfs_minix, mkswap, chmod_chown_chgrp and utility.c
|
||||
* Vladimir N. Oleynik -- many fixes to cmdedit. so tab completion
|
||||
is now working and general editing is much improved, and to
|
||||
improve complex prompt handling.
|
||||
* Vladimir N. Oleynik -- added route status reporting.
|
||||
* Vladimir N. Oleynik -- fixed wget to use xfopen
|
||||
* Vladimir N. Oleynik -- new stty applet
|
||||
* Vladimir N. Oleynik -- fixed find, it used to stop on perm errors.
|
||||
* Vladimir N. Oleynik -- locale forced to posix for scripts
|
||||
* Vladimir N. Oleynik -- saved 128 bytes by moving error checking
|
||||
for several my_* functions into utility.c
|
||||
* Bjorn Wesen -- new ifconfig and route applet (taken from
|
||||
work done by Axis Communications).
|
||||
* Mark Whitley -- Added a 'How to contribute to Busybox' doc
|
||||
and updated the style guide.
|
||||
* Mark Whitley -- implemented grep -A, -B, and -C
|
||||
* Mark Whitley -- overhauled the test suite.
|
||||
|
||||
|
||||
-Erik Andersen, 15 March 2001
|
||||
|
||||
0.49
|
||||
|
||||
* Matt Kraai -- new sort.c
|
||||
@@ -40,7 +460,7 @@
|
||||
* Mark Whitley -- Updates to style guide
|
||||
* Mark Whitley -- Big cleanup in utility.c: style guide compliance,
|
||||
de-macro-ifying some variables and functions
|
||||
* Erik Andersen -- ls now honors BB_FEATURE_AUTOWIDTH so it can find
|
||||
* Erik Andersen -- ls now honors CONFIG_FEATURE_AUTOWIDTH so it can find
|
||||
the width and height of the console.
|
||||
* Erik Andersen -- insmod now ignores -L and accepts the -o option.
|
||||
* Erik Andersen -- updates so you can now select from the Makefile
|
||||
@@ -56,7 +476,7 @@
|
||||
0.48
|
||||
|
||||
* Glenn McGrath -- tar now supports uncompressing tar files,
|
||||
define BB_FEATURE_TAR_GZIP to use the -z option.
|
||||
define CONFIG_FEATURE_TAR_GZIP to use the -z option.
|
||||
* Matt Kraai -- fix all usage of TRUE and FALSE so all apps now
|
||||
return EXIT_SUCCESS or EXIT_FAILURE to the system.
|
||||
Now TRUE and FALSE are set to the C standard where TRUE=1.
|
||||
@@ -88,7 +508,7 @@
|
||||
GNU-date compatible
|
||||
* me -- Progress meter (optional) in wget
|
||||
* Doolittle/me -- programs invoked by full path name take
|
||||
precedence over applets unless BB_FEATURE_SH_BUILTINS_ALWAYS_WIN
|
||||
precedence over applets unless CONFIG_FEATURE_SH_BUILTINS_ALWAYS_WIN
|
||||
* Gaute B Strokkenes <gs234@cam.ac.uk> -- applets found using a
|
||||
binary search instead of linear search. Much faster!
|
||||
* new applets: cmp readlink
|
||||
@@ -221,7 +641,7 @@
|
||||
0.45
|
||||
* Now compiles vs libc5 (which can save lots of space for
|
||||
embedded systems).
|
||||
* Added BB_FEATURE_TRIVIAL_HELP which compiles out most all of the
|
||||
* Added CONFIG_FEATURE_TRIVIAL_HELP which compiles out most all of the
|
||||
help messages (i.e --help). Saves 17k over a full compile.
|
||||
* Added cut and tr from minix, since due to the license change,
|
||||
we can now use minix code. Minix tr saves 4k.
|
||||
@@ -242,7 +662,7 @@
|
||||
* Replaced the telnet implementation with one written by
|
||||
Tomi Ollila <too@iki.fi> It works great and costs 3k.
|
||||
* BusyBox sh (lash) now supports being used as a standalone shell. When
|
||||
BB_FEATURE_SH_STANDALONE_SHELL is defined, all the busybox commands may
|
||||
CONFIG_FEATURE_SH_STANDALONE_SHELL is defined, all the busybox commands may
|
||||
be invoked as shell internals. Best used when compiling staticly
|
||||
(i.e. DOSTATIC=true)
|
||||
* BusyBox sh (lash) internals now behave as expected wrt pipes
|
||||
@@ -294,7 +714,7 @@
|
||||
* Fixed exit status for killall - Pavel Roskin
|
||||
* Fixed 'swapon -a' and 'swapoff -a', which were broken.
|
||||
* Fixed 'mount -a' so it works as expected.
|
||||
* Implemented 'ls -R' (enabled by enabling BB_FEATURE_LS_RECURSIVE)
|
||||
* Implemented 'ls -R' (enabled by enabling CONFIG_FEATURE_LS_RECURSIVE)
|
||||
* Implemented "ping -s", fixed error messages and argument parsing -
|
||||
Pavel Roskin
|
||||
* Syslogd will not go to background if "-n" is given. Better help
|
||||
@@ -332,7 +752,7 @@
|
||||
saving a bunch of memory (kernel /proc support is not thin). This
|
||||
is done by making use of some nice kernel patches I wrote up to
|
||||
support the features that busybox requires and that /proc usually
|
||||
provides. To enable this, turn on BB_FEATURE_USE_DEVPS_PATCH and
|
||||
provides. To enable this, turn on CONFIG_FEATURE_USE_DEVPS_PATCH and
|
||||
patch your kernel with the devps patch in the kernel-patches/
|
||||
directory.
|
||||
* Wrote basename, dirname, killall, and uptime.
|
||||
@@ -377,7 +797,7 @@
|
||||
* An initial telnet implementation was added by
|
||||
Randolph Chung <tausq@debian.org>.
|
||||
* Fixed a bug where "sed 's/foo/bar/g'" (i.e. a script w/o a "-e")
|
||||
* ps now supports BB_FEATURE_AUTOWIDTH, and can adjust its width
|
||||
* ps now supports CONFIG_FEATURE_AUTOWIDTH, and can adjust its width
|
||||
to match the terminal (defaults to width=79 when this is off).
|
||||
* ps now accepts (and ignores) all options except for "--help" (which
|
||||
as would be expected displays help).
|
||||
@@ -400,7 +820,7 @@
|
||||
|
||||
* Fairly massive restructuring of umount.c to deal with remounting
|
||||
busy devices read-only. Adds a -r option to control that; it is
|
||||
optionally compiled in with BB_FEATURE_REMOUNT
|
||||
optionally compiled in with CONFIG_FEATURE_REMOUNT
|
||||
* Added a bunch of functions to mtab.c to interact with the
|
||||
{get,set,end}mntent interface; as it turns out, those functions do
|
||||
not appear to be re-entrant, and that causes a lot of problems with
|
||||
@@ -471,7 +891,7 @@
|
||||
* Created a tiny tail implementation, removing -c, -q, -v, and making
|
||||
tail -f work only with a single file. This reduced tail from 6k to
|
||||
2.4k. The bigger/more featured tail can still be had by disabling
|
||||
BB_FEATURE_SIMPLE_TAIL in busybox.defs.h
|
||||
CONFIG_FEATURE_SIMPLE_TAIL in busybox.defs.h
|
||||
* Ping now falls back to doing the right thing if /etc/protocols
|
||||
turns up missing.
|
||||
* Fixed mount and umount. Previously they could leak loop device
|
||||
@@ -523,14 +943,14 @@
|
||||
devices. Support is toggled by MOUNT_LOOP feature -- Ben Collins
|
||||
<bcollins@debian.org>
|
||||
* Several fixes from Marco Pantaleoni <panta@prosa.it> compile in
|
||||
* fullWrite() not only if BB_TAR is defined, but also
|
||||
if BB_CP or BB_MV are (fullWrite() is referenced by copyFile())
|
||||
* fullWrite() not only if CONFIG_TAR is defined, but also
|
||||
if CONFIG_CP or CONFIG_MV are (fullWrite() is referenced by copyFile())
|
||||
* add some compiler optimizations to further reduce executable size
|
||||
(as a side note, on my machines the largest code is generated
|
||||
by gcc 2.95.2 with -Os ! The smallest by plain gcc 2.7.2.3 with
|
||||
-O2 -m386 ...)
|
||||
* Compile now won't fail if busybox.def.h defines
|
||||
BB_FEATURE_LINUXRC but not BB_INIT. (init_main used to be
|
||||
CONFIG_FEATURE_INITRD but not CONFIG_INIT. (init_main used to be
|
||||
referenced, but not compiled)
|
||||
* Fixed a bug in setting TERM for serial console support. TERM now
|
||||
defaults to "ansi" for serial consoles.
|
||||
@@ -590,7 +1010,7 @@
|
||||
to suit my evil purposes. Costs 6k. I'll make it smaller
|
||||
sometime.
|
||||
* on reboot, init called 'umount -a -n', which caused errors
|
||||
when BB_MTAB was not enabled. Changed to 'umount -a', which does
|
||||
when CONFIG_MTAB was not enabled. Changed to 'umount -a', which does
|
||||
the right thing.
|
||||
* init will now try to run /sbin/getty if it is present (for easy
|
||||
integration with the about-to-be-released tinylogin.)
|
||||
@@ -625,7 +1045,7 @@
|
||||
* I've taken a first step to making busybox not need the /proc
|
||||
filesystem. Most apps don't need it. Those that _require_ it,
|
||||
will complain if you enable them when you disable
|
||||
BB_FEATURE_USE_PROCFS.
|
||||
CONFIG_FEATURE_USE_PROCFS.
|
||||
|
||||
-Erik Andersen, Dec 5, 1999
|
||||
|
||||
@@ -663,7 +1083,7 @@
|
||||
* from
|
||||
Eric Delaunay).
|
||||
* Made createPath be quiet (again thanks to Eric Delaunay). If
|
||||
* BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS is defined, then whatever
|
||||
* CONFIG_CONSOLE_CMD_IF_RC_SCRIPT_EXITS is defined, then whatever
|
||||
command you define it as will be run if the init script exits.
|
||||
* Updated install.sh to make it more robust (thanks to Adam Di Carlo)
|
||||
* NFS support added to mount by Eric Delaunay. It costs 10k when
|
||||
@@ -719,7 +1139,7 @@
|
||||
to Eric Delaunay.
|
||||
* more started to read from stdin after the last file was finished, and
|
||||
options were not parsed correctly (fix thanks to Eric Delaunay).
|
||||
* more will now use the terminal size if BB_FEATURE_AUTOWIDTH is on.
|
||||
* more will now use the terminal size if CONFIG_FEATURE_AUTOWIDTH is on.
|
||||
* rm wouldn't remove a symlink unless the symlink was valid. This was
|
||||
a side effect of the busybox 0.32 recursiveAction() fix. Things
|
||||
should now work correctly.
|
||||
@@ -737,7 +1157,7 @@
|
||||
* Removed some debugging noise from init.c
|
||||
* Fixed ln so it works now (it was very broken).
|
||||
* Fixed df so it won't segfault when there is no /etc/fstab,
|
||||
* If BB_MTAB is not defined, df and mount will whine if /etc/fstab
|
||||
* If CONFIG_MTAB is not defined, df and mount will whine if /etc/fstab
|
||||
is not installed (since they cannot fixup "/dev/root" to
|
||||
state the real root device name)
|
||||
* merged some redundant code from mtab.c/df.c into utility.c
|
||||
@@ -745,9 +1165,8 @@
|
||||
-Erik Andersen, Nov 5, 1999
|
||||
|
||||
0.32
|
||||
* More changes -- many thanks to Lineo for paying me to work on
|
||||
busybox. If you have any problems please let me know ASAP at
|
||||
andersen@lineo.com or andersee@debian.org
|
||||
* More changes -- If you have any problems please let me know ASAP at
|
||||
andersee@debian.org
|
||||
* usage() now prints the BusyBox version. This will help folks
|
||||
realize that they are not in Kansas anymore.
|
||||
* Fixed mkdir -m option so that it works. kill segfaulted w/o any
|
||||
@@ -758,11 +1177,11 @@
|
||||
* with full regular expressions!). Fixed a stupid seg-fault in sync
|
||||
* Fixed mount -- mount -a failed to parse and apply mount options Fixed
|
||||
* umount -n (patch thanks to Matthew Grant <grantma@anathoth.gen.nz>)
|
||||
* umount -a no longer umounts /proc Added BB_MTAB, allowing (at the
|
||||
* umount -a no longer umounts /proc Added CONFIG_MTAB, allowing (at the
|
||||
* cost of ~1.5k and the need for a rw /etc)
|
||||
folks to use a real /etc/mtab file instead of a symlink to
|
||||
/proc/mounts. mount, and umount will add/remove entries and df
|
||||
will now use /etc/mtab if BB_MTAB is defined.
|
||||
will now use /etc/mtab if CONFIG_MTAB is defined.
|
||||
* Fixed a nice bug in recursiveAction() which caused it to infinitely
|
||||
hunt through /proc/../fd/* creating new file descriptors if it
|
||||
followed the /dev/fd link over to /proc. recursiveAction() now
|
||||
@@ -789,10 +1208,9 @@
|
||||
-Erik Andersen, Oct 21, 1999
|
||||
|
||||
0.30
|
||||
Major changes -- lots of stuff rewritten. Many thanks to Lineo for
|
||||
paying me to make these updates. If you have any problems with busybox,
|
||||
or notice any bugs -- please let me know so I can fix it. These
|
||||
changes include:
|
||||
Major changes -- lots of stuff rewritten. If you have any problems
|
||||
with busybox, or notice any bugs -- please let me know so I can fix
|
||||
it. These changes include:
|
||||
|
||||
Core Changes:
|
||||
* busybox can now invoke apps in two ways: via symlinks to the
|
||||
|
||||
@@ -1,384 +0,0 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
// This file defines the feature set to be compiled into busybox.
|
||||
// When you turn things off here, they won't be compiled in at all.
|
||||
//
|
||||
//// This file is parsed by sed. You MUST use single line comments.
|
||||
// i.e. //#define BB_BLAH
|
||||
//
|
||||
//
|
||||
// BusyBox Applications
|
||||
//#define BB_AR
|
||||
#define BB_BASENAME
|
||||
#define BB_CAT
|
||||
#define BB_CHMOD_CHOWN_CHGRP
|
||||
#define BB_CHROOT
|
||||
#define BB_CHVT
|
||||
#define BB_CLEAR
|
||||
//#define BB_CMP
|
||||
#define BB_CP_MV
|
||||
#define BB_CUT
|
||||
#define BB_DATE
|
||||
//#define BB_DC
|
||||
#define BB_DD
|
||||
//#define BB_DEALLOCVT
|
||||
#define BB_DF
|
||||
#define BB_DIRNAME
|
||||
#define BB_DMESG
|
||||
//#define BB_DOS2UNIX
|
||||
//#define BB_DPKG_DEB
|
||||
//#define BB_DUTMP
|
||||
#define BB_DU
|
||||
//#define BB_DUMPKMAP
|
||||
#define BB_ECHO
|
||||
//#define BB_EXPR
|
||||
//#define BB_FBSET
|
||||
//#define BB_FDFLUSH
|
||||
#define BB_FIND
|
||||
#define BB_FREE
|
||||
//#define BB_FREERAMDISK
|
||||
//#define BB_FSCK_MINIX
|
||||
//#define BB_GETOPT
|
||||
#define BB_GREP
|
||||
#define BB_GUNZIP
|
||||
#define BB_GZIP
|
||||
#define BB_HALT
|
||||
#define BB_HEAD
|
||||
//#define BB_HOSTID
|
||||
//#define BB_HOSTNAME
|
||||
#define BB_ID
|
||||
#define BB_INIT
|
||||
//#define BB_INSMOD
|
||||
#define BB_KILL
|
||||
#define BB_KILLALL
|
||||
//#define BB_LENGTH
|
||||
#define BB_LN
|
||||
//#define BB_LOADACM
|
||||
//#define BB_LOADFONT
|
||||
//#define BB_LOADKMAP
|
||||
#define BB_LOGGER
|
||||
//#define BB_LOGNAME
|
||||
#define BB_LS
|
||||
#define BB_LSMOD
|
||||
//#define BB_MAKEDEVS
|
||||
//#define BB_MD5SUM
|
||||
#define BB_MKDIR
|
||||
//#define BB_MKFIFO
|
||||
//#define BB_MKFS_MINIX
|
||||
#define BB_MKNOD
|
||||
#define BB_MKSWAP
|
||||
//#define BB_MKTEMP
|
||||
//#define BB_NC
|
||||
#define BB_MORE
|
||||
#define BB_MOUNT
|
||||
//#define BB_MT
|
||||
//#define BB_NSLOOKUP
|
||||
//#define BB_PING
|
||||
#define BB_POWEROFF
|
||||
//#define BB_PRINTF
|
||||
#define BB_PS
|
||||
#define BB_PWD
|
||||
//#define BB_RDATE
|
||||
//#define BB_READLINK
|
||||
#define BB_REBOOT
|
||||
//#define BB_RENICE
|
||||
#define BB_RESET
|
||||
#define BB_RM
|
||||
#define BB_RMDIR
|
||||
//#define BB_RMMOD
|
||||
//#define BB_RPMUNPACK
|
||||
#define BB_SED
|
||||
//#define BB_SETKEYCODES
|
||||
#define BB_SH
|
||||
#define BB_SLEEP
|
||||
#define BB_SORT
|
||||
#define BB_SWAPONOFF
|
||||
#define BB_SYNC
|
||||
#define BB_SYSLOGD
|
||||
#define BB_TAIL
|
||||
#define BB_TAR
|
||||
//#define BB_TEE
|
||||
//#define BB_TEST
|
||||
//#define BB_TELNET
|
||||
#define BB_TOUCH
|
||||
//#define BB_TR
|
||||
#define BB_TRUE_FALSE
|
||||
#define BB_TTY
|
||||
//#define BB_UUENCODE
|
||||
//#define BB_UUDECODE
|
||||
#define BB_UMOUNT
|
||||
#define BB_UNIQ
|
||||
#define BB_UNAME
|
||||
//#define BB_UNIX2DOS
|
||||
//#define BB_UPDATE
|
||||
#define BB_UPTIME
|
||||
//#define BB_USLEEP
|
||||
//#define BB_WATCHDOG
|
||||
#define BB_WC
|
||||
//#define BB_WGET
|
||||
#define BB_WHICH
|
||||
#define BB_WHOAMI
|
||||
#define BB_XARGS
|
||||
#define BB_YES
|
||||
// End of Applications List
|
||||
//
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------
|
||||
// This is where feature definitions go. Generally speaking,
|
||||
// turning this stuff off makes things a bit smaller (and less
|
||||
// pretty/useful).
|
||||
//
|
||||
//
|
||||
// BusyBox will, by default, malloc space for its buffers. This costs code
|
||||
// size for the call to xmalloc. You can use the following feature to have
|
||||
// them put on the stack. For some very small machines with limited stack
|
||||
// space, this can be deadly. For most folks, this works just fine...
|
||||
//#define BB_FEATURE_BUFFERS_GO_ON_STACK
|
||||
//
|
||||
// Turn this on to use Erik's very cool devps, and devmtab kernel drivers,
|
||||
// thereby eliminating the need for the /proc filesystem and thereby saving
|
||||
// lots and lots memory for more important things. You can not use this and
|
||||
// USE_PROCFS at the same time... NOTE: If you enable this feature, you
|
||||
// _must_ have patched the kernel to include the devps patch that is included
|
||||
// in the busybox/kernel-patches directory. You will also need to create some
|
||||
// device special files in /dev on your embedded system:
|
||||
// mknod /dev/mtab c 10 22
|
||||
// mknod /dev/ps c 10 21
|
||||
// I emailed Linus and this patch will not be going into the stock kernel.
|
||||
//#define BB_FEATURE_USE_DEVPS_PATCH
|
||||
//
|
||||
// enable features that use the /proc filesystem (apps that
|
||||
// break without this will tell you on compile)...
|
||||
// You can't use this and BB_FEATURE_USE_DEVPS_PATCH
|
||||
// at the same time...
|
||||
#define BB_FEATURE_USE_PROCFS
|
||||
//
|
||||
// This compiles out everything but the most
|
||||
// trivial --help usage information (i.e. reduces binary size)
|
||||
//#define BB_FEATURE_TRIVIAL_HELP
|
||||
//
|
||||
// Use termios to manipulate the screen ('more' is prettier with this on)
|
||||
#define BB_FEATURE_USE_TERMIOS
|
||||
//
|
||||
// calculate terminal & column widths (for more and ls)
|
||||
#define BB_FEATURE_AUTOWIDTH
|
||||
//
|
||||
// show username/groupnames (bypasses libc6 NSS) for ls
|
||||
#define BB_FEATURE_LS_USERNAME
|
||||
//
|
||||
// show file timestamps in ls
|
||||
#define BB_FEATURE_LS_TIMESTAMPS
|
||||
//
|
||||
// enable ls -p and -F
|
||||
#define BB_FEATURE_LS_FILETYPES
|
||||
//
|
||||
// sort the file names
|
||||
#define BB_FEATURE_LS_SORTFILES
|
||||
//
|
||||
// enable ls -R
|
||||
#define BB_FEATURE_LS_RECURSIVE
|
||||
//
|
||||
// enable ls -L
|
||||
#define BB_FEATURE_LS_FOLLOWLINKS
|
||||
//
|
||||
// Change ping implementation -- simplified, featureless, but really small.
|
||||
//#define BB_FEATURE_SIMPLE_PING
|
||||
//
|
||||
// Make init use a simplified /etc/inittab file (recommended).
|
||||
#define BB_FEATURE_USE_INITTAB
|
||||
//
|
||||
//Enable init being called as /linuxrc
|
||||
#define BB_FEATURE_LINUXRC
|
||||
//
|
||||
//Have init enable core dumping for child processes (for debugging only)
|
||||
//#define BB_FEATURE_INIT_COREDUMPS
|
||||
//
|
||||
// Allow init to permenently chroot, and umount the old root fs
|
||||
// just like an initrd does. Requires a kernel patch by Werner Almesberger.
|
||||
// ftp://icaftp.epfl.ch/pub/people/almesber/misc/umount-root-*.tar.gz
|
||||
//#define BB_FEATURE_INIT_CHROOT
|
||||
//
|
||||
//Make sure nothing is printed to the console on boot
|
||||
//#define BB_FEATURE_EXTRA_QUIET
|
||||
//
|
||||
//Should syslogd also provide klogd support?
|
||||
#define BB_FEATURE_KLOGD
|
||||
//
|
||||
// enable syslogd -R remotehost
|
||||
#define BB_FEATURE_REMOTE_LOG
|
||||
//
|
||||
//Simple tail implementation (2.34k vs 3k for the full one).
|
||||
//Both provide 'tail -f', but this cuts out -c, -q, -s, and -v.
|
||||
#define BB_FEATURE_SIMPLE_TAIL
|
||||
//
|
||||
// Enable support for loop devices in mount
|
||||
#define BB_FEATURE_MOUNT_LOOP
|
||||
//
|
||||
// Enable support for a real /etc/mtab file instead of /proc/mounts
|
||||
//#define BB_FEATURE_MOUNT_MTAB_SUPPORT
|
||||
//
|
||||
// Enable support for mounting remote NFS volumes.
|
||||
// You may need to mount with "-o nolock" if you are
|
||||
// not running a local portmapper daemon...
|
||||
#define BB_FEATURE_NFSMOUNT
|
||||
//
|
||||
// Enable support forced filesystem unmounting
|
||||
// (i.e. in case of an unreachable NFS system).
|
||||
#define BB_FEATURE_MOUNT_FORCE
|
||||
//
|
||||
// Enable support for creation of tar files.
|
||||
#define BB_FEATURE_TAR_CREATE
|
||||
//
|
||||
// Enable support for "--exclude" and "-X" for excluding files
|
||||
#define BB_FEATURE_TAR_EXCLUDE
|
||||
//
|
||||
// Enable support for tar -z option (currently only works for inflating)
|
||||
#define BB_FEATURE_TAR_GZIP
|
||||
//
|
||||
//// Enable reverse sort
|
||||
#define BB_FEATURE_SORT_REVERSE
|
||||
//
|
||||
// Enable command line editing in the shell.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
#define BB_FEATURE_SH_COMMAND_EDITING
|
||||
//
|
||||
//Allow the shell to invoke all the compiled in BusyBox applets as if they
|
||||
//were shell builtins. Nice for staticly linking an emergency rescue shell,
|
||||
//among other things.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
#define BB_FEATURE_SH_STANDALONE_SHELL
|
||||
//
|
||||
//When this is enabled, busybox shell applets can be called using full path
|
||||
//names. This causes applets (i.e., most busybox commands) to override
|
||||
//real commands on the filesystem. For example, if you run run /bin/cat, it
|
||||
//will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_
|
||||
//busybox. Some systems want this, others do not. Choose wisely. :-) This
|
||||
//only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
//BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
//
|
||||
// Enable tab completion in the shell (not yet
|
||||
// working very well -- so don't turn this on)
|
||||
// Only relevant if BB_SH is enabled.
|
||||
#define BB_FEATURE_SH_TAB_COMPLETION
|
||||
//
|
||||
// Attempts to match usernames in a ~-prefixed path
|
||||
// XXX: Doesn't work without NSS, off by default
|
||||
//#define BB_FEATURE_USERNAME_COMPLETION /* require NSS */
|
||||
//
|
||||
//Turn on extra fbset options
|
||||
//#define BB_FEATURE_FBSET_FANCY
|
||||
//
|
||||
//Turn on fbset readmode support
|
||||
//#define BB_FEATURE_FBSET_READMODE
|
||||
//
|
||||
// Support insmod/lsmod/rmmod for post 2.1 kernels
|
||||
//#define BB_FEATURE_NEW_MODULE_INTERFACE
|
||||
//
|
||||
// Support insmod/lsmod/rmmod for pre 2.1 kernels
|
||||
//#define BB_FEATURE_OLD_MODULE_INTERFACE
|
||||
//
|
||||
// Support module version checking
|
||||
//#define BB_FEATURE_INSMOD_VERSION_CHECKING
|
||||
//
|
||||
// Support for Minix filesystem, version 2
|
||||
//#define BB_FEATURE_MINIX2
|
||||
//
|
||||
//
|
||||
// Enable busybox --install [-s]
|
||||
// to create links (or symlinks) for all the commands that are
|
||||
// compiled into the binary. (needs /proc filesystem)
|
||||
// #define BB_FEATURE_INSTALLER
|
||||
//
|
||||
// Enable a nifty progress meter in wget (adds just under 2k)
|
||||
#define BB_FEATURE_WGET_STATUSBAR
|
||||
//
|
||||
// Clean up all memory before exiting -- usually not needed
|
||||
// as the OS can clean up... Don't enable this unless you
|
||||
// have a really good reason for cleaning things up manually.
|
||||
//#define BB_FEATURE_CLEAN_UP
|
||||
//
|
||||
// Support for human readable output by ls, du, etc.(example 13k, 23M, 235G)
|
||||
#define BB_FEATURE_HUMAN_READABLE
|
||||
//
|
||||
// End of Features List
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------
|
||||
// Nothing beyond this point should ever be touched by
|
||||
// mere mortals so leave this stuff alone.
|
||||
//
|
||||
#if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF
|
||||
#ifdef BB_FEATURE_MOUNT_MTAB_SUPPORT
|
||||
#define BB_MTAB
|
||||
#endif
|
||||
#else
|
||||
#undef BB_MTAB
|
||||
#endif
|
||||
//
|
||||
#if defined BB_FEATURE_SH_COMMAND_EDITING && defined BB_SH
|
||||
#define BB_CMDEDIT
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_KILLALL
|
||||
#ifndef BB_KILL
|
||||
#define BB_KILL
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#ifndef BB_INIT
|
||||
#undef BB_LINUXRC
|
||||
#undef BB_FEATURE_LINUXRC
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_GZIP
|
||||
#ifndef BB_GUNZIP
|
||||
#define BB_GUNZIP
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_DPKG_DEB
|
||||
#ifndef BB_AR
|
||||
#define BB_AR
|
||||
#endif
|
||||
#ifndef BB_TAR
|
||||
#define BB_TAR
|
||||
#endif
|
||||
#ifndef BB_FEATURE_TAR_GZIP
|
||||
#define BB_FEATURE_TAR_GZIP
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_TAR
|
||||
#ifdef BB_FEATURE_TAR_GZIP
|
||||
#ifndef BB_GUNZIP
|
||||
#define BB_GUNZIP
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#if defined BB_MOUNT && defined BB_FEATURE_NFSMOUNT
|
||||
#define BB_NFSMOUNT
|
||||
#endif
|
||||
//
|
||||
#if defined BB_FEATURE_SH_COMMAND_EDITING
|
||||
#ifndef BB_FEATURE_USE_TERMIOS
|
||||
#define BB_FEATURE_USE_TERMIOS
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#if defined BB_FEATURE_AUTOWIDTH
|
||||
#ifndef BB_FEATURE_USE_TERMIOS
|
||||
#define BB_FEATURE_USE_TERMIOS
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#if defined BB_INSMOD || defined BB_LSMOD
|
||||
#ifndef BB_FEATURE_NEW_MODULE_INTERFACE
|
||||
#define BB_FEATURE_NEW_MODULE_INTERFACE
|
||||
#endif
|
||||
#endif
|
||||
-323
@@ -1,323 +0,0 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
|
||||
// NOTE: This file only defines features usefull under the Hurd,
|
||||
// To compile for the Hurd raname this to Config.h prior to make
|
||||
|
||||
// This file defines the feature set to be compiled into busybox.
|
||||
// When you turn things off here, they won't be compiled in at all.
|
||||
//
|
||||
//// This file is parsed by sed. You MUST use single line comments.
|
||||
// i.e. //#define BB_BLAH
|
||||
//
|
||||
//
|
||||
// BusyBox Applications
|
||||
#define BB_AR
|
||||
#define BB_BASENAME
|
||||
#define BB_CAT
|
||||
#define BB_CHMOD_CHOWN_CHGRP
|
||||
#define BB_CHROOT
|
||||
//#define BB_CHVT /* not needed */
|
||||
#define BB_CLEAR
|
||||
#define BB_CP_MV
|
||||
#define BB_CUT
|
||||
#define BB_DATE
|
||||
#define BB_DC
|
||||
#define BB_DD
|
||||
//#define BB_DEALLOCVT /* inot needed */
|
||||
//#define BB_DF /* different implementation */
|
||||
#define BB_DIRNAME
|
||||
//#define BB_DMESG /* doesnt compile, different implementation */
|
||||
#define BB_DUTMP
|
||||
#define BB_DU
|
||||
//#define BB_DUMPKMAP /* not needed */
|
||||
#define BB_ECHO
|
||||
#define BB_EXPR
|
||||
//#define BB_FBSET /* not needed, doesnt compile */
|
||||
//#define BB_FDFLUSH /* is this needed? */
|
||||
#define BB_FIND
|
||||
//#define BB_FREE /* doesnt compile */
|
||||
#define BB_FREERAMDISK /* does hurd support ramdisks ? */
|
||||
#define BB_FSCK_MINIX
|
||||
#define BB_GETOPT
|
||||
#define BB_GREP
|
||||
#define BB_GUNZIP
|
||||
#define BB_GZIP
|
||||
#define BB_HALT
|
||||
#define BB_HEAD
|
||||
#define BB_HOSTID
|
||||
#define BB_HOSTNAME
|
||||
#define BB_ID
|
||||
//#define BB_INIT /* not needed?, doesnt compile */
|
||||
//#define BB_INSMOD /* not needed, doesnt compile */
|
||||
#define BB_KILL
|
||||
#define BB_KILLALL
|
||||
#define BB_LENGTH
|
||||
#define BB_LN
|
||||
//#define BB_LOADACM /* not needed, doesnt compile */
|
||||
//#define BB_LOADFONT /* not needed, doesnt compile */
|
||||
//#define BB_LOADKMAP /* not needed */
|
||||
#define BB_LOGGER
|
||||
#define BB_LOGNAME
|
||||
#define BB_LS
|
||||
//#define BB_LSMOD /* not needed, doesnt compile */
|
||||
//#define BB_MAKEDEVS /* different implementation */
|
||||
#define BB_MD5SUM
|
||||
#define BB_MKDIR
|
||||
#define BB_MKFIFO
|
||||
#define BB_MKFS_MINIX
|
||||
#define BB_MKNOD
|
||||
//#define BB_MKSWAP /* different impelementation (i think) */
|
||||
#define BB_MKTEMP
|
||||
#define BB_NC
|
||||
#define BB_MORE
|
||||
//#define BB_MOUNT /* different implementation */
|
||||
#define BB_MT
|
||||
#define BB_NSLOOKUP
|
||||
//#define BB_PING /* doesnt compile, Hurd uses BSD style ip.h */
|
||||
//#define BB_POWEROFF /* different implementation i assume */
|
||||
#define BB_PRINTF
|
||||
//#define BB_PS /* needs /proc */
|
||||
#define BB_PWD
|
||||
#define BB_RDATE
|
||||
//#define BB_REBOOT /* different implementation */
|
||||
#define BB_RENICE
|
||||
#define BB_RESET
|
||||
#define BB_RM
|
||||
#define BB_RMDIR
|
||||
//#define BB_RMMOD /* not needed, doesnt compile */
|
||||
#define BB_SED
|
||||
//#define BB_SETKEYCODES /* is this needed ? */
|
||||
#define BB_SH
|
||||
#define BB_SLEEP
|
||||
#define BB_SORT
|
||||
//#define BB_SWAPONOFF /* different implementation, doesnt compile */
|
||||
#define BB_SYNC
|
||||
//#define BB_SYSLOGD /* doesnt compile */
|
||||
#define BB_TAIL
|
||||
#define BB_TAR
|
||||
#define BB_TEE
|
||||
#define BB_TEST
|
||||
#define BB_TELNET
|
||||
#define BB_TOUCH
|
||||
#define BB_TR
|
||||
#define BB_TRUE_FALSE
|
||||
#define BB_TTY
|
||||
//#define BB_UPTIME /* doesnt compile */
|
||||
#define BB_USLEEP
|
||||
#define BB_WC
|
||||
#define BB_WGET
|
||||
#define BB_WHICH
|
||||
#define BB_WHOAMI
|
||||
#define BB_UUENCODE
|
||||
#define BB_UUDECODE
|
||||
//#define BB_UMOUNT /* different implementation */
|
||||
#define BB_UNIQ
|
||||
//#define BB_UNAME /* doesnt compile */
|
||||
//#define BB_UPDATE /* doesnt compile */
|
||||
#define BB_YES
|
||||
// End of Applications List
|
||||
//
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------
|
||||
// This is where feature definitions go. Generally speaking,
|
||||
// turning this stuff off makes things a bit smaller (and less
|
||||
// pretty/useful).
|
||||
//
|
||||
//
|
||||
//
|
||||
// Turn this on to use Erik's very cool devps and devmtab kernel drivers,
|
||||
// thereby eliminating the need for the /proc filesystem and thereby saving
|
||||
// lots and lots memory for more important things. You can not use this and
|
||||
// USE_PROCFS at the same time... NOTE: If you enable this feature, you
|
||||
// _must_ have patched the kernel to include the devps patch that is included
|
||||
// in the busybox/kernel-patches directory. You will also need to create some
|
||||
// device special files in /dev on your embedded system:
|
||||
// mknod /dev/mtab c 10 22
|
||||
// mknod /dev/ps c 10 21
|
||||
// I emailed Linus and this patch will not be going into the stock kernel.
|
||||
//#define BB_FEATURE_USE_DEVPS_PATCH
|
||||
//
|
||||
// enable features that use the /proc filesystem (apps that
|
||||
// break without this will tell you on compile)...
|
||||
// You can't use this and BB_FEATURE_USE_DEVPS_PATCH
|
||||
// at the same time...
|
||||
#define BB_FEATURE_USE_PROCFS
|
||||
//
|
||||
// This compiles out everything but the most
|
||||
// trivial --help usage information (i.e. reduces binary size)
|
||||
//#define BB_FEATURE_TRIVIAL_HELP
|
||||
//
|
||||
// Use termios to manipulate the screen ('more' is prettier with this on)
|
||||
#define BB_FEATURE_USE_TERMIOS
|
||||
//
|
||||
// calculate terminal & column widths (for more and ls)
|
||||
#define BB_FEATURE_AUTOWIDTH
|
||||
//
|
||||
// show username/groupnames (bypasses libc6 NSS) for ls
|
||||
#define BB_FEATURE_LS_USERNAME
|
||||
//
|
||||
// show file timestamps in ls
|
||||
#define BB_FEATURE_LS_TIMESTAMPS
|
||||
//
|
||||
// enable ls -p and -F
|
||||
#define BB_FEATURE_LS_FILETYPES
|
||||
//
|
||||
// sort the file names (still a bit buggy)
|
||||
#define BB_FEATURE_LS_SORTFILES
|
||||
//
|
||||
// enable ls -R
|
||||
#define BB_FEATURE_LS_RECURSIVE
|
||||
//
|
||||
// Change ping implementation -- simplified, featureless, but really small.
|
||||
#define BB_FEATURE_SIMPLE_PING
|
||||
//
|
||||
// Make init use a simplified /etc/inittab file (recommended).
|
||||
#define BB_FEATURE_USE_INITTAB
|
||||
//
|
||||
//Enable init being called as /linuxrc
|
||||
//#define BB_FEATURE_LINUXRC
|
||||
//
|
||||
//Have init enable core dumping for child processes (for debugging only)
|
||||
//#define BB_FEATURE_INIT_COREDUMPS
|
||||
//
|
||||
// Allow init to permenently chroot, and umount the old root fs
|
||||
// just like an initrd does. Requires a kernel patch by Werner Almesberger.
|
||||
// ftp://icaftp.epfl.ch/pub/people/almesber/misc/umount-root-*.tar.gz
|
||||
//#define BB_FEATURE_INIT_CHROOT
|
||||
//
|
||||
//Make sure nothing is printed to the console on boot
|
||||
#define BB_FEATURE_EXTRA_QUIET
|
||||
//
|
||||
//Should syslogd also provide klogd support?
|
||||
#define BB_FEATURE_KLOGD
|
||||
//
|
||||
// enable syslogd -R remotehost
|
||||
#define BB_FEATURE_REMOTE_LOG
|
||||
//
|
||||
//Simple tail implementation (2.34k vs 3k for the full one).
|
||||
//Both provide 'tail -f' support (only one file at a time.)
|
||||
#define BB_FEATURE_SIMPLE_TAIL
|
||||
//
|
||||
// Enable support for loop devices in mount
|
||||
//#define BB_FEATURE_MOUNT_LOOP
|
||||
//
|
||||
// Enable support for a real /etc/mtab file instead of /proc/mounts
|
||||
//#define BB_FEATURE_MOUNT_MTAB_SUPPORT
|
||||
//
|
||||
// Enable support for mounting remote NFS volumes
|
||||
//#define BB_FEATURE_NFSMOUNT
|
||||
//
|
||||
// Enable support forced filesystem unmounting
|
||||
// (i.e. in case of an unreachable NFS system).
|
||||
#define BB_FEATURE_MOUNT_FORCE
|
||||
//
|
||||
// Enable support for creation of tar files.
|
||||
#define BB_FEATURE_TAR_CREATE
|
||||
//
|
||||
// Enable support for "--exclude" for excluding files
|
||||
#define BB_FEATURE_TAR_EXCLUDE
|
||||
//
|
||||
//// Enable reverse sort
|
||||
#define BB_FEATURE_SORT_REVERSE
|
||||
//
|
||||
// Enable command line editing in the shell
|
||||
#define BB_FEATURE_SH_COMMAND_EDITING
|
||||
//
|
||||
//Allow the shell to invoke all the compiled in BusyBox commands as if they
|
||||
//were shell builtins. Nice for staticly linking an emergency rescue shell
|
||||
//among other thing.
|
||||
#define BB_FEATURE_SH_STANDALONE_SHELL
|
||||
//
|
||||
// Enable tab completion in the shell (not yet
|
||||
// working very well -- so don't turn this on)
|
||||
//#define BB_FEATURE_SH_TAB_COMPLETION
|
||||
//
|
||||
//Turn on extra fbset options
|
||||
//#define BB_FEATURE_FBSET_FANCY
|
||||
//
|
||||
//Turn on fbset readmode support
|
||||
//#define BB_FEATURE_FBSET_READMODE
|
||||
//
|
||||
// You must enable one or both of these features
|
||||
// Support installing modules from pre 2.1 kernels
|
||||
//#define BB_FEATURE_INSMOD_OLD_KERNEL
|
||||
// Support installing modules from kernel versions after 2.1.18
|
||||
#define BB_FEATURE_INSMOD_NEW_KERNEL
|
||||
//
|
||||
// Support module version checking
|
||||
//#define BB_FEATURE_INSMOD_VERSION_CHECKING
|
||||
//
|
||||
// Support for Minix filesystem, version 2
|
||||
//#define BB_FEATURE_MINIX2
|
||||
//
|
||||
//
|
||||
// Enable busybox --install [-s]
|
||||
// to create links (or symlinks) for all the commands that are
|
||||
// compiled into the binary. (needs /proc filesystem)
|
||||
// #define BB_FEATURE_INSTALLER
|
||||
//
|
||||
// Clean up all memory before exiting -- usually not needed
|
||||
// as the OS can clean up... Don't enable this unless you
|
||||
// have a really good reason for cleaning things up manually.
|
||||
//#define BB_FEATURE_CLEAN_UP
|
||||
//
|
||||
// End of Features List
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------
|
||||
// Nothing beyond this point should ever be touched by
|
||||
// mere mortals so leave this stuff alone.
|
||||
//
|
||||
#ifdef BB_FEATURE_MOUNT_MTAB_SUPPORT
|
||||
#define BB_MTAB
|
||||
#endif
|
||||
//
|
||||
#if defined BB_FEATURE_SH_COMMAND_EDITING && defined BB_SH
|
||||
#define BB_CMDEDIT
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_KILLALL
|
||||
#ifndef BB_KILL
|
||||
#define BB_KILL
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_FEATURE_LINUXRC
|
||||
#ifndef BB_INIT
|
||||
#define BB_INIT
|
||||
#endif
|
||||
#define BB_LINUXRC
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_GZIP
|
||||
#ifndef BB_GUNZIP
|
||||
#define BB_GUNZIP
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#if defined BB_MOUNT && defined BB_FEATURE_NFSMOUNT
|
||||
#define BB_NFSMOUNT
|
||||
#endif
|
||||
//
|
||||
#if defined BB_FEATURE_SH_COMMAND_EDITING
|
||||
#ifndef BB_FEATURE_USE_TERMIOS
|
||||
#define BB_FEATURE_USE_TERMIOS
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#if defined BB_FEATURE_AUTOWIDTH
|
||||
#ifndef BB_FEATURE_USE_TERMIOS
|
||||
#define BB_FEATURE_USE_TERMIOS
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#if defined BB_INSMOD
|
||||
#ifndef BB_FEATURE_INSMOD_OLD_KERNEL
|
||||
#define BB_FEATURE_INSMOD_NEW_KERNEL
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
1) Run 'make config' or 'make menuconfig' and select the
|
||||
functionality that you wish to enable.
|
||||
|
||||
2) make dep
|
||||
|
||||
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)
|
||||
|
||||
4) make
|
||||
|
||||
5) Run 'make install' or 'make PREFIX=/target install' to
|
||||
install busybox and all the needed links.
|
||||
@@ -17,15 +17,14 @@ Copyright 1998 Dave Cinege <dcinege@psychosis.com>
|
||||
mini-gzip(gzip), mini-netcat(mnc)
|
||||
Copyright 1998 Charles P. Wright <cpwright@villagenet.com>
|
||||
|
||||
Tons of new stuff as noted in header files
|
||||
Copyright (C) 1999,2000,2001 by Lineo, inc. and written by
|
||||
Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
|
||||
Tons of new stuff as noted in header files
|
||||
Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
|
||||
Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
|
||||
|
||||
|
||||
Please feed suggestions, bug reports, insults, and bribes back to:
|
||||
Erik Andersen
|
||||
<andersen@lineo.com>
|
||||
<andersen@codepoet.org>
|
||||
<andersee@debian.org>
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# Copyright (C) 1999,2000,2001 Erik Andersen <andersee@debian.org>
|
||||
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -17,194 +17,85 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
PROG := busybox
|
||||
VERSION := 0.49
|
||||
BUILDTIME := $(shell TZ=UTC date --utc "+%Y.%m.%d-%H:%M%z")
|
||||
export VERSION
|
||||
TOPDIR:= $(shell /bin/pwd)/
|
||||
include $(TOPDIR).config
|
||||
include $(TOPDIR)Rules.mak
|
||||
SUBDIRS:=applets archival archival/libunarchive console-tools \
|
||||
editors fileutils findutils init miscutils modutils networking \
|
||||
networking/udhcp procps loginutils shell shellutils sysklogd \
|
||||
textutils util-linux libbb libpwdgrp
|
||||
|
||||
# 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
|
||||
all: do-it-all
|
||||
|
||||
# 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 =
|
||||
|
||||
# If you want a static binary, turn this on.
|
||||
DOSTATIC = false
|
||||
|
||||
# Set the following to `true' to make a debuggable build.
|
||||
# Leave this set to `false' for production use.
|
||||
# eg: `make DODEBUG=true tests'
|
||||
# Do not enable this for production builds...
|
||||
DODEBUG = false
|
||||
|
||||
# Setting this to `true' will cause busybox to directly use the system's
|
||||
# password and group functions. Assuming you use GNU libc, when this is
|
||||
# `true', you will need to install the /etc/nsswitch.conf configuration file
|
||||
# and the required libnss_* libraries. This generally makes your embedded
|
||||
# system quite a bit larger... If you leave this off, busybox will directly
|
||||
# use the /etc/password, /etc/group files (and your system will be smaller, and
|
||||
# I will get fewer emails asking about how glibc NSS works). Enabling this adds
|
||||
# just 1.4k to the binary size (which is a _lot_ less then glibc NSS costs),
|
||||
# Most people will want to leave this set to false.
|
||||
USE_SYSTEM_PWD_GRP = false
|
||||
|
||||
# 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 first set up your environment.
|
||||
# eg: `export DMALLOC_OPTIONS=debug=0x14f47d83,inter=100,log=logfile`
|
||||
# Do not enable this for production builds...
|
||||
DODMALLOC = false
|
||||
|
||||
# If you want large file summit support, turn this on.
|
||||
# This has no effect if you don't have a kernel with lfs
|
||||
# support, and a system with libc-2.1.3 or later.
|
||||
# Some of the programs that can benefit from lfs support
|
||||
# are dd, gzip, mount, tar, and mkfs_minix.
|
||||
# LFS allows you to use the above programs for files
|
||||
# larger than 2GB!
|
||||
DOLFS = false
|
||||
|
||||
# If you have a "pristine" source directory, point BB_SRC_DIR to it.
|
||||
# Experimental and incomplete; tell the mailing list
|
||||
# <busybox@opensource.lineo.com> if you do or don't like it so far.
|
||||
BB_SRC_DIR = .
|
||||
|
||||
# If you are running a cross compiler, you may want to set this
|
||||
# to something more interesting, like "powerpc-linux-".
|
||||
CROSS =
|
||||
CC = $(CROSS)gcc
|
||||
STRIPTOOL = $(CROSS)strip
|
||||
|
||||
# To compile vs uClibc, just use the compiler wrapper built by uClibc...
|
||||
# Isn't that easy? Right now, uClibc needs BB_FEATURE_NFSMOUNT disabled
|
||||
# since uClibc's nfs support isn't ready yet.
|
||||
#CC = ../uClibc/extra/gcc-uClibc/gcc-uClibc-i386
|
||||
|
||||
# To compile vs some other alternative libc, you may need to use/adjust
|
||||
# the following lines to meet your needs...
|
||||
#LIBCDIR=/usr/i486-linuxlibc1/
|
||||
#LDFLAGS+=-nostdlib
|
||||
#LIBRARIES = $(LIBCDIR)/libc.a -lgcc
|
||||
#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
|
||||
#GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
|
||||
|
||||
#--------------------------------------------------------
|
||||
|
||||
# use '-Os' optimization if available, else use -O2
|
||||
OPTIMIZATION = $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
|
||||
then echo "-Os"; else echo "-O2" ; fi)
|
||||
|
||||
WARNINGS = -Wall
|
||||
|
||||
ifeq ($(DOLFS),true)
|
||||
# For large file summit support
|
||||
CFLAGS+=-D_FILE_OFFSET_BITS=64
|
||||
endif
|
||||
ifeq ($(DODMALLOC),true)
|
||||
# For testing mem leaks with dmalloc
|
||||
CFLAGS+=-DDMALLOC
|
||||
LIBRARIES = -ldmalloc
|
||||
# Force debug=true, since this is useless when not debugging...
|
||||
DODEBUG = true
|
||||
endif
|
||||
ifeq ($(DODEBUG),true)
|
||||
CFLAGS += $(WARNINGS) -g -D_GNU_SOURCE
|
||||
LDFLAGS += -Wl,-warn-common
|
||||
STRIP =
|
||||
else
|
||||
CFLAGS += $(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE
|
||||
LDFLAGS += -s -Wl,-warn-common
|
||||
STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
|
||||
endif
|
||||
ifeq ($(DOSTATIC),true)
|
||||
LDFLAGS += --static
|
||||
#
|
||||
#use '-ffunction-sections -fdata-sections' and '--gc-sections' (if they
|
||||
# work) to try and strip out any unused junk. Doesn't do much for me,
|
||||
# but you may want to give it a shot...
|
||||
#
|
||||
#ifeq ($(shell $(CC) -ffunction-sections -fdata-sections -S \
|
||||
# -o /dev/null -xc /dev/null 2>/dev/null && $(LD) \
|
||||
# --gc-sections -v >/dev/null && echo 1),1)
|
||||
# CFLAGS += -ffunction-sections -fdata-sections
|
||||
# LDFLAGS += --gc-sections
|
||||
#endif
|
||||
endif
|
||||
|
||||
ifndef $(PREFIX)
|
||||
PREFIX = `pwd`/_install
|
||||
endif
|
||||
|
||||
# Additional complications due to support for pristine source dir.
|
||||
# Config.h 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>.
|
||||
# If it gets in your way, set DISABLE_VPATH=yes
|
||||
ifeq ($(DISABLE_VPATH),yes)
|
||||
CONFIG_H = Config.h
|
||||
# Make "config" the default target if there is no configuration file or
|
||||
# "depend" the target if there is no top-level dependency information.
|
||||
ifeq (.config,$(wildcard .config))
|
||||
include .config
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
do-it-all: busybox busybox.links #doc
|
||||
include $(patsubst %,%/Makefile.in, $(SUBDIRS))
|
||||
else
|
||||
VPATH = .:$(BB_SRC_DIR)
|
||||
CONFIG_LIST = $(addsuffix /Config.h,$(subst :, ,$(VPATH)))
|
||||
CONFIG_H = $(word 1,$(shell ls -f -1 $(CONFIG_LIST) 2>/dev/null))
|
||||
CFLAGS += -I- $(patsubst %,-I%,$(subst :, ,$(VPATH))) $(CROSS_CFLAGS)
|
||||
CONFIGURATION = depend
|
||||
do-it-all: depend
|
||||
endif
|
||||
|
||||
OBJECTS = $(shell $(BB_SRC_DIR)/busybox.sh $(CONFIG_H) $(BB_SRC_DIR)) busybox.o messages.o usage.o utility.o
|
||||
CFLAGS += -DBB_VER='"$(VERSION)"'
|
||||
CFLAGS += -DBB_BT='"$(BUILDTIME)"'
|
||||
ifdef BB_INIT_SCRIPT
|
||||
CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
|
||||
endif
|
||||
|
||||
ifneq ($(USE_SYSTEM_PWD_GRP),true)
|
||||
PWD_LIB = pwd_grp/libpwd.a
|
||||
LIBRARIES += $(PWD_LIB)
|
||||
else
|
||||
CFLAGS += -DUSE_SYSTEM_PWD_GRP
|
||||
CONFIGURATION = menuconfig
|
||||
do-it-all: menuconfig
|
||||
endif
|
||||
|
||||
|
||||
# Put user-supplied flags at the end, where they
|
||||
# have a chance of winning.
|
||||
CFLAGS += $(CFLAGS_EXTRA)
|
||||
busybox: depend $(libraries-y)
|
||||
$(CC) $(LDFLAGS) -o $@ $(libraries-y) $(LIBRARIES)
|
||||
$(STRIPCMD) $@
|
||||
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
busybox.links: applets/busybox.mkll
|
||||
- $(SHELL) $^ >$@
|
||||
|
||||
all: busybox busybox.links doc
|
||||
install: applets/install.sh busybox busybox.links
|
||||
$(SHELL) $< $(PREFIX)
|
||||
|
||||
uninstall: busybox busybox.links
|
||||
for i in `cat busybox.links` ; do rm -f $$PREFIX$$i; done
|
||||
|
||||
install-hardlinks: applets/install.sh busybox busybox.links
|
||||
$(SHELL) $< $(PREFIX) --hardlinks
|
||||
|
||||
|
||||
# Documentation Targets
|
||||
doc: olddoc
|
||||
|
||||
# Old Docs...
|
||||
olddoc: docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
|
||||
olddoc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
|
||||
|
||||
docs/busybox.pod : docs/busybox_header.pod include/usage.h docs/busybox_footer.pod
|
||||
- ( cat docs/busybox_header.pod; \
|
||||
docs/autodocifier.pl include/usage.h; \
|
||||
cat docs/busybox_footer.pod ) > docs/busybox.pod
|
||||
|
||||
docs/BusyBox.txt: docs/busybox.pod
|
||||
@echo
|
||||
@echo BusyBox Documentation
|
||||
@echo
|
||||
-mkdir -p docs
|
||||
-pod2text $(BB_SRC_DIR)/docs/busybox.pod > docs/BusyBox.txt
|
||||
-pod2text $< > $@
|
||||
|
||||
docs/BusyBox.1: docs/busybox.pod
|
||||
- mkdir -p docs
|
||||
- pod2man --center=BusyBox --release="version $(VERSION)" \
|
||||
$(BB_SRC_DIR)/docs/busybox.pod > docs/BusyBox.1
|
||||
$< > $@
|
||||
|
||||
docs/BusyBox.html: docs/busybox.lineo.com/BusyBox.html
|
||||
docs/BusyBox.html: docs/busybox.net/BusyBox.html
|
||||
- mkdir -p docs
|
||||
-@ rm -f docs/BusyBox.html
|
||||
-@ ln -s busybox.lineo.com/BusyBox.html docs/BusyBox.html
|
||||
-@ ln -s busybox.net/BusyBox.html docs/BusyBox.html
|
||||
|
||||
docs/busybox.lineo.com/BusyBox.html: docs/busybox.pod
|
||||
-@ mkdir -p docs/busybox.lineo.com
|
||||
- pod2html --noindex $(BB_SRC_DIR)/docs/busybox.pod > \
|
||||
docs/busybox.lineo.com/BusyBox.html
|
||||
-@ rm -f pod2html*
|
||||
docs/busybox.net/BusyBox.html: docs/busybox.pod
|
||||
-@ mkdir -p docs/busybox.net
|
||||
- pod2html --noindex $< > \
|
||||
docs/busybox.net/BusyBox.html
|
||||
-@ rm -f pod2htm*
|
||||
|
||||
|
||||
# New docs based on DOCBOOK SGML
|
||||
@@ -231,59 +122,114 @@ docs/busybox.pdf: docs/busybox.ps
|
||||
|
||||
docs/busybox/busyboxdocumentation.html: docs/busybox.sgml
|
||||
- mkdir -p docs
|
||||
(cd docs/busybox.lineo.com; sgmltools -b html ../busybox.sgml)
|
||||
(cd docs/busybox.net; sgmltools -b html ../busybox.sgml)
|
||||
|
||||
|
||||
|
||||
busybox: $(PWD_LIB) $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES)
|
||||
$(STRIP)
|
||||
# The nifty new buildsystem stuff
|
||||
$(TOPDIR)scripts/mkdep: scripts/mkdep.c
|
||||
$(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
|
||||
|
||||
$(PWD_LIB):
|
||||
$(MAKE) -eC pwd_grp
|
||||
$(TOPDIR)scripts/split-include: scripts/split-include.c
|
||||
$(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
|
||||
|
||||
busybox.links: Config.h applets.h
|
||||
- $(BB_SRC_DIR)/busybox.mkll $(CONFIG_H) $(BB_SRC_DIR)/applets.h >$@
|
||||
$(TOPDIR).depend: $(TOPDIR)scripts/mkdep
|
||||
rm -f .depend .hdepend;
|
||||
mkdir -p $(TOPDIR)include/config;
|
||||
$(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
|
||||
scripts/mkdep -I $(TOPDIR)include -- \
|
||||
`find $(TOPDIR) -name \*.c -print` >> .depend;
|
||||
scripts/mkdep -I $(TOPDIR)include -- \
|
||||
`find $(TOPDIR) -name \*.h -print` >> .hdepend;
|
||||
$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)" ;
|
||||
@ echo -e "\n\nNow run 'make' to build BusyBox\n\n"
|
||||
|
||||
nfsmount.o cmdedit.o: %.o: %.h
|
||||
$(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile
|
||||
$(CC) $(CFLAGS) -c $*.c -o $*.o
|
||||
depend dep: $(TOPDIR)include/config.h $(TOPDIR).depend
|
||||
|
||||
utility.o: loop.h
|
||||
BB_SHELL := ${shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
||||
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
||||
else echo sh; fi ; fi}
|
||||
|
||||
loop.h: mk_loop_h.sh
|
||||
@ sh $<
|
||||
include/config/MARKER: depend $(TOPDIR)scripts/split-include
|
||||
scripts/split-include include/config.h include/config
|
||||
@ touch include/config/MARKER
|
||||
|
||||
$(TOPDIR)include/config.h:
|
||||
@if [ ! -f $(TOPDIR)include/config.h ] ; then \
|
||||
make oldconfig; \
|
||||
fi;
|
||||
|
||||
$(TOPDIR).config:
|
||||
@if [ ! -f $(TOPDIR).config ] ; then \
|
||||
cp $(TOPDIR)sysdeps/$(TARGET_OS)/defconfig $(TOPDIR).config; \
|
||||
fi;
|
||||
|
||||
menuconfig: $(TOPDIR).config
|
||||
mkdir -p $(TOPDIR)include/config
|
||||
$(MAKE) -C scripts/lxdialog all
|
||||
$(BB_SHELL) scripts/Menuconfig sysdeps/$(TARGET_OS)/config.in
|
||||
|
||||
config: $(TOPDIR).config
|
||||
mkdir -p $(TOPDIR)include/config
|
||||
$(BB_SHELL) scripts/Configure sysdeps/$(TARGET_OS)/config.in
|
||||
|
||||
oldconfig: $(TOPDIR).config
|
||||
mkdir -p $(TOPDIR)include/config
|
||||
$(BB_SHELL) scripts/Configure -d sysdeps/$(TARGET_OS)/config.in
|
||||
|
||||
|
||||
ifdef CONFIGURATION
|
||||
..$(CONFIGURATION):
|
||||
@echo
|
||||
@echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
|
||||
@echo
|
||||
$(MAKE) $(CONFIGURATION)
|
||||
@echo
|
||||
@echo "Successful. Try re-making (ignore the error that follows)"
|
||||
@echo
|
||||
exit 1
|
||||
|
||||
dummy:
|
||||
|
||||
else
|
||||
|
||||
dummy:
|
||||
|
||||
endif
|
||||
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
|
||||
# Testing...
|
||||
test tests:
|
||||
cd tests && $(MAKE) all
|
||||
# old way of doing it
|
||||
#cd tests && $(MAKE) all
|
||||
# new way of doing it
|
||||
cd tests && ./tester.sh
|
||||
|
||||
# Cleanup
|
||||
clean:
|
||||
- cd tests && $(MAKE) clean
|
||||
- cd pwd_grp && $(MAKE) clean
|
||||
- $(MAKE) -C tests clean
|
||||
- $(MAKE) -C scripts/lxdialog clean
|
||||
- rm -f docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
|
||||
docs/busybox.lineo.com/BusyBox.html
|
||||
docs/busybox.net/BusyBox.html
|
||||
- rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
|
||||
docs/busybox.pdf docs/busybox.lineo.com/busybox.html
|
||||
- rm -f Config.h.ORG bb.def.h busybox.REGRESS.sh.results bb.OptionsAndFeatures
|
||||
- rm -rf docs/busybox _install
|
||||
- rm -f busybox.links loop.h *~ *.o core
|
||||
docs/busybox.pdf docs/busybox.pod docs/busybox.net/busybox.html \
|
||||
docs/busybox _install pod2htm* *.gdb *.elf *~ core
|
||||
- rm -f busybox busybox.links libbb/loop.h .config.old .hdepend
|
||||
- rm -f scripts/split-include scripts/mkdep .*config.log
|
||||
- rm -rf include/config include/config.h
|
||||
- find . -name .\*.flags -exec rm -f {} \;
|
||||
- find . -name .depend -exec rm -f {} \;
|
||||
- find . -name \*.o -exec rm -f {} \;
|
||||
- find . -name \*.a -exec rm -f {} \;
|
||||
|
||||
distclean: clean
|
||||
- rm -f busybox
|
||||
- rm -f busybox
|
||||
- cd tests && $(MAKE) distclean
|
||||
|
||||
install: busybox busybox.links
|
||||
$(BB_SRC_DIR)/install.sh $(PREFIX)
|
||||
|
||||
install-hardlinks: busybox busybox.links
|
||||
$(BB_SRC_DIR)/install.sh $(PREFIX) --hardlinks
|
||||
|
||||
debug_pristine:
|
||||
@ echo VPATH=\"$(VPATH)\"
|
||||
@ echo CONFIG_LIST=\"$(CONFIG_LIST)\"
|
||||
@ echo CONFIG_H=\"$(CONFIG_H)\"
|
||||
@ echo OBJECTS=\"$(OBJECTS)\"
|
||||
|
||||
dist release: distclean doc
|
||||
cd ..; \
|
||||
rm -rf busybox-$(VERSION); \
|
||||
@@ -292,20 +238,22 @@ dist release: distclean doc
|
||||
find busybox-$(VERSION)/ -type d \
|
||||
-name CVS \
|
||||
-print \
|
||||
| xargs rm -rf; \
|
||||
\
|
||||
find busybox-$(VERSION)/ -type f \
|
||||
-name .cvsignore \
|
||||
-print \
|
||||
| xargs rm -f; \
|
||||
-exec rm -rf {} \; ; \
|
||||
\
|
||||
find busybox-$(VERSION)/ -type f \
|
||||
-name .\#* \
|
||||
-print \
|
||||
| xargs rm -f; \
|
||||
-exec rm -f {} \; ; \
|
||||
\
|
||||
tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION)/;
|
||||
|
||||
.PHONY: tags
|
||||
|
||||
|
||||
.PHONY: tags check depend
|
||||
|
||||
tags:
|
||||
ctags -R .
|
||||
|
||||
check: busybox
|
||||
cd testsuite && ./runtest
|
||||
|
||||
@@ -11,9 +11,7 @@ the expected functionality and behave very much like their GNU counterparts.
|
||||
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, a kernel, and an editor,
|
||||
such as nano, e3, or elvis-tiny. For a really minimal system, you can even use
|
||||
the busybox shell (not Bourne compatible, but very small and quite usable).
|
||||
systems. To create a working system, just add /dev, /etc, and a kernel.
|
||||
|
||||
BusyBox was originally written to support the Debian Rescue/Install disks, but
|
||||
it also makes an excellent environment for any small or embedded system.
|
||||
@@ -36,12 +34,14 @@ Supported architectures:
|
||||
|
||||
Busybox in general will build on any architecture supported by gcc. It has
|
||||
a few specialized features added for __sparc__ and __alpha__. insmod
|
||||
functionality is currently limited to x86, ARM, and SH3/4.
|
||||
functionality is currently limited to x86, ARM, SH3/4, powerpc, m68k,
|
||||
MIPS, and v850e.
|
||||
|
||||
Supported libcs:
|
||||
|
||||
glibc-2.0.x, glibc-2.1.x, Linux-libc5, uClibc. People are looking at
|
||||
newlib and diet-libc, but consider them unsupported, untested, or worse.
|
||||
glibc-2.0.x, glibc-2.1.x, glibc-2.2.x, Linux-libc5, uClibc. People
|
||||
are looking at newlib and diet-libc, but consider them unsupported,
|
||||
untested, or worse.
|
||||
|
||||
Supported kernels:
|
||||
|
||||
@@ -50,10 +50,40 @@ Supported kernels:
|
||||
|
||||
----------------
|
||||
|
||||
Shells:
|
||||
|
||||
lash is the very smallest shell (adds just 10k) and it is quite usable as
|
||||
a command prompt, but it is not suitable for any but the most trivial
|
||||
scripting (such as an initrd that calls insmod a few times) since it does
|
||||
not understand Bourne shell grammer. It does handle pipes, redirects, and
|
||||
job control though. Adding in command editing makes it a very nice
|
||||
lightweight command prompt.
|
||||
|
||||
hush is also quite small (just 18k) and it has very complete Bourne shell
|
||||
grammer. It handles if/then/else/fi just fine, but doesn't handle loops
|
||||
like for/do/done or case/esac and such. It also currently has a problem
|
||||
with job control. Using hush is not yet recommended.
|
||||
|
||||
msh: The minix shell (adds just 30k) is quite complete and handles things
|
||||
like for/do/done, case/esac and all the things you expect a Bourne shell to
|
||||
do. It is not always pedantically correct about Bourne shell grammer (try
|
||||
running the shell testscript "tests/sh.testcases" on it and compare vs bash)
|
||||
but for most things it works quite well. It also uses only vfork, so it can
|
||||
be used on uClinux systems. This was only recently added, so there is still
|
||||
room to shrink it further...
|
||||
|
||||
ash: This adds about 60k in the default configuration and is the most
|
||||
complete and most pedantically correct shell included with busybox. This
|
||||
shell was also recently added, and several people (mainly Vladimir and Erik)
|
||||
have been working on it. There are a number of configurable things at the
|
||||
top of ash.c as well, so check those out if you want to tweak things.
|
||||
|
||||
----------------
|
||||
|
||||
Getting help:
|
||||
|
||||
When you find you need help, you can check out the BusyBox mailing list
|
||||
archives at http://opensource.lineo.com/lists/busybox/ or even join
|
||||
archives at http://busybox.net/lists/busybox/ or even join
|
||||
the mailing list if you are interested.
|
||||
|
||||
----------------
|
||||
@@ -61,17 +91,17 @@ the mailing list if you are interested.
|
||||
Bugs:
|
||||
|
||||
If you find bugs, please submit a bug report. Full instructions on how to
|
||||
report a bug are found at http://bugs.lineo.com/Reporting.html.
|
||||
report a bug are found at http://bugs.busybox.net/Reporting.html.
|
||||
|
||||
For the impatient: To submit a bug, simply send an email describing the problem
|
||||
to submit@bugs.lineo.com. Bug reports should look something like this:
|
||||
to submit@bugs.busybox.net. Bug reports should look something like this:
|
||||
|
||||
To: submit@bugs.lineo.com
|
||||
To: submit@bugs.busybox.net
|
||||
From: diligent@testing.linux.org
|
||||
Subject: /bin/true doesn't work
|
||||
|
||||
Package: busybox
|
||||
Version: 0.48
|
||||
Version: 0.51
|
||||
|
||||
When I invoke '/bin/true' it doesn't work. I expected it to return
|
||||
a "0" but it returned a "1" instead. Here is the transcript:
|
||||
@@ -93,30 +123,27 @@ understanding.
|
||||
|
||||
FTP:
|
||||
|
||||
Source for the latest released version can always be downloaded from
|
||||
ftp://ftp.lineo.com/pub/busybox.
|
||||
Source for the latest released version, as well as daily snapshots, can always
|
||||
be downloaded from
|
||||
http://busybox.net/downloads/
|
||||
|
||||
----------------
|
||||
|
||||
CVS:
|
||||
|
||||
BusyBox now has its own publicly browsable CVS tree at:
|
||||
http://opensource.lineo.com/cgi-bin/cvsweb/busybox/
|
||||
http://busybox.net/cgi-bin/cvsweb/busybox/
|
||||
|
||||
Anonymous CVS access is available. For instructions, check out:
|
||||
http://opensource.lineo.com/cvs_anon.html
|
||||
http://busybox.net/cvs_anon.html
|
||||
|
||||
For those that are actively contributing there is even CVS write access:
|
||||
http://opensource.lineo.com/cvs_write.html
|
||||
http://busybox.net/cvs_write.html
|
||||
|
||||
----------------
|
||||
|
||||
Please feed suggestions, bug reports, insults, and bribes back to:
|
||||
Erik Andersen
|
||||
<andersen@lineo.com>
|
||||
<andersen@codepoet.org>
|
||||
<andersee@debian.org>
|
||||
|
||||
<blatant plug>
|
||||
Many thanks to go to Lineo for paying me to work on busybox.
|
||||
</blatant plug>
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
# Rules.make for busybox
|
||||
#
|
||||
# Copyright (C) 2002 Erik Andersen <andersee@debian.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
PROG := busybox
|
||||
VERSION := 0.61.pre
|
||||
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
|
||||
HOSTCC := gcc
|
||||
HOSTCFLAGS:= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
|
||||
|
||||
|
||||
# What OS are you compiling busybox for? This allows you to include
|
||||
# OS specific things, syscall overrides, etc.
|
||||
TARGET_OS:=linux
|
||||
|
||||
# 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
|
||||
|
||||
# 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:=#-Werror
|
||||
|
||||
# If you want a static binary, turn this on.
|
||||
DOSTATIC:=false
|
||||
|
||||
# Set the following to `true' to make a debuggable build.
|
||||
# Leave this set to `false' for production use.
|
||||
DODEBUG:=false
|
||||
|
||||
# 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 first set up your environment.
|
||||
# eg: `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
|
||||
# Do not enable this for production builds...
|
||||
DODMALLOC:=false
|
||||
|
||||
# Electric-fence is another very useful malloc debugging library.
|
||||
# Do not enable this for production builds...
|
||||
DOEFENCE:=false
|
||||
|
||||
# If you want large file summit support, turn this on.
|
||||
# This has no effect if you don't have a kernel with lfs
|
||||
# support, and a system with libc-2.1.3 or later.
|
||||
# Some of the programs that can benefit from lfs support
|
||||
# are dd, gzip, mount, tar, and mkfs_minix.
|
||||
# LFS allows you to use the above programs for files
|
||||
# larger than 2GB!
|
||||
DOLFS:=false
|
||||
|
||||
# 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:=
|
||||
|
||||
# If you are running a cross compiler, you may want to set CROSS
|
||||
# to something more interesting, like "arm-linux-".
|
||||
CROSS:=
|
||||
CC := $(CROSS)gcc
|
||||
AR := $(CROSS)ar
|
||||
AS := $(CROSS)as
|
||||
LD := $(CROSS)ld
|
||||
NM := $(CROSS)nm
|
||||
STRIP := $(CROSS)strip
|
||||
CPP := $(CC) -E
|
||||
MAKEFILES := $(TOPDIR).config
|
||||
export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
|
||||
|
||||
|
||||
# To compile vs uClibc, just use the compiler wrapper built by uClibc...
|
||||
# Everything should compile and work as expected these days...
|
||||
#CC:=/usr/i386-linux-uclibc/bin/i386-uclibc-gcc
|
||||
|
||||
# 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
|
||||
#
|
||||
# The following is used for libc5 (if you install altgcc and libc5-altdev
|
||||
# on a Debian system).
|
||||
#LIBCDIR:=/usr/i486-linuxlibc1
|
||||
#
|
||||
# For other libraries, you are on your own...
|
||||
#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$(TOPDIR)include
|
||||
ARFLAGS:=-r
|
||||
|
||||
TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \
|
||||
-e 's/i.86/i386/' \
|
||||
-e 's/sparc.*/sparc/' \
|
||||
-e 's/arm.*/arm/g' \
|
||||
-e 's/m68k.*/m68k/' \
|
||||
-e 's/ppc/powerpc/g' \
|
||||
-e 's/v850.*/v850/g' \
|
||||
-e 's/sh[234]/sh/' \
|
||||
-e 's/mips.*/mips/' \
|
||||
}
|
||||
|
||||
#--------------------------------------------------------
|
||||
# Arch specific compiler optimization stuff should go here.
|
||||
# Unless you want to override the defaults, do not set anything
|
||||
# for OPTIMIZATION...
|
||||
|
||||
# use '-Os' optimization if available, else use -O2
|
||||
OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null \
|
||||
>/dev/null 2>&1; then echo "-Os"; else echo "-O2" ; fi}
|
||||
|
||||
# Some nice architecture specific optimizations
|
||||
ifeq ($(strip $(TARGET_ARCH)),arm)
|
||||
OPTIMIZATION+=-fstrict-aliasing
|
||||
endif
|
||||
ifeq ($(strip $(TARGET_ARCH)),i386)
|
||||
OPTIMIZATION+=-march=i386
|
||||
OPTIMIZATION+=${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc \
|
||||
/dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi}
|
||||
OPTIMIZATION+=${shell if $(CC) -falign-functions=1 -falign-jumps=0 -falign-loops=0 \
|
||||
-S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo \
|
||||
"-falign-functions=1 -falign-jumps=0 -falign-loops=0"; else \
|
||||
if $(CC) -malign-functions=0 -malign-jumps=0 -S -o /dev/null -xc \
|
||||
/dev/null >/dev/null 2>&1; then echo "-malign-functions=0 -malign-jumps=0"; fi; fi}
|
||||
endif
|
||||
OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer
|
||||
|
||||
#
|
||||
#--------------------------------------------------------
|
||||
# If you're going to do a lot of builds with a non-vanilla configuration,
|
||||
# it makes sense to adjust parameters above, so you can type "make"
|
||||
# by itself, instead of following it by the same half-dozen overrides
|
||||
# every time. The stuff below, on the other hand, is probably less
|
||||
# prone to casual user adjustment.
|
||||
#
|
||||
|
||||
ifeq ($(strip $(DOLFS)),true)
|
||||
# For large file summit support
|
||||
CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
endif
|
||||
ifeq ($(strip $(DODMALLOC)),true)
|
||||
# For testing mem leaks with dmalloc
|
||||
CFLAGS+=-DDMALLOC
|
||||
LIBRARIES:=-ldmalloc
|
||||
# Force debug=true, since this is useless when not debugging...
|
||||
DODEBUG:=true
|
||||
else
|
||||
ifeq ($(strip $(DOEFENCE)),true)
|
||||
LIBRARIES:=-lefence
|
||||
# Force debug=true, since this is useless when not debugging...
|
||||
DODEBUG:=true
|
||||
endif
|
||||
endif
|
||||
ifeq ($(strip $(DODEBUG)),true)
|
||||
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
|
||||
LDFLAGS +=-Wl,-warn-common
|
||||
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
|
||||
else
|
||||
CFLAGS += $(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE
|
||||
LDFLAGS += -s -Wl,-warn-common
|
||||
STRIPCMD:=$(STRIP) --remove-section=.note --remove-section=.comment
|
||||
endif
|
||||
ifeq ($(strip $(DOSTATIC)),true)
|
||||
LDFLAGS += --static
|
||||
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)
|
||||
endif
|
||||
|
||||
CFLAGS += -DBB_VER='"$(VERSION)"'
|
||||
CFLAGS += -DBB_BT='"$(BUILDTIME)"'
|
||||
OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
|
||||
CFLAGS += $(CROSS_CFLAGS)
|
||||
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)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
|
||||
|
||||
ifdef _FASTDEP_ALL_SUB_DIRS
|
||||
fastdep: dummy
|
||||
$(TOPDIR)scripts/mkdep $(CFLAGS) $(EXTRA_CFLAGS_nostdinc) -- $(wildcard *.[chS]) > .depend
|
||||
ifdef ALL_SUB_DIRS
|
||||
$(MAKE) $(patsubst %,_sfdep_%,$(ALL_SUB_DIRS)) _FASTDEP_ALL_SUB_DIRS="$(ALL_SUB_DIRS)"
|
||||
endif
|
||||
|
||||
$(patsubst %,_sfdep_%,$(_FASTDEP_ALL_SUB_DIRS)):
|
||||
$(MAKE) -C $(patsubst _sfdep_%,%,$@) fastdep
|
||||
endif
|
||||
|
||||
.PHONY: dummy
|
||||
|
||||
|
||||
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
@@ -3,40 +3,34 @@ is listed here doesn't mean that it is going to be added to busybox,
|
||||
or that doing so is even a good idea. It just means that I _might_ get
|
||||
around to it some time. If you have any good ideas, please let me know.
|
||||
|
||||
* login/sulogin/passwd/getty/etc are part of tinylogin, and so are not
|
||||
needed or wanted in busybox (or else I'd have to link to libcrypt).
|
||||
|
||||
* We _were_ going to split networking apps into a new package called
|
||||
netkit-tiny. Per discussions on the mailing list, this isn't going
|
||||
to happen. False alarm. Sorry about the confusion.
|
||||
|
||||
* The busybox shell, lash, is really too weak for serious use, although it is
|
||||
possible to run simple systems with it. BusyBox 0.49 was supposed to have
|
||||
a new shell, updated to understand full Bourne grammer. Well, that simply
|
||||
didn't happen in time for the release. A rewrite is in progress that will
|
||||
result in a new shell that understands the full Bourne grammar. This new
|
||||
shell is being championed by Larry Doolittle <ldoolitt@recycle.lbl.gov>, and
|
||||
could use your help. Please see the work in progress at
|
||||
http://doolittle.faludi.com/~larry/parser.html
|
||||
|
||||
-Erik
|
||||
|
||||
-----------
|
||||
|
||||
Possible apps to include some time:
|
||||
|
||||
* hwclock
|
||||
* stty
|
||||
* group/commonize strings, remove dups (for i18n, l10n)
|
||||
|
||||
-----------
|
||||
|
||||
With sysvinit, reboot, poweroff and halt all used a named pipe,
|
||||
/dev/initctl, to communicate with the init process. Busybox
|
||||
currently uses signals to communicate with init. This makes
|
||||
busybox incompatible with sysvinit. We should probably use
|
||||
a named pipe as well so we can be compatible.
|
||||
|
||||
-----------------------
|
||||
|
||||
Running the following:
|
||||
Run the following:
|
||||
|
||||
rm -f busybox && make LDFLAGS+=-nostdlib 2>&1 | \
|
||||
sed -ne 's/.*undefined reference to `\(.*\)..*/\1/gp' | sort | uniq
|
||||
|
||||
reveals the list of all external (i.e. libc) things that BusyBox depends on.
|
||||
reveals the list of all external (i.e., libc) things that BusyBox depends on.
|
||||
It would be a very nice thing to reduce this list to an absolute minimum, to
|
||||
reduce the footprint of busybox, especially when staticly linking with
|
||||
libraries such as uClibc.
|
||||
@@ -48,6 +42,11 @@ and then start with the biggest things and make them smaller...
|
||||
|
||||
-----------------------
|
||||
|
||||
du.c probably ought to have an -x switch like GNU du does...
|
||||
xargs could use a -l option
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
libbb/unzip.c and archival/gzip.c have common constant static arrays and
|
||||
code for initializing the CRC array. Both use CRC-32 and could use
|
||||
common code for CRC calculation. Within archival/gzip.c, the CRC
|
||||
array should be malloc-ed as it is in libbb/unzip.c .
|
||||
@@ -1,397 +0,0 @@
|
||||
/*
|
||||
* applets.h - a listing of all busybox applets.
|
||||
*
|
||||
* If you write a new applet, you need to add an entry to this list to make
|
||||
* busybox aware of it.
|
||||
*
|
||||
* It is CRUCIAL that this listing be kept in ascii order, otherwise the binary
|
||||
* search lookup contributed by Gaute B Strokkenes stops working. If you value
|
||||
* your kneecaps, you'll be sure to *make sure* that any changes made to this
|
||||
* file result in the listing remaining in ascii order. You have been warned.
|
||||
*/
|
||||
|
||||
#if defined(PROTOTYPES)
|
||||
#define APPLET(a,b,c,d) \
|
||||
extern int b(int argc, char **argv); \
|
||||
extern const char d[];
|
||||
#define APPLET_NOUSAGE(a,b,c) \
|
||||
extern int b(int argc, char **argv);
|
||||
#elif defined(MAKE_LINKS)
|
||||
#define APPLET(a,b,c,d) LINK c a
|
||||
#define APPLET_NOUSAGE(a,b,c) LINK c a
|
||||
#else
|
||||
const struct BB_applet applets[] = {
|
||||
#define APPLET(a,b,c,d) {a,b,c,d},
|
||||
#define APPLET_NOUSAGE(a,b,c) {a,b,c,NULL},
|
||||
#endif
|
||||
|
||||
#ifdef BB_TEST
|
||||
APPLET("[", test_main, _BB_DIR_USR_BIN, test_usage)
|
||||
#endif
|
||||
#ifdef BB_AR
|
||||
APPLET("ar", ar_main, _BB_DIR_USR_BIN, ar_usage)
|
||||
#endif
|
||||
#ifdef BB_BASENAME
|
||||
APPLET("basename", basename_main, _BB_DIR_USR_BIN, basename_usage)
|
||||
#endif
|
||||
APPLET_NOUSAGE("busybox", busybox_main, _BB_DIR_BIN)
|
||||
#ifdef BB_CAT
|
||||
APPLET("cat", cat_main, _BB_DIR_BIN, cat_usage)
|
||||
#endif
|
||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||
APPLET("chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN, chgrp_usage)
|
||||
#endif
|
||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||
APPLET("chmod", chmod_chown_chgrp_main, _BB_DIR_BIN, chmod_usage)
|
||||
#endif
|
||||
#ifdef BB_CHMOD_CHOWN_CHGRP
|
||||
APPLET("chown", chmod_chown_chgrp_main, _BB_DIR_BIN, chown_usage)
|
||||
#endif
|
||||
#ifdef BB_CHROOT
|
||||
APPLET("chroot", chroot_main, _BB_DIR_USR_SBIN, chroot_usage)
|
||||
#endif
|
||||
#ifdef BB_CHVT
|
||||
APPLET("chvt", chvt_main, _BB_DIR_USR_BIN, chvt_usage)
|
||||
#endif
|
||||
#ifdef BB_CLEAR
|
||||
APPLET("clear", clear_main, _BB_DIR_USR_BIN, clear_usage)
|
||||
#endif
|
||||
#ifdef BB_CMP
|
||||
APPLET("cmp", cmp_main, _BB_DIR_USR_BIN, cmp_usage)
|
||||
#endif
|
||||
#ifdef BB_CP_MV
|
||||
APPLET("cp", cp_mv_main, _BB_DIR_BIN, cp_usage)
|
||||
#endif
|
||||
#ifdef BB_CUT
|
||||
APPLET("cut", cut_main, _BB_DIR_USR_BIN, cut_usage)
|
||||
#endif
|
||||
#ifdef BB_DATE
|
||||
APPLET("date", date_main, _BB_DIR_BIN, date_usage)
|
||||
#endif
|
||||
#ifdef BB_DC
|
||||
APPLET("dc", dc_main, _BB_DIR_USR_BIN, dc_usage)
|
||||
#endif
|
||||
#ifdef BB_DD
|
||||
APPLET("dd", dd_main, _BB_DIR_BIN, dd_usage)
|
||||
#endif
|
||||
#ifdef BB_DEALLOCVT
|
||||
APPLET("deallocvt", deallocvt_main, _BB_DIR_USR_BIN, deallocvt_usage)
|
||||
#endif
|
||||
#ifdef BB_DF
|
||||
APPLET("df", df_main, _BB_DIR_BIN, df_usage)
|
||||
#endif
|
||||
#ifdef BB_DIRNAME
|
||||
APPLET("dirname", dirname_main, _BB_DIR_USR_BIN, dirname_usage)
|
||||
#endif
|
||||
#ifdef BB_DMESG
|
||||
APPLET("dmesg", dmesg_main, _BB_DIR_BIN, dmesg_usage)
|
||||
#endif
|
||||
#ifdef BB_DOS2UNIX
|
||||
APPLET("dos2unix", dos2unix_main, _BB_DIR_USR_BIN, dos2unix_usage)
|
||||
#endif
|
||||
#ifdef BB_DPKG_DEB
|
||||
APPLET("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb_usage)
|
||||
#endif
|
||||
#ifdef BB_DU
|
||||
APPLET("du", du_main, _BB_DIR_USR_BIN, du_usage)
|
||||
#endif
|
||||
#ifdef BB_DUMPKMAP
|
||||
APPLET("dumpkmap", dumpkmap_main, _BB_DIR_BIN, dumpkmap_usage)
|
||||
#endif
|
||||
#ifdef BB_DUTMP
|
||||
APPLET("dutmp", dutmp_main, _BB_DIR_USR_SBIN, dutmp_usage)
|
||||
#endif
|
||||
#ifdef BB_ECHO
|
||||
APPLET("echo", echo_main, _BB_DIR_BIN, echo_usage)
|
||||
#endif
|
||||
#ifdef BB_EXPR
|
||||
APPLET("expr", expr_main, _BB_DIR_USR_BIN, expr_usage)
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE
|
||||
APPLET("false", false_main, _BB_DIR_BIN, false_usage)
|
||||
#endif
|
||||
#ifdef BB_FBSET
|
||||
APPLET_NOUSAGE("fbset", fbset_main, _BB_DIR_USR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_FDFLUSH
|
||||
APPLET("fdflush", fdflush_main, _BB_DIR_BIN, fdflush_usage)
|
||||
#endif
|
||||
#ifdef BB_FIND
|
||||
APPLET("find", find_main, _BB_DIR_USR_BIN, find_usage)
|
||||
#endif
|
||||
#ifdef BB_FREE
|
||||
APPLET("free", free_main, _BB_DIR_USR_BIN, free_usage)
|
||||
#endif
|
||||
#ifdef BB_FREERAMDISK
|
||||
APPLET("freeramdisk", freeramdisk_main, _BB_DIR_SBIN, freeramdisk_usage)
|
||||
#endif
|
||||
#ifdef BB_FSCK_MINIX
|
||||
APPLET("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage)
|
||||
#endif
|
||||
#ifdef BB_GETOPT
|
||||
APPLET("getopt", getopt_main, _BB_DIR_BIN, getopt_usage)
|
||||
#endif
|
||||
#ifdef BB_GREP
|
||||
APPLET("grep", grep_main, _BB_DIR_BIN, grep_usage)
|
||||
#endif
|
||||
#ifdef BB_GUNZIP
|
||||
APPLET("gunzip", gunzip_main, _BB_DIR_BIN, gunzip_usage)
|
||||
#endif
|
||||
#ifdef BB_GZIP
|
||||
APPLET("gzip", gzip_main, _BB_DIR_BIN, gzip_usage)
|
||||
#endif
|
||||
#ifdef BB_HALT
|
||||
APPLET("halt", halt_main, _BB_DIR_SBIN, halt_usage)
|
||||
#endif
|
||||
#ifdef BB_HEAD
|
||||
APPLET("head", head_main, _BB_DIR_USR_BIN, head_usage)
|
||||
#endif
|
||||
#ifdef BB_HOSTID
|
||||
APPLET("hostid", hostid_main, _BB_DIR_USR_BIN, hostid_usage)
|
||||
#endif
|
||||
#ifdef BB_HOSTNAME
|
||||
APPLET("hostname", hostname_main, _BB_DIR_BIN, hostname_usage)
|
||||
#endif
|
||||
#ifdef BB_ID
|
||||
APPLET("id", id_main, _BB_DIR_USR_BIN, id_usage)
|
||||
#endif
|
||||
#ifdef BB_INIT
|
||||
APPLET_NOUSAGE("init", init_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_INSMOD
|
||||
APPLET("insmod", insmod_main, _BB_DIR_SBIN, insmod_usage)
|
||||
#endif
|
||||
#ifdef BB_KILL
|
||||
APPLET("kill", kill_main, _BB_DIR_BIN, kill_usage)
|
||||
#endif
|
||||
#ifdef BB_KILLALL
|
||||
APPLET("killall", kill_main, _BB_DIR_USR_BIN, killall_usage)
|
||||
#endif
|
||||
#ifdef BB_LENGTH
|
||||
APPLET("length", length_main, _BB_DIR_USR_BIN, length_usage)
|
||||
#endif
|
||||
#ifdef BB_LINUXRC
|
||||
APPLET_NOUSAGE("linuxrc", init_main, _BB_DIR_ROOT)
|
||||
#endif
|
||||
#ifdef BB_LN
|
||||
APPLET("ln", ln_main, _BB_DIR_BIN, ln_usage)
|
||||
#endif
|
||||
#ifdef BB_LOADACM
|
||||
APPLET("loadacm", loadacm_main, _BB_DIR_USR_BIN, loadacm_usage)
|
||||
#endif
|
||||
#ifdef BB_LOADFONT
|
||||
APPLET("loadfont", loadfont_main, _BB_DIR_USR_BIN, loadfont_usage)
|
||||
#endif
|
||||
#ifdef BB_LOADKMAP
|
||||
APPLET("loadkmap", loadkmap_main, _BB_DIR_SBIN, loadkmap_usage)
|
||||
#endif
|
||||
#ifdef BB_LOGGER
|
||||
APPLET("logger", logger_main, _BB_DIR_USR_BIN, logger_usage)
|
||||
#endif
|
||||
#ifdef BB_LOGNAME
|
||||
APPLET("logname", logname_main, _BB_DIR_USR_BIN, logname_usage)
|
||||
#endif
|
||||
#ifdef BB_LS
|
||||
APPLET("ls", ls_main, _BB_DIR_BIN, ls_usage)
|
||||
#endif
|
||||
#ifdef BB_LSMOD
|
||||
APPLET("lsmod", lsmod_main, _BB_DIR_SBIN, lsmod_usage)
|
||||
#endif
|
||||
#ifdef BB_MAKEDEVS
|
||||
APPLET("makedevs", makedevs_main, _BB_DIR_SBIN, makedevs_usage)
|
||||
#endif
|
||||
#ifdef BB_MD5SUM
|
||||
APPLET("md5sum", md5sum_main, _BB_DIR_USR_BIN, md5sum_usage)
|
||||
#endif
|
||||
#ifdef BB_MKDIR
|
||||
APPLET("mkdir", mkdir_main, _BB_DIR_BIN, mkdir_usage)
|
||||
#endif
|
||||
#ifdef BB_MKFIFO
|
||||
APPLET("mkfifo", mkfifo_main, _BB_DIR_USR_BIN, mkfifo_usage)
|
||||
#endif
|
||||
#ifdef BB_MKFS_MINIX
|
||||
APPLET("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage)
|
||||
#endif
|
||||
#ifdef BB_MKNOD
|
||||
APPLET("mknod", mknod_main, _BB_DIR_BIN, mknod_usage)
|
||||
#endif
|
||||
#ifdef BB_MKSWAP
|
||||
APPLET("mkswap", mkswap_main, _BB_DIR_SBIN, mkswap_usage)
|
||||
#endif
|
||||
#ifdef BB_MKTEMP
|
||||
APPLET("mktemp", mktemp_main, _BB_DIR_BIN, mktemp_usage)
|
||||
#endif
|
||||
#ifdef BB_MORE
|
||||
APPLET("more", more_main, _BB_DIR_BIN, more_usage)
|
||||
#endif
|
||||
#ifdef BB_MOUNT
|
||||
APPLET("mount", mount_main, _BB_DIR_BIN, mount_usage)
|
||||
#endif
|
||||
#ifdef BB_MT
|
||||
APPLET("mt", mt_main, _BB_DIR_BIN, mt_usage)
|
||||
#endif
|
||||
#ifdef BB_CP_MV
|
||||
APPLET("mv", cp_mv_main, _BB_DIR_BIN, mv_usage)
|
||||
#endif
|
||||
#ifdef BB_NC
|
||||
APPLET("nc", nc_main, _BB_DIR_USR_BIN, nc_usage)
|
||||
#endif
|
||||
#ifdef BB_NSLOOKUP
|
||||
APPLET("nslookup", nslookup_main, _BB_DIR_USR_BIN, nslookup_usage)
|
||||
#endif
|
||||
#ifdef BB_PING
|
||||
APPLET("ping", ping_main, _BB_DIR_BIN, ping_usage)
|
||||
#endif
|
||||
#ifdef BB_POWEROFF
|
||||
APPLET("poweroff", poweroff_main, _BB_DIR_SBIN, poweroff_usage)
|
||||
#endif
|
||||
#ifdef BB_PRINTF
|
||||
APPLET("printf", printf_main, _BB_DIR_USR_BIN, printf_usage)
|
||||
#endif
|
||||
#ifdef BB_PS
|
||||
APPLET("ps", ps_main, _BB_DIR_BIN, ps_usage)
|
||||
#endif
|
||||
#ifdef BB_PWD
|
||||
APPLET("pwd", pwd_main, _BB_DIR_BIN, pwd_usage)
|
||||
#endif
|
||||
#ifdef BB_RDATE
|
||||
APPLET("rdate", rdate_main, _BB_DIR_USR_BIN, rdate_usage)
|
||||
#endif
|
||||
#ifdef BB_READLINK
|
||||
APPLET("readlink", readlink_main, _BB_DIR_USR_BIN, readlink_usage)
|
||||
#endif
|
||||
#ifdef BB_REBOOT
|
||||
APPLET("reboot", reboot_main, _BB_DIR_SBIN, reboot_usage)
|
||||
#endif
|
||||
#ifdef BB_RENICE
|
||||
APPLET("renice", renice_main, _BB_DIR_USR_BIN, renice_usage)
|
||||
#endif
|
||||
#ifdef BB_RESET
|
||||
APPLET("reset", reset_main, _BB_DIR_USR_BIN, reset_usage)
|
||||
#endif
|
||||
#ifdef BB_RM
|
||||
APPLET("rm", rm_main, _BB_DIR_BIN, rm_usage)
|
||||
#endif
|
||||
#ifdef BB_RMDIR
|
||||
APPLET("rmdir", rmdir_main, _BB_DIR_BIN, rmdir_usage)
|
||||
#endif
|
||||
#ifdef BB_RMMOD
|
||||
APPLET("rmmod", rmmod_main, _BB_DIR_SBIN, rmmod_usage)
|
||||
#endif
|
||||
#ifdef BB_RPMUNPACK
|
||||
APPLET("rpmunpack", rpmunpack_main, _BB_DIR_USR_BIN, rpmunpack_usage)
|
||||
#endif
|
||||
#ifdef BB_SED
|
||||
APPLET("sed", sed_main, _BB_DIR_BIN, sed_usage)
|
||||
#endif
|
||||
#ifdef BB_SETKEYCODES
|
||||
APPLET("setkeycodes", setkeycodes_main, _BB_DIR_USR_BIN, setkeycodes_usage)
|
||||
#endif
|
||||
#ifdef BB_SH
|
||||
APPLET("sh", shell_main, _BB_DIR_BIN, shell_usage)
|
||||
#endif
|
||||
#ifdef BB_SLEEP
|
||||
APPLET("sleep", sleep_main, _BB_DIR_BIN, sleep_usage)
|
||||
#endif
|
||||
#ifdef BB_SORT
|
||||
APPLET("sort", sort_main, _BB_DIR_USR_BIN, sort_usage)
|
||||
#endif
|
||||
#ifdef BB_SWAPONOFF
|
||||
APPLET("swapoff", swap_on_off_main, _BB_DIR_SBIN, swapoff_usage)
|
||||
#endif
|
||||
#ifdef BB_SWAPONOFF
|
||||
APPLET("swapon", swap_on_off_main, _BB_DIR_SBIN, swapon_usage)
|
||||
#endif
|
||||
#ifdef BB_SYNC
|
||||
APPLET("sync", sync_main, _BB_DIR_BIN, sync_usage)
|
||||
#endif
|
||||
#ifdef BB_SYSLOGD
|
||||
APPLET("syslogd", syslogd_main, _BB_DIR_SBIN, syslogd_usage)
|
||||
#endif
|
||||
#ifdef BB_TAIL
|
||||
APPLET("tail", tail_main, _BB_DIR_USR_BIN, tail_usage)
|
||||
#endif
|
||||
#ifdef BB_TAR
|
||||
APPLET("tar", tar_main, _BB_DIR_BIN, tar_usage)
|
||||
#endif
|
||||
#ifdef BB_TEE
|
||||
APPLET("tee", tee_main, _BB_DIR_USR_BIN, tee_usage)
|
||||
#endif
|
||||
#ifdef BB_TELNET
|
||||
APPLET("telnet", telnet_main, _BB_DIR_USR_BIN, telnet_usage)
|
||||
#endif
|
||||
#ifdef BB_TEST
|
||||
APPLET("test", test_main, _BB_DIR_USR_BIN, test_usage)
|
||||
#endif
|
||||
#ifdef BB_TOUCH
|
||||
APPLET("touch", touch_main, _BB_DIR_BIN, touch_usage)
|
||||
#endif
|
||||
#ifdef BB_TR
|
||||
APPLET("tr", tr_main, _BB_DIR_USR_BIN, tr_usage)
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE
|
||||
APPLET("true", true_main, _BB_DIR_BIN, true_usage)
|
||||
#endif
|
||||
#ifdef BB_TTY
|
||||
APPLET("tty", tty_main, _BB_DIR_USR_BIN, tty_usage)
|
||||
#endif
|
||||
#ifdef BB_UMOUNT
|
||||
APPLET("umount", umount_main, _BB_DIR_BIN, umount_usage)
|
||||
#endif
|
||||
#ifdef BB_UNAME
|
||||
APPLET("uname", uname_main, _BB_DIR_BIN, uname_usage)
|
||||
#endif
|
||||
#ifdef BB_UNIQ
|
||||
APPLET("uniq", uniq_main, _BB_DIR_USR_BIN, uniq_usage)
|
||||
#endif
|
||||
#ifdef BB_UNIX2DOS
|
||||
APPLET("unix2dos", unix2dos_main, _BB_DIR_USR_BIN, unix2dos_usage)
|
||||
#endif
|
||||
#ifdef BB_UPDATE
|
||||
APPLET("update", update_main, _BB_DIR_SBIN, update_usage)
|
||||
#endif
|
||||
#ifdef BB_UPTIME
|
||||
APPLET("uptime", uptime_main, _BB_DIR_USR_BIN, uptime_usage)
|
||||
#endif
|
||||
#ifdef BB_USLEEP
|
||||
APPLET("usleep", usleep_main, _BB_DIR_BIN, usleep_usage)
|
||||
#endif
|
||||
#ifdef BB_UUDECODE
|
||||
APPLET("uudecode", uudecode_main, _BB_DIR_USR_BIN, uudecode_usage)
|
||||
#endif
|
||||
#ifdef BB_UUENCODE
|
||||
APPLET("uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage)
|
||||
#endif
|
||||
#ifdef BB_WATCHDOG
|
||||
APPLET("watchdog", watchdog_main, _BB_DIR_SBIN, watchdog_usage)
|
||||
#endif
|
||||
#ifdef BB_WC
|
||||
APPLET("wc", wc_main, _BB_DIR_USR_BIN, wc_usage)
|
||||
#endif
|
||||
#ifdef BB_WGET
|
||||
APPLET("wget", wget_main, _BB_DIR_USR_BIN, wget_usage)
|
||||
#endif
|
||||
#ifdef BB_WHICH
|
||||
APPLET("which", which_main, _BB_DIR_USR_BIN, which_usage)
|
||||
#endif
|
||||
#ifdef BB_WHOAMI
|
||||
APPLET("whoami", whoami_main, _BB_DIR_USR_BIN, whoami_usage)
|
||||
#endif
|
||||
#ifdef BB_XARGS
|
||||
APPLET("xargs", xargs_main, _BB_DIR_USR_BIN, xargs_usage)
|
||||
#endif
|
||||
#ifdef BB_YES
|
||||
APPLET("yes", yes_main, _BB_DIR_USR_BIN, yes_usage)
|
||||
#endif
|
||||
#ifdef BB_GUNZIP
|
||||
APPLET("zcat", gunzip_main, _BB_DIR_BIN, gunzip_usage)
|
||||
#endif
|
||||
|
||||
#if !defined(PROTOTYPES) && !defined(MAKE_LINKS)
|
||||
{ 0,NULL,0,NULL}
|
||||
};
|
||||
|
||||
/* The -1 arises because of the {0,NULL,0,NULL} entry above. */
|
||||
size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
TOPDIR:= ../
|
||||
APPLETS_DIR:=./
|
||||
include $(TOPDIR).config
|
||||
include $(TOPDIR)Rules.mak
|
||||
include Makefile.in
|
||||
all: $(libraries-y)
|
||||
-include $(TOPDIR).depend
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a $(AR_TARGET)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
APPLETS_AR:=applets.a
|
||||
ifndef $(APPLETS_DIR)
|
||||
APPLETS_DIR:=$(TOPDIR)applets/
|
||||
endif
|
||||
|
||||
APPLET_SRC:=applets.c busybox.c usage.c
|
||||
APPLET_OBJ:= $(patsubst %.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
|
||||
|
||||
|
||||
|
||||
libraries-y+=$(APPLETS_DIR)$(APPLETS_AR)
|
||||
|
||||
$(APPLET_OBJ): $(TOPDIR).config
|
||||
|
||||
$(APPLETS_DIR)$(APPLETS_AR): $(APPLET_OBJ)
|
||||
$(AR) -ro $@ $(APPLET_OBJ)
|
||||
|
||||
@@ -0,0 +1,422 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Utility routines.
|
||||
*
|
||||
* Copyright (C) tons of folks. Tracking down who wrote what
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#undef APPLET
|
||||
#undef APPLET_NOUSAGE
|
||||
#undef PROTOTYPES
|
||||
#include "applets.h"
|
||||
|
||||
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 int parse_config_file ( void );
|
||||
|
||||
static int config_ok;
|
||||
|
||||
#define CONFIG_FILE "/etc/busybox.conf"
|
||||
|
||||
/* applets [] is const, so we have to define this "override" structure */
|
||||
struct BB_suid_config {
|
||||
struct BB_applet *m_applet;
|
||||
|
||||
uid_t m_uid;
|
||||
gid_t m_gid;
|
||||
mode_t m_mode;
|
||||
|
||||
struct BB_suid_config *m_next;
|
||||
};
|
||||
|
||||
static struct BB_suid_config *suid_config;
|
||||
|
||||
#endif /* CONFIG_FEATURE_SUID_CONFIG */
|
||||
|
||||
#endif /* CONFIG_FEATURE_SUID */
|
||||
|
||||
|
||||
|
||||
extern void 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,
|
||||
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 )
|
||||
config_ok = 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) {
|
||||
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)
|
||||
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 )
|
||||
{
|
||||
struct group *grp = getgrgid ( g );
|
||||
|
||||
if ( grp ) {
|
||||
char **mem;
|
||||
|
||||
for ( mem = grp-> gr_mem; *mem; mem++ ) {
|
||||
struct passwd *pwd = getpwnam ( *mem );
|
||||
|
||||
if ( pwd && ( pwd-> pw_uid == u ))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
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 ( config_ok ) {
|
||||
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 ? */
|
||||
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 ))
|
||||
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 ))
|
||||
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 )
|
||||
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
|
||||
|
||||
|
||||
#define parse_error(x) { err=x; goto pe_label; }
|
||||
|
||||
|
||||
int parse_config_file ( void )
|
||||
{
|
||||
struct stat st;
|
||||
char *err = 0;
|
||||
FILE *f = 0;
|
||||
int lc = 0;
|
||||
|
||||
suid_config = 0;
|
||||
|
||||
/* is there a config file ? */
|
||||
if ( stat ( CONFIG_FILE, &st ) == 0 ) {
|
||||
/* is it owned by root with no write perm. for group and others ? */
|
||||
if ( S_ISREG( st. st_mode ) && ( st. st_uid == 0 ) && (!( st. st_mode & ( S_IWGRP | S_IWOTH )))) {
|
||||
/* that's ok .. then try to open it */
|
||||
f = fopen ( CONFIG_FILE, "r" );
|
||||
|
||||
if ( f ) {
|
||||
char buffer [256];
|
||||
int section = 0;
|
||||
|
||||
while ( fgets ( buffer, sizeof( buffer ) - 1, f )) {
|
||||
char c = buffer [0];
|
||||
char *p;
|
||||
|
||||
lc++;
|
||||
|
||||
p = strchr ( buffer, '#' );
|
||||
if ( p )
|
||||
*p = 0;
|
||||
p = buffer + xstrlen ( buffer );
|
||||
while (( p > buffer ) && isspace ( *--p ))
|
||||
*p = 0;
|
||||
|
||||
if ( p == buffer )
|
||||
continue;
|
||||
|
||||
if ( c == '[' ) {
|
||||
p = strchr ( buffer, ']' );
|
||||
|
||||
if ( !p || ( p == ( buffer + 1 ))) /* no matching ] or empty [] */
|
||||
parse_error ( "malformed section header" );
|
||||
|
||||
*p = 0;
|
||||
|
||||
if ( strcasecmp ( buffer + 1, "SUID" ) == 0 )
|
||||
section = 1;
|
||||
else
|
||||
section = -1; /* unknown section - just skip */
|
||||
}
|
||||
else if ( section ) {
|
||||
switch ( section ) {
|
||||
case 1: { /* SUID */
|
||||
int l;
|
||||
struct BB_applet *applet;
|
||||
|
||||
p = strchr ( buffer, '=' ); /* <key>[::space::]*=[::space::]*<value> */
|
||||
|
||||
if ( !p || ( p == ( buffer + 1 ))) /* no = or key is empty */
|
||||
parse_error ( "malformed keyword" );
|
||||
|
||||
l = p - buffer;
|
||||
while ( isspace ( buffer [--l] )) { } /* skip whitespace */
|
||||
|
||||
buffer [l+1] = 0;
|
||||
|
||||
if (( applet = find_applet_by_name ( buffer ))) {
|
||||
struct BB_suid_config *sct = xmalloc ( sizeof( struct BB_suid_config ));
|
||||
|
||||
sct-> m_applet = applet;
|
||||
sct-> m_next = suid_config;
|
||||
suid_config = sct;
|
||||
|
||||
while ( isspace ( *++p )) { } /* skip whitespace */
|
||||
|
||||
sct-> m_mode = 0;
|
||||
|
||||
switch ( *p++ ) {
|
||||
case 'S': sct-> m_mode |= S_ISUID; break;
|
||||
case 's': sct-> m_mode |= S_ISUID; /* no break */
|
||||
case 'x': sct-> m_mode |= S_IXUSR; break;
|
||||
case '-': break;
|
||||
default : parse_error ( "invalid user mode" );
|
||||
}
|
||||
|
||||
switch ( *p++ ) {
|
||||
case 's': sct-> m_mode |= S_ISGID; /* no break */
|
||||
case 'x': sct-> m_mode |= S_IXGRP; break;
|
||||
case 'S': break;
|
||||
case '-': break;
|
||||
default : parse_error ( "invalid group mode" );
|
||||
}
|
||||
|
||||
switch ( *p ) {
|
||||
case 't':
|
||||
case 'x': sct-> m_mode |= S_IXOTH; break;
|
||||
case 'T':
|
||||
case '-': break;
|
||||
default : parse_error ( "invalid other mode" );
|
||||
}
|
||||
|
||||
while ( isspace ( *++p )) { } /* skip whitespace */
|
||||
|
||||
if ( isdigit ( *p )) {
|
||||
sct-> m_uid = strtol ( p, &p, 10 );
|
||||
if ( *p++ != '.' )
|
||||
parse_error ( "parsing <uid>.<gid>" );
|
||||
}
|
||||
else {
|
||||
struct passwd *pwd;
|
||||
char *p2 = strchr ( p, '.' );
|
||||
|
||||
if ( !p2 )
|
||||
parse_error ( "parsing <uid>.<gid>" );
|
||||
|
||||
*p2 = 0;
|
||||
pwd = getpwnam ( p );
|
||||
|
||||
if ( !pwd )
|
||||
parse_error ( "invalid user name" );
|
||||
|
||||
sct-> m_uid = pwd-> pw_uid;
|
||||
p = p2 + 1;
|
||||
}
|
||||
if ( isdigit ( *p ))
|
||||
sct-> m_gid = strtol ( p, &p, 10 );
|
||||
else {
|
||||
struct group *grp = getgrnam ( p );
|
||||
|
||||
if ( !grp )
|
||||
parse_error ( "invalid group name" );
|
||||
|
||||
sct-> m_gid = grp-> gr_gid;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: /* unknown - skip */
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
parse_error ( "keyword not within section" );
|
||||
}
|
||||
fclose ( f );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0; /* no config file or not readable (not an error) */
|
||||
|
||||
pe_label:
|
||||
fprintf ( stderr, "Parse error in %s, line %d: %s\n", CONFIG_FILE, lc, err );
|
||||
|
||||
if ( f )
|
||||
fclose ( f );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* END CODE */
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+43
-64
@@ -1,35 +1,32 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
#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
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#undef APPLET
|
||||
#undef APPLET_NOUSAGE
|
||||
#undef PROTOTYPES
|
||||
#include "applets.h"
|
||||
|
||||
#define bb_need_full_version
|
||||
#define BB_DECLARE_EXTERN
|
||||
#include "messages.c"
|
||||
|
||||
static int been_there_done_that = 0;
|
||||
int been_there_done_that = 0; /* Also used in applets.c */
|
||||
const char *applet_name;
|
||||
|
||||
#ifdef BB_FEATURE_INSTALLER
|
||||
#ifdef CONFIG_FEATURE_INSTALLER
|
||||
/*
|
||||
* directory table
|
||||
* this should be consistent w/ the enum, busybox.h::Location,
|
||||
* or else...
|
||||
*/
|
||||
static char* install_dir[] = {
|
||||
"/",
|
||||
"/bin",
|
||||
"/sbin",
|
||||
"/usr/bin",
|
||||
"/usr/sbin",
|
||||
static const char usr_bin [] ="/usr/bin";
|
||||
static const char usr_sbin[] ="/usr/sbin";
|
||||
|
||||
static const char* const install_dir[] = {
|
||||
&usr_bin [8], /* "", equivalent to "/" for concat_path_file() */
|
||||
&usr_bin [4], /* "/bin" */
|
||||
&usr_sbin[4], /* "/sbin" */
|
||||
usr_bin,
|
||||
usr_sbin
|
||||
};
|
||||
|
||||
/* abstract link() */
|
||||
@@ -41,23 +38,9 @@ typedef int (*__link_f)(const char *, const char *);
|
||||
* malloc'd string w/ full pathname of busybox's location
|
||||
* NULL on failure
|
||||
*/
|
||||
static char *busybox_fullpath()
|
||||
static inline char *busybox_fullpath(void)
|
||||
{
|
||||
pid_t pid;
|
||||
char path[256];
|
||||
char proc[256];
|
||||
int len;
|
||||
|
||||
pid = getpid();
|
||||
sprintf(proc, "/proc/%d/exe", pid);
|
||||
len = readlink(proc, path, 256);
|
||||
if (len != -1) {
|
||||
path[len] = 0;
|
||||
} else {
|
||||
perror_msg("%s", proc);
|
||||
return NULL;
|
||||
}
|
||||
return strdup(path);
|
||||
return xreadlink("/proc/self/exe");
|
||||
}
|
||||
|
||||
/* create (sym)links for each applet */
|
||||
@@ -65,7 +48,7 @@ static void install_links(const char *busybox, int use_symbolic_links)
|
||||
{
|
||||
__link_f Link = link;
|
||||
|
||||
char command[256];
|
||||
char *fpc;
|
||||
int i;
|
||||
int rc;
|
||||
|
||||
@@ -73,47 +56,43 @@ static void install_links(const char *busybox, int use_symbolic_links)
|
||||
Link = symlink;
|
||||
|
||||
for (i = 0; applets[i].name != NULL; i++) {
|
||||
sprintf ( command, "%s/%s",
|
||||
install_dir[applets[i].location], applets[i].name);
|
||||
rc = Link(busybox, command);
|
||||
|
||||
if (rc) {
|
||||
perror_msg("%s", command);
|
||||
fpc = concat_path_file(
|
||||
install_dir[applets[i].location], applets[i].name);
|
||||
rc = Link(busybox, fpc);
|
||||
if (rc!=0 && errno!=EEXIST) {
|
||||
perror_msg("%s", fpc);
|
||||
}
|
||||
free(fpc);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* BB_FEATURE_INSTALLER */
|
||||
#endif /* CONFIG_FEATURE_INSTALLER */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct BB_applet search_applet, *applet;
|
||||
const char *s;
|
||||
const char *s;
|
||||
|
||||
for (s = applet_name = argv[0]; *s != '\0';) {
|
||||
applet_name = argv[0];
|
||||
|
||||
if (applet_name[0] == '-')
|
||||
applet_name++;
|
||||
|
||||
for (s = applet_name; *s != '\0';) {
|
||||
if (*s++ == '/')
|
||||
applet_name = s;
|
||||
}
|
||||
|
||||
#ifdef BB_SH
|
||||
/* Add in a special case hack -- whenever **argv == '-'
|
||||
* (i.e. '-su' or '-sh') always invoke the shell */
|
||||
if (**argv == '-' && *(*argv+1)!= '-') {
|
||||
exit(((*(shell_main)) (argc, argv)));
|
||||
#ifdef CONFIG_LOCALE_SUPPORT
|
||||
#ifdef CONFIG_INIT
|
||||
if(getpid()!=1) /* Do not set locale for `init' */
|
||||
#endif
|
||||
{
|
||||
setlocale(LC_ALL, "");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Do a binary search to find the applet entry given the name. */
|
||||
search_applet.name = applet_name;
|
||||
applet = bsearch(&search_applet, applets, NUM_APPLETS,
|
||||
sizeof(struct BB_applet), applet_name_compare);
|
||||
if (applet != NULL) {
|
||||
if (applet->usage && argv[1] && strcmp(argv[1], "--help") == 0)
|
||||
usage(applet->usage);
|
||||
exit((*(applet->main)) (argc, argv));
|
||||
}
|
||||
|
||||
error_msg_and_die("applet not found\n");
|
||||
run_applet_by_name(applet_name, argc, argv);
|
||||
error_msg_and_die("applet not found");
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +100,7 @@ int busybox_main(int argc, char **argv)
|
||||
{
|
||||
int col = 0, len, i;
|
||||
|
||||
#ifdef BB_FEATURE_INSTALLER
|
||||
#ifdef CONFIG_FEATURE_INSTALLER
|
||||
/*
|
||||
* This style of argument parsing doesn't scale well
|
||||
* in the event that busybox starts wanting more --options.
|
||||
@@ -149,7 +128,7 @@ int busybox_main(int argc, char **argv)
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
#endif /* BB_FEATURE_INSTALLER */
|
||||
#endif /* CONFIG_FEATURE_INSTALLER */
|
||||
|
||||
argc--;
|
||||
|
||||
@@ -176,7 +155,7 @@ int busybox_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n\n");
|
||||
exit(-1);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* Flag that we've been here already */
|
||||
|
||||
@@ -7,8 +7,11 @@
|
||||
|
||||
# Maintainer: Larry Doolittle <ldoolitt@recycle.lbl.gov>
|
||||
|
||||
CONFIG_H=${1:-Config.h}
|
||||
APPLETS_H=${2:-applets.h}
|
||||
export LC_ALL=POSIX
|
||||
export LC_CTYPE=POSIX
|
||||
|
||||
CONFIG_H=${1:-include/config.h}
|
||||
APPLETS_H=${2:-include/applets.h}
|
||||
gcc -E -DMAKE_LINKS -include $CONFIG_H $APPLETS_H |
|
||||
awk '/^[ \t]*LINK/{
|
||||
dir=substr($2,8)
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
RAW=` \
|
||||
gcc -E -dM ${1:-Config.h} | \
|
||||
sed -n -e '/^.*BB_FEATURE.*$/d;s/^#define.*\<BB_\(.*\)\>/\1.c/gp;' \
|
||||
| tr A-Z a-z | sort
|
||||
`
|
||||
test "${RAW}" != "" || exit
|
||||
cd ${2:-.}
|
||||
# I added in the extra "ls" so only source files that
|
||||
# actually exist will show up in the compile list.
|
||||
ls -1 $RAW 2>/dev/null | sed -e 's/\.c$/\.o/g'
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
export LC_ALL=POSIX
|
||||
export LC_CTYPE=POSIX
|
||||
|
||||
prefix=$1
|
||||
if [ "$prefix" = "" ]; then
|
||||
echo "No installation directory, aborting."
|
||||
|
||||
+4
-1554
File diff suppressed because it is too large.
Load diff
@@ -1,223 +0,0 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini ar implementation for busybox
|
||||
*
|
||||
* Copyright (C) 2000 by Glenn McGrath
|
||||
* Written by Glenn McGrath <bug1@optushome.com.au> 1 June 2000
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
typedef struct ar_headers_s {
|
||||
char *name;
|
||||
size_t size;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
mode_t mode;
|
||||
time_t mtime;
|
||||
off_t offset;
|
||||
struct ar_headers_s *next;
|
||||
} ar_headers_t;
|
||||
|
||||
/*
|
||||
* return the headerL_t struct for the filename descriptor
|
||||
*/
|
||||
extern ar_headers_t get_headers(int srcFd)
|
||||
{
|
||||
typedef struct raw_ar_header_s { /* Byte Offset */
|
||||
char name[16]; /* 0-15 */
|
||||
char date[12]; /* 16-27 */
|
||||
char uid[6];
|
||||
char gid[6]; /* 28-39 */
|
||||
char mode[8]; /* 40-47 */
|
||||
char size[10]; /* 48-57 */
|
||||
char fmag[2]; /* 58-59 */
|
||||
} raw_ar_header_t;
|
||||
raw_ar_header_t raw_ar_header;
|
||||
|
||||
ar_headers_t *head, *entry;
|
||||
char ar_magic[8];
|
||||
char *long_name=NULL;
|
||||
|
||||
head = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
entry = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
|
||||
/* check ar magic */
|
||||
if (full_read(srcFd, ar_magic, 8) != 8)
|
||||
error_msg_and_die("cannot read magic\n");
|
||||
if (strncmp(ar_magic,"!<arch>",7) != 0)
|
||||
error_msg_and_die("invalid magic\n");
|
||||
|
||||
while (full_read(srcFd, (char *) &raw_ar_header, 60)==60) {
|
||||
/* check the end of header markers are valid */
|
||||
if ((raw_ar_header.fmag[0]!='`') || (raw_ar_header.fmag[1]!='\n')) {
|
||||
char newline[1];
|
||||
if (raw_ar_header.fmag[1]!='`') {
|
||||
break;
|
||||
}
|
||||
/* some version of ar, have an extra '\n' after each entry */
|
||||
read(srcFd, newline, 1);
|
||||
if (newline[0]!='\n') {
|
||||
break;
|
||||
}
|
||||
/* fix up the header, we started reading 1 byte too early due to a '\n' */
|
||||
memmove((char *) &raw_ar_header, (char *)&raw_ar_header+1, 59);
|
||||
/* dont worry about adding the last '\n', we dont need it now */
|
||||
}
|
||||
|
||||
entry->size = (size_t) atoi(raw_ar_header.size);
|
||||
/* long filenames have '/' as the first character */
|
||||
if (raw_ar_header.name[0] == '/') {
|
||||
if (raw_ar_header.name[1] == '/') {
|
||||
/* multiple long filenames are stored as data in one entry */
|
||||
long_name = (char *) xrealloc(long_name, entry->size);
|
||||
full_read(srcFd, long_name, entry->size);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
/* The number after the '/' indicates the offset in the ar data section
|
||||
(saved in variable long_name) that conatains the real filename */
|
||||
const int long_name_offset = (int) atoi((char *) &raw_ar_header.name[1]);
|
||||
entry->name = xmalloc(strlen(&long_name[long_name_offset]));
|
||||
strcpy(entry->name, &long_name[long_name_offset]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* short filenames */
|
||||
entry->name = xmalloc(16);
|
||||
strncpy(entry->name, raw_ar_header.name, 16);
|
||||
}
|
||||
entry->name[strcspn(entry->name, " /")]='\0';
|
||||
|
||||
/* convert the rest of the now valid char header to its typed struct */
|
||||
parse_mode(raw_ar_header.mode, &entry->mode);
|
||||
entry->mtime = atoi(raw_ar_header.date);
|
||||
entry->uid = atoi(raw_ar_header.uid);
|
||||
entry->gid = atoi(raw_ar_header.gid);
|
||||
entry->offset = lseek(srcFd, 0, SEEK_CUR);
|
||||
|
||||
/* add this entries header to our combined list */
|
||||
entry->next = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
*entry->next = *head;
|
||||
*head = *entry;
|
||||
lseek(srcFd, (off_t) entry->size, SEEK_CUR);
|
||||
}
|
||||
return(*head);
|
||||
}
|
||||
|
||||
extern int ar_main(int argc, char **argv)
|
||||
{
|
||||
const int preserve_date = 1; /* preserve original dates */
|
||||
const int verbose = 2; /* be verbose */
|
||||
const int display = 4; /* display contents */
|
||||
const int extract_to_file = 8; /* extract contents of archive */
|
||||
const int extract_to_stdout = 16; /* extract to stdout */
|
||||
|
||||
int funct = 0, opt=0;
|
||||
int srcFd=0, dstFd=0;
|
||||
|
||||
ar_headers_t head, *extract_list=NULL;
|
||||
|
||||
extract_list = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
|
||||
while ((opt = getopt(argc, argv, "ovtpx")) != -1) {
|
||||
switch (opt) {
|
||||
case 'o':
|
||||
funct |= preserve_date;
|
||||
break;
|
||||
case 'v':
|
||||
funct |= verbose;
|
||||
break;
|
||||
case 't':
|
||||
funct |= display;
|
||||
break;
|
||||
case 'p':
|
||||
funct |= extract_to_stdout;
|
||||
break;
|
||||
case 'x':
|
||||
funct |= extract_to_file;
|
||||
break;
|
||||
default:
|
||||
usage(ar_usage);
|
||||
}
|
||||
}
|
||||
|
||||
/* check the src filename was specified */
|
||||
if (optind == argc)
|
||||
usage(ar_usage);
|
||||
|
||||
if ( (srcFd = open(argv[optind], O_RDONLY)) < 0)
|
||||
error_msg_and_die("Cannot read %s\n", argv[optind]);
|
||||
|
||||
optind++;
|
||||
head = get_headers(srcFd);
|
||||
|
||||
/* find files to extract or display */
|
||||
/* search through argv and build extract list */
|
||||
for (;optind<argc; optind++) {
|
||||
ar_headers_t *ar_entry;
|
||||
ar_entry = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
ar_entry = &head;
|
||||
while (ar_entry->next != NULL) {
|
||||
if (strcmp(argv[optind], ar_entry->name) == 0) {
|
||||
ar_headers_t *tmp;
|
||||
tmp = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
*tmp = *extract_list;
|
||||
*extract_list = *ar_entry;
|
||||
extract_list->next = tmp;
|
||||
break;
|
||||
}
|
||||
ar_entry=ar_entry->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* if individual files not found extract all files */
|
||||
if (extract_list->next==NULL) {
|
||||
extract_list = &head;
|
||||
}
|
||||
|
||||
/* find files to extract or display */
|
||||
while (extract_list->next != NULL) {
|
||||
if (funct & extract_to_file) {
|
||||
dstFd = open(extract_list->name, O_WRONLY | O_CREAT, extract_list->mode);
|
||||
}
|
||||
else if (funct & extract_to_stdout) {
|
||||
dstFd = fileno(stdout);
|
||||
}
|
||||
if ((funct & extract_to_file) || (funct & extract_to_stdout)) {
|
||||
lseek(srcFd, extract_list->offset, SEEK_SET);
|
||||
copy_file_chunk(srcFd, dstFd, (size_t) extract_list->size);
|
||||
}
|
||||
if (funct & verbose) {
|
||||
printf("%s %d/%d %8d %s ", mode_string(extract_list->mode),
|
||||
extract_list->uid, extract_list->gid,
|
||||
extract_list->size, time_string(extract_list->mtime));
|
||||
}
|
||||
if ((funct & display) || (funct & verbose)){
|
||||
printf("%s\n", extract_list->name);
|
||||
}
|
||||
extract_list=extract_list->next;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
TOPDIR:= ../
|
||||
ARCHIVAL_DIR:=./
|
||||
include $(TOPDIR).config
|
||||
include $(TOPDIR)Rules.mak
|
||||
include Makefile.in
|
||||
all: $(libraries-y)
|
||||
-include $(TOPDIR).depend
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a $(AR_TARGET)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
ARCHIVAL_AR:=archival.a
|
||||
ifndef $(ARCHIVAL_DIR)
|
||||
ARCHIVAL_DIR:=$(TOPDIR)archival/
|
||||
endif
|
||||
|
||||
ARCHIVAL-y:=
|
||||
ARCHIVAL-$(CONFIG_AR) += ar.o
|
||||
ARCHIVAL-$(CONFIG_BUNZIP2) += bunzip2.o
|
||||
ARCHIVAL-$(CONFIG_CPIO) += cpio.o
|
||||
ARCHIVAL-$(CONFIG_DPKG) += dpkg.o
|
||||
ARCHIVAL-$(CONFIG_DPKG_DEB) += dpkg_deb.o
|
||||
ARCHIVAL-$(CONFIG_GUNZIP) += gunzip.o
|
||||
ARCHIVAL-$(CONFIG_GZIP) += gzip.o
|
||||
ARCHIVAL-$(CONFIG_RPM2CPIO) += rpm2cpio.o
|
||||
ARCHIVAL-$(CONFIG_TAR) += tar.o
|
||||
ARCHIVAL-$(CONFIG_UNZIP) += unzip.o
|
||||
|
||||
libraries-y+=$(ARCHIVAL_DIR)$(ARCHIVAL_AR)
|
||||
|
||||
$(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
|
||||
$(AR) -ro $@ $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
|
||||
|
||||
+98
-169
@@ -21,203 +21,132 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* There is no signle standard to adhere to so ar may not portable
|
||||
* between different systems
|
||||
* http://www.unix-systems.org/single_unix_specification_v2/xcu/ar.html
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <fnmatch.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <utime.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include "unarchive.h"
|
||||
#include "busybox.h"
|
||||
|
||||
typedef struct ar_headers_s {
|
||||
char *name;
|
||||
size_t size;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
mode_t mode;
|
||||
time_t mtime;
|
||||
off_t offset;
|
||||
struct ar_headers_s *next;
|
||||
} ar_headers_t;
|
||||
|
||||
/*
|
||||
* return the headerL_t struct for the filename descriptor
|
||||
*/
|
||||
extern ar_headers_t get_headers(int srcFd)
|
||||
static void header_verbose_list_ar(const file_header_t *file_header)
|
||||
{
|
||||
typedef struct raw_ar_header_s { /* Byte Offset */
|
||||
char name[16]; /* 0-15 */
|
||||
char date[12]; /* 16-27 */
|
||||
char uid[6];
|
||||
char gid[6]; /* 28-39 */
|
||||
char mode[8]; /* 40-47 */
|
||||
char size[10]; /* 48-57 */
|
||||
char fmag[2]; /* 58-59 */
|
||||
} raw_ar_header_t;
|
||||
raw_ar_header_t raw_ar_header;
|
||||
const char *mode = mode_string(file_header->mode);
|
||||
char *mtime;
|
||||
|
||||
ar_headers_t *head, *entry;
|
||||
char ar_magic[8];
|
||||
char *long_name=NULL;
|
||||
|
||||
head = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
entry = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
|
||||
/* check ar magic */
|
||||
if (full_read(srcFd, ar_magic, 8) != 8)
|
||||
error_msg_and_die("cannot read magic\n");
|
||||
if (strncmp(ar_magic,"!<arch>",7) != 0)
|
||||
error_msg_and_die("invalid magic\n");
|
||||
|
||||
while (full_read(srcFd, (char *) &raw_ar_header, 60)==60) {
|
||||
/* check the end of header markers are valid */
|
||||
if ((raw_ar_header.fmag[0]!='`') || (raw_ar_header.fmag[1]!='\n')) {
|
||||
char newline[1];
|
||||
if (raw_ar_header.fmag[1]!='`') {
|
||||
break;
|
||||
}
|
||||
/* some version of ar, have an extra '\n' after each entry */
|
||||
read(srcFd, newline, 1);
|
||||
if (newline[0]!='\n') {
|
||||
break;
|
||||
}
|
||||
/* fix up the header, we started reading 1 byte too early due to a '\n' */
|
||||
memmove((char *) &raw_ar_header, (char *)&raw_ar_header+1, 59);
|
||||
/* dont worry about adding the last '\n', we dont need it now */
|
||||
}
|
||||
|
||||
entry->size = (size_t) atoi(raw_ar_header.size);
|
||||
/* long filenames have '/' as the first character */
|
||||
if (raw_ar_header.name[0] == '/') {
|
||||
if (raw_ar_header.name[1] == '/') {
|
||||
/* multiple long filenames are stored as data in one entry */
|
||||
long_name = (char *) xrealloc(long_name, entry->size);
|
||||
full_read(srcFd, long_name, entry->size);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
/* The number after the '/' indicates the offset in the ar data section
|
||||
(saved in variable long_name) that conatains the real filename */
|
||||
const int long_name_offset = (int) atoi((char *) &raw_ar_header.name[1]);
|
||||
entry->name = xmalloc(strlen(&long_name[long_name_offset]));
|
||||
strcpy(entry->name, &long_name[long_name_offset]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* short filenames */
|
||||
entry->name = xmalloc(16);
|
||||
strncpy(entry->name, raw_ar_header.name, 16);
|
||||
}
|
||||
entry->name[strcspn(entry->name, " /")]='\0';
|
||||
|
||||
/* convert the rest of the now valid char header to its typed struct */
|
||||
parse_mode(raw_ar_header.mode, &entry->mode);
|
||||
entry->mtime = atoi(raw_ar_header.date);
|
||||
entry->uid = atoi(raw_ar_header.uid);
|
||||
entry->gid = atoi(raw_ar_header.gid);
|
||||
entry->offset = lseek(srcFd, 0, SEEK_CUR);
|
||||
|
||||
/* add this entries header to our combined list */
|
||||
entry->next = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
*entry->next = *head;
|
||||
*head = *entry;
|
||||
lseek(srcFd, (off_t) entry->size, SEEK_CUR);
|
||||
}
|
||||
return(*head);
|
||||
mtime = ctime(&file_header->mtime);
|
||||
mtime[16] = ' ';
|
||||
memmove(&mtime[17], &mtime[20], 4);
|
||||
mtime[21] = '\0';
|
||||
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);
|
||||
}
|
||||
|
||||
#if defined CONFIG_TAR | defined CONFIG_DPKG_DEB | defined CONFIG_CPIO
|
||||
/* This is simpler than data_extract_all */
|
||||
static void data_extract_regular_file(archive_handle_t *archive_handle)
|
||||
{
|
||||
file_header_t *file_header;
|
||||
int dst_fd;
|
||||
|
||||
file_header = archive_handle->file_header;
|
||||
dst_fd = xopen(file_header->name, O_WRONLY | O_CREAT);
|
||||
copy_file_chunk_fd(archive_handle->src_fd, dst_fd, file_header->size);
|
||||
close(dst_fd);
|
||||
|
||||
chmod(file_header->name, file_header->mode);
|
||||
chown(file_header->name, file_header->uid, file_header->gid);
|
||||
|
||||
if (archive_handle->flags & ARCHIVE_PRESERVE_DATE) {
|
||||
struct utimbuf t;
|
||||
t.actime = t.modtime = file_header->mtime;
|
||||
utime(file_header->name, &t);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int ar_main(int argc, char **argv)
|
||||
{
|
||||
const int preserve_date = 1; /* preserve original dates */
|
||||
const int verbose = 2; /* be verbose */
|
||||
const int display = 4; /* display contents */
|
||||
const int extract_to_file = 8; /* extract contents of archive */
|
||||
const int extract_to_stdout = 16; /* extract to stdout */
|
||||
archive_handle_t *archive_handle;
|
||||
int opt;
|
||||
|
||||
int funct = 0, opt=0;
|
||||
int srcFd=0, dstFd=0;
|
||||
#ifndef CONFIG_DPKG_DEB
|
||||
char magic[8];
|
||||
#endif
|
||||
#if defined CONFIG_TAR | defined CONFIG_DPKG_DEB | defined CONFIG_CPIO
|
||||
archive_handle = init_handle();
|
||||
#else
|
||||
archive_handle = xcalloc(1, sizeof(archive_handle_t));
|
||||
archive_handle->filter = filter_accept_all;
|
||||
archive_handle->action_data = data_skip;
|
||||
archive_handle->action_header = header_skip;
|
||||
archive_handle->file_header =xmalloc(sizeof(file_header_t));
|
||||
#endif
|
||||
|
||||
ar_headers_t head, *extract_list=NULL;
|
||||
|
||||
extract_list = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
|
||||
while ((opt = getopt(argc, argv, "ovtpx")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "covtpxX")) != -1) {
|
||||
switch (opt) {
|
||||
case 'o':
|
||||
funct |= preserve_date;
|
||||
case 'p': /* print */
|
||||
archive_handle->action_data = data_extract_to_stdout;
|
||||
break;
|
||||
case 'v':
|
||||
funct |= verbose;
|
||||
case 't': /* list contents */
|
||||
archive_handle->action_header = header_list;
|
||||
break;
|
||||
case 't':
|
||||
funct |= display;
|
||||
case 'X':
|
||||
archive_handle->action_header = header_verbose_list_ar;
|
||||
case 'x': /* extract */
|
||||
#if defined CONFIG_TAR | defined CONFIG_DPKG_DEB | defined CONFIG_CPIO
|
||||
archive_handle->action_data = data_extract_all;
|
||||
#else
|
||||
archive_handle->action_data = data_extract_regular_file;
|
||||
#endif
|
||||
break;
|
||||
case 'p':
|
||||
funct |= extract_to_stdout;
|
||||
/* Modifiers */
|
||||
case 'o': /* preserve original dates */
|
||||
archive_handle->flags |= ARCHIVE_PRESERVE_DATE;
|
||||
break;
|
||||
case 'x':
|
||||
funct |= extract_to_file;
|
||||
case 'v': /* verbose */
|
||||
archive_handle->action_header = header_verbose_list_ar;
|
||||
break;
|
||||
default:
|
||||
usage(ar_usage);
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
/* check the src filename was specified */
|
||||
if (optind == argc)
|
||||
usage(ar_usage);
|
||||
|
||||
if ( (srcFd = open(argv[optind], O_RDONLY)) < 0)
|
||||
error_msg_and_die("Cannot read %s\n", argv[optind]);
|
||||
|
||||
optind++;
|
||||
head = get_headers(srcFd);
|
||||
|
||||
/* find files to extract or display */
|
||||
/* search through argv and build extract list */
|
||||
for (;optind<argc; optind++) {
|
||||
ar_headers_t *ar_entry;
|
||||
ar_entry = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
ar_entry = &head;
|
||||
while (ar_entry->next != NULL) {
|
||||
if (strcmp(argv[optind], ar_entry->name) == 0) {
|
||||
ar_headers_t *tmp;
|
||||
tmp = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
*tmp = *extract_list;
|
||||
*extract_list = *ar_entry;
|
||||
extract_list->next = tmp;
|
||||
break;
|
||||
}
|
||||
ar_entry=ar_entry->next;
|
||||
}
|
||||
if (optind == argc) {
|
||||
show_usage();
|
||||
}
|
||||
|
||||
/* if individual files not found extract all files */
|
||||
if (extract_list->next==NULL) {
|
||||
extract_list = &head;
|
||||
archive_handle->src_fd = xopen(argv[optind++], O_RDONLY);
|
||||
|
||||
/* TODO: This is the same as in tar, seperate function ? */
|
||||
while (optind < argc) {
|
||||
archive_handle->filter = filter_accept_list;
|
||||
archive_handle->accept = add_to_list(archive_handle->accept, argv[optind]);
|
||||
optind++;
|
||||
}
|
||||
|
||||
/* find files to extract or display */
|
||||
while (extract_list->next != NULL) {
|
||||
if (funct & extract_to_file) {
|
||||
dstFd = open(extract_list->name, O_WRONLY | O_CREAT, extract_list->mode);
|
||||
}
|
||||
else if (funct & extract_to_stdout) {
|
||||
dstFd = fileno(stdout);
|
||||
}
|
||||
if ((funct & extract_to_file) || (funct & extract_to_stdout)) {
|
||||
lseek(srcFd, extract_list->offset, SEEK_SET);
|
||||
copy_file_chunk(srcFd, dstFd, (size_t) extract_list->size);
|
||||
}
|
||||
if (funct & verbose) {
|
||||
printf("%s %d/%d %8d %s ", mode_string(extract_list->mode),
|
||||
extract_list->uid, extract_list->gid,
|
||||
extract_list->size, time_string(extract_list->mtime));
|
||||
}
|
||||
if ((funct & display) || (funct & verbose)){
|
||||
printf("%s\n", extract_list->name);
|
||||
}
|
||||
extract_list=extract_list->next;
|
||||
|
||||
#if defined CONFIG_DPKG_DEB
|
||||
unpack_ar_archive(archive_handle);
|
||||
#else
|
||||
xread_all(archive_handle->src_fd, magic, 7);
|
||||
if (strncmp(magic, "!<arch>", 7) != 0) {
|
||||
error_msg_and_die("Invalid ar magic");
|
||||
}
|
||||
archive_handle->offset += 7;
|
||||
|
||||
while (get_header_ar(archive_handle) == EXIT_SUCCESS);
|
||||
#endif
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+1865
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see scripts/kbuild/config-language.txt.
|
||||
#
|
||||
|
||||
mainmenu_option next_comment
|
||||
comment 'Archival Utilities'
|
||||
|
||||
bool 'ar' CONFIG_AR
|
||||
if [ "$CONFIG_AR" = "y" ] ; then
|
||||
bool ' Enable support for long filenames (not need for debs)' CONFIG_FEATURE_AR_LONG_FILENAMES
|
||||
fi
|
||||
bool 'bunzip2' CONFIG_BUNZIP2
|
||||
bool 'cpio' CONFIG_CPIO
|
||||
bool 'dpkg' CONFIG_DPKG
|
||||
bool 'dpkg_deb' CONFIG_DPKG_DEB
|
||||
if [ "$CONFIG_DPKG_DEB" = "y" ] ; then
|
||||
bool ' -x support only' CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||
fi
|
||||
bool 'gunzip' CONFIG_GUNZIP
|
||||
bool 'gzip' CONFIG_GZIP
|
||||
bool 'rpm2cpio' CONFIG_RPM2CPIO
|
||||
bool 'tar' CONFIG_TAR
|
||||
if [ "$CONFIG_TAR" = "y" ] ; then
|
||||
bool ' Enable archive creation' CONFIG_FEATURE_TAR_CREATE
|
||||
bool ' Enable -X and --exclude options (exclude files)' CONFIG_FEATURE_TAR_EXCLUDE
|
||||
bool ' Enable -z option' CONFIG_FEATURE_TAR_GZIP
|
||||
bool ' Enable support for old tar header format' CONFIG_FEATURE_TAR_OLD_FORMAT
|
||||
bool ' Enable support for GNU long filenames' CONFIG_FEATURE_GNUTAR_LONG_FILENAME
|
||||
fi
|
||||
if [ "$CONFIG_CPIO" = "y" -o "$CONFIG_TAR" = "y" ] ; then
|
||||
bool ' Enable tape drive support' CONFIG_FEATURE_UNARCHIVE_TAPE
|
||||
fi
|
||||
bool 'unzip' CONFIG_UNZIP
|
||||
endmenu
|
||||
+240
@@ -0,0 +1,240 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini cpio implementation for busybox
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Limitations:
|
||||
* Doesn't check CRC's
|
||||
* Only supports new ASCII and CRC formats
|
||||
*
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "unarchive.h"
|
||||
#include "busybox.h"
|
||||
|
||||
typedef struct hardlinks_s {
|
||||
file_header_t *entry;
|
||||
int inode;
|
||||
struct hardlinks_s *next;
|
||||
} hardlinks_t;
|
||||
|
||||
extern int cpio_main(int argc, char **argv)
|
||||
{
|
||||
archive_handle_t *archive_handle;
|
||||
int opt;
|
||||
|
||||
/* Initialise */
|
||||
archive_handle = init_handle();
|
||||
archive_handle->src_fd = fileno(stdin);
|
||||
archive_handle->action_header = header_list;
|
||||
|
||||
while ((opt = getopt(argc, argv, "idmuvtF:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'i': /* extract */
|
||||
archive_handle->action_data = data_extract_all;
|
||||
break;
|
||||
case 'd': /* create _leading_ directories */
|
||||
archive_handle->flags |= ARCHIVE_CREATE_LEADING_DIRS;
|
||||
break;
|
||||
case 'm': /* preserve modification time */
|
||||
archive_handle->flags |= ARCHIVE_PRESERVE_DATE;
|
||||
break;
|
||||
case 'v': /* verbosly list files */
|
||||
archive_handle->action_header = header_verbose_list;
|
||||
break;
|
||||
case 'u': /* unconditional */
|
||||
archive_handle->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
|
||||
break;
|
||||
case 't': /* list files */
|
||||
archive_handle->action_header = header_list;
|
||||
break;
|
||||
case 'F':
|
||||
archive_handle->src_fd = xopen(optarg, O_RDONLY);
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
while (optind < argc) {
|
||||
archive_handle->filter = filter_accept_list;
|
||||
archive_handle->accept = add_to_list(archive_handle->accept, argv[optind]);
|
||||
optind++;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
static hardlinks_t *saved_hardlinks = NULL;
|
||||
static unsigned short pending_hardlinks = 0;
|
||||
file_header_t *file_header = archive_handle->file_header;
|
||||
char cpio_header[110];
|
||||
int namesize;
|
||||
char dummy[16];
|
||||
int major, minor, nlink, inode;
|
||||
char extract_flag;
|
||||
|
||||
if (pending_hardlinks) { /* Deal with any pending hardlinks */
|
||||
hardlinks_t *tmp;
|
||||
hardlinks_t *oldtmp;
|
||||
|
||||
tmp = saved_hardlinks;
|
||||
oldtmp = NULL;
|
||||
|
||||
while (tmp) {
|
||||
error_msg_and_die("need to fix this\n");
|
||||
if (tmp->entry->link_name) { /* Found a hardlink ready to be extracted */
|
||||
file_header = tmp->entry;
|
||||
if (oldtmp) {
|
||||
oldtmp->next = tmp->next; /* Remove item from linked list */
|
||||
} else {
|
||||
saved_hardlinks = tmp->next;
|
||||
}
|
||||
free(tmp);
|
||||
continue;
|
||||
}
|
||||
oldtmp = tmp;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
pending_hardlinks = 0; /* No more pending hardlinks, read next file entry */
|
||||
}
|
||||
|
||||
/* There can be padding before archive header */
|
||||
archive_handle->offset += data_align(archive_handle->src_fd, archive_handle->offset, 4);
|
||||
|
||||
if (xread_all_eof(archive_handle->src_fd, cpio_header, 110) == 0) {
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
archive_handle->offset += 110;
|
||||
|
||||
if (strncmp(&cpio_header[0], "07070", 5) != 0) {
|
||||
printf("cpio header is %x-%x-%x-%x-%x\n",
|
||||
cpio_header[0],
|
||||
cpio_header[1],
|
||||
cpio_header[2],
|
||||
cpio_header[3],
|
||||
cpio_header[4]);
|
||||
error_msg_and_die("Unsupported cpio format");
|
||||
}
|
||||
|
||||
if ((cpio_header[5] != '1') && (cpio_header[5] != '2')) {
|
||||
error_msg_and_die("Unsupported cpio format, use newc or crc");
|
||||
}
|
||||
|
||||
sscanf(cpio_header, "%6c%8x%8x%8x%8x%8x%8lx%8lx%16c%8x%8x%8x%8c",
|
||||
dummy, &inode, (unsigned int*)&file_header->mode,
|
||||
(unsigned int*)&file_header->uid, (unsigned int*)&file_header->gid,
|
||||
&nlink, &file_header->mtime, &file_header->size,
|
||||
dummy, &major, &minor, &namesize, dummy);
|
||||
|
||||
file_header->name = (char *) xmalloc(namesize + 1);
|
||||
xread(archive_handle->src_fd, file_header->name, namesize); /* Read in filename */
|
||||
file_header->name[namesize] = '\0';
|
||||
archive_handle->offset += namesize;
|
||||
|
||||
/* Update offset amount and skip padding before file contents */
|
||||
archive_handle->offset += data_align(archive_handle->src_fd, archive_handle->offset, 4);
|
||||
|
||||
if (strcmp(file_header->name, "TRAILER!!!") == 0) {
|
||||
printf("%d blocks\n", (int) (archive_handle->offset % 512 ? (archive_handle->offset / 512) + 1 : archive_handle->offset / 512)); /* Always round up */
|
||||
if (saved_hardlinks) { /* Bummer - we still have unresolved hardlinks */
|
||||
hardlinks_t *tmp = saved_hardlinks;
|
||||
hardlinks_t *oldtmp = NULL;
|
||||
while (tmp) {
|
||||
error_msg("%s not created: cannot resolve hardlink", tmp->entry->name);
|
||||
oldtmp = tmp;
|
||||
tmp = tmp->next;
|
||||
free (oldtmp->entry->name);
|
||||
free (oldtmp->entry);
|
||||
free (oldtmp);
|
||||
}
|
||||
saved_hardlinks = NULL;
|
||||
pending_hardlinks = 0;
|
||||
}
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (S_ISLNK(file_header->mode)) {
|
||||
file_header->link_name = (char *) xmalloc(file_header->size + 1);
|
||||
xread(archive_handle->src_fd, file_header->link_name, file_header->size);
|
||||
file_header->link_name[file_header->size] = '\0';
|
||||
archive_handle->offset += file_header->size;
|
||||
file_header->size = 0; /* Stop possible seeks in future */
|
||||
}
|
||||
if (nlink > 1 && !S_ISDIR(file_header->mode)) {
|
||||
if (file_header->size == 0) { /* Put file on a linked list for later */
|
||||
hardlinks_t *new = xmalloc(sizeof(hardlinks_t));
|
||||
new->next = saved_hardlinks;
|
||||
new->inode = inode;
|
||||
new->entry = file_header;
|
||||
saved_hardlinks = new;
|
||||
continue;
|
||||
} else { /* Found the file with data in */
|
||||
hardlinks_t *tmp = saved_hardlinks;
|
||||
pending_hardlinks = 1;
|
||||
while (tmp) {
|
||||
if (tmp->inode == inode) {
|
||||
tmp->entry->link_name = xstrdup(file_header->name);
|
||||
nlink--;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
if (nlink > 1) {
|
||||
error_msg("error resolving hardlink: did you create the archive with GNU cpio 2.0-2.2?");
|
||||
}
|
||||
}
|
||||
}
|
||||
file_header->device = (major << 8) | minor;
|
||||
|
||||
extract_flag = FALSE;
|
||||
if (archive_handle->filter(archive_handle->accept, archive_handle->reject, file_header->name) == EXIT_SUCCESS) {
|
||||
struct stat statbuf;
|
||||
|
||||
extract_flag = TRUE;
|
||||
|
||||
/* Check if the file already exists */
|
||||
if (lstat (file_header->name, &statbuf) == 0) {
|
||||
if ((archive_handle->flags & ARCHIVE_EXTRACT_UNCONDITIONAL) || (statbuf.st_mtime < file_header->mtime)) {
|
||||
/* Remove file if flag set or its older than the file to be extracted */
|
||||
if (unlink(file_header->name) == -1) {
|
||||
perror_msg_and_die("Couldnt remove old file");
|
||||
}
|
||||
} else {
|
||||
if (! archive_handle->flags & ARCHIVE_EXTRACT_QUIET) {
|
||||
error_msg("%s not created: newer or same age file exists", file_header->name);
|
||||
}
|
||||
extract_flag = FALSE;
|
||||
}
|
||||
}
|
||||
archive_handle->action_header(file_header);
|
||||
}
|
||||
|
||||
archive_handle->action_header(file_header);
|
||||
if (extract_flag) {
|
||||
archive_handle->action_data(archive_handle);
|
||||
} else {
|
||||
data_skip(archive_handle);
|
||||
}
|
||||
archive_handle->offset += file_header->size;
|
||||
}
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
+1599
File diff suppressed because it is too large.
Load diff
+73
-124
@@ -13,151 +13,100 @@
|
||||
* 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 <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include "unarchive.h"
|
||||
#include "busybox.h"
|
||||
|
||||
typedef struct ar_headers_s {
|
||||
char *name;
|
||||
size_t size;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
mode_t mode;
|
||||
time_t mtime;
|
||||
off_t offset;
|
||||
struct ar_headers_s *next;
|
||||
} ar_headers_t;
|
||||
|
||||
extern ar_headers_t get_headers(int srcFd);
|
||||
extern int tar_unzip_init(int tarFd);
|
||||
extern int readTarFile(int tarFd, int extractFlag, int listFlag,
|
||||
int tostdoutFlag, int verboseFlag, char** extractList,
|
||||
char** excludeList);
|
||||
|
||||
extern int dpkg_deb_main(int argc, char **argv)
|
||||
{
|
||||
const int dpkg_deb_contents = 1;
|
||||
const int dpkg_deb_control = 2;
|
||||
// const int dpkg_deb_info = 4;
|
||||
const int dpkg_deb_extract = 8;
|
||||
const int dpkg_deb_verbose_extract = 16;
|
||||
int opt=0;
|
||||
int optflag=0;
|
||||
int extract_flag = FALSE;
|
||||
int list_flag = FALSE;
|
||||
int verbose_flag = FALSE;
|
||||
int extract_to_stdout = FALSE;
|
||||
char ar_filename[15];
|
||||
int srcFd=0;
|
||||
int status=0;
|
||||
ar_headers_t *ar_headers = NULL;
|
||||
char **extract_list=NULL;
|
||||
char *target_dir=NULL;
|
||||
archive_handle_t *ar_archive;
|
||||
archive_handle_t *tar_gz_archive;
|
||||
int opt = 0;
|
||||
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||
const llist_t *control_tar_gz_llist = add_to_list(NULL, "control.tar.gz");
|
||||
#endif
|
||||
#ifndef CONFIG_AR
|
||||
char magic[7];
|
||||
#endif
|
||||
|
||||
while ((opt = getopt(argc, argv, "cexX")) != -1) {
|
||||
/* a .deb file is an ar archive that contain three files,
|
||||
* data.tar.gz, control.tar.gz and debian
|
||||
*/
|
||||
|
||||
/* Setup the tar archive handle */
|
||||
tar_gz_archive = init_handle();
|
||||
|
||||
/* Setup an ar archive handle that refers to the gzip sub archive */
|
||||
ar_archive = init_handle();
|
||||
ar_archive->action_data_subarchive = get_header_tar_gz;
|
||||
ar_archive->sub_archive = tar_gz_archive;
|
||||
ar_archive->filter = filter_accept_list;
|
||||
ar_archive->accept = add_to_list(NULL, "data.tar.gz");
|
||||
|
||||
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||
while ((opt = getopt(argc, argv, "cefXx")) != -1) {
|
||||
#else
|
||||
while ((opt = getopt(argc, argv, "x")) != -1) {
|
||||
#endif
|
||||
switch (opt) {
|
||||
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
|
||||
case 'c':
|
||||
optflag |= dpkg_deb_contents;
|
||||
tar_gz_archive->action_header = header_verbose_list;
|
||||
break;
|
||||
case 'e':
|
||||
optflag |= dpkg_deb_control;
|
||||
ar_archive->accept = control_tar_gz_llist;
|
||||
tar_gz_archive->action_data = data_extract_all;
|
||||
break;
|
||||
/* case 'I':
|
||||
optflag |= dpkg_deb_info;
|
||||
break;
|
||||
*/
|
||||
case 'x':
|
||||
optflag |= dpkg_deb_extract;
|
||||
case 'f':
|
||||
/* Print the entire control file
|
||||
* it should accept a second argument which specifies a
|
||||
* specific field to print */
|
||||
ar_archive->accept = control_tar_gz_llist;
|
||||
tar_gz_archive->accept = add_to_list(NULL, "./control");;
|
||||
tar_gz_archive->filter = filter_accept_list;
|
||||
tar_gz_archive->action_data = data_extract_to_stdout;
|
||||
break;
|
||||
case 'X':
|
||||
optflag |= dpkg_deb_verbose_extract;
|
||||
tar_gz_archive->action_header = header_list;
|
||||
#endif
|
||||
case 'x':
|
||||
tar_gz_archive->action_data = data_extract_all;
|
||||
break;
|
||||
default:
|
||||
usage(dpkg_deb_usage);
|
||||
return EXIT_FAILURE;
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (((optind + 1 ) > argc) || (optflag == 0)) {
|
||||
usage(dpkg_deb_usage);
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (optflag & dpkg_deb_contents) {
|
||||
list_flag = TRUE;
|
||||
verbose_flag = TRUE;
|
||||
strcpy(ar_filename, "data.tar.gz");
|
||||
}
|
||||
else if (optflag & dpkg_deb_control) {
|
||||
extract_flag = TRUE;
|
||||
strcpy(ar_filename, "control.tar.gz");
|
||||
if ( (optind + 1) == argc ) {
|
||||
target_dir = (char *) xmalloc(7);
|
||||
strcpy(target_dir, "DEBIAN");
|
||||
}
|
||||
else {
|
||||
target_dir = (char *) xmalloc(strlen(argv[optind+1]));
|
||||
|
||||
strcpy(target_dir, argv[optind+1]);
|
||||
}
|
||||
}
|
||||
/* else if (optflag & dpkg_deb_info) {
|
||||
extract_flag = TRUE;
|
||||
extract_to_stdout = TRUE;
|
||||
strcpy(ar_filename, "control.tar.gz");
|
||||
extract_list = argv+optind+1;
|
||||
printf("list one is [%s]\n",extract_list[0]);
|
||||
}
|
||||
*/
|
||||
else if (optflag & dpkg_deb_extract) {
|
||||
extract_flag = TRUE;
|
||||
strcpy(ar_filename, "data.tar.gz");
|
||||
if ( (optind + 2) > argc ) {
|
||||
error_msg_and_die("No directory specified\n");
|
||||
}
|
||||
target_dir = (char *) xmalloc(strlen(argv[optind+1]));
|
||||
strcpy(target_dir, argv[optind+1]);
|
||||
}
|
||||
else if (optflag & dpkg_deb_verbose_extract) {
|
||||
extract_flag = TRUE;
|
||||
list_flag = TRUE;
|
||||
strcpy(ar_filename, "data.tar.gz");
|
||||
if ( (optind + 2) > argc ) {
|
||||
error_msg_and_die("No directory specified\n");
|
||||
}
|
||||
target_dir = (char *) xmalloc(strlen(argv[optind+1]));
|
||||
strcpy(target_dir, argv[optind+1]);
|
||||
}
|
||||
|
||||
ar_headers = (ar_headers_t *) xmalloc(sizeof(ar_headers_t));
|
||||
srcFd = open(argv[optind], O_RDONLY);
|
||||
|
||||
*ar_headers = get_headers(srcFd);
|
||||
if (ar_headers->next==NULL)
|
||||
error_msg_and_die("Couldnt find %s in %s\n",ar_filename, argv[optind]);
|
||||
|
||||
while (ar_headers->next != NULL) {
|
||||
if (strcmp(ar_headers->name, ar_filename)==0)
|
||||
break;
|
||||
ar_headers = ar_headers->next;
|
||||
if (optind + 2 < argc) {
|
||||
show_usage();
|
||||
}
|
||||
|
||||
lseek(srcFd, ar_headers->offset, SEEK_SET);
|
||||
srcFd = tar_unzip_init(srcFd);
|
||||
if ( target_dir != NULL) {
|
||||
if (is_directory(target_dir, TRUE, NULL)==FALSE) {
|
||||
mkdir(target_dir, 0755);
|
||||
}
|
||||
if (chdir(target_dir)==-1) {
|
||||
error_msg_and_die("Cannot change to dir %s\n",argv[optind+1]);
|
||||
}
|
||||
tar_gz_archive->src_fd = ar_archive->src_fd = xopen(argv[optind++], O_RDONLY);
|
||||
|
||||
/* Workout where to extract the files */
|
||||
/* 2nd argument is a dir name */
|
||||
mkdir(argv[optind], 0777);
|
||||
chdir(argv[optind]);
|
||||
|
||||
#ifdef CONFIG_AR
|
||||
unpack_ar_archive(ar_archive);
|
||||
#else
|
||||
xread_all(ar_archive->src_fd, magic, 7);
|
||||
if (strncmp(magic, "!<arch>", 7) != 0) {
|
||||
error_msg_and_die("Invalid ar magic");
|
||||
}
|
||||
status = readTarFile(srcFd, extract_flag, list_flag, extract_to_stdout, verbose_flag, NULL, extract_list);
|
||||
close (srcFd);
|
||||
ar_archive->offset += 7;
|
||||
|
||||
while (get_header_ar(ar_archive) == EXIT_SUCCESS);
|
||||
#endif
|
||||
|
||||
/* Cleanup */
|
||||
close (ar_archive->src_fd);
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
+130
-1284
File diff suppressed because it is too large.
Load diff
+506
-1344
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,30 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
TOPDIR:= ../../
|
||||
LIBUNARCHIVE_DIR:=./
|
||||
include $(TOPDIR).config
|
||||
include $(TOPDIR)Rules.mak
|
||||
include Makefile.in
|
||||
all: $(libraries-y)
|
||||
-include $(TOPDIR).depend
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a $(AR_TARGET)
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
LIBUNARCHIVE_AR:=libunarchive.a
|
||||
ifndef $(LIBUNARCHIVE_DIR)
|
||||
LIBUNARCHIVE_DIR:=$(TOPDIR)archival/libunarchive/
|
||||
endif
|
||||
|
||||
LIBUNARCHIVE-y:= \
|
||||
\
|
||||
data_skip.o \
|
||||
data_extract_all.o \
|
||||
data_extract_all_prefix.o \
|
||||
data_extract_to_stdout.o \
|
||||
data_extract_to_buffer.o \
|
||||
\
|
||||
filter_accept_all.o \
|
||||
filter_accept_list.o \
|
||||
filter_accept_reject_list.o \
|
||||
\
|
||||
get_header_ar.o \
|
||||
get_header_tar.o \
|
||||
get_header_tar_gz.o \
|
||||
\
|
||||
header_skip.o \
|
||||
header_list.o \
|
||||
header_verbose_list.o \
|
||||
\
|
||||
add_to_list.o \
|
||||
check_header_gzip.o \
|
||||
check_trailer_gzip.o \
|
||||
copy_file_chunk_fd.o \
|
||||
data_align.o \
|
||||
find_list_entry.o \
|
||||
init_handle.o \
|
||||
seek_sub_file.o \
|
||||
uncompress.o \
|
||||
unpack_ar_archive.o \
|
||||
unzip.o
|
||||
|
||||
LIBUNARCHIVE-$(CONFIG_DPKG) +=
|
||||
LIBUNARCHIVE-$(CONFIG_DPKG_DEB) +=
|
||||
LIBUNARCHIVE-$(CONFIG_AR) +=
|
||||
LIBUNARCHIVE-$(CONFIG_CPIO) +=
|
||||
LIBUNARCHIVE-$(CONFIG_GUNZIP) +=
|
||||
LIBUNARCHIVE-$(CONFIG_RPM2CPIO) +=
|
||||
LIBUNARCHIVE-$(CONFIG_TAR) +=
|
||||
LIBUNARCHIVE-$(CONFIG_UNZIP) +=
|
||||
|
||||
libraries-y+=$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR)
|
||||
|
||||
$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
|
||||
$(AR) -ro $@ $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "unarchive.h"
|
||||
#include "libbb.h"
|
||||
|
||||
extern const llist_t *add_to_list(const llist_t *old_head, const char *new_item)
|
||||
{
|
||||
llist_t *new_head;
|
||||
|
||||
new_head = xmalloc(sizeof(llist_t));
|
||||
new_head->data = new_item;
|
||||
new_head->link = old_head;
|
||||
|
||||
return(new_head);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "libbb.h"
|
||||
|
||||
extern void check_header_gzip(int src_fd)
|
||||
{
|
||||
union {
|
||||
unsigned char raw[8];
|
||||
struct {
|
||||
unsigned char method;
|
||||
unsigned char flags;
|
||||
unsigned int mtime;
|
||||
unsigned char xtra_flags;
|
||||
unsigned char os_flags;
|
||||
} formated;
|
||||
} header;
|
||||
|
||||
xread_all(src_fd, header.raw, 8);
|
||||
|
||||
/* Check the compression method */
|
||||
if (header.formated.method != 8) {
|
||||
error_msg_and_die("Unknown compression method %d",
|
||||
header.formated.method);
|
||||
}
|
||||
|
||||
if (header.formated.flags & 0x04) {
|
||||
/* bit 2 set: extra field present */
|
||||
unsigned char extra_short;
|
||||
|
||||
extra_short = xread_char(src_fd);
|
||||
extra_short += xread_char(src_fd) << 8;
|
||||
while (extra_short > 0) {
|
||||
/* Ignore extra field */
|
||||
xread_char(src_fd);
|
||||
extra_short--;
|
||||
}
|
||||
}
|
||||
|
||||
/* Discard original name if any */
|
||||
if (header.formated.flags & 0x08) {
|
||||
/* bit 3 set: original file name present */
|
||||
char tmp;
|
||||
|
||||
do {
|
||||
read(src_fd, &tmp, 1);
|
||||
} while (tmp != 0);
|
||||
}
|
||||
|
||||
/* Discard file comment if any */
|
||||
if (header.formated.flags & 0x10) {
|
||||
/* bit 4 set: file comment present */
|
||||
char tmp;
|
||||
|
||||
do {
|
||||
read(src_fd, &tmp, 1);
|
||||
} while (tmp != 0);
|
||||
}
|
||||
|
||||
/* Read the header checksum */
|
||||
if (header.formated.flags & 0x02) {
|
||||
char tmp;
|
||||
|
||||
read(src_fd, &tmp, 1);
|
||||
read(src_fd, &tmp, 1);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* busybox gunzip trailing header handler
|
||||
* Copyright Glenn McGrath 2002
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.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"
|
||||
|
||||
extern unsigned int gunzip_crc;
|
||||
extern unsigned int gunzip_bytes_out;
|
||||
extern unsigned char *gunzip_in_buffer;
|
||||
extern unsigned char gunzip_in_buffer_count;
|
||||
|
||||
extern void check_trailer_gzip(int src_fd)
|
||||
{
|
||||
|
||||
unsigned int stored_crc = 0;
|
||||
unsigned char count;
|
||||
|
||||
/* top up the input buffer with the rest of the trailer */
|
||||
xread_all(src_fd, &gunzip_in_buffer[gunzip_in_buffer_count], 8 - gunzip_in_buffer_count);
|
||||
for (count = 0; count != 4; count++) {
|
||||
stored_crc |= (gunzip_in_buffer[count] << (count * 8));
|
||||
}
|
||||
|
||||
/* Validate decompression - crc */
|
||||
if (stored_crc != (gunzip_crc ^ 0xffffffffL)) {
|
||||
error_msg("invalid compressed data--crc error");
|
||||
}
|
||||
|
||||
/* Validate decompression - size */
|
||||
if (gunzip_bytes_out !=
|
||||
(gunzip_in_buffer[4] | (gunzip_in_buffer[5] << 8) |
|
||||
(gunzip_in_buffer[6] << 16) | (gunzip_in_buffer[7] << 24))) {
|
||||
error_msg("invalid compressed data--length error");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include "libbb.h"
|
||||
|
||||
/* Copy CHUNKSIZE bytes (or untill EOF if chunksize == -1)
|
||||
* from SRC_FILE to DST_FILE. */
|
||||
extern int copy_file_chunk_fd(int src_fd, int dst_fd, off_t chunksize)
|
||||
{
|
||||
size_t nread, size;
|
||||
char buffer[BUFSIZ];
|
||||
|
||||
while (chunksize != 0) {
|
||||
if (chunksize > BUFSIZ) {
|
||||
size = BUFSIZ;
|
||||
} else {
|
||||
size = chunksize;
|
||||
}
|
||||
nread = xread(src_fd, buffer, size);
|
||||
if (nread == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (write (dst_fd, buffer, nread) != nread) {
|
||||
error_msg_and_die ("Short write");
|
||||
}
|
||||
|
||||
if (chunksize != -1) {
|
||||
chunksize -= nread;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include "unarchive.h"
|
||||
#include "libbb.h"
|
||||
|
||||
extern const unsigned short data_align(const int src_fd, const unsigned int offset, const unsigned short align_to)
|
||||
{
|
||||
const unsigned short skip_amount = (align_to - (offset % align_to)) % align_to;
|
||||
seek_sub_file(src_fd, skip_amount);
|
||||
|
||||
return(skip_amount);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <utime.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
extern void data_extract_all(archive_handle_t *archive_handle)
|
||||
{
|
||||
file_header_t *file_header = archive_handle->file_header;
|
||||
int dst_fd;
|
||||
int res;
|
||||
|
||||
if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) {
|
||||
char *name = xstrdup(file_header->name);
|
||||
make_directory (dirname(name), 0777, FILEUTILS_RECUR);
|
||||
free(name);
|
||||
}
|
||||
|
||||
/* Create the file */
|
||||
switch(file_header->mode & S_IFMT) {
|
||||
case S_IFREG: {
|
||||
#ifdef CONFIG_CPIO
|
||||
if (file_header->link_name) {
|
||||
/* hard link */
|
||||
res = link(file_header->link_name, file_header->name);
|
||||
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
|
||||
perror_msg("Couldnt create hard link");
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* Regular file */
|
||||
dst_fd = xopen(file_header->name, O_WRONLY | O_CREAT);
|
||||
copy_file_chunk_fd(archive_handle->src_fd, dst_fd, file_header->size);
|
||||
close(dst_fd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case S_IFDIR:
|
||||
res = mkdir(file_header->name, file_header->mode);
|
||||
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
|
||||
perror_msg("extract_archive: %s", file_header->name);
|
||||
}
|
||||
break;
|
||||
case S_IFLNK:
|
||||
/* Symlink */
|
||||
res = symlink(file_header->link_name, file_header->name);
|
||||
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
|
||||
perror_msg("Cannot create symlink from %s to '%s'", file_header->name, file_header->link_name);
|
||||
}
|
||||
break;
|
||||
case S_IFSOCK:
|
||||
case S_IFBLK:
|
||||
case S_IFCHR:
|
||||
case S_IFIFO:
|
||||
res = mknod(file_header->name, file_header->mode, file_header->device);
|
||||
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
|
||||
perror_msg("Cannot create node %s", file_header->name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
chmod(file_header->name, file_header->mode);
|
||||
chown(file_header->name, file_header->uid, file_header->gid);
|
||||
|
||||
if (archive_handle->flags & ARCHIVE_PRESERVE_DATE) {
|
||||
struct utimbuf t;
|
||||
t.actime = t.modtime = file_header->mtime;
|
||||
utime(file_header->name, &t);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <utime.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
extern void data_extract_all_prefix(archive_handle_t *archive_handle)
|
||||
{
|
||||
char *name_ptr = archive_handle->file_header->name;
|
||||
|
||||
name_ptr += strspn(name_ptr, "./");
|
||||
if (name_ptr[0] != '\0') {
|
||||
archive_handle->file_header->name = xmalloc(strlen(archive_handle->buffer) + 2 + strlen(name_ptr));
|
||||
sprintf(archive_handle->file_header->name, "%s%s", archive_handle->buffer, name_ptr);
|
||||
data_extract_all(archive_handle);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "unarchive.h"
|
||||
#include "libbb.h"
|
||||
|
||||
extern void data_extract_to_buffer(archive_handle_t *archive_handle)
|
||||
{
|
||||
archive_handle->buffer = xmalloc(archive_handle->file_header->size + 1);
|
||||
|
||||
xread_all(archive_handle->src_fd, archive_handle->buffer, archive_handle->file_header->size);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "unarchive.h"
|
||||
|
||||
extern void data_extract_to_stdout(archive_handle_t *archive_handle)
|
||||
{
|
||||
copy_file_chunk_fd(archive_handle->src_fd, fileno(stdout), archive_handle->file_header->size);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "unarchive.h"
|
||||
#include "libbb.h"
|
||||
|
||||
extern void data_skip(archive_handle_t *archive_handle)
|
||||
{
|
||||
seek_sub_file(archive_handle->src_fd, archive_handle->file_header->size);
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
#include "config.h"
|
||||
#include "libbb.h"
|
||||
|
||||
#ifdef CONFIG_FEATURE_UNCOMPRESS
|
||||
|
||||
/* uncompress for busybox -- (c) 2002 Robert Griebl
|
||||
*
|
||||
* based on the original compress42.c source
|
||||
* (see disclaimer below)
|
||||
*/
|
||||
|
||||
|
||||
/* (N)compress42.c - File compression ala IEEE Computer, Mar 1992.
|
||||
*
|
||||
* Authors:
|
||||
* Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
|
||||
* Jim McKie (decvax!mcvax!jim)
|
||||
* Steve Davies (decvax!vax135!petsd!peora!srd)
|
||||
* Ken Turkowski (decvax!decwrl!turtlevax!ken)
|
||||
* James A. Woods (decvax!ihnp4!ames!jaw)
|
||||
* Joe Orost (decvax!vax135!petsd!joe)
|
||||
* Dave Mack (csu@alembic.acs.com)
|
||||
* Peter Jannesen, Network Communication Systems
|
||||
* (peter@ncs.nl)
|
||||
*
|
||||
* marc@suse.de : a small security fix for a buffer overflow
|
||||
*
|
||||
* [... History snipped ...]
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define IBUFSIZ 2048 /* Defailt input buffer size */
|
||||
#define OBUFSIZ 2048 /* Default output buffer size */
|
||||
|
||||
/* Defines for third byte of header */
|
||||
#define MAGIC_1 (char_type)'\037'/* First byte of compressed file */
|
||||
#define MAGIC_2 (char_type)'\235'/* Second byte of compressed file */
|
||||
#define BIT_MASK 0x1f /* Mask for 'number of compresssion bits' */
|
||||
/* Masks 0x20 and 0x40 are free. */
|
||||
/* I think 0x20 should mean that there is */
|
||||
/* a fourth header byte (for expansion). */
|
||||
#define BLOCK_MODE 0x80 /* Block compresssion if table is full and */
|
||||
/* compression rate is dropping flush tables */
|
||||
|
||||
/* the next two codes should not be changed lightly, as they must not */
|
||||
/* lie within the contiguous general code space. */
|
||||
#define FIRST 257 /* first free entry */
|
||||
#define CLEAR 256 /* table clear output code */
|
||||
|
||||
#define INIT_BITS 9 /* initial number of bits/code */
|
||||
|
||||
|
||||
/*
|
||||
* machine variants which require cc -Dmachine: pdp11, z8000, DOS
|
||||
*/
|
||||
#define FAST
|
||||
|
||||
#define HBITS 17 /* 50% occupancy */
|
||||
#define HSIZE (1<<HBITS)
|
||||
#define HMASK (HSIZE-1)
|
||||
#define HPRIME 9941
|
||||
#define BITS 16
|
||||
#undef MAXSEG_64K
|
||||
|
||||
typedef long int code_int;
|
||||
|
||||
typedef long int count_int;
|
||||
typedef long int cmp_code_int;
|
||||
|
||||
typedef unsigned char char_type;
|
||||
|
||||
#define MAXCODE(n) (1L << (n))
|
||||
|
||||
|
||||
|
||||
int block_mode = BLOCK_MODE;/* Block compress mode -C compatible with 2.0*/
|
||||
int maxbits = BITS; /* user settable max # bits/code */
|
||||
int exit_code = -1; /* Exitcode of compress (-1 no file compressed) */
|
||||
|
||||
char_type inbuf[IBUFSIZ+64]; /* Input buffer */
|
||||
char_type outbuf[OBUFSIZ+2048];/* Output buffer */
|
||||
|
||||
|
||||
count_int htab[HSIZE];
|
||||
unsigned short codetab[HSIZE];
|
||||
|
||||
#define htabof(i) htab[i]
|
||||
#define codetabof(i) codetab[i]
|
||||
#define tab_prefixof(i) codetabof(i)
|
||||
#define tab_suffixof(i) ((char_type *)(htab))[i]
|
||||
#define de_stack ((char_type *)&(htab[HSIZE-1]))
|
||||
#define clear_htab() memset(htab, -1, sizeof(htab))
|
||||
#define clear_tab_prefixof() memset(codetab, 0, 256);
|
||||
|
||||
|
||||
/*
|
||||
* Decompress stdin to stdout. This routine adapts to the codes in the
|
||||
* file building the "string" table on-the-fly; requiring no table to
|
||||
* be stored in the compressed file. The tables used herein are shared
|
||||
* with those of the compress() routine. See the definitions above.
|
||||
*/
|
||||
|
||||
extern int uncompress(int fd_in, int fd_out)
|
||||
{
|
||||
char_type *stackp;
|
||||
code_int code;
|
||||
int finchar;
|
||||
code_int oldcode;
|
||||
code_int incode;
|
||||
int inbits;
|
||||
int posbits;
|
||||
int outpos;
|
||||
int insize;
|
||||
int bitmask;
|
||||
code_int free_ent;
|
||||
code_int maxcode;
|
||||
code_int maxmaxcode;
|
||||
int n_bits;
|
||||
int rsize = 0;
|
||||
|
||||
insize = 0;
|
||||
|
||||
inbuf [0] = xread_char(fd_in);
|
||||
|
||||
maxbits = inbuf[0] & BIT_MASK;
|
||||
block_mode = inbuf[0] & BLOCK_MODE;
|
||||
maxmaxcode = MAXCODE(maxbits);
|
||||
|
||||
if (maxbits > BITS)
|
||||
{
|
||||
fprintf(stderr, "compressed with %d bits, can only handle %d bits\n", maxbits, BITS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//fprintf(stderr, "Bits: %d, block_mode: %d\n", maxbits, block_mode );
|
||||
|
||||
maxcode = MAXCODE(n_bits = INIT_BITS)-1;
|
||||
bitmask = (1<<n_bits)-1;
|
||||
oldcode = -1;
|
||||
finchar = 0;
|
||||
outpos = 0;
|
||||
posbits = 0<<3;
|
||||
|
||||
free_ent = ((block_mode) ? FIRST : 256);
|
||||
|
||||
clear_tab_prefixof(); /* As above, initialize the first
|
||||
256 entries in the table. */
|
||||
|
||||
for (code = 255 ; code >= 0 ; --code)
|
||||
tab_suffixof(code) = (char_type)code;
|
||||
|
||||
do
|
||||
{
|
||||
resetbuf: ;
|
||||
{
|
||||
int i;
|
||||
int e;
|
||||
int o;
|
||||
|
||||
e = insize-(o = (posbits>>3));
|
||||
|
||||
for (i = 0 ; i < e ; ++i)
|
||||
inbuf[i] = inbuf[i+o];
|
||||
|
||||
insize = e;
|
||||
posbits = 0;
|
||||
}
|
||||
|
||||
if (insize < (int) sizeof(inbuf)-IBUFSIZ)
|
||||
{
|
||||
xread_all(fd_in, inbuf+insize, IBUFSIZ);
|
||||
insize += rsize;
|
||||
}
|
||||
|
||||
inbits = ((rsize > 0) ? (insize - insize%n_bits)<<3 :
|
||||
(insize<<3)-(n_bits-1));
|
||||
|
||||
while (inbits > posbits)
|
||||
{
|
||||
if (free_ent > maxcode)
|
||||
{
|
||||
posbits = ((posbits-1) + ((n_bits<<3) -
|
||||
(posbits-1+(n_bits<<3))%(n_bits<<3)));
|
||||
|
||||
++n_bits;
|
||||
if (n_bits == maxbits)
|
||||
maxcode = maxmaxcode;
|
||||
else
|
||||
maxcode = MAXCODE(n_bits)-1;
|
||||
|
||||
bitmask = (1<<n_bits)-1;
|
||||
goto resetbuf;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
char_type *p = &inbuf[posbits>>3];
|
||||
code = ((((long)(p[0]))|((long)(p[1])<<8)|((long)(p[2])<<16))>>(posbits&0x7))&bitmask;
|
||||
}
|
||||
posbits += n_bits;
|
||||
|
||||
|
||||
if (oldcode == -1)
|
||||
{
|
||||
outbuf[outpos++] = (char_type)(finchar = (int)(oldcode = code));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (code == CLEAR && block_mode)
|
||||
{
|
||||
clear_tab_prefixof();
|
||||
free_ent = FIRST - 1;
|
||||
posbits = ((posbits-1) + ((n_bits<<3) -
|
||||
(posbits-1+(n_bits<<3))%(n_bits<<3)));
|
||||
maxcode = MAXCODE(n_bits = INIT_BITS)-1;
|
||||
bitmask = (1<<n_bits)-1;
|
||||
goto resetbuf;
|
||||
}
|
||||
|
||||
incode = code;
|
||||
stackp = de_stack;
|
||||
|
||||
if (code >= free_ent) /* Special case for KwKwK string. */
|
||||
{
|
||||
if (code > free_ent)
|
||||
{
|
||||
char_type *p;
|
||||
|
||||
posbits -= n_bits;
|
||||
p = &inbuf[posbits>>3];
|
||||
|
||||
fprintf(stderr, "insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)\n", insize, posbits,
|
||||
p[-1],p[0],p[1],p[2],p[3], (posbits&07));
|
||||
fprintf(stderr, "uncompress: corrupt input\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
*--stackp = (char_type)finchar;
|
||||
code = oldcode;
|
||||
}
|
||||
|
||||
while ((cmp_code_int)code >= (cmp_code_int)256)
|
||||
{ /* Generate output characters in reverse order */
|
||||
*--stackp = tab_suffixof(code);
|
||||
code = tab_prefixof(code);
|
||||
}
|
||||
|
||||
*--stackp = (char_type)(finchar = tab_suffixof(code));
|
||||
|
||||
/* And put them out in forward order */
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
if (outpos+(i = (de_stack-stackp)) >= OBUFSIZ)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (i > OBUFSIZ-outpos) i = OBUFSIZ-outpos;
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
memcpy(outbuf+outpos, stackp, i);
|
||||
outpos += i;
|
||||
}
|
||||
|
||||
if (outpos >= OBUFSIZ)
|
||||
{
|
||||
write(fd_out, outbuf, outpos);
|
||||
outpos = 0;
|
||||
}
|
||||
stackp+= i;
|
||||
}
|
||||
while ((i = (de_stack-stackp)) > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(outbuf+outpos, stackp, i);
|
||||
outpos += i;
|
||||
}
|
||||
}
|
||||
|
||||
if ((code = free_ent) < maxmaxcode) /* Generate the new entry. */
|
||||
{
|
||||
tab_prefixof(code) = (unsigned short)oldcode;
|
||||
tab_suffixof(code) = (char_type)finchar;
|
||||
free_ent = code+1;
|
||||
}
|
||||
|
||||
oldcode = incode; /* Remember previous code. */
|
||||
}
|
||||
|
||||
}
|
||||
while (rsize > 0);
|
||||
|
||||
if (outpos > 0) {
|
||||
write(fd_out, outbuf, outpos);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,904 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* gunzip implementation for busybox
|
||||
*
|
||||
* Based on GNU gzip v1.2.4 Copyright (C) 1992-1993 Jean-loup Gailly.
|
||||
*
|
||||
* Originally adjusted for busybox by Sven Rudolph <sr1@inf.tu-dresden.de>
|
||||
* based on gzip sources
|
||||
*
|
||||
* Adjusted further by Erik Andersen <andersee@debian.org> to support
|
||||
* files as well as stdin/stdout, and to generally behave itself wrt
|
||||
* command line handling.
|
||||
*
|
||||
* General cleanup to better adhere to the style guide and make use of standard
|
||||
* busybox functions by Glenn McGrath <bug1@optushome.com.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
|
||||
*
|
||||
*
|
||||
* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
|
||||
* Copyright (C) 1992-1993 Jean-loup Gailly
|
||||
* The unzip code was written and put in the public domain by Mark Adler.
|
||||
* Portions of the lzw code are derived from the public domain 'compress'
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#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 <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 {
|
||||
unsigned char e; /* number of extra bits or operation */
|
||||
unsigned char b; /* number of bits in this code or subcode */
|
||||
union {
|
||||
unsigned short n; /* literal, length base, or distance base */
|
||||
struct huft_s *t; /* pointer to next level of table */
|
||||
} v;
|
||||
} huft_t;
|
||||
|
||||
static int gunzip_src_fd;
|
||||
static int gunzip_dst_fd;
|
||||
unsigned int gunzip_bytes_out; /* number of output bytes */
|
||||
static unsigned int gunzip_outbuf_count; /* bytes in output buffer */
|
||||
|
||||
/* This is used to sanify any unused bits from the bitbuffer
|
||||
* so they arent skipped when reading trailers (trailing headers) */
|
||||
unsigned char gunzip_in_buffer_count;
|
||||
unsigned char *gunzip_in_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;
|
||||
|
||||
static unsigned char *gunzip_window;
|
||||
static unsigned int *gunzip_crc_table;
|
||||
unsigned int 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) */
|
||||
#define N_MAX 288 /* maximum number of codes in any set */
|
||||
|
||||
static unsigned int gunzip_hufts; /* track memory usage */
|
||||
static unsigned int gunzip_bb; /* bit buffer */
|
||||
static unsigned char gunzip_bk; /* bits in bit buffer */
|
||||
|
||||
static const unsigned short mask_bits[] = {
|
||||
0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
|
||||
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
|
||||
};
|
||||
|
||||
/* 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
|
||||
};
|
||||
|
||||
/* 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
|
||||
}; /* 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
|
||||
};
|
||||
|
||||
/* 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
|
||||
};
|
||||
|
||||
/* Tables for deflate from PKZIP's appnote.txt. */
|
||||
/* Order of the bit length code lengths */
|
||||
static const unsigned char border[] = {
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
|
||||
};
|
||||
|
||||
static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current, const unsigned int required)
|
||||
{
|
||||
while (*current < required) {
|
||||
bitbuffer |= ((unsigned int) xread_char(gunzip_src_fd)) << *current;
|
||||
*current += 8;
|
||||
}
|
||||
|
||||
return(bitbuffer);
|
||||
}
|
||||
|
||||
static void abort_gzip(void)
|
||||
{
|
||||
error_msg("gzip aborted\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
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
|
||||
* each table.
|
||||
* t: table to free
|
||||
*/
|
||||
static int huft_free(huft_t * t)
|
||||
{
|
||||
huft_t *p;
|
||||
huft_t *q;
|
||||
|
||||
/* Go through linked list, freeing from the malloced (t[-1]) address. */
|
||||
p = t;
|
||||
while (p != (huft_t *) NULL) {
|
||||
q = (--p)->v.t;
|
||||
free((char *) p);
|
||||
p = q;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Given a list of code lengths and a maximum table size, make a set of
|
||||
* tables to decode that set of codes. Return zero on success, one if
|
||||
* the given code set is incomplete (the tables are still built in this
|
||||
* case), two if the input is invalid (all zero length codes or an
|
||||
* oversubscribed set of lengths), and three if not enough memory.
|
||||
*
|
||||
* b: code lengths in bits (all assumed <= BMAX)
|
||||
* n: number of codes (assumed <= N_MAX)
|
||||
* s: number of simple-valued codes (0..s-1)
|
||||
* d: list of base values for non-simple codes
|
||||
* e: list of extra bits for non-simple codes
|
||||
* 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)
|
||||
{
|
||||
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 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 */
|
||||
|
||||
/* Generate counts for each bit length */
|
||||
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) */
|
||||
} while (--i);
|
||||
if (c[0] == n) { /* null input--all zero length codes */
|
||||
*t = (huft_t *) NULL;
|
||||
*m = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
/* 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 */
|
||||
}
|
||||
}
|
||||
if ((y -= c[i]) < 0) {
|
||||
return 2;
|
||||
}
|
||||
c[i] += y;
|
||||
|
||||
/* Generate starting offsets into the value table for each length */
|
||||
x[1] = j = 0;
|
||||
p = c + 1;
|
||||
xp = x + 2;
|
||||
while (--i) { /* note that i == g from above */
|
||||
*xp++ = (j += *p++);
|
||||
}
|
||||
|
||||
/* Make a table of values in order of bit lengths */
|
||||
p = b;
|
||||
i = 0;
|
||||
do {
|
||||
if ((j = *p++) != 0) {
|
||||
v[x[j]++] = i;
|
||||
}
|
||||
} 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) */
|
||||
u[0] = (huft_t *) NULL; /* just to keep compilers happy */
|
||||
q = (huft_t *) NULL; /* ditto */
|
||||
z = 0; /* ditto */
|
||||
|
||||
/* go through the bit lengths (k already is bits in shortest code) */
|
||||
for (; k <= g; k++) {
|
||||
a = c[k];
|
||||
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 */
|
||||
|
||||
/* 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 */
|
||||
xp = c + k;
|
||||
while (++j < z) { /* try smaller tables up to z bits */
|
||||
if ((f <<= 1) <= *++xp) {
|
||||
break; /* enough codes to use up j bits */
|
||||
}
|
||||
f -= *xp; /* else deduct codes from patterns */
|
||||
}
|
||||
}
|
||||
z = 1 << j; /* table entries for j-bit table */
|
||||
|
||||
/* allocate and link in new table */
|
||||
q = (huft_t *) xmalloc((z + 1) * sizeof(huft_t));
|
||||
|
||||
gunzip_hufts += z + 1; /* track memory usage */
|
||||
*t = q + 1; /* link to list for huft_free() */
|
||||
*(t = &(q->v.t)) = NULL;
|
||||
u[h] = ++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 */
|
||||
}
|
||||
}
|
||||
|
||||
/* set up table entry in r */
|
||||
r.b = (unsigned char) (k - w);
|
||||
if (p >= v + n) {
|
||||
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++ */
|
||||
} else {
|
||||
r.e = (unsigned char) e[*p - s]; /* non-simple--look up in lists */
|
||||
r.v.n = d[*p++ - s];
|
||||
}
|
||||
|
||||
/* fill code-like entries with r */
|
||||
f = 1 << (k - w);
|
||||
for (j = i >> w; j < z; j += f) {
|
||||
q[j] = r;
|
||||
}
|
||||
|
||||
/* backwards increment the k-bit code i */
|
||||
for (j = 1 << (k - 1); i & j; j >>= 1) {
|
||||
i ^= j;
|
||||
}
|
||||
i ^= j;
|
||||
|
||||
/* backup over finished tables */
|
||||
while ((i & ((1 << w) - 1)) != x[h]) {
|
||||
h--; /* don't need to update q */
|
||||
w -= l;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Return true (1) if we were given an incomplete table */
|
||||
return y != 0 && g != 1;
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
* Write the output gunzip_window gunzip_window[0..gunzip_outbuf_count-1] and update crc and gunzip_bytes_out.
|
||||
* (Used for the decompressed data only.)
|
||||
*/
|
||||
static void flush_gunzip_window(void)
|
||||
{
|
||||
int n;
|
||||
|
||||
for (n = 0; n < gunzip_outbuf_count; n++) {
|
||||
gunzip_crc = gunzip_crc_table[((int) gunzip_crc ^ (gunzip_window[n])) & 0xff] ^ (gunzip_crc >> 8);
|
||||
}
|
||||
|
||||
if (write(gunzip_dst_fd, gunzip_window, gunzip_outbuf_count) != gunzip_outbuf_count) {
|
||||
error_msg_and_die("Couldnt write");
|
||||
}
|
||||
gunzip_bytes_out += gunzip_outbuf_count;
|
||||
gunzip_outbuf_count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* inflate (decompress) the codes in a deflated (compressed) block.
|
||||
* Return an error code or zero if it all goes ok.
|
||||
*
|
||||
* tl, td: literal/length and distance decoder tables
|
||||
* bl, bd: number of bits decoded by tl[] and td[]
|
||||
*/
|
||||
static int inflate_codes(huft_t * tl, huft_t * td, const unsigned int bl, const unsigned int bd)
|
||||
{
|
||||
unsigned int e; /* table entry flag/number of extra bits */
|
||||
unsigned int n, d; /* length and index for copy */
|
||||
unsigned int w; /* current gunzip_window position */
|
||||
huft_t *t; /* pointer to table entry */
|
||||
unsigned int ml, md; /* masks for bl and bd bits */
|
||||
unsigned int b; /* bit buffer */
|
||||
unsigned int k; /* number of bits in bit buffer */
|
||||
|
||||
/* make local copies of globals */
|
||||
b = gunzip_bb; /* initialize bit buffer */
|
||||
k = gunzip_bk;
|
||||
w = gunzip_outbuf_count; /* initialize gunzip_window position */
|
||||
|
||||
/* inflate the coded data */
|
||||
ml = mask_bits[bl]; /* precompute masks for speed */
|
||||
md = mask_bits[bd];
|
||||
while (1) { /* do until end of block */
|
||||
b = fill_bitbuffer(b, &k, bl);
|
||||
if ((e = (t = tl + ((unsigned) b & ml))->e) > 16)
|
||||
do {
|
||||
if (e == 99) {
|
||||
return 1;
|
||||
}
|
||||
b >>= t->b;
|
||||
k -= t->b;
|
||||
e -= 16;
|
||||
b = fill_bitbuffer(b, &k, e);
|
||||
} while ((e =
|
||||
(t = t->v.t + ((unsigned) b & mask_bits[e]))->e) > 16);
|
||||
b >>= t->b;
|
||||
k -= t->b;
|
||||
if (e == 16) { /* then it's a literal */
|
||||
gunzip_window[w++] = (unsigned char) t->v.n;
|
||||
if (w == gunzip_wsize) {
|
||||
gunzip_outbuf_count = (w);
|
||||
flush_gunzip_window();
|
||||
w = 0;
|
||||
}
|
||||
} else { /* it's an EOB or a length */
|
||||
|
||||
/* exit if end of block */
|
||||
if (e == 15) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* get length of block to copy */
|
||||
b = fill_bitbuffer(b, &k, e);
|
||||
n = t->v.n + ((unsigned) b & mask_bits[e]);
|
||||
b >>= e;
|
||||
k -= e;
|
||||
|
||||
/* decode distance of block to copy */
|
||||
b = fill_bitbuffer(b, &k, bd);
|
||||
if ((e = (t = td + ((unsigned) b & md))->e) > 16)
|
||||
do {
|
||||
if (e == 99)
|
||||
return 1;
|
||||
b >>= t->b;
|
||||
k -= t->b;
|
||||
e -= 16;
|
||||
b = fill_bitbuffer(b, &k, e);
|
||||
} while ((e =
|
||||
(t =
|
||||
t->v.t + ((unsigned) b & mask_bits[e]))->e) > 16);
|
||||
b >>= t->b;
|
||||
k -= t->b;
|
||||
b = fill_bitbuffer(b, &k, e);
|
||||
d = w - t->v.n - ((unsigned) b & mask_bits[e]);
|
||||
b >>= e;
|
||||
k -= e;
|
||||
|
||||
/* do the copy */
|
||||
do {
|
||||
n -= (e =
|
||||
(e =
|
||||
gunzip_wsize - ((d &= gunzip_wsize - 1) > w ? d : w)) > n ? n : e);
|
||||
/* copy to new buffer to prevent possible overwrite */
|
||||
if (w - d >= e) { /* (this test assumes unsigned comparison) */
|
||||
memcpy(gunzip_window + w, gunzip_window + d, e);
|
||||
w += e;
|
||||
d += e;
|
||||
} else {
|
||||
/* do it slow to avoid memcpy() overlap */
|
||||
/* !NOMEMCPY */
|
||||
do {
|
||||
gunzip_window[w++] = gunzip_window[d++];
|
||||
} while (--e);
|
||||
}
|
||||
if (w == gunzip_wsize) {
|
||||
gunzip_outbuf_count = (w);
|
||||
flush_gunzip_window();
|
||||
w = 0;
|
||||
}
|
||||
|
||||
} while (n);
|
||||
}
|
||||
}
|
||||
|
||||
/* restore the globals from the locals */
|
||||
gunzip_outbuf_count = w; /* restore global gunzip_window pointer */
|
||||
gunzip_bb = b; /* restore global bit buffer */
|
||||
gunzip_bk = k;
|
||||
|
||||
/* done */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* decompress an inflated block
|
||||
* e: last block flag
|
||||
*
|
||||
* GLOBAL VARIABLES: bb, kk,
|
||||
*/
|
||||
static int inflate_block(int *e)
|
||||
{
|
||||
unsigned t; /* block type */
|
||||
register unsigned int b; /* bit buffer */
|
||||
unsigned int k; /* number of bits in bit buffer */
|
||||
|
||||
/* make local bit buffer */
|
||||
|
||||
b = gunzip_bb;
|
||||
k = gunzip_bk;
|
||||
|
||||
/* read in last block bit */
|
||||
b = fill_bitbuffer(b, &k, 1);
|
||||
*e = (int) b & 1;
|
||||
b >>= 1;
|
||||
k -= 1;
|
||||
|
||||
/* read in block type */
|
||||
b = fill_bitbuffer(b, &k, 2);
|
||||
t = (unsigned) b & 3;
|
||||
b >>= 2;
|
||||
k -= 2;
|
||||
|
||||
/* restore the global bit buffer */
|
||||
gunzip_bb = b;
|
||||
gunzip_bk = k;
|
||||
|
||||
/* inflate that block type */
|
||||
switch (t) {
|
||||
case 0: /* Inflate stored */
|
||||
{
|
||||
unsigned int n; /* number of bytes in block */
|
||||
unsigned int w; /* current gunzip_window position */
|
||||
unsigned int b_stored; /* bit buffer */
|
||||
unsigned int k_stored; /* number of bits in bit buffer */
|
||||
|
||||
/* make local copies of globals */
|
||||
b_stored = gunzip_bb; /* initialize bit buffer */
|
||||
k_stored = gunzip_bk;
|
||||
w = gunzip_outbuf_count; /* initialize gunzip_window position */
|
||||
|
||||
/* go to byte boundary */
|
||||
n = k_stored & 7;
|
||||
b_stored >>= n;
|
||||
k_stored -= n;
|
||||
|
||||
/* get the length and its complement */
|
||||
b_stored = fill_bitbuffer(b_stored, &k_stored, 16);
|
||||
n = ((unsigned) b_stored & 0xffff);
|
||||
b_stored >>= 16;
|
||||
k_stored -= 16;
|
||||
|
||||
b_stored = fill_bitbuffer(b_stored, &k_stored, 16);
|
||||
if (n != (unsigned) ((~b_stored) & 0xffff)) {
|
||||
return 1; /* error in compressed data */
|
||||
}
|
||||
b_stored >>= 16;
|
||||
k_stored -= 16;
|
||||
|
||||
/* read and output the compressed data */
|
||||
while (n--) {
|
||||
b_stored = fill_bitbuffer(b_stored, &k_stored, 8);
|
||||
gunzip_window[w++] = (unsigned char) b_stored;
|
||||
if (w == (unsigned int) gunzip_wsize) {
|
||||
gunzip_outbuf_count = (w);
|
||||
flush_gunzip_window();
|
||||
w = 0;
|
||||
}
|
||||
b_stored >>= 8;
|
||||
k_stored -= 8;
|
||||
}
|
||||
|
||||
/* restore the globals from the locals */
|
||||
gunzip_outbuf_count = w; /* restore global gunzip_window pointer */
|
||||
gunzip_bb = b_stored; /* restore global bit buffer */
|
||||
gunzip_bk = k_stored;
|
||||
return 0;
|
||||
}
|
||||
case 1: /* Inflate fixed
|
||||
* decompress an inflated type 1 (fixed Huffman codes) block. We should
|
||||
* either replace this with a custom decoder, or at least precompute the
|
||||
* Huffman tables.
|
||||
*/
|
||||
{
|
||||
int i; /* temporary variable */
|
||||
huft_t *tl; /* literal/length code table */
|
||||
huft_t *td; /* distance code table */
|
||||
unsigned int bl; /* lookup bits for tl */
|
||||
unsigned int bd; /* lookup bits for td */
|
||||
unsigned int l[288]; /* length list for huft_build */
|
||||
|
||||
/* set up literal table */
|
||||
for (i = 0; i < 144; i++) {
|
||||
l[i] = 8;
|
||||
}
|
||||
for (; i < 256; i++) {
|
||||
l[i] = 9;
|
||||
}
|
||||
for (; i < 280; i++) {
|
||||
l[i] = 7;
|
||||
}
|
||||
for (; i < 288; i++) { /* make a complete, but wrong code set */
|
||||
l[i] = 8;
|
||||
}
|
||||
bl = 7;
|
||||
if ((i = huft_build(l, 288, 257, cplens, cplext, &tl, &bl)) != 0) {
|
||||
return i;
|
||||
}
|
||||
|
||||
/* set up distance table */
|
||||
for (i = 0; i < 30; i++) { /* make an incomplete code set */
|
||||
l[i] = 5;
|
||||
}
|
||||
bd = 5;
|
||||
if ((i = huft_build(l, 30, 0, cpdist, cpdext, &td, &bd)) > 1) {
|
||||
huft_free(tl);
|
||||
return i;
|
||||
}
|
||||
|
||||
/* decompress until an end-of-block code */
|
||||
if (inflate_codes(tl, td, bl, bd)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* free the decoding tables, return */
|
||||
huft_free(tl);
|
||||
huft_free(td);
|
||||
return 0;
|
||||
}
|
||||
case 2: /* Inflate dynamic */
|
||||
{
|
||||
const int dbits = 6; /* bits in base distance lookup table */
|
||||
const int lbits = 9; /* bits in base literal/length lookup table */
|
||||
|
||||
huft_t *tl; /* literal/length code table */
|
||||
huft_t *td; /* distance code table */
|
||||
unsigned int i; /* temporary variables */
|
||||
unsigned int j;
|
||||
unsigned int l; /* last length */
|
||||
unsigned int m; /* mask for bit lengths table */
|
||||
unsigned int n; /* number of lengths to get */
|
||||
unsigned int bl; /* lookup bits for tl */
|
||||
unsigned int bd; /* lookup bits for td */
|
||||
unsigned int nb; /* number of bit length codes */
|
||||
unsigned int nl; /* number of literal/length codes */
|
||||
unsigned int nd; /* number of distance codes */
|
||||
|
||||
unsigned int ll[286 + 30]; /* literal/length and distance code lengths */
|
||||
unsigned int b_dynamic; /* bit buffer */
|
||||
unsigned int k_dynamic; /* number of bits in bit buffer */
|
||||
|
||||
/* make local bit buffer */
|
||||
b_dynamic = gunzip_bb;
|
||||
k_dynamic = gunzip_bk;
|
||||
|
||||
/* read in table lengths */
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 5);
|
||||
nl = 257 + ((unsigned int) b_dynamic & 0x1f); /* number of literal/length codes */
|
||||
|
||||
b_dynamic >>= 5;
|
||||
k_dynamic -= 5;
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 5);
|
||||
nd = 1 + ((unsigned int) b_dynamic & 0x1f); /* number of distance codes */
|
||||
|
||||
b_dynamic >>= 5;
|
||||
k_dynamic -= 5;
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 4);
|
||||
nb = 4 + ((unsigned int) b_dynamic & 0xf); /* number of bit length codes */
|
||||
|
||||
b_dynamic >>= 4;
|
||||
k_dynamic -= 4;
|
||||
if (nl > 286 || nd > 30) {
|
||||
return 1; /* bad lengths */
|
||||
}
|
||||
|
||||
/* read in bit-length-code lengths */
|
||||
for (j = 0; j < nb; j++) {
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 3);
|
||||
ll[border[j]] = (unsigned int) b_dynamic & 7;
|
||||
b_dynamic >>= 3;
|
||||
k_dynamic -= 3;
|
||||
}
|
||||
for (; j < 19; j++) {
|
||||
ll[border[j]] = 0;
|
||||
}
|
||||
|
||||
/* build decoding table for trees--single level, 7 bit lookup */
|
||||
bl = 7;
|
||||
i = huft_build(ll, 19, 19, NULL, NULL, &tl, &bl);
|
||||
if (i != 0) {
|
||||
if (i == 1) {
|
||||
huft_free(tl);
|
||||
}
|
||||
return i; /* incomplete code set */
|
||||
}
|
||||
|
||||
/* read in literal and distance code lengths */
|
||||
n = nl + nd;
|
||||
m = mask_bits[bl];
|
||||
i = l = 0;
|
||||
while ((unsigned int) i < n) {
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, (unsigned int)bl);
|
||||
j = (td = tl + ((unsigned int) b_dynamic & m))->b;
|
||||
b_dynamic >>= j;
|
||||
k_dynamic -= j;
|
||||
j = td->v.n;
|
||||
if (j < 16) { /* length of code in bits (0..15) */
|
||||
ll[i++] = l = j; /* save last length in l */
|
||||
} else if (j == 16) { /* repeat last length 3 to 6 times */
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 2);
|
||||
j = 3 + ((unsigned int) b_dynamic & 3);
|
||||
b_dynamic >>= 2;
|
||||
k_dynamic -= 2;
|
||||
if ((unsigned int) i + j > n) {
|
||||
return 1;
|
||||
}
|
||||
while (j--) {
|
||||
ll[i++] = l;
|
||||
}
|
||||
} else if (j == 17) { /* 3 to 10 zero length codes */
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 3);
|
||||
j = 3 + ((unsigned int) b_dynamic & 7);
|
||||
b_dynamic >>= 3;
|
||||
k_dynamic -= 3;
|
||||
if ((unsigned int) i + j > n) {
|
||||
return 1;
|
||||
}
|
||||
while (j--) {
|
||||
ll[i++] = 0;
|
||||
}
|
||||
l = 0;
|
||||
} else { /* j == 18: 11 to 138 zero length codes */
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 7);
|
||||
j = 11 + ((unsigned int) b_dynamic & 0x7f);
|
||||
b_dynamic >>= 7;
|
||||
k_dynamic -= 7;
|
||||
if ((unsigned int) i + j > n) {
|
||||
return 1;
|
||||
}
|
||||
while (j--) {
|
||||
ll[i++] = 0;
|
||||
}
|
||||
l = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* free decoding table for trees */
|
||||
huft_free(tl);
|
||||
|
||||
/* restore the global bit buffer */
|
||||
gunzip_bb = b_dynamic;
|
||||
gunzip_bk = k_dynamic;
|
||||
|
||||
/* build the decoding tables for literal/length and distance codes */
|
||||
bl = lbits;
|
||||
|
||||
if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) {
|
||||
if (i == 1) {
|
||||
error_msg_and_die("Incomplete literal tree");
|
||||
huft_free(tl);
|
||||
}
|
||||
return i; /* incomplete code set */
|
||||
}
|
||||
|
||||
bd = dbits;
|
||||
if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) {
|
||||
if (i == 1) {
|
||||
error_msg_and_die("incomplete distance tree");
|
||||
huft_free(td);
|
||||
}
|
||||
huft_free(tl);
|
||||
return i; /* incomplete code set */
|
||||
}
|
||||
|
||||
/* decompress until an end-of-block code */
|
||||
if (inflate_codes(tl, td, bl, bd)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* free the decoding tables, return */
|
||||
huft_free(tl);
|
||||
huft_free(td);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
/* bad block type */
|
||||
error_msg("bad block type %d\n", t);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* decompress an inflated entry
|
||||
*
|
||||
* GLOBAL VARIABLES: gunzip_outbuf_count, bk, gunzip_bb, hufts, inptr
|
||||
*/
|
||||
extern int inflate(int in, int out)
|
||||
{
|
||||
typedef void (*sig_type) (int);
|
||||
int e; /* last block flag */
|
||||
int r; /* result code */
|
||||
unsigned h = 0; /* maximum struct huft's malloc'ed */
|
||||
|
||||
/* Allocate all global buffers (for DYN_ALLOC option) */
|
||||
gunzip_window = xmalloc(0x8000);
|
||||
gunzip_outbuf_count = 0;
|
||||
gunzip_bytes_out = 0;
|
||||
|
||||
gunzip_src_fd = in;
|
||||
gunzip_dst_fd = out;
|
||||
|
||||
gunzip_in_buffer = malloc(8);
|
||||
|
||||
if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
|
||||
(void) signal(SIGINT, (sig_type) abort_gzip);
|
||||
}
|
||||
#ifdef SIGHUP
|
||||
if (signal(SIGHUP, SIG_IGN) != SIG_IGN) {
|
||||
(void) signal(SIGHUP, (sig_type) abort_gzip);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* initialize gunzip_window, bit buffer */
|
||||
gunzip_bk = 0;
|
||||
gunzip_bb = 0;
|
||||
|
||||
/* Create the crc table */
|
||||
make_gunzip_crc_table();
|
||||
|
||||
/* decompress until the last block */
|
||||
do {
|
||||
gunzip_hufts = 0;
|
||||
r = inflate_block(&e);
|
||||
if (r != 0) {
|
||||
error_msg_and_die("inflate error %d", r);
|
||||
return r;
|
||||
}
|
||||
if (gunzip_hufts > h) {
|
||||
h = gunzip_hufts;
|
||||
}
|
||||
} while (!e);
|
||||
|
||||
/* write any buffered uncompressed data */
|
||||
flush_gunzip_window();
|
||||
free(gunzip_window);
|
||||
|
||||
/* Cleanup */
|
||||
free(gunzip_crc_table);
|
||||
|
||||
/* Store unused bytes in a global buffer so calling applets can access it */
|
||||
gunzip_in_buffer_count = 0;
|
||||
if (gunzip_bk >= 8) {
|
||||
/* Undo too much lookahead. The next read will be byte aligned
|
||||
* so we can discard unused bits in the last meaningful byte. */
|
||||
gunzip_in_buffer[gunzip_in_buffer_count] = gunzip_bb & 0xff;
|
||||
gunzip_in_buffer_count++;
|
||||
gunzip_bb >>= 8;
|
||||
gunzip_bk -= 8;
|
||||
}
|
||||
|
||||
/* return success */
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <fnmatch.h>
|
||||
#include <stdlib.h>
|
||||
#include "unarchive.h"
|
||||
/*
|
||||
* Accept names that are in the accept list
|
||||
*/
|
||||
extern char filter_accept_all(const llist_t *accept_list, const llist_t *reject_list, const char *key)
|
||||
{
|
||||
if (key) {
|
||||
return(EXIT_SUCCESS);
|
||||
} else {
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#include <fnmatch.h>
|
||||
#include <stdlib.h>
|
||||
#include "unarchive.h"
|
||||
|
||||
/*
|
||||
* Accept names that are in the accept list
|
||||
*/
|
||||
extern char filter_accept_list(const llist_t *accept_list, const llist_t *reject_list, const char *key)
|
||||
{
|
||||
if (find_list_entry(accept_list, key)) {
|
||||
return(EXIT_SUCCESS);
|
||||
} else {
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#include <fnmatch.h>
|
||||
#include <stdlib.h>
|
||||
#include "unarchive.h"
|
||||
|
||||
/*
|
||||
* Accept names that are in the accept list
|
||||
*/
|
||||
extern char filter_accept_reject_list(const llist_t *accept_list, const llist_t *reject_list, const char *key)
|
||||
{
|
||||
const llist_t *accept_entry = find_list_entry(accept_list, key);
|
||||
const llist_t *reject_entry = find_list_entry(reject_list, key);
|
||||
|
||||
/* Fail if an accept list was specified and the key wasnt in there */
|
||||
if (accept_list && (accept_entry == NULL)) {
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* If the key is in a reject list fail */
|
||||
if (reject_entry) {
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Accepted */
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <fnmatch.h>
|
||||
#include <stdlib.h>
|
||||
#include "unarchive.h"
|
||||
|
||||
extern const llist_t *find_list_entry(const llist_t *list, const char *filename)
|
||||
{
|
||||
while (list) {
|
||||
if (fnmatch(list->data, filename, 0) == 0) {
|
||||
return(list);
|
||||
}
|
||||
list = list->link;
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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 <unistd.h>
|
||||
#include "unarchive.h"
|
||||
#include "libbb.h"
|
||||
|
||||
extern 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;
|
||||
} ar;
|
||||
#ifdef CONFIG_FEATURE_AR_LONG_FILENAMES
|
||||
static char *ar_long_names;
|
||||
static unsigned int ar_long_name_size;
|
||||
#endif
|
||||
|
||||
/* dont use xread as we want to handle the error ourself */
|
||||
if (read(archive_handle->src_fd, ar.raw, 60) != 60) {
|
||||
/* End Of File */
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Some ar entries have a trailing '\n' after the previous data entry */
|
||||
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] = xread_char(archive_handle->src_fd);
|
||||
archive_handle->offset++;
|
||||
}
|
||||
archive_handle->offset += 60;
|
||||
|
||||
/* align the headers based on the header magic */
|
||||
if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) {
|
||||
error_msg_and_die("Invalid ar header");
|
||||
}
|
||||
|
||||
typed->mode = strtol(ar.formated.mode, NULL, 8);
|
||||
typed->mtime = atoi(ar.formated.date);
|
||||
typed->uid = atoi(ar.formated.uid);
|
||||
typed->gid = atoi(ar.formated.gid);
|
||||
typed->size = atoi(ar.formated.size);
|
||||
|
||||
/* long filenames have '/' as the first character */
|
||||
if (ar.formated.name[0] == '/') {
|
||||
#ifdef CONFIG_FEATURE_AR_LONG_FILENAMES
|
||||
if (ar.formated.name[1] == '/') {
|
||||
/* If the second char is a '/' then this entries data section
|
||||
* stores long filename for multiple entries, they are stored
|
||||
* in static variable long_names for use in future entries */
|
||||
ar_long_name_size = typed->size;
|
||||
ar_long_names = xmalloc(ar_long_name_size);
|
||||
xread_all(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 */
|
||||
return (get_header_ar(archive_handle)); /* Return next header */
|
||||
} else if (ar.formated.name[1] == ' ') {
|
||||
/* This is the index of symbols in the file for compilers */
|
||||
data_skip(archive_handle);
|
||||
return (get_header_ar(archive_handle)); /* Return next header */
|
||||
} else {
|
||||
/* The number after the '/' indicates the offset in the ar data section
|
||||
(saved in variable long_name) that conatains the real filename */
|
||||
const unsigned int long_offset = atoi(&ar.formated.name[1]);
|
||||
if (long_offset >= ar_long_name_size) {
|
||||
error_msg_and_die("Cant resolve long filename");
|
||||
}
|
||||
typed->name = xstrdup(ar_long_names + long_offset);
|
||||
}
|
||||
#else
|
||||
error_msg_and_die("long filenames not supported");
|
||||
#endif
|
||||
} else {
|
||||
/* short filenames */
|
||||
typed->name = xstrndup(ar.formated.name, 16);
|
||||
}
|
||||
|
||||
typed->name[strcspn(typed->name, " /")] = '\0';
|
||||
|
||||
if (archive_handle->filter(archive_handle->accept, archive_handle->reject, typed->name) == EXIT_SUCCESS) {
|
||||
archive_handle->action_header(typed);
|
||||
if (archive_handle->sub_archive) {
|
||||
while (archive_handle->action_data_subarchive(archive_handle->sub_archive) == EXIT_SUCCESS);
|
||||
} else {
|
||||
archive_handle->action_data(archive_handle);
|
||||
}
|
||||
} else {
|
||||
data_skip(archive_handle);
|
||||
}
|
||||
|
||||
archive_handle->offset += typed->size + 1;
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* 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 char get_header_tar(archive_handle_t *archive_handle)
|
||||
{
|
||||
file_header_t *file_header = archive_handle->file_header;
|
||||
union {
|
||||
unsigned char raw[512];
|
||||
struct {
|
||||
char name[100]; /* 0-99 */
|
||||
char mode[8]; /* 100-107 */
|
||||
char uid[8]; /* 108-115 */
|
||||
char gid[8]; /* 116-123 */
|
||||
char size[12]; /* 124-135 */
|
||||
char mtime[12]; /* 136-147 */
|
||||
char chksum[8]; /* 148-155 */
|
||||
char typeflag; /* 156-156 */
|
||||
char linkname[100]; /* 157-256 */
|
||||
char magic[6]; /* 257-262 */
|
||||
char version[2]; /* 263-264 */
|
||||
char uname[32]; /* 265-296 */
|
||||
char gname[32]; /* 297-328 */
|
||||
char devmajor[8]; /* 329-336 */
|
||||
char devminor[8]; /* 337-344 */
|
||||
char prefix[155]; /* 345-499 */
|
||||
char padding[12]; /* 500-512 */
|
||||
} formated;
|
||||
} tar;
|
||||
long sum = 0;
|
||||
long i;
|
||||
char *tmp;
|
||||
|
||||
/* Align header */
|
||||
archive_handle->offset += data_align(archive_handle->src_fd, archive_handle->offset, 512);
|
||||
|
||||
if (xread_all_eof(archive_handle->src_fd, tar.raw, 512) == 0) {
|
||||
/* End of file */
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
archive_handle->offset += 512;
|
||||
|
||||
/* If there is no filename its an empty header */
|
||||
if (tar.formated.name[0] == 0) {
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* 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_OLD_FORMAT
|
||||
if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0)
|
||||
#endif
|
||||
error_msg_and_die("Invalid tar magic");
|
||||
}
|
||||
|
||||
/* Do checksum on headers */
|
||||
for (i = 0; i < 148 ; i++) {
|
||||
sum += tar.raw[i];
|
||||
}
|
||||
sum += ' ' * 8;
|
||||
for (i = 156; i < 512 ; i++) {
|
||||
sum += tar.raw[i];
|
||||
}
|
||||
if (sum != strtol(tar.formated.chksum, NULL, 8)) {
|
||||
error_msg("Invalid tar header checksum");
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* convert to type'ed variables */
|
||||
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);
|
||||
}
|
||||
tmp = last_char_is(archive_handle->file_header->name, '/');
|
||||
if (tmp) {
|
||||
*tmp = '\0';
|
||||
}
|
||||
|
||||
file_header->mode = strtol(tar.formated.mode, NULL, 8);
|
||||
file_header->uid = strtol(tar.formated.uid, NULL, 8);
|
||||
file_header->gid = strtol(tar.formated.gid, NULL, 8);
|
||||
file_header->size = strtol(tar.formated.size, NULL, 8);
|
||||
file_header->mtime = strtol(tar.formated.mtime, NULL, 8);
|
||||
file_header->link_name = (tar.formated.linkname[0] != '\0') ?
|
||||
xstrdup(tar.formated.linkname) : NULL;
|
||||
file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) +
|
||||
strtol(tar.formated.devminor, NULL, 8));
|
||||
|
||||
#if defined CONFIG_FEATURE_TAR_OLD_FORMAT || defined CONFIG_FEATURE_GNUTAR_LONG_FILENAME
|
||||
/* Fix mode, used by the old format */
|
||||
switch (tar.formated.typeflag) {
|
||||
# ifdef CONFIG_FEATURE_TAR_OLD_FORMAT
|
||||
case 0:
|
||||
file_header->mode |= S_IFREG;
|
||||
break;
|
||||
case 1:
|
||||
error_msg("Internal hard link not supported");
|
||||
break;
|
||||
case 2:
|
||||
file_header->mode |= S_IFLNK;
|
||||
break;
|
||||
case 3:
|
||||
file_header->mode |= S_IFCHR;
|
||||
break;
|
||||
case 4:
|
||||
file_header->mode |= S_IFBLK;
|
||||
break;
|
||||
case 5:
|
||||
file_header->mode |= S_IFDIR;
|
||||
break;
|
||||
case 6:
|
||||
file_header->mode |= S_IFIFO;
|
||||
break;
|
||||
# endif
|
||||
# ifdef CONFIG_FEATURE_GNUTAR_LONG_FILENAME
|
||||
case 'L': {
|
||||
char *longname;
|
||||
|
||||
longname = xmalloc(file_header->size + 1);
|
||||
xread_all(archive_handle->src_fd, longname, file_header->size);
|
||||
longname[file_header->size] = '\0';
|
||||
archive_handle->offset += file_header->size;
|
||||
|
||||
get_header_tar(archive_handle);
|
||||
file_header->name = longname;
|
||||
break;
|
||||
}
|
||||
case 'K': {
|
||||
char *linkname;
|
||||
|
||||
linkname = xmalloc(file_header->size + 1);
|
||||
xread_all(archive_handle->src_fd, linkname, file_header->size);
|
||||
linkname[file_header->size] = '\0';
|
||||
archive_handle->offset += file_header->size;
|
||||
|
||||
get_header_tar(archive_handle);
|
||||
file_header->name = linkname;
|
||||
break;
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
if (archive_handle->filter(archive_handle->accept, archive_handle->reject, archive_handle->file_header->name) == EXIT_SUCCESS) {
|
||||
archive_handle->action_header(archive_handle->file_header);
|
||||
archive_handle->flags |= ARCHIVE_EXTRACT_QUIET;
|
||||
archive_handle->action_data(archive_handle);
|
||||
archive_handle->passed = add_to_list(archive_handle->passed, archive_handle->file_header->name);
|
||||
} else {
|
||||
data_skip(archive_handle);
|
||||
}
|
||||
archive_handle->offset += file_header->size;
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
extern char get_header_tar_gz(archive_handle_t *archive_handle)
|
||||
{
|
||||
int fd_pipe[2];
|
||||
int pid;
|
||||
unsigned char magic[2];
|
||||
|
||||
xread_all(archive_handle->src_fd, &magic, 2);
|
||||
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
|
||||
error_msg_and_die("Invalid gzip magic");
|
||||
}
|
||||
|
||||
check_header_gzip(archive_handle->src_fd);
|
||||
|
||||
if (pipe(fd_pipe) != 0) {
|
||||
error_msg_and_die("Can't create pipe");
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid == -1) {
|
||||
error_msg_and_die("Fork failed\n");
|
||||
}
|
||||
|
||||
if (pid == 0) {
|
||||
/* child process */
|
||||
close(fd_pipe[0]); /* We don't wan't to read from the pipe */
|
||||
inflate(archive_handle->src_fd, fd_pipe[1]);
|
||||
check_trailer_gzip(archive_handle->src_fd);
|
||||
close(fd_pipe[1]); /* Send EOF */
|
||||
exit(0);
|
||||
/* notreached */
|
||||
}
|
||||
/* parent process */
|
||||
close(fd_pipe[1]); /* Don't want to write down the pipe */
|
||||
close(archive_handle->src_fd);
|
||||
|
||||
archive_handle->src_fd = fd_pipe[0];
|
||||
|
||||
archive_handle->offset = 0;
|
||||
while (get_header_tar(archive_handle) == EXIT_SUCCESS);
|
||||
|
||||
if (kill(pid, SIGTERM) == -1) {
|
||||
error_msg_and_die("Couldnt kill gunzip process");
|
||||
}
|
||||
|
||||
/* I dont think this is needed */
|
||||
#if 0
|
||||
if (waitpid(pid, NULL, 0) == -1) {
|
||||
error_msg("Couldnt wait ?");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Can only do one file at a time */
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include "unarchive.h"
|
||||
|
||||
extern void header_list(const file_header_t *file_header)
|
||||
{
|
||||
puts(file_header->name);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include "unarchive.h"
|
||||
|
||||
extern void header_skip(const file_header_t *file_header)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#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)
|
||||
{
|
||||
struct tm *mtime = localtime(&file_header->mtime);
|
||||
|
||||
printf("%s %d/%d%10u %4u-%02u-%02u %02u:%02u:%02u %s",
|
||||
mode_string(file_header->mode),
|
||||
file_header->uid,
|
||||
file_header->gid,
|
||||
(unsigned int) file_header->size,
|
||||
1900 + mtime->tm_year,
|
||||
1 + mtime->tm_mon,
|
||||
mtime->tm_mday,
|
||||
mtime->tm_hour,
|
||||
mtime->tm_min,
|
||||
mtime->tm_sec,
|
||||
file_header->name);
|
||||
|
||||
if (file_header->link_name) {
|
||||
printf(" -> %s", file_header->link_name);
|
||||
}
|
||||
/* putchar isnt used anywhere else i dont think */
|
||||
puts("");
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <string.h>
|
||||
#include "libbb.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
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->file_header = xmalloc(sizeof(file_header_t));
|
||||
archive_handle->action_header = header_skip;
|
||||
archive_handle->action_data = data_skip;
|
||||
archive_handle->filter = filter_accept_all;
|
||||
|
||||
return(archive_handle);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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 <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "unarchive.h"
|
||||
#include "libbb.h"
|
||||
|
||||
extern void seek_sub_file(const int src_fd, const unsigned int amount)
|
||||
{
|
||||
if ((lseek(src_fd, amount, SEEK_CUR) == -1) && (errno == ESPIPE)) {
|
||||
unsigned int i;
|
||||
for (i = 0; i < amount; i++) {
|
||||
xread_char(src_fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
#include "config.h"
|
||||
#include "libbb.h"
|
||||
|
||||
#ifdef CONFIG_FEATURE_UNCOMPRESS
|
||||
|
||||
/* uncompress for busybox -- (c) 2002 Robert Griebl
|
||||
*
|
||||
* based on the original compress42.c source
|
||||
* (see disclaimer below)
|
||||
*/
|
||||
|
||||
|
||||
/* (N)compress42.c - File compression ala IEEE Computer, Mar 1992.
|
||||
*
|
||||
* Authors:
|
||||
* Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
|
||||
* Jim McKie (decvax!mcvax!jim)
|
||||
* Steve Davies (decvax!vax135!petsd!peora!srd)
|
||||
* Ken Turkowski (decvax!decwrl!turtlevax!ken)
|
||||
* James A. Woods (decvax!ihnp4!ames!jaw)
|
||||
* Joe Orost (decvax!vax135!petsd!joe)
|
||||
* Dave Mack (csu@alembic.acs.com)
|
||||
* Peter Jannesen, Network Communication Systems
|
||||
* (peter@ncs.nl)
|
||||
*
|
||||
* marc@suse.de : a small security fix for a buffer overflow
|
||||
*
|
||||
* [... History snipped ...]
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define IBUFSIZ 2048 /* Defailt input buffer size */
|
||||
#define OBUFSIZ 2048 /* Default output buffer size */
|
||||
|
||||
/* Defines for third byte of header */
|
||||
#define MAGIC_1 (char_type)'\037'/* First byte of compressed file */
|
||||
#define MAGIC_2 (char_type)'\235'/* Second byte of compressed file */
|
||||
#define BIT_MASK 0x1f /* Mask for 'number of compresssion bits' */
|
||||
/* Masks 0x20 and 0x40 are free. */
|
||||
/* I think 0x20 should mean that there is */
|
||||
/* a fourth header byte (for expansion). */
|
||||
#define BLOCK_MODE 0x80 /* Block compresssion if table is full and */
|
||||
/* compression rate is dropping flush tables */
|
||||
|
||||
/* the next two codes should not be changed lightly, as they must not */
|
||||
/* lie within the contiguous general code space. */
|
||||
#define FIRST 257 /* first free entry */
|
||||
#define CLEAR 256 /* table clear output code */
|
||||
|
||||
#define INIT_BITS 9 /* initial number of bits/code */
|
||||
|
||||
|
||||
/*
|
||||
* machine variants which require cc -Dmachine: pdp11, z8000, DOS
|
||||
*/
|
||||
#define FAST
|
||||
|
||||
#define HBITS 17 /* 50% occupancy */
|
||||
#define HSIZE (1<<HBITS)
|
||||
#define HMASK (HSIZE-1)
|
||||
#define HPRIME 9941
|
||||
#define BITS 16
|
||||
#undef MAXSEG_64K
|
||||
|
||||
typedef long int code_int;
|
||||
|
||||
typedef long int count_int;
|
||||
typedef long int cmp_code_int;
|
||||
|
||||
typedef unsigned char char_type;
|
||||
|
||||
#define MAXCODE(n) (1L << (n))
|
||||
|
||||
|
||||
|
||||
int block_mode = BLOCK_MODE;/* Block compress mode -C compatible with 2.0*/
|
||||
int maxbits = BITS; /* user settable max # bits/code */
|
||||
int exit_code = -1; /* Exitcode of compress (-1 no file compressed) */
|
||||
|
||||
char_type inbuf[IBUFSIZ+64]; /* Input buffer */
|
||||
char_type outbuf[OBUFSIZ+2048];/* Output buffer */
|
||||
|
||||
|
||||
count_int htab[HSIZE];
|
||||
unsigned short codetab[HSIZE];
|
||||
|
||||
#define htabof(i) htab[i]
|
||||
#define codetabof(i) codetab[i]
|
||||
#define tab_prefixof(i) codetabof(i)
|
||||
#define tab_suffixof(i) ((char_type *)(htab))[i]
|
||||
#define de_stack ((char_type *)&(htab[HSIZE-1]))
|
||||
#define clear_htab() memset(htab, -1, sizeof(htab))
|
||||
#define clear_tab_prefixof() memset(codetab, 0, 256);
|
||||
|
||||
|
||||
/*
|
||||
* Decompress stdin to stdout. This routine adapts to the codes in the
|
||||
* file building the "string" table on-the-fly; requiring no table to
|
||||
* be stored in the compressed file. The tables used herein are shared
|
||||
* with those of the compress() routine. See the definitions above.
|
||||
*/
|
||||
|
||||
extern int uncompress(int fd_in, int fd_out)
|
||||
{
|
||||
char_type *stackp;
|
||||
code_int code;
|
||||
int finchar;
|
||||
code_int oldcode;
|
||||
code_int incode;
|
||||
int inbits;
|
||||
int posbits;
|
||||
int outpos;
|
||||
int insize;
|
||||
int bitmask;
|
||||
code_int free_ent;
|
||||
code_int maxcode;
|
||||
code_int maxmaxcode;
|
||||
int n_bits;
|
||||
int rsize = 0;
|
||||
|
||||
insize = 0;
|
||||
|
||||
inbuf [0] = xread_char(fd_in);
|
||||
|
||||
maxbits = inbuf[0] & BIT_MASK;
|
||||
block_mode = inbuf[0] & BLOCK_MODE;
|
||||
maxmaxcode = MAXCODE(maxbits);
|
||||
|
||||
if (maxbits > BITS)
|
||||
{
|
||||
fprintf(stderr, "compressed with %d bits, can only handle %d bits\n", maxbits, BITS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//fprintf(stderr, "Bits: %d, block_mode: %d\n", maxbits, block_mode );
|
||||
|
||||
maxcode = MAXCODE(n_bits = INIT_BITS)-1;
|
||||
bitmask = (1<<n_bits)-1;
|
||||
oldcode = -1;
|
||||
finchar = 0;
|
||||
outpos = 0;
|
||||
posbits = 0<<3;
|
||||
|
||||
free_ent = ((block_mode) ? FIRST : 256);
|
||||
|
||||
clear_tab_prefixof(); /* As above, initialize the first
|
||||
256 entries in the table. */
|
||||
|
||||
for (code = 255 ; code >= 0 ; --code)
|
||||
tab_suffixof(code) = (char_type)code;
|
||||
|
||||
do
|
||||
{
|
||||
resetbuf: ;
|
||||
{
|
||||
int i;
|
||||
int e;
|
||||
int o;
|
||||
|
||||
e = insize-(o = (posbits>>3));
|
||||
|
||||
for (i = 0 ; i < e ; ++i)
|
||||
inbuf[i] = inbuf[i+o];
|
||||
|
||||
insize = e;
|
||||
posbits = 0;
|
||||
}
|
||||
|
||||
if (insize < (int) sizeof(inbuf)-IBUFSIZ)
|
||||
{
|
||||
xread_all(fd_in, inbuf+insize, IBUFSIZ);
|
||||
insize += rsize;
|
||||
}
|
||||
|
||||
inbits = ((rsize > 0) ? (insize - insize%n_bits)<<3 :
|
||||
(insize<<3)-(n_bits-1));
|
||||
|
||||
while (inbits > posbits)
|
||||
{
|
||||
if (free_ent > maxcode)
|
||||
{
|
||||
posbits = ((posbits-1) + ((n_bits<<3) -
|
||||
(posbits-1+(n_bits<<3))%(n_bits<<3)));
|
||||
|
||||
++n_bits;
|
||||
if (n_bits == maxbits)
|
||||
maxcode = maxmaxcode;
|
||||
else
|
||||
maxcode = MAXCODE(n_bits)-1;
|
||||
|
||||
bitmask = (1<<n_bits)-1;
|
||||
goto resetbuf;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
char_type *p = &inbuf[posbits>>3];
|
||||
code = ((((long)(p[0]))|((long)(p[1])<<8)|((long)(p[2])<<16))>>(posbits&0x7))&bitmask;
|
||||
}
|
||||
posbits += n_bits;
|
||||
|
||||
|
||||
if (oldcode == -1)
|
||||
{
|
||||
outbuf[outpos++] = (char_type)(finchar = (int)(oldcode = code));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (code == CLEAR && block_mode)
|
||||
{
|
||||
clear_tab_prefixof();
|
||||
free_ent = FIRST - 1;
|
||||
posbits = ((posbits-1) + ((n_bits<<3) -
|
||||
(posbits-1+(n_bits<<3))%(n_bits<<3)));
|
||||
maxcode = MAXCODE(n_bits = INIT_BITS)-1;
|
||||
bitmask = (1<<n_bits)-1;
|
||||
goto resetbuf;
|
||||
}
|
||||
|
||||
incode = code;
|
||||
stackp = de_stack;
|
||||
|
||||
if (code >= free_ent) /* Special case for KwKwK string. */
|
||||
{
|
||||
if (code > free_ent)
|
||||
{
|
||||
char_type *p;
|
||||
|
||||
posbits -= n_bits;
|
||||
p = &inbuf[posbits>>3];
|
||||
|
||||
fprintf(stderr, "insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)\n", insize, posbits,
|
||||
p[-1],p[0],p[1],p[2],p[3], (posbits&07));
|
||||
fprintf(stderr, "uncompress: corrupt input\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
*--stackp = (char_type)finchar;
|
||||
code = oldcode;
|
||||
}
|
||||
|
||||
while ((cmp_code_int)code >= (cmp_code_int)256)
|
||||
{ /* Generate output characters in reverse order */
|
||||
*--stackp = tab_suffixof(code);
|
||||
code = tab_prefixof(code);
|
||||
}
|
||||
|
||||
*--stackp = (char_type)(finchar = tab_suffixof(code));
|
||||
|
||||
/* And put them out in forward order */
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
if (outpos+(i = (de_stack-stackp)) >= OBUFSIZ)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (i > OBUFSIZ-outpos) i = OBUFSIZ-outpos;
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
memcpy(outbuf+outpos, stackp, i);
|
||||
outpos += i;
|
||||
}
|
||||
|
||||
if (outpos >= OBUFSIZ)
|
||||
{
|
||||
write(fd_out, outbuf, outpos);
|
||||
outpos = 0;
|
||||
}
|
||||
stackp+= i;
|
||||
}
|
||||
while ((i = (de_stack-stackp)) > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(outbuf+outpos, stackp, i);
|
||||
outpos += i;
|
||||
}
|
||||
}
|
||||
|
||||
if ((code = free_ent) < maxmaxcode) /* Generate the new entry. */
|
||||
{
|
||||
tab_prefixof(code) = (unsigned short)oldcode;
|
||||
tab_suffixof(code) = (char_type)finchar;
|
||||
free_ent = code+1;
|
||||
}
|
||||
|
||||
oldcode = incode; /* Remember previous code. */
|
||||
}
|
||||
|
||||
}
|
||||
while (rsize > 0);
|
||||
|
||||
if (outpos > 0) {
|
||||
write(fd_out, outbuf, outpos);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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 <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include "unarchive.h"
|
||||
#include "busybox.h"
|
||||
|
||||
extern void unpack_ar_archive(archive_handle_t *ar_archive)
|
||||
{
|
||||
char magic[7];
|
||||
|
||||
xread_all(ar_archive->src_fd, magic, 7);
|
||||
if (strncmp(magic, "!<arch>", 7) != 0) {
|
||||
error_msg_and_die("Invalid ar magic");
|
||||
}
|
||||
ar_archive->offset += 7;
|
||||
|
||||
while (get_header_ar(ar_archive) == EXIT_SUCCESS);
|
||||
}
|
||||
@@ -0,0 +1,904 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* gunzip implementation for busybox
|
||||
*
|
||||
* Based on GNU gzip v1.2.4 Copyright (C) 1992-1993 Jean-loup Gailly.
|
||||
*
|
||||
* Originally adjusted for busybox by Sven Rudolph <sr1@inf.tu-dresden.de>
|
||||
* based on gzip sources
|
||||
*
|
||||
* Adjusted further by Erik Andersen <andersee@debian.org> to support
|
||||
* files as well as stdin/stdout, and to generally behave itself wrt
|
||||
* command line handling.
|
||||
*
|
||||
* General cleanup to better adhere to the style guide and make use of standard
|
||||
* busybox functions by Glenn McGrath <bug1@optushome.com.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
|
||||
*
|
||||
*
|
||||
* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
|
||||
* Copyright (C) 1992-1993 Jean-loup Gailly
|
||||
* The unzip code was written and put in the public domain by Mark Adler.
|
||||
* Portions of the lzw code are derived from the public domain 'compress'
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#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 <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 {
|
||||
unsigned char e; /* number of extra bits or operation */
|
||||
unsigned char b; /* number of bits in this code or subcode */
|
||||
union {
|
||||
unsigned short n; /* literal, length base, or distance base */
|
||||
struct huft_s *t; /* pointer to next level of table */
|
||||
} v;
|
||||
} huft_t;
|
||||
|
||||
static int gunzip_src_fd;
|
||||
static int gunzip_dst_fd;
|
||||
unsigned int gunzip_bytes_out; /* number of output bytes */
|
||||
static unsigned int gunzip_outbuf_count; /* bytes in output buffer */
|
||||
|
||||
/* This is used to sanify any unused bits from the bitbuffer
|
||||
* so they arent skipped when reading trailers (trailing headers) */
|
||||
unsigned char gunzip_in_buffer_count;
|
||||
unsigned char *gunzip_in_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;
|
||||
|
||||
static unsigned char *gunzip_window;
|
||||
static unsigned int *gunzip_crc_table;
|
||||
unsigned int 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) */
|
||||
#define N_MAX 288 /* maximum number of codes in any set */
|
||||
|
||||
static unsigned int gunzip_hufts; /* track memory usage */
|
||||
static unsigned int gunzip_bb; /* bit buffer */
|
||||
static unsigned char gunzip_bk; /* bits in bit buffer */
|
||||
|
||||
static const unsigned short mask_bits[] = {
|
||||
0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
|
||||
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
|
||||
};
|
||||
|
||||
/* 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
|
||||
};
|
||||
|
||||
/* 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
|
||||
}; /* 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
|
||||
};
|
||||
|
||||
/* 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
|
||||
};
|
||||
|
||||
/* Tables for deflate from PKZIP's appnote.txt. */
|
||||
/* Order of the bit length code lengths */
|
||||
static const unsigned char border[] = {
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
|
||||
};
|
||||
|
||||
static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current, const unsigned int required)
|
||||
{
|
||||
while (*current < required) {
|
||||
bitbuffer |= ((unsigned int) xread_char(gunzip_src_fd)) << *current;
|
||||
*current += 8;
|
||||
}
|
||||
|
||||
return(bitbuffer);
|
||||
}
|
||||
|
||||
static void abort_gzip(void)
|
||||
{
|
||||
error_msg("gzip aborted\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
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
|
||||
* each table.
|
||||
* t: table to free
|
||||
*/
|
||||
static int huft_free(huft_t * t)
|
||||
{
|
||||
huft_t *p;
|
||||
huft_t *q;
|
||||
|
||||
/* Go through linked list, freeing from the malloced (t[-1]) address. */
|
||||
p = t;
|
||||
while (p != (huft_t *) NULL) {
|
||||
q = (--p)->v.t;
|
||||
free((char *) p);
|
||||
p = q;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Given a list of code lengths and a maximum table size, make a set of
|
||||
* tables to decode that set of codes. Return zero on success, one if
|
||||
* the given code set is incomplete (the tables are still built in this
|
||||
* case), two if the input is invalid (all zero length codes or an
|
||||
* oversubscribed set of lengths), and three if not enough memory.
|
||||
*
|
||||
* b: code lengths in bits (all assumed <= BMAX)
|
||||
* n: number of codes (assumed <= N_MAX)
|
||||
* s: number of simple-valued codes (0..s-1)
|
||||
* d: list of base values for non-simple codes
|
||||
* e: list of extra bits for non-simple codes
|
||||
* 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)
|
||||
{
|
||||
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 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 */
|
||||
|
||||
/* Generate counts for each bit length */
|
||||
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) */
|
||||
} while (--i);
|
||||
if (c[0] == n) { /* null input--all zero length codes */
|
||||
*t = (huft_t *) NULL;
|
||||
*m = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
/* 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 */
|
||||
}
|
||||
}
|
||||
if ((y -= c[i]) < 0) {
|
||||
return 2;
|
||||
}
|
||||
c[i] += y;
|
||||
|
||||
/* Generate starting offsets into the value table for each length */
|
||||
x[1] = j = 0;
|
||||
p = c + 1;
|
||||
xp = x + 2;
|
||||
while (--i) { /* note that i == g from above */
|
||||
*xp++ = (j += *p++);
|
||||
}
|
||||
|
||||
/* Make a table of values in order of bit lengths */
|
||||
p = b;
|
||||
i = 0;
|
||||
do {
|
||||
if ((j = *p++) != 0) {
|
||||
v[x[j]++] = i;
|
||||
}
|
||||
} 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) */
|
||||
u[0] = (huft_t *) NULL; /* just to keep compilers happy */
|
||||
q = (huft_t *) NULL; /* ditto */
|
||||
z = 0; /* ditto */
|
||||
|
||||
/* go through the bit lengths (k already is bits in shortest code) */
|
||||
for (; k <= g; k++) {
|
||||
a = c[k];
|
||||
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 */
|
||||
|
||||
/* 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 */
|
||||
xp = c + k;
|
||||
while (++j < z) { /* try smaller tables up to z bits */
|
||||
if ((f <<= 1) <= *++xp) {
|
||||
break; /* enough codes to use up j bits */
|
||||
}
|
||||
f -= *xp; /* else deduct codes from patterns */
|
||||
}
|
||||
}
|
||||
z = 1 << j; /* table entries for j-bit table */
|
||||
|
||||
/* allocate and link in new table */
|
||||
q = (huft_t *) xmalloc((z + 1) * sizeof(huft_t));
|
||||
|
||||
gunzip_hufts += z + 1; /* track memory usage */
|
||||
*t = q + 1; /* link to list for huft_free() */
|
||||
*(t = &(q->v.t)) = NULL;
|
||||
u[h] = ++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 */
|
||||
}
|
||||
}
|
||||
|
||||
/* set up table entry in r */
|
||||
r.b = (unsigned char) (k - w);
|
||||
if (p >= v + n) {
|
||||
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++ */
|
||||
} else {
|
||||
r.e = (unsigned char) e[*p - s]; /* non-simple--look up in lists */
|
||||
r.v.n = d[*p++ - s];
|
||||
}
|
||||
|
||||
/* fill code-like entries with r */
|
||||
f = 1 << (k - w);
|
||||
for (j = i >> w; j < z; j += f) {
|
||||
q[j] = r;
|
||||
}
|
||||
|
||||
/* backwards increment the k-bit code i */
|
||||
for (j = 1 << (k - 1); i & j; j >>= 1) {
|
||||
i ^= j;
|
||||
}
|
||||
i ^= j;
|
||||
|
||||
/* backup over finished tables */
|
||||
while ((i & ((1 << w) - 1)) != x[h]) {
|
||||
h--; /* don't need to update q */
|
||||
w -= l;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Return true (1) if we were given an incomplete table */
|
||||
return y != 0 && g != 1;
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
* Write the output gunzip_window gunzip_window[0..gunzip_outbuf_count-1] and update crc and gunzip_bytes_out.
|
||||
* (Used for the decompressed data only.)
|
||||
*/
|
||||
static void flush_gunzip_window(void)
|
||||
{
|
||||
int n;
|
||||
|
||||
for (n = 0; n < gunzip_outbuf_count; n++) {
|
||||
gunzip_crc = gunzip_crc_table[((int) gunzip_crc ^ (gunzip_window[n])) & 0xff] ^ (gunzip_crc >> 8);
|
||||
}
|
||||
|
||||
if (write(gunzip_dst_fd, gunzip_window, gunzip_outbuf_count) != gunzip_outbuf_count) {
|
||||
error_msg_and_die("Couldnt write");
|
||||
}
|
||||
gunzip_bytes_out += gunzip_outbuf_count;
|
||||
gunzip_outbuf_count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* inflate (decompress) the codes in a deflated (compressed) block.
|
||||
* Return an error code or zero if it all goes ok.
|
||||
*
|
||||
* tl, td: literal/length and distance decoder tables
|
||||
* bl, bd: number of bits decoded by tl[] and td[]
|
||||
*/
|
||||
static int inflate_codes(huft_t * tl, huft_t * td, const unsigned int bl, const unsigned int bd)
|
||||
{
|
||||
unsigned int e; /* table entry flag/number of extra bits */
|
||||
unsigned int n, d; /* length and index for copy */
|
||||
unsigned int w; /* current gunzip_window position */
|
||||
huft_t *t; /* pointer to table entry */
|
||||
unsigned int ml, md; /* masks for bl and bd bits */
|
||||
unsigned int b; /* bit buffer */
|
||||
unsigned int k; /* number of bits in bit buffer */
|
||||
|
||||
/* make local copies of globals */
|
||||
b = gunzip_bb; /* initialize bit buffer */
|
||||
k = gunzip_bk;
|
||||
w = gunzip_outbuf_count; /* initialize gunzip_window position */
|
||||
|
||||
/* inflate the coded data */
|
||||
ml = mask_bits[bl]; /* precompute masks for speed */
|
||||
md = mask_bits[bd];
|
||||
while (1) { /* do until end of block */
|
||||
b = fill_bitbuffer(b, &k, bl);
|
||||
if ((e = (t = tl + ((unsigned) b & ml))->e) > 16)
|
||||
do {
|
||||
if (e == 99) {
|
||||
return 1;
|
||||
}
|
||||
b >>= t->b;
|
||||
k -= t->b;
|
||||
e -= 16;
|
||||
b = fill_bitbuffer(b, &k, e);
|
||||
} while ((e =
|
||||
(t = t->v.t + ((unsigned) b & mask_bits[e]))->e) > 16);
|
||||
b >>= t->b;
|
||||
k -= t->b;
|
||||
if (e == 16) { /* then it's a literal */
|
||||
gunzip_window[w++] = (unsigned char) t->v.n;
|
||||
if (w == gunzip_wsize) {
|
||||
gunzip_outbuf_count = (w);
|
||||
flush_gunzip_window();
|
||||
w = 0;
|
||||
}
|
||||
} else { /* it's an EOB or a length */
|
||||
|
||||
/* exit if end of block */
|
||||
if (e == 15) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* get length of block to copy */
|
||||
b = fill_bitbuffer(b, &k, e);
|
||||
n = t->v.n + ((unsigned) b & mask_bits[e]);
|
||||
b >>= e;
|
||||
k -= e;
|
||||
|
||||
/* decode distance of block to copy */
|
||||
b = fill_bitbuffer(b, &k, bd);
|
||||
if ((e = (t = td + ((unsigned) b & md))->e) > 16)
|
||||
do {
|
||||
if (e == 99)
|
||||
return 1;
|
||||
b >>= t->b;
|
||||
k -= t->b;
|
||||
e -= 16;
|
||||
b = fill_bitbuffer(b, &k, e);
|
||||
} while ((e =
|
||||
(t =
|
||||
t->v.t + ((unsigned) b & mask_bits[e]))->e) > 16);
|
||||
b >>= t->b;
|
||||
k -= t->b;
|
||||
b = fill_bitbuffer(b, &k, e);
|
||||
d = w - t->v.n - ((unsigned) b & mask_bits[e]);
|
||||
b >>= e;
|
||||
k -= e;
|
||||
|
||||
/* do the copy */
|
||||
do {
|
||||
n -= (e =
|
||||
(e =
|
||||
gunzip_wsize - ((d &= gunzip_wsize - 1) > w ? d : w)) > n ? n : e);
|
||||
/* copy to new buffer to prevent possible overwrite */
|
||||
if (w - d >= e) { /* (this test assumes unsigned comparison) */
|
||||
memcpy(gunzip_window + w, gunzip_window + d, e);
|
||||
w += e;
|
||||
d += e;
|
||||
} else {
|
||||
/* do it slow to avoid memcpy() overlap */
|
||||
/* !NOMEMCPY */
|
||||
do {
|
||||
gunzip_window[w++] = gunzip_window[d++];
|
||||
} while (--e);
|
||||
}
|
||||
if (w == gunzip_wsize) {
|
||||
gunzip_outbuf_count = (w);
|
||||
flush_gunzip_window();
|
||||
w = 0;
|
||||
}
|
||||
|
||||
} while (n);
|
||||
}
|
||||
}
|
||||
|
||||
/* restore the globals from the locals */
|
||||
gunzip_outbuf_count = w; /* restore global gunzip_window pointer */
|
||||
gunzip_bb = b; /* restore global bit buffer */
|
||||
gunzip_bk = k;
|
||||
|
||||
/* done */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* decompress an inflated block
|
||||
* e: last block flag
|
||||
*
|
||||
* GLOBAL VARIABLES: bb, kk,
|
||||
*/
|
||||
static int inflate_block(int *e)
|
||||
{
|
||||
unsigned t; /* block type */
|
||||
register unsigned int b; /* bit buffer */
|
||||
unsigned int k; /* number of bits in bit buffer */
|
||||
|
||||
/* make local bit buffer */
|
||||
|
||||
b = gunzip_bb;
|
||||
k = gunzip_bk;
|
||||
|
||||
/* read in last block bit */
|
||||
b = fill_bitbuffer(b, &k, 1);
|
||||
*e = (int) b & 1;
|
||||
b >>= 1;
|
||||
k -= 1;
|
||||
|
||||
/* read in block type */
|
||||
b = fill_bitbuffer(b, &k, 2);
|
||||
t = (unsigned) b & 3;
|
||||
b >>= 2;
|
||||
k -= 2;
|
||||
|
||||
/* restore the global bit buffer */
|
||||
gunzip_bb = b;
|
||||
gunzip_bk = k;
|
||||
|
||||
/* inflate that block type */
|
||||
switch (t) {
|
||||
case 0: /* Inflate stored */
|
||||
{
|
||||
unsigned int n; /* number of bytes in block */
|
||||
unsigned int w; /* current gunzip_window position */
|
||||
unsigned int b_stored; /* bit buffer */
|
||||
unsigned int k_stored; /* number of bits in bit buffer */
|
||||
|
||||
/* make local copies of globals */
|
||||
b_stored = gunzip_bb; /* initialize bit buffer */
|
||||
k_stored = gunzip_bk;
|
||||
w = gunzip_outbuf_count; /* initialize gunzip_window position */
|
||||
|
||||
/* go to byte boundary */
|
||||
n = k_stored & 7;
|
||||
b_stored >>= n;
|
||||
k_stored -= n;
|
||||
|
||||
/* get the length and its complement */
|
||||
b_stored = fill_bitbuffer(b_stored, &k_stored, 16);
|
||||
n = ((unsigned) b_stored & 0xffff);
|
||||
b_stored >>= 16;
|
||||
k_stored -= 16;
|
||||
|
||||
b_stored = fill_bitbuffer(b_stored, &k_stored, 16);
|
||||
if (n != (unsigned) ((~b_stored) & 0xffff)) {
|
||||
return 1; /* error in compressed data */
|
||||
}
|
||||
b_stored >>= 16;
|
||||
k_stored -= 16;
|
||||
|
||||
/* read and output the compressed data */
|
||||
while (n--) {
|
||||
b_stored = fill_bitbuffer(b_stored, &k_stored, 8);
|
||||
gunzip_window[w++] = (unsigned char) b_stored;
|
||||
if (w == (unsigned int) gunzip_wsize) {
|
||||
gunzip_outbuf_count = (w);
|
||||
flush_gunzip_window();
|
||||
w = 0;
|
||||
}
|
||||
b_stored >>= 8;
|
||||
k_stored -= 8;
|
||||
}
|
||||
|
||||
/* restore the globals from the locals */
|
||||
gunzip_outbuf_count = w; /* restore global gunzip_window pointer */
|
||||
gunzip_bb = b_stored; /* restore global bit buffer */
|
||||
gunzip_bk = k_stored;
|
||||
return 0;
|
||||
}
|
||||
case 1: /* Inflate fixed
|
||||
* decompress an inflated type 1 (fixed Huffman codes) block. We should
|
||||
* either replace this with a custom decoder, or at least precompute the
|
||||
* Huffman tables.
|
||||
*/
|
||||
{
|
||||
int i; /* temporary variable */
|
||||
huft_t *tl; /* literal/length code table */
|
||||
huft_t *td; /* distance code table */
|
||||
unsigned int bl; /* lookup bits for tl */
|
||||
unsigned int bd; /* lookup bits for td */
|
||||
unsigned int l[288]; /* length list for huft_build */
|
||||
|
||||
/* set up literal table */
|
||||
for (i = 0; i < 144; i++) {
|
||||
l[i] = 8;
|
||||
}
|
||||
for (; i < 256; i++) {
|
||||
l[i] = 9;
|
||||
}
|
||||
for (; i < 280; i++) {
|
||||
l[i] = 7;
|
||||
}
|
||||
for (; i < 288; i++) { /* make a complete, but wrong code set */
|
||||
l[i] = 8;
|
||||
}
|
||||
bl = 7;
|
||||
if ((i = huft_build(l, 288, 257, cplens, cplext, &tl, &bl)) != 0) {
|
||||
return i;
|
||||
}
|
||||
|
||||
/* set up distance table */
|
||||
for (i = 0; i < 30; i++) { /* make an incomplete code set */
|
||||
l[i] = 5;
|
||||
}
|
||||
bd = 5;
|
||||
if ((i = huft_build(l, 30, 0, cpdist, cpdext, &td, &bd)) > 1) {
|
||||
huft_free(tl);
|
||||
return i;
|
||||
}
|
||||
|
||||
/* decompress until an end-of-block code */
|
||||
if (inflate_codes(tl, td, bl, bd)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* free the decoding tables, return */
|
||||
huft_free(tl);
|
||||
huft_free(td);
|
||||
return 0;
|
||||
}
|
||||
case 2: /* Inflate dynamic */
|
||||
{
|
||||
const int dbits = 6; /* bits in base distance lookup table */
|
||||
const int lbits = 9; /* bits in base literal/length lookup table */
|
||||
|
||||
huft_t *tl; /* literal/length code table */
|
||||
huft_t *td; /* distance code table */
|
||||
unsigned int i; /* temporary variables */
|
||||
unsigned int j;
|
||||
unsigned int l; /* last length */
|
||||
unsigned int m; /* mask for bit lengths table */
|
||||
unsigned int n; /* number of lengths to get */
|
||||
unsigned int bl; /* lookup bits for tl */
|
||||
unsigned int bd; /* lookup bits for td */
|
||||
unsigned int nb; /* number of bit length codes */
|
||||
unsigned int nl; /* number of literal/length codes */
|
||||
unsigned int nd; /* number of distance codes */
|
||||
|
||||
unsigned int ll[286 + 30]; /* literal/length and distance code lengths */
|
||||
unsigned int b_dynamic; /* bit buffer */
|
||||
unsigned int k_dynamic; /* number of bits in bit buffer */
|
||||
|
||||
/* make local bit buffer */
|
||||
b_dynamic = gunzip_bb;
|
||||
k_dynamic = gunzip_bk;
|
||||
|
||||
/* read in table lengths */
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 5);
|
||||
nl = 257 + ((unsigned int) b_dynamic & 0x1f); /* number of literal/length codes */
|
||||
|
||||
b_dynamic >>= 5;
|
||||
k_dynamic -= 5;
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 5);
|
||||
nd = 1 + ((unsigned int) b_dynamic & 0x1f); /* number of distance codes */
|
||||
|
||||
b_dynamic >>= 5;
|
||||
k_dynamic -= 5;
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 4);
|
||||
nb = 4 + ((unsigned int) b_dynamic & 0xf); /* number of bit length codes */
|
||||
|
||||
b_dynamic >>= 4;
|
||||
k_dynamic -= 4;
|
||||
if (nl > 286 || nd > 30) {
|
||||
return 1; /* bad lengths */
|
||||
}
|
||||
|
||||
/* read in bit-length-code lengths */
|
||||
for (j = 0; j < nb; j++) {
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 3);
|
||||
ll[border[j]] = (unsigned int) b_dynamic & 7;
|
||||
b_dynamic >>= 3;
|
||||
k_dynamic -= 3;
|
||||
}
|
||||
for (; j < 19; j++) {
|
||||
ll[border[j]] = 0;
|
||||
}
|
||||
|
||||
/* build decoding table for trees--single level, 7 bit lookup */
|
||||
bl = 7;
|
||||
i = huft_build(ll, 19, 19, NULL, NULL, &tl, &bl);
|
||||
if (i != 0) {
|
||||
if (i == 1) {
|
||||
huft_free(tl);
|
||||
}
|
||||
return i; /* incomplete code set */
|
||||
}
|
||||
|
||||
/* read in literal and distance code lengths */
|
||||
n = nl + nd;
|
||||
m = mask_bits[bl];
|
||||
i = l = 0;
|
||||
while ((unsigned int) i < n) {
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, (unsigned int)bl);
|
||||
j = (td = tl + ((unsigned int) b_dynamic & m))->b;
|
||||
b_dynamic >>= j;
|
||||
k_dynamic -= j;
|
||||
j = td->v.n;
|
||||
if (j < 16) { /* length of code in bits (0..15) */
|
||||
ll[i++] = l = j; /* save last length in l */
|
||||
} else if (j == 16) { /* repeat last length 3 to 6 times */
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 2);
|
||||
j = 3 + ((unsigned int) b_dynamic & 3);
|
||||
b_dynamic >>= 2;
|
||||
k_dynamic -= 2;
|
||||
if ((unsigned int) i + j > n) {
|
||||
return 1;
|
||||
}
|
||||
while (j--) {
|
||||
ll[i++] = l;
|
||||
}
|
||||
} else if (j == 17) { /* 3 to 10 zero length codes */
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 3);
|
||||
j = 3 + ((unsigned int) b_dynamic & 7);
|
||||
b_dynamic >>= 3;
|
||||
k_dynamic -= 3;
|
||||
if ((unsigned int) i + j > n) {
|
||||
return 1;
|
||||
}
|
||||
while (j--) {
|
||||
ll[i++] = 0;
|
||||
}
|
||||
l = 0;
|
||||
} else { /* j == 18: 11 to 138 zero length codes */
|
||||
b_dynamic = fill_bitbuffer(b_dynamic, &k_dynamic, 7);
|
||||
j = 11 + ((unsigned int) b_dynamic & 0x7f);
|
||||
b_dynamic >>= 7;
|
||||
k_dynamic -= 7;
|
||||
if ((unsigned int) i + j > n) {
|
||||
return 1;
|
||||
}
|
||||
while (j--) {
|
||||
ll[i++] = 0;
|
||||
}
|
||||
l = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* free decoding table for trees */
|
||||
huft_free(tl);
|
||||
|
||||
/* restore the global bit buffer */
|
||||
gunzip_bb = b_dynamic;
|
||||
gunzip_bk = k_dynamic;
|
||||
|
||||
/* build the decoding tables for literal/length and distance codes */
|
||||
bl = lbits;
|
||||
|
||||
if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) {
|
||||
if (i == 1) {
|
||||
error_msg_and_die("Incomplete literal tree");
|
||||
huft_free(tl);
|
||||
}
|
||||
return i; /* incomplete code set */
|
||||
}
|
||||
|
||||
bd = dbits;
|
||||
if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) {
|
||||
if (i == 1) {
|
||||
error_msg_and_die("incomplete distance tree");
|
||||
huft_free(td);
|
||||
}
|
||||
huft_free(tl);
|
||||
return i; /* incomplete code set */
|
||||
}
|
||||
|
||||
/* decompress until an end-of-block code */
|
||||
if (inflate_codes(tl, td, bl, bd)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* free the decoding tables, return */
|
||||
huft_free(tl);
|
||||
huft_free(td);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
/* bad block type */
|
||||
error_msg("bad block type %d\n", t);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* decompress an inflated entry
|
||||
*
|
||||
* GLOBAL VARIABLES: gunzip_outbuf_count, bk, gunzip_bb, hufts, inptr
|
||||
*/
|
||||
extern int inflate(int in, int out)
|
||||
{
|
||||
typedef void (*sig_type) (int);
|
||||
int e; /* last block flag */
|
||||
int r; /* result code */
|
||||
unsigned h = 0; /* maximum struct huft's malloc'ed */
|
||||
|
||||
/* Allocate all global buffers (for DYN_ALLOC option) */
|
||||
gunzip_window = xmalloc(0x8000);
|
||||
gunzip_outbuf_count = 0;
|
||||
gunzip_bytes_out = 0;
|
||||
|
||||
gunzip_src_fd = in;
|
||||
gunzip_dst_fd = out;
|
||||
|
||||
gunzip_in_buffer = malloc(8);
|
||||
|
||||
if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
|
||||
(void) signal(SIGINT, (sig_type) abort_gzip);
|
||||
}
|
||||
#ifdef SIGHUP
|
||||
if (signal(SIGHUP, SIG_IGN) != SIG_IGN) {
|
||||
(void) signal(SIGHUP, (sig_type) abort_gzip);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* initialize gunzip_window, bit buffer */
|
||||
gunzip_bk = 0;
|
||||
gunzip_bb = 0;
|
||||
|
||||
/* Create the crc table */
|
||||
make_gunzip_crc_table();
|
||||
|
||||
/* decompress until the last block */
|
||||
do {
|
||||
gunzip_hufts = 0;
|
||||
r = inflate_block(&e);
|
||||
if (r != 0) {
|
||||
error_msg_and_die("inflate error %d", r);
|
||||
return r;
|
||||
}
|
||||
if (gunzip_hufts > h) {
|
||||
h = gunzip_hufts;
|
||||
}
|
||||
} while (!e);
|
||||
|
||||
/* write any buffered uncompressed data */
|
||||
flush_gunzip_window();
|
||||
free(gunzip_window);
|
||||
|
||||
/* Cleanup */
|
||||
free(gunzip_crc_table);
|
||||
|
||||
/* Store unused bytes in a global buffer so calling applets can access it */
|
||||
gunzip_in_buffer_count = 0;
|
||||
if (gunzip_bk >= 8) {
|
||||
/* Undo too much lookahead. The next read will be byte aligned
|
||||
* so we can discard unused bits in the last meaningful byte. */
|
||||
gunzip_in_buffer[gunzip_in_buffer_count] = gunzip_bb & 0xff;
|
||||
gunzip_in_buffer_count++;
|
||||
gunzip_bb >>= 8;
|
||||
gunzip_bk -= 8;
|
||||
}
|
||||
|
||||
/* return success */
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini rpm2cpio implementation for busybox
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h> /* For ntohl & htonl function */
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
#include "unarchive.h"
|
||||
|
||||
#define RPM_MAGIC "\355\253\356\333"
|
||||
#define RPM_HEADER_MAGIC "\216\255\350"
|
||||
|
||||
struct rpm_lead {
|
||||
unsigned char magic[4];
|
||||
u_int8_t major, minor;
|
||||
u_int16_t type;
|
||||
u_int16_t archnum;
|
||||
char name[66];
|
||||
u_int16_t osnum;
|
||||
u_int16_t signature_type;
|
||||
char reserved[16];
|
||||
};
|
||||
|
||||
struct rpm_header {
|
||||
char magic[3]; /* 3 byte magic: 0x8e 0xad 0xe8 */
|
||||
u_int8_t version; /* 1 byte version number */
|
||||
u_int32_t reserved; /* 4 bytes reserved */
|
||||
u_int32_t entries; /* Number of entries in header (4 bytes) */
|
||||
u_int32_t size; /* Size of store (4 bytes) */
|
||||
};
|
||||
|
||||
void skip_header(int rpm_fd)
|
||||
{
|
||||
struct rpm_header header;
|
||||
|
||||
xread_all(rpm_fd, &header, sizeof(struct rpm_header));
|
||||
if (strncmp((char *) &header.magic, RPM_HEADER_MAGIC, 3) != 0) {
|
||||
error_msg_and_die("Invalid RPM header magic"); /* Invalid magic */
|
||||
}
|
||||
if (header.version != 1) {
|
||||
error_msg_and_die("Unsupported RPM header version"); /* This program only supports v1 headers */
|
||||
}
|
||||
header.entries = ntohl(header.entries);
|
||||
header.size = ntohl(header.size);
|
||||
lseek (rpm_fd, 16 * header.entries, SEEK_CUR); /* Seek past index entries */
|
||||
lseek (rpm_fd, header.size, SEEK_CUR); /* Seek past store */
|
||||
}
|
||||
|
||||
/* No getopt required */
|
||||
extern int rpm2cpio_main(int argc, char **argv)
|
||||
{
|
||||
struct rpm_lead lead;
|
||||
int rpm_fd;
|
||||
unsigned char magic[2];
|
||||
|
||||
if (argc == 1) {
|
||||
rpm_fd = fileno(stdin);
|
||||
} else {
|
||||
rpm_fd = xopen(argv[1], O_RDONLY);
|
||||
}
|
||||
|
||||
xread_all(rpm_fd, &lead, sizeof(struct rpm_lead));
|
||||
if (strncmp((char *) &lead.magic, RPM_MAGIC, 4) != 0) {
|
||||
error_msg_and_die("Invalid RPM magic"); /* Just check the magic, the rest is irrelevant */
|
||||
}
|
||||
|
||||
/* Skip the signature header */
|
||||
skip_header(rpm_fd);
|
||||
data_align(rpm_fd, lseek(rpm_fd, 0, SEEK_CUR), 8);
|
||||
|
||||
/* Skip the main header */
|
||||
skip_header(rpm_fd);
|
||||
|
||||
xread_all(rpm_fd, &magic, 2);
|
||||
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
|
||||
error_msg_and_die("Invalid gzip magic");
|
||||
}
|
||||
|
||||
check_header_gzip(rpm_fd);
|
||||
if (inflate(rpm_fd, fileno(stdout)) != 0) {
|
||||
error_msg("Error inflating");
|
||||
}
|
||||
check_trailer_gzip(rpm_fd);
|
||||
|
||||
close(rpm_fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
+507
-938
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,244 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini unzip implementation for busybox
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
/* For reference to format see http://www.pkware.com/support/appnote.html */
|
||||
|
||||
/* TODO Endian issues, exclude, should we accept input from stdin ? */
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.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
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static void header_verbose_list_unzip(const file_header_t *file_header)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
archive_handle_t *archive_handle;
|
||||
unsigned int total_size = 0;
|
||||
unsigned int total_entries = 0;
|
||||
char *base_dir = NULL;
|
||||
int opt = 0;
|
||||
|
||||
/* Initialise */
|
||||
archive_handle = init_handle();
|
||||
archive_handle->action_data = NULL;
|
||||
archive_handle->action_header = header_list_unzip;
|
||||
|
||||
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;
|
||||
break;
|
||||
case 'n': /* never overwright existing files */
|
||||
break;
|
||||
case 'o':
|
||||
archive_handle->flags = ARCHIVE_EXTRACT_UNCONDITIONAL;
|
||||
break;
|
||||
case 'p': /* extract files to stdout */
|
||||
archive_handle->action_data = data_extract_to_stdout;
|
||||
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:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (argc == optind) {
|
||||
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");
|
||||
}
|
||||
|
||||
if (*argv[optind] == '-') {
|
||||
archive_handle->src_fd = fileno(stdin);
|
||||
} else {
|
||||
archive_handle->src_fd = xopen(argv[optind++], O_RDONLY);
|
||||
}
|
||||
|
||||
if ((base_dir) && (chdir(base_dir))) {
|
||||
perror_msg_and_die("Couldnt chdir");
|
||||
}
|
||||
|
||||
while (optind < argc) {
|
||||
archive_handle->filter = filter_accept_list;
|
||||
archive_handle->accept = add_to_list(archive_handle->accept, argv[optind]);
|
||||
optind++;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
unsigned int magic;
|
||||
int dst_fd;
|
||||
|
||||
/* TODO Endian issues */
|
||||
xread_all(archive_handle->src_fd, &magic, 4);
|
||||
archive_handle->offset += 4;
|
||||
|
||||
if (magic == ZIP_CDS_MAGIC) {
|
||||
break;
|
||||
}
|
||||
else if (magic != ZIP_FILEHEADER_MAGIC) {
|
||||
error_msg_and_die("Invlaide zip magic");
|
||||
}
|
||||
|
||||
/* Read the file header */
|
||||
xread_all(archive_handle->src_fd, zip_header.raw, 26);
|
||||
archive_handle->offset += 26;
|
||||
archive_handle->file_header->mode = S_IFREG | 0777;
|
||||
|
||||
if (zip_header.formated.method != 8) {
|
||||
error_msg_and_die("Unsupported compression method %d\n", zip_header.formated.method);
|
||||
}
|
||||
|
||||
/* Read filename */
|
||||
archive_handle->file_header->name = xmalloc(zip_header.formated.filename_len + 1);
|
||||
xread_all(archive_handle->src_fd, 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';
|
||||
|
||||
/* 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;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* 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 = xopen(archive_handle->file_header->name, O_WRONLY | O_CREAT);
|
||||
inflate(archive_handle->src_fd, dst_fd);
|
||||
close(dst_fd);
|
||||
chmod(archive_handle->file_header->name, archive_handle->file_header->mode);
|
||||
|
||||
/* Validate decompression - crc */
|
||||
if (zip_header.formated.crc32 != (gunzip_crc ^ 0xffffffffL)) {
|
||||
error_msg("Invalid compressed data--crc error");
|
||||
}
|
||||
|
||||
/* Validate decompression - size */
|
||||
if (gunzip_bytes_out != zip_header.formated.ucmpsize) {
|
||||
error_msg("Invalid compressed data--length error");
|
||||
}
|
||||
}
|
||||
|
||||
/* 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++;
|
||||
|
||||
archive_handle->action_header(archive_handle->file_header);
|
||||
|
||||
/* Data descriptor section */
|
||||
if (zip_header.formated.flags & 4) {
|
||||
/* skip over duplicate crc, compressed size and uncompressed size */
|
||||
unsigned short i;
|
||||
for (i = 0; i != 12; i++) {
|
||||
xread_char(archive_handle->src_fd);
|
||||
}
|
||||
archive_handle->offset += 12;
|
||||
}
|
||||
}
|
||||
/* Central directory section */
|
||||
|
||||
if (archive_handle->action_header == header_verbose_list_unzip) {
|
||||
printf(" -------- -------\n");
|
||||
printf("%9d %d files\n", total_size, total_entries);
|
||||
}
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
#include "busybox.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#undef APPLET
|
||||
#undef APPLET_NOUSAGE
|
||||
#undef PROTOTYPES
|
||||
#include "applets.h"
|
||||
|
||||
#define bb_need_full_version
|
||||
#define BB_DECLARE_EXTERN
|
||||
#include "messages.c"
|
||||
|
||||
static int been_there_done_that = 0;
|
||||
const char *applet_name;
|
||||
|
||||
#ifdef BB_FEATURE_INSTALLER
|
||||
/*
|
||||
* directory table
|
||||
* this should be consistent w/ the enum, busybox.h::Location,
|
||||
* or else...
|
||||
*/
|
||||
static char* install_dir[] = {
|
||||
"/",
|
||||
"/bin",
|
||||
"/sbin",
|
||||
"/usr/bin",
|
||||
"/usr/sbin",
|
||||
};
|
||||
|
||||
/* 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 char *busybox_fullpath()
|
||||
{
|
||||
pid_t pid;
|
||||
char path[256];
|
||||
char proc[256];
|
||||
int len;
|
||||
|
||||
pid = getpid();
|
||||
sprintf(proc, "/proc/%d/exe", pid);
|
||||
len = readlink(proc, path, 256);
|
||||
if (len != -1) {
|
||||
path[len] = 0;
|
||||
} else {
|
||||
perror_msg("%s", proc);
|
||||
return NULL;
|
||||
}
|
||||
return strdup(path);
|
||||
}
|
||||
|
||||
/* create (sym)links for each applet */
|
||||
static void install_links(const char *busybox, int use_symbolic_links)
|
||||
{
|
||||
__link_f Link = link;
|
||||
|
||||
char command[256];
|
||||
int i;
|
||||
int rc;
|
||||
|
||||
if (use_symbolic_links)
|
||||
Link = symlink;
|
||||
|
||||
for (i = 0; applets[i].name != NULL; i++) {
|
||||
sprintf ( command, "%s/%s",
|
||||
install_dir[applets[i].location], applets[i].name);
|
||||
rc = Link(busybox, command);
|
||||
|
||||
if (rc) {
|
||||
perror_msg("%s", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* BB_FEATURE_INSTALLER */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct BB_applet search_applet, *applet;
|
||||
const char *s;
|
||||
|
||||
for (s = applet_name = argv[0]; *s != '\0';) {
|
||||
if (*s++ == '/')
|
||||
applet_name = s;
|
||||
}
|
||||
|
||||
#ifdef BB_SH
|
||||
/* Add in a special case hack -- whenever **argv == '-'
|
||||
* (i.e. '-su' or '-sh') always invoke the shell */
|
||||
if (**argv == '-' && *(*argv+1)!= '-') {
|
||||
exit(((*(shell_main)) (argc, argv)));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Do a binary search to find the applet entry given the name. */
|
||||
search_applet.name = applet_name;
|
||||
applet = bsearch(&search_applet, applets, NUM_APPLETS,
|
||||
sizeof(struct BB_applet), applet_name_compare);
|
||||
if (applet != NULL) {
|
||||
if (applet->usage && argv[1] && strcmp(argv[1], "--help") == 0)
|
||||
usage(applet->usage);
|
||||
exit((*(applet->main)) (argc, argv));
|
||||
}
|
||||
|
||||
error_msg_and_die("applet not found\n");
|
||||
}
|
||||
|
||||
|
||||
int busybox_main(int argc, char **argv)
|
||||
{
|
||||
int col = 0, len, i;
|
||||
|
||||
#ifdef BB_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)) {
|
||||
int use_symbolic_links = 0;
|
||||
int rc = 0;
|
||||
char *busybox;
|
||||
|
||||
/* to use symlinks, or not to use symlinks... */
|
||||
if (argc > 2) {
|
||||
if ((strcmp(argv[2], "-s") == 0)) {
|
||||
use_symbolic_links = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* link */
|
||||
busybox = busybox_fullpath();
|
||||
if (busybox) {
|
||||
install_links(busybox, use_symbolic_links);
|
||||
free(busybox);
|
||||
} else {
|
||||
rc = 1;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
#endif /* BB_FEATURE_INSTALLER */
|
||||
|
||||
argc--;
|
||||
|
||||
/* If we've already been here once, exit now */
|
||||
if (been_there_done_that == 1 || argc < 1) {
|
||||
const struct BB_applet *a = applets;
|
||||
|
||||
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", full_version);
|
||||
|
||||
while (a->name != 0) {
|
||||
col +=
|
||||
fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "),
|
||||
(a++)->name);
|
||||
if (col > 60 && a->name != 0) {
|
||||
fprintf(stderr, ",\n");
|
||||
col = 0;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Flag that we've been here already */
|
||||
been_there_done_that = 1;
|
||||
|
||||
/* Move the command line down a notch */
|
||||
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));
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -1,247 +0,0 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Busybox main internal header 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
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
#ifndef _BB_INTERNAL_H_
|
||||
#define _BB_INTERNAL_H_ 1
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
/* Some useful definitions */
|
||||
#define FALSE ((int) 0)
|
||||
#define TRUE ((int) 1)
|
||||
#define SKIP ((int) 2)
|
||||
|
||||
/* for mtab.c */
|
||||
#define MTAB_GETMOUNTPT '1'
|
||||
#define MTAB_GETDEVICE '2'
|
||||
|
||||
#define BUF_SIZE 8192
|
||||
#define EXPAND_ALLOC 1024
|
||||
|
||||
static inline int is_decimal(ch) { return ((ch >= '0') && (ch <= '9')); }
|
||||
static inline int is_octal(ch) { return ((ch >= '0') && (ch <= '7')); }
|
||||
|
||||
/* Macros for min/max. */
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
|
||||
enum Location {
|
||||
_BB_DIR_ROOT = 0,
|
||||
_BB_DIR_BIN,
|
||||
_BB_DIR_SBIN,
|
||||
_BB_DIR_USR_BIN,
|
||||
_BB_DIR_USR_SBIN
|
||||
};
|
||||
|
||||
struct BB_applet {
|
||||
const char* name;
|
||||
int (*main)(int argc, char** argv);
|
||||
enum Location location;
|
||||
const char* usage;
|
||||
};
|
||||
/* From busybox.c */
|
||||
extern const struct BB_applet applets[];
|
||||
|
||||
/* Automagically pull in all the applet function prototypes and
|
||||
* applet usage strings. These are all of the form:
|
||||
* extern int foo_main(int argc, char **argv);
|
||||
* extern const char foo_usage[];
|
||||
* These are all autogenerated from the set of currently defined applets.
|
||||
*/
|
||||
#define PROTOTYPES
|
||||
#include "applets.h"
|
||||
#undef PROTOTYPES
|
||||
|
||||
extern const char *applet_name;
|
||||
extern int applet_name_compare(const void *x, const void *y);
|
||||
|
||||
extern void usage(const char *usage) __attribute__ ((noreturn));
|
||||
extern void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
extern void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
|
||||
extern void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
extern void perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
|
||||
|
||||
const char *mode_string(int mode);
|
||||
const char *time_string(time_t timeVal);
|
||||
int is_directory(const char *name, const int followLinks, struct stat *statBuf);
|
||||
int isDevice(const char *name);
|
||||
|
||||
typedef struct ino_dev_hash_bucket_struct {
|
||||
struct ino_dev_hash_bucket_struct *next;
|
||||
ino_t ino;
|
||||
dev_t dev;
|
||||
char name[1];
|
||||
} ino_dev_hashtable_bucket_t;
|
||||
int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name);
|
||||
void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name);
|
||||
void reset_ino_dev_hashtable(void);
|
||||
|
||||
int copy_file(const char *srcName, const char *destName,
|
||||
int setModes, int followLinks, int forceFlag);
|
||||
int copy_file_chunk(int srcFd, int dstFd, size_t remaining);
|
||||
char *buildName(const char *dirName, const char *fileName);
|
||||
int makeString(int argc, const char **argv, char *buf, int bufLen);
|
||||
char *getChunk(int size);
|
||||
char *chunkstrdup(const char *str);
|
||||
void freeChunks(void);
|
||||
ssize_t safe_read(int fd, void *buf, size_t count);
|
||||
int full_write(int fd, const char *buf, int len);
|
||||
int full_read(int fd, char *buf, int len);
|
||||
int recursive_action(const char *fileName, int recurse, int followLinks, int depthFirst,
|
||||
int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData),
|
||||
int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData),
|
||||
void* userData);
|
||||
|
||||
extern int create_path (const char *name, int mode);
|
||||
extern int parse_mode( const char* s, mode_t* theMode);
|
||||
|
||||
extern int get_kernel_revision(void);
|
||||
|
||||
extern int get_console_fd(char* tty_name);
|
||||
extern struct mntent *find_mount_point(const char *name, const char *table);
|
||||
extern void write_mtab(char* blockDevice, char* directory,
|
||||
char* filesystemType, long flags, char* string_flags);
|
||||
extern void erase_mtab(const char * name);
|
||||
extern void mtab_read(void);
|
||||
extern char *mtab_first(void **iter);
|
||||
extern char *mtab_next(void **iter);
|
||||
extern char *mtab_getinfo(const char *match, const char which);
|
||||
extern int check_wildcard_match(const char* text, const char* pattern);
|
||||
extern long atoi_w_units (const char *cp);
|
||||
extern pid_t* find_pid_by_name( char* pidName);
|
||||
extern int find_real_root_device_name(char* name);
|
||||
extern char *get_line_from_file(FILE *file);
|
||||
extern void print_file(FILE *file);
|
||||
extern int print_file_by_name(char *filename);
|
||||
extern char process_escape_sequence(char **ptr);
|
||||
extern char *get_last_path_component(char *path);
|
||||
extern FILE *wfopen(const char *path, const char *mode);
|
||||
extern FILE *xfopen(const char *path, const char *mode);
|
||||
|
||||
#ifndef DMALLOC
|
||||
extern void *xmalloc (size_t size);
|
||||
extern void *xrealloc(void *old, size_t size);
|
||||
extern void *xcalloc(size_t nmemb, size_t size);
|
||||
extern char *xstrdup (const char *s);
|
||||
#endif
|
||||
extern char *xstrndup (const char *s, int n);
|
||||
|
||||
struct suffix_mult {
|
||||
char *suffix;
|
||||
int mult;
|
||||
};
|
||||
|
||||
extern unsigned long parse_number(const char *numstr, struct suffix_mult *suffixes);
|
||||
|
||||
|
||||
/* These parse entries in /etc/passwd and /etc/group. This is desirable
|
||||
* for BusyBox since we want to avoid using the glibc NSS stuff, which
|
||||
* increases target size and is often not needed embedded systems. */
|
||||
extern long my_getpwnam(char *name);
|
||||
extern long my_getgrnam(char *name);
|
||||
extern void my_getpwuid(char *name, long uid);
|
||||
extern void my_getgrgid(char *group, long gid);
|
||||
extern long my_getpwnamegid(char *name);
|
||||
|
||||
extern int device_open(char *device, int mode);
|
||||
|
||||
#if defined BB_FEATURE_MOUNT_LOOP
|
||||
extern int del_loop(const char *device);
|
||||
extern int set_loop(const char *device, const char *file, int offset, int *loopro);
|
||||
extern char *find_unused_loop_device (void);
|
||||
#endif
|
||||
|
||||
|
||||
#if (__GLIBC__ < 2) && (defined BB_SYSLOGD || defined BB_INIT)
|
||||
extern int vdprintf(int d, const char *format, va_list ap);
|
||||
#endif
|
||||
|
||||
#if defined BB_NFSMOUNT
|
||||
int nfsmount(const char *spec, const char *node, int *flags,
|
||||
char **extra_opts, char **mount_opts, int running_bg);
|
||||
#endif
|
||||
|
||||
#ifndef RB_POWER_OFF
|
||||
/* Stop system and switch power off if possible. */
|
||||
#define RB_POWER_OFF 0x4321fedc
|
||||
#endif
|
||||
|
||||
/* Include our own copy of struct sysinfo to avoid binary compatability
|
||||
* problems with Linux 2.4, which changed things. Grumble, grumble. */
|
||||
struct sysinfo {
|
||||
long uptime; /* Seconds since boot */
|
||||
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
|
||||
unsigned long totalram; /* Total usable main memory size */
|
||||
unsigned long freeram; /* Available memory size */
|
||||
unsigned long sharedram; /* Amount of shared memory */
|
||||
unsigned long bufferram; /* Memory used by buffers */
|
||||
unsigned long totalswap; /* Total swap space size */
|
||||
unsigned long freeswap; /* swap space still available */
|
||||
unsigned short procs; /* Number of current processes */
|
||||
unsigned long totalhigh; /* Total high memory size */
|
||||
unsigned long freehigh; /* Available high memory size */
|
||||
unsigned int mem_unit; /* Memory unit size in bytes */
|
||||
char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
|
||||
};
|
||||
extern int sysinfo (struct sysinfo* info);
|
||||
|
||||
/* Bit map related macros -- libc5 doens't provide these... sigh. */
|
||||
#ifndef setbit
|
||||
#define NBBY CHAR_BIT
|
||||
#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
|
||||
#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
|
||||
#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
|
||||
#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
|
||||
#endif
|
||||
|
||||
#ifdef BB_FEATURE_HUMAN_READABLE
|
||||
char *format(unsigned long val, unsigned long hr);
|
||||
#define KILOBYTE 1024
|
||||
#define MEGABYTE (KILOBYTE*1024)
|
||||
#define GIGABYTE (MEGABYTE*1024)
|
||||
#endif
|
||||
|
||||
#ifdef BB_FEATURE_BUFFERS_GO_ON_STACK
|
||||
#define RESERVE_BB_BUFFER(buffer,len) char buffer[len]
|
||||
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char buffer[len]
|
||||
#else
|
||||
#define RESERVE_BB_BUFFER(buffer,len) char *buffer=xmalloc(len)
|
||||
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
|
||||
#endif
|
||||
|
||||
#endif /* _BB_INTERNAL_H_ */
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Make busybox links list file.
|
||||
|
||||
# input $1: full path to Config.h
|
||||
# input $2: full path to applets.h
|
||||
# output (stdout): list of pathnames that should be linked to busybox
|
||||
|
||||
# Maintainer: Larry Doolittle <ldoolitt@recycle.lbl.gov>
|
||||
|
||||
CONFIG_H=${1:-Config.h}
|
||||
APPLETS_H=${2:-applets.h}
|
||||
gcc -E -DMAKE_LINKS -include $CONFIG_H $APPLETS_H |
|
||||
awk '/^[ \t]*LINK/{
|
||||
dir=substr($2,8)
|
||||
gsub("_","/",dir)
|
||||
if(dir=="/ROOT") dir=""
|
||||
file=$3
|
||||
gsub("\"","",file)
|
||||
if (file=="busybox") next
|
||||
print tolower(dir) "/" file
|
||||
}'
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
RAW=` \
|
||||
gcc -E -dM ${1:-Config.h} | \
|
||||
sed -n -e '/^.*BB_FEATURE.*$/d;s/^#define.*\<BB_\(.*\)\>/\1.c/gp;' \
|
||||
| tr A-Z a-z | sort
|
||||
`
|
||||
test "${RAW}" != "" || exit
|
||||
cd ${2:-.}
|
||||
# I added in the extra "ls" so only source files that
|
||||
# actually exist will show up in the compile list.
|
||||
ls -1 $RAW 2>/dev/null | sed -e 's/\.c$/\.o/g'
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
Name: busybox
|
||||
Version: 0.49
|
||||
Release: 1
|
||||
Group: System/Utilities
|
||||
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
|
||||
Copyright: GPL
|
||||
Packager : Erik Andersen <andersen@lineo.com>
|
||||
Conflicts: fileutils grep shellutils
|
||||
Buildroot: /tmp/%{Name}-%{Version}
|
||||
Source: %{Name}-%{Version}.tar.gz
|
||||
|
||||
%Description
|
||||
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 fileutils, shellutils, findutils, textutils, grep, gzip,
|
||||
tar, etc. BusyBox provides a fairly complete POSIX environment for any small
|
||||
or emdedded system. The utilities in BusyBox generally have fewer options then
|
||||
their full featured GNU cousins; however, the options that are provided behave
|
||||
very much like their GNU counterparts.
|
||||
|
||||
%Prep
|
||||
%setup -q -n %{Name}-%{Version}
|
||||
|
||||
%Build
|
||||
make
|
||||
|
||||
%Install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make PREFIX=$RPM_BUILD_ROOT install
|
||||
|
||||
%Clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%Files
|
||||
%defattr(-,root,root)
|
||||
/
|
||||
@@ -1,179 +0,0 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini chown/chmod/chgrp implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#define BB_DECLARE_EXTERN
|
||||
#define bb_need_invalid_option
|
||||
#define bb_need_too_few_args
|
||||
#include "messages.c"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
static long uid = -1;
|
||||
static long gid = -1;
|
||||
static int whichApp;
|
||||
static char *theMode = NULL;
|
||||
|
||||
|
||||
#define CHGRP_APP 1
|
||||
#define CHOWN_APP 2
|
||||
#define CHMOD_APP 3
|
||||
|
||||
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
{
|
||||
switch (whichApp) {
|
||||
case CHGRP_APP:
|
||||
case CHOWN_APP:
|
||||
#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
|
||||
if (lchown
|
||||
(fileName, (whichApp == CHOWN_APP) ? uid : statbuf->st_uid,
|
||||
(gid == -1) ? statbuf->st_gid : gid) == 0)
|
||||
#else
|
||||
if (chown
|
||||
(fileName, (whichApp == CHOWN_APP) ? uid : statbuf->st_uid,
|
||||
(gid == -1) ? statbuf->st_gid : gid) == 0)
|
||||
#endif
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
break;
|
||||
case CHMOD_APP:
|
||||
/* Parse the specified modes */
|
||||
if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) {
|
||||
error_msg_and_die( "unknown mode: %s\n", theMode);
|
||||
}
|
||||
if (chmod(fileName, statbuf->st_mode) == 0)
|
||||
return (TRUE);
|
||||
break;
|
||||
}
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
int chmod_chown_chgrp_main(int argc, char **argv)
|
||||
{
|
||||
int stopIt = FALSE;
|
||||
int recursiveFlag = FALSE;
|
||||
char *groupName=NULL;
|
||||
char *p=NULL;
|
||||
const char *appUsage;
|
||||
|
||||
whichApp = (strcmp(applet_name, "chown") == 0)?
|
||||
CHOWN_APP : (strcmp(applet_name, "chmod") == 0)?
|
||||
CHMOD_APP : CHGRP_APP;
|
||||
|
||||
appUsage = (whichApp == CHOWN_APP)?
|
||||
chown_usage : (whichApp == CHMOD_APP) ? chmod_usage : chgrp_usage;
|
||||
|
||||
if (argc < 2)
|
||||
usage(appUsage);
|
||||
argv++;
|
||||
|
||||
/* Parse options */
|
||||
while (--argc >= 0 && *argv && (**argv == '-')) {
|
||||
while (stopIt==FALSE && *++(*argv)) {
|
||||
switch (**argv) {
|
||||
case 'R':
|
||||
recursiveFlag = TRUE;
|
||||
break;
|
||||
default:
|
||||
theMode=*argv-1;
|
||||
stopIt = TRUE;
|
||||
}
|
||||
}
|
||||
if (stopIt==TRUE)
|
||||
break;
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (argc == 0 || *argv == NULL) {
|
||||
error_msg(too_few_args);
|
||||
}
|
||||
|
||||
if (whichApp == CHMOD_APP) {
|
||||
if (theMode==NULL)
|
||||
theMode = *argv;
|
||||
} else {
|
||||
|
||||
/* Find the selected group */
|
||||
if (whichApp == CHGRP_APP) {
|
||||
groupName = *argv;
|
||||
gid = strtoul(groupName, &p, 10); /* maybe it's already numeric */
|
||||
if (groupName == p)
|
||||
gid = my_getgrnam(groupName);
|
||||
if (gid == -1)
|
||||
goto bad_group;
|
||||
} else {
|
||||
groupName = strchr(*argv, '.');
|
||||
if (groupName == NULL)
|
||||
groupName = strchr(*argv, ':');
|
||||
if (groupName) {
|
||||
*groupName++ = '\0';
|
||||
gid = strtoul(groupName, &p, 10);
|
||||
if (groupName == p)
|
||||
gid = my_getgrnam(groupName);
|
||||
if (gid == -1)
|
||||
goto bad_group;
|
||||
} else
|
||||
gid = -1;
|
||||
}
|
||||
|
||||
|
||||
/* Find the selected user (if appropriate) */
|
||||
if (whichApp == CHOWN_APP) {
|
||||
uid = strtoul(*argv, &p, 10); /* if numeric ... */
|
||||
if (*argv == p)
|
||||
uid = my_getpwnam(*argv);
|
||||
if (uid == -1) {
|
||||
error_msg_and_die( "unknown user name: %s\n", *argv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
if (argc < 1) {
|
||||
error_msg_and_die(too_few_args);
|
||||
}
|
||||
while (argc-- > 1) {
|
||||
if (recursive_action (*(++argv), recursiveFlag, FALSE, FALSE,
|
||||
fileAction, fileAction, NULL) == FALSE)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
bad_group:
|
||||
error_msg_and_die( "unknown group name: %s\n", groupName);
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -1,40 +0,0 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* chvt.c - aeb - 940227 - Change virtual terminal
|
||||
*
|
||||
* busyboxed by Erik Andersen
|
||||
*/
|
||||
#include "busybox.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
/* From <linux/vt.h> */
|
||||
static const int VT_ACTIVATE = 0x5606; /* make vt active */
|
||||
static const int VT_WAITACTIVE = 0x5607; /* wait for vt active */
|
||||
|
||||
int chvt_main(int argc, char **argv)
|
||||
{
|
||||
int fd, num;
|
||||
|
||||
if ((argc != 2) || (**(argv + 1) == '-'))
|
||||
usage (chvt_usage);
|
||||
fd = get_console_fd("/dev/console");
|
||||
num = atoi(argv[1]);
|
||||
if (ioctl(fd, VT_ACTIVATE, num))
|
||||
perror_msg_and_die("VT_ACTIVATE");
|
||||
if (ioctl(fd, VT_WAITACTIVE, num))
|
||||
perror_msg_and_die("VT_WAITACTIVE");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef CMDEDIT_H
|
||||
#define CMDEDIT_H
|
||||
|
||||
#ifdef BB_FEATURE_SH_COMMAND_EDITING
|
||||
#include <stddef.h>
|
||||
|
||||
void cmdedit_init(void);
|
||||
void cmdedit_terminate(void);
|
||||
void cmdedit_read_input(char* promptStr, char* command); /* read a line of input */
|
||||
|
||||
#endif /* BB_FEATURE_SH_COMMAND_EDITING */
|
||||
|
||||
#endif /* CMDEDIT_H */
|
||||
@@ -1,66 +0,0 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini cmp implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int cmp_main(int argc, char **argv)
|
||||
{
|
||||
FILE *fp1 = NULL, *fp2 = stdin;
|
||||
char *filename1 = argv[1], *filename2 = "-";
|
||||
int c1, c2, char_pos = 1, line_pos = 1;
|
||||
|
||||
/* parse argv[] */
|
||||
if (argc < 2 || 3 < argc)
|
||||
usage(cmp_usage);
|
||||
|
||||
fp1 = xfopen(argv[1], "r");
|
||||
if (argv[2] != NULL) {
|
||||
fp2 = xfopen(argv[2], "r");
|
||||
filename2 = argv[2];
|
||||
}
|
||||
|
||||
do {
|
||||
c1 = fgetc(fp1);
|
||||
c2 = fgetc(fp2);
|
||||
if (c1 != c2) {
|
||||
if (c1 == EOF)
|
||||
printf("EOF on %s\n", filename1);
|
||||
else if (c2 == EOF)
|
||||
printf("EOF on %s\n", filename2);
|
||||
else
|
||||
printf("%s %s differ: char %d, line %d\n", filename1, filename2,
|
||||
char_pos, line_pos);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
char_pos++;
|
||||
if (c1 == '\n')
|
||||
line_pos++;
|
||||
} while (c1 != EOF);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
TOPDIR:= ../
|
||||
CONSOLETOOLS_DIR:=./
|
||||
include $(TOPDIR).config
|
||||
include $(TOPDIR)Rules.mak
|
||||
include Makefile.in
|
||||
all: $(libraries-y)
|
||||
-include $(TOPDIR).depend
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a $(AR_TARGET)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CONSOLETOOLS_AR:=console-tools.a
|
||||
ifndef $(CONSOLETOOLS_DIR)
|
||||
CONSOLETOOLS_DIR:=$(TOPDIR)console-tools/
|
||||
endif
|
||||
|
||||
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_LOADACM) += loadacm.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
|
||||
|
||||
libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR)
|
||||
|
||||
$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
|
||||
$(AR) -ro $@ $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
|
||||
|
||||
@@ -4,12 +4,15 @@
|
||||
*
|
||||
* busyboxed by Erik Andersen
|
||||
*/
|
||||
#include "busybox.h"
|
||||
|
||||
/* getopt not needed */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* From <linux/vt.h> */
|
||||
static const int VT_ACTIVATE = 0x5606; /* make vt active */
|
||||
@@ -20,8 +23,8 @@ int chvt_main(int argc, char **argv)
|
||||
int fd, num;
|
||||
|
||||
if ((argc != 2) || (**(argv + 1) == '-'))
|
||||
usage (chvt_usage);
|
||||
fd = get_console_fd("/dev/console");
|
||||
show_usage();
|
||||
fd = get_console_fd();
|
||||
num = atoi(argv[1]);
|
||||
if (ioctl(fd, VT_ACTIVATE, num))
|
||||
perror_msg_and_die("VT_ACTIVATE");
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
/*
|
||||
* Mini clear implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
|
||||
* Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -22,9 +21,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
extern int clear_main(int argc, char **argv)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see scripts/kbuild/config-language.txt.
|
||||
#
|
||||
|
||||
mainmenu_option next_comment
|
||||
comment 'Console Utilities'
|
||||
bool 'chvt' CONFIG_CHVT
|
||||
bool 'clear' CONFIG_CLEAR
|
||||
bool 'deallocvt' CONFIG_DEALLOCVT
|
||||
bool 'dumpkmap' CONFIG_DUMPKMAP
|
||||
bool 'loadacm' CONFIG_LOADACM
|
||||
bool 'loadfont' CONFIG_LOADFONT
|
||||
bool 'loadkmap' CONFIG_LOADKMAP
|
||||
bool 'openvt' CONFIG_OPENVT
|
||||
bool 'reset' CONFIG_RESET
|
||||
bool 'setkeycodes' CONFIG_SETKEYCODES
|
||||
|
||||
endmenu
|
||||
@@ -3,12 +3,12 @@
|
||||
* disalloc.c - aeb - 940501 - Disallocate virtual terminal(s)
|
||||
* Renamed deallocvt.
|
||||
*/
|
||||
#include "busybox.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* From <linux/vt.h> */
|
||||
static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
|
||||
@@ -19,9 +19,9 @@ int deallocvt_main(int argc, char *argv[])
|
||||
|
||||
//if ((argc > 2) || ((argv == 2) && (**(argv + 1) == '-')))
|
||||
if (argc > 2)
|
||||
usage(deallocvt_usage);
|
||||
show_usage();
|
||||
|
||||
fd = get_console_fd("/dev/console");
|
||||
fd = get_console_fd();
|
||||
|
||||
if (argc == 1) {
|
||||
/* deallocate all unused consoles */
|
||||
@@ -31,9 +31,9 @@ int deallocvt_main(int argc, char *argv[])
|
||||
for (i = 1; i < argc; i++) {
|
||||
num = atoi(argv[i]);
|
||||
if (num == 0)
|
||||
error_msg("0: illegal VT number\n");
|
||||
error_msg("0: illegal VT number");
|
||||
else if (num == 1)
|
||||
error_msg("VT 1 cannot be deallocated\n");
|
||||
error_msg("VT 1 cannot be deallocated");
|
||||
else if (ioctl(fd, VT_DISALLOCATE, num))
|
||||
perror_msg_and_die("VT_DISALLOCATE");
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
@@ -28,6 +27,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* From <linux/kd.h> */
|
||||
struct kbentry {
|
||||
@@ -48,12 +48,12 @@ int dumpkmap_main(int argc, char **argv)
|
||||
char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap";
|
||||
|
||||
if (argc>=2 && *argv[1]=='-') {
|
||||
usage(dumpkmap_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror_msg("Error opening /dev/tty0");
|
||||
perror_msg("Error opening " CURRENT_VC);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ int dumpkmap_main(int argc, char **argv)
|
||||
ke.kb_table = i;
|
||||
if (ioctl(fd, KDGKBENT, &ke) < 0) {
|
||||
|
||||
error_msg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
|
||||
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);
|
||||
|
||||
+24
-59
@@ -7,7 +7,6 @@
|
||||
* Peter Novodvorsky <petya@logic.ru>
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
@@ -17,29 +16,30 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <sys/kd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/kd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
typedef unsigned short unicode;
|
||||
|
||||
static long int ctoi(unsigned char *s, int *is_unicode);
|
||||
int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
|
||||
int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
|
||||
unicode utf8_to_ucs2(char *buf);
|
||||
int screen_map_load(int fd, FILE * fp);
|
||||
static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
|
||||
static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
|
||||
static unicode utf8_to_ucs2(char *buf);
|
||||
static int screen_map_load(int fd, FILE * fp);
|
||||
|
||||
int loadacm_main(int argc, char **argv)
|
||||
{
|
||||
int fd;
|
||||
|
||||
if (argc>=2 && *argv[1]=='-') {
|
||||
usage(loadacm_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = open("/dev/tty", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror_msg_and_die("Error opening /dev/tty1");
|
||||
perror_msg_and_die("Error opening " CURRENT_VC);
|
||||
}
|
||||
|
||||
if (screen_map_load(fd, stdin)) {
|
||||
@@ -51,7 +51,7 @@ int loadacm_main(int argc, char **argv)
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int screen_map_load(int fd, FILE * fp)
|
||||
static int screen_map_load(int fd, FILE * fp)
|
||||
{
|
||||
struct stat stbuf;
|
||||
unicode wbuf[E_TABSZ];
|
||||
@@ -70,7 +70,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
if (parse_failed) {
|
||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||
if (errno == ESPIPE)
|
||||
error_msg_and_die("16bit screen-map MUST be a regular file.\n");
|
||||
error_msg_and_die("16bit screen-map MUST be a regular file.");
|
||||
else
|
||||
perror_msg_and_die("fseek failed reading binary 16bit screen-map");
|
||||
}
|
||||
@@ -79,7 +79,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
perror_msg_and_die("Cannot read [new] map from file");
|
||||
#if 0
|
||||
else
|
||||
error_msg("Input screen-map is binary.\n");
|
||||
error_msg("Input screen-map is binary.");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
/* rewind... */
|
||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||
if (errno == ESPIPE)
|
||||
error_msg("Assuming 8bit screen-map - MUST be a regular file.\n"),
|
||||
error_msg("Assuming 8bit screen-map - MUST be a regular file."),
|
||||
exit(1);
|
||||
else
|
||||
perror_msg_and_die("fseek failed assuming 8bit screen-map");
|
||||
@@ -109,7 +109,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||
if (errno == ESPIPE)
|
||||
/* should not - it succedeed above */
|
||||
error_msg_and_die("fseek() returned ESPIPE !\n");
|
||||
error_msg_and_die("fseek() returned ESPIPE !");
|
||||
else
|
||||
perror_msg_and_die("fseek for binary 8bit screen-map");
|
||||
}
|
||||
@@ -118,7 +118,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
perror_msg_and_die("Cannot read [old] map from file");
|
||||
#if 0
|
||||
else
|
||||
error_msg("Input screen-map is binary.\n");
|
||||
error_msg("Input screen-map is binary.");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
error_msg("Error parsing symbolic map\n");
|
||||
error_msg("Error parsing symbolic map");
|
||||
return(1);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
*
|
||||
* FIXME: ignores everything after second word
|
||||
*/
|
||||
int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
|
||||
static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
|
||||
{
|
||||
char buffer[256]; /* line buffer reading file */
|
||||
char *p, *q; /* 1st + 2nd words in line */
|
||||
@@ -149,7 +149,7 @@ int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
|
||||
int tmp_is_unicode; /* tmp for is_unicode calculation */
|
||||
int i; /* loop index - result holder */
|
||||
int ret_code = 0; /* return code */
|
||||
sigset_t sigset, old_sigset;
|
||||
sigset_t acmsigset, old_sigset;
|
||||
|
||||
assert(is_unicode);
|
||||
|
||||
@@ -163,9 +163,9 @@ int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
|
||||
buf[i] = 0xfffd;
|
||||
|
||||
/* block SIGCHLD */
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &sigset, &old_sigset);
|
||||
sigemptyset(&acmsigset);
|
||||
sigaddset(&acmsigset, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &acmsigset, &old_sigset);
|
||||
|
||||
do {
|
||||
if (NULL == fgets(buffer, sizeof(buffer), fp)) {
|
||||
@@ -213,7 +213,7 @@ int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
|
||||
}
|
||||
|
||||
|
||||
int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
|
||||
static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
|
||||
{
|
||||
char buffer[256];
|
||||
int in, on;
|
||||
@@ -255,7 +255,7 @@ int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
|
||||
*
|
||||
* CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones.
|
||||
*/
|
||||
long int ctoi(unsigned char *s, int *is_unicode)
|
||||
static long int ctoi(unsigned char *s, int *is_unicode)
|
||||
{
|
||||
int i;
|
||||
size_t ls;
|
||||
@@ -302,42 +302,7 @@ long int ctoi(unsigned char *s, int *is_unicode)
|
||||
}
|
||||
|
||||
|
||||
void saveoldmap(int fd, char *omfil)
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[E_TABSZ];
|
||||
|
||||
#ifdef GIO_UNISCRNMAP
|
||||
unicode xbuf[E_TABSZ];
|
||||
int is_old_map = 0;
|
||||
|
||||
if (ioctl(fd, GIO_UNISCRNMAP, xbuf)) {
|
||||
perror_msg("GIO_UNISCRNMAP ioctl error");
|
||||
#endif
|
||||
if (ioctl(fd, GIO_SCRNMAP, buf))
|
||||
perror_msg_and_die("GIO_SCRNMAP ioctl error");
|
||||
else
|
||||
is_old_map = 1;
|
||||
#ifdef GIO_UNISCRNMAP
|
||||
}
|
||||
#endif
|
||||
|
||||
fp = xfopen(omfil, "w");
|
||||
#ifdef GIO_UNISCRNMAP
|
||||
if (is_old_map) {
|
||||
#endif
|
||||
if (fwrite(buf, E_TABSZ, 1, fp) != 1)
|
||||
perror_msg_and_die("Error writing map to file");
|
||||
#ifdef GIO_UNISCRNMAP
|
||||
} else if (fwrite(xbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1) {
|
||||
perror_msg_and_die("Error writing map to file");
|
||||
}
|
||||
#endif
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
unicode utf8_to_ucs2(char *buf)
|
||||
static unicode utf8_to_ucs2(char *buf)
|
||||
{
|
||||
int utf_count = 0;
|
||||
long utf_char = 0;
|
||||
|
||||
+11
-11
@@ -7,7 +7,6 @@
|
||||
* Loads the console font, and possibly the corresponding screen map(s).
|
||||
* (Adapted for busybox by Matej Vela.)
|
||||
*/
|
||||
#include "busybox.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
@@ -20,6 +19,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/kd.h>
|
||||
#include <endian.h>
|
||||
#include "busybox.h"
|
||||
|
||||
static const int PSF_MAGIC1 = 0x36;
|
||||
static const int PSF_MAGIC2 = 0x04;
|
||||
@@ -44,11 +44,11 @@ extern int loadfont_main(int argc, char **argv)
|
||||
int fd;
|
||||
|
||||
if (argc != 1)
|
||||
usage(loadfont_usage);
|
||||
show_usage();
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0)
|
||||
perror_msg_and_die("Error opening /dev/tty0");
|
||||
perror_msg_and_die("Error opening " CURRENT_VC);
|
||||
loadnewfont(fd);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
@@ -62,7 +62,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
if (unit < 1 || unit > 32)
|
||||
error_msg_and_die("Bad character size %d\n", unit);
|
||||
error_msg_and_die("Bad character size %d", unit);
|
||||
|
||||
for (i = 0; i < fontsize; i++)
|
||||
memcpy(buf + (32 * i), inbuf + (unit * i), unit);
|
||||
@@ -119,8 +119,8 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
|
||||
if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
|
||||
#ifdef ENOIOCTLCMD
|
||||
if (errno == ENOIOCTLCMD) {
|
||||
error_msg("It seems this kernel is older than 1.1.92\n");
|
||||
error_msg_and_die("No Unicode mapping table loaded.\n");
|
||||
error_msg("It seems this kernel is older than 1.1.92");
|
||||
error_msg_and_die("No Unicode mapping table loaded.");
|
||||
} else
|
||||
#endif
|
||||
perror_msg_and_die("PIO_UNIMAPCLR");
|
||||
@@ -174,11 +174,11 @@ static void loadnewfont(int fd)
|
||||
goto no_psf;
|
||||
|
||||
if (psfhdr.mode > PSF_MAXMODE)
|
||||
error_msg_and_die("Unsupported psf file mode\n");
|
||||
error_msg_and_die("Unsupported psf file mode");
|
||||
fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
|
||||
#if !defined( PIO_FONTX ) || defined( __sparc__ )
|
||||
if (fontsize != 256)
|
||||
error_msg_and_die("Only fontsize 256 supported\n");
|
||||
error_msg_and_die("Only fontsize 256 supported");
|
||||
#endif
|
||||
hastable = (psfhdr.mode & PSF_MODEHASTAB);
|
||||
unit = psfhdr.charsize;
|
||||
@@ -186,7 +186,7 @@ static void loadnewfont(int fd)
|
||||
|
||||
head = head0 + fontsize * unit;
|
||||
if (head > inputlth || (!hastable && head != inputlth))
|
||||
error_msg_and_die("Input file: bad length\n");
|
||||
error_msg_and_die("Input file: bad length");
|
||||
do_loadfont(fd, inbuf + head0, unit, fontsize);
|
||||
if (hastable)
|
||||
do_loadtable(fd, inbuf + head, inputlth - head, fontsize);
|
||||
@@ -201,7 +201,7 @@ static void loadnewfont(int fd)
|
||||
} else {
|
||||
/* bare font */
|
||||
if (inputlth & 0377)
|
||||
error_msg_and_die("Bad input file size\n");
|
||||
error_msg_and_die("Bad input file size");
|
||||
offset = 0;
|
||||
unit = inputlth / 256;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
@@ -28,6 +27,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#define BINARY_KEYMAP_MAGIC "bkeymap"
|
||||
|
||||
@@ -51,15 +51,15 @@ int loadkmap_main(int argc, char **argv)
|
||||
char flags[MAX_NR_KEYMAPS], buff[7];
|
||||
|
||||
if (argc != 1)
|
||||
usage(loadkmap_usage);
|
||||
show_usage();
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0)
|
||||
perror_msg_and_die("Error opening /dev/tty0");
|
||||
perror_msg_and_die("Error opening " CURRENT_VC);
|
||||
|
||||
read(0, buff, 7);
|
||||
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
|
||||
error_msg_and_die("This is not a valid binary keymap.\n");
|
||||
error_msg_and_die("This is not a valid binary keymap.");
|
||||
|
||||
if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS))
|
||||
perror_msg_and_die("Error reading keymap flags");
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* openvt.c - open a vt to run a command.
|
||||
*
|
||||
* busyboxed by Quy Tonthat <quy@signal3.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.
|
||||
*/
|
||||
|
||||
/* getopt not needed */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#define VTNAME "/dev/tty%d"
|
||||
|
||||
int openvt_main(int argc, char **argv)
|
||||
{
|
||||
int pid;
|
||||
int fd;
|
||||
int vtno;
|
||||
char vtname[sizeof VTNAME + 2];
|
||||
char * cmd = NULL;
|
||||
char * cmd_args = NULL;
|
||||
|
||||
if (argc < 3)
|
||||
show_usage();
|
||||
|
||||
if (!isdigit(argv[1][0]))
|
||||
show_usage();
|
||||
|
||||
vtno = (int) atol(argv[1]);
|
||||
|
||||
/* if (vtno <= 0 || vtno > 63) */
|
||||
if (vtno <= 0 || vtno > 12)
|
||||
error_msg_and_die("Illegal vt number (%d)", vtno);
|
||||
|
||||
sprintf(vtname, VTNAME, vtno);
|
||||
|
||||
cmd = argv[2];
|
||||
cmd_args = xmalloc(80);
|
||||
cmd_args[0] = '\0';
|
||||
|
||||
if((pid = fork()) == 0) {
|
||||
/* leave current vt */
|
||||
|
||||
#ifdef ESIX_5_3_2_D
|
||||
if (setpgrp() < 0) {
|
||||
#else
|
||||
if (setsid() < 0) {
|
||||
#endif
|
||||
|
||||
perror_msg_and_die("Unable to set new session");
|
||||
}
|
||||
close(0); /* so that new vt becomes stdin */
|
||||
|
||||
/* and grab new one */
|
||||
if ((fd = open(vtname, O_RDWR)) == -1)
|
||||
perror_msg_and_die("could not open %s", vtname);
|
||||
|
||||
/* Reassign stdout and sterr */
|
||||
close(1);
|
||||
close(2);
|
||||
dup(fd);
|
||||
dup(fd);
|
||||
|
||||
execvp(cmd, &argv[2]);
|
||||
/*execlp(cmd, cmd_args);*/
|
||||
_exit(1);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -2,10 +2,9 @@
|
||||
/*
|
||||
* Mini reset implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
* and Kent Robotti <robotti@metconnect.com>
|
||||
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
|
||||
* Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.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
|
||||
@@ -23,13 +22,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int reset_main(int argc, char **argv)
|
||||
{
|
||||
printf("\033c");
|
||||
printf("\033[?25h\033c\033[J");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
/* From <linux/kd.h> */
|
||||
@@ -43,27 +43,27 @@ setkeycodes_main(int argc, char** argv)
|
||||
struct kbkeycode a;
|
||||
|
||||
if (argc % 2 != 1 || argc < 2) {
|
||||
usage(setkeycodes_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = get_console_fd("/dev/console");
|
||||
fd = get_console_fd();
|
||||
|
||||
while (argc > 2) {
|
||||
a.keycode = atoi(argv[2]);
|
||||
a.scancode = sc = strtol(argv[1], &ep, 16);
|
||||
if (*ep) {
|
||||
error_msg_and_die("error reading SCANCODE: '%s'\n", argv[1]);
|
||||
error_msg_and_die("error reading SCANCODE: '%s'", argv[1]);
|
||||
}
|
||||
if (a.scancode > 127) {
|
||||
a.scancode -= 0xe000;
|
||||
a.scancode += 128;
|
||||
}
|
||||
if (a.scancode > 255 || a.keycode > 127) {
|
||||
error_msg_and_die("SCANCODE or KEYCODE outside bounds\n");
|
||||
error_msg_and_die("SCANCODE or KEYCODE outside bounds");
|
||||
}
|
||||
if (ioctl(fd,KDSETKEYCODE,&a)) {
|
||||
perror("KDSETKEYCODE");
|
||||
error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d\n", sc, a.keycode);
|
||||
error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d", sc, a.keycode);
|
||||
}
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/*
|
||||
* Mini basename implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
|
||||
* Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -21,8 +21,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
/* getopt not needed */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
#include <string.h>
|
||||
|
||||
extern int basename_main(int argc, char **argv)
|
||||
@@ -31,7 +33,7 @@ extern int basename_main(int argc, char **argv)
|
||||
char *s;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage(basename_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
argv++;
|
||||
@@ -42,9 +44,9 @@ extern int basename_main(int argc, char **argv)
|
||||
argv++;
|
||||
n = strlen(*argv);
|
||||
m = strlen(s);
|
||||
if (m>=n && strncmp(s+m-n, *argv, n)==0)
|
||||
if (m>n && strncmp(s+m-n, *argv, n)==0)
|
||||
s[m-n] = '\0';
|
||||
}
|
||||
printf("%s\n", s);
|
||||
puts(s);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+424
@@ -0,0 +1,424 @@
|
||||
/*
|
||||
* Calendar implementation for busybox
|
||||
*
|
||||
* Copyright (C) 2001 by Steven J. Merrifield <steve@labyrinth.net.au>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "busybox.h"
|
||||
|
||||
#ifdef CONFIG_LOCALE_SUPPORT
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#define THURSDAY 4 /* for reformation */
|
||||
#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 MAXDAYS 42 /* max slots in a month array */
|
||||
#define SPACE -1 /* used in day array */
|
||||
|
||||
static int days_in_month[2][13] = {
|
||||
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
|
||||
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
|
||||
};
|
||||
|
||||
int sep1752[MAXDAYS] = {
|
||||
SPACE, SPACE, 1, 2, 14, 15, 16,
|
||||
17, 18, 19, 20, 21, 22, 23,
|
||||
24, 25, 26, 27, 28, 29, 30,
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
}, j_sep1752[MAXDAYS] = {
|
||||
SPACE, SPACE, 245, 246, 258, 259, 260,
|
||||
261, 262, 263, 264, 265, 266, 267,
|
||||
268, 269, 270, 271, 272, 273, 274,
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
}, empty[MAXDAYS] = {
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE,
|
||||
};
|
||||
|
||||
char *month_names[12];
|
||||
|
||||
char day_headings[] = " ";
|
||||
char j_day_headings[] = " ";
|
||||
|
||||
/* leap year -- account for gregorian reformation in 1752 */
|
||||
#define leap_year(yr) \
|
||||
((yr) <= 1752 ? !((yr) % 4) : \
|
||||
(!((yr) % 4) && ((yr) % 100)) || !((yr) % 400))
|
||||
|
||||
/* number of centuries since 1700, not inclusive */
|
||||
#define centuries_since_1700(yr) \
|
||||
((yr) > 1700 ? (yr) / 100 - 17 : 0)
|
||||
|
||||
/* number of centuries since 1700 whose modulo of 400 is 0 */
|
||||
#define quad_centuries_since_1700(yr) \
|
||||
((yr) > 1600 ? ((yr) - 1600) / 400 : 0)
|
||||
|
||||
/* number of leap years between year 1 and this year, not inclusive */
|
||||
#define leap_years_since_year_1(yr) \
|
||||
((yr) / 4 - centuries_since_1700(yr) + quad_centuries_since_1700(yr))
|
||||
|
||||
int julian;
|
||||
void ascii_day __P((char *, int));
|
||||
void center __P((char *, int, int));
|
||||
void day_array __P((int, int, int *));
|
||||
int day_in_week __P((int, int, int));
|
||||
int day_in_year __P((int, int, int));
|
||||
void j_yearly __P((int));
|
||||
void monthly __P((int, int));
|
||||
void trim_trailing_spaces __P((char *));
|
||||
void yearly __P((int));
|
||||
|
||||
int cal_main(int argc, char **argv)
|
||||
{
|
||||
struct tm *local_time;
|
||||
static struct tm zero_tm;
|
||||
time_t now;
|
||||
int ch, month, year, yflag, i;
|
||||
char buf[40];
|
||||
|
||||
#ifdef CONFIG_LOCALE_SUPPORT
|
||||
setlocale(LC_TIME, "");
|
||||
#endif
|
||||
|
||||
yflag = 0;
|
||||
while ((ch = getopt(argc, argv, "jy")) != -1)
|
||||
switch(ch) {
|
||||
case 'j':
|
||||
julian = 1;
|
||||
break;
|
||||
case 'y':
|
||||
yflag = 1;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
month = 0;
|
||||
switch(argc) {
|
||||
case 2:
|
||||
if ((month = atoi(*argv++)) < 1 || month > 12)
|
||||
error_msg_and_die("Illegal month value: use 1-12");
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
if ((year = atoi(*argv)) < 1 || year > 9999)
|
||||
error_msg_and_die("Illegal year value: use 1-9999");
|
||||
break;
|
||||
case 0:
|
||||
time(&now);
|
||||
local_time = localtime(&now);
|
||||
year = local_time->tm_year + 1900;
|
||||
if (!yflag)
|
||||
month = local_time->tm_mon + 1;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
zero_tm.tm_mon = i;
|
||||
strftime(buf, sizeof(buf), "%B", &zero_tm);
|
||||
month_names[i] = xstrdup(buf);
|
||||
}
|
||||
for (i = 0; i < 7; i++) {
|
||||
zero_tm.tm_wday = i;
|
||||
strftime(buf, sizeof(buf), "%a", &zero_tm);
|
||||
strncpy(day_headings + i * 3, buf, 2);
|
||||
strncpy(j_day_headings + i * 4 + 1, buf, 2);
|
||||
}
|
||||
|
||||
if (month)
|
||||
monthly(month, year);
|
||||
else if (julian)
|
||||
j_yearly(year);
|
||||
else
|
||||
yearly(year);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#define DAY_LEN 3 /* 3 spaces per day */
|
||||
#define J_DAY_LEN 4 /* 4 spaces per day */
|
||||
#define WEEK_LEN 20 /* 7 * 3 - one space at the end */
|
||||
#define J_WEEK_LEN 27 /* 7 * 4 - one space at the end */
|
||||
#define HEAD_SEP 2 /* spaces between day headings */
|
||||
#define J_HEAD_SEP 2
|
||||
|
||||
void monthly(int month, int year)
|
||||
{
|
||||
int col, row, len, days[MAXDAYS];
|
||||
char *p, lineout[30];
|
||||
|
||||
day_array(month, year, days);
|
||||
len = sprintf(lineout, "%s %d", month_names[month - 1], year);
|
||||
printf("%*s%s\n%s\n",
|
||||
((julian ? J_WEEK_LEN : WEEK_LEN) - len) / 2, "",
|
||||
lineout, julian ? j_day_headings : day_headings);
|
||||
for (row = 0; row < 6; row++) {
|
||||
for (col = 0, p = lineout; col < 7; col++,
|
||||
p += julian ? J_DAY_LEN : DAY_LEN)
|
||||
ascii_day(p, days[row * 7 + col]);
|
||||
*p = '\0';
|
||||
trim_trailing_spaces(lineout);
|
||||
printf("%s\n", lineout);
|
||||
}
|
||||
}
|
||||
|
||||
void j_yearly(int year)
|
||||
{
|
||||
int col, *dp, i, month, row, which_cal;
|
||||
int days[12][MAXDAYS];
|
||||
char *p, lineout[80];
|
||||
|
||||
sprintf(lineout, "%d", year);
|
||||
center(lineout, J_WEEK_LEN * 2 + J_HEAD_SEP, 0);
|
||||
printf("\n\n");
|
||||
for (i = 0; i < 12; i++)
|
||||
day_array(i + 1, year, days[i]);
|
||||
memset(lineout, ' ', sizeof(lineout) - 1);
|
||||
lineout[sizeof(lineout) - 1] = '\0';
|
||||
for (month = 0; month < 12; month += 2) {
|
||||
center(month_names[month], J_WEEK_LEN, J_HEAD_SEP);
|
||||
center(month_names[month + 1], J_WEEK_LEN, 0);
|
||||
printf("\n%s%*s%s\n", j_day_headings, J_HEAD_SEP, "",
|
||||
j_day_headings);
|
||||
for (row = 0; row < 6; row++) {
|
||||
for (which_cal = 0; which_cal < 2; which_cal++) {
|
||||
p = lineout + which_cal * (J_WEEK_LEN + 2);
|
||||
dp = &days[month + which_cal][row * 7];
|
||||
for (col = 0; col < 7; col++, p += J_DAY_LEN)
|
||||
ascii_day(p, *dp++);
|
||||
}
|
||||
*p = '\0';
|
||||
trim_trailing_spaces(lineout);
|
||||
printf("%s\n", lineout);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void yearly(int year)
|
||||
{
|
||||
int col, *dp, i, month, row, which_cal;
|
||||
int days[12][MAXDAYS];
|
||||
char *p, lineout[80];
|
||||
|
||||
sprintf(lineout, "%d", year);
|
||||
center(lineout, WEEK_LEN * 3 + HEAD_SEP * 2, 0);
|
||||
printf("\n\n");
|
||||
for (i = 0; i < 12; i++)
|
||||
day_array(i + 1, year, days[i]);
|
||||
memset(lineout, ' ', sizeof(lineout) - 1);
|
||||
lineout[sizeof(lineout) - 1] = '\0';
|
||||
for (month = 0; month < 12; month += 3) {
|
||||
center(month_names[month], WEEK_LEN, HEAD_SEP);
|
||||
center(month_names[month + 1], WEEK_LEN, HEAD_SEP);
|
||||
center(month_names[month + 2], WEEK_LEN, 0);
|
||||
printf("\n%s%*s%s%*s%s\n", day_headings, HEAD_SEP,
|
||||
"", day_headings, HEAD_SEP, "", day_headings);
|
||||
for (row = 0; row < 6; row++) {
|
||||
for (which_cal = 0; which_cal < 3; which_cal++) {
|
||||
p = lineout + which_cal * (WEEK_LEN + 2);
|
||||
dp = &days[month + which_cal][row * 7];
|
||||
for (col = 0; col < 7; col++, p += DAY_LEN)
|
||||
ascii_day(p, *dp++);
|
||||
}
|
||||
*p = '\0';
|
||||
trim_trailing_spaces(lineout);
|
||||
printf("%s\n", lineout);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* day_array --
|
||||
* Fill in an array of 42 integers with a calendar. Assume for a moment
|
||||
* that you took the (maximum) 6 rows in a calendar and stretched them
|
||||
* out end to end. You would have 42 numbers or spaces. This routine
|
||||
* builds that array for any month from Jan. 1 through Dec. 9999.
|
||||
*/
|
||||
void day_array(int month, int year, int *days)
|
||||
{
|
||||
int day, dw, dm;
|
||||
|
||||
if ((month == 9) && (year == 1752)) {
|
||||
memmove(days,
|
||||
julian ? j_sep1752 : sep1752, MAXDAYS * sizeof(int));
|
||||
return;
|
||||
}
|
||||
memmove(days, empty, MAXDAYS * sizeof(int));
|
||||
dm = days_in_month[leap_year(year)][month];
|
||||
dw = day_in_week(1, month, year);
|
||||
day = julian ? day_in_year(1, month, year) : 1;
|
||||
while (dm--)
|
||||
days[dw++] = day++;
|
||||
}
|
||||
|
||||
/*
|
||||
* day_in_year --
|
||||
* return the 1 based day number within the year
|
||||
*/
|
||||
int day_in_year(int day, int month, int year)
|
||||
{
|
||||
int i, leap;
|
||||
|
||||
leap = leap_year(year);
|
||||
for (i = 1; i < month; i++)
|
||||
day += days_in_month[leap][i];
|
||||
return (day);
|
||||
}
|
||||
|
||||
/*
|
||||
* day_in_week
|
||||
* return the 0 based day number for any date from 1 Jan. 1 to
|
||||
* 31 Dec. 9999. Assumes the Gregorian reformation eliminates
|
||||
* 3 Sep. 1752 through 13 Sep. 1752. Returns Thursday for all
|
||||
* missing days.
|
||||
*/
|
||||
int day_in_week(int day, int month, int year)
|
||||
{
|
||||
long temp;
|
||||
|
||||
temp = (long)(year - 1) * 365 + leap_years_since_year_1(year - 1)
|
||||
+ day_in_year(day, month, year);
|
||||
if (temp < FIRST_MISSING_DAY)
|
||||
return ((temp - 1 + SATURDAY) % 7);
|
||||
if (temp >= (FIRST_MISSING_DAY + NUMBER_MISSING_DAYS))
|
||||
return (((temp - 1 + SATURDAY) - NUMBER_MISSING_DAYS) % 7);
|
||||
return (THURSDAY);
|
||||
}
|
||||
|
||||
void ascii_day(char *p, int day)
|
||||
{
|
||||
int display, val;
|
||||
static char *aday[] = {
|
||||
"",
|
||||
" 1", " 2", " 3", " 4", " 5", " 6", " 7",
|
||||
" 8", " 9", "10", "11", "12", "13", "14",
|
||||
"15", "16", "17", "18", "19", "20", "21",
|
||||
"22", "23", "24", "25", "26", "27", "28",
|
||||
"29", "30", "31",
|
||||
};
|
||||
|
||||
if (day == SPACE) {
|
||||
memset(p, ' ', julian ? J_DAY_LEN : DAY_LEN);
|
||||
return;
|
||||
}
|
||||
if (julian) {
|
||||
if ((val = day / 100) != 0) {
|
||||
day %= 100;
|
||||
*p++ = val + '0';
|
||||
display = 1;
|
||||
} else {
|
||||
*p++ = ' ';
|
||||
display = 0;
|
||||
}
|
||||
val = day / 10;
|
||||
if (val || display)
|
||||
*p++ = val + '0';
|
||||
else
|
||||
*p++ = ' ';
|
||||
*p++ = day % 10 + '0';
|
||||
} else {
|
||||
*p++ = aday[day][0];
|
||||
*p++ = aday[day][1];
|
||||
}
|
||||
*p = ' ';
|
||||
}
|
||||
|
||||
void trim_trailing_spaces(char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
for (p = s; *p; ++p)
|
||||
continue;
|
||||
while (p > s && (--p, isspace(*p)))
|
||||
continue;
|
||||
if (p > s)
|
||||
++p;
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
void center(char *str, int len, int separate)
|
||||
{
|
||||
|
||||
len -= strlen(str);
|
||||
printf("%*s%s%*s", len / 2, "", str, len / 2 + len % 2, "");
|
||||
if (separate)
|
||||
printf("%*s", separate, "");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Kim Letkeman.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
+5
-4
@@ -2,8 +2,8 @@
|
||||
/*
|
||||
* Mini Cat implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
|
||||
* Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -21,8 +21,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int cat_main(int argc, char **argv)
|
||||
{
|
||||
@@ -36,7 +37,7 @@ extern int cat_main(int argc, char **argv)
|
||||
while (--argc > 0) {
|
||||
if(!(strcmp(*++argv, "-"))) {
|
||||
print_file(stdin);
|
||||
} else if (print_file_by_name(*argv) == FALSE) {
|
||||
} else if (! print_file_by_name(*argv)) {
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini chgrp implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
|
||||
* Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* Don't use lchown for libc5 or glibc older then 2.1.x */
|
||||
#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
|
||||
#define lchown chown
|
||||
#endif
|
||||
|
||||
|
||||
static long gid;
|
||||
|
||||
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
{
|
||||
if (lchown(fileName, statbuf->st_uid, (gid == -1) ? statbuf->st_gid : gid) == 0) {
|
||||
return (TRUE);
|
||||
}
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
int chgrp_main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
int recursiveFlag = FALSE;
|
||||
char *p=NULL;
|
||||
|
||||
/* do normal option parsing */
|
||||
while ((opt = getopt(argc, argv, "R")) > 0) {
|
||||
switch (opt) {
|
||||
case 'R':
|
||||
recursiveFlag = TRUE;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (argc > optind && argc > 2 && argv[optind]) {
|
||||
/* Find the selected group */
|
||||
gid = strtoul(argv[optind], &p, 10); /* maybe it's already numeric */
|
||||
if (argv[optind] == p)
|
||||
gid = my_getgrnam(argv[optind]);
|
||||
} else {
|
||||
error_msg_and_die(too_few_args);
|
||||
}
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
while (++optind < argc) {
|
||||
if (! recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
|
||||
fileAction, fileAction, NULL)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -0,0 +1,96 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini chmod implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
|
||||
* Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include "busybox.h"
|
||||
|
||||
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
{
|
||||
if (!parse_mode((char *)junk, &(statbuf->st_mode)))
|
||||
error_msg_and_die( "unknown mode: %s", (char *)junk);
|
||||
if (chmod(fileName, statbuf->st_mode) == 0)
|
||||
return (TRUE);
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
int chmod_main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
int recursiveFlag = FALSE;
|
||||
int modeind = 0; /* Index of the mode argument in `argv'. */
|
||||
char *smode;
|
||||
static const char chmod_modes[] = "Rrwxstugoa,+-=";
|
||||
|
||||
/* do normal option parsing */
|
||||
while (1) {
|
||||
int thisind = optind ? optind : 1;
|
||||
|
||||
opt = getopt(argc, argv, chmod_modes);
|
||||
if (opt == EOF)
|
||||
break;
|
||||
smode = strchr(chmod_modes, opt);
|
||||
if(smode == NULL)
|
||||
show_usage();
|
||||
if(smode == chmod_modes) { /* 'R' */
|
||||
recursiveFlag = TRUE;
|
||||
} else {
|
||||
if (modeind != 0 && modeind != thisind)
|
||||
show_usage();
|
||||
modeind = thisind;
|
||||
}
|
||||
}
|
||||
|
||||
if (modeind == 0)
|
||||
modeind = optind++;
|
||||
|
||||
opt = optind;
|
||||
if (opt >= argc) {
|
||||
error_msg_and_die(too_few_args);
|
||||
}
|
||||
|
||||
smode = argv[modeind];
|
||||
/* Ok, ready to do the deed now */
|
||||
for (; opt < argc; opt++) {
|
||||
if (! recursive_action (argv[opt], recursiveFlag, FALSE, FALSE, fileAction,
|
||||
fileAction, smode)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -0,0 +1,112 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini chown implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
|
||||
* Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* Don't use lchown for libc5 or glibc older then 2.1.x */
|
||||
#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
|
||||
#define lchown chown
|
||||
#endif
|
||||
|
||||
static long uid;
|
||||
static long gid;
|
||||
|
||||
static int (*chown_func)(const char *, __uid_t, __gid_t) = chown;
|
||||
|
||||
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
{
|
||||
if (chown_func(fileName, uid, (gid == -1) ? statbuf->st_gid : gid) == 0) {
|
||||
return (TRUE);
|
||||
}
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
int chown_main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
int recursiveFlag = FALSE,
|
||||
noderefFlag = FALSE;
|
||||
char *groupName=NULL;
|
||||
char *p=NULL;
|
||||
|
||||
/* do normal option parsing */
|
||||
while ((opt = getopt(argc, argv, "Rh")) > 0) {
|
||||
switch (opt) {
|
||||
case 'R':
|
||||
recursiveFlag = TRUE;
|
||||
break;
|
||||
case 'h':
|
||||
noderefFlag = TRUE;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (noderefFlag) chown_func = lchown;
|
||||
|
||||
if (argc > optind && argc > 2 && argv[optind]) {
|
||||
/* First, check if there is a group name here */
|
||||
groupName = strchr(argv[optind], '.');
|
||||
if (groupName == NULL)
|
||||
groupName = strchr(argv[optind], ':');
|
||||
if (groupName) {
|
||||
*groupName++ = '\0';
|
||||
gid = strtoul(groupName, &p, 10);
|
||||
if (groupName == p)
|
||||
gid = my_getgrnam(groupName);
|
||||
} else {
|
||||
gid = -1;
|
||||
}
|
||||
/* Now check for the username */
|
||||
uid = strtoul(argv[optind], &p, 10); /* Is is numeric? */
|
||||
if (argv[optind] == p) {
|
||||
uid = my_getpwnam(argv[optind]);
|
||||
}
|
||||
} else {
|
||||
error_msg_and_die(too_few_args);
|
||||
}
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
while (++optind < argc) {
|
||||
if (! recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
|
||||
fileAction, fileAction, NULL)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+11
-9
@@ -2,9 +2,8 @@
|
||||
/*
|
||||
* Mini chroot implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
|
||||
* Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -22,18 +21,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include "busybox.h"
|
||||
|
||||
int chroot_main(int argc, char **argv)
|
||||
{
|
||||
char *prog;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage(chroot_usage);
|
||||
show_usage();
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
@@ -48,14 +47,17 @@ int chroot_main(int argc, char **argv)
|
||||
prog = *argv;
|
||||
execvp(*argv, argv);
|
||||
} else {
|
||||
#ifndef BB_SH
|
||||
#if defined shell_main && defined CONFIG_FEATURE_SH_STANDALONE_SHELL
|
||||
char shell[] = "/bin/sh";
|
||||
char *shell_argv[2] = { shell, NULL };
|
||||
applet_name = shell;
|
||||
shell_main(1, shell_argv);
|
||||
return EXIT_SUCCESS;
|
||||
#else
|
||||
prog = getenv("SHELL");
|
||||
if (!prog)
|
||||
prog = "/bin/sh";
|
||||
execlp(prog, prog, NULL);
|
||||
#else
|
||||
shell_main(argc, argv);
|
||||
return EXIT_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
perror_msg_and_die("cannot execute %s", prog);
|
||||
|
||||
+25
-13
@@ -2,9 +2,7 @@
|
||||
/*
|
||||
* Mini cmp implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Matt Kraai <kraai@alumni.carnegiemellon.edu>
|
||||
* 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
|
||||
@@ -22,32 +20,46 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include "busybox.h"
|
||||
|
||||
int cmp_main(int argc, char **argv)
|
||||
{
|
||||
FILE *fp1 = NULL, *fp2 = stdin;
|
||||
char *filename1 = argv[1], *filename2 = "-";
|
||||
int c1, c2, char_pos = 1, line_pos = 1;
|
||||
char *filename1, *filename2 = "-";
|
||||
int c, c1, c2, char_pos = 1, line_pos = 1, silent = FALSE;
|
||||
|
||||
/* parse argv[] */
|
||||
if (argc < 2 || 3 < argc)
|
||||
usage(cmp_usage);
|
||||
while ((c = getopt(argc, argv, "s")) != EOF) {
|
||||
switch (c) {
|
||||
case 's':
|
||||
silent = TRUE;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
fp1 = xfopen(argv[1], "r");
|
||||
if (argv[2] != NULL) {
|
||||
fp2 = xfopen(argv[2], "r");
|
||||
filename2 = argv[2];
|
||||
filename1 = argv[optind];
|
||||
switch (argc - optind) {
|
||||
case 2:
|
||||
fp2 = xfopen(filename2 = argv[optind + 1], "r");
|
||||
case 1:
|
||||
fp1 = xfopen(filename1, "r");
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
|
||||
do {
|
||||
c1 = fgetc(fp1);
|
||||
c2 = fgetc(fp2);
|
||||
if (c1 != c2) {
|
||||
if (silent)
|
||||
return EXIT_FAILURE;
|
||||
if (c1 == EOF)
|
||||
printf("EOF on %s\n", filename1);
|
||||
else if (c2 == EOF)
|
||||
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini cp implementation for busybox
|
||||
*
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <utime.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "busybox.h"
|
||||
|
||||
extern int cp_main(int argc, char **argv)
|
||||
{
|
||||
int status = 0;
|
||||
int opt;
|
||||
int flags = FILEUTILS_DEREFERENCE;
|
||||
int i;
|
||||
|
||||
while ((opt = getopt(argc, argv, "adfipR")) != -1)
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
flags |= FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR;
|
||||
/* fallthrough */
|
||||
case 'd':
|
||||
flags &= ~FILEUTILS_DEREFERENCE;
|
||||
break;
|
||||
case 'f':
|
||||
flags |= FILEUTILS_FORCE;
|
||||
break;
|
||||
case 'i':
|
||||
flags |= FILEUTILS_INTERACTIVE;
|
||||
break;
|
||||
case 'p':
|
||||
flags |= FILEUTILS_PRESERVE_STATUS;
|
||||
break;
|
||||
case 'R':
|
||||
flags |= FILEUTILS_RECUR;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if (optind + 2 > argc)
|
||||
show_usage();
|
||||
|
||||
/* If there are only two arguments and... */
|
||||
if (optind + 2 == argc) {
|
||||
struct stat source_stat;
|
||||
struct stat dest_stat;
|
||||
int source_exists = 1;
|
||||
int dest_exists = 1;
|
||||
|
||||
if ((!(flags & FILEUTILS_DEREFERENCE) &&
|
||||
lstat(argv[optind], &source_stat) < 0) ||
|
||||
((flags & FILEUTILS_DEREFERENCE) &&
|
||||
stat(argv[optind], &source_stat))) {
|
||||
if (errno != ENOENT)
|
||||
perror_msg_and_die("unable to stat `%s'", argv[optind]);
|
||||
source_exists = 0;
|
||||
}
|
||||
|
||||
if (stat(argv[optind + 1], &dest_stat) < 0) {
|
||||
if (errno != ENOENT)
|
||||
perror_msg_and_die("unable to stat `%s'", argv[optind + 1]);
|
||||
dest_exists = 0;
|
||||
}
|
||||
|
||||
/* ...if neither is a directory or... */
|
||||
if (((!source_exists || !S_ISDIR(source_stat.st_mode)) &&
|
||||
(!dest_exists || !S_ISDIR(dest_stat.st_mode))) ||
|
||||
/* ...recursing, the first is a directory, and the
|
||||
* second doesn't exist, then... */
|
||||
((flags & FILEUTILS_RECUR) && S_ISDIR(source_stat.st_mode) &&
|
||||
!dest_exists)) {
|
||||
/* ...do a simple copy. */
|
||||
if (copy_file(argv[optind], argv[optind + 1], flags) < 0)
|
||||
status = 1;
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = optind; i < argc - 1; i++) {
|
||||
char *dest = concat_path_file(argv[argc - 1],
|
||||
get_last_path_component(argv[i]));
|
||||
if (copy_file(argv[i], dest, flags) < 0)
|
||||
status = 1;
|
||||
free(dest);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
+241
-131
@@ -24,8 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h> /* getopt */
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
@@ -34,65 +33,228 @@ extern int optind;
|
||||
extern char *optarg;
|
||||
|
||||
|
||||
/* globals in this file only */
|
||||
/* option vars */
|
||||
static char part = 0; /* (b)yte, (c)har, (f)ields */
|
||||
static int startpos = 1;
|
||||
static int endpos = -1;
|
||||
static char delim = '\t'; /* delimiter, default is tab */
|
||||
static unsigned int supress_non_delimited_lines = 0;
|
||||
static char delim = '\t'; /* delimiter, default is tab */
|
||||
|
||||
struct cut_list {
|
||||
int startpos;
|
||||
int endpos;
|
||||
};
|
||||
|
||||
static const int BOL = 0;
|
||||
static const int EOL = INT_MAX;
|
||||
static const int 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 */
|
||||
|
||||
|
||||
static int cmpfunc(const void *a, const void *b)
|
||||
{
|
||||
struct cut_list *la = (struct cut_list *)a;
|
||||
struct cut_list *lb = (struct cut_list *)b;
|
||||
|
||||
if (la->startpos > lb->startpos)
|
||||
return 1;
|
||||
if (la->startpos < lb->startpos)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* decompose_list() - parses a list and puts values into startpos and endpos.
|
||||
* parse_lists() - parses a list and puts values into startpos and endpos.
|
||||
* valid list formats: N, N-, N-M, -M
|
||||
* more than one list can be seperated by commas
|
||||
*/
|
||||
static void decompose_list(const char *list)
|
||||
static void parse_lists(char *lists)
|
||||
{
|
||||
unsigned int nminus = 0;
|
||||
char *ptr;
|
||||
char *ltok = NULL;
|
||||
char *ntok = NULL;
|
||||
char *junk;
|
||||
int s = 0, e = 0;
|
||||
|
||||
/* the list must contain only digits and no more than one minus sign */
|
||||
for (ptr = (char *)list; *ptr; ptr++) {
|
||||
if (!isdigit(*ptr) && *ptr != '-') {
|
||||
error_msg_and_die("invalid byte or field list\n");
|
||||
/* take apart the lists, one by one (they are seperated with commas */
|
||||
while ((ltok = strsep(&lists, ",")) != NULL) {
|
||||
|
||||
/* it's actually legal to pass an empty list */
|
||||
if (strlen(ltok) == 0)
|
||||
continue;
|
||||
|
||||
/* get the start pos */
|
||||
ntok = strsep(<ok, "-");
|
||||
if (ntok == NULL) {
|
||||
fprintf(stderr, "Help ntok is null for starting position! What do I do?\n");
|
||||
} else if (strlen(ntok) == 0) {
|
||||
s = BOL;
|
||||
} else {
|
||||
s = strtoul(ntok, &junk, 10);
|
||||
if(*junk != '\0' || s < 0)
|
||||
error_msg_and_die("invalid byte or field list");
|
||||
|
||||
/* account for the fact that arrays are zero based, while the user
|
||||
* expects the first char on the line to be char # 1 */
|
||||
if (s != 0)
|
||||
s--;
|
||||
}
|
||||
if (*ptr == '-') {
|
||||
nminus++;
|
||||
if (nminus > 1) {
|
||||
error_msg_and_die("invalid byte or field list\n");
|
||||
|
||||
/* get the end pos */
|
||||
ntok = strsep(<ok, "-");
|
||||
if (ntok == NULL) {
|
||||
e = NON_RANGE;
|
||||
} else if (strlen(ntok) == 0) {
|
||||
e = EOL;
|
||||
} else {
|
||||
e = strtoul(ntok, &junk, 10);
|
||||
if(*junk != '\0' || e < 0)
|
||||
error_msg_and_die("invalid byte or field list");
|
||||
/* if the user specified and end position of 0, that means "til the
|
||||
* end of the line */
|
||||
if (e == 0)
|
||||
e = INT_MAX;
|
||||
e--; /* again, arrays are zero based, lines are 1 based */
|
||||
if (e == s)
|
||||
e = NON_RANGE;
|
||||
}
|
||||
|
||||
/* if there's something left to tokenize, the user past an invalid list */
|
||||
if (ltok)
|
||||
error_msg_and_die("invalid byte or field list");
|
||||
|
||||
/* add the new list */
|
||||
cut_lists = xrealloc(cut_lists, sizeof(struct cut_list) * (++nlists));
|
||||
cut_lists[nlists-1].startpos = s;
|
||||
cut_lists[nlists-1].endpos = e;
|
||||
}
|
||||
|
||||
/* make sure we got some cut positions out of all that */
|
||||
if (nlists == 0)
|
||||
error_msg_and_die("missing list of positions");
|
||||
|
||||
/* now that the lists are parsed, we need to sort them to make life easier
|
||||
* on us when it comes time to print the chars / fields / lines */
|
||||
qsort(cut_lists, nlists, sizeof(struct cut_list), cmpfunc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void cut_line_by_chars(const char *line)
|
||||
{
|
||||
int c, l;
|
||||
/* set up a list so we can keep track of what's been printed */
|
||||
char *printed = xcalloc(strlen(line), sizeof(char));
|
||||
|
||||
/* print the chars specified in each cut list */
|
||||
for (c = 0; c < nlists; c++) {
|
||||
l = cut_lists[c].startpos;
|
||||
while (l < strlen(line)) {
|
||||
if (!printed[l]) {
|
||||
putchar(line[l]);
|
||||
printed[l] = 'X';
|
||||
}
|
||||
l++;
|
||||
if (cut_lists[c].endpos == NON_RANGE || l > cut_lists[c].endpos)
|
||||
break;
|
||||
}
|
||||
}
|
||||
putchar('\n'); /* cuz we were handed a chomped line */
|
||||
free(printed);
|
||||
}
|
||||
|
||||
|
||||
static void cut_line_by_fields(char *line)
|
||||
{
|
||||
int c, f;
|
||||
int ndelim = -1; /* zero-based / one-based problem */
|
||||
int nfields_printed = 0;
|
||||
char *field = NULL;
|
||||
char d[2] = { delim, 0 };
|
||||
char *printed;
|
||||
|
||||
/* test the easy case first: does this line contain any delimiters? */
|
||||
if (strchr(line, delim) == NULL) {
|
||||
if (!supress_non_delimited_lines)
|
||||
puts(line);
|
||||
return;
|
||||
}
|
||||
|
||||
/* set up a list so we can keep track of what's been printed */
|
||||
printed = xcalloc(strlen(line), sizeof(char));
|
||||
|
||||
/* process each list on this line, for as long as we've got a line to process */
|
||||
for (c = 0; c < nlists && line; c++) {
|
||||
f = cut_lists[c].startpos;
|
||||
do {
|
||||
|
||||
/* find the field we're looking for */
|
||||
while (line && ndelim < f) {
|
||||
field = strsep(&line, d);
|
||||
ndelim++;
|
||||
}
|
||||
|
||||
/* we found it, and it hasn't been printed yet */
|
||||
if (field && ndelim == f && !printed[ndelim]) {
|
||||
/* if this isn't our first time through, we need to print the
|
||||
* delimiter after the last field that was printed */
|
||||
if (nfields_printed > 0)
|
||||
putchar(delim);
|
||||
fputs(field, stdout);
|
||||
printed[ndelim] = 'X';
|
||||
nfields_printed++;
|
||||
}
|
||||
|
||||
f++;
|
||||
|
||||
/* keep going as long as we have a line to work with, this is a
|
||||
* list, and we're not at the end of that list */
|
||||
} while (line && cut_lists[c].endpos != NON_RANGE && f <= cut_lists[c].endpos);
|
||||
}
|
||||
|
||||
/* if we printed anything at all, we need to finish it with a newline cuz
|
||||
* we were handed a chomped line */
|
||||
putchar('\n');
|
||||
|
||||
free(printed);
|
||||
}
|
||||
|
||||
|
||||
static void cut_file_by_lines(const char *line, unsigned int linenum)
|
||||
{
|
||||
static int c = 0;
|
||||
static int l = -1;
|
||||
|
||||
/* I can't initialize this above cuz the "initializer isn't
|
||||
* constant" *sigh* */
|
||||
if (l == -1)
|
||||
l = cut_lists[c].startpos;
|
||||
|
||||
/* get out if we have no more lists to process or if the lines are lower
|
||||
* than what we're interested in */
|
||||
if (c >= nlists || linenum < l)
|
||||
return;
|
||||
|
||||
/* if the line we're looking for is lower than the one we were passed, it
|
||||
* means we displayed it already, so move on */
|
||||
while (l < linenum) {
|
||||
l++;
|
||||
/* move on to the next list if we're at the end of this one */
|
||||
if (cut_lists[c].endpos == NON_RANGE || l > cut_lists[c].endpos) {
|
||||
c++;
|
||||
/* get out if there's no more lists to process */
|
||||
if (c >= nlists)
|
||||
return;
|
||||
l = cut_lists[c].startpos;
|
||||
/* get out if the current line is lower than the one we just became
|
||||
* interested in */
|
||||
if (linenum < l)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle single value 'N' case */
|
||||
if (nminus == 0) {
|
||||
startpos = strtol(list, &ptr, 10);
|
||||
if (startpos == 0) {
|
||||
error_msg_and_die("missing list of fields\n");
|
||||
}
|
||||
endpos = startpos;
|
||||
}
|
||||
/* handle multi-value cases */
|
||||
else if (nminus == 1) {
|
||||
/* handle 'N-' case */
|
||||
if (list[strlen(list) - 1] == '-') {
|
||||
startpos = strtol(list, &ptr, 10);
|
||||
}
|
||||
/* handle '-M' case */
|
||||
else if (list[0] == '-') {
|
||||
endpos = strtol(&list[1], NULL, 10);
|
||||
}
|
||||
/* handle 'N-M' case */
|
||||
else {
|
||||
startpos = strtol(list, &ptr, 10);
|
||||
endpos = strtol(ptr+1, &ptr, 10);
|
||||
}
|
||||
|
||||
/* a sanity check */
|
||||
if (startpos == 0) {
|
||||
startpos = 1;
|
||||
}
|
||||
}
|
||||
/* If we made it here, it means we've found the line we're looking for, so print it */
|
||||
puts(line);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,82 +263,31 @@ static void decompose_list(const char *list)
|
||||
*/
|
||||
static void cut_file(FILE *file)
|
||||
{
|
||||
char *line;
|
||||
unsigned int cr_hits = 0;
|
||||
char *line = NULL;
|
||||
unsigned int linenum = 0; /* keep these zero-based to be consistent */
|
||||
|
||||
/* go through every line in the file */
|
||||
for (line = NULL; (line = get_line_from_file(file)) != NULL; free(line)) {
|
||||
/* cut based on chars/bytes */
|
||||
if (part == 'c' || part == 'b') {
|
||||
int i;
|
||||
/* a valid end position has been specified */
|
||||
if (endpos > 0) {
|
||||
for (i = startpos-1; i < endpos; i++) {
|
||||
fputc(line[i], stdout);
|
||||
}
|
||||
fputc('\n', stdout);
|
||||
}
|
||||
/* otherwise, just go to the end of the line */
|
||||
else {
|
||||
for (i = startpos-1; line[i]; i++) {
|
||||
fputc(line[i], stdout);
|
||||
}
|
||||
}
|
||||
}
|
||||
while ((line = get_line_from_file(file)) != NULL) {
|
||||
chomp(line);
|
||||
|
||||
/* cut based on chars/bytes XXX: only works when sizeof(char) == byte */
|
||||
if (part == 'c' || part == 'b')
|
||||
cut_line_by_chars(line);
|
||||
|
||||
/* cut based on fields */
|
||||
else if (part == 'f') {
|
||||
char *ptr;
|
||||
char *start = line;
|
||||
unsigned int delims_hit = 0;
|
||||
|
||||
if (delim == '\n') {
|
||||
cr_hits++;
|
||||
if (cr_hits >= startpos && cr_hits <= endpos) {
|
||||
while (*start && *start != '\n') {
|
||||
fputc(*start, stdout);
|
||||
start++;
|
||||
}
|
||||
fputc('\n', stdout);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (ptr = line; (ptr = strchr(ptr, delim)) != NULL; ptr++) {
|
||||
delims_hit++;
|
||||
if (delims_hit == (startpos - 1)) {
|
||||
start = ptr+1;
|
||||
}
|
||||
if (delims_hit == endpos) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* we didn't hit any delimeters */
|
||||
if (delims_hit == 0 && !supress_non_delimited_lines) {
|
||||
fputs(line, stdout);
|
||||
}
|
||||
/* we =did= hit some delimiters */
|
||||
else if (delims_hit > 0) {
|
||||
/* we have a fixed end point */
|
||||
if (ptr) {
|
||||
while (start < ptr) {
|
||||
fputc(*start, stdout);
|
||||
start++;
|
||||
}
|
||||
fputc('\n', stdout);
|
||||
}
|
||||
/* or we're just going til the end of the line */
|
||||
else {
|
||||
while (*start) {
|
||||
fputc(*start, stdout);
|
||||
start++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (delim == '\n')
|
||||
cut_file_by_lines(line, linenum);
|
||||
else
|
||||
cut_line_by_fields(line);
|
||||
}
|
||||
|
||||
linenum++;
|
||||
free(line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern int cut_main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
@@ -188,14 +299,14 @@ extern int cut_main(int argc, char **argv)
|
||||
case 'f':
|
||||
/* make sure they didn't ask for two types of lists */
|
||||
if (part != 0) {
|
||||
error_msg_and_die("only one type of list may be specified\n");
|
||||
error_msg_and_die("only one type of list may be specified");
|
||||
}
|
||||
part = (char)opt;
|
||||
decompose_list(optarg);
|
||||
parse_lists(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
if (strlen(optarg) > 1) {
|
||||
error_msg_and_die("the delimiter must be a single character\n");
|
||||
error_msg_and_die("the delimiter must be a single character");
|
||||
}
|
||||
delim = optarg[0];
|
||||
break;
|
||||
@@ -209,17 +320,18 @@ extern int cut_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (part == 0) {
|
||||
error_msg_and_die("you must specify a list of bytes, characters, or fields\n");
|
||||
error_msg_and_die("you must specify a list of bytes, characters, or fields");
|
||||
}
|
||||
|
||||
if (supress_non_delimited_lines && part != 'f') {
|
||||
error_msg_and_die("suppressing non-delimited lines makes sense"
|
||||
" only when operating on fields\n");
|
||||
|
||||
}
|
||||
|
||||
if (delim != '\t' && part != 'f') {
|
||||
error_msg_and_die("a delimiter may be specified only when operating on fields\n");
|
||||
/* non-field (char or byte) cutting has some special handling */
|
||||
if (part != 'f') {
|
||||
if (supress_non_delimited_lines) {
|
||||
error_msg_and_die("suppressing non-delimited lines makes sense"
|
||||
" only when operating on fields");
|
||||
}
|
||||
if (delim != '\t' && part != 'f') {
|
||||
error_msg_and_die("a delimiter may be specified only when operating on fields");
|
||||
}
|
||||
}
|
||||
|
||||
/* argv[(optind)..(argc-1)] should be names of file to process. If no
|
||||
@@ -232,10 +344,8 @@ extern int cut_main(int argc, char **argv)
|
||||
int i;
|
||||
FILE *file;
|
||||
for (i = optind; i < argc; i++) {
|
||||
file = fopen(argv[i], "r");
|
||||
if (file == NULL) {
|
||||
perror_msg("%s", argv[i]);
|
||||
} else {
|
||||
file = wfopen(argv[i], "r");
|
||||
if(file) {
|
||||
cut_file(file);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
+131
-99
@@ -3,6 +3,8 @@
|
||||
* Mini date implementation for busybox
|
||||
*
|
||||
* by Matthew Grant <grantma@anathoth.gen.nz>
|
||||
*
|
||||
* 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
|
||||
@@ -20,11 +22,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#define BB_DECLARE_EXTERN
|
||||
#define bb_need_invalid_date
|
||||
#define bb_need_memory_exhausted
|
||||
#include "messages.c"
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
@@ -33,6 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
/* This 'date' command supports only 2 time setting formats,
|
||||
@@ -46,23 +44,22 @@
|
||||
|
||||
/* Default input handling to save suprising some people */
|
||||
|
||||
struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
|
||||
static struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
|
||||
{
|
||||
int nr;
|
||||
|
||||
nr = sscanf(t_string, "%2d%2d%2d%2d%d",
|
||||
&(tm_time->tm_mon),
|
||||
&(tm_time->tm_mday),
|
||||
&(tm_time->tm_hour),
|
||||
&(tm_time->tm_min), &(tm_time->tm_year));
|
||||
nr = sscanf(t_string, "%2d%2d%2d%2d%d", &(tm_time->tm_mon),
|
||||
&(tm_time->tm_mday), &(tm_time->tm_hour), &(tm_time->tm_min),
|
||||
&(tm_time->tm_year));
|
||||
|
||||
if (nr < 4 || nr > 5) {
|
||||
error_msg_and_die(invalid_date, t_string);
|
||||
error_msg_and_die(invalid_date, t_string);
|
||||
}
|
||||
|
||||
/* correct for century - minor Y2K problem here? */
|
||||
if (tm_time->tm_year >= 1900)
|
||||
if (tm_time->tm_year >= 1900) {
|
||||
tm_time->tm_year -= 1900;
|
||||
}
|
||||
/* adjust date */
|
||||
tm_time->tm_mon -= 1;
|
||||
|
||||
@@ -73,56 +70,45 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
|
||||
|
||||
/* The new stuff for LRP */
|
||||
|
||||
struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
|
||||
static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
|
||||
{
|
||||
struct tm t;
|
||||
|
||||
/* Parse input and assign appropriately to tm_time */
|
||||
|
||||
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, &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) {
|
||||
|
||||
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
|
||||
} 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) {
|
||||
|
||||
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:%d",
|
||||
&t.tm_year,
|
||||
&t.tm_mon,
|
||||
&t.tm_mday,
|
||||
&t.tm_hour,
|
||||
&t.tm_min, &t.tm_sec) == 6) {
|
||||
|
||||
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,
|
||||
&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) {
|
||||
/* 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) {
|
||||
/* 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) {
|
||||
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 {
|
||||
error_msg_and_die(invalid_date, t_string);
|
||||
error_msg_and_die(invalid_date, t_string);
|
||||
}
|
||||
*tm_time = t;
|
||||
return (tm_time);
|
||||
@@ -142,45 +128,73 @@ int date_main(int argc, char **argv)
|
||||
time_t tm;
|
||||
struct tm tm_time;
|
||||
|
||||
#ifdef CONFIG_FEATURE_DATE_ISOFMT
|
||||
int ifmt = 0;
|
||||
|
||||
# define GETOPT_ISOFMT "I::"
|
||||
#else
|
||||
# define GETOPT_ISOFMT
|
||||
#endif
|
||||
|
||||
/* Interpret command line args */
|
||||
while ((c = getopt(argc, argv, "Rs:ud:")) != EOF) {
|
||||
while ((c = getopt(argc, argv, "Rs:ud:" GETOPT_ISOFMT)) != EOF) {
|
||||
switch (c) {
|
||||
case 'R':
|
||||
rfc822 = 1;
|
||||
break;
|
||||
case 's':
|
||||
set_time = 1;
|
||||
if ((date_str != NULL) || ((date_str = optarg) == NULL)) {
|
||||
usage(date_usage);
|
||||
case 'R':
|
||||
rfc822 = 1;
|
||||
break;
|
||||
case 's':
|
||||
set_time = 1;
|
||||
if ((date_str != NULL) || ((date_str = optarg) == NULL)) {
|
||||
show_usage();
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
utc = 1;
|
||||
if (putenv("TZ=UTC0") != 0)
|
||||
error_msg_and_die(memory_exhausted);
|
||||
break;
|
||||
case 'd':
|
||||
use_arg = 1;
|
||||
if ((date_str != NULL) || ((date_str = optarg) == NULL))
|
||||
show_usage();
|
||||
break;
|
||||
#ifdef CONFIG_FEATURE_DATE_ISOFMT
|
||||
case 'I':
|
||||
if (!optarg)
|
||||
ifmt = 1;
|
||||
else {
|
||||
int ifmt_len = xstrlen(optarg);
|
||||
|
||||
if ((ifmt_len <= 4)
|
||||
&& (strncmp(optarg, "date", ifmt_len) == 0)) {
|
||||
ifmt = 1;
|
||||
} else if ((ifmt_len <= 5)
|
||||
&& (strncmp(optarg, "hours", ifmt_len) == 0)) {
|
||||
ifmt = 2;
|
||||
} else if ((ifmt_len <= 7)
|
||||
&& (strncmp(optarg, "minutes", ifmt_len) == 0)) {
|
||||
ifmt = 3;
|
||||
} else if ((ifmt_len <= 7)
|
||||
&& (strncmp(optarg, "seconds", ifmt_len) == 0)) {
|
||||
ifmt = 4;
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
utc = 1;
|
||||
if (putenv("TZ=UTC0") != 0)
|
||||
error_msg_and_die(memory_exhausted);
|
||||
break;
|
||||
case 'd':
|
||||
use_arg = 1;
|
||||
if ((date_str != NULL) || ((date_str = optarg) == NULL))
|
||||
usage(date_usage);
|
||||
break;
|
||||
default:
|
||||
usage(date_usage);
|
||||
}
|
||||
if (ifmt) {
|
||||
break; /* else show_usage(); */
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if ((date_fmt == NULL) && (optind < argc) && (argv[optind][0] == '+'))
|
||||
date_fmt = &argv[optind][1]; /* Skip over the '+' */
|
||||
else if (date_str == NULL) {
|
||||
|
||||
if ((date_fmt == NULL) && (optind < argc) && (argv[optind][0] == '+')) {
|
||||
date_fmt = &argv[optind][1]; /* Skip over the '+' */
|
||||
} else if (date_str == NULL) {
|
||||
set_time = 1;
|
||||
date_str = argv[optind];
|
||||
}
|
||||
#if 0
|
||||
else {
|
||||
error_msg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt);
|
||||
usage(date_usage);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now we have parsed all the information except the date format
|
||||
which depends on whether the clock is being set or read */
|
||||
@@ -203,20 +217,18 @@ int date_main(int argc, char **argv)
|
||||
date_conv_time(&tm_time, date_str);
|
||||
}
|
||||
|
||||
/* Correct any day of week and day of year etc fields */
|
||||
/* Correct any day of week and day of year etc. fields */
|
||||
tm = mktime(&tm_time);
|
||||
if (tm < 0)
|
||||
error_msg_and_die(invalid_date, date_str);
|
||||
if ( utc ) {
|
||||
if (putenv("TZ=UTC0") != 0)
|
||||
error_msg_and_die(memory_exhausted);
|
||||
if (tm < 0) {
|
||||
error_msg_and_die(invalid_date, date_str);
|
||||
}
|
||||
if (utc && (putenv("TZ=UTC0") != 0)) {
|
||||
error_msg_and_die(memory_exhausted);
|
||||
}
|
||||
|
||||
/* if setting time, set it */
|
||||
if (set_time) {
|
||||
if (stime(&tm) < 0) {
|
||||
perror_msg("cannot set date");
|
||||
}
|
||||
if (set_time && (stime(&tm) < 0)) {
|
||||
perror_msg("cannot set date");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,12 +236,32 @@ int date_main(int argc, char **argv)
|
||||
|
||||
/* Deal with format string */
|
||||
if (date_fmt == NULL) {
|
||||
date_fmt = (rfc822
|
||||
? (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
|
||||
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 =
|
||||
(rfc822
|
||||
? (utc ? "%a, %e %b %Y %H:%M:%S GMT" :
|
||||
"%a, %e %b %Y %H:%M:%S %z") : "%a %b %e %H:%M:%S %Z %Y");
|
||||
|
||||
#ifdef CONFIG_FEATURE_DATE_ISOFMT
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
} else if (*date_fmt == '\0') {
|
||||
/* Imitate what GNU 'date' does with NO format string! */
|
||||
printf("\n");
|
||||
@@ -245,7 +277,7 @@ int date_main(int argc, char **argv)
|
||||
/* Print OUTPUT (after ALL that!) */
|
||||
t_buff = xmalloc(201);
|
||||
strftime(t_buff, 200, date_fmt, &tm_time);
|
||||
printf("%s\n", t_buff);
|
||||
puts(t_buff);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+40
-19
@@ -3,7 +3,7 @@
|
||||
* Mini dd implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2000 by Matt Kraai <kraai@alumni.carnegiemellon.edu>
|
||||
* 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
|
||||
@@ -21,16 +21,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
static struct suffix_mult dd_suffixes[] = {
|
||||
|
||||
static const struct suffix_mult dd_suffixes[] = {
|
||||
{ "c", 1 },
|
||||
{ "w", 2 },
|
||||
{ "b", 512 },
|
||||
@@ -45,12 +46,11 @@ static struct suffix_mult dd_suffixes[] = {
|
||||
|
||||
int dd_main(int argc, char **argv)
|
||||
{
|
||||
int i, ifd, ofd, oflag, sync = FALSE, trunc = TRUE;
|
||||
int i, ifd, ofd, oflag, sync_flag = FALSE, trunc = TRUE, noerror = FALSE;
|
||||
size_t in_full = 0, in_part = 0, out_full = 0, out_part = 0;
|
||||
size_t bs = 512, count = -1;
|
||||
ssize_t n;
|
||||
off_t seek = 0, skip = 0;
|
||||
FILE *statusfp;
|
||||
char *infile = NULL, *outfile = NULL, *buf;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
@@ -73,10 +73,13 @@ int dd_main(int argc, char **argv)
|
||||
trunc = FALSE;
|
||||
buf += 7;
|
||||
} else if (strncmp("sync", buf, 4) == 0) {
|
||||
sync = TRUE;
|
||||
sync_flag = TRUE;
|
||||
buf += 4;
|
||||
} else if (strncmp("noerror", buf, 7) == 0) {
|
||||
noerror = TRUE;
|
||||
buf += 7;
|
||||
} else {
|
||||
error_msg_and_die("invalid conversion `%s'\n", argv[i]+5);
|
||||
error_msg_and_die("invalid conversion `%s'", argv[i]+5);
|
||||
}
|
||||
if (buf[0] == '\0')
|
||||
break;
|
||||
@@ -84,7 +87,7 @@ int dd_main(int argc, char **argv)
|
||||
buf++;
|
||||
}
|
||||
} else
|
||||
usage(dd_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
buf = xmalloc(bs);
|
||||
@@ -107,15 +110,17 @@ int dd_main(int argc, char **argv)
|
||||
perror_msg_and_die("%s", outfile);
|
||||
|
||||
if (seek && trunc) {
|
||||
if (ftruncate(ofd, seek * bs) < 0)
|
||||
perror_msg_and_die("%s", outfile);
|
||||
}
|
||||
if (ftruncate(ofd, seek * bs) < 0) {
|
||||
struct stat st;
|
||||
|
||||
statusfp = stdout;
|
||||
if (fstat (ofd, &st) < 0 || S_ISREG (st.st_mode) ||
|
||||
S_ISDIR (st.st_mode))
|
||||
perror_msg_and_die("%s", outfile);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ofd = STDOUT_FILENO;
|
||||
outfile = "standard output";
|
||||
statusfp = stderr;
|
||||
}
|
||||
|
||||
if (skip) {
|
||||
@@ -129,16 +134,26 @@ 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);
|
||||
}
|
||||
n = safe_read(ifd, buf, bs);
|
||||
if (n < 0)
|
||||
perror_msg_and_die("%s", infile);
|
||||
if (n < 0) {
|
||||
if (noerror) {
|
||||
n = bs;
|
||||
perror_msg("%s", infile);
|
||||
} else {
|
||||
perror_msg_and_die("%s", infile);
|
||||
}
|
||||
}
|
||||
if (n == 0)
|
||||
break;
|
||||
if (n == bs)
|
||||
in_full++;
|
||||
else
|
||||
in_part++;
|
||||
if (sync) {
|
||||
if (sync_flag) {
|
||||
memset(buf + n, '\0', bs - n);
|
||||
n = bs;
|
||||
}
|
||||
@@ -151,8 +166,14 @@ int dd_main(int argc, char **argv)
|
||||
out_part++;
|
||||
}
|
||||
|
||||
fprintf(statusfp, "%d+%d records in\n", in_full, in_part);
|
||||
fprintf(statusfp, "%d+%d records out\n", out_full, out_part);
|
||||
if (close (ifd) < 0)
|
||||
perror_msg_and_die("%s", infile);
|
||||
|
||||
if (close (ofd) < 0)
|
||||
perror_msg_and_die("%s", outfile);
|
||||
|
||||
fprintf(stderr, "%ld+%ld records in\n", (long)in_full, (long)in_part);
|
||||
fprintf(stderr, "%ld+%ld records out\n", (long)out_full, (long)out_part);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+59
-57
@@ -2,8 +2,8 @@
|
||||
/*
|
||||
* Mini df implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
|
||||
* Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.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
|
||||
@@ -22,58 +22,63 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "busybox.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <mntent.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <getopt.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern const char mtab_file[]; /* Defined in utility.c */
|
||||
#ifdef BB_FEATURE_HUMAN_READABLE
|
||||
unsigned long disp_hr = KILOBYTE;
|
||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||
static unsigned long df_disp_hr = KILOBYTE;
|
||||
#endif
|
||||
|
||||
static int df(char *device, const char *mountPoint)
|
||||
static int do_df(char *device, const char *mount_point)
|
||||
{
|
||||
struct statfs s;
|
||||
long blocks_used;
|
||||
long blocks_percent_used;
|
||||
|
||||
if (statfs(mountPoint, &s) != 0) {
|
||||
perror_msg("%s", mountPoint);
|
||||
if (statfs(mount_point, &s) != 0) {
|
||||
perror_msg("%s", mount_point);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (s.f_blocks > 0) {
|
||||
blocks_used = s.f_blocks - s.f_bfree;
|
||||
if(0 == blocks_used)
|
||||
if(blocks_used == 0)
|
||||
blocks_percent_used = 0;
|
||||
else
|
||||
else {
|
||||
blocks_percent_used = (long)
|
||||
(blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5);
|
||||
}
|
||||
if (strcmp(device, "/dev/root") == 0) {
|
||||
/* Adjusts device to be the real root device,
|
||||
* or leaves device alone if it can't find it */
|
||||
find_real_root_device_name( device);
|
||||
device = find_real_root_device_name(device);
|
||||
if(device==NULL)
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef BB_FEATURE_HUMAN_READABLE
|
||||
printf("%-20s %9s",
|
||||
device,
|
||||
format((s.f_blocks * s.f_bsize), disp_hr));
|
||||
printf(" %9s", format((s.f_blocks - s.f_bfree) * s.f_bsize, disp_hr));
|
||||
printf(" %9s %3ld%% %s\n",
|
||||
format(s.f_bavail * s.f_bsize, disp_hr),
|
||||
blocks_percent_used, mountPoint);
|
||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||
printf("%-20s %9s ", device,
|
||||
make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr));
|
||||
|
||||
printf("%9s ",
|
||||
make_human_readable_str( (s.f_blocks - s.f_bfree), s.f_bsize, df_disp_hr));
|
||||
|
||||
printf("%9s %3ld%% %s\n",
|
||||
make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr),
|
||||
blocks_percent_used, mount_point);
|
||||
#else
|
||||
printf("%-20s %9ld %9ld %9ld %3ld%% %s\n",
|
||||
device,
|
||||
(long) (s.f_blocks * (s.f_bsize / 1024.0)),
|
||||
(long) ((s.f_blocks - s.f_bfree) * (s.f_bsize / 1024.0)),
|
||||
(long) (s.f_bavail * (s.f_bsize / 1024.0)),
|
||||
blocks_percent_used, mountPoint);
|
||||
device,
|
||||
(long) (s.f_blocks * (s.f_bsize / (double)KILOBYTE)),
|
||||
(long) ((s.f_blocks - s.f_bfree)*(s.f_bsize/(double)KILOBYTE)),
|
||||
(long) (s.f_bavail * (s.f_bsize / (double)KILOBYTE)),
|
||||
blocks_percent_used, mount_point);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -84,67 +89,64 @@ extern int df_main(int argc, char **argv)
|
||||
int status = EXIT_SUCCESS;
|
||||
int opt = 0;
|
||||
int i = 0;
|
||||
char disp_units_hdr[80] = "1k-blocks"; /* default display is kilobytes */
|
||||
|
||||
while ((opt = getopt(argc, argv, "?"
|
||||
#ifdef BB_FEATURE_HUMAN_READABLE
|
||||
while ((opt = getopt(argc, argv, "k"
|
||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||
"hm"
|
||||
#endif
|
||||
"k"
|
||||
)) > 0)
|
||||
{
|
||||
switch (opt) {
|
||||
#ifdef BB_FEATURE_HUMAN_READABLE
|
||||
case 'h': disp_hr = 0; break;
|
||||
case 'm': disp_hr = MEGABYTE; break;
|
||||
case 'k': disp_hr = KILOBYTE; break;
|
||||
#else
|
||||
case 'k': break;
|
||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||
case 'h':
|
||||
df_disp_hr = 0;
|
||||
strcpy(disp_units_hdr, " Size");
|
||||
break;
|
||||
case 'm':
|
||||
df_disp_hr = MEGABYTE;
|
||||
strcpy(disp_units_hdr, "1M-blocks");
|
||||
break;
|
||||
#endif
|
||||
case '?': goto print_df_usage; break;
|
||||
case 'k':
|
||||
/* default display is kilobytes */
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
printf("%-20s %-14s %s %s %s %s\n", "Filesystem",
|
||||
#ifdef BB_FEATURE_HUMAN_READABLE
|
||||
(KILOBYTE == disp_hr) ? "1k-blocks" : " Size",
|
||||
#else
|
||||
"1k-blocks",
|
||||
#endif
|
||||
printf("%-20s %-14s %s %s %s %s\n", "Filesystem", disp_units_hdr,
|
||||
"Used", "Available", "Use%", "Mounted on");
|
||||
|
||||
|
||||
if(optind < argc) {
|
||||
struct mntent *mountEntry;
|
||||
struct mntent *mount_entry;
|
||||
for(i = optind; i < argc; i++)
|
||||
{
|
||||
if ((mountEntry = find_mount_point(argv[i], mtab_file)) == 0) {
|
||||
error_msg("%s: can't find mount point.\n", argv[i]);
|
||||
if ((mount_entry = find_mount_point(argv[i], mtab_file)) == 0) {
|
||||
error_msg("%s: can't find mount point.", argv[i]);
|
||||
status = EXIT_FAILURE;
|
||||
} else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir))
|
||||
} else if (!do_df(mount_entry->mnt_fsname, mount_entry->mnt_dir))
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
} else {
|
||||
FILE *mountTable;
|
||||
struct mntent *mountEntry;
|
||||
FILE *mount_table;
|
||||
struct mntent *mount_entry;
|
||||
|
||||
mountTable = setmntent(mtab_file, "r");
|
||||
if (mountTable == 0) {
|
||||
mount_table = setmntent(mtab_file, "r");
|
||||
if (mount_table == 0) {
|
||||
perror_msg("%s", mtab_file);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
while ((mountEntry = getmntent(mountTable))) {
|
||||
if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir))
|
||||
while ((mount_entry = getmntent(mount_table))) {
|
||||
if (!do_df(mount_entry->mnt_fsname, mount_entry->mnt_dir))
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
endmntent(mountTable);
|
||||
endmntent(mount_table);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
print_df_usage:
|
||||
usage(df_usage);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+9
-16
@@ -2,8 +2,8 @@
|
||||
/*
|
||||
* Mini dirname implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
* Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
|
||||
* Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,28 +20,21 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "busybox.h"
|
||||
|
||||
/* getopt not needed */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int dirname_main(int argc, char **argv)
|
||||
{
|
||||
char* s;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-'))
|
||||
usage(dirname_usage);
|
||||
show_usage();
|
||||
argv++;
|
||||
|
||||
s=*argv+strlen(*argv)-1;
|
||||
while (s != *argv && *s == '/') {
|
||||
*s-- = '\0';
|
||||
}
|
||||
s = strrchr(*argv, '/');
|
||||
if (s != NULL && s == *argv)
|
||||
s[1] = '\0';
|
||||
else if (s != NULL)
|
||||
*s = '\0';
|
||||
puts(s ? *argv : ".");
|
||||
puts (dirname (argv[0]));
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Loaded 100 of 705 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user