Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
8ec10a9483 | ||
|
|
90ca2848fd | ||
|
|
ed3ef50c23 | ||
|
|
ab050f5522 | ||
|
|
3654ca56fa | ||
|
|
4e33875759 | ||
|
|
a68b21a28e | ||
|
|
6e25f92636 | ||
|
|
a528dc7071 | ||
|
|
1e4b957ac3 | ||
|
|
5c9c8b4b26 | ||
|
|
d5cad14b11 | ||
|
|
dff9d54e32 | ||
|
|
5307eca7de | ||
|
|
114ad9c753 | ||
|
|
dbb8f8d123 | ||
|
|
d35c21587a | ||
|
|
ffde8673fe | ||
|
|
8ba1b1120e | ||
|
|
0bc20caea5 | ||
|
|
537d165216 | ||
|
|
c1b8f1224c | ||
|
|
155c89b0c3 | ||
|
|
15f29e7d86 | ||
|
|
cc2bcdc41d | ||
|
|
39b727f498 | ||
|
|
3862423884 | ||
|
|
70c6086474 | ||
|
|
86f3d5bad6 | ||
|
|
54e9457920 | ||
|
|
23a93f52aa | ||
|
|
f5d5e77321 | ||
|
|
26439a2991 | ||
|
|
088d9e0f05 | ||
|
|
7d69701d39 | ||
|
|
8c5cb31e1b | ||
|
|
a18aaf1b6a | ||
|
|
c5cd470fdb | ||
|
|
f6c6d9aacc | ||
|
|
24be980004 | ||
|
|
a5b55ca8a9 | ||
|
|
f1b0c77c22 | ||
|
|
59ab025363 | ||
|
|
2b8d07c590 | ||
|
|
9136e3c84e | ||
|
|
e132119f07 | ||
|
|
6705986f27 | ||
|
|
6d0921cc0b | ||
|
|
3b3f5c364a | ||
|
|
8f8dab94e5 | ||
|
|
0d5a08ed92 | ||
|
|
b098b6d74c | ||
|
|
fe9888ad97 | ||
|
|
965fa326a1 | ||
|
|
e2310b5a91 | ||
|
|
c73a7f9ba0 | ||
|
|
370fb08e79 | ||
|
|
6092680305 | ||
|
|
5f825ee6d6 | ||
|
|
f914a8af2b | ||
|
|
6f65a3a7e8 | ||
|
|
1d269432b1 | ||
|
|
8392acd8fc | ||
|
|
12f417edbd | ||
|
|
c9acf8c766 | ||
|
|
fd4c58d7c5 | ||
|
|
9aa23ba5a8 | ||
|
|
541ffe30a2 | ||
|
|
55787401ea | ||
|
|
744b064a34 | ||
|
|
59d31b68c3 | ||
|
|
8ea28be6d2 | ||
|
|
0bcc813a34 | ||
|
|
b0970d4fed | ||
|
|
eb60d8bcd1 | ||
|
|
55bccf315e | ||
|
|
defcd5e75e | ||
|
|
6c6ea6cba2 | ||
|
|
92386561f1 | ||
|
|
05ebdd03d4 | ||
|
|
0810f723b1 | ||
|
|
09acc06c10 | ||
|
|
849083c886 | ||
|
|
b3dc3b8990 | ||
|
|
70a7855980 | ||
|
|
1171c2fcb4 | ||
|
|
be7499c83c | ||
|
|
a9711a5969 | ||
|
|
59c09d06e3 | ||
|
|
5e23e3d631 | ||
|
|
fa0443216d | ||
|
|
47b005217e | ||
|
|
5e8b3ea19d | ||
|
|
58a408512b | ||
|
|
7541e3a812 | ||
|
|
004827d715 | ||
|
|
1944f547bd | ||
|
|
28b3c53f0d | ||
|
|
01bda5de6b | ||
|
|
27c7bec4d4 | ||
|
|
e6e818309e | ||
|
|
e9e182e255 | ||
|
|
2d5b64273f | ||
|
|
a9819b2908 | ||
|
|
e9f07fb6e8 | ||
|
|
16fdbe8b27 | ||
|
|
a6cd07099d | ||
|
|
e111d69ca2 | ||
|
|
70da6a66d2 | ||
|
|
3680c58084 | ||
|
|
5e8c0ffb75 | ||
|
|
e75f6a972c | ||
|
|
e80a2633bc | ||
|
|
8eb5985f94 | ||
|
|
8a6b619c96 | ||
|
|
eac2636513 | ||
|
|
a1f9775981 | ||
|
|
24ac017961 | ||
|
|
0d2acb0ead | ||
|
|
86349776d0 | ||
|
|
1fa1adea2a | ||
|
|
0dab829977 | ||
|
|
bfa7967c4a | ||
|
|
8677d7b6ec | ||
|
|
e699b9f0fb | ||
|
|
4f1b0124c7 | ||
|
|
8abc78aa84 | ||
|
|
1b622ff5ac | ||
|
|
aefe5629ab | ||
|
|
95fa0ea3d4 | ||
|
|
6f6aa9b428 | ||
|
|
e3a94f7d08 | ||
|
|
95d1f6d7c7 | ||
|
|
4362200712 | ||
|
|
1e1d232f38 | ||
|
|
235f66dea3 | ||
|
|
d0fa0a12f1 | ||
|
|
02ced93ec2 | ||
|
|
46948366fa | ||
|
|
21125543e1 | ||
|
|
4836fd44f0 | ||
|
|
bd193a42a5 | ||
|
|
77508b29fa | ||
|
|
f361ac29b0 | ||
|
|
483262f633 | ||
|
|
4d4b3b1d88 | ||
|
|
e3a48d865a | ||
|
|
d9d03b83f8 | ||
|
|
b12e506d8d | ||
|
|
69a6b2d4ae | ||
|
|
e48eea63d3 | ||
|
|
a2d61e761e | ||
|
|
5ec241d3b3 | ||
|
|
2d6282bb37 | ||
|
|
d323d32c5b | ||
|
|
5a964f9d0b | ||
|
|
20c2bdd7f2 | ||
|
|
5c365da884 | ||
|
|
4ed17829ac | ||
|
|
b2356f6de9 | ||
|
|
59ec601b8e | ||
|
|
a293a516ad | ||
|
|
394cf22668 | ||
|
|
cf7982e908 | ||
|
|
70d09ed1cf | ||
|
|
9962cd9f78 | ||
|
|
c8eedd56ac | ||
|
|
46f44d24fc | ||
|
|
00732b57c7 | ||
|
|
c52a97d79f | ||
|
|
9df3833370 | ||
|
|
29edd005f9 | ||
|
|
afdde3e356 | ||
|
|
5b5db38a7d | ||
|
|
1bca5ed886 | ||
|
|
8c28fd7849 | ||
|
|
7da312058c | ||
|
|
f21aa84389 | ||
|
|
eb4218d0a4 | ||
|
|
bf2b8ae49a | ||
|
|
76fef0a5d0 | ||
|
|
9cff4fbac9 | ||
|
|
5e09b6e3a8 | ||
|
|
f3b2b52b58 | ||
|
|
f57c944e09 | ||
|
|
7b5c16ebe5 | ||
|
|
87afb526b5 | ||
|
|
1e1d9d1c95 | ||
|
|
da7b82981b | ||
|
|
02553a2a18 | ||
|
|
3d957c87b7 | ||
|
|
6b78fe383f | ||
|
|
1e7cea952b | ||
|
|
bc5941a540 | ||
|
|
bfa54143f6 | ||
|
|
8ffabf5825 | ||
|
|
1d3523b7aa | ||
|
|
21adca750a | ||
|
|
e884970c87 | ||
|
|
92ed8a3519 | ||
|
|
ab147f608d | ||
|
|
26a3adb244 | ||
|
|
deb9d4d765 | ||
|
|
4758368505 | ||
|
|
cf61fe14ae | ||
|
|
d27753afd9 | ||
|
|
0e836ed8db | ||
|
|
2187adc619 | ||
|
|
8cede00b9e | ||
|
|
f484e7e65c | ||
|
|
868c057d25 | ||
|
|
e73fda8311 | ||
|
|
29be79c5f6 | ||
|
|
4c45e0991a | ||
|
|
b8b8d81c24 | ||
|
|
4d449c42f2 | ||
|
|
e2f6e12213 | ||
|
|
09a34e5368 | ||
|
|
02f3b2e0c8 | ||
|
|
87559829ff | ||
|
|
3e856ce428 | ||
|
|
b558e76eb1 | ||
|
|
cabafae7b0 | ||
|
|
c119ab9e29 | ||
|
|
8c725e624a | ||
|
|
8c2d3f46ab | ||
|
|
9bd71e8323 | ||
|
|
8fff78d66e | ||
|
|
ddea368dbe | ||
|
|
618e8ed4c4 | ||
|
|
0730943b49 | ||
|
|
20ea5c3352 | ||
|
|
7b5d59464f | ||
|
|
cf1189f5a7 | ||
|
|
4bfb6b7b67 | ||
|
|
e500d20835 | ||
|
|
d58ff8731c | ||
|
|
9a71af54f5 | ||
|
|
ab8f9e286b | ||
|
|
768a2340b5 | ||
|
|
e93abf9e69 | ||
|
|
5022d0e55f | ||
|
|
0053087587 | ||
|
|
9028e2c96a | ||
|
|
a683ee81d9 | ||
|
|
e5aef92e22 | ||
|
|
cf32e23796 | ||
|
|
50b3113dc2 | ||
|
|
337ec1bb32 | ||
|
|
e790ddb2e1 | ||
|
|
4e573f4729 | ||
|
|
8045c08e1c | ||
|
|
e2e2c29ea1 | ||
|
|
3c5ee9a379 | ||
|
|
46f0beb167 | ||
|
|
2aa1091130 | ||
|
|
6d5b73d183 | ||
|
|
f61caf0411 | ||
|
|
7918e1fd54 | ||
|
|
d8ad76cb31 | ||
|
|
63a862272c | ||
|
|
eb69ead091 | ||
|
|
e7ff2842dd | ||
|
|
2dc192fd99 | ||
|
|
a75466e981 | ||
|
|
ef936da7c5 | ||
|
|
3e07541e5f | ||
|
|
269e07cadc | ||
|
|
a5bd26831f | ||
|
|
b273d66518 | ||
|
|
c559d30776 | ||
|
|
b344c21709 | ||
|
|
d1ee7e39f7 | ||
|
|
84bdc75c7e | ||
|
|
e8c55f42c1 | ||
|
|
2dab174daa | ||
|
|
a0428eee9e | ||
|
|
ef5529b278 | ||
|
|
9133c98a9d | ||
|
|
3180413e76 | ||
|
|
ac1169b20f | ||
|
|
97d2612566 | ||
|
|
324a778f31 | ||
|
|
b60208dd8f | ||
|
|
130005cd89 | ||
|
|
207061ac0d | ||
|
|
2be4797a06 | ||
|
|
6050618096 | ||
|
|
69229a6c92 | ||
|
|
4f94e826cf | ||
|
|
567cdd1d51 | ||
|
|
9a6e67c960 | ||
|
|
33fdae54d1 | ||
|
|
e7e1e2dcad | ||
|
|
0d5835a767 | ||
|
|
872138de50 | ||
|
|
7a86e61a54 | ||
|
|
62f987e95f | ||
|
|
958c78f9a1 | ||
|
|
13241dfbdd | ||
|
|
aa3908d1b7 | ||
|
|
b520e083e0 | ||
|
|
25b669c144 | ||
|
|
ba1ff9b4eb | ||
|
|
c2bf5cad79 | ||
|
|
43f3e6114c | ||
|
|
8d369e98a5 | ||
|
|
c0321f9bc6 | ||
|
|
e7c1af1e0d | ||
|
|
bbaef66b3f | ||
|
|
e0bcce09ba | ||
|
|
8ce85ce4e3 | ||
|
|
bdcc6fbd95 | ||
|
|
f8263516c2 | ||
|
|
db7f2af089 | ||
|
|
f6b7139971 | ||
|
|
d266748c76 | ||
|
|
53323695c5 | ||
|
|
67fdf5e538 | ||
|
|
ff1ed7215c | ||
|
|
d89882da16 | ||
|
|
3570a34de4 | ||
|
|
caffb6eff0 | ||
|
|
c5949f62e5 | ||
|
|
e081eae7a4 | ||
|
|
bf73909f23 | ||
|
|
944be90b21 | ||
|
|
fe4208fe93 | ||
|
|
488aac2e2a | ||
|
|
896fa4ea1d | ||
|
|
57f83fffd8 | ||
|
|
6f283c2f77 | ||
|
|
9ae3838657 | ||
|
|
1b1cfde1f8 | ||
|
|
0102a9fd48 | ||
|
|
2da90d3b58 | ||
|
|
285b446d17 | ||
|
|
32e95f988d | ||
|
|
96bdde97fb | ||
|
|
6d66817b6b | ||
|
|
82e0614101 | ||
|
|
a37d5b772b | ||
|
|
5b17693f0a | ||
|
|
ebc0dd7a8a | ||
|
|
92a61c1206 | ||
|
|
90f580ad5b | ||
|
|
d995493987 | ||
|
|
a2f2a8f8c0 | ||
|
|
810d38f850 | ||
|
|
a1b35c4512 | ||
|
|
8c185f9600 | ||
|
|
75610e18b3 | ||
|
|
2c1faecba7 | ||
|
|
c873d61008 | ||
|
|
ba35b98444 | ||
|
|
d2f5677762 | ||
|
|
d1de4a16ad | ||
|
|
f34aa4c378 | ||
|
|
8a2e56c5df | ||
|
|
350b3f9236 | ||
|
|
ae22612792 | ||
|
|
624cc771da | ||
|
|
8847b9a03a | ||
|
|
7c22b77162 | ||
|
|
cff3fe3ae9 | ||
|
|
0cccdfaf36 | ||
|
|
b938e2ff99 | ||
|
|
46a98dfb13 | ||
|
|
56f3e353da | ||
|
|
06f64b2370 | ||
|
|
0b2da467a8 | ||
|
|
721119e1db | ||
|
|
cd26ff4eac | ||
|
|
252bacc9ea | ||
|
|
fd3741d712 | ||
|
|
38c8551cf2 | ||
|
|
63dde9d4ce | ||
|
|
b2f36af157 | ||
|
|
6fc2a7d04d | ||
|
|
82cfbad216 | ||
|
|
c9db2e8665 | ||
|
|
d2d3aa39ef | ||
|
|
2aee993118 | ||
|
|
f5cf8c6c65 | ||
|
|
33bee33af0 | ||
|
|
5f84fd7066 | ||
|
|
cbe05e45db | ||
|
|
7e3bf6e339 | ||
|
|
ce40fc044b | ||
|
|
5d63884a8f | ||
|
|
31e6829bd8 | ||
|
|
131241f71c | ||
|
|
cbbe4d6bc2 | ||
|
|
56a328810b | ||
|
|
b4c3c59a45 | ||
|
|
f8e04f7113 | ||
|
|
fb6a50820c | ||
|
|
d39d120998 | ||
|
|
5d513f7256 | ||
|
|
dd450a0ded | ||
|
|
322ae93a5e | ||
|
|
b89075298e | ||
|
|
23ad7f7f06 | ||
|
|
ccb0a9ba88 | ||
|
|
fca8050f0f | ||
|
|
ac19b7e032 | ||
|
|
49352adf9c | ||
|
|
605a819a17 | ||
|
|
f0b073f55a | ||
|
|
de34e43755 | ||
|
|
cbb61c78ae | ||
|
|
73de6561ca | ||
|
|
729216cb11 | ||
|
|
18310f1ce3 | ||
|
|
0ae8e5a645 | ||
|
|
bd7c67136a | ||
|
|
1c6917d2c4 | ||
|
|
e2b345a6d8 | ||
|
|
437bf72785 | ||
|
|
6fb88e73f7 | ||
|
|
8324b9f1aa | ||
|
|
11c655295c | ||
|
|
44e3840343 | ||
|
|
17c8851813 | ||
|
|
6085c72b6e | ||
|
|
9dd79791c8 | ||
|
|
ebee301c8b | ||
|
|
d13ebff163 | ||
|
|
1eec89df4c | ||
|
|
3639c5d950 | ||
|
|
1b355ebba6 | ||
|
|
43c8c38bbf | ||
|
|
61a9d8d145 | ||
|
|
9670083818 | ||
|
|
b92223b6f5 | ||
|
|
fd50c3d2f9 | ||
|
|
cb91d69b3f | ||
|
|
73bdf13d35 | ||
|
|
3a957b9d4c | ||
|
|
18a1014c95 | ||
|
|
da542f3a0c | ||
|
|
f446297afd | ||
|
|
e99674a70f | ||
|
|
5eb5912790 | ||
|
|
4e61db2284 | ||
|
|
ad3d90f91e | ||
|
|
a3de24e85d | ||
|
|
1638488d26 | ||
|
|
ab60f6987a | ||
|
|
88cc3057fd | ||
|
|
06aeb6c417 | ||
|
|
4d5ac2f346 | ||
|
|
3a0f4baf2f | ||
|
|
8237add8d0 | ||
|
|
32f2769800 | ||
|
|
089d12d762 | ||
|
|
aaa94fb8a9 | ||
|
|
ce82c8ab77 | ||
|
|
2368a387ed | ||
|
|
e4c4d69c04 | ||
|
|
6ab22027d0 | ||
|
|
fba9c00071 | ||
|
|
acf5551099 | ||
|
|
918507edda | ||
|
|
851ce895bd | ||
|
|
a1f16bba72 | ||
|
|
e2205f093b | ||
|
|
0e4cec0be8 | ||
|
|
dc746169cf | ||
|
|
282c364148 | ||
|
|
fa405d0cb2 | ||
|
|
202995c612 | ||
|
|
c86e5e6145 | ||
|
|
be0dc0d06a | ||
|
|
b2fc5a0647 | ||
|
|
e89267c8b3 | ||
|
|
8cbac440d6 | ||
|
|
6ac18a3d83 | ||
|
|
bb39a31e33 | ||
|
|
79565b6c91 | ||
|
|
f9ca653faa | ||
|
|
88f50b6bf5 | ||
|
|
40406e6bad | ||
|
|
adbf018dc4 | ||
|
|
deb95f69b6 | ||
|
|
46ade97983 | ||
|
|
0c8e2a6580 | ||
|
|
fdd5103348 | ||
|
|
5ae166813f | ||
|
|
807f0fd637 | ||
|
|
d5fa3e3e9a | ||
|
|
080d51bf45 | ||
|
|
0f8f7b8a35 | ||
|
|
98bbd688a8 | ||
|
|
43c17b3d96 | ||
|
|
616d13bcd1 | ||
|
|
259972e565 | ||
|
|
9cf306d55e | ||
|
|
6a4c33c5c0 | ||
|
|
6150df320a | ||
|
|
d5704686b1 | ||
|
|
1428c4f136 | ||
|
|
a5716d3029 | ||
|
|
501c88b245 | ||
|
|
6a99aaf020 | ||
|
|
7ce41ad692 | ||
|
|
e92108ae6d | ||
|
|
0d49dd53cf | ||
|
|
cc10a5b42b | ||
|
|
83e85f6a08 | ||
|
|
52681b48dc | ||
|
|
fad9c1198a | ||
|
|
b040d4f3da | ||
|
|
b9ea02c04b | ||
|
|
d34595d857 | ||
|
|
e5db406690 | ||
|
|
40bfc76385 | ||
|
|
e99f7500e0 | ||
|
|
ea824fb937 | ||
|
|
bf960f58e2 | ||
|
|
7df345e149 | ||
|
|
ec8d60f0f8 | ||
|
|
0010ee45e3 | ||
|
|
c768ab490e | ||
|
|
ced2cefcca | ||
|
|
1f45b268cb | ||
|
|
1ac435c15e | ||
|
|
51154bacbe | ||
|
|
3950596e1e | ||
|
|
99e370f0c6 | ||
|
|
aa4f108338 | ||
|
|
27a804246a | ||
|
|
869057238b | ||
|
|
2f46b664b7 | ||
|
|
91a4400fd5 | ||
|
|
a16c66335e | ||
|
|
ae6eae02dd | ||
|
|
52d6fa3bb3 | ||
|
|
1d255be78d | ||
|
|
2ef880b236 | ||
|
|
a9d69fb568 | ||
|
|
8f122431f5 | ||
|
|
6efc48c1ae | ||
|
|
9c5fcc3408 | ||
|
|
cc8a66b113 | ||
|
|
97562bd9d7 | ||
|
|
21ddb38fcf | ||
|
|
a1d187a8a8 | ||
|
|
bc0aed79a8 | ||
|
|
47d4926244 | ||
|
|
bf181b9338 | ||
|
|
3bd8bd89ee | ||
|
|
464c5de00d | ||
|
|
70705d7c96 | ||
|
|
add09fd558 | ||
|
|
17ad45aace | ||
|
|
df4532bfa3 | ||
|
|
ff5a9033f9 | ||
|
|
f626dcbc84 | ||
|
|
9027bcf2f4 | ||
|
|
93c0d9f090 | ||
|
|
fad04fdd12 | ||
|
|
b870af09ae | ||
|
|
d6912c97de | ||
|
|
58361a44b5 | ||
|
|
e7413a9cde | ||
|
|
d537a95fdb | ||
|
|
4ac6cb534d | ||
|
|
ec10b9d534 | ||
|
|
34623db618 | ||
|
|
02008346c0 | ||
|
|
94074a980c | ||
|
|
496e33feeb | ||
|
|
4f7fe77d07 | ||
|
|
06f3529ada | ||
|
|
156959ea93 | ||
|
|
f4c022649b | ||
|
|
55380700d8 | ||
|
|
00143ba921 | ||
|
|
ac48461da9 | ||
|
|
37653aaf9c | ||
|
|
c41e8c840f | ||
|
|
6f96e674b9 | ||
|
|
be84cd4ef6 | ||
|
|
e58771e73c | ||
|
|
e714bce003 | ||
|
|
3ecbe9f4dc | ||
|
|
97426e082a | ||
|
|
8fbaeece53 | ||
|
|
68fda241d2 | ||
|
|
858c1adf2b | ||
|
|
7719008a85 | ||
|
|
aec27bca98 | ||
|
|
960be79964 | ||
|
|
be909b1cd5 | ||
|
|
d006c9e630 | ||
|
|
9ebccb2891 | ||
|
|
f1f6d58598 | ||
|
|
0c838af50b | ||
|
|
195fa15caf | ||
|
|
61dc057183 | ||
|
|
df5f6ba115 | ||
|
|
da9841efc1 | ||
|
|
da1d1e763d | ||
|
|
cc54d12ef7 | ||
|
|
dd23b8bb43 | ||
|
|
c674d70699 | ||
|
|
6315ce603b | ||
|
|
85c552035e | ||
|
|
9b2297a34e | ||
|
|
a0053735dc | ||
|
|
3849f9bfcc | ||
|
|
9a8243aa1e | ||
|
|
928faac503 | ||
|
|
34e1941c32 | ||
|
|
0b4551faf5 | ||
|
|
a03d86cf54 | ||
|
|
44735f8744 | ||
|
|
999bf72f49 | ||
|
|
e9b527ae48 | ||
|
|
161cf93404 | ||
|
|
f12724c21a | ||
|
|
a57ba4db64 | ||
|
|
2cd439f7f0 | ||
|
|
bd22ed8067 | ||
|
|
877a71bbf0 | ||
|
|
9cf44e79aa | ||
|
|
8f282f1b02 | ||
|
|
acecc47261 | ||
|
|
e6b9dfa967 | ||
|
|
53a955786d | ||
|
|
a2c83d885e | ||
|
|
03f9c81cec | ||
|
|
bb374a6935 | ||
|
|
4c95a28461 | ||
|
|
3312b0b626 | ||
|
|
2158092344 | ||
|
|
b9eb0233a9 | ||
|
|
b0b732bfe4 | ||
|
|
03f4c27bd6 | ||
|
|
67536ffa43 | ||
|
|
8845adc545 | ||
|
|
02bc25be56 | ||
|
|
e5cec4e3ac | ||
|
|
62bb2d02b6 | ||
|
|
a5dbb39dac | ||
|
|
c8c10c5715 | ||
|
|
f86aee74ce | ||
|
|
b1e379f7f3 | ||
|
|
78eab2f6c6 | ||
|
|
3cfa9ec09c | ||
|
|
6f5e281479 | ||
|
|
b2731b11ef | ||
|
|
1e03add675 | ||
|
|
5d893b6beb | ||
|
|
89bc256c94 | ||
|
|
f7cf2f7ef9 | ||
|
|
57ebebfb01 | ||
|
|
2086e3d679 | ||
|
|
028fb625f5 | ||
|
|
5331025f79 | ||
|
|
b02c54ebee | ||
|
|
72965e3454 | ||
|
|
b54833cde0 | ||
|
|
7c31ea4e29 | ||
|
|
5d41d60f1e | ||
|
|
2e1148b239 | ||
|
|
8bd891cbec | ||
|
|
1ca41775bb | ||
|
|
d37218941c | ||
|
|
268b8c4f38 | ||
|
|
0c96eba3de | ||
|
|
a44790f539 | ||
|
|
a2db097d66 | ||
|
|
1c314ad655 | ||
|
|
47cac6779a | ||
|
|
eb0283333b | ||
|
|
7cdc76dfbf | ||
|
|
d0edef3cbe | ||
|
|
495869f59a | ||
|
|
cb1d841f09 | ||
|
|
27b5924b96 | ||
|
|
8f425dbf9a | ||
|
|
83a949cb22 | ||
|
|
1386e70210 | ||
|
|
ef40aa81c5 | ||
|
|
3adffb7fc8 | ||
|
|
10dc9d4d17 | ||
|
|
8a24a6783a | ||
|
|
4a971aef59 | ||
|
|
3c37598dc2 | ||
|
|
a29dec28cb | ||
|
|
ccd32cbb61 | ||
|
|
9d9610b8de | ||
|
|
6f9985e2f2 | ||
|
|
addc9c28ad | ||
|
|
4fa84e6b54 | ||
|
|
c6cdf58747 | ||
|
|
07edff4ba4 | ||
|
|
45087b1010 | ||
|
|
766c012975 | ||
|
|
c5c5e3d144 | ||
|
|
afa0662860 | ||
|
|
1a804e4b3c | ||
|
|
f929641c51 | ||
|
|
feb47c024a | ||
|
|
f7a01951fb | ||
|
|
7ac06a3ff1 | ||
|
|
0021679b0d | ||
|
|
b405dfa54d | ||
|
|
c03525475e | ||
|
|
e63ad9ba06 | ||
|
|
28c88a9430 | ||
|
|
339b892313 | ||
|
|
4eb1b30411 | ||
|
|
bd4a75f6c8 | ||
|
|
bb245ba0c2 | ||
|
|
9ca57d377e | ||
|
|
e1e23eecab | ||
|
|
5e29c6ffce | ||
|
|
a15cd0be34 | ||
|
|
b7362e36a8 | ||
|
|
67e32304b1 | ||
|
|
be5023a84d | ||
|
|
b610615be9 | ||
|
|
dbb3019d0d | ||
|
|
30f0f2d040 | ||
|
|
b108a5b780 | ||
|
|
110fc0cacc | ||
|
|
74c66ad06e | ||
|
|
98cd53e86d | ||
|
|
852ff13fc4 | ||
|
|
b991395405 | ||
|
|
2e965239ee | ||
|
|
3f75503fa0 | ||
|
|
28c70b3a16 | ||
|
|
e97da40079 | ||
|
|
1af7ed5573 | ||
|
|
3c709b45b3 | ||
|
|
d84990eb1f | ||
|
|
854e11581f | ||
|
|
2b6ab3cbf8 | ||
|
|
053b1462b7 | ||
|
|
baf22bff21 | ||
|
|
c7ccfc99fc | ||
|
|
9f16d61408 | ||
|
|
44760d058c | ||
|
|
5db60a7a7a | ||
|
|
0c6a970eb2 | ||
|
|
b3d235f63b | ||
|
|
b3cf9baeb9 | ||
|
|
049b706591 | ||
|
|
da10ec0eaa | ||
|
|
0024abcbbc | ||
|
|
0b66577368 | ||
|
|
a42982e8f5 | ||
|
|
1f6262b8e2 | ||
|
|
fb8ba506bb | ||
|
|
3232203226 | ||
|
|
d05e3ce5c2 | ||
|
|
eec2f63b3f | ||
|
|
700a5aed75 | ||
|
|
517cab761f | ||
|
|
6ca28ba65c | ||
|
|
680d65a646 | ||
|
|
68480dc30f | ||
|
|
815e904470 | ||
|
|
c389d91181 | ||
|
|
82c0ac7e4f | ||
|
|
f2fffefe49 | ||
|
|
36fe1a30b1 | ||
|
|
926e0e3465 | ||
|
|
afeb683459 | ||
|
|
46a38dbb9b | ||
|
|
ef4268efa7 | ||
|
|
832000f7f3 | ||
|
|
f0c30b71be | ||
|
|
5a0a2aa00b | ||
|
|
808d03ec19 | ||
|
|
9c8ffa02f4 | ||
|
|
3199bda52e | ||
|
|
6082917e34 | ||
|
|
380e58a05f | ||
|
|
ec480c49c2 | ||
|
|
86ab8a32bd | ||
|
|
4062268bc7 | ||
|
|
08e9289ab3 | ||
|
|
b6c6d87a99 | ||
|
|
77bd2db325 | ||
|
|
1624813459 | ||
|
|
b83e0ed3a1 | ||
|
|
89960b8af2 | ||
|
|
b5966368d7 | ||
|
|
deb0331eb6 | ||
|
|
108a44345c | ||
|
|
e511e7c116 | ||
|
|
8ea7d8cdaf | ||
|
|
330fd2b576 | ||
|
|
d356c6e9d1 | ||
|
|
5b46d792f1 | ||
|
|
499f65fb98 | ||
|
|
969f9b0486 | ||
|
|
67a0dd8f3c | ||
|
|
c3f5c9c2ee | ||
|
|
bcd6177853 | ||
|
|
73c8c9cf9a | ||
|
|
23dea9b712 | ||
|
|
7ab9c7ee52 | ||
|
|
3d427ac5ef | ||
|
|
59b9e87024 | ||
|
|
ac130e1dca | ||
|
|
0a027e6880 | ||
|
|
691f49d3c1 | ||
|
|
0e713cef9d | ||
|
|
6c5f2c6021 | ||
|
|
9b15e50835 | ||
|
|
a59d7094a6 | ||
|
|
0a704e8ff6 | ||
|
|
a19bc64653 | ||
|
|
e31c06608e | ||
|
|
03ccce6e30 | ||
|
|
5afc864422 | ||
|
|
3c1217cfad | ||
|
|
8f8d6d5f2d | ||
|
|
d16665810d | ||
|
|
12d1b378be | ||
|
|
9b7d964581 | ||
|
|
f378fced43 | ||
|
|
4625240674 | ||
|
|
94f5e0ba7c | ||
|
|
28c49b6c9c | ||
|
|
25c44c623d | ||
|
|
923ef599f3 | ||
|
|
6ed02a0ee0 | ||
|
|
abc199eb0c | ||
|
|
4f3f757d56 | ||
|
|
227a59b05d | ||
|
|
f93a95de69 | ||
|
|
e90f4045af | ||
|
|
1d1d95051a | ||
|
|
cf8d38a3eb | ||
|
|
7d6ba57bba | ||
|
|
e3ed156eeb | ||
|
|
1101d23604 | ||
|
|
eef658068b | ||
|
|
2e397341d9 | ||
|
|
262dd039eb | ||
|
|
3fe7f9f20b | ||
|
|
a3e57ca700 | ||
|
|
f13df3752c | ||
|
|
9a8195cc03 | ||
|
|
b9167cb67f | ||
|
|
632bb57135 | ||
|
|
c366050a23 | ||
|
|
f29f797f54 | ||
|
|
0a64de9b4f | ||
|
|
229dd2b905 | ||
|
|
5d68857b9c | ||
|
|
a6c752201e | ||
|
|
91e581fa04 | ||
|
|
5a50def0f4 | ||
|
|
6e703034f4 | ||
|
|
26702fe191 | ||
|
|
e5b6c7dd9c | ||
|
|
4fd10fc73b | ||
|
|
200be97e36 | ||
|
|
5a728cfdfe | ||
|
|
3becdfc316 | ||
|
|
53642b066c | ||
|
|
9057b6a918 | ||
|
|
ab01ed12bd | ||
|
|
5e1189e187 | ||
|
|
95c1c1e05f | ||
|
|
d5ba77d03e | ||
|
|
50ed0676ad | ||
|
|
cbd6628c8c | ||
|
|
9cf3bfa7c1 | ||
|
|
b4f8606c05 | ||
|
|
08e7f75ba2 | ||
|
|
f17792ca9b | ||
|
|
61677feff7 | ||
|
|
62dc17a3b1 | ||
|
|
f0657d3229 | ||
|
|
a2685735b1 | ||
|
|
f3b3d17060 | ||
|
|
0817d1372c | ||
|
|
84e09e4437 | ||
|
|
ecd512453c | ||
|
|
5dd853ad2a | ||
|
|
6a34b539db | ||
|
|
825aead68b | ||
|
|
93d6513d93 | ||
|
|
7a4b719486 | ||
|
|
6bd3602988 | ||
|
|
c0dac18d6d | ||
|
|
e9fee653dc | ||
|
|
d4bc1fcad8 | ||
|
|
5661fe078e | ||
|
|
cbb0a4b40d | ||
|
|
b99ca13261 | ||
|
|
68a9ea4208 | ||
|
|
183da4ade1 | ||
|
|
983b51b17b | ||
|
|
3364d78b18 | ||
|
|
6acaa40f27 | ||
|
|
deea048bec | ||
|
|
1ad302ac90 | ||
|
|
e454fb68a3 | ||
|
|
298854f029 | ||
|
|
ec5bd90916 | ||
|
|
016ffe9307 | ||
|
|
0d068a2067 | ||
|
|
c053e41fa0 | ||
|
|
42094cdad5 | ||
|
|
1dbe340eba | ||
|
|
c7c634bd88 | ||
|
|
6c41c44898 | ||
|
|
531bcb6826 | ||
|
|
6273f655c8 | ||
|
|
161220c498 | ||
|
|
13456d1fcd | ||
|
|
d75af99529 | ||
|
|
a967e3c8f0 | ||
|
|
ce91732416 | ||
|
|
3522eb1ab3 |
No files matched your search
@@ -1,2 +1,4 @@
|
||||
busybox
|
||||
busybox.links
|
||||
_install
|
||||
applet_source_list
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
--blank-lines-after-declarations
|
||||
--blank-lines-after-procedures
|
||||
--break-before-boolean-operator
|
||||
--no-blank-lines-after-commas
|
||||
--braces-on-if-line
|
||||
--braces-on-struct-decl-line
|
||||
--comment-indentation25
|
||||
--declaration-comment-column25
|
||||
--no-comment-delimiters-on-blank-lines
|
||||
--cuddle-else
|
||||
--continuation-indentation4
|
||||
--case-indentation0
|
||||
--else-endif-column33
|
||||
--space-after-cast
|
||||
--line-comments-indentation0
|
||||
--declaration-indentation1
|
||||
--dont-format-first-column-comments
|
||||
--dont-format-comments
|
||||
--honour-newlines
|
||||
--indent-level4
|
||||
/* changed from 0 to 4 */
|
||||
--parameter-indentation4
|
||||
--line-length78 /* changed from 75 */
|
||||
--continue-at-parentheses
|
||||
--no-space-after-function-call-names
|
||||
--dont-break-procedure-type
|
||||
--dont-star-comments
|
||||
--leave-optional-blank-lines
|
||||
--dont-space-special-semicolon
|
||||
--tab-size4
|
||||
/* additions by Mark */
|
||||
--case-brace-indentation0
|
||||
--leave-preprocessor-space
|
||||
@@ -1,8 +1,8 @@
|
||||
List of the authors of code contained in busybox.
|
||||
List of the authors of code contained in BusyBox.
|
||||
|
||||
If you should be listed here, or the description of
|
||||
what you have done needs more detail, or is incorect,
|
||||
_please_ let me know.
|
||||
If you have code in BusyBox, you should be listed here. If you should be
|
||||
listed, or the description of what you have done needs more detail, or is
|
||||
incorect, _please_ let me know.
|
||||
|
||||
-Erik
|
||||
|
||||
@@ -12,11 +12,11 @@ Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
Tons of new stuff, major rewrite of most of the
|
||||
core apps, tons of new apps as noted in header files.
|
||||
|
||||
Bruce Perens <bruce@pixar.com>
|
||||
Original author of BusyBox. His code is still in many apps.
|
||||
|
||||
Edward Betts <edward@debian.org>
|
||||
expr, hostid, logname, tty, wc, whoami, yes
|
||||
|
||||
John Beppu <beppu@lineo.com>
|
||||
du, head, tee
|
||||
du, head, nslookup, sort, tee, uniq
|
||||
|
||||
Brian Candler <B.Candler@pobox.com>
|
||||
tiny-ls(ls)
|
||||
@@ -28,17 +28,54 @@ Dave Cinege <dcinege@psychosis.com>
|
||||
more(v2), makedevs, dutmp, modularization, auto links file,
|
||||
various fixes, Linux Router Project maintenance
|
||||
|
||||
Larry Doolittle <ldoolitt@recycle.lbl.gov>
|
||||
pristine source directory compilation, lots of patches and 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
|
||||
|
||||
John Lombardo <john@deltanet.com>
|
||||
dirname, tr
|
||||
dirname, tr
|
||||
|
||||
Glenn McGrath <bug1@netconnect.com.au>
|
||||
ar.c
|
||||
|
||||
Bruce Perens <bruce@pixar.com>
|
||||
Original author of BusyBox. His code is still in many apps.
|
||||
|
||||
Kent Robotti <robotti@metconnect.com>
|
||||
reset, tons and tons of bug reports and patchs.
|
||||
|
||||
Chip Rosenthal <chip@unicom.com>, <crosenth@covad.com>
|
||||
wget - Contributed by permission of Covad Communications
|
||||
|
||||
Pavel Roskin <proski@gnu.org>
|
||||
Lots of bugs fixes and patches.
|
||||
|
||||
Gyepi Sam <gyepi@praxis-sw.com>
|
||||
Remote logging feature for syslogd
|
||||
|
||||
Linus Torvalds <torvalds@transmeta.com>
|
||||
mkswap, fsck.minix, mkfs.minix
|
||||
|
||||
Mark Whitley <markw@lineo.com> <markw@codepoet.org>
|
||||
grep, sed, cut, xargs, style-guide, new-applet-HOWTO, bug fixes, etc.
|
||||
|
||||
Charles P. Wright <cpwright@villagenet.com>
|
||||
gzip, mini-netcat(nc)
|
||||
|
||||
Enrique Zanardi <ezanardi@ull.es>
|
||||
tarcat (since removed), loadkmap, various fixes, Debian maintenance
|
||||
|
||||
Karl M. Hegbloom <karlheg@debian.org>
|
||||
cp_mv.c, the test suite, various fixes to utility.c, &c.
|
||||
Vladimir Oleynik <dzo@simtreas.ru>
|
||||
cmdedit, stty-port, locale, various fixes
|
||||
and irreconcilable critic of everything not perfect.
|
||||
|
||||
Tim Riker <Tim@Rikers.org>
|
||||
bug fixes, member of fan club
|
||||
@@ -1,4 +1,541 @@
|
||||
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
|
||||
BB_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
|
||||
* Matt Kraai -- new tail.c
|
||||
* Glenn McGrath -- new 'dpkg-deb' applet
|
||||
* Glenn McGrath -- new ar code
|
||||
* spoon -- new watchdog applet
|
||||
* Vladimir N. Oleynik <dzo@simtreas.ru> -- fixed cmdedit.c so now
|
||||
scrolling and tab completion in lash work properly. Also several
|
||||
byte saving optimizations.
|
||||
* Erik Andersen -- disabled many less commonly used applets by default
|
||||
* Mark Whitley -- more thrashing about to get clean perror_msg usage
|
||||
* Matt Kraai -- new command line munging
|
||||
* Larry Doolittle -- keep some locales from messing up busybox.sh
|
||||
* Matt Kraai -- cleaned up dd and tail with new parse_number routine
|
||||
* Mark Whitley -- remove debugging messages from deallocvt
|
||||
* Matt Kraai and Mark Whitley -- new document "How to Add a New Applet
|
||||
to BusyBox"
|
||||
* David Douthitt -- fixed "grep -qv" bug
|
||||
* Larry Doolittle -- fixed insmod bug with old kernels
|
||||
* Matt Kraai -- logger remixed to use getopt, selection of stdin made
|
||||
util-linux compatible
|
||||
* Erik Andersen -- many more internal symbols classified static to
|
||||
avoid namespace pollution
|
||||
* Matt Kraai -- nc listening support
|
||||
* Erik Andersen -- made sed understand arbitrary regexp delimiters
|
||||
* Matt Kraai et al. -- more tar improvements and bug fixes, now
|
||||
handles regexp file exclusion
|
||||
* Larry Doolittle -- new script (multibuild.pl) to automate build rule
|
||||
checking
|
||||
* Matt Kraai -- update/cleanup of the docs on how to use init
|
||||
* Erik Andersen -- renamed all sh.c symbols per the style guide,
|
||||
better if-then-else-fi handling
|
||||
* Erik Andersen -- cleaner division of labor between cmdedit.c and sh.c
|
||||
* Larry Doolittle -- shell data structure cleanup, fixed buglets
|
||||
in read, exec, and piped builtins
|
||||
* Erik Andersen -- md5sum was broken in 0.48. Now fixed (and doesn't
|
||||
use getline, shrinking static compiles (since nothing else used it).
|
||||
* ?? -- squashed memory leak in shell prompt handling
|
||||
* 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
|
||||
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
|
||||
whether or not to use the system's passwd and group functions.
|
||||
Since most systems use GNU libc, this can save you from having to
|
||||
install the /etc/nsswitch.conf configuration file and the required
|
||||
libnss_* libraries. Adds 1.5k. You can now, also, disable this,
|
||||
causing busybox to use the system's pwd.h and grp.h functions.
|
||||
|
||||
|
||||
-Erik Andersen, 27 January 2001
|
||||
|
||||
0.48
|
||||
|
||||
* Glenn McGrath -- tar now supports uncompressing tar files,
|
||||
define BB_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.
|
||||
* me -- Fixed uname problem causing the kernel version to be
|
||||
mis-detected (causing problems with poweroff, init,
|
||||
and other things).
|
||||
* Alcove, Julien Gaulmin <julien.gaulmin@alcove.fr> and
|
||||
Nicolas Ferre <nicolas.ferre@alcove.fr> -- insmod support on ARM
|
||||
and StrongArm, and suport for lsmod on older 2.0.x kernels.
|
||||
* Kent Robotti -- Renamed unrpm to original rpmunpack, so you can use
|
||||
an included shell script called unrpm as a front end to it. There's
|
||||
also a shell script called undeb included for debian packages.
|
||||
* Matt Kraai -- fix an infinite loop with ls -aR
|
||||
* Larry Doolittle -- Shaved off about 100 bytes and 200 bytes heap
|
||||
from date.c. Also document the "-d" option in the usage message.
|
||||
* Gennady Feldman -- fixed dd to use blocksize when reading/writing,
|
||||
(it was reading the whole thing and then writing it out). Also
|
||||
updated usage information (was missing conv=notrunc) and added
|
||||
conv=sync feature.
|
||||
* Larry Doolittle (in collaboration with Matt Kraai) -- allow for a
|
||||
pristine source directory -- where all the .o files and such are
|
||||
not placed into the source tree. Thanks Larry!
|
||||
* Larry Doolittle -- use the applet definitions in applets.h
|
||||
to autogenerate the applet function and usage prototypes.
|
||||
* Sebastien Huet, Arne Bernin, and Kent Robotti -- Add in tar -X and
|
||||
fixed a bug breaking tar --exclude.
|
||||
* Jonas Holmberg -- echo option handling made GNU-echo compatible
|
||||
* Aleksey Demidov <asd@ixcelerator.com> -- date option handling made
|
||||
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
|
||||
* Gaute B Strokkenes <gs234@cam.ac.uk> -- applets found using a
|
||||
binary search instead of linear search. Much faster!
|
||||
* new applets: cmp readlink
|
||||
* Mark Whitley -- Removed advertising clause of Berkeley license
|
||||
according to decision by the Regents of the University of
|
||||
California; included reference
|
||||
* tail's confusing special treatment of single digit options removed;
|
||||
people should use -n instead
|
||||
* Larry Doolittle -- \r handled now in echo and tr
|
||||
* Matt Kraai -- rewrite of uniq
|
||||
* Mark Whitley -- remix of xargs
|
||||
* Jim Gleason <jimg@lineo.com> -- fixed tar so it no longer breaks
|
||||
hard links.
|
||||
* Matt Kraai -- logger now logs all arguments, not just the first
|
||||
* Gennady Feldman -- syslogd no longer logs to localhost if compiled
|
||||
for remote logging...
|
||||
* Richard June <rjune@ims1.imagestream-is.com> -- support for 'gzip -d'
|
||||
* various artists -- Other good stuff that I forgot to document.
|
||||
|
||||
|
||||
-Erik Andersen, 13 December 2000
|
||||
|
||||
0.47
|
||||
|
||||
* A bug in syslogd was fixed that allowed it to potentially fork-bomb
|
||||
your system. Anyone using 0.46 syslogd should upgrade.
|
||||
* Renamed busybox.defs.h to the more sensible "Config.h"
|
||||
* Improved portability between different libcs.
|
||||
* Many apps ported to use getopt()
|
||||
* Common handling of '--help'
|
||||
* All usage messages centralized.
|
||||
* Added a bunch of new commands:
|
||||
* 'rdate' contributed by Sterling Huxley <sterling@europa.com>
|
||||
* 'wget' contributed by Chip Rosenthal <chip@unicom.com>,
|
||||
<crosenth@covad.com> and Covad Communications
|
||||
* 'getopt' from "Alfred M. Szmidt" <ams@trillian.itslinux.org>
|
||||
* dos2unix, unix2dos, reset, and unrpm.c (and lots of help
|
||||
debugging) thanks to Kent Robotti <robotti@metconnect.com>.
|
||||
* 'renice' command, thanks to Dave Cinege <dcinege@psychosis.com>
|
||||
* 'xargs' (written by me)
|
||||
* 'expr' contributed by Edward Betts <edward@debian.org>, based
|
||||
on GNY expr
|
||||
* lsmod now uses the query_module syscall, rather then /proc (me)
|
||||
* syslogd can now log messages to remote hosts -- patch thanks
|
||||
to Gyepi Sam <gyepi@praxis-sw.com>
|
||||
* chroot can now call the builtin shell - Pavel Roskin <proski@gnu.org>
|
||||
* 'make install' now creates relative symlinks, and added a new
|
||||
'make install-hardlinks' target to (tada) install hardlinks.
|
||||
* Rewrite of 'tail' to make it simpler, smaller, and more robust.
|
||||
It now weighs only 2.25k (3k when full featured). The code is
|
||||
cleaner too, thanks to Allen Soard <esp-software@mail.hypermart.net>
|
||||
* Add optional ls file sorting, thanks to a patch from
|
||||
Sterling Huxley <sterling@europa.com>
|
||||
* Fixed chmod option parsing so things like 'chmod -r /tmp/file'
|
||||
now work (previously it thought -r was an option). Doh!
|
||||
* Fixed tar handling of stdin and stdout
|
||||
* Renamed "internal.h" to the more sensible "busybox.h"
|
||||
* Preliminary support for GNU HURD.
|
||||
* Updated my devps and devmtab kernel patches for the latest 2.2.x
|
||||
kernel, for those wanting to go proc-less.
|
||||
* Tons of other bugfixes.
|
||||
|
||||
|
||||
-Erik Andersen, 25 September 2000
|
||||
|
||||
|
||||
0.46
|
||||
|
||||
* Better portability. Now should compile cleanly with libc5,
|
||||
GNU libc 2.0 and 2.1, and various Linux kernels including
|
||||
2.0.x, 2.2.x, and to 2.4.0-test*. (patch for 2.4.x kernels
|
||||
to make /proc/mounts behave included in the kernel-patches dir).
|
||||
* Fixed a _horrible_ bug where 'tar -tvf' could unlink
|
||||
local files that matched tarball contents!!! Fix thanks
|
||||
to Marius Groeger <mgroeger@sysgo.de>
|
||||
* Fixed a nasty bug in tar when could mess up saved symlinks.
|
||||
* Fixed tar creation support when reading from stdin ('tar -cf - . ')
|
||||
thanks to Daniel Quinlan <quinlan@transmeta.com>
|
||||
* Updates to handle Linux 2.4.0 kernels (kludged around the
|
||||
"none" entries in /proc/mounts, added a hack to make sysinfo
|
||||
work with both old and new kernels).
|
||||
* Fixed insmod module option parsing for options lacking an '='.
|
||||
Fix thanks to Marc Nijdam <marc_nijdam@hp.com>
|
||||
* Fixed segfault with 'cut -f 1 -d:' and added 'cut -s' suport.
|
||||
Fix thanks to Arne Bernin <arne@matrix.loopback.org>
|
||||
* Several fixes from Marius Groeger <mag@sysgo.de>
|
||||
- Added support for "sh -c command args..."
|
||||
- Fixed globbing, i.e. 'echo * *' and 'echo "******"' now work.
|
||||
- Added shell environment variable substitution
|
||||
- Added the "read" shell builtin.
|
||||
* Fixed cursor editing in cmdedit.c. The following keyboard sequence
|
||||
used to create an infinite loop: ls, cursor up, left, down.
|
||||
* Added support for being a login shell, so things like
|
||||
'-su' or '-sh' (stuff where argv[0][0]=='-') will now always
|
||||
invoke the shell. Now you can use BusyBox as a login shell.
|
||||
* ls.c now ignores '-g', since some ftp clients like that sort
|
||||
of thing. Patch thanks to David Vrabel <dvrabel@arcom.co.uk>
|
||||
* Fix to init.c from Stuart Menefy <Stuart.Menefy@st.com> so that
|
||||
it always sets the controlling terminal before running any programs
|
||||
* Several fixes from Matt Kraai <kraai@alumni.carnegiemellon.edu>
|
||||
- Fixed tr so it recognizes standard escape sequences.
|
||||
Merged common escape seq. code from tr and echo into utility.c.
|
||||
- Major work in updating/cleaning up the docs, and getting the
|
||||
new SGML based docs into shape.
|
||||
- cleanup of ar.c
|
||||
- BusyBox should now poweroff when asked to do so.
|
||||
- Fixed 'ln -n' and 'ln -s' so they both work properly.
|
||||
* Reorganized signal names in kill.c for better architecture support
|
||||
-- patch thanks to simon wood <simon@mungewell.uklinux.net>
|
||||
* In 0.43, backspace and delete worked properly, but with 0.45,
|
||||
it just echoed a ^? for backspace, and ^H for control-h. This
|
||||
was due to a broken macro in init.c, that is now fixed.
|
||||
* Removed sfdisk from BusyBox. It was buggy, fat, and we really
|
||||
couldn't maintain it very well, so including it was not really
|
||||
very appropriate. Those wanting an fdisk are invited to
|
||||
grab a copy from util-linux.
|
||||
* Added 'dumpkmap' to allow people to dump a binary keymap, which can
|
||||
then be loaded in by 'loadkmap' -- submitted by
|
||||
Arne Bernin <arne@matrix.loopback.org>
|
||||
* Fixed NFS so it supports 2.4.x kernels and NFSv3.
|
||||
* Brand, new versions of grep and sed which use libc regex routines,
|
||||
thanks to Mark Whitley <markw@lineo.com>. The hand-tooled
|
||||
"regexp.[ch]" files have been removed. Much help on these from
|
||||
Matt Kraai as well.
|
||||
|
||||
|
||||
-Erik Andersen, 11 July 2000
|
||||
|
||||
|
||||
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
|
||||
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.
|
||||
* insmod now works. It costs 29k, but imagine an initrd with a
|
||||
staticly linked busybox containing only insmod and sh, a few /dev
|
||||
entries, and a kernel module or two... It doesn't get smaller
|
||||
then this folks (I pity the fool that writes insmod in asm ;-).
|
||||
Many kudos go to Ron Alder <alder@lineo.com> for finishing this off!
|
||||
* Added a mini ar archive utility, especially written for BusyBox by
|
||||
Glenn McGrath <bug1@netconnect.com.au>
|
||||
* Added mktemp, contributed by Daniel Jacobowitz <dan@debian.org>
|
||||
* Added setkeycodes, for those that have wierd keyboard buttons.
|
||||
* Added md5sum, uuencode and uudecode -- thanks to Alfred M. Szmidt
|
||||
<ams@trillian.itslinux.org> for contributing these.
|
||||
* Added 'grep -v' option (inverted search) and updated
|
||||
docs accordingly. -beppu
|
||||
* Wrote which
|
||||
* 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
|
||||
be invoked as shell internals. Best used when compiling staticly
|
||||
(i.e. DOSTATIC=true)
|
||||
* BusyBox sh (lash) internals now behave as expected wrt pipes
|
||||
and redirects.
|
||||
* Fixed ping warnings -- fix from Sascha Ziemann <szi@aibon.ping.de>
|
||||
* Fixed update segfault
|
||||
* Fixed mknod -- minor number was always 0
|
||||
* Fixed tar option parsing, so both "tar xvf foo.tar" and
|
||||
"tar -xvf foo.tar" now work (i.e. no "-" before options)
|
||||
(this was very broken in 0.43).
|
||||
* Several contributions from Randolph Chung <tausq@debian.org>.
|
||||
* cp/mv now accepts the -f flag
|
||||
* tail can now accept -<num> commands (e.g. -10) for better
|
||||
compatibility with the standard tail command
|
||||
* added a simple id implementation; doesn't support sup. groups yet
|
||||
* logname used getlogin(3) which uses utmp. Now it doesn't.
|
||||
* whoami used getpwuid(3) which uses libc NSS. Now it behaves.
|
||||
* Add support for "noatime" and "nodiratime" mount flags to mount.
|
||||
* Changed 'umount -f' to mean force, and actually use umount2.
|
||||
* Changed 'umount -l' to mean "Do not free loop device".
|
||||
* Fixed basename to support stripping of suffixes. Patch thanks
|
||||
to xiong jianxin <jxiong@uiuc.edu>
|
||||
* cp -fa now works as expected for symlinks (it didn't before)
|
||||
* zcat now works (wasn't working since option parsing was broken)
|
||||
* Renamed "mnc" to the more correct "nc" (for netcat).
|
||||
* Makefile intelligence updates
|
||||
* Changed the way init parses /etc/inittab entries to avoid problems
|
||||
with commands that contain colons in them. Fix thanks to
|
||||
Pavel Roskin <proski@gnu.org>
|
||||
* Fixed a warning in utility.c due to char being unsigned on Linux/PPC,
|
||||
Fix thanks to Pavel Roskin <proski@gnu.org>
|
||||
* Made "killall" complain (not error and exit) about processes that it
|
||||
cannot find by name -- Pavel Roskin <proski@gnu.org>
|
||||
* Fixed more and ps to have sensible terminal width defaults, thanks
|
||||
to Pavel Roskin.
|
||||
* Fixed all fatalError() calls lacking a "\n", thanks to Pavel Roskin.
|
||||
* Fixed a segfault in yes when no args were given -- Pavel Roskin.
|
||||
* Simplified freeramdisk and added argument checking -- Pavel Roskin.
|
||||
* Fixed segfault caused by "touch -c"
|
||||
* Fixed segfault caused by "rm -f"
|
||||
* Fixed segfault caused by "ln -s -s" and similar abuses. Further fixes
|
||||
and "--" support from Pavel Roskin.
|
||||
* Fixed segfault caused by "cp -a -a" and similar abuses.
|
||||
* Implemented "rm -- <foo>". Implementation fixed by Pavel Roskin.
|
||||
* "which" rewritten to use stat(). Fixes to improve its compatability
|
||||
with traditional implementations -- Pavel Roskin.
|
||||
* "mount" now reports errors from nfsmount() and assumes NFS mount
|
||||
if ':' is present in the device name - Pavel Roskin
|
||||
* 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 "ping -s", fixed error messages and argument parsing -
|
||||
Pavel Roskin
|
||||
* Syslogd will not go to background if "-n" is given. Better help
|
||||
and argument checking -- Pavel Roskin
|
||||
* Fixed a small bug that could cause tar to emit warning messages
|
||||
and not extract the first file in a directory in some cases
|
||||
of nested directories. Thanks to Kevin Traas <kevin@netmaster.com>
|
||||
for helping track this one down.
|
||||
* More doc updates
|
||||
* Fixed grep "Line too long" problem -- John Beppu
|
||||
* Fixed 'grep -q -i B some_file' so it works
|
||||
* math takes input from stdin if no args are given. -- John Beppu
|
||||
* math was renamed to dc. Although it deviates from dc's behaviour,
|
||||
this will probably be remedied in the future. -- John Beppu
|
||||
|
||||
|
||||
-Erik Andersen, June 21, 2000
|
||||
|
||||
|
||||
0.44
|
||||
Previously, an erronous announcement of BusyBox 0.44 was made, so to
|
||||
avoid possible confusion, we are skipping straight to 0.45, and calling
|
||||
it good.
|
||||
|
||||
-Erik Andersen
|
||||
|
||||
|
||||
0.43
|
||||
* Major update to the provided documentation.
|
||||
* Busybox now includes a shell! It currently costs 7.5 k (plus an
|
||||
additional 2.5 k if you compile in command line editing). Handles
|
||||
job control, has the usual set of builtins, and does everything
|
||||
except for handling programming statements (if, while, etc...)
|
||||
* Busybox can now work perfectly when /proc is disabled, thereby
|
||||
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
|
||||
@@ -6,15 +543,19 @@
|
||||
provides. To enable this, turn on BB_FEATURE_USE_DEVPS_PATCH and
|
||||
patch your kernel with the devps patch in the kernel-patches/
|
||||
directory.
|
||||
* Wrote basename, killall, and uptime.
|
||||
* Wrote basename, dirname, killall, and uptime.
|
||||
* tar has been completely rewritten by me. Both tar creation and
|
||||
extraction are now well behaved. Costs 7.6k with all optional
|
||||
tar features enabled, and 5k for just tar extraction support.
|
||||
* Added freeramdisk, which will free up all memory associated
|
||||
with a ram disk. Contributed by Emanuele Caratti <wiz@iol.it>
|
||||
and then adjusted a bit by me.
|
||||
* Added tr and dirname from John Lombardo <john@deltanet.com>
|
||||
* tar wouldn't create directory entries that don't end in '/',
|
||||
now it does (thanks to Avery Pennarun <apenwarr@worldvisions.ca>)
|
||||
* Several fixes from Pavel Roskin <pavel_roskin@geocities.com>:
|
||||
- When `tail' fails to open a file it now exits.
|
||||
* Added tr from John Lombardo <john@deltanet.com>
|
||||
* Added echo and test (from me).
|
||||
* Added usleep contributed by Nicolas Pitre <nico@cam.org>
|
||||
* BusyBox's bss size has been majorly reduced (was 384668, is now 28740).
|
||||
* Several fixes from Pavel Roskin <proski@gnu.org>:
|
||||
- When `tail' fails to open a file it now exits.
|
||||
- When `syslogd' is given the `-n' option it should still use
|
||||
fork() for running klogd.
|
||||
* nslookup types are now changed to u_int32_t (instead of uint32_t)
|
||||
@@ -37,7 +578,8 @@
|
||||
the same, and prints an error (instead of endlessly looping).
|
||||
- mv now attempts to do a rename, and will fall back to doing
|
||||
a copy only if the rename fails.
|
||||
* Several fixes from Pavel Roskin <pavel_roskin@geocities.com>:
|
||||
- Syslogd now supports multiple concurrent connections
|
||||
* Several fixes from Pavel Roskin <proski@gnu.org>:
|
||||
- Fixes to sort. Removed "-g", fixed and added "-r"
|
||||
- Fixes to the makefile for handling "strip"
|
||||
* An initial telnet implementation was added by
|
||||
@@ -45,6 +587,18 @@
|
||||
* 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
|
||||
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).
|
||||
* Fixed mount'ing loop devices when the filesystem type was not
|
||||
specified. It used to revert to non-loop after the first try.
|
||||
* all mallocs now use xmalloc (and so are OOM error safe), and
|
||||
the common error handling saves a few bytes. Thanks to
|
||||
Bob Tinsley <bob@earthrise.demon.co.uk> for the patch.
|
||||
* Fix "+" parsing bug in date, from "Merle F. McClelland" <mfm@cts.com>.
|
||||
* Fix symlink following bug in chmod -R and friends.
|
||||
* Now allows SYSV style 'chown foo:bar' in addition to 'chown foo.bar'
|
||||
* Fixed a bug in the busybox globbing routine such that 'find /dir -name [i]'
|
||||
no longer segfaults.
|
||||
|
||||
|
||||
-Erik Andersen
|
||||
@@ -135,7 +689,7 @@
|
||||
Randolph Chung <tausq@debian.org>.
|
||||
* cp could, when copying symlinks, change permissions of the
|
||||
files pointed to by the symlinks.
|
||||
* Several fixes from Pavel Roskin <pavel_roskin@geocities.com>:
|
||||
* Several fixes from Pavel Roskin <proski@gnu.org>:
|
||||
- `chown' with 1 argument displayed the error incorrectly
|
||||
- `fdflush', `length' and `printf' crashed if run without arguments
|
||||
- `fdflush' tried to flush itself using *argv
|
||||
@@ -201,7 +755,7 @@
|
||||
* Major init re-work. init now supports inittab (slightly different
|
||||
but similar to sysvinit), allowing me to get all the policy out of
|
||||
init and into the conf file. It works just fine without inittab
|
||||
being present, but if you dont like the defautl behavior you can
|
||||
being present, but if you dont like the default behavior you can
|
||||
now do something about it. Init is much cleaner as a result.
|
||||
* Fixed an bug in syslogd causing it to stop after 20 minutes. -erik
|
||||
* Fixed an embarrasing segfault in head -beppu Fixed the embarrasing
|
||||
@@ -496,11 +1050,11 @@
|
||||
* from Matthew Grant <grantma@anathoth.gen.nz>
|
||||
to accomodate glibc timezone support. I then ripped out GNU
|
||||
getopt.
|
||||
* mkswap -- new version merged from util-linux. Can now make
|
||||
* >128Meg swaps. Replaced the old and star, unstar, and tarcat
|
||||
* with the tar
|
||||
implementation from sash. Now tar behaves as god intended it
|
||||
to (i.e. tar -xvf <file> and tar -cf <file> <dir> work).
|
||||
* mkswap -- new version merged from util-linux. Can now make
|
||||
>128Meg swaps.
|
||||
* Replaced the old and star, unstar, and tarcat with the tar
|
||||
implementation from sash. Now tar behaves as god intended it
|
||||
to (i.e. tar -xvf <file> and tar -cf <file> <dir> work).
|
||||
* dd -- rewritten. Can with with files, stdin, stdout. Added the
|
||||
* following new apps: loadfont -- added from debian boot floppies
|
||||
* chroot -- added based on a patch from Paolo Molaro
|
||||
|
||||
@@ -0,0 +1,484 @@
|
||||
/* 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_ADJTIMEX
|
||||
//#define BB_AR
|
||||
#define BB_BASENAME
|
||||
#define BB_CAT
|
||||
#define BB_CHGRP
|
||||
#define BB_CHMOD
|
||||
#define BB_CHOWN
|
||||
#define BB_CHROOT
|
||||
#define BB_CHVT
|
||||
#define BB_CLEAR
|
||||
//#define BB_CMP
|
||||
#define BB_CP
|
||||
//#define BB_CPIO
|
||||
#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
|
||||
//#define BB_DPKG_DEB
|
||||
//#define BB_DUTMP
|
||||
#define BB_DU
|
||||
//#define BB_DUMPKMAP
|
||||
#define BB_ECHO
|
||||
#define BB_ENV
|
||||
//#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_IFCONFIG
|
||||
#define BB_INIT
|
||||
//#define BB_INSMOD
|
||||
#define BB_KILL
|
||||
#define BB_KILLALL
|
||||
#define BB_KLOGD
|
||||
//#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_MV
|
||||
//#define BB_NSLOOKUP
|
||||
//#define BB_PING
|
||||
//#define BB_PIVOT_ROOT
|
||||
#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_ROUTE
|
||||
//#define BB_RPM2CPIO
|
||||
#define BB_SED
|
||||
//#define BB_SETKEYCODES
|
||||
#define BB_SH
|
||||
#define BB_SLEEP
|
||||
#define BB_SORT
|
||||
//#define BB_STTY
|
||||
#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_TFTP
|
||||
#define BB_TOUCH
|
||||
//#define BB_TR
|
||||
#define BB_TRUE_FALSE
|
||||
#define BB_TTY
|
||||
//#define BB_UNIX2DOS
|
||||
//#define BB_UUENCODE
|
||||
//#define BB_UUDECODE
|
||||
#define BB_UMOUNT
|
||||
#define BB_UNIQ
|
||||
#define BB_UNAME
|
||||
//#define BB_UPDATE
|
||||
#define BB_UPTIME
|
||||
//#define BB_USLEEP
|
||||
//#define BB_VI
|
||||
//#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).
|
||||
//
|
||||
//
|
||||
// If you enabled BB_SH above, you may select one of the following shells.
|
||||
// You can only select ONE of the following shells. Sorry.
|
||||
//
|
||||
// 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 very nice
|
||||
// lightweight command prompt.
|
||||
//#define BB_FEATURE_LASH
|
||||
//
|
||||
// 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.
|
||||
//#define BB_FEATURE_HUSH
|
||||
//
|
||||
// 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...
|
||||
#define BB_FEATURE_MSH
|
||||
//
|
||||
// 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. The
|
||||
// Posix math support is currently disabled (that bit of code was horrible) but
|
||||
// will be restored for the next BusyBox release.
|
||||
//#define BB_FEATURE_ASH
|
||||
//
|
||||
// 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
|
||||
// The third alternative for buffer allocation is to use BSS. This works
|
||||
// beautifully for computers with a real MMU (and OS support), but wastes
|
||||
// runtime RAM for uCLinux. This behavior was the only one available for
|
||||
// BusyBox versions 0.48 and earlier.
|
||||
//#define BB_FEATURE_BUFFERS_GO_IN_BSS
|
||||
//
|
||||
// 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. 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
|
||||
//
|
||||
// show verbose usage messages
|
||||
//#define BB_FEATURE_VERBOSE_USAGE
|
||||
//
|
||||
// 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 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
|
||||
//
|
||||
// Disable for a smaller (but less functional) ping
|
||||
#define BB_FEATURE_FANCY_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
|
||||
//
|
||||
//Make sure nothing is printed to the console on boot
|
||||
//#define BB_FEATURE_EXTRA_QUIET
|
||||
//
|
||||
// enable syslogd -R remotehost
|
||||
#define BB_FEATURE_REMOTE_LOG
|
||||
//
|
||||
// enable syslogd -C
|
||||
//#define BB_FEATURE_IPC_SYSLOG
|
||||
//
|
||||
//Disable for a 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_FANCY_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_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 uniqe sort
|
||||
#define BB_FEATURE_SORT_UNIQUE
|
||||
//
|
||||
// Enable command line editing in the shell.
|
||||
// Only relevant if BB_SH is enabled. On by default.
|
||||
#define BB_FEATURE_COMMAND_EDITING
|
||||
//
|
||||
// Enable tab completion in the shell. This is now working quite nicely.
|
||||
// This feature adds a bit over 4k. Only relevant if BB_SH is enabled.
|
||||
#define BB_FEATURE_COMMAND_TAB_COMPLETION
|
||||
//
|
||||
// Attempts to match usernames in a ~-prefixed path
|
||||
//#define BB_FEATURE_COMMAND_USERNAME_COMPLETION
|
||||
//
|
||||
//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. Off by default.
|
||||
// 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. Off by default.
|
||||
//#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
//
|
||||
// Uncomment this option for a fancy shell prompt that includes the
|
||||
// current username and hostname. On systems that don't have usernames
|
||||
// or hostnames, this can look hideous.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
//#define BB_FEATURE_SH_FANCY_PROMPT
|
||||
//
|
||||
//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 uClinux memory usage optimization, which will load the image
|
||||
// directly into the kernel memory. This divides memory requrements by three.
|
||||
// If you are not running uClinux (i.e., your CPU has an MMU) leave this
|
||||
// disabled...
|
||||
//#define BB_FEATURE_INSMOD_LOADINKMEM
|
||||
//
|
||||
// Support for Minix filesystem, version 2
|
||||
//#define BB_FEATURE_MINIX2
|
||||
//
|
||||
// Enable ifconfig status reporting output -- this feature adds 12k.
|
||||
//#define BB_FEATURE_IFCONFIG_STATUS
|
||||
//
|
||||
// Enable ifconfig slip-specific options "keepalive" and "outfill"
|
||||
//#define BB_FEATURE_IFCONFIG_SLIP
|
||||
//
|
||||
// Enable ifconfig options "mem_start", "io_addr", and "irq".
|
||||
//#define BB_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
|
||||
//
|
||||
// Enable ifconfig option "hw". Currently works for only with "ether".
|
||||
//#define BB_FEATURE_IFCONFIG_HW
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Enable HTTP authentication in wget
|
||||
#define BB_FEATURE_WGET_AUTHENTICATION
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Support for the find -type option.
|
||||
#define BB_FEATURE_FIND_TYPE
|
||||
//
|
||||
// Support for the find -perm option.
|
||||
#define BB_FEATURE_FIND_PERM
|
||||
//
|
||||
// Support for the find -mtine option.
|
||||
#define BB_FEATURE_FIND_MTIME
|
||||
//
|
||||
// Support for the -A -B and -C context flags in grep
|
||||
//#define BB_FEATURE_GREP_CONTEXT
|
||||
//
|
||||
// Support for the EGREP applet (alias to the grep applet)
|
||||
//#define BB_FEATURE_GREP_EGREP_ALIAS
|
||||
//
|
||||
// Tell tftp what commands that should be supported.
|
||||
#define BB_FEATURE_TFTP_PUT
|
||||
#define BB_FEATURE_TFTP_GET
|
||||
//
|
||||
// features for vi
|
||||
#define BB_FEATURE_VI_COLON // ":" colon commands, no "ex" mode
|
||||
#define BB_FEATURE_VI_YANKMARK // Yank/Put commands and Mark cmds
|
||||
#define BB_FEATURE_VI_SEARCH // search and replace cmds
|
||||
#define BB_FEATURE_VI_USE_SIGNALS // catch signals
|
||||
#define BB_FEATURE_VI_DOT_CMD // remember previous cmd and "." cmd
|
||||
#define BB_FEATURE_VI_READONLY // vi -R and "view" mode
|
||||
#define BB_FEATURE_VI_SETOPTS // set-able options, ai ic showmatch
|
||||
#define BB_FEATURE_VI_SET // :set
|
||||
#define BB_FEATURE_VI_WIN_RESIZE // handle window resize
|
||||
//
|
||||
// Enable a if you system have setuped locale
|
||||
//#define BB_LOCALE_SUPPORT
|
||||
//
|
||||
// Support for TELNET to pass TERM type to remote host. Adds 384 bytes.
|
||||
#define BB_FEATURE_TELNET_TTYPE
|
||||
//
|
||||
// End of Features List
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------
|
||||
// Nothing beyond this point should ever be touched by
|
||||
// mere mortals so leave this stuff alone.
|
||||
//
|
||||
#if defined BB_SH
|
||||
#if defined BB_FEATURE_COMMAND_EDITING
|
||||
#define BB_CMDEDIT
|
||||
#else
|
||||
#undef BB_FEATURE_COMMAND_EDITING
|
||||
#undef BB_FEATURE_COMMAND_TAB_COMPLETION
|
||||
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
|
||||
#undef BB_FEATURE_SH_FANCY_PROMPT
|
||||
#endif
|
||||
#if ! defined BB_FEATURE_LASH && ! defined BB_FEATURE_HUSH && ! defined BB_FEATURE_MSH && ! defined BB_FEATURE_ASH
|
||||
#define BB_FEATURE_MSH
|
||||
#endif
|
||||
#if defined BB_FEATURE_ASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_MSH
|
||||
#elif defined BB_FEATURE_MSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#elif defined BB_FEATURE_HUSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_MSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#elif defined BB_FEATURE_LASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_MSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#endif
|
||||
#else
|
||||
#undef BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
#undef BB_FEATURE_SH_STANDALONE_SHELL
|
||||
#undef BB_FEATURE_SH_FANCY_PROMPT
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_KILLALL
|
||||
#ifndef BB_KILL
|
||||
#define BB_KILL
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#ifndef BB_INIT
|
||||
#undef BB_FEATURE_LINUXRC
|
||||
#endif
|
||||
//
|
||||
#if defined BB_MOUNT && defined BB_FEATURE_NFSMOUNT
|
||||
#define BB_NFSMOUNT
|
||||
#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
|
||||
#if ! defined BB_FEATURE_NEW_MODULE_INTERFACE && ! defined BB_FEATURE_OLD_MODULE_INTERFACE
|
||||
#define BB_FEATURE_NEW_MODULE_INTERFACE
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_SYSLOGD
|
||||
#if defined BB_FEATURE_IPC_SYSLOG
|
||||
#define BB_LOGREAD
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
1) Check Config.h and adjust if you need a different functionality than
|
||||
defined by default.
|
||||
|
||||
2) Check the Makefile
|
||||
|
||||
3) make
|
||||
|
||||
4) make install
|
||||
@@ -18,7 +18,7 @@ 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 by Lineo, inc. and written by
|
||||
Copyright (C) 1999,2000,2001 by Lineo, inc. and written by
|
||||
Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# Copyright (C) 1999-2000 Erik Andersen <andersee@debian.org>
|
||||
# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org>
|
||||
# Copyright (C) 1999,2000,2001 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
|
||||
@@ -19,117 +18,404 @@
|
||||
#
|
||||
|
||||
PROG := busybox
|
||||
VERSION := 0.43
|
||||
BUILDTIME := $(shell TZ=GMT date "+%Y%m%d-%H%M")
|
||||
VERSION := 0.52
|
||||
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
|
||||
export VERSION
|
||||
|
||||
# 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 =
|
||||
|
||||
# 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'
|
||||
DODEBUG = false
|
||||
|
||||
# If you want a static binary, turn this on. I can't think
|
||||
# of many situations where anybody would ever want it static,
|
||||
# but...
|
||||
DOSTATIC = 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).
|
||||
# Note that if you want hostname resolution to work with glibc, you still need
|
||||
# the libnss_* libraries. Most people will want to leave this set to false.
|
||||
USE_SYSTEM_PWD_GRP = true
|
||||
|
||||
# This will choke on a non-debian system
|
||||
ARCH =`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
|
||||
# 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
|
||||
|
||||
CC = gcc
|
||||
# Electric-fence is another very useful malloc debugging library.
|
||||
# Do not enable this for production builds...
|
||||
DOEFENCE = false
|
||||
|
||||
GCCMAJVERSION = $(shell $(CC) --version | sed -n "s/^[^0-9]*\([0-9]\)\.\([0-9].*\)[\.].*/\1/p")
|
||||
GCCMINVERSION = $(shell $(CC) --version | sed -n "s/^[^0-9]*\([0-9]\)\.\([0-9].*\)[\.].*/\2/p")
|
||||
# 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 =
|
||||
|
||||
GCCSUPPORTSOPTSIZE = $(shell \
|
||||
if ( test $(GCCMAJVERSION) -eq 2 ) ; then \
|
||||
if ( test $(GCCMINVERSION) -ge 66 ) ; then \
|
||||
echo "true"; \
|
||||
else \
|
||||
echo "false"; \
|
||||
fi; \
|
||||
else \
|
||||
if ( test $(GCCMAJVERSION) -gt 2 ) ; then \
|
||||
echo "true"; \
|
||||
else \
|
||||
echo "false"; \
|
||||
fi; \
|
||||
fi; )
|
||||
# If you are running a cross compiler, you may want to set this
|
||||
# to something more interesting, like "powerpc-linux-".
|
||||
CROSS =
|
||||
CC = $(CROSS)gcc
|
||||
AR = $(CROSS)ar
|
||||
STRIPTOOL = $(CROSS)strip
|
||||
|
||||
# To compile vs uClibc, just use the compiler wrapper built by uClibc...
|
||||
# This make things very easy? Everything should compile and work as
|
||||
# expected these days...
|
||||
#CC = ../uClibc/extra/gcc-uClibc/i386-uclibc-gcc
|
||||
|
||||
ifeq ($(GCCSUPPORTSOPTSIZE), true)
|
||||
OPTIMIZATION = -Os
|
||||
else
|
||||
OPTIMIZATION = -O2
|
||||
# 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")
|
||||
|
||||
# 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 -Wshadow
|
||||
|
||||
ARFLAGS = -r
|
||||
|
||||
#
|
||||
#--------------------------------------------------------
|
||||
# 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_FILE_OFFSET_BITS=64
|
||||
endif
|
||||
|
||||
# Allow alternative stripping tools to be used...
|
||||
ifndef $(STRIPTOOL)
|
||||
STRIPTOOL = strip
|
||||
endif
|
||||
|
||||
|
||||
# -D_GNU_SOURCE is needed because environ is used in init.c
|
||||
ifeq ($(DODEBUG),true)
|
||||
CFLAGS += -Wall -g -D_GNU_SOURCE
|
||||
LDFLAGS =
|
||||
STRIP =
|
||||
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
|
||||
CFLAGS += -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
|
||||
LDFLAGS = -s
|
||||
STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
|
||||
#Only staticly link when _not_ debugging
|
||||
ifeq ($(DOSTATIC),true)
|
||||
LDFLAGS += --static
|
||||
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
|
||||
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 ($(strip $(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
|
||||
|
||||
LIBRARIES =
|
||||
OBJECTS = $(shell ./busybox.sh) busybox.o messages.o utility.o
|
||||
# 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
|
||||
#ifneq ($(strip $(VPATH)),)
|
||||
# CFLAGS += -I- -I. $(patsubst %,-I%,$(subst :, ,$(VPATH)))
|
||||
#endif
|
||||
|
||||
# We need to set APPLET_SOURCES to something like
|
||||
# $(shell busybox.sh Config.h)
|
||||
# but in a manner that works with VPATH and BB_SRC_DIR.
|
||||
# Possible ways to approach this:
|
||||
#
|
||||
# 1. Explicitly search through .:$(VPATH) for busybox.sh and config.h,
|
||||
# then $(shell $(BUSYBOX_SH) $(CONFIG_H) $(BB_SRC_DIR))
|
||||
#
|
||||
# 2. Explicity search through .:$(VPATH) for slist.mk,
|
||||
# then $(shell $(MAKE) -f $(SLIST_MK) VPATH=$(VPATH) BB_SRC_DIR=$(BB_SRC_DIR))
|
||||
#
|
||||
# 3. Create slist.mk in this directory, with commands embedded in
|
||||
# a $(shell ...) command, and $(MAKE) it immediately.
|
||||
#
|
||||
# 4. Use a real rule within this makefile to create a file that sets
|
||||
# APPLET_SOURCE_LIST, then include that file. Has complications
|
||||
# with the first trip through the makefile (before processing the
|
||||
# include) trying to do too much, and a spurious warning the first
|
||||
# time make is run.
|
||||
#
|
||||
# This is option 3:
|
||||
#
|
||||
#APPLET_SOURCES = $(shell \
|
||||
# echo -e 'all: busybox.sh Config.h\n\t@ $$(SHELL) $$^ $$(BB_SRC_DIR)' >slist.mk; \
|
||||
# make -f slist.mk VPATH=$(VPATH) BB_SRC_DIR=$(BB_SRC_DIR) \
|
||||
#)
|
||||
# And option 4:
|
||||
-include applet_source_list
|
||||
|
||||
OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
|
||||
CFLAGS += $(CROSS_CFLAGS)
|
||||
CFLAGS += -DBB_VER='"$(VERSION)"'
|
||||
CFLAGS += -DBB_BT='"$(BUILDTIME)"'
|
||||
ifdef BB_INIT_SCRIPT
|
||||
CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
|
||||
endif
|
||||
|
||||
all: busybox busybox.links
|
||||
.PHONY: all
|
||||
ifneq ($(strip $(USE_SYSTEM_PWD_GRP)),true)
|
||||
PWD_GRP = pwd_grp
|
||||
PWD_GRP_DIR = $(BB_SRC_DIR:=/)$(PWD_GRP)
|
||||
PWD_LIB = libpwd.a
|
||||
PWD_CSRC=__getpwent.c pwent.c getpwnam.c getpwuid.c putpwent.c getpw.c \
|
||||
fgetpwent.c __getgrent.c grent.c getgrnam.c getgrgid.c fgetgrent.c \
|
||||
initgroups.c setgroups.c
|
||||
PWD_OBJS=$(patsubst %.c,$(PWD_GRP)/%.o, $(PWD_CSRC))
|
||||
PWD_CFLAGS = -I$(PWD_GRP_DIR)
|
||||
else
|
||||
CFLAGS += -DUSE_SYSTEM_PWD_GRP
|
||||
endif
|
||||
|
||||
LIBBB = libbb
|
||||
LIBBB_LIB = libbb.a
|
||||
LIBBB_CSRC= ask_confirmation.c chomp.c concat_path_file.c copy_file.c \
|
||||
copy_file_chunk.c daemon.c device_open.c error_msg.c \
|
||||
error_msg_and_die.c fgets_str.c find_mount_point.c find_pid_by_name.c \
|
||||
find_root_device.c full_read.c full_write.c get_console.c \
|
||||
get_last_path_component.c get_line_from_file.c gz_open.c human_readable.c \
|
||||
isdirectory.c kernel_version.c loop.c mode_string.c module_syscalls.c mtab.c \
|
||||
mtab_file.c my_getgrnam.c my_getgrgid.c my_getpwnam.c my_getpwnamegid.c \
|
||||
my_getpwuid.c parse_mode.c parse_number.c perror_msg.c perror_msg_and_die.c \
|
||||
print_file.c process_escape_sequence.c read_package_field.c recursive_action.c \
|
||||
safe_read.c safe_strncpy.c syscalls.c syslog_msg_with_name.c time_string.c \
|
||||
trim.c unzip.c vdprintf.c verror_msg.c vperror_msg.c wfopen.c xfuncs.c \
|
||||
xgetcwd.c xreadlink.c xregcomp.c interface.c remove_file.c last_char_is.c \
|
||||
copyfd.c vherror_msg.c herror_msg.c herror_msg_and_die.c xgethostbyname.c \
|
||||
dirname.c make_directory.c
|
||||
LIBBB_OBJS=$(patsubst %.c,$(LIBBB)/%.o, $(LIBBB_CSRC))
|
||||
LIBBB_CFLAGS = -I$(LIBBB)
|
||||
ifneq ($(strip $(BB_SRC_DIR)),)
|
||||
LIBBB_CFLAGS += -I$(BB_SRC_DIR)/$(LIBBB)
|
||||
endif
|
||||
|
||||
busybox: $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES)
|
||||
LIBBB_MSRC=libbb/messages.c
|
||||
LIBBB_MESSAGES= full_version name_too_long omitting_directory not_a_directory \
|
||||
memory_exhausted invalid_date invalid_option io_error dash_dash_help \
|
||||
write_error too_few_args name_longer_than_foo unknown
|
||||
LIBBB_MOBJ=$(patsubst %,$(LIBBB)/%.o, $(LIBBB_MESSAGES))
|
||||
|
||||
LIBBB_ARCSRC=libbb/unarchive.c
|
||||
LIBBB_ARCOBJ= archive_offset seek_sub_file extract_archive unarchive \
|
||||
get_header_ar get_header_cpio get_header_tar deb_extract
|
||||
LIBBB_AROBJS=$(patsubst %,$(LIBBB)/%.o, $(LIBBB_ARCOBJ))
|
||||
|
||||
|
||||
# Put user-supplied flags at the end, where they
|
||||
# have a chance of winning.
|
||||
CFLAGS += $(CFLAGS_EXTRA)
|
||||
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
all: applet_source_list busybox busybox.links doc
|
||||
|
||||
applet_source_list: busybox.sh Config.h
|
||||
(echo -n "APPLET_SOURCES := "; BB_SRC_DIR=$(BB_SRC_DIR) $(SHELL) $^) > $@
|
||||
|
||||
doc: olddoc
|
||||
|
||||
# Old Docs...
|
||||
olddoc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
|
||||
|
||||
docs/busybox.pod : docs/busybox_header.pod usage.h docs/busybox_footer.pod
|
||||
- ( cat docs/busybox_header.pod; \
|
||||
docs/autodocifier.pl 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 $< > $@
|
||||
|
||||
docs/BusyBox.1: docs/busybox.pod
|
||||
- mkdir -p docs
|
||||
- pod2man --center=BusyBox --release="version $(VERSION)" \
|
||||
$< > $@
|
||||
|
||||
docs/BusyBox.html: docs/busybox.lineo.com/BusyBox.html
|
||||
- mkdir -p docs
|
||||
-@ rm -f docs/BusyBox.html
|
||||
-@ ln -s busybox.lineo.com/BusyBox.html docs/BusyBox.html
|
||||
|
||||
docs/busybox.lineo.com/BusyBox.html: docs/busybox.pod
|
||||
-@ mkdir -p docs/busybox.lineo.com
|
||||
- pod2html --noindex $< > \
|
||||
docs/busybox.lineo.com/BusyBox.html
|
||||
-@ rm -f pod2htm*
|
||||
|
||||
|
||||
# New docs based on DOCBOOK SGML
|
||||
newdoc: docs/busybox.txt docs/busybox.pdf docs/busybox/busyboxdocumentation.html
|
||||
|
||||
docs/busybox.txt: docs/busybox.sgml
|
||||
@echo
|
||||
@echo BusyBox Documentation
|
||||
@echo
|
||||
- mkdir -p docs
|
||||
(cd docs; sgmltools -b txt busybox.sgml)
|
||||
|
||||
docs/busybox.dvi: docs/busybox.sgml
|
||||
- mkdir -p docs
|
||||
(cd docs; sgmltools -b dvi busybox.sgml)
|
||||
|
||||
docs/busybox.ps: docs/busybox.sgml
|
||||
- mkdir -p docs
|
||||
(cd docs; sgmltools -b ps busybox.sgml)
|
||||
|
||||
docs/busybox.pdf: docs/busybox.ps
|
||||
- mkdir -p docs
|
||||
(cd docs; ps2pdf busybox.ps)
|
||||
|
||||
docs/busybox/busyboxdocumentation.html: docs/busybox.sgml
|
||||
- mkdir -p docs
|
||||
(cd docs/busybox.lineo.com; sgmltools -b html ../busybox.sgml)
|
||||
|
||||
|
||||
busybox: $(PWD_LIB) $(LIBBB_LIB) $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBBB_LIB) $(PWD_LIB) $(LIBRARIES)
|
||||
$(STRIP)
|
||||
|
||||
busybox.links: busybox.def.h
|
||||
- ./busybox.mkll | sort >$@
|
||||
# Without VPATH, rule expands to "/bin/sh busybox.mkll Config.h applets.h"
|
||||
# but with VPATH, some or all of those file names are resolved to the
|
||||
# directories in which they live.
|
||||
busybox.links: busybox.mkll Config.h applets.h
|
||||
- $(SHELL) $^ >$@
|
||||
|
||||
regexp.o nfsmount.o: %.o: %.h
|
||||
$(OBJECTS): %.o: busybox.def.h internal.h %.c
|
||||
nfsmount.o cmdedit.o: %.o: %.h
|
||||
sh.o: cmdedit.h
|
||||
$(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile
|
||||
$(CC) -I- $(CFLAGS) -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o
|
||||
|
||||
$(PWD_OBJS): %.o: %.c Config.h busybox.h applets.h Makefile
|
||||
- mkdir -p $(PWD_GRP)
|
||||
$(CC) $(CFLAGS) $(PWD_CFLAGS) -c $< -o $*.o
|
||||
|
||||
$(LIBBB_OBJS): %.o: %.c Config.h busybox.h applets.h Makefile libbb/libbb.h
|
||||
- mkdir -p $(LIBBB)
|
||||
$(CC) $(CFLAGS) $(LIBBB_CFLAGS) -c $< -o $*.o
|
||||
|
||||
$(LIBBB_MOBJ): $(LIBBB_MSRC)
|
||||
- mkdir -p $(LIBBB)
|
||||
$(CC) $(CFLAGS) $(LIBBB_CFLAGS) -DL_$(patsubst libbb/%,%,$*) -c $< -o $*.o
|
||||
|
||||
$(LIBBB_AROBJS): $(LIBBB_ARCSRC)
|
||||
- mkdir -p $(LIBBB)
|
||||
$(CC) $(CFLAGS) $(LIBBB_CFLAGS) -DL_$(patsubst libbb/%,%,$*) -c $< -o $*.o
|
||||
|
||||
libpwd.a: $(PWD_OBJS)
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
|
||||
libbb.a: $(LIBBB_MOBJ) $(LIBBB_AROBJS) $(LIBBB_OBJS)
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
|
||||
usage.o: usage.h
|
||||
|
||||
sh.o: sh.c lash.c hush.c msh.c ash.c
|
||||
|
||||
libbb/loop.o: libbb/loop.h
|
||||
|
||||
libbb/loop.h: mk_loop_h.sh
|
||||
@ $(SHELL) $< > $@
|
||||
|
||||
.PHONY: test tests
|
||||
test tests:
|
||||
cd tests && $(MAKE) all
|
||||
# old way of doing it
|
||||
#cd tests && $(MAKE) all
|
||||
# new way of doing it
|
||||
cd tests && ./tester.sh
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
- rm -f busybox.links *~ *.o core
|
||||
- rm -rf _install
|
||||
- cd tests && $(MAKE) clean
|
||||
- rm -f docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
|
||||
docs/busybox.lineo.com/BusyBox.html
|
||||
- rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
|
||||
docs/busybox.pdf docs/busybox.lineo.com/busybox.html
|
||||
- rm -f multibuild.log Config.h.orig
|
||||
- rm -rf docs/busybox _install libpwd.a libbb.a pod2htm*
|
||||
- rm -f busybox.links libbb/loop.h *~ slist.mk core applet_source_list
|
||||
- find -name \*.o -exec rm -f {} \;
|
||||
|
||||
.PHONY: distclean
|
||||
distclean: clean
|
||||
- rm -f busybox
|
||||
- rm -f busybox applet_source_list
|
||||
- cd tests && $(MAKE) distclean
|
||||
|
||||
.PHONY: install
|
||||
install: busybox busybox.links
|
||||
./install.sh $(PREFIX)
|
||||
install: install.sh busybox busybox.links
|
||||
$(SHELL) $< $(PREFIX)
|
||||
|
||||
.PHONY: dist release
|
||||
dist release: distclean
|
||||
install-hardlinks: install.sh busybox busybox.links
|
||||
$(SHELL) $< $(PREFIX) --hardlinks
|
||||
|
||||
debug_pristine:
|
||||
@ echo VPATH=\"$(VPATH)\"
|
||||
@ echo OBJECTS=\"$(OBJECTS)\"
|
||||
|
||||
dist release: distclean doc
|
||||
cd ..; \
|
||||
rm -rf busybox-$(VERSION); \
|
||||
cp -a busybox busybox-$(VERSION); \
|
||||
@@ -137,11 +423,15 @@ dist release: distclean
|
||||
find busybox-$(VERSION)/ -type d \
|
||||
-name CVS \
|
||||
-print \
|
||||
| xargs rm -rf; \
|
||||
-exec rm -rf {} \; ; \
|
||||
\
|
||||
find busybox-$(VERSION)/ -type f \
|
||||
-name .cvsignore \
|
||||
-name .\#* \
|
||||
-print \
|
||||
| xargs rm -f; \
|
||||
-exec rm -f {} \; ; \
|
||||
\
|
||||
tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION)/;
|
||||
|
||||
.PHONY: tags
|
||||
tags:
|
||||
ctags -R .
|
||||
@@ -1,30 +1,123 @@
|
||||
Please see the LICENSE file for copyright information.
|
||||
|
||||
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
|
||||
embedded system. The utilities in BusyBox generally have fewer options than
|
||||
their full featured GNU cousins; however, the options that are included provide
|
||||
the expected functionality and behave very much like their GNU counterparts.
|
||||
|
||||
BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It
|
||||
provides a pretty complete POSIX environment in a very small package.
|
||||
Just add a kernel, "ash" (Keith Almquists tiny Bourne shell clone), and
|
||||
an editor such as "elvis-tiny" or "ae", and you have a working system.
|
||||
Busybox was begun to support the Debian Rescue/Install disks, but it
|
||||
also makes an excellent environment for any small or embedded system.
|
||||
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 shell, and a kernel. For
|
||||
a really minimal system, you can even use the busybox shell (not Bourne
|
||||
compatible, but very small and quite usable) and the busybox vi editor.
|
||||
|
||||
As of version 0.20 there is a version number. : ) Also as of version
|
||||
0.20, BB is now modularized to easily allow you to build of only the
|
||||
BB parts you need, thereby reducing binary size. To turn off unwanted
|
||||
Busybox components, simply edit the file busybox.def.h and comment out
|
||||
the parts you do not need using C++ style (//) comments.
|
||||
BusyBox was originally written to support the Debian Rescue/Install disks, but
|
||||
it also makes an excellent environment for any small or embedded system.
|
||||
|
||||
After the build is complete a busybox.links file is generated which is
|
||||
then used by 'make install' to create symlinks to the busybox binary
|
||||
for all compiled in functions. By default, 'make install' will place
|
||||
the symlink forest into `pwd`/_install unless you have defined the
|
||||
PREFIX environment variable.
|
||||
As of version 0.20 there is now a version number. : ) Also as of version 0.20,
|
||||
BusyBox is now modularized to easily allow you to build only the components you
|
||||
need, thereby reducing binary size. To turn off unwanted BusyBox components,
|
||||
simply edit the file "Config.h" and comment out the components you do not need
|
||||
using C++ style (//) comments.
|
||||
|
||||
After the build is complete, a busybox.links file is generated. This is
|
||||
used by 'make install' to create symlinks to the busybox binary for all
|
||||
compiled in functions. By default, 'make install' will place the symlink
|
||||
forest into `pwd`/_install unless you have defined the PREFIX environment
|
||||
variable (i.e., 'make PREFIX=/tmp/foo install')
|
||||
|
||||
----------------
|
||||
|
||||
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, SH3/4, powerpc, and MIPS.
|
||||
|
||||
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.
|
||||
|
||||
Supported kernels:
|
||||
|
||||
Full functionality requires Linux 2.0.x, 2.2.x, or 2.4.x. A large fraction
|
||||
of the code should run on just about anything.
|
||||
|
||||
----------------
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
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.lineo.com
|
||||
From: diligent@testing.linux.org
|
||||
Subject: /bin/true doesn't work
|
||||
|
||||
Package: busybox
|
||||
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:
|
||||
$ /bin/true ; echo $?
|
||||
1
|
||||
With GNU /bin/true, I get the following output:
|
||||
$ /bin/true ; echo $?
|
||||
0
|
||||
I am using Debian 2.2r2, kernel version 2.2.18, and the latest
|
||||
uClibc from CVS. Thanks for the wonderful program!
|
||||
-Diligent
|
||||
|
||||
Note the careful description and use of examples showing not only what BusyBox
|
||||
does, but also a counter example showing what an equivalent GNU app does. Bug
|
||||
reports lacking such detail may take a _long_ time to be fixed... Thanks for
|
||||
understanding.
|
||||
|
||||
----------------
|
||||
|
||||
FTP:
|
||||
|
||||
Source for the latest released version can always be downloaded from
|
||||
ftp://ftp.lineo.com/pub/busybox.
|
||||
|
||||
----------------
|
||||
|
||||
CVS:
|
||||
|
||||
BusyBox now has its own publicly browsable CVS tree at:
|
||||
http://opensource.lineo.com/cgi-bin/cvsweb/busybox/
|
||||
|
||||
Anonymous CVS access is available. For instructions, check out:
|
||||
http://opensource.lineo.com/cvs_anon.html
|
||||
|
||||
For those that are actively contributing there is even CVS write access:
|
||||
http://opensource.lineo.com/cvs_write.html
|
||||
|
||||
----------------
|
||||
|
||||
Please feed suggestions, bug reports, insults, and bribes back to:
|
||||
Erik Andersen
|
||||
<andersen@lineo.com>
|
||||
<andersee@debian.org>
|
||||
<andersee@codepoet.org>
|
||||
|
||||
<blatent plug>
|
||||
<blatant plug>
|
||||
Many thanks to go to Lineo for paying me to work on busybox.
|
||||
</blatent plug>
|
||||
</blatant plug>
|
||||
|
||||
@@ -4,127 +4,54 @@ 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 in libcrypt).
|
||||
needed or wanted in busybox (or else I'd have to link to libcrypt).
|
||||
|
||||
* Networking apps are probably going to be split out some time soon into a
|
||||
separate package (named perhaps tiny-netkit?). This currently includes
|
||||
hostid, hostname, mnc, and ping.
|
||||
* 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.
|
||||
|
||||
|
||||
-Erik
|
||||
|
||||
-----------
|
||||
|
||||
* Allow tar to create archives with sockets, devices, and other special files
|
||||
* Make insmod actually work
|
||||
* dnsdomainname
|
||||
* traceroute/netstat
|
||||
* rdate
|
||||
Possible apps to include some time:
|
||||
|
||||
* hwclock
|
||||
* killall
|
||||
* stty
|
||||
* tr
|
||||
* cut
|
||||
* expr (maybe?) (ash builtin?)
|
||||
* start-stop-daemon
|
||||
* 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.
|
||||
|
||||
-----------------------
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
-----------------------
|
||||
|
||||
Compile with debugging on, run 'nm --size-sort ./busybox'
|
||||
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
|
||||
|
||||
busybox.defs.h is too big and hard to follow.
|
||||
|
||||
I either need to add a better build system (like the Linux kernel?)
|
||||
or I need to split up busybox.defs.h into coherent chunks (i.e.
|
||||
busybox.defs.h just has a bunch of:
|
||||
|
||||
#include "fileutils.h"
|
||||
#include "shellutils.h"
|
||||
|
||||
which would then have smaller sets of #defines...
|
||||
Hmm. Needs to be carefully thought out.
|
||||
|
||||
-----------------------
|
||||
|
||||
|
||||
-rw-r--r-- 1000/1000 4398 2000-01-06 21:55 uniq.c
|
||||
-rw-r--r-- 1000/1000 1568 1999-10-20 18:08 update.c
|
||||
-rw-r----- 0/1000 1168 2000-01-29 21:03 update.o
|
||||
-rw-r--r-- 1000/1000 22820 2000-01-05 11:36 utility.c
|
||||
-rw-r----- 0/1000 7372 2000-01-29 21:03 utility.o
|
||||
tar: Skipping to next file header
|
||||
tar: Skipping to next file header
|
||||
tar: Archive - EOF not on block boundary
|
||||
tar: Error is not recoverable: exiting now
|
||||
|
||||
|
||||
#1 You are storing by id instead of name like normal tar. Did you realize this?
|
||||
(or am I missing some compile option? )ctar did not do this, and I don't think
|
||||
it's a good idea for LRP.
|
||||
|
||||
#2
|
||||
ctar did not produce the EOF error like your tar does. I believe you need to
|
||||
pad the end of the archive with at least 2 tarsized (512byte) blocks. (I
|
||||
think???)
|
||||
|
||||
#3
|
||||
There is no exclude file(s) option to tar. LRP's packaging system can not
|
||||
function without this. Will you have the time to add this soon?
|
||||
|
||||
|
||||
-----------------------
|
||||
|
||||
cd /mnt
|
||||
mkdir BACKUP
|
||||
mv * BACKUP
|
||||
|
||||
Today, "mv" behaved as a cp -a and my disk becomed full. It does not
|
||||
work properly either when renaming a directory into something else
|
||||
(it produces a lot of disk activity when doing this).
|
||||
|
||||
|
||||
-----------------------
|
||||
|
||||
|
||||
Feature request:
|
||||
|
||||
/bin/busybox --install -s which makes all links to commands that it
|
||||
can support (an optionnal -s should be used for symbolic links instead
|
||||
of hard links).
|
||||
|
||||
|
||||
-----------------------
|
||||
|
||||
|
||||
> Have you ever thought of doig network logging in busybox syslogd ? It
|
||||
> would quite make sense on embedded systems... :)
|
||||
|
||||
So far I had not considered it. Basically, you wish to have
|
||||
messages from the embedded box logged to a remote network
|
||||
syslog box, right? I can see that this would be useful.
|
||||
I'll add this to the TODO list,
|
||||
|
||||
|
||||
-----------------------
|
||||
|
||||
|
||||
In utility.c:copyFile: It uses followLinks for both source and
|
||||
destination files... is that right for `mv'? Will need to revisit
|
||||
the GNU, freeBSD, and MINIX versions for this... Should read the
|
||||
Unix98 and POSIX specs also.
|
||||
|
||||
-----------------------
|
||||
|
||||
I think that the add_inode &c in utility.c needs to also stow the
|
||||
st_dev field, and that du.c should NOT call `reset_inode_list'
|
||||
because there can be hard links from inside one argv/ to inside
|
||||
another argv/. du.c probably ought to have an -x switch like GNU du
|
||||
does also...
|
||||
|
||||
|
||||
------------------------------------------------------------------
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* adjtimex.c - read, and possibly modify, the Linux kernel `timex' variables.
|
||||
*
|
||||
* Originally written: October 1997
|
||||
* Last hack: March 2001
|
||||
* Copyright 1997, 2000, 2001 Larry Doolittle <LRDoolittle@lbl.gov>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License (Version 2,
|
||||
* June 1991) as published by the Free Software Foundation. At the
|
||||
* time of writing, that license was published by the FSF with the URL
|
||||
* http://www.gnu.org/copyleft/gpl.html, and is incorporated herein by
|
||||
* reference.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This adjtimex(1) is very similar in intent to adjtimex(8) by Steven
|
||||
* Dick <ssd@nevets.oau.org> and Jim Van Zandt <jrv@vanzandt.mv.com>
|
||||
* (see http://metalab.unc.edu/pub/Linux/system/admin/time/adjtimex*).
|
||||
* That version predates this one, and is _much_ bigger and more
|
||||
* featureful. My independently written version was very similar to
|
||||
* Steven's from the start, because they both follow the kernel timex
|
||||
* structure. I further tweaked this version to be equivalent to Steven's
|
||||
* where possible, but I don't like getopt_long, so the actual usage
|
||||
* syntax is incompatible.
|
||||
*
|
||||
* Amazingly enough, my Red Hat 5.2 sys/timex (and sub-includes)
|
||||
* don't actually give a prototype for adjtimex(2), so building
|
||||
* this code (with -Wall) gives a warning. Later versions of
|
||||
* glibc fix this issue.
|
||||
*
|
||||
* This program is too simple for a Makefile, just build with:
|
||||
* gcc -Wall -O adjtimex.c -o adjtimex
|
||||
*
|
||||
* busyboxed 20 March 2001, Larry Doolittle <ldoolitt@recycle.lbl.gov>
|
||||
* It will autosense if it is built in a busybox environment, based
|
||||
* on the BB_VER preprocessor macro.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if __GNU_LIBRARY__ < 5
|
||||
#include <sys/timex.h>
|
||||
extern int adjtimex(struct timex *buf);
|
||||
#else
|
||||
#include <sys/timex.h>
|
||||
#endif
|
||||
|
||||
#ifdef BB_VER
|
||||
#include "busybox.h"
|
||||
#endif
|
||||
|
||||
static struct {int bit; char *name;} statlist[] = {
|
||||
{ STA_PLL, "PLL" },
|
||||
{ STA_PPSFREQ, "PPSFREQ" },
|
||||
{ STA_PPSTIME, "PPSTIME" },
|
||||
{ STA_FLL, "FFL" },
|
||||
{ STA_INS, "INS" },
|
||||
{ STA_DEL, "DEL" },
|
||||
{ STA_UNSYNC, "UNSYNC" },
|
||||
{ STA_FREQHOLD, "FREQHOLD" },
|
||||
{ STA_PPSSIGNAL, "PPSSIGNAL" },
|
||||
{ STA_PPSJITTER, "PPSJITTER" },
|
||||
{ STA_PPSWANDER, "PPSWANDER" },
|
||||
{ STA_PPSERROR, "PPSERROR" },
|
||||
{ STA_CLOCKERR, "CLOCKERR" },
|
||||
{ 0, NULL } };
|
||||
|
||||
static char *ret_code_descript[] = {
|
||||
"clock synchronized",
|
||||
"insert leap second",
|
||||
"delete leap second",
|
||||
"leap second in progress",
|
||||
"leap second has occurred",
|
||||
"clock not synchronized" };
|
||||
|
||||
#ifdef BB_VER
|
||||
#define main adjtimex_main
|
||||
#else
|
||||
void usage(char *prog)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: %s [ -q ] [ -o offset ] [ -f frequency ] [ -p timeconstant ] [ -t tick ]\n",
|
||||
prog);
|
||||
}
|
||||
#define show_usage() usage(argv[0])
|
||||
#endif
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct timex txc;
|
||||
int quiet=0;
|
||||
int c, i, ret, sep;
|
||||
char *descript;
|
||||
txc.modes=0;
|
||||
for (;;) {
|
||||
c = getopt( argc, argv, "qo:f:p:t:");
|
||||
if (c == EOF) break;
|
||||
switch (c) {
|
||||
case 'q':
|
||||
quiet=1;
|
||||
break;
|
||||
case 'o':
|
||||
txc.offset = atoi(optarg);
|
||||
txc.modes |= ADJ_OFFSET_SINGLESHOT;
|
||||
break;
|
||||
case 'f':
|
||||
txc.freq = atoi(optarg);
|
||||
txc.modes |= ADJ_FREQUENCY;
|
||||
break;
|
||||
case 'p':
|
||||
txc.constant = atoi(optarg);
|
||||
txc.modes |= ADJ_TIMECONST;
|
||||
break;
|
||||
case 't':
|
||||
txc.tick = atoi(optarg);
|
||||
txc.modes |= ADJ_TICK;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (argc != optind) { /* no valid non-option parameters */
|
||||
show_usage();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = adjtimex(&txc);
|
||||
|
||||
if (ret < 0) perror("adjtimex");
|
||||
|
||||
if (!quiet && ret>=0) {
|
||||
printf(
|
||||
" mode: %d\n"
|
||||
"-o offset: %ld\n"
|
||||
"-f frequency: %ld\n"
|
||||
" maxerror: %ld\n"
|
||||
" esterror: %ld\n"
|
||||
" status: %d ( ",
|
||||
txc.modes, txc.offset, txc.freq, txc.maxerror,
|
||||
txc.esterror, txc.status);
|
||||
|
||||
/* representative output of next code fragment:
|
||||
"PLL | PPSTIME" */
|
||||
sep=0;
|
||||
for (i=0; statlist[i].name; i++) {
|
||||
if (txc.status & statlist[i].bit) {
|
||||
if (sep) fputs(" | ",stdout);
|
||||
fputs(statlist[i].name,stdout);
|
||||
sep=1;
|
||||
}
|
||||
}
|
||||
|
||||
descript = "error";
|
||||
if (ret >= 0 && ret <= 5) descript = ret_code_descript[ret];
|
||||
printf(" )\n"
|
||||
"-p timeconstant: %ld\n"
|
||||
" precision: %ld\n"
|
||||
" tolerance: %ld\n"
|
||||
"-t tick: %ld\n"
|
||||
" time.tv_sec: %ld\n"
|
||||
" time.tv_usec: %ld\n"
|
||||
" return value: %d (%s)\n",
|
||||
txc.constant,
|
||||
txc.precision, txc.tolerance, txc.tick,
|
||||
(long)txc.time.tv_sec, (long)txc.time.tv_usec, ret, descript);
|
||||
}
|
||||
return (ret<0);
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
/* 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 <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);
|
||||
|
||||
extern void show_usage(void)
|
||||
{
|
||||
const char *format_string;
|
||||
const char *usage_string = usage_messages;
|
||||
int i;
|
||||
/* From busybox.c */
|
||||
extern int been_there_done_that;
|
||||
|
||||
if (strcmp(applet_using->name, "busybox")==0) {
|
||||
been_there_done_that=1;
|
||||
busybox_main(0, NULL);
|
||||
}
|
||||
|
||||
for (i = applet_using - applets; i > 0; ) {
|
||||
if (!*usage_string++) {
|
||||
--i;
|
||||
}
|
||||
}
|
||||
format_string = "%s\n\nUsage: %s %s\n\n";
|
||||
if(*usage_string == 0)
|
||||
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;
|
||||
|
||||
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) {
|
||||
show_usage();
|
||||
}
|
||||
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 = 0;
|
||||
}
|
||||
|
||||
|
||||
/* END CODE */
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -0,0 +1,454 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#undef APPLET
|
||||
#undef APPLET_ODDNAME
|
||||
#undef APPLET_NOUSAGE
|
||||
|
||||
|
||||
#if defined(PROTOTYPES)
|
||||
#define APPLET(a,b,c) extern int b(int argc, char **argv);
|
||||
#define APPLET_NOUSAGE(a,b,c) extern int b(int argc, char **argv);
|
||||
#define APPLET_ODDNAME(a,b,c,d) extern int b(int argc, char **argv);
|
||||
extern const char usage_messages[];
|
||||
#elif defined(MAKE_USAGE)
|
||||
#ifdef BB_FEATURE_VERBOSE_USAGE
|
||||
#define APPLET(a,b,c) a##_trivial_usage "\n\n" a##_full_usage "\0"
|
||||
#define APPLET_NOUSAGE(a,b,c) "\0"
|
||||
#define APPLET_ODDNAME(a,b,c,d) d##_trivial_usage "\n\n" d##_full_usage "\0"
|
||||
#else
|
||||
#define APPLET(a,b,c) a##_trivial_usage "\0"
|
||||
#define APPLET_NOUSAGE(a,b,c) "\0"
|
||||
#define APPLET_ODDNAME(a,b,c,d) d##_trivial_usage "\0"
|
||||
#endif
|
||||
#elif defined(MAKE_LINKS)
|
||||
# define APPLET(a,b,c) LINK c a
|
||||
# define APPLET_NOUSAGE(a,b,c) LINK c a
|
||||
# define APPLET_ODDNAME(a,b,c,d) LINK c a
|
||||
#else
|
||||
const struct BB_applet applets[] = {
|
||||
#define APPLET(a,b,c) {#a,b,c},
|
||||
#define APPLET_NOUSAGE(a,b,c) {a,b,c},
|
||||
#define APPLET_ODDNAME(a,b,c,d) {a,b,c},
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef BB_TEST
|
||||
APPLET_NOUSAGE("[", test_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_ADJTIMEX
|
||||
APPLET(adjtimex, adjtimex_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_AR
|
||||
APPLET(ar, ar_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_BASENAME
|
||||
APPLET(basename, basename_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
APPLET_NOUSAGE("busybox", busybox_main, _BB_DIR_BIN)
|
||||
#ifdef BB_CAT
|
||||
APPLET(cat, cat_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHGRP
|
||||
APPLET(chgrp, chgrp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHMOD
|
||||
APPLET(chmod, chmod_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHOWN
|
||||
APPLET(chown, chown_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CHROOT
|
||||
APPLET(chroot, chroot_main, _BB_DIR_USR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_CHVT
|
||||
APPLET(chvt, chvt_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CLEAR
|
||||
APPLET(clear, clear_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CMP
|
||||
APPLET(cmp, cmp_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CP
|
||||
APPLET(cp, cp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CPIO
|
||||
APPLET(cpio, cpio_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_CUT
|
||||
APPLET(cut, cut_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DATE
|
||||
APPLET(date, date_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DC
|
||||
APPLET(dc, dc_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DD
|
||||
APPLET(dd, dd_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DEALLOCVT
|
||||
APPLET(deallocvt, deallocvt_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DF
|
||||
APPLET(df, df_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DIRNAME
|
||||
APPLET(dirname, dirname_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DMESG
|
||||
APPLET(dmesg, dmesg_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DOS2UNIX
|
||||
APPLET(dos2unix, dos2unix_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DPKG
|
||||
APPLET(dpkg, dpkg_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DPKG_DEB
|
||||
APPLET_ODDNAME("dpkg-deb", dpkg_deb_main, _BB_DIR_USR_BIN, dpkg_deb)
|
||||
#endif
|
||||
#ifdef BB_DU
|
||||
APPLET(du, du_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DUMPKMAP
|
||||
APPLET(dumpkmap, dumpkmap_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_DUTMP
|
||||
APPLET(dutmp, dutmp_main, _BB_DIR_USR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_ECHO
|
||||
APPLET(echo, echo_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#if defined(BB_FEATURE_GREP_EGREP_ALIAS) && defined(BB_GREP)
|
||||
APPLET_NOUSAGE("egrep", grep_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_ENV
|
||||
APPLET(env, env_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_EXPR
|
||||
APPLET(expr, expr_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE
|
||||
APPLET(false, false_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FBSET
|
||||
APPLET(fbset, fbset_main, _BB_DIR_USR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_FDFLUSH
|
||||
APPLET(fdflush, fdflush_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FIND
|
||||
APPLET(find, find_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FREE
|
||||
APPLET(free, free_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FREERAMDISK
|
||||
APPLET(freeramdisk, freeramdisk_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_FSCK_MINIX
|
||||
APPLET_ODDNAME("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix)
|
||||
#endif
|
||||
#ifdef BB_GETOPT
|
||||
APPLET(getopt, getopt_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GREP
|
||||
APPLET(grep, grep_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GUNZIP
|
||||
APPLET(gunzip, gunzip_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GZIP
|
||||
APPLET(gzip, gzip_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_HALT
|
||||
APPLET(halt, halt_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_HEAD
|
||||
APPLET(head, head_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_HOSTID
|
||||
APPLET(hostid, hostid_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_HOSTNAME
|
||||
APPLET(hostname, hostname_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_ID
|
||||
APPLET(id, id_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_IFCONFIG
|
||||
APPLET(ifconfig, ifconfig_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_INIT
|
||||
APPLET(init, init_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_INSMOD
|
||||
APPLET(insmod, insmod_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_KILL
|
||||
APPLET(kill, kill_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_KILLALL
|
||||
APPLET(killall, kill_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_KLOGD
|
||||
APPLET(klogd, klogd_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_LENGTH
|
||||
APPLET(length, length_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_FEATURE_LINUXRC
|
||||
APPLET_NOUSAGE("linuxrc", init_main, _BB_DIR_ROOT)
|
||||
#endif
|
||||
#ifdef BB_LN
|
||||
APPLET(ln, ln_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOADACM
|
||||
APPLET(loadacm, loadacm_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOADFONT
|
||||
APPLET(loadfont, loadfont_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOADKMAP
|
||||
APPLET(loadkmap, loadkmap_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_LOGGER
|
||||
APPLET(logger, logger_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOGNAME
|
||||
APPLET(logname, logname_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LOGREAD
|
||||
APPLET(logread, logread_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_LS
|
||||
APPLET(ls, ls_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LSMOD
|
||||
APPLET(lsmod, lsmod_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_MAKEDEVS
|
||||
APPLET(makedevs, makedevs_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_MD5SUM
|
||||
APPLET(md5sum, md5sum_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKDIR
|
||||
APPLET(mkdir, mkdir_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKFIFO
|
||||
APPLET(mkfifo, mkfifo_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKFS_MINIX
|
||||
APPLET_ODDNAME("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix)
|
||||
#endif
|
||||
#ifdef BB_MKNOD
|
||||
APPLET(mknod, mknod_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MKSWAP
|
||||
APPLET(mkswap, mkswap_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_MKTEMP
|
||||
APPLET(mktemp, mktemp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MORE
|
||||
APPLET(more, more_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MOUNT
|
||||
APPLET(mount, mount_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MT
|
||||
APPLET(mt, mt_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MV
|
||||
APPLET(mv, mv_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_NC
|
||||
APPLET(nc, nc_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_NSLOOKUP
|
||||
APPLET(nslookup, nslookup_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PING
|
||||
APPLET(ping, ping_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PIVOT_ROOT
|
||||
APPLET(pivot_root, pivot_root_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_POWEROFF
|
||||
APPLET(poweroff, poweroff_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_PRINTF
|
||||
APPLET(printf, printf_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PS
|
||||
APPLET(ps, ps_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PWD
|
||||
APPLET(pwd, pwd_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RDATE
|
||||
APPLET(rdate, rdate_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_READLINK
|
||||
APPLET(readlink, readlink_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_REBOOT
|
||||
APPLET(reboot, reboot_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_RENICE
|
||||
APPLET(renice, renice_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RESET
|
||||
APPLET(reset, reset_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RM
|
||||
APPLET(rm, rm_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RMDIR
|
||||
APPLET(rmdir, rmdir_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RMMOD
|
||||
APPLET(rmmod, rmmod_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_ROUTE
|
||||
APPLET(route, route_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RPM2CPIO
|
||||
APPLET(rpm2cpio, rpm2cpio_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_RPMUNPACK
|
||||
APPLET(rpmunpack, rpmunpack_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SED
|
||||
APPLET(sed, sed_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SETKEYCODES
|
||||
APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SH
|
||||
APPLET(sh, shell_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SLEEP
|
||||
APPLET(sleep, sleep_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SORT
|
||||
APPLET(sort, sort_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_STTY
|
||||
APPLET(stty, stty_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SWAPONOFF
|
||||
APPLET(swapoff, swap_on_off_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_SWAPONOFF
|
||||
APPLET(swapon, swap_on_off_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_SYNC
|
||||
APPLET(sync, sync_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SYSLOGD
|
||||
APPLET(syslogd, syslogd_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_TAIL
|
||||
APPLET(tail, tail_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TAR
|
||||
APPLET(tar, tar_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TEE
|
||||
APPLET(tee, tee_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TELNET
|
||||
APPLET(telnet, telnet_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TEST
|
||||
APPLET(test, test_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TFTP
|
||||
APPLET(tftp, tftp_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TOUCH
|
||||
APPLET(touch, touch_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TR
|
||||
APPLET(tr, tr_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE
|
||||
APPLET(true, true_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TTY
|
||||
APPLET(tty, tty_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UMOUNT
|
||||
APPLET(umount, umount_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UNAME
|
||||
APPLET(uname, uname_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UNIQ
|
||||
APPLET(uniq, uniq_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UNIX2DOS
|
||||
APPLET(unix2dos, unix2dos_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UPDATE
|
||||
APPLET(update, update_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_UPTIME
|
||||
APPLET(uptime, uptime_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_USLEEP
|
||||
APPLET(usleep, usleep_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UUDECODE
|
||||
APPLET(uudecode, uudecode_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UUENCODE
|
||||
APPLET(uuencode, uuencode_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_VI
|
||||
APPLET(vi, vi_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WATCHDOG
|
||||
APPLET(watchdog, watchdog_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_WC
|
||||
APPLET(wc, wc_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WGET
|
||||
APPLET(wget, wget_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WHICH
|
||||
APPLET(which, which_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_WHOAMI
|
||||
APPLET(whoami, whoami_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_XARGS
|
||||
APPLET(xargs, xargs_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_YES
|
||||
APPLET(yes, yes_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_GUNZIP
|
||||
APPLET(zcat, gunzip_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
|
||||
#if !defined(PROTOTYPES) && !defined(MAKE_USAGE)
|
||||
{ 0,NULL,0 }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,113 @@
|
||||
/* 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 <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);
|
||||
|
||||
extern void show_usage(void)
|
||||
{
|
||||
const char *format_string;
|
||||
const char *usage_string = usage_messages;
|
||||
int i;
|
||||
/* From busybox.c */
|
||||
extern int been_there_done_that;
|
||||
|
||||
if (strcmp(applet_using->name, "busybox")==0) {
|
||||
been_there_done_that=1;
|
||||
busybox_main(0, NULL);
|
||||
}
|
||||
|
||||
for (i = applet_using - applets; i > 0; ) {
|
||||
if (!*usage_string++) {
|
||||
--i;
|
||||
}
|
||||
}
|
||||
format_string = "%s\n\nUsage: %s %s\n\n";
|
||||
if(*usage_string == 0)
|
||||
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;
|
||||
|
||||
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) {
|
||||
show_usage();
|
||||
}
|
||||
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 = 0;
|
||||
}
|
||||
|
||||
|
||||
/* END CODE */
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+128
-336
@@ -1,366 +1,146 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef BB_INIT
|
||||
#undef BB_FEATURE_LINUXRC
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
#ifdef BB_LOCALE_SUPPORT
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
static int been_there_done_that = 0;
|
||||
int been_there_done_that = 0; /* Also used in applets.c */
|
||||
const char *applet_name;
|
||||
|
||||
/* It has been alledged that doing such things can
|
||||
* help reduce binary size when staticly linking,
|
||||
* of course with glibc, this is unlikely as long
|
||||
* as we use things like printf -- perhaps a printf
|
||||
* replacement may be in order
|
||||
#ifdef BB_FEATURE_INSTALLER
|
||||
/*
|
||||
* directory table
|
||||
* this should be consistent w/ the enum, busybox.h::Location,
|
||||
* or else...
|
||||
*/
|
||||
#if 0
|
||||
void exit(int status) __attribute__ ((noreturn));
|
||||
void exit(int status)
|
||||
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()
|
||||
{
|
||||
_exit(status);
|
||||
};
|
||||
void abort(void) __attribute__ ((__noreturn__));
|
||||
void abort(void)
|
||||
return xreadlink("/proc/self/exe");
|
||||
}
|
||||
|
||||
/* create (sym)links for each applet */
|
||||
static void install_links(const char *busybox, int use_symbolic_links)
|
||||
{
|
||||
_exit(0);
|
||||
};
|
||||
int atexit(void (*__func) (void))
|
||||
{
|
||||
_exit(0);
|
||||
};
|
||||
void *__libc_stack_end;
|
||||
#endif
|
||||
__link_f Link = link;
|
||||
|
||||
char *fpc;
|
||||
int i;
|
||||
int rc;
|
||||
|
||||
static const struct Applet applets[] = {
|
||||
|
||||
#ifdef BB_BASENAME //usr/bin/basename
|
||||
{"basename", basename_main},
|
||||
#endif
|
||||
#ifdef BB_BUSYBOX //bin
|
||||
{"busybox", busybox_main},
|
||||
#endif
|
||||
#ifdef BB_BLOCK_DEVICE //sbin
|
||||
{"block_device", block_device_main},
|
||||
#endif
|
||||
#ifdef BB_CAT //bin
|
||||
{"cat", cat_main},
|
||||
#endif
|
||||
#ifdef BB_CHMOD_CHOWN_CHGRP //bin
|
||||
{"chmod", chmod_chown_chgrp_main},
|
||||
{"chown", chmod_chown_chgrp_main},
|
||||
{"chgrp", chmod_chown_chgrp_main},
|
||||
#endif
|
||||
#ifdef BB_CHROOT //sbin
|
||||
{"chroot", chroot_main},
|
||||
#endif
|
||||
#ifdef BB_CLEAR //usr/bin
|
||||
{"clear", clear_main},
|
||||
#endif
|
||||
#ifdef BB_CHVT //usr/bin
|
||||
{"chvt", chvt_main},
|
||||
#endif
|
||||
#ifdef BB_CP_MV //bin
|
||||
{"cp", cp_mv_main},
|
||||
{"mv", cp_mv_main},
|
||||
#endif
|
||||
#ifdef BB_DATE //bin
|
||||
{"date", date_main},
|
||||
#endif
|
||||
#ifdef BB_DD //bin
|
||||
{"dd", dd_main},
|
||||
#endif
|
||||
#ifdef BB_DF //bin
|
||||
{"df", df_main},
|
||||
#endif
|
||||
#ifdef BB_DIRNAME //usr/bin
|
||||
{"dirname", dirname_main},
|
||||
#endif
|
||||
#ifdef BB_DMESG //bin
|
||||
{"dmesg", dmesg_main},
|
||||
#endif
|
||||
#ifdef BB_DU //bin
|
||||
{"du", du_main},
|
||||
#endif
|
||||
#ifdef BB_DUTMP //usr/sbin
|
||||
{"dutmp", dutmp_main},
|
||||
#endif
|
||||
#ifdef BB_FBSET //usr/sbin
|
||||
{"fbset", fbset_main},
|
||||
#endif
|
||||
#ifdef BB_FDFLUSH //bin
|
||||
{"fdflush", fdflush_main},
|
||||
#endif
|
||||
#ifdef BB_FIND //usr/bin
|
||||
{"find", find_main},
|
||||
#endif
|
||||
#ifdef BB_FREE //usr/bin
|
||||
{"free", free_main},
|
||||
#endif
|
||||
#ifdef BB_FREERAMDISK //sbin
|
||||
{"freeramdisk", freeramdisk_main},
|
||||
#endif
|
||||
#ifdef BB_DEALLOCVT //usr/bin
|
||||
{"deallocvt", deallocvt_main},
|
||||
#endif
|
||||
#ifdef BB_FSCK_MINIX //sbin
|
||||
{"fsck.minix", fsck_minix_main},
|
||||
#endif
|
||||
#ifdef BB_MKFS_MINIX //sbin
|
||||
{"mkfs.minix", mkfs_minix_main},
|
||||
#endif
|
||||
#ifdef BB_GREP //bin
|
||||
{"grep", grep_main},
|
||||
#endif
|
||||
#ifdef BB_HALT //sbin
|
||||
{"halt", halt_main},
|
||||
#endif
|
||||
#ifdef BB_HEAD //bin
|
||||
{"head", head_main},
|
||||
#endif
|
||||
#ifdef BB_HOSTID //usr/bin
|
||||
{"hostid", hostid_main},
|
||||
#endif
|
||||
#ifdef BB_HOSTNAME //bin
|
||||
{"hostname", hostname_main},
|
||||
#endif
|
||||
#ifdef BB_INIT //sbin
|
||||
{"init", init_main},
|
||||
#endif
|
||||
#ifdef BB_INSMOD //sbin
|
||||
{"insmod", insmod_main},
|
||||
#endif
|
||||
#ifdef BB_FEATURE_LINUXRC //
|
||||
{"linuxrc", init_main},
|
||||
#endif
|
||||
#ifdef BB_KILL //bin
|
||||
{"kill", kill_main},
|
||||
#endif
|
||||
#ifdef BB_KILLALL //usr/bin
|
||||
{"killall", kill_main},
|
||||
#endif
|
||||
#ifdef BB_LENGTH //usr/bin
|
||||
{"length", length_main},
|
||||
#endif
|
||||
#ifdef BB_LN //bin
|
||||
{"ln", ln_main},
|
||||
#endif
|
||||
#ifdef BB_LOADACM //usr/bin
|
||||
{"loadacm", loadacm_main},
|
||||
#endif
|
||||
#ifdef BB_LOADFONT //usr/bin
|
||||
{"loadfont", loadfont_main},
|
||||
#endif
|
||||
#ifdef BB_LOADKMAP //sbin
|
||||
{"loadkmap", loadkmap_main},
|
||||
#endif
|
||||
#ifdef BB_LS //bin
|
||||
{"ls", ls_main},
|
||||
#endif
|
||||
#ifdef BB_LSMOD //sbin
|
||||
{"lsmod", lsmod_main},
|
||||
#endif
|
||||
#ifdef BB_MAKEDEVS //sbin
|
||||
{"makedevs", makedevs_main},
|
||||
#endif
|
||||
#ifdef BB_MATH //usr/bin
|
||||
{"math", math_main},
|
||||
#endif
|
||||
#ifdef BB_MKDIR //bin
|
||||
{"mkdir", mkdir_main},
|
||||
#endif
|
||||
#ifdef BB_MKFIFO //usr/bin
|
||||
{"mkfifo", mkfifo_main},
|
||||
#endif
|
||||
#ifdef BB_MKNOD //bin
|
||||
{"mknod", mknod_main},
|
||||
#endif
|
||||
#ifdef BB_MKSWAP //sbin
|
||||
{"mkswap", mkswap_main},
|
||||
#endif
|
||||
#ifdef BB_MNC //usr/bin
|
||||
{"mnc", mnc_main},
|
||||
#endif
|
||||
#ifdef BB_MORE //bin
|
||||
{"more", more_main},
|
||||
#endif
|
||||
#ifdef BB_MOUNT //bin
|
||||
{"mount", mount_main},
|
||||
#endif
|
||||
#ifdef BB_MT //bin
|
||||
{"mt", mt_main},
|
||||
#endif
|
||||
#ifdef BB_NSLOOKUP //usr/bin
|
||||
{"nslookup", nslookup_main},
|
||||
#endif
|
||||
#ifdef BB_PING //bin
|
||||
{"ping", ping_main},
|
||||
#endif
|
||||
#ifdef BB_POWEROFF //sbin
|
||||
{"poweroff", poweroff_main},
|
||||
#endif
|
||||
#ifdef BB_PRINTF //usr/bin
|
||||
{"printf", printf_main},
|
||||
#endif
|
||||
#ifdef BB_PS //bin
|
||||
{"ps", ps_main},
|
||||
#endif
|
||||
#ifdef BB_PWD //bin
|
||||
{"pwd", pwd_main},
|
||||
#endif
|
||||
#ifdef BB_REBOOT //sbin
|
||||
{"reboot", reboot_main},
|
||||
#endif
|
||||
#ifdef BB_RM //bin
|
||||
{"rm", rm_main},
|
||||
#endif
|
||||
#ifdef BB_RMDIR //bin
|
||||
{"rmdir", rmdir_main},
|
||||
#endif
|
||||
#ifdef BB_RMMOD //sbin
|
||||
{"rmmod", rmmod_main},
|
||||
#endif
|
||||
#ifdef BB_SFDISK //sbin
|
||||
{"fdisk", sfdisk_main},
|
||||
{"sfdisk", sfdisk_main},
|
||||
#endif
|
||||
#ifdef BB_SED //bin
|
||||
{"sed", sed_main},
|
||||
#endif
|
||||
#ifdef BB_SLEEP //bin
|
||||
{"sleep", sleep_main},
|
||||
#endif
|
||||
#ifdef BB_SORT //bin
|
||||
{"sort", sort_main},
|
||||
#endif
|
||||
#ifdef BB_SYNC //bin
|
||||
{"sync", sync_main},
|
||||
#endif
|
||||
#ifdef BB_SYSLOGD //sbin
|
||||
{"syslogd", syslogd_main},
|
||||
#endif
|
||||
#ifdef BB_LOGGER //usr/bin
|
||||
{"logger", logger_main},
|
||||
#endif
|
||||
#ifdef BB_LOGNAME //usr/bin
|
||||
{"logname", logname_main},
|
||||
#endif
|
||||
#ifdef BB_SWAPONOFF //sbin
|
||||
{"swapon", swap_on_off_main},
|
||||
{"swapoff", swap_on_off_main},
|
||||
#endif
|
||||
#ifdef BB_TAIL //usr/bin
|
||||
{"tail", tail_main},
|
||||
#endif
|
||||
#ifdef BB_TAR //bin
|
||||
{"tar", tar_main},
|
||||
#endif
|
||||
#ifdef BB_TELNET //usr/bin
|
||||
{"telnet", telnet_main},
|
||||
#endif
|
||||
#ifdef BB_TEE //bin
|
||||
{"tee", tee_main},
|
||||
#endif
|
||||
#ifdef BB_TOUCH //usr/bin
|
||||
{"touch", touch_main},
|
||||
#endif
|
||||
#ifdef BB_TR //usr/bin
|
||||
{"tr", tr_main},
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE //bin
|
||||
{"true", true_main},
|
||||
{"false", false_main},
|
||||
#endif
|
||||
#ifdef BB_TTY //usr/bin
|
||||
{"tty", tty_main},
|
||||
#endif
|
||||
#ifdef BB_UMOUNT //bin
|
||||
{"umount", umount_main},
|
||||
#endif
|
||||
#ifdef BB_UNAME //bin
|
||||
{"uname", uname_main},
|
||||
#endif
|
||||
#ifdef BB_UPTIME //usr/bin
|
||||
{"uptime", uptime_main},
|
||||
#endif
|
||||
#ifdef BB_UNIQ //bin
|
||||
{"uniq", uniq_main},
|
||||
#endif
|
||||
#ifdef BB_UPDATE //sbin
|
||||
{"update", update_main},
|
||||
#endif
|
||||
#ifdef BB_WC //usr/bin
|
||||
{"wc", wc_main},
|
||||
#endif
|
||||
#ifdef BB_WHOAMI //usr/bin
|
||||
{"whoami", whoami_main},
|
||||
#endif
|
||||
#ifdef BB_YES //usr/bin
|
||||
{"yes", yes_main},
|
||||
#endif
|
||||
#ifdef BB_GUNZIP //bin
|
||||
{"zcat", gunzip_main},
|
||||
{"gunzip", gunzip_main},
|
||||
#endif
|
||||
#ifdef BB_GZIP //bin
|
||||
{"gzip", gzip_main},
|
||||
#endif
|
||||
{0}
|
||||
};
|
||||
if (use_symbolic_links)
|
||||
Link = symlink;
|
||||
|
||||
for (i = 0; applets[i].name != NULL; i++) {
|
||||
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 */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *s = argv[0];
|
||||
char *name = argv[0];
|
||||
const struct Applet *a = applets;
|
||||
const char *s;
|
||||
|
||||
while (*s != '\0') {
|
||||
for (s = applet_name = argv[0]; *s != '\0';) {
|
||||
if (*s++ == '/')
|
||||
name = s;
|
||||
applet_name = s;
|
||||
}
|
||||
|
||||
*argv = name;
|
||||
|
||||
while (a->name != 0) {
|
||||
if (strcmp(name, a->name) == 0) {
|
||||
int status;
|
||||
|
||||
status = ((*(a->main)) (argc, argv));
|
||||
if (status < 0) {
|
||||
fprintf(stderr, "%s: %s\n", a->name, strerror(errno));
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
exit(status);
|
||||
}
|
||||
a++;
|
||||
/* Add in a special case hack for a leading hyphen */
|
||||
if (**argv == '-' && *(*argv+1)!= '-') {
|
||||
applet_name = (*argv+1);
|
||||
}
|
||||
exit(busybox_main(argc, argv));
|
||||
|
||||
#ifdef BB_LOCALE_SUPPORT
|
||||
#ifdef BB_INIT
|
||||
if(getpid()!=1) /* Do not set locale for `init' */
|
||||
#endif
|
||||
{
|
||||
setlocale(LC_ALL, "");
|
||||
}
|
||||
#endif
|
||||
|
||||
run_applet_by_name(applet_name, argc, argv);
|
||||
error_msg_and_die("applet not found");
|
||||
}
|
||||
|
||||
|
||||
int busybox_main(int argc, char **argv)
|
||||
{
|
||||
int col = 0;
|
||||
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--;
|
||||
argv++;
|
||||
|
||||
/* If we've already been here once, exit now */
|
||||
if (been_there_done_that == 1 || argc < 1) {
|
||||
const struct Applet *a = applets;
|
||||
const struct BB_applet *a = applets;
|
||||
|
||||
fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
|
||||
BB_VER, BB_BT);
|
||||
fprintf(stderr, "Usage: busybox [function] [arguments]...\n");
|
||||
fprintf(stderr, " or: [function] [arguments]...\n\n");
|
||||
fprintf(stderr,
|
||||
"\tMost people will create a link to busybox for each\n"
|
||||
"\tfunction name, and busybox will act like whatever you invoke it as.\n");
|
||||
fprintf(stderr, "\nCurrently defined functions:\n");
|
||||
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 +=
|
||||
@@ -372,12 +152,24 @@ int busybox_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n\n");
|
||||
exit(-1);
|
||||
} else {
|
||||
/* If we've already been here once, exit now */
|
||||
been_there_done_that = 1;
|
||||
return (main(argc, argv));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* 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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+19
-10
@@ -1,15 +1,24 @@
|
||||
#!/bin/sh
|
||||
# Make busybox links list file.
|
||||
|
||||
DF="busybox.def.h"
|
||||
MF="busybox.c"
|
||||
# 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
|
||||
|
||||
LIST="$(sed -n '/^#define/{s/^#define //p;}' $DF)"
|
||||
# Maintainer: Larry Doolittle <ldoolitt@recycle.lbl.gov>
|
||||
|
||||
for def in ${LIST}; do
|
||||
i=`sed -n 's/^#ifdef \<'$def'\>.*\/\/\(.*$\)/\/\1\//gp' $MF`
|
||||
j=`sed -n '/^#ifdef \<'$def'\>.*/,/^#endif/{ s/.*\"\(.*\)\".*/\1/gp; }' $MF`
|
||||
for k in $j; do
|
||||
echo $i$k
|
||||
done
|
||||
done
|
||||
export LC_ALL=POSIX
|
||||
export LC_CTYPE=POSIX
|
||||
|
||||
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
|
||||
}'
|
||||
+14
-2
@@ -1,4 +1,16 @@
|
||||
#!/bin/sh
|
||||
ls -1 `sed -n '/^#define/{s/.*BB_// ; s/$/.c/p; }' busybox.def.h | \
|
||||
tr [:upper:] [:lower:]` 2> /dev/null | sed -e 's/\.c$/\.o/g'
|
||||
|
||||
export LC_ALL=POSIX
|
||||
export LC_CTYPE=POSIX
|
||||
|
||||
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
|
||||
if [ -d "$BB_SRC_DIR" ]; then cd $BB_SRC_DIR; fi
|
||||
# By running $RAW through "ls", we avoid listing
|
||||
# source files that don't exist.
|
||||
ls $RAW 2>/dev/null | tr '\n' ' '
|
||||
|
||||
+40
-8
@@ -1,20 +1,52 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
export LC_ALL=POSIX
|
||||
export LC_CTYPE=POSIX
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
prefix=$1
|
||||
if [ "$prefix" = "" ]; then
|
||||
echo "No installation directory, aborting."
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ "$2" = "--hardlinks" ]; then
|
||||
linkopts="-f"
|
||||
else
|
||||
linkopts="-fs"
|
||||
fi
|
||||
h=`sort busybox.links | uniq`
|
||||
|
||||
|
||||
rm -f $prefix/bin/busybox || exit 1
|
||||
mkdir -p $prefix/bin || exit 1
|
||||
install -m 755 busybox $prefix/bin/busybox || exit 1
|
||||
|
||||
for i in $h ; do
|
||||
echo " $1$i -> /bin/busybox"
|
||||
mkdir -p $1/`echo $i | sed -e 's/\/[^\/]*$//' `
|
||||
ln -fs /bin/busybox $1$i
|
||||
appdir=`dirname $i`
|
||||
mkdir -p $prefix/$appdir || exit 1
|
||||
if [ "$2" = "--hardlinks" ]; then
|
||||
bb_path="$prefix/bin/busybox"
|
||||
else
|
||||
case "$appdir" in
|
||||
/)
|
||||
bb_path="bin/busybox"
|
||||
;;
|
||||
/bin)
|
||||
bb_path="busybox"
|
||||
;;
|
||||
/sbin)
|
||||
bb_path="../bin/busybox"
|
||||
;;
|
||||
/usr/bin|/usr/sbin)
|
||||
bb_path="../../bin/busybox"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown installation directory: $appdir"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
echo " $prefix$i -> $bb_path"
|
||||
ln $linkopts $bb_path $prefix$i || exit 1
|
||||
done
|
||||
rm -f $1/bin/busybox
|
||||
install -m 755 busybox $1/bin/busybox
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "busybox.h"
|
||||
|
||||
const char usage_messages[] =
|
||||
|
||||
#define MAKE_USAGE
|
||||
#include "usage.h"
|
||||
|
||||
#include "applets.h"
|
||||
|
||||
;
|
||||
+1787
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,89 @@
|
||||
/* 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int ar_main(int argc, char **argv)
|
||||
{
|
||||
FILE *src_stream = NULL;
|
||||
char **extract_names = NULL;
|
||||
char ar_magic[8];
|
||||
int extract_function = extract_unconditional;
|
||||
int opt;
|
||||
int num_of_entries = 0;
|
||||
extern off_t archive_offset;
|
||||
|
||||
while ((opt = getopt(argc, argv, "ovtpx")) != -1) {
|
||||
switch (opt) {
|
||||
case 'o':
|
||||
extract_function |= extract_preserve_date;
|
||||
break;
|
||||
case 'v':
|
||||
extract_function |= extract_verbose_list;
|
||||
break;
|
||||
case 't':
|
||||
extract_function |= extract_list;
|
||||
break;
|
||||
case 'p':
|
||||
extract_function |= extract_to_stdout;
|
||||
break;
|
||||
case 'x':
|
||||
extract_function |= extract_all_to_fs;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
/* check the src filename was specified */
|
||||
if (optind == argc) {
|
||||
show_usage();
|
||||
}
|
||||
|
||||
src_stream = xfopen(argv[optind++], "r");
|
||||
|
||||
/* check ar magic */
|
||||
fread(ar_magic, 1, 8, src_stream);
|
||||
if (strncmp(ar_magic,"!<arch>",7) != 0) {
|
||||
error_msg_and_die("invalid magic");
|
||||
}
|
||||
archive_offset = 8;
|
||||
|
||||
extract_names = malloc(sizeof(char *));
|
||||
extract_names[0] = NULL;
|
||||
while (optind < argc) {
|
||||
num_of_entries++;
|
||||
*extract_names = realloc(*extract_names, num_of_entries);
|
||||
extract_names[num_of_entries - 1] = xstrdup(argv[optind]);
|
||||
optind++;
|
||||
}
|
||||
|
||||
unarchive(src_stream, &get_header_ar, extract_function, "./", extract_names);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/* 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int ar_main(int argc, char **argv)
|
||||
{
|
||||
FILE *src_stream = NULL;
|
||||
char **extract_names = NULL;
|
||||
char ar_magic[8];
|
||||
int extract_function = extract_unconditional;
|
||||
int opt;
|
||||
int num_of_entries = 0;
|
||||
extern off_t archive_offset;
|
||||
|
||||
while ((opt = getopt(argc, argv, "ovtpx")) != -1) {
|
||||
switch (opt) {
|
||||
case 'o':
|
||||
extract_function |= extract_preserve_date;
|
||||
break;
|
||||
case 'v':
|
||||
extract_function |= extract_verbose_list;
|
||||
break;
|
||||
case 't':
|
||||
extract_function |= extract_list;
|
||||
break;
|
||||
case 'p':
|
||||
extract_function |= extract_to_stdout;
|
||||
break;
|
||||
case 'x':
|
||||
extract_function |= extract_all_to_fs;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
/* check the src filename was specified */
|
||||
if (optind == argc) {
|
||||
show_usage();
|
||||
}
|
||||
|
||||
src_stream = xfopen(argv[optind++], "r");
|
||||
|
||||
/* check ar magic */
|
||||
fread(ar_magic, 1, 8, src_stream);
|
||||
if (strncmp(ar_magic,"!<arch>",7) != 0) {
|
||||
error_msg_and_die("invalid magic");
|
||||
}
|
||||
archive_offset = 8;
|
||||
|
||||
extract_names = malloc(sizeof(char *));
|
||||
extract_names[0] = NULL;
|
||||
while (optind < argc) {
|
||||
num_of_entries++;
|
||||
*extract_names = realloc(*extract_names, num_of_entries);
|
||||
extract_names[num_of_entries - 1] = xstrdup(argv[optind]);
|
||||
optind++;
|
||||
}
|
||||
|
||||
unarchive(src_stream, &get_header_ar, extract_function, "./", extract_names);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/* 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 "busybox.h"
|
||||
|
||||
extern int cpio_main(int argc, char **argv)
|
||||
{
|
||||
FILE *src_stream = stdin;
|
||||
char **extract_names = NULL;
|
||||
int extract_function = 0;
|
||||
int num_of_entries = 0;
|
||||
int opt = 0;
|
||||
mode_t oldmask = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "idmuvtF:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'i': // extract
|
||||
extract_function |= extract_all_to_fs;
|
||||
break;
|
||||
case 'd': // create _leading_ directories
|
||||
extract_function |= extract_create_leading_dirs;
|
||||
oldmask = umask(077); /* Make make_directory act like GNU cpio */
|
||||
break;
|
||||
case 'm': // preserve modification time
|
||||
extract_function |= extract_preserve_date;
|
||||
break;
|
||||
case 'v': // verbosly list files
|
||||
extract_function |= extract_verbose_list;
|
||||
break;
|
||||
case 'u': // unconditional
|
||||
extract_function |= extract_unconditional;
|
||||
break;
|
||||
case 't': // list files
|
||||
extract_function |= extract_list;
|
||||
break;
|
||||
case 'F':
|
||||
src_stream = xfopen(optarg, "r");
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (extract_function & extract_all_to_fs && extract_function & extract_list) {
|
||||
extract_function ^= extract_all_to_fs; /* If specify t, don't extract*/
|
||||
}
|
||||
|
||||
if (extract_function & extract_all_to_fs && extract_function & extract_verbose_list) { /* The meaning of v changes on extract */
|
||||
extract_function ^= extract_verbose_list;
|
||||
extract_function |= extract_list;
|
||||
}
|
||||
|
||||
extract_names = malloc(4);
|
||||
while (optind < argc) {
|
||||
num_of_entries++;
|
||||
*extract_names = realloc(*extract_names, num_of_entries);
|
||||
extract_names[num_of_entries - 1] = xstrdup(argv[optind]);
|
||||
optind++;
|
||||
}
|
||||
|
||||
unarchive(src_stream, &get_header_cpio, extract_function, "./", extract_names);
|
||||
if (oldmask) umask(oldmask); /* Restore umask if we changed it */
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
+854
@@ -0,0 +1,854 @@
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <search.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "busybox.h"
|
||||
|
||||
#define DEPENDSMAX 64 /* maximum number of depends we can handle */
|
||||
|
||||
/* Should we do full dependency checking? */
|
||||
//#define DODEPENDS 0
|
||||
|
||||
/* Should we do debugging? */
|
||||
//#define DODEBUG 0
|
||||
|
||||
#ifdef DODEBUG
|
||||
#define SYSTEM(x) do_system(x)
|
||||
#define DPRINTF(fmt,args...) fprintf(stderr, fmt, ##args)
|
||||
#else
|
||||
#define SYSTEM(x) system(x)
|
||||
#define DPRINTF(fmt,args...) /* nothing */
|
||||
#endif
|
||||
|
||||
/* from dpkg-deb.c */
|
||||
|
||||
static const char statusfile[] = "/var/lib/dpkg/status.udeb";
|
||||
static const char new_statusfile[] = "/var/lib/dpkg/status.udeb.new";
|
||||
static const char bak_statusfile[] = "/var/lib/dpkg/status.udeb.bak";
|
||||
|
||||
static const char infodir[] = "/var/lib/dpkg/info/";
|
||||
static const char udpkg_quiet[] = "UDPKG_QUIET";
|
||||
|
||||
//static const int status_want_unknown = 1;
|
||||
static const int state_want_install = 2;
|
||||
//static const int state_want_hold = 3;
|
||||
//static const int state_want_deinstall = 4;
|
||||
//static const int state_want_purge = 5;
|
||||
|
||||
static const int state_flag_ok = 1;
|
||||
//static const int state_flag_reinstreq = 2;
|
||||
//static const int state_flag_hold = 3;
|
||||
//static const int state_flag_holdreinstreq = 4;
|
||||
|
||||
//static const int state_statusnoninstalled = 1;
|
||||
static const int state_status_unpacked = 2;
|
||||
static const int state_status_halfconfigured = 3;
|
||||
static const int state_status_installed = 4;
|
||||
static const int state_status_halfinstalled = 5;
|
||||
//static const int state_statusconfigfiles = 6;
|
||||
//static const int state_statuspostinstfailed = 7;
|
||||
//static const int state_statusremovalfailed = 8;
|
||||
|
||||
static const char *state_words_want[] = { "unknown", "install", "hold", "deinstall", "purge", 0 };
|
||||
static const char *state_words_flag[] = { "ok", "reinstreq", "hold", "hold-reinstreq", 0 };
|
||||
static const char *state_words_status[] = { "not-installed", "unpacked", "half-configured", "installed",
|
||||
"half-installed", "config-files", "post-inst-failed", "removal-failed", 0 };
|
||||
|
||||
static const int color_white = 0;
|
||||
static const int color_grey = 1;
|
||||
static const int color_black = 2;
|
||||
|
||||
/* data structures */
|
||||
typedef struct package_s {
|
||||
char *filename;
|
||||
char *package;
|
||||
unsigned char state_want;
|
||||
unsigned char state_flag;
|
||||
unsigned char state_status;
|
||||
char *depends;
|
||||
char *provides;
|
||||
char *description;
|
||||
char *priority;
|
||||
char *section;
|
||||
char *installed_size;
|
||||
char *maintainer;
|
||||
char *source;
|
||||
char *version;
|
||||
char *pre_depends;
|
||||
char *replaces;
|
||||
char *recommends;
|
||||
char *suggests;
|
||||
char *conflicts;
|
||||
char *conffiles;
|
||||
char *long_description;
|
||||
char *architecture;
|
||||
char *md5sum;
|
||||
int installer_menu_item;
|
||||
char color; /* for topo-sort */
|
||||
struct package_s *requiredfor[DEPENDSMAX];
|
||||
unsigned short requiredcount;
|
||||
struct package_s *next;
|
||||
} package_t;
|
||||
|
||||
#ifdef DODEBUG
|
||||
static int do_system(const char *cmd)
|
||||
{
|
||||
DPRINTF("cmd is %s\n", cmd);
|
||||
return system(cmd);
|
||||
}
|
||||
#else
|
||||
#define do_system(cmd) system(cmd)
|
||||
#endif
|
||||
|
||||
static int package_compare(const void *p1, const void *p2)
|
||||
{
|
||||
return strcmp(((package_t *)p1)->package,
|
||||
((package_t *)p2)->package);
|
||||
}
|
||||
|
||||
#ifdef DODEPENDS
|
||||
|
||||
static char **depends_split(const char *dependsstr)
|
||||
{
|
||||
static char *dependsvec[DEPENDSMAX];
|
||||
char *p;
|
||||
int i = 0;
|
||||
|
||||
dependsvec[0] = 0;
|
||||
if (dependsstr == 0) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
p = xstrdup(dependsstr);
|
||||
while (*p != 0 && *p != '\n') {
|
||||
if (*p != ' ') {
|
||||
if (*p == ',') {
|
||||
*p = 0;
|
||||
dependsvec[++i] = 0;
|
||||
} else {
|
||||
if (dependsvec[i] == 0) {
|
||||
dependsvec[i] = p;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
*p = 0; /* eat the space... */
|
||||
}
|
||||
p++;
|
||||
}
|
||||
*p = 0;
|
||||
|
||||
end:
|
||||
dependsvec[i+1] = 0;
|
||||
return dependsvec;
|
||||
}
|
||||
|
||||
/* Topological sort algorithm:
|
||||
* ordered is the output list, pkgs is the dependency graph, pkg is
|
||||
* the current node
|
||||
*
|
||||
* recursively add all the adjacent nodes to the ordered list, marking
|
||||
* each one as visited along the way
|
||||
*
|
||||
* yes, this algorithm looks a bit odd when all the params have the
|
||||
* same type :-)
|
||||
*/
|
||||
static void depends_sort_visit(package_t **ordered, package_t *pkgs,
|
||||
package_t *pkg)
|
||||
{
|
||||
unsigned short i;
|
||||
|
||||
/* mark node as processing */
|
||||
pkg->color = color_grey;
|
||||
|
||||
/* visit each not-yet-visited node */
|
||||
for (i = 0; i < pkg->requiredcount; i++)
|
||||
if (pkg->requiredfor[i]->color == color_white)
|
||||
depends_sort_visit(ordered, pkgs, pkg->requiredfor[i]);
|
||||
|
||||
#if 0
|
||||
/* add it to the list */
|
||||
newnode = (struct package_t *)xmalloc(sizeof(struct package_t));
|
||||
/* make a shallow copy */
|
||||
*newnode = *pkg;
|
||||
newnode->next = *ordered;
|
||||
*ordered = newnode;
|
||||
#endif
|
||||
|
||||
pkg->next = *ordered;
|
||||
*ordered = pkg;
|
||||
|
||||
/* mark node as done */
|
||||
pkg->color = color_black;
|
||||
}
|
||||
|
||||
static package_t *depends_sort(package_t *pkgs)
|
||||
{
|
||||
/* TODO: it needs to break cycles in the to-be-installed package
|
||||
* graph... */
|
||||
package_t *ordered = NULL;
|
||||
package_t *pkg;
|
||||
|
||||
for (pkg = pkgs; pkg != 0; pkg = pkg->next) {
|
||||
pkg->color = color_white;
|
||||
}
|
||||
for (pkg = pkgs; pkg != 0; pkg = pkg->next) {
|
||||
if (pkg->color == color_white) {
|
||||
depends_sort_visit(&ordered, pkgs, pkg);
|
||||
}
|
||||
}
|
||||
|
||||
/* Leaks the old list... return the new one... */
|
||||
return ordered;
|
||||
}
|
||||
|
||||
|
||||
/* resolve package dependencies --
|
||||
* for each package in the list of packages to be installed, we parse its
|
||||
* dependency info to determine if the dependent packages are either
|
||||
* already installed, or are scheduled to be installed. If both tests fail
|
||||
* than bail.
|
||||
*
|
||||
* The algorithm here is O(n^2*m) where n = number of packages to be
|
||||
* installed and m is the # of dependencies per package. Not a terribly
|
||||
* efficient algorithm, but given that at any one time you are unlikely
|
||||
* to install a very large number of packages it doesn't really matter
|
||||
*/
|
||||
static package_t *depends_resolve(package_t *pkgs, void *status)
|
||||
{
|
||||
package_t *pkg, *chk;
|
||||
package_t dependpkg;
|
||||
char **dependsvec;
|
||||
int i;
|
||||
void *found;
|
||||
|
||||
for (pkg = pkgs; pkg != 0; pkg = pkg->next) {
|
||||
dependsvec = depends_split(pkg->depends);
|
||||
i = 0;
|
||||
while (dependsvec[i] != 0) {
|
||||
/* Check for dependencies; first look for installed packages */
|
||||
dependpkg.package = dependsvec[i];
|
||||
if (((found = tfind(&dependpkg, &status, package_compare)) == 0) ||
|
||||
((chk = *(package_t **)found) && (chk->state_flag & state_flag_ok) &&
|
||||
(chk->state_status & state_status_installed))) {
|
||||
|
||||
/* if it fails, we look through the list of packages we are going to
|
||||
* install */
|
||||
for (chk = pkgs; chk != 0; chk = chk->next) {
|
||||
if (strcmp(chk->package, dependsvec[i]) == 0 || (chk->provides &&
|
||||
strncmp(chk->provides, dependsvec[i], strlen(dependsvec[i])) == 0)) {
|
||||
if (chk->requiredcount >= DEPENDSMAX) {
|
||||
error_msg("Too many dependencies for %s", chk->package);
|
||||
return 0;
|
||||
}
|
||||
if (chk != pkg) {
|
||||
chk->requiredfor[chk->requiredcount++] = pkg;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (chk == 0) {
|
||||
error_msg("%s depends on %s, but it is not going to be installed", pkg->package, dependsvec[i]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return depends_sort(pkgs);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Status file handling routines
|
||||
*
|
||||
* This is a fairly minimalistic implementation. there are two main functions
|
||||
* that are supported:
|
||||
*
|
||||
* 1) reading the entire status file:
|
||||
* the status file is read into memory as a binary-tree, with just the
|
||||
* package and status info preserved
|
||||
*
|
||||
* 2) merging the status file
|
||||
* control info from (new) packages is merged into the status file,
|
||||
* replacing any pre-existing entries. when a merge happens, status info
|
||||
* read using the status_read function is written back to the status file
|
||||
*/
|
||||
static unsigned char status_parse(const char *line, const char **status_words)
|
||||
{
|
||||
unsigned char status_num;
|
||||
int i = 0;
|
||||
|
||||
while (status_words[i] != 0) {
|
||||
if (strncmp(line, status_words[i], strlen(status_words[i])) == 0) {
|
||||
status_num = (char)i;
|
||||
return(status_num);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
/* parse error */
|
||||
error_msg("Invalid status word");
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the buffered control file and parse it,
|
||||
* filling parsed fields into the package structure
|
||||
*/
|
||||
static int fill_package_struct(package_t *package, const char *package_buffer)
|
||||
{
|
||||
char *field = NULL;
|
||||
int field_start = 0;
|
||||
int field_length = 0;
|
||||
|
||||
while ((field = read_package_field(&package_buffer[field_start])) != NULL) {
|
||||
field_length = strlen(field);
|
||||
field_start += (field_length + 1);
|
||||
|
||||
if (strlen(field) == 0) {
|
||||
printf("empty line: *this shouldnt happen i dont think*\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* these are common to both installed and uninstalled packages */
|
||||
if (strstr(field, "Package: ") == field) {
|
||||
package->package = strdup(field + 9);
|
||||
}
|
||||
else if (strstr(field, "Depends: ") == field) {
|
||||
package->depends = strdup(field + 9);
|
||||
}
|
||||
else if (strstr(field, "Provides: ") == field) {
|
||||
package->provides = strdup(field + 10);
|
||||
}
|
||||
/* This is specific to the Debian Installer. Ifdef? */
|
||||
else if (strstr(field, "installer-menu-item: ") == field) {
|
||||
package->installer_menu_item = atoi(field + 21);
|
||||
}
|
||||
else if (strstr(field, "Description: ") == field) {
|
||||
package->description = strdup(field + 13);
|
||||
}
|
||||
else if (strstr(field, "Priority: ") == field) {
|
||||
package->priority = strdup(field + 10);
|
||||
}
|
||||
else if (strstr(field, "Section: ") == field) {
|
||||
package->section = strdup(field + 9);
|
||||
}
|
||||
else if (strstr(field, "Installed-Size: ") == field) {
|
||||
package->installed_size = strdup(field + 16);
|
||||
}
|
||||
else if (strstr(field, "Maintainer: ") == field) {
|
||||
package->maintainer = strdup(field + 12);
|
||||
}
|
||||
else if (strstr(field, "Version: ") == field) {
|
||||
package->version = strdup(field + 9);
|
||||
}
|
||||
else if (strstr(field, "Suggests: ") == field) {
|
||||
package->suggests = strdup(field + 10);
|
||||
}
|
||||
else if (strstr(field, "Recommends: ") == field) {
|
||||
package->recommends = strdup(field + 12);
|
||||
}
|
||||
/* else if (strstr(field, "Conffiles: ") == field) {
|
||||
package->conffiles = read_block(file);
|
||||
package->conffiles = xcalloc(1, 1);
|
||||
while ((field = strtok(NULL, "\n")) != NULL) {
|
||||
package->long_description = xrealloc(package->conffiles,
|
||||
strlen(package->conffiles) + strlen(field) + 1);
|
||||
strcat(package->conffiles, field);
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* These are only in available file */
|
||||
else if (strstr(field, "Architecture: ") == field) {
|
||||
package->architecture = strdup(field + 14);
|
||||
}
|
||||
else if (strstr(field, "Filename: ") == field) {
|
||||
package->filename = strdup(field + 10);
|
||||
}
|
||||
else if (strstr(field, "MD5sum ") == field) {
|
||||
package->md5sum = strdup(field + 7);
|
||||
}
|
||||
|
||||
/* This is only needed for status file */
|
||||
if (strstr(field, "Status: ") == field) {
|
||||
char *word_pointer;
|
||||
|
||||
word_pointer = strchr(field, ' ') + 1;
|
||||
package->state_want = status_parse(word_pointer, state_words_want);
|
||||
word_pointer = strchr(word_pointer, ' ') + 1;
|
||||
package->state_flag = status_parse(word_pointer, state_words_flag);
|
||||
word_pointer = strchr(word_pointer, ' ') + 1;
|
||||
package->state_status = status_parse(word_pointer, state_words_status);
|
||||
} else {
|
||||
package->state_want = status_parse("purge", state_words_want);
|
||||
package->state_flag = status_parse("ok", state_words_flag);
|
||||
package->state_status = status_parse("not-installed", state_words_status);
|
||||
}
|
||||
|
||||
free(field);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
extern void write_package(FILE *out_file, package_t *pkg)
|
||||
{
|
||||
if (pkg->package) {
|
||||
fprintf(out_file, "Package: %s\n", pkg->package);
|
||||
}
|
||||
if ((pkg->state_want != 0) || (pkg->state_flag != 0)|| (pkg->state_status != 0)) {
|
||||
fprintf(out_file, "Status: %s %s %s\n",
|
||||
state_words_want[pkg->state_want - 1],
|
||||
state_words_flag[pkg->state_flag - 1],
|
||||
state_words_status[pkg->state_status - 1]);
|
||||
}
|
||||
if (pkg->depends) {
|
||||
fprintf(out_file, "Depends: %s\n", pkg->depends);
|
||||
}
|
||||
if (pkg->provides) {
|
||||
fprintf(out_file, "Provides: %s\n", pkg->provides);
|
||||
}
|
||||
if (pkg->priority) {
|
||||
fprintf(out_file, "Priority: %s\n", pkg->priority);
|
||||
}
|
||||
if (pkg->section) {
|
||||
fprintf(out_file, "Section: %s\n", pkg->section);
|
||||
}
|
||||
if (pkg->section) {
|
||||
fprintf(out_file, "Installed-Size: %s\n", pkg->installed_size);
|
||||
}
|
||||
if (pkg->maintainer) {
|
||||
fprintf(out_file, "Maintainer: %s\n", pkg->maintainer);
|
||||
}
|
||||
if (pkg->source) {
|
||||
fprintf(out_file, "Source: %s\n", pkg->source);
|
||||
}
|
||||
if (pkg->version) {
|
||||
fprintf(out_file, "Version: %s\n", pkg->version);
|
||||
}
|
||||
if (pkg->pre_depends) {
|
||||
fprintf(out_file, "Pre-depends: %s\n", pkg->pre_depends);
|
||||
}
|
||||
if (pkg->replaces) {
|
||||
fprintf(out_file, "Replaces: %s\n", pkg->replaces);
|
||||
}
|
||||
if (pkg->recommends) {
|
||||
fprintf(out_file, "Recommends: %s\n", pkg->recommends);
|
||||
}
|
||||
if (pkg->suggests) {
|
||||
fprintf(out_file, "Suggests: %s\n", pkg->suggests);
|
||||
}
|
||||
if (pkg->conflicts) {
|
||||
fprintf(out_file, "Conflicts: %s\n", pkg->conflicts);
|
||||
}
|
||||
if (pkg->conffiles) {
|
||||
fprintf(out_file, "Conf-files: %s\n", pkg->conffiles);
|
||||
}
|
||||
if (pkg->architecture) {
|
||||
fprintf(out_file, "Architecture: %s\n", pkg->architecture);
|
||||
}
|
||||
if (pkg->filename) {
|
||||
fprintf(out_file, "Filename: %s\n", pkg->filename);
|
||||
}
|
||||
if (pkg->md5sum) {
|
||||
fprintf(out_file, "MD5sum: %s\n", pkg->md5sum);
|
||||
}
|
||||
if (pkg->installer_menu_item) {
|
||||
fprintf(out_file, "installer-main-menu %d\n", pkg->installer_menu_item);
|
||||
}
|
||||
if (pkg->description) {
|
||||
fprintf(out_file, "Description: %s\n", pkg->description);
|
||||
}
|
||||
fputc('\n', out_file);
|
||||
pkg = pkg->next;
|
||||
}
|
||||
|
||||
static void *status_read(void)
|
||||
{
|
||||
FILE *f;
|
||||
void *status = 0;
|
||||
package_t *m = 0, *p = 0, *t = 0;
|
||||
char *package_control_buffer = NULL;
|
||||
|
||||
if (getenv(udpkg_quiet) == NULL) {
|
||||
printf("(Reading database...)\n");
|
||||
}
|
||||
|
||||
if ((f = wfopen(statusfile, "r")) == NULL) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
while ( (package_control_buffer = fgets_str(f, "\n\n")) != NULL) {
|
||||
m = (package_t *)xcalloc(1, sizeof(package_t));
|
||||
fill_package_struct(m, package_control_buffer);
|
||||
if (m->package) {
|
||||
/*
|
||||
* If there is an item in the tree by this name,
|
||||
* it must be a virtual package; insert real
|
||||
* package in preference.
|
||||
*/
|
||||
tdelete(m, &status, package_compare);
|
||||
tsearch(m, &status, package_compare);
|
||||
if (m->provides) {
|
||||
/*
|
||||
* A "Provides" triggers the insertion
|
||||
* of a pseudo package into the status
|
||||
* binary-tree.
|
||||
*/
|
||||
p = (package_t *)xcalloc(1, sizeof(package_t));
|
||||
p->package = xstrdup(m->provides);
|
||||
t = *(package_t **)tsearch(p, &status, package_compare);
|
||||
if (t != p) {
|
||||
free(p->package);
|
||||
free(p);
|
||||
} else {
|
||||
/*
|
||||
* Pseudo package status is the
|
||||
* same as the status of the
|
||||
* package providing it
|
||||
* FIXME: (not quite right, if 2
|
||||
* packages of different statuses
|
||||
* provide it).
|
||||
*/
|
||||
t->state_want = m->state_want;
|
||||
t->state_flag = m->state_flag;
|
||||
t->state_status = m->state_status;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
free(m);
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
return status;
|
||||
}
|
||||
|
||||
static int status_merge(void *status, package_t *pkgs)
|
||||
{
|
||||
FILE *fin, *fout;
|
||||
char *line = NULL;
|
||||
package_t *pkg = 0, *statpkg = 0;
|
||||
package_t locpkg;
|
||||
|
||||
if ((fout = wfopen(new_statusfile, "w")) == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (getenv(udpkg_quiet) == NULL) {
|
||||
printf("(Updating database...)\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Dont use wfopen here, handle errors ourself
|
||||
*/
|
||||
if ((fin = fopen(statusfile, "r")) != NULL) {
|
||||
while (((line = get_line_from_file(fin)) != NULL) && !feof(fin)) {
|
||||
chomp(line); /* trim newline */
|
||||
/* If we see a package header, find out if it's a package
|
||||
* that we have processed. if so, we skip that block for
|
||||
* now (write it at the end).
|
||||
*
|
||||
* we also look at packages in the status cache and update
|
||||
* their status fields
|
||||
*/
|
||||
if (strstr(line, "Package: ") == line) {
|
||||
for (pkg = pkgs; pkg != 0 && strcmp(line + 9,
|
||||
pkg->package) != 0; pkg = pkg->next) ;
|
||||
|
||||
locpkg.package = line + 9;
|
||||
statpkg = tfind(&locpkg, &status, package_compare);
|
||||
|
||||
/* note: statpkg should be non-zero, unless the status
|
||||
* file was changed while we are processing (no locking
|
||||
* is currently done...
|
||||
*/
|
||||
if (statpkg != 0) {
|
||||
statpkg = *(package_t **)statpkg;
|
||||
}
|
||||
}
|
||||
if (pkg != 0) {
|
||||
continue;
|
||||
}
|
||||
if (strstr(line, "Status: ") == line && statpkg != 0) {
|
||||
snprintf(line, sizeof(line), "Status: %s %s %s",
|
||||
state_words_want[statpkg->state_want - 1],
|
||||
state_words_flag[statpkg->state_flag - 1],
|
||||
state_words_status[statpkg->state_status - 1]);
|
||||
}
|
||||
fprintf(fout, "%s\n", line);
|
||||
}
|
||||
fclose(fin);
|
||||
}
|
||||
free(line);
|
||||
|
||||
// Print out packages we processed.
|
||||
for (pkg = pkgs; pkg != 0; pkg = pkg->next) {
|
||||
write_package(fout, pkg);
|
||||
}
|
||||
fclose(fout);
|
||||
|
||||
/*
|
||||
* Its ok if renaming statusfile fails becasue it doesnt exist
|
||||
*/
|
||||
if (rename(statusfile, bak_statusfile) == -1) {
|
||||
struct stat stat_buf;
|
||||
if (stat(statusfile, &stat_buf) == 0) {
|
||||
error_msg("Couldnt create backup status file");
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
error_msg("No status file found, creating new one");
|
||||
}
|
||||
|
||||
if (rename(new_statusfile, statusfile) == -1) {
|
||||
error_msg("Couldnt create status file");
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
static int is_file(const char *fn)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
if (stat(fn, &statbuf) < 0) {
|
||||
return 0;
|
||||
}
|
||||
return S_ISREG(statbuf.st_mode);
|
||||
}
|
||||
|
||||
static int dpkg_doconfigure(package_t *pkg)
|
||||
{
|
||||
int r;
|
||||
char postinst[1024];
|
||||
char buf[1024];
|
||||
|
||||
DPRINTF("Configuring %s\n", pkg->package);
|
||||
pkg->state_status = 0;
|
||||
snprintf(postinst, sizeof(postinst), "%s%s.postinst", infodir, pkg->package);
|
||||
|
||||
if (is_file(postinst)) {
|
||||
snprintf(buf, sizeof(buf), "%s configure", postinst);
|
||||
if ((r = do_system(buf)) != 0) {
|
||||
error_msg("postinst exited with status %d\n", r);
|
||||
pkg->state_status = state_status_halfconfigured;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
pkg->state_status = state_status_installed;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dpkg_dounpack(package_t *pkg)
|
||||
{
|
||||
FILE *out_stream;
|
||||
char *info_prefix;
|
||||
int status = TRUE;
|
||||
int r = 0;
|
||||
|
||||
DPRINTF("Unpacking %s\n", pkg->package);
|
||||
|
||||
/* extract the data file */
|
||||
deb_extract(pkg->filename, stdout, (extract_data_tar_gz | extract_all_to_fs), "/", NULL);
|
||||
|
||||
/* extract the control files */
|
||||
info_prefix = (char *) malloc(strlen(pkg->package) + strlen(infodir) + 2 + 5 + 1);
|
||||
sprintf(info_prefix, "%s/%s.", infodir, pkg->package);
|
||||
deb_extract(pkg->package, stdout, (extract_control_tar_gz | extract_all_to_fs), info_prefix, NULL);
|
||||
|
||||
/* Create the list file */
|
||||
strcat(info_prefix, "list");
|
||||
out_stream = wfopen(info_prefix, "w");
|
||||
deb_extract(pkg->package, out_stream, (extract_data_tar_gz | extract_list), NULL, NULL);
|
||||
fclose(out_stream);
|
||||
|
||||
pkg->state_want = state_want_install;
|
||||
pkg->state_flag = state_flag_ok;
|
||||
|
||||
if (status == TRUE) {
|
||||
pkg->state_status = state_status_unpacked;
|
||||
} else {
|
||||
pkg->state_status = state_status_halfinstalled;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract and parse the control file from control.tar.gz
|
||||
*/
|
||||
static int dpkg_read_control(package_t *pkg)
|
||||
{
|
||||
FILE *pkg_file;
|
||||
char *control_buffer = NULL;
|
||||
|
||||
if ((pkg_file = wfopen(pkg->filename, "r")) == NULL) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
control_buffer = deb_extract(pkg->filename, stdout, (extract_control_tar_gz | extract_one_to_buffer), NULL, "./control");
|
||||
fill_package_struct(pkg, control_buffer);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
static int dpkg_unpack(package_t *pkgs, void *status)
|
||||
{
|
||||
int r = 0;
|
||||
package_t *pkg;
|
||||
|
||||
for (pkg = pkgs; pkg != 0; pkg = pkg->next) {
|
||||
dpkg_read_control(pkg);
|
||||
if ((r = dpkg_dounpack(pkg)) != 0 ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
status_merge(status, pkgs);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int dpkg_configure(package_t *pkgs, void *status)
|
||||
{
|
||||
int r = 0;
|
||||
void *found;
|
||||
package_t *pkg;
|
||||
|
||||
for (pkg = pkgs; pkg != 0 && r == 0; pkg = pkg->next) {
|
||||
found = tfind(pkg, &status, package_compare);
|
||||
|
||||
if (found == 0) {
|
||||
error_msg("Trying to configure %s, but it is not installed", pkg->package);
|
||||
r = 1;
|
||||
}
|
||||
/* configure the package listed in the status file;
|
||||
* not pkg, as we have info only for the latter
|
||||
*/
|
||||
else {
|
||||
r = dpkg_doconfigure(*(package_t **)found);
|
||||
}
|
||||
}
|
||||
status_merge(status, 0);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int dpkg_install(package_t *pkgs, void *status)
|
||||
{
|
||||
package_t *p, *ordered = 0;
|
||||
|
||||
/* Stage 1: parse all the control information */
|
||||
for (p = pkgs; p != 0; p = p->next) {
|
||||
dpkg_read_control(p);
|
||||
}
|
||||
|
||||
/* Stage 2: resolve dependencies */
|
||||
#ifdef DODEPENDS
|
||||
ordered = depends_resolve(pkgs, status);
|
||||
#else
|
||||
ordered = pkgs;
|
||||
#endif
|
||||
|
||||
/* Stage 3: install */
|
||||
for (p = ordered; p != 0; p = p->next) {
|
||||
p->state_want = state_want_install;
|
||||
|
||||
/* for now the flag is always set to ok... this is probably
|
||||
* not what we want
|
||||
*/
|
||||
p->state_flag = state_flag_ok;
|
||||
|
||||
DPRINTF("Installing %s\n", p->package);
|
||||
if (dpkg_dounpack(p) != 0) {
|
||||
perror_msg(p->filename);
|
||||
}
|
||||
|
||||
if (dpkg_doconfigure(p) != 0) {
|
||||
perror_msg(p->filename);
|
||||
}
|
||||
}
|
||||
|
||||
if (ordered != 0) {
|
||||
status_merge(status, pkgs);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Not implemented yet
|
||||
*
|
||||
static int dpkg_remove(package_t *pkgs, void *status)
|
||||
{
|
||||
package_t *p;
|
||||
|
||||
for (p = pkgs; p != 0; p = p->next)
|
||||
{
|
||||
}
|
||||
status_merge(status, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
extern int dpkg_main(int argc, char **argv)
|
||||
{
|
||||
const int arg_install = 1;
|
||||
const int arg_unpack = 2;
|
||||
const int arg_configure = 4;
|
||||
|
||||
package_t *p, *packages = NULL;
|
||||
void *status = NULL;
|
||||
int opt = 0;
|
||||
int optflag = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "iruc")) != -1) {
|
||||
switch (opt) {
|
||||
case 'i':
|
||||
optflag |= arg_install;
|
||||
break;
|
||||
case 'u':
|
||||
optflag |= arg_unpack;
|
||||
break;
|
||||
case 'c':
|
||||
optflag |= arg_configure;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
while (optind < argc) {
|
||||
p = (package_t *) xcalloc(1, sizeof(package_t));
|
||||
if (optflag & arg_configure) {
|
||||
p->package = xstrdup(argv[optind]);
|
||||
} else {
|
||||
p->filename = xstrdup(argv[optind]);
|
||||
}
|
||||
p->next = packages;
|
||||
packages = p;
|
||||
|
||||
optind++;
|
||||
}
|
||||
|
||||
make_directory((char *)infodir, S_IRWXU, FILEUTILS_RECUR);
|
||||
|
||||
status = status_read();
|
||||
|
||||
if (optflag & arg_install) {
|
||||
return dpkg_install(packages, status);
|
||||
}
|
||||
else if (optflag & arg_unpack) {
|
||||
return dpkg_unpack(packages, status);
|
||||
}
|
||||
else if (optflag & arg_configure) {
|
||||
return dpkg_configure(packages, status);
|
||||
}
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int dpkg_deb_main(int argc, char **argv)
|
||||
{
|
||||
char *prefix = NULL;
|
||||
char *filename = NULL;
|
||||
char *output_buffer = NULL;
|
||||
int opt = 0;
|
||||
int arg_type = 0;
|
||||
int deb_extract_funct = extract_create_leading_dirs | extract_unconditional;
|
||||
|
||||
const int arg_type_prefix = 1;
|
||||
const int arg_type_field = 2;
|
||||
const int arg_type_filename = 4;
|
||||
// const int arg_type_un_ar_gz = 8;
|
||||
|
||||
while ((opt = getopt(argc, argv, "ceftXxI")) != -1) {
|
||||
switch (opt) {
|
||||
case 'c':
|
||||
deb_extract_funct |= extract_data_tar_gz;
|
||||
deb_extract_funct |= extract_verbose_list;
|
||||
break;
|
||||
case 'e':
|
||||
arg_type = arg_type_prefix;
|
||||
deb_extract_funct |= extract_control_tar_gz;
|
||||
deb_extract_funct |= extract_all_to_fs;
|
||||
break;
|
||||
case 'f':
|
||||
arg_type = arg_type_field;
|
||||
deb_extract_funct |= extract_control_tar_gz;
|
||||
deb_extract_funct |= extract_one_to_buffer;
|
||||
filename = xstrdup("./control");
|
||||
break;
|
||||
case 't': /* --fsys-tarfile, i just made up this short name */
|
||||
/* Integrate the functionality needed with some code from ar.c */
|
||||
error_msg_and_die("Option disabled");
|
||||
// arg_type = arg_type_un_ar_gz;
|
||||
break;
|
||||
case 'X':
|
||||
arg_type = arg_type_prefix;
|
||||
deb_extract_funct |= extract_data_tar_gz;
|
||||
deb_extract_funct |= extract_all_to_fs;
|
||||
deb_extract_funct |= extract_list;
|
||||
case 'x':
|
||||
arg_type = arg_type_prefix;
|
||||
deb_extract_funct |= extract_data_tar_gz;
|
||||
deb_extract_funct |= extract_all_to_fs;
|
||||
break;
|
||||
case 'I':
|
||||
arg_type = arg_type_filename;
|
||||
deb_extract_funct |= extract_control_tar_gz;
|
||||
deb_extract_funct |= extract_one_to_buffer;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (optind == argc) {
|
||||
show_usage();
|
||||
}
|
||||
|
||||
/* Workout where to extract the files */
|
||||
if (arg_type == arg_type_prefix) {
|
||||
/* argument is a dir name */
|
||||
if ((optind + 1) == argc ) {
|
||||
prefix = xstrdup("./DEBIAN/");
|
||||
} else {
|
||||
prefix = (char *) xmalloc(strlen(argv[optind + 1]) + 2);
|
||||
strcpy(prefix, argv[optind + 1]);
|
||||
/* Make sure the directory has a trailing '/' */
|
||||
if (last_char_is(prefix, '/') == NULL) {
|
||||
strcat(prefix, "/");
|
||||
}
|
||||
}
|
||||
mkdir(prefix, 0777);
|
||||
}
|
||||
|
||||
if (arg_type == arg_type_filename) {
|
||||
if ((optind + 1) != argc) {
|
||||
filename = xstrdup(argv[optind + 1]);
|
||||
} else {
|
||||
error_msg_and_die("-I currently requires a filename to be specified");
|
||||
}
|
||||
}
|
||||
|
||||
output_buffer = deb_extract(argv[optind], stdout, deb_extract_funct, prefix, filename);
|
||||
|
||||
if ((arg_type == arg_type_filename) && (output_buffer != NULL)) {
|
||||
puts(output_buffer);
|
||||
}
|
||||
else if (arg_type == arg_type_field) {
|
||||
char *field = NULL;
|
||||
int field_start = 0;
|
||||
|
||||
while ((field = read_package_field(&output_buffer[field_start])) != NULL) {
|
||||
field_start += (strlen(field) + 1);
|
||||
if (strstr(field, argv[optind + 1]) == field) {
|
||||
puts(field + strlen(argv[optind + 1]) + 2);
|
||||
}
|
||||
free(field);
|
||||
}
|
||||
}
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
+115
-2255
File diff suppressed because it is too large.
Load diff
+370
-1221
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,92 @@
|
||||
/* 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 "busybox.h"
|
||||
#include <netinet/in.h> /* For ntohl & htonl function */
|
||||
#include <string.h>
|
||||
|
||||
#define RPM_MAGIC "\355\253\356\333"
|
||||
#define RPM_HEADER_MAGIC "\216\255\350"
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
|
||||
struct rpm_lead {
|
||||
unsigned char magic[4];
|
||||
u8 major, minor;
|
||||
u16 type;
|
||||
u16 archnum;
|
||||
char name[66];
|
||||
u16 osnum;
|
||||
u16 signature_type;
|
||||
char reserved[16];
|
||||
};
|
||||
|
||||
struct rpm_header {
|
||||
char magic[3]; /* 3 byte magic: 0x8e 0xad 0xe8 */
|
||||
u8 version; /* 1 byte version number */
|
||||
u32 reserved; /* 4 bytes reserved */
|
||||
u32 entries; /* Number of entries in header (4 bytes) */
|
||||
u32 size; /* Size of store (4 bytes) */
|
||||
};
|
||||
|
||||
void skip_header(FILE *rpmfile)
|
||||
{
|
||||
struct rpm_header header;
|
||||
|
||||
fread(&header, sizeof(struct rpm_header), 1, rpmfile);
|
||||
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);
|
||||
fseek (rpmfile, 16 * header.entries, SEEK_CUR); /* Seek past index entries */
|
||||
fseek (rpmfile, header.size, SEEK_CUR); /* Seek past store */
|
||||
}
|
||||
|
||||
/* No getopt required */
|
||||
extern int rpm2cpio_main(int argc, char **argv)
|
||||
{
|
||||
struct rpm_lead lead;
|
||||
int gunzip_pid;
|
||||
FILE *rpmfile, *cpiofile;
|
||||
|
||||
if (argc == 1) {
|
||||
rpmfile = stdin;
|
||||
} else {
|
||||
rpmfile = fopen(argv[1], "r");
|
||||
if (!rpmfile) perror_msg_and_die("Can't open rpm file");
|
||||
}
|
||||
|
||||
fread (&lead, sizeof(struct rpm_lead), 1, rpmfile);
|
||||
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(rpmfile);
|
||||
fseek(rpmfile, (8 - (ftell(rpmfile) % 8)) % 8, SEEK_CUR); /* Pad to 8 byte boundary */
|
||||
/* Skip the main header */
|
||||
skip_header(rpmfile);
|
||||
|
||||
cpiofile = gz_open(rpmfile, &gunzip_pid);
|
||||
copyfd(fileno(cpiofile), fileno(stdout));
|
||||
gz_close(gunzip_pid);
|
||||
fclose(rpmfile);
|
||||
return 0;
|
||||
}
|
||||
+1007
-1149
File diff suppressed because it is too large.
Load diff
+21
-9
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Mini basename implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* 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
|
||||
@@ -21,20 +21,32 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
/* getopt not needed */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
#include <string.h>
|
||||
|
||||
extern int basename_main(int argc, char **argv)
|
||||
{
|
||||
char* s;
|
||||
int m, n;
|
||||
char *s;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage("basename [file ...]\n");
|
||||
show_usage();
|
||||
}
|
||||
|
||||
argv++;
|
||||
|
||||
s = strrchr(*argv, '/');
|
||||
printf("%s\n", (s)? s + 1 : *argv);
|
||||
exit(TRUE);
|
||||
}
|
||||
s = get_last_path_component(*argv);
|
||||
|
||||
if (argc>2) {
|
||||
argv++;
|
||||
n = strlen(*argv);
|
||||
m = strlen(s);
|
||||
if (m>=n && strncmp(s+m-n, *argv, n)==0)
|
||||
s[m-n] = '\0';
|
||||
}
|
||||
puts(s);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1,366 +1,146 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef BB_INIT
|
||||
#undef BB_FEATURE_LINUXRC
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
#ifdef BB_LOCALE_SUPPORT
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
static int been_there_done_that = 0;
|
||||
int been_there_done_that = 0; /* Also used in applets.c */
|
||||
const char *applet_name;
|
||||
|
||||
/* It has been alledged that doing such things can
|
||||
* help reduce binary size when staticly linking,
|
||||
* of course with glibc, this is unlikely as long
|
||||
* as we use things like printf -- perhaps a printf
|
||||
* replacement may be in order
|
||||
#ifdef BB_FEATURE_INSTALLER
|
||||
/*
|
||||
* directory table
|
||||
* this should be consistent w/ the enum, busybox.h::Location,
|
||||
* or else...
|
||||
*/
|
||||
#if 0
|
||||
void exit(int status) __attribute__ ((noreturn));
|
||||
void exit(int status)
|
||||
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()
|
||||
{
|
||||
_exit(status);
|
||||
};
|
||||
void abort(void) __attribute__ ((__noreturn__));
|
||||
void abort(void)
|
||||
return xreadlink("/proc/self/exe");
|
||||
}
|
||||
|
||||
/* create (sym)links for each applet */
|
||||
static void install_links(const char *busybox, int use_symbolic_links)
|
||||
{
|
||||
_exit(0);
|
||||
};
|
||||
int atexit(void (*__func) (void))
|
||||
{
|
||||
_exit(0);
|
||||
};
|
||||
void *__libc_stack_end;
|
||||
#endif
|
||||
__link_f Link = link;
|
||||
|
||||
char *fpc;
|
||||
int i;
|
||||
int rc;
|
||||
|
||||
static const struct Applet applets[] = {
|
||||
|
||||
#ifdef BB_BASENAME //usr/bin/basename
|
||||
{"basename", basename_main},
|
||||
#endif
|
||||
#ifdef BB_BUSYBOX //bin
|
||||
{"busybox", busybox_main},
|
||||
#endif
|
||||
#ifdef BB_BLOCK_DEVICE //sbin
|
||||
{"block_device", block_device_main},
|
||||
#endif
|
||||
#ifdef BB_CAT //bin
|
||||
{"cat", cat_main},
|
||||
#endif
|
||||
#ifdef BB_CHMOD_CHOWN_CHGRP //bin
|
||||
{"chmod", chmod_chown_chgrp_main},
|
||||
{"chown", chmod_chown_chgrp_main},
|
||||
{"chgrp", chmod_chown_chgrp_main},
|
||||
#endif
|
||||
#ifdef BB_CHROOT //sbin
|
||||
{"chroot", chroot_main},
|
||||
#endif
|
||||
#ifdef BB_CLEAR //usr/bin
|
||||
{"clear", clear_main},
|
||||
#endif
|
||||
#ifdef BB_CHVT //usr/bin
|
||||
{"chvt", chvt_main},
|
||||
#endif
|
||||
#ifdef BB_CP_MV //bin
|
||||
{"cp", cp_mv_main},
|
||||
{"mv", cp_mv_main},
|
||||
#endif
|
||||
#ifdef BB_DATE //bin
|
||||
{"date", date_main},
|
||||
#endif
|
||||
#ifdef BB_DD //bin
|
||||
{"dd", dd_main},
|
||||
#endif
|
||||
#ifdef BB_DF //bin
|
||||
{"df", df_main},
|
||||
#endif
|
||||
#ifdef BB_DIRNAME //usr/bin
|
||||
{"dirname", dirname_main},
|
||||
#endif
|
||||
#ifdef BB_DMESG //bin
|
||||
{"dmesg", dmesg_main},
|
||||
#endif
|
||||
#ifdef BB_DU //bin
|
||||
{"du", du_main},
|
||||
#endif
|
||||
#ifdef BB_DUTMP //usr/sbin
|
||||
{"dutmp", dutmp_main},
|
||||
#endif
|
||||
#ifdef BB_FBSET //usr/sbin
|
||||
{"fbset", fbset_main},
|
||||
#endif
|
||||
#ifdef BB_FDFLUSH //bin
|
||||
{"fdflush", fdflush_main},
|
||||
#endif
|
||||
#ifdef BB_FIND //usr/bin
|
||||
{"find", find_main},
|
||||
#endif
|
||||
#ifdef BB_FREE //usr/bin
|
||||
{"free", free_main},
|
||||
#endif
|
||||
#ifdef BB_FREERAMDISK //sbin
|
||||
{"freeramdisk", freeramdisk_main},
|
||||
#endif
|
||||
#ifdef BB_DEALLOCVT //usr/bin
|
||||
{"deallocvt", deallocvt_main},
|
||||
#endif
|
||||
#ifdef BB_FSCK_MINIX //sbin
|
||||
{"fsck.minix", fsck_minix_main},
|
||||
#endif
|
||||
#ifdef BB_MKFS_MINIX //sbin
|
||||
{"mkfs.minix", mkfs_minix_main},
|
||||
#endif
|
||||
#ifdef BB_GREP //bin
|
||||
{"grep", grep_main},
|
||||
#endif
|
||||
#ifdef BB_HALT //sbin
|
||||
{"halt", halt_main},
|
||||
#endif
|
||||
#ifdef BB_HEAD //bin
|
||||
{"head", head_main},
|
||||
#endif
|
||||
#ifdef BB_HOSTID //usr/bin
|
||||
{"hostid", hostid_main},
|
||||
#endif
|
||||
#ifdef BB_HOSTNAME //bin
|
||||
{"hostname", hostname_main},
|
||||
#endif
|
||||
#ifdef BB_INIT //sbin
|
||||
{"init", init_main},
|
||||
#endif
|
||||
#ifdef BB_INSMOD //sbin
|
||||
{"insmod", insmod_main},
|
||||
#endif
|
||||
#ifdef BB_FEATURE_LINUXRC //
|
||||
{"linuxrc", init_main},
|
||||
#endif
|
||||
#ifdef BB_KILL //bin
|
||||
{"kill", kill_main},
|
||||
#endif
|
||||
#ifdef BB_KILLALL //usr/bin
|
||||
{"killall", kill_main},
|
||||
#endif
|
||||
#ifdef BB_LENGTH //usr/bin
|
||||
{"length", length_main},
|
||||
#endif
|
||||
#ifdef BB_LN //bin
|
||||
{"ln", ln_main},
|
||||
#endif
|
||||
#ifdef BB_LOADACM //usr/bin
|
||||
{"loadacm", loadacm_main},
|
||||
#endif
|
||||
#ifdef BB_LOADFONT //usr/bin
|
||||
{"loadfont", loadfont_main},
|
||||
#endif
|
||||
#ifdef BB_LOADKMAP //sbin
|
||||
{"loadkmap", loadkmap_main},
|
||||
#endif
|
||||
#ifdef BB_LS //bin
|
||||
{"ls", ls_main},
|
||||
#endif
|
||||
#ifdef BB_LSMOD //sbin
|
||||
{"lsmod", lsmod_main},
|
||||
#endif
|
||||
#ifdef BB_MAKEDEVS //sbin
|
||||
{"makedevs", makedevs_main},
|
||||
#endif
|
||||
#ifdef BB_MATH //usr/bin
|
||||
{"math", math_main},
|
||||
#endif
|
||||
#ifdef BB_MKDIR //bin
|
||||
{"mkdir", mkdir_main},
|
||||
#endif
|
||||
#ifdef BB_MKFIFO //usr/bin
|
||||
{"mkfifo", mkfifo_main},
|
||||
#endif
|
||||
#ifdef BB_MKNOD //bin
|
||||
{"mknod", mknod_main},
|
||||
#endif
|
||||
#ifdef BB_MKSWAP //sbin
|
||||
{"mkswap", mkswap_main},
|
||||
#endif
|
||||
#ifdef BB_MNC //usr/bin
|
||||
{"mnc", mnc_main},
|
||||
#endif
|
||||
#ifdef BB_MORE //bin
|
||||
{"more", more_main},
|
||||
#endif
|
||||
#ifdef BB_MOUNT //bin
|
||||
{"mount", mount_main},
|
||||
#endif
|
||||
#ifdef BB_MT //bin
|
||||
{"mt", mt_main},
|
||||
#endif
|
||||
#ifdef BB_NSLOOKUP //usr/bin
|
||||
{"nslookup", nslookup_main},
|
||||
#endif
|
||||
#ifdef BB_PING //bin
|
||||
{"ping", ping_main},
|
||||
#endif
|
||||
#ifdef BB_POWEROFF //sbin
|
||||
{"poweroff", poweroff_main},
|
||||
#endif
|
||||
#ifdef BB_PRINTF //usr/bin
|
||||
{"printf", printf_main},
|
||||
#endif
|
||||
#ifdef BB_PS //bin
|
||||
{"ps", ps_main},
|
||||
#endif
|
||||
#ifdef BB_PWD //bin
|
||||
{"pwd", pwd_main},
|
||||
#endif
|
||||
#ifdef BB_REBOOT //sbin
|
||||
{"reboot", reboot_main},
|
||||
#endif
|
||||
#ifdef BB_RM //bin
|
||||
{"rm", rm_main},
|
||||
#endif
|
||||
#ifdef BB_RMDIR //bin
|
||||
{"rmdir", rmdir_main},
|
||||
#endif
|
||||
#ifdef BB_RMMOD //sbin
|
||||
{"rmmod", rmmod_main},
|
||||
#endif
|
||||
#ifdef BB_SFDISK //sbin
|
||||
{"fdisk", sfdisk_main},
|
||||
{"sfdisk", sfdisk_main},
|
||||
#endif
|
||||
#ifdef BB_SED //bin
|
||||
{"sed", sed_main},
|
||||
#endif
|
||||
#ifdef BB_SLEEP //bin
|
||||
{"sleep", sleep_main},
|
||||
#endif
|
||||
#ifdef BB_SORT //bin
|
||||
{"sort", sort_main},
|
||||
#endif
|
||||
#ifdef BB_SYNC //bin
|
||||
{"sync", sync_main},
|
||||
#endif
|
||||
#ifdef BB_SYSLOGD //sbin
|
||||
{"syslogd", syslogd_main},
|
||||
#endif
|
||||
#ifdef BB_LOGGER //usr/bin
|
||||
{"logger", logger_main},
|
||||
#endif
|
||||
#ifdef BB_LOGNAME //usr/bin
|
||||
{"logname", logname_main},
|
||||
#endif
|
||||
#ifdef BB_SWAPONOFF //sbin
|
||||
{"swapon", swap_on_off_main},
|
||||
{"swapoff", swap_on_off_main},
|
||||
#endif
|
||||
#ifdef BB_TAIL //usr/bin
|
||||
{"tail", tail_main},
|
||||
#endif
|
||||
#ifdef BB_TAR //bin
|
||||
{"tar", tar_main},
|
||||
#endif
|
||||
#ifdef BB_TELNET //usr/bin
|
||||
{"telnet", telnet_main},
|
||||
#endif
|
||||
#ifdef BB_TEE //bin
|
||||
{"tee", tee_main},
|
||||
#endif
|
||||
#ifdef BB_TOUCH //usr/bin
|
||||
{"touch", touch_main},
|
||||
#endif
|
||||
#ifdef BB_TR //usr/bin
|
||||
{"tr", tr_main},
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE //bin
|
||||
{"true", true_main},
|
||||
{"false", false_main},
|
||||
#endif
|
||||
#ifdef BB_TTY //usr/bin
|
||||
{"tty", tty_main},
|
||||
#endif
|
||||
#ifdef BB_UMOUNT //bin
|
||||
{"umount", umount_main},
|
||||
#endif
|
||||
#ifdef BB_UNAME //bin
|
||||
{"uname", uname_main},
|
||||
#endif
|
||||
#ifdef BB_UPTIME //usr/bin
|
||||
{"uptime", uptime_main},
|
||||
#endif
|
||||
#ifdef BB_UNIQ //bin
|
||||
{"uniq", uniq_main},
|
||||
#endif
|
||||
#ifdef BB_UPDATE //sbin
|
||||
{"update", update_main},
|
||||
#endif
|
||||
#ifdef BB_WC //usr/bin
|
||||
{"wc", wc_main},
|
||||
#endif
|
||||
#ifdef BB_WHOAMI //usr/bin
|
||||
{"whoami", whoami_main},
|
||||
#endif
|
||||
#ifdef BB_YES //usr/bin
|
||||
{"yes", yes_main},
|
||||
#endif
|
||||
#ifdef BB_GUNZIP //bin
|
||||
{"zcat", gunzip_main},
|
||||
{"gunzip", gunzip_main},
|
||||
#endif
|
||||
#ifdef BB_GZIP //bin
|
||||
{"gzip", gzip_main},
|
||||
#endif
|
||||
{0}
|
||||
};
|
||||
if (use_symbolic_links)
|
||||
Link = symlink;
|
||||
|
||||
for (i = 0; applets[i].name != NULL; i++) {
|
||||
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 */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *s = argv[0];
|
||||
char *name = argv[0];
|
||||
const struct Applet *a = applets;
|
||||
const char *s;
|
||||
|
||||
while (*s != '\0') {
|
||||
for (s = applet_name = argv[0]; *s != '\0';) {
|
||||
if (*s++ == '/')
|
||||
name = s;
|
||||
applet_name = s;
|
||||
}
|
||||
|
||||
*argv = name;
|
||||
|
||||
while (a->name != 0) {
|
||||
if (strcmp(name, a->name) == 0) {
|
||||
int status;
|
||||
|
||||
status = ((*(a->main)) (argc, argv));
|
||||
if (status < 0) {
|
||||
fprintf(stderr, "%s: %s\n", a->name, strerror(errno));
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
exit(status);
|
||||
}
|
||||
a++;
|
||||
/* Add in a special case hack for a leading hyphen */
|
||||
if (**argv == '-' && *(*argv+1)!= '-') {
|
||||
applet_name = (*argv+1);
|
||||
}
|
||||
exit(busybox_main(argc, argv));
|
||||
|
||||
#ifdef BB_LOCALE_SUPPORT
|
||||
#ifdef BB_INIT
|
||||
if(getpid()!=1) /* Do not set locale for `init' */
|
||||
#endif
|
||||
{
|
||||
setlocale(LC_ALL, "");
|
||||
}
|
||||
#endif
|
||||
|
||||
run_applet_by_name(applet_name, argc, argv);
|
||||
error_msg_and_die("applet not found");
|
||||
}
|
||||
|
||||
|
||||
int busybox_main(int argc, char **argv)
|
||||
{
|
||||
int col = 0;
|
||||
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--;
|
||||
argv++;
|
||||
|
||||
/* If we've already been here once, exit now */
|
||||
if (been_there_done_that == 1 || argc < 1) {
|
||||
const struct Applet *a = applets;
|
||||
const struct BB_applet *a = applets;
|
||||
|
||||
fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
|
||||
BB_VER, BB_BT);
|
||||
fprintf(stderr, "Usage: busybox [function] [arguments]...\n");
|
||||
fprintf(stderr, " or: [function] [arguments]...\n\n");
|
||||
fprintf(stderr,
|
||||
"\tMost people will create a link to busybox for each\n"
|
||||
"\tfunction name, and busybox will act like whatever you invoke it as.\n");
|
||||
fprintf(stderr, "\nCurrently defined functions:\n");
|
||||
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 +=
|
||||
@@ -372,12 +152,24 @@ int busybox_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n\n");
|
||||
exit(-1);
|
||||
} else {
|
||||
/* If we've already been here once, exit now */
|
||||
been_there_done_that = 1;
|
||||
return (main(argc, argv));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* 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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
-181
@@ -1,181 +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_BASENAME
|
||||
#define BB_CAT
|
||||
#define BB_CHMOD_CHOWN_CHGRP
|
||||
#define BB_CHROOT
|
||||
#define BB_CHVT
|
||||
#define BB_CLEAR
|
||||
#define BB_CP_MV
|
||||
#define BB_DATE
|
||||
#define BB_DD
|
||||
#define BB_DEALLOCVT
|
||||
#define BB_DF
|
||||
#define BB_DIRNAME
|
||||
#define BB_DMESG
|
||||
//#define BB_DUTMP
|
||||
#define BB_DU
|
||||
#define BB_FBSET
|
||||
//#define BB_FDFLUSH
|
||||
#define BB_FIND
|
||||
#define BB_FREE
|
||||
#define BB_FREERAMDISK
|
||||
#define BB_FSCK_MINIX
|
||||
#define BB_GREP
|
||||
#define BB_GUNZIP
|
||||
#define BB_GZIP
|
||||
//#define BB_HALT
|
||||
#define BB_HEAD
|
||||
//#define BB_HOSTID
|
||||
#define BB_HOSTNAME
|
||||
#define BB_INIT
|
||||
// Don't turn BB_INSMOD on. It doesn't work.
|
||||
//#define BB_INSMOD
|
||||
#define BB_KILL
|
||||
#ifdef BB_KILL
|
||||
#define BB_KILLALL
|
||||
#endif
|
||||
#define BB_KLOGD
|
||||
//#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_MKFS_MINIX
|
||||
//#define BB_MATH
|
||||
#define BB_MKDIR
|
||||
//#define BB_MKFIFO
|
||||
#define BB_MKNOD
|
||||
#define BB_MKSWAP
|
||||
//#define BB_MNC
|
||||
#define BB_MORE
|
||||
#define BB_MOUNT
|
||||
#define BB_NFSMOUNT
|
||||
//#define BB_MT
|
||||
#define BB_NSLOOKUP
|
||||
#define BB_PING
|
||||
#define BB_POWEROFF
|
||||
//#define BB_PRINTF
|
||||
#define BB_PS
|
||||
#define BB_PWD
|
||||
#define BB_REBOOT
|
||||
#define BB_REGEXP
|
||||
#define BB_RM
|
||||
#define BB_RMDIR
|
||||
//#define BB_RMMOD
|
||||
#define BB_SED
|
||||
//#define BB_SFDISK
|
||||
#define BB_SLEEP
|
||||
#define BB_SORT
|
||||
#define BB_SWAPONOFF
|
||||
#define BB_SYNC
|
||||
#define BB_SYSLOGD
|
||||
#define BB_TAIL
|
||||
#define BB_TAR
|
||||
#define BB_TEE
|
||||
// Don't turn BB_TELNET on. It doesn't work.
|
||||
#define BB_TELNET
|
||||
#define BB_TOUCH
|
||||
#define BB_TR
|
||||
#define BB_TRUE_FALSE
|
||||
#define BB_TTY
|
||||
#define BB_UPTIME
|
||||
#define BB_WC
|
||||
#define BB_WHOAMI
|
||||
#define BB_UMOUNT
|
||||
#define BB_UNIQ
|
||||
#define BB_UNAME
|
||||
#define BB_UPDATE
|
||||
#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, devmtab,
|
||||
// etc. kernel drivers, thereby eliminating the need for
|
||||
// the /proc filesystem and thereby saving lots and lots
|
||||
// memory for more important things.
|
||||
// You can't use this and USE_PROCFS at the same time...
|
||||
//#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 DEVPS_N_DEVMTAB at the same time...
|
||||
#define BB_FEATURE_USE_PROCFS
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Change ping implementation -- simplified, featureless, but really small.
|
||||
//#define BB_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
|
||||
//
|
||||
//
|
||||
//Simple tail implementation (2k vs 6k for the full one). Still
|
||||
//provides 'tail -f' support -- but for 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
|
||||
#ifdef BB_MOUNT
|
||||
//#define BB_MTAB
|
||||
#endif
|
||||
//
|
||||
//
|
||||
// Enable support for remounting filesystems
|
||||
#define BB_FEATURE_REMOUNT
|
||||
//
|
||||
// Enable support for creation of tar files.
|
||||
//#define BB_FEATURE_TAR_CREATE
|
||||
//
|
||||
//// Enable reverse sort
|
||||
//#define BB_FEATURE_SORT_REVERSE
|
||||
//
|
||||
// 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
|
||||
#ifdef BB_MOUNT
|
||||
//#define BB_FEATURE_INIT_CHROOT
|
||||
#endif
|
||||
//
|
||||
//Make sure nothing is printed to the console on boot
|
||||
#define BB_FEATURE_EXTRA_QUIET
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/* 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>
|
||||
|
||||
#define BB_BANNER "BusyBox v" BB_VER " (" BB_BT ")"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
|
||||
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;
|
||||
};
|
||||
/* 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
|
||||
|
||||
#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
|
||||
#ifdef BB_FEATURE_BUFFERS_GO_IN_BSS
|
||||
#define RESERVE_BB_BUFFER(buffer,len) static char buffer[len]
|
||||
#define RESERVE_BB_UBUFFER(buffer,len) static 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
|
||||
|
||||
|
||||
/* 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
|
||||
|
||||
#ifndef RB_POWER_OFF
|
||||
/* Stop system and switch power off if possible. */
|
||||
#define RB_POWER_OFF 0x4321fedc
|
||||
#endif
|
||||
|
||||
|
||||
/* Pull in the utility routines from libbb */
|
||||
#include "libbb/libbb.h"
|
||||
|
||||
|
||||
|
||||
#endif /* _BB_INTERNAL_H_ */
|
||||
+19
-10
@@ -1,15 +1,24 @@
|
||||
#!/bin/sh
|
||||
# Make busybox links list file.
|
||||
|
||||
DF="busybox.def.h"
|
||||
MF="busybox.c"
|
||||
# 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
|
||||
|
||||
LIST="$(sed -n '/^#define/{s/^#define //p;}' $DF)"
|
||||
# Maintainer: Larry Doolittle <ldoolitt@recycle.lbl.gov>
|
||||
|
||||
for def in ${LIST}; do
|
||||
i=`sed -n 's/^#ifdef \<'$def'\>.*\/\/\(.*$\)/\/\1\//gp' $MF`
|
||||
j=`sed -n '/^#ifdef \<'$def'\>.*/,/^#endif/{ s/.*\"\(.*\)\".*/\1/gp; }' $MF`
|
||||
for k in $j; do
|
||||
echo $i$k
|
||||
done
|
||||
done
|
||||
export LC_ALL=POSIX
|
||||
export LC_CTYPE=POSIX
|
||||
|
||||
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
|
||||
}'
|
||||
+14
-2
@@ -1,4 +1,16 @@
|
||||
#!/bin/sh
|
||||
ls -1 `sed -n '/^#define/{s/.*BB_// ; s/$/.c/p; }' busybox.def.h | \
|
||||
tr [:upper:] [:lower:]` 2> /dev/null | sed -e 's/\.c$/\.o/g'
|
||||
|
||||
export LC_ALL=POSIX
|
||||
export LC_CTYPE=POSIX
|
||||
|
||||
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
|
||||
if [ -d "$BB_SRC_DIR" ]; then cd $BB_SRC_DIR; fi
|
||||
# By running $RAW through "ls", we avoid listing
|
||||
# source files that don't exist.
|
||||
ls $RAW 2>/dev/null | tr '\n' ' '
|
||||
|
||||
+8
-7
@@ -1,5 +1,5 @@
|
||||
Name: busybox
|
||||
Version: 0.43
|
||||
Version: 0.52
|
||||
Release: 1
|
||||
Group: System/Utilities
|
||||
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
|
||||
@@ -10,12 +10,13 @@ Buildroot: /tmp/%{Name}-%{Version}
|
||||
Source: %{Name}-%{Version}.tar.gz
|
||||
|
||||
%Description
|
||||
BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It
|
||||
provides a pretty complete POSIX environment in a very small package.
|
||||
Just add a kernel, "ash" (Keith Almquists tiny Bourne shell clone), and
|
||||
an editor such as "elvis-tiny" or "ae", and you have a full system. This
|
||||
is makes an excellent environment for a "rescue" disk or any small or
|
||||
embedded system.
|
||||
BusyBox combines tiny versions of many common UNIX utilities into a single
|
||||
small executable. It provides minimalist replacements for most of the utilities
|
||||
you usually find in 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}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Mini Cat implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* 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
|
||||
@@ -21,43 +21,27 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static void print_file(FILE * file)
|
||||
{
|
||||
int c;
|
||||
|
||||
while ((c = getc(file)) != EOF)
|
||||
putc(c, stdout);
|
||||
fclose(file);
|
||||
fflush(stdout);
|
||||
}
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int cat_main(int argc, char **argv)
|
||||
{
|
||||
FILE *file;
|
||||
int status = EXIT_SUCCESS;
|
||||
|
||||
if (argc == 1) {
|
||||
print_file(stdin);
|
||||
exit(TRUE);
|
||||
return status;
|
||||
}
|
||||
|
||||
if (**(argv + 1) == '-') {
|
||||
usage("cat [file ...]\n");
|
||||
}
|
||||
argc--;
|
||||
|
||||
while (argc-- > 0 && *(argv++) != '\0' && strlen(*argv)) {
|
||||
file = fopen(*argv, "r");
|
||||
if (file == NULL) {
|
||||
perror(*argv);
|
||||
exit(FALSE);
|
||||
while (--argc > 0) {
|
||||
if(!(strcmp(*++argv, "-"))) {
|
||||
print_file(stdin);
|
||||
} else if (print_file_by_name(*argv) == FALSE) {
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
print_file(file);
|
||||
}
|
||||
exit(TRUE);
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/* 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 <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) == FALSE) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -0,0 +1,85 @@
|
||||
/* 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 <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("internal error");
|
||||
if (chmod(fileName, statbuf->st_mode) == 0)
|
||||
return (TRUE);
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
int chmod_main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int opt;
|
||||
int recursiveFlag = FALSE;
|
||||
|
||||
/* 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]) {
|
||||
/* Parse the specified mode */
|
||||
mode_t mode;
|
||||
if (parse_mode(argv[optind], &mode) == FALSE) {
|
||||
error_msg_and_die( "unknown mode: %s", argv[optind]);
|
||||
}
|
||||
} else {
|
||||
error_msg_and_die(too_few_args);
|
||||
}
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
for (i = optind + 1; i < argc; i++) {
|
||||
if (recursive_action (argv[i], recursiveFlag, FALSE, FALSE, fileAction,
|
||||
fileAction, argv[optind]) == FALSE) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -1,189 +0,0 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini chown/chmod/chgrp implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 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 "internal.h"
|
||||
#define BB_DECLARE_EXTERN
|
||||
#define bb_need_invalid_option
|
||||
#include "messages.c"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
|
||||
|
||||
static uid_t uid = -1;
|
||||
static gid_t gid = -1;
|
||||
static int whichApp;
|
||||
static char *invocationName = NULL;
|
||||
static char *theMode = NULL;
|
||||
|
||||
|
||||
#define CHGRP_APP 1
|
||||
#define CHOWN_APP 2
|
||||
#define CHMOD_APP 3
|
||||
|
||||
static const char chgrp_usage[] = "chgrp [OPTION]... GROUP FILE...\n\n"
|
||||
"Change the group membership of each FILE to GROUP.\n"
|
||||
|
||||
"\nOptions:\n\t-R\tchange files and directories recursively\n";
|
||||
static const char chown_usage[] =
|
||||
"chown [OPTION]... OWNER[.[GROUP] FILE...\n\n"
|
||||
"Change the owner and/or group of each FILE to OWNER and/or GROUP.\n"
|
||||
|
||||
"\nOptions:\n\t-R\tchange files and directories recursively\n";
|
||||
static const char chmod_usage[] =
|
||||
"chmod [-R] MODE[,MODE]... FILE...\n\n"
|
||||
"Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n"
|
||||
|
||||
"one or more of the letters rwxst.\n\n"
|
||||
"\nOptions:\n\t-R\tchange files and directories recursively.\n";
|
||||
|
||||
|
||||
static int fileAction(const char *fileName, struct stat *statbuf)
|
||||
{
|
||||
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) {
|
||||
fatalError( "%s: unknown mode: %s\n", invocationName, 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 recursiveFlag = FALSE;
|
||||
char *groupName;
|
||||
char *p;
|
||||
const char *appUsage;
|
||||
|
||||
whichApp = (strcmp(*argv, "chown") == 0)?
|
||||
CHOWN_APP : (strcmp(*argv, "chmod") == 0)?
|
||||
CHMOD_APP : CHGRP_APP;
|
||||
|
||||
appUsage = (whichApp == CHOWN_APP)?
|
||||
chown_usage : (whichApp == CHMOD_APP) ? chmod_usage : chgrp_usage;
|
||||
|
||||
if (argc < 2)
|
||||
usage(appUsage);
|
||||
invocationName = *argv;
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
/* Parse options */
|
||||
while (**argv == '-') {
|
||||
while (*++(*argv))
|
||||
switch (**argv) {
|
||||
case 'R':
|
||||
recursiveFlag = TRUE;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, invalid_option, invocationName, **argv);
|
||||
usage(appUsage);
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (whichApp == CHMOD_APP) {
|
||||
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) {
|
||||
*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) {
|
||||
fatalError( "%s: unknown user name: %s\n",
|
||||
invocationName, *argv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
if (argc <= 1) {
|
||||
fatalError( "%s: too few arguments\n", invocationName);
|
||||
}
|
||||
while (argc-- > 1) {
|
||||
if (recursiveAction
|
||||
(*(++argv), recursiveFlag, TRUE, FALSE, fileAction,
|
||||
fileAction) == FALSE)
|
||||
exit(FALSE);
|
||||
}
|
||||
exit(TRUE);
|
||||
|
||||
bad_group:
|
||||
fatalError( "%s: unknown group name: %s\n", invocationName, groupName);
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -0,0 +1,113 @@
|
||||
/* 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 <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)() = 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) == FALSE) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -3,7 +3,7 @@
|
||||
* Mini chroot implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* 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
|
||||
@@ -22,48 +22,47 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
static const char chroot_usage[] = "chroot NEWROOT [COMMAND...]\n\n"
|
||||
|
||||
"Run COMMAND with root directory set to NEWROOT.\n";
|
||||
|
||||
|
||||
#include "busybox.h"
|
||||
|
||||
int chroot_main(int argc, char **argv)
|
||||
{
|
||||
char *prog;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage(chroot_usage);
|
||||
show_usage();
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
if (chroot(*argv) || (chdir("/"))) {
|
||||
fprintf(stderr, "chroot: cannot change root directory to %s: %s\n",
|
||||
*argv, strerror(errno));
|
||||
exit(FALSE);
|
||||
perror_msg_and_die("cannot change root directory to %s", *argv);
|
||||
}
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
if (argc >= 1) {
|
||||
fprintf(stderr, "command: %s\n", *argv);
|
||||
prog = *argv;
|
||||
execvp(*argv, argv);
|
||||
} else {
|
||||
char *prog;
|
||||
|
||||
#ifndef BB_SH
|
||||
prog = getenv("SHELL");
|
||||
if (!prog)
|
||||
prog = "/bin/sh";
|
||||
execlp(prog, prog, NULL);
|
||||
#else
|
||||
char shell[] = "/bin/sh";
|
||||
char *shell_argv[2] = { shell, NULL };
|
||||
applet_name = shell;
|
||||
shell_main(1, shell_argv);
|
||||
return EXIT_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
fprintf(stderr, "chroot: cannot execute %s: %s\n",
|
||||
*argv, strerror(errno));
|
||||
exit(FALSE);
|
||||
perror_msg_and_die("cannot execute %s", prog);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,35 +4,33 @@
|
||||
*
|
||||
* busyboxed by Erik Andersen
|
||||
*/
|
||||
#include "internal.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/vt.h>
|
||||
|
||||
/* getopt not needed */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int getfd(void);
|
||||
/* 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 N\n\nChange foreground virtual terminal to /dev/ttyN\n");
|
||||
}
|
||||
if ((argc != 2) || (**(argv + 1) == '-'))
|
||||
show_usage();
|
||||
fd = get_console_fd("/dev/console");
|
||||
num = atoi(argv[1]);
|
||||
if (ioctl(fd, VT_ACTIVATE, num)) {
|
||||
perror("VT_ACTIVATE");
|
||||
exit(FALSE);
|
||||
}
|
||||
if (ioctl(fd, VT_WAITACTIVE, num)) {
|
||||
perror("VT_WAITACTIVE");
|
||||
exit(FALSE);
|
||||
}
|
||||
exit(TRUE);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Mini clear implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* 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
|
||||
@@ -22,12 +22,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
extern int clear_main(int argc, char **argv)
|
||||
{
|
||||
printf("\033[H\033[J");
|
||||
exit(TRUE);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef CMDEDIT_H
|
||||
#define CMDEDIT_H
|
||||
|
||||
void cmdedit_init(void);
|
||||
void cmdedit_terminate(void);
|
||||
void cmdedit_read_input(char* promptStr, char* command); /* read a line of input */
|
||||
|
||||
#endif /* CMDEDIT_H */
|
||||
@@ -0,0 +1,80 @@
|
||||
/* 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 <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, *filename2 = "-";
|
||||
int c, c1, c2, char_pos = 1, line_pos = 1, silent = FALSE;
|
||||
|
||||
while ((c = getopt(argc, argv, "s")) != EOF) {
|
||||
switch (c) {
|
||||
case 's':
|
||||
silent = TRUE;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
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;
|
||||
}
|
||||
+16
-18
@@ -4,35 +4,33 @@
|
||||
*
|
||||
* busyboxed by Erik Andersen
|
||||
*/
|
||||
#include "internal.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/vt.h>
|
||||
|
||||
/* getopt not needed */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int getfd(void);
|
||||
/* 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 N\n\nChange foreground virtual terminal to /dev/ttyN\n");
|
||||
}
|
||||
if ((argc != 2) || (**(argv + 1) == '-'))
|
||||
show_usage();
|
||||
fd = get_console_fd("/dev/console");
|
||||
num = atoi(argv[1]);
|
||||
if (ioctl(fd, VT_ACTIVATE, num)) {
|
||||
perror("VT_ACTIVATE");
|
||||
exit(FALSE);
|
||||
}
|
||||
if (ioctl(fd, VT_WAITACTIVE, num)) {
|
||||
perror("VT_WAITACTIVE");
|
||||
exit(FALSE);
|
||||
}
|
||||
exit(TRUE);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Mini clear implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* 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
|
||||
@@ -22,12 +22,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
extern int clear_main(int argc, char **argv)
|
||||
{
|
||||
printf("\033[H\033[J");
|
||||
exit(TRUE);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+17
-26
@@ -3,50 +3,41 @@
|
||||
* disalloc.c - aeb - 940501 - Disallocate virtual terminal(s)
|
||||
* Renamed deallocvt.
|
||||
*/
|
||||
#include "internal.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/vt.h>
|
||||
#include <stdio.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int getfd(void);
|
||||
char *progname;
|
||||
/* From <linux/vt.h> */
|
||||
static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
|
||||
|
||||
int deallocvt_main(int argc, char *argv[])
|
||||
{
|
||||
int fd, num, i;
|
||||
|
||||
if ((argc != 2) || (**(argv + 1) == '-')) {
|
||||
usage
|
||||
("deallocvt N\n\nDeallocate unused virtual terminal /dev/ttyN\n");
|
||||
}
|
||||
|
||||
progname = argv[0];
|
||||
//if ((argc > 2) || ((argv == 2) && (**(argv + 1) == '-')))
|
||||
if (argc > 2)
|
||||
show_usage();
|
||||
|
||||
fd = get_console_fd("/dev/console");
|
||||
|
||||
if (argc == 1) {
|
||||
/* deallocate all unused consoles */
|
||||
if (ioctl(fd, VT_DISALLOCATE, 0)) {
|
||||
perror("VT_DISALLOCATE");
|
||||
exit(1);
|
||||
}
|
||||
} else
|
||||
if (ioctl(fd, VT_DISALLOCATE, 0))
|
||||
perror_msg_and_die("VT_DISALLOCATE");
|
||||
} else {
|
||||
for (i = 1; i < argc; i++) {
|
||||
num = atoi(argv[i]);
|
||||
if (num == 0)
|
||||
fprintf(stderr, "%s: 0: illegal VT number\n", progname);
|
||||
error_msg("0: illegal VT number");
|
||||
else if (num == 1)
|
||||
fprintf(stderr, "%s: VT 1 cannot be deallocated\n",
|
||||
progname);
|
||||
else if (ioctl(fd, VT_DISALLOCATE, num)) {
|
||||
perror("VT_DISALLOCATE");
|
||||
fprintf(stderr, "%s: could not deallocate console %d\n",
|
||||
progname, num);
|
||||
exit(1);
|
||||
}
|
||||
error_msg("VT 1 cannot be deallocated");
|
||||
else if (ioctl(fd, VT_DISALLOCATE, num))
|
||||
perror_msg_and_die("VT_DISALLOCATE");
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini dumpkmap implementation for busybox
|
||||
*
|
||||
* Copyright (C) Arne Bernin <arne@matrix.loopback.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* From <linux/kd.h> */
|
||||
struct kbentry {
|
||||
unsigned char kb_table;
|
||||
unsigned char kb_index;
|
||||
unsigned short kb_value;
|
||||
};
|
||||
static const int KDGKBENT = 0x4B46; /* gets one entry in translation table */
|
||||
|
||||
/* From <linux/keyboard.h> */
|
||||
static const int NR_KEYS = 128;
|
||||
static const int MAX_NR_KEYMAPS = 256;
|
||||
|
||||
int dumpkmap_main(int argc, char **argv)
|
||||
{
|
||||
struct kbentry ke;
|
||||
int i, j, fd;
|
||||
char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap";
|
||||
|
||||
if (argc>=2 && *argv[1]=='-') {
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror_msg("Error opening /dev/tty0");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
write(1, magic, 7);
|
||||
|
||||
for (i=0; i < MAX_NR_KEYMAPS; i++) flags[i]=0;
|
||||
flags[0]=1;
|
||||
flags[1]=1;
|
||||
flags[2]=1;
|
||||
flags[4]=1;
|
||||
flags[5]=1;
|
||||
flags[6]=1;
|
||||
flags[8]=1;
|
||||
flags[9]=1;
|
||||
flags[10]=1;
|
||||
flags[12]=1;
|
||||
|
||||
/* dump flags */
|
||||
for (i=0; i < MAX_NR_KEYMAPS; i++) write(1,&flags[i],1);
|
||||
|
||||
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
|
||||
if (flags[i] == 1) {
|
||||
for (j = 0; j < NR_KEYS; j++) {
|
||||
ke.kb_index = j;
|
||||
ke.kb_table = i;
|
||||
if (ioctl(fd, KDGKBENT, &ke) < 0) {
|
||||
|
||||
error_msg("ioctl returned: %s, %s, %s, %xqq", strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
|
||||
}
|
||||
else {
|
||||
write(1,(void*)&ke.kb_value,2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+43
-91
@@ -16,40 +16,42 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/kd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.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]=='-') {
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = open("/dev/tty", O_RDWR);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Error opening /dev/tty1: %s\n", strerror(errno));
|
||||
return 1;
|
||||
perror_msg_and_die("Error opening /dev/tty1");
|
||||
}
|
||||
|
||||
if (screen_map_load(fd, stdin)) {
|
||||
fprintf(stderr, "Error loading acm: %s\n", strerror(errno));
|
||||
return 1;
|
||||
perror_msg_and_die("Error loading acm");
|
||||
}
|
||||
|
||||
write(fd, "\033(K", 3);
|
||||
|
||||
return 0;
|
||||
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];
|
||||
@@ -57,8 +59,8 @@ int screen_map_load(int fd, FILE * fp)
|
||||
int parse_failed = 0;
|
||||
int is_unicode;
|
||||
|
||||
if (fstat(fp->_fileno, &stbuf))
|
||||
perror("Cannot stat map file"), exit(1);
|
||||
if (fstat(fileno(fp), &stbuf))
|
||||
perror_msg_and_die("Cannot stat map file");
|
||||
|
||||
/* first try a UTF screen-map: either ASCII (no restriction) or binary (regular file) */
|
||||
if (!
|
||||
@@ -68,19 +70,16 @@ int screen_map_load(int fd, FILE * fp)
|
||||
if (parse_failed) {
|
||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||
if (errno == ESPIPE)
|
||||
fprintf(stderr,
|
||||
"16bit screen-map MUST be a regular file.\n"),
|
||||
exit(1);
|
||||
error_msg_and_die("16bit screen-map MUST be a regular file.");
|
||||
else
|
||||
perror("fseek failed reading binary 16bit screen-map"),
|
||||
exit(1);
|
||||
perror_msg_and_die("fseek failed reading binary 16bit screen-map");
|
||||
}
|
||||
|
||||
if (fread(wbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1)
|
||||
perror("Cannot read [new] map from file"), exit(1);
|
||||
perror_msg_and_die("Cannot read [new] map from file");
|
||||
#if 0
|
||||
else
|
||||
fprintf(stderr, "Input screen-map is binary.\n");
|
||||
error_msg("Input screen-map is binary.");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -88,7 +87,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
/* same if it was binary, ie. if parse_failed */
|
||||
if (parse_failed || is_unicode) {
|
||||
if (ioctl(fd, PIO_UNISCRNMAP, wbuf))
|
||||
perror("PIO_UNISCRNMAP ioctl"), exit(1);
|
||||
perror_msg_and_die("PIO_UNISCRNMAP ioctl");
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -97,11 +96,10 @@ int screen_map_load(int fd, FILE * fp)
|
||||
/* rewind... */
|
||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||
if (errno == ESPIPE)
|
||||
fprintf(stderr,
|
||||
"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("fseek failed assuming 8bit screen-map"), exit(1);
|
||||
perror_msg_and_die("fseek failed assuming 8bit screen-map");
|
||||
}
|
||||
|
||||
/* ... and try an old 8-bit screen-map */
|
||||
@@ -111,28 +109,26 @@ int screen_map_load(int fd, FILE * fp)
|
||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||
if (errno == ESPIPE)
|
||||
/* should not - it succedeed above */
|
||||
fprintf(stderr, "fseek() returned ESPIPE !\n"),
|
||||
exit(1);
|
||||
error_msg_and_die("fseek() returned ESPIPE !");
|
||||
else
|
||||
perror("fseek for binary 8bit screen-map"), exit(1);
|
||||
perror_msg_and_die("fseek for binary 8bit screen-map");
|
||||
}
|
||||
|
||||
if (fread(buf, E_TABSZ, 1, fp) != 1)
|
||||
perror("Cannot read [old] map from file"), exit(1);
|
||||
perror_msg_and_die("Cannot read [old] map from file");
|
||||
#if 0
|
||||
else
|
||||
fprintf(stderr, "Input screen-map is binary.\n");
|
||||
error_msg("Input screen-map is binary.");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ioctl(fd, PIO_SCRNMAP, buf))
|
||||
perror("PIO_SCRNMAP ioctl"), exit(1);
|
||||
perror_msg_and_die("PIO_SCRNMAP ioctl");
|
||||
else
|
||||
return 0;
|
||||
} else {
|
||||
fprintf(stderr, "Error parsing symbolic map\n");
|
||||
exit(1);
|
||||
}
|
||||
error_msg("Error parsing symbolic map");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -145,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 */
|
||||
@@ -153,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);
|
||||
|
||||
@@ -167,18 +163,16 @@ 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)) {
|
||||
if (feof(fp))
|
||||
break;
|
||||
else {
|
||||
perror("uni_screen_map_read_ascii() can't read line");
|
||||
exit(2);
|
||||
}
|
||||
else
|
||||
perror_msg_and_die("uni_screen_map_read_ascii() can't read line");
|
||||
}
|
||||
|
||||
/* get "charset-relative charcode", stripping leading spaces */
|
||||
@@ -219,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;
|
||||
@@ -261,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;
|
||||
@@ -308,53 +302,11 @@ 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("GIO_UNISCRNMAP ioctl error");
|
||||
#endif
|
||||
if (ioctl(fd, GIO_SCRNMAP, buf)) {
|
||||
perror("GIO_SCRNMAP ioctl error");
|
||||
exit(1);
|
||||
} else
|
||||
is_old_map = 1;
|
||||
#ifdef GIO_UNISCRNMAP
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((fp = fopen(omfil, "w")) == NULL) {
|
||||
perror(omfil);
|
||||
exit(1);
|
||||
}
|
||||
#ifdef GIO_UNISCRNMAP
|
||||
if (is_old_map) {
|
||||
#endif
|
||||
if (fwrite(buf, E_TABSZ, 1, fp) != 1) {
|
||||
perror("Error writing map to file");
|
||||
exit(1);
|
||||
}
|
||||
#ifdef GIO_UNISCRNMAP
|
||||
} else if (fwrite(xbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1) {
|
||||
perror("Error writing map to file");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
unicode utf8_to_ucs2(char *buf)
|
||||
static unicode utf8_to_ucs2(char *buf)
|
||||
{
|
||||
int utf_count = 0;
|
||||
long utf_char;
|
||||
unicode tc;
|
||||
long utf_char = 0;
|
||||
unicode tc = 0;
|
||||
unsigned char c;
|
||||
|
||||
do {
|
||||
|
||||
+37
-62
@@ -7,7 +7,6 @@
|
||||
* Loads the console font, and possibly the corresponding screen map(s).
|
||||
* (Adapted for busybox by Matej Vela.)
|
||||
*/
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
@@ -15,23 +14,20 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/kd.h>
|
||||
#include <endian.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#define PSF_MAGIC1 0x36
|
||||
#define PSF_MAGIC2 0x04
|
||||
static const int PSF_MAGIC1 = 0x36;
|
||||
static const int PSF_MAGIC2 = 0x04;
|
||||
|
||||
#define PSF_MODE512 0x01
|
||||
#define PSF_MODEHASTAB 0x02
|
||||
#define PSF_MAXMODE 0x03
|
||||
#define PSF_SEPARATOR 0xFFFF
|
||||
|
||||
static const char loadfont_usage[] = "loadfont\n"
|
||||
"\n" "\tLoad a console font from standard input.\n" "\n";
|
||||
static const int PSF_MODE512 = 0x01;
|
||||
static const int PSF_MODEHASTAB = 0x02;
|
||||
static const int PSF_MAXMODE = 0x03;
|
||||
static const int PSF_SEPARATOR = 0xFFFF;
|
||||
|
||||
struct psf_header {
|
||||
unsigned char magic1, magic2; /* Magic number */
|
||||
@@ -47,14 +43,15 @@ extern int loadfont_main(int argc, char **argv)
|
||||
{
|
||||
int fd;
|
||||
|
||||
if (argc != 1)
|
||||
show_usage();
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
if (fd < 0)
|
||||
perror_msg_and_die("Error opening /dev/tty0");
|
||||
loadnewfont(fd);
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
|
||||
@@ -64,10 +61,8 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
if (unit < 1 || unit > 32) {
|
||||
fprintf(stderr, "Bad character size %d\n", unit);
|
||||
exit(1);
|
||||
}
|
||||
if (unit < 1 || unit > 32)
|
||||
error_msg_and_die("Bad character size %d", unit);
|
||||
|
||||
for (i = 0; i < fontsize; i++)
|
||||
memcpy(buf + (32 * i), inbuf + (unit * i), unit);
|
||||
@@ -82,13 +77,11 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
|
||||
|
||||
if (ioctl(fd, PIO_FONTX, &cfd) == 0)
|
||||
return; /* success */
|
||||
perror("PIO_FONTX ioctl error (trying PIO_FONT)");
|
||||
perror_msg("PIO_FONTX ioctl error (trying PIO_FONT)");
|
||||
}
|
||||
#endif
|
||||
if (ioctl(fd, PIO_FONT, buf)) {
|
||||
perror("PIO_FONT ioctl error");
|
||||
exit(1);
|
||||
}
|
||||
if (ioctl(fd, PIO_FONT, buf))
|
||||
perror_msg_and_die("PIO_FONT ioctl error");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -102,12 +95,8 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
|
||||
u_short unicode;
|
||||
|
||||
maxct = tailsz; /* more than enough */
|
||||
up = (struct unipair *) malloc(maxct * sizeof(struct unipair));
|
||||
up = (struct unipair *) xmalloc(maxct * sizeof(struct unipair));
|
||||
|
||||
if (!up) {
|
||||
fprintf(stderr, "Out of memory?\n");
|
||||
exit(1);
|
||||
}
|
||||
for (glyph = 0; glyph < fontsize; glyph++) {
|
||||
while (tailsz >= 2) {
|
||||
unicode = (((u_short) inbuf[1]) << 8) + inbuf[0];
|
||||
@@ -130,12 +119,11 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
|
||||
if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
|
||||
#ifdef ENOIOCTLCMD
|
||||
if (errno == ENOIOCTLCMD) {
|
||||
fprintf(stderr, "It seems this kernel is older than 1.1.92\n");
|
||||
fprintf(stderr, "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("PIO_UNIMAPCLR");
|
||||
exit(1);
|
||||
perror_msg_and_die("PIO_UNIMAPCLR");
|
||||
}
|
||||
ud.entry_ct = ct;
|
||||
ud.entries = up;
|
||||
@@ -145,8 +133,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
|
||||
/* change advice parameters */
|
||||
}
|
||||
#endif
|
||||
perror("PIO_UNIMAP");
|
||||
exit(1);
|
||||
perror_msg_and_die("PIO_UNIMAP");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +141,7 @@ static void loadnewfont(int fd)
|
||||
{
|
||||
int unit;
|
||||
char inbuf[32768]; /* primitive */
|
||||
int inputlth, offset;
|
||||
unsigned int inputlth, offset;
|
||||
|
||||
/*
|
||||
* We used to look at the length of the input file
|
||||
@@ -162,25 +149,21 @@ static void loadnewfont(int fd)
|
||||
* just read the entire file.
|
||||
*/
|
||||
inputlth = fread(inbuf, 1, sizeof(inbuf), stdin);
|
||||
if (ferror(stdin)) {
|
||||
perror("Error reading input font");
|
||||
exit(1);
|
||||
}
|
||||
if (ferror(stdin))
|
||||
perror_msg_and_die("Error reading input font");
|
||||
/* use malloc/realloc in case of giant files;
|
||||
maybe these do not occur: 16kB for the font,
|
||||
and 16kB for the map leaves 32 unicode values
|
||||
for each font position */
|
||||
if (!feof(stdin)) {
|
||||
perror("Font too large");
|
||||
exit(1);
|
||||
}
|
||||
if (!feof(stdin))
|
||||
perror_msg_and_die("Font too large");
|
||||
|
||||
/* test for psf first */
|
||||
{
|
||||
struct psf_header psfhdr;
|
||||
int fontsize;
|
||||
int hastable;
|
||||
int head0, head;
|
||||
unsigned int head0, head;
|
||||
|
||||
if (inputlth < sizeof(struct psf_header))
|
||||
goto no_psf;
|
||||
@@ -190,26 +173,20 @@ static void loadnewfont(int fd)
|
||||
if (!PSF_MAGIC_OK(psfhdr))
|
||||
goto no_psf;
|
||||
|
||||
if (psfhdr.mode > PSF_MAXMODE) {
|
||||
fprintf(stderr, "Unsupported psf file mode\n");
|
||||
exit(1);
|
||||
}
|
||||
if (psfhdr.mode > PSF_MAXMODE)
|
||||
error_msg_and_die("Unsupported psf file mode");
|
||||
fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
|
||||
#if !defined( PIO_FONTX ) || defined( __sparc__ )
|
||||
if (fontsize != 256) {
|
||||
fprintf(stderr, "Only fontsize 256 supported\n");
|
||||
exit(1);
|
||||
}
|
||||
if (fontsize != 256)
|
||||
error_msg_and_die("Only fontsize 256 supported");
|
||||
#endif
|
||||
hastable = (psfhdr.mode & PSF_MODEHASTAB);
|
||||
unit = psfhdr.charsize;
|
||||
head0 = sizeof(struct psf_header);
|
||||
|
||||
head = head0 + fontsize * unit;
|
||||
if (head > inputlth || (!hastable && head != inputlth)) {
|
||||
fprintf(stderr, "Input file: bad length\n");
|
||||
exit(1);
|
||||
}
|
||||
if (head > inputlth || (!hastable && head != inputlth))
|
||||
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);
|
||||
@@ -223,10 +200,8 @@ static void loadnewfont(int fd)
|
||||
unit = 16;
|
||||
} else {
|
||||
/* bare font */
|
||||
if (inputlth & 0377) {
|
||||
fprintf(stderr, "Bad input file size\n");
|
||||
exit(1);
|
||||
}
|
||||
if (inputlth & 0377)
|
||||
error_msg_and_die("Bad input file size");
|
||||
offset = 0;
|
||||
unit = inputlth / 256;
|
||||
}
|
||||
|
||||
+32
-35
@@ -20,63 +20,58 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <linux/kd.h>
|
||||
#include <linux/keyboard.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#define BINARY_KEYMAP_MAGIC "bkeymap"
|
||||
|
||||
static const char loadkmap_usage[] = "loadkmap\n"
|
||||
"\n"
|
||||
|
||||
"\tLoad a binary keyboard translation table from standard input.\n"
|
||||
"\n";
|
||||
/* From <linux/kd.h> */
|
||||
struct kbentry {
|
||||
unsigned char kb_table;
|
||||
unsigned char kb_index;
|
||||
unsigned short kb_value;
|
||||
};
|
||||
static const int KDSKBENT = 0x4B47; /* sets one entry in translation table */
|
||||
|
||||
/* From <linux/keyboard.h> */
|
||||
static const int NR_KEYS = 128;
|
||||
static const int MAX_NR_KEYMAPS = 256;
|
||||
|
||||
int loadkmap_main(int argc, char **argv)
|
||||
{
|
||||
struct kbentry ke;
|
||||
u_short *ibuff;
|
||||
int i, j, fd, readsz, pos, ibuffsz = NR_KEYS * sizeof(u_short);
|
||||
char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap", buff[7];
|
||||
char flags[MAX_NR_KEYMAPS], buff[7];
|
||||
|
||||
if (argc != 1)
|
||||
show_usage();
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
if (fd < 0)
|
||||
perror_msg_and_die("Error opening /dev/tty0");
|
||||
|
||||
read(0, buff, 7);
|
||||
if (0 != strncmp(buff, magic, 7)) {
|
||||
fprintf(stderr, "This is not a valid binary keymap.\n");
|
||||
return 1;
|
||||
}
|
||||
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
|
||||
error_msg_and_die("This is not a valid binary keymap.");
|
||||
|
||||
if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) {
|
||||
fprintf(stderr, "Error reading keymap flags: %s\n",
|
||||
strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS))
|
||||
perror_msg_and_die("Error reading keymap flags");
|
||||
|
||||
ibuff = (u_short *) malloc(ibuffsz);
|
||||
if (!ibuff) {
|
||||
fprintf(stderr, "Out of memory.\n");
|
||||
return 1;
|
||||
}
|
||||
ibuff = (u_short *) xmalloc(ibuffsz);
|
||||
|
||||
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
|
||||
if (flags[i] == 1) {
|
||||
pos = 0;
|
||||
while (pos < ibuffsz) {
|
||||
if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos))
|
||||
< 0) {
|
||||
fprintf(stderr, "Error reading keymap: %s\n",
|
||||
strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) < 0)
|
||||
perror_msg_and_die("Error reading keymap");
|
||||
pos += readsz;
|
||||
}
|
||||
for (j = 0; j < NR_KEYS; j++) {
|
||||
@@ -87,6 +82,8 @@ int loadkmap_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
return 0;
|
||||
/* Don't bother to close files. Exit does that
|
||||
* automagically, so we can save a few bytes */
|
||||
/* close(fd); */
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
* 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 "busybox.h"
|
||||
|
||||
extern int reset_main(int argc, char **argv)
|
||||
{
|
||||
printf("\033c");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* setkeycodes
|
||||
*
|
||||
* Copyright (C) 1994-1998 Andries E. Brouwer <aeb@cwi.nl>
|
||||
*
|
||||
* Adjusted for BusyBox 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 <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
/* From <linux/kd.h> */
|
||||
struct kbkeycode {
|
||||
unsigned int scancode, keycode;
|
||||
};
|
||||
static const int KDSETKEYCODE = 0x4B4D; /* write kernel keycode table entry */
|
||||
|
||||
extern int
|
||||
setkeycodes_main(int argc, char** argv)
|
||||
{
|
||||
char *ep;
|
||||
int fd, sc;
|
||||
struct kbkeycode a;
|
||||
|
||||
if (argc % 2 != 1 || argc < 2) {
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = get_console_fd("/dev/console");
|
||||
|
||||
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'", 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");
|
||||
}
|
||||
if (ioctl(fd,KDSETKEYCODE,&a)) {
|
||||
perror("KDSETKEYCODE");
|
||||
error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d", sc, a.keycode);
|
||||
}
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+21
-9
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Mini basename implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* 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
|
||||
@@ -21,20 +21,32 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
/* getopt not needed */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
#include <string.h>
|
||||
|
||||
extern int basename_main(int argc, char **argv)
|
||||
{
|
||||
char* s;
|
||||
int m, n;
|
||||
char *s;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage("basename [file ...]\n");
|
||||
show_usage();
|
||||
}
|
||||
|
||||
argv++;
|
||||
|
||||
s = strrchr(*argv, '/');
|
||||
printf("%s\n", (s)? s + 1 : *argv);
|
||||
exit(TRUE);
|
||||
}
|
||||
s = get_last_path_component(*argv);
|
||||
|
||||
if (argc>2) {
|
||||
argv++;
|
||||
n = strlen(*argv);
|
||||
m = strlen(s);
|
||||
if (m>=n && strncmp(s+m-n, *argv, n)==0)
|
||||
s[m-n] = '\0';
|
||||
}
|
||||
puts(s);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+12
-28
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Mini Cat implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* 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
|
||||
@@ -21,43 +21,27 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static void print_file(FILE * file)
|
||||
{
|
||||
int c;
|
||||
|
||||
while ((c = getc(file)) != EOF)
|
||||
putc(c, stdout);
|
||||
fclose(file);
|
||||
fflush(stdout);
|
||||
}
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int cat_main(int argc, char **argv)
|
||||
{
|
||||
FILE *file;
|
||||
int status = EXIT_SUCCESS;
|
||||
|
||||
if (argc == 1) {
|
||||
print_file(stdin);
|
||||
exit(TRUE);
|
||||
return status;
|
||||
}
|
||||
|
||||
if (**(argv + 1) == '-') {
|
||||
usage("cat [file ...]\n");
|
||||
}
|
||||
argc--;
|
||||
|
||||
while (argc-- > 0 && *(argv++) != '\0' && strlen(*argv)) {
|
||||
file = fopen(*argv, "r");
|
||||
if (file == NULL) {
|
||||
perror(*argv);
|
||||
exit(FALSE);
|
||||
while (--argc > 0) {
|
||||
if(!(strcmp(*++argv, "-"))) {
|
||||
print_file(stdin);
|
||||
} else if (print_file_by_name(*argv) == FALSE) {
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
print_file(file);
|
||||
}
|
||||
exit(TRUE);
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/* 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 <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) == FALSE) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -0,0 +1,85 @@
|
||||
/* 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 <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("internal error");
|
||||
if (chmod(fileName, statbuf->st_mode) == 0)
|
||||
return (TRUE);
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
int chmod_main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int opt;
|
||||
int recursiveFlag = FALSE;
|
||||
|
||||
/* 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]) {
|
||||
/* Parse the specified mode */
|
||||
mode_t mode;
|
||||
if (parse_mode(argv[optind], &mode) == FALSE) {
|
||||
error_msg_and_die( "unknown mode: %s", argv[optind]);
|
||||
}
|
||||
} else {
|
||||
error_msg_and_die(too_few_args);
|
||||
}
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
for (i = optind + 1; i < argc; i++) {
|
||||
if (recursive_action (argv[i], recursiveFlag, FALSE, FALSE, fileAction,
|
||||
fileAction, argv[optind]) == FALSE) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -0,0 +1,113 @@
|
||||
/* 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 <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)() = 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) == FALSE) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
+18
-19
@@ -3,7 +3,7 @@
|
||||
* Mini chroot implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* 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
|
||||
@@ -22,48 +22,47 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
static const char chroot_usage[] = "chroot NEWROOT [COMMAND...]\n\n"
|
||||
|
||||
"Run COMMAND with root directory set to NEWROOT.\n";
|
||||
|
||||
|
||||
#include "busybox.h"
|
||||
|
||||
int chroot_main(int argc, char **argv)
|
||||
{
|
||||
char *prog;
|
||||
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage(chroot_usage);
|
||||
show_usage();
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
if (chroot(*argv) || (chdir("/"))) {
|
||||
fprintf(stderr, "chroot: cannot change root directory to %s: %s\n",
|
||||
*argv, strerror(errno));
|
||||
exit(FALSE);
|
||||
perror_msg_and_die("cannot change root directory to %s", *argv);
|
||||
}
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
if (argc >= 1) {
|
||||
fprintf(stderr, "command: %s\n", *argv);
|
||||
prog = *argv;
|
||||
execvp(*argv, argv);
|
||||
} else {
|
||||
char *prog;
|
||||
|
||||
#ifndef BB_SH
|
||||
prog = getenv("SHELL");
|
||||
if (!prog)
|
||||
prog = "/bin/sh";
|
||||
execlp(prog, prog, NULL);
|
||||
#else
|
||||
char shell[] = "/bin/sh";
|
||||
char *shell_argv[2] = { shell, NULL };
|
||||
applet_name = shell;
|
||||
shell_main(1, shell_argv);
|
||||
return EXIT_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
fprintf(stderr, "chroot: cannot execute %s: %s\n",
|
||||
*argv, strerror(errno));
|
||||
exit(FALSE);
|
||||
perror_msg_and_die("cannot execute %s", prog);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/* 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 <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, *filename2 = "-";
|
||||
int c, c1, c2, char_pos = 1, line_pos = 1, silent = FALSE;
|
||||
|
||||
while ((c = getopt(argc, argv, "s")) != EOF) {
|
||||
switch (c) {
|
||||
case 's':
|
||||
silent = TRUE;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
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;
|
||||
}
|
||||
+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 = 0;
|
||||
int i;
|
||||
|
||||
while ((opt = getopt(argc, argv, "adfipR")) != -1)
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
flags |= FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR;
|
||||
/* fallthrough */
|
||||
case 'd':
|
||||
flags |= FILEUTILS_PRESERVE_SYMLINKS;
|
||||
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_PRESERVE_SYMLINKS) &&
|
||||
lstat(argv[optind], &source_stat) < 0) ||
|
||||
(!(flags & FILEUTILS_PRESERVE_SYMLINKS) &&
|
||||
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;
|
||||
}
|
||||
+358
@@ -0,0 +1,358 @@
|
||||
/*
|
||||
* cut.c - minimalist version of cut
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Mark Whitley <markw@lineo.com>, <markw@codepoet.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h> /* getopt */
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
/* globals from other files */
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
|
||||
|
||||
/* option vars */
|
||||
static char part = 0; /* (b)yte, (c)har, (f)ields */
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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 parse_lists(char *lists)
|
||||
{
|
||||
char *ltok = NULL;
|
||||
char *ntok = NULL;
|
||||
char *junk;
|
||||
int s = 0, e = 0;
|
||||
|
||||
/* 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--;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we made it here, it means we've found the line we're looking for, so print it */
|
||||
puts(line);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* snippy-snip
|
||||
*/
|
||||
static void cut_file(FILE *file)
|
||||
{
|
||||
char *line = NULL;
|
||||
unsigned int linenum = 0; /* keep these zero-based to be consistent */
|
||||
|
||||
/* go through every line in the file */
|
||||
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') {
|
||||
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;
|
||||
|
||||
while ((opt = getopt(argc, argv, "b:c:d:f:ns")) > 0) {
|
||||
switch (opt) {
|
||||
case 'b':
|
||||
case 'c':
|
||||
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");
|
||||
}
|
||||
part = (char)opt;
|
||||
parse_lists(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
if (strlen(optarg) > 1) {
|
||||
error_msg_and_die("the delimiter must be a single character");
|
||||
}
|
||||
delim = optarg[0];
|
||||
break;
|
||||
case 'n':
|
||||
/* no-op */
|
||||
break;
|
||||
case 's':
|
||||
supress_non_delimited_lines++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (part == 0) {
|
||||
error_msg_and_die("you must specify a list of bytes, characters, or fields");
|
||||
}
|
||||
|
||||
/* 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
|
||||
* files were specified or '-' was specified, take input from stdin.
|
||||
* Otherwise, we process all the files specified. */
|
||||
if (argv[optind] == NULL || (strcmp(argv[optind], "-") == 0)) {
|
||||
cut_file(stdin);
|
||||
}
|
||||
else {
|
||||
int i;
|
||||
FILE *file;
|
||||
for (i = optind; i < argc; i++) {
|
||||
file = fopen(argv[i], "r");
|
||||
if (file == NULL) {
|
||||
perror_msg("%s", argv[i]);
|
||||
} else {
|
||||
cut_file(file);
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+89
-127
@@ -20,17 +20,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.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>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
/* This 'date' command supports only 2 time setting formats,
|
||||
@@ -39,21 +37,12 @@
|
||||
an RFC 822 complient date output for shell scripting
|
||||
mail commands */
|
||||
|
||||
static const char date_usage[] = "date [OPTION]... [+FORMAT]\n"
|
||||
" or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n\n"
|
||||
"Display the current time in the given FORMAT, or set the system date.\n"
|
||||
"\nOptions:\n\t-R\t\toutput RFC-822 compliant date string\n"
|
||||
"\t-s\t\tset time described by STRING\n"
|
||||
|
||||
"\t-u\t\tprint or set Coordinated Universal Time\n";
|
||||
|
||||
|
||||
/* Input parsing code is always bulky - used heavy duty libc stuff as
|
||||
much as possible, missed out a lot of bounds checking */
|
||||
|
||||
/* 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;
|
||||
|
||||
@@ -64,8 +53,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
|
||||
&(tm_time->tm_min), &(tm_time->tm_year));
|
||||
|
||||
if (nr < 4 || nr > 5) {
|
||||
fprintf(stderr, invalid_date, "date", t_string);
|
||||
exit(FALSE);
|
||||
error_msg_and_die(invalid_date, t_string);
|
||||
}
|
||||
|
||||
/* correct for century - minor Y2K problem here? */
|
||||
@@ -81,78 +69,59 @@ 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 itm_time, jtm_time, ktm_time, ltm_time, mtm_time, ntm_time;
|
||||
|
||||
itm_time = *tm_time;
|
||||
jtm_time = *tm_time;
|
||||
ktm_time = *tm_time;
|
||||
ltm_time = *tm_time;
|
||||
mtm_time = *tm_time;
|
||||
ntm_time = *tm_time;
|
||||
struct tm t;
|
||||
|
||||
/* Parse input and assign appropriately to tm_time */
|
||||
|
||||
if (sscanf(t_string, "%d:%d:%d",
|
||||
&itm_time.tm_hour, &itm_time.tm_min, &itm_time.tm_sec) == 3) {
|
||||
if (t=*tm_time,sscanf(t_string, "%d:%d:%d",
|
||||
&t.tm_hour, &t.tm_min, &t.tm_sec) == 3) {
|
||||
/* no adjustments needed */
|
||||
|
||||
*tm_time = itm_time;
|
||||
return (tm_time);
|
||||
} else if (t=*tm_time,sscanf(t_string, "%d:%d",
|
||||
&t.tm_hour, &t.tm_min) == 2) {
|
||||
/* no adjustments needed */
|
||||
|
||||
} else if (sscanf(t_string, "%d:%d",
|
||||
&jtm_time.tm_hour, &jtm_time.tm_min) == 2) {
|
||||
|
||||
*tm_time = jtm_time;
|
||||
return (tm_time);
|
||||
} else if (t=*tm_time,sscanf(t_string, "%d.%d-%d:%d:%d",
|
||||
&t.tm_mon,
|
||||
&t.tm_mday,
|
||||
&t.tm_hour,
|
||||
&t.tm_min, &t.tm_sec) == 5) {
|
||||
|
||||
} else if (sscanf(t_string, "%d.%d-%d:%d:%d",
|
||||
&ktm_time.tm_mon,
|
||||
&ktm_time.tm_mday,
|
||||
&ktm_time.tm_hour,
|
||||
&ktm_time.tm_min, &ktm_time.tm_sec) == 5) {
|
||||
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
|
||||
ktm_time.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
*tm_time = ktm_time;
|
||||
return (tm_time);
|
||||
} else if (t=*tm_time,sscanf(t_string, "%d.%d-%d:%d",
|
||||
&t.tm_mon,
|
||||
&t.tm_mday,
|
||||
&t.tm_hour, &t.tm_min) == 4) {
|
||||
|
||||
} else if (sscanf(t_string, "%d.%d-%d:%d",
|
||||
<m_time.tm_mon,
|
||||
<m_time.tm_mday,
|
||||
<m_time.tm_hour, <m_time.tm_min) == 4) {
|
||||
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
|
||||
ltm_time.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
*tm_time = ltm_time;
|
||||
return (tm_time);
|
||||
} else if (t=*tm_time,sscanf(t_string, "%d.%d.%d-%d:%d:%d",
|
||||
&t.tm_year,
|
||||
&t.tm_mon,
|
||||
&t.tm_mday,
|
||||
&t.tm_hour,
|
||||
&t.tm_min, &t.tm_sec) == 6) {
|
||||
|
||||
} else if (sscanf(t_string, "%d.%d.%d-%d:%d:%d",
|
||||
&mtm_time.tm_year,
|
||||
&mtm_time.tm_mon,
|
||||
&mtm_time.tm_mday,
|
||||
&mtm_time.tm_hour,
|
||||
&mtm_time.tm_min, &mtm_time.tm_sec) == 6) {
|
||||
t.tm_year -= 1900; /* Adjust years */
|
||||
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
|
||||
mtm_time.tm_year -= 1900; /* Adjust years */
|
||||
mtm_time.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
*tm_time = mtm_time;
|
||||
return (tm_time);
|
||||
|
||||
} else if (sscanf(t_string, "%d.%d.%d-%d:%d",
|
||||
&ntm_time.tm_year,
|
||||
&ntm_time.tm_mon,
|
||||
&ntm_time.tm_mday,
|
||||
&ntm_time.tm_hour, &ntm_time.tm_min) == 5) {
|
||||
ntm_time.tm_year -= 1900; /* Adjust years */
|
||||
ntm_time.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
|
||||
*tm_time = ntm_time;
|
||||
return (tm_time);
|
||||
} 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);
|
||||
}
|
||||
|
||||
fprintf(stderr, invalid_date, "date", t_string);
|
||||
|
||||
exit(FALSE);
|
||||
|
||||
*tm_time = t;
|
||||
return (tm_time);
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +130,7 @@ int date_main(int argc, char **argv)
|
||||
char *date_str = NULL;
|
||||
char *date_fmt = NULL;
|
||||
char *t_buff;
|
||||
int i;
|
||||
int c;
|
||||
int set_time = 0;
|
||||
int rfc822 = 0;
|
||||
int utc = 0;
|
||||
@@ -170,51 +139,44 @@ int date_main(int argc, char **argv)
|
||||
struct tm tm_time;
|
||||
|
||||
/* Interpret command line args */
|
||||
i = --argc;
|
||||
argv++;
|
||||
while (i > 0 && **argv) {
|
||||
if (**argv == '-') {
|
||||
while (i > 0 && *++(*argv))
|
||||
switch (**argv) {
|
||||
case 'R':
|
||||
rfc822 = 1;
|
||||
break;
|
||||
case 's':
|
||||
set_time = 1;
|
||||
if (date_str != NULL)
|
||||
usage(date_usage);
|
||||
date_str = optarg;
|
||||
break;
|
||||
case 'u':
|
||||
utc = 1;
|
||||
if (putenv("TZ=UTC0") != 0) {
|
||||
fprintf(stderr, memory_exhausted, "date");
|
||||
exit(FALSE);
|
||||
}
|
||||
/* Look ma, no break. Don't fix it either. */
|
||||
case 'd':
|
||||
use_arg = 1;
|
||||
if (date_str != NULL)
|
||||
usage(date_usage);
|
||||
date_str = optarg;
|
||||
break;
|
||||
case '-':
|
||||
usage(date_usage);
|
||||
}
|
||||
} else {
|
||||
if ((date_fmt == NULL) && (strcmp(*argv, "+") == 0))
|
||||
date_fmt = *argv;
|
||||
else if (date_str == NULL) {
|
||||
while ((c = getopt(argc, argv, "Rs:ud:")) != EOF) {
|
||||
switch (c) {
|
||||
case 'R':
|
||||
rfc822 = 1;
|
||||
break;
|
||||
case 's':
|
||||
set_time = 1;
|
||||
date_str = *argv;
|
||||
} else {
|
||||
usage(date_usage);
|
||||
}
|
||||
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;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
i--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
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);
|
||||
show_usage();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now we have parsed all the information except the date format
|
||||
which depends on whether the clock is being set or read */
|
||||
@@ -237,18 +199,19 @@ 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) {
|
||||
fprintf(stderr, invalid_date, "date", date_str);
|
||||
exit(FALSE);
|
||||
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 setting time, set it */
|
||||
if (set_time) {
|
||||
if (stime(&tm) < 0) {
|
||||
fprintf(stderr, "date: can't set date.\n");
|
||||
exit(FALSE);
|
||||
perror_msg("cannot set date");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -266,7 +229,7 @@ int date_main(int argc, char **argv)
|
||||
} else if (*date_fmt == '\0') {
|
||||
/* Imitate what GNU 'date' does with NO format string! */
|
||||
printf("\n");
|
||||
exit(TRUE);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* Handle special conversions */
|
||||
@@ -276,10 +239,9 @@ int date_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Print OUTPUT (after ALL that!) */
|
||||
t_buff = malloc(201);
|
||||
t_buff = xmalloc(201);
|
||||
strftime(t_buff, 200, date_fmt, &tm_time);
|
||||
printf("%s\n", t_buff);
|
||||
|
||||
exit(TRUE);
|
||||
puts(t_buff);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+114
-155
@@ -2,15 +2,8 @@
|
||||
/*
|
||||
* Mini dd implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
* based in part on code taken from sash.
|
||||
*
|
||||
* Copyright (c) 1999 by David I. Bell
|
||||
* Permission is granted to use, distribute, or modify this source,
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* Permission to distribute this code under the GPL has been granted.
|
||||
* 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
|
||||
@@ -28,172 +21,138 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "internal.h"
|
||||
#include <features.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
typedef unsigned long long int uintmax_t;
|
||||
#endif
|
||||
|
||||
static const char dd_usage[] =
|
||||
"dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n]\n\n"
|
||||
"Copy a file, converting and formatting according to options\n\n"
|
||||
"\tif=FILE\tread from FILE instead of stdin\n"
|
||||
"\tof=FILE\twrite to FILE instead of stdout\n"
|
||||
"\tbs=n\tread and write n bytes at a time\n"
|
||||
"\tcount=n\tcopy only n input blocks\n"
|
||||
"\tskip=n\tskip n input blocks\n"
|
||||
"\tseek=n\tskip n output blocks\n"
|
||||
|
||||
"\n"
|
||||
"Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)\n";
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
static const struct suffix_mult dd_suffixes[] = {
|
||||
{ "c", 1 },
|
||||
{ "w", 2 },
|
||||
{ "b", 512 },
|
||||
{ "kD", 1000 },
|
||||
{ "k", 1024 },
|
||||
{ "MD", 1000000 },
|
||||
{ "M", 1048576 },
|
||||
{ "GD", 1000000000 },
|
||||
{ "G", 1073741824 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
extern int dd_main(int argc, char **argv)
|
||||
int dd_main(int argc, char **argv)
|
||||
{
|
||||
const char *inFile = NULL;
|
||||
const char *outFile = NULL;
|
||||
char *cp;
|
||||
int inFd;
|
||||
int outFd;
|
||||
int inCc = 0;
|
||||
int outCc;
|
||||
long blockSize = 512;
|
||||
uintmax_t skipBlocks = 0;
|
||||
uintmax_t seekBlocks = 0;
|
||||
uintmax_t count = (uintmax_t) - 1;
|
||||
uintmax_t intotal;
|
||||
uintmax_t outTotal;
|
||||
unsigned char *buf;
|
||||
int i, ifd, ofd, oflag, sync_flag = FALSE, trunc = TRUE;
|
||||
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;
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strncmp("bs=", argv[i], 3) == 0)
|
||||
bs = parse_number(argv[i]+3, dd_suffixes);
|
||||
else if (strncmp("count=", argv[i], 6) == 0)
|
||||
count = parse_number(argv[i]+6, dd_suffixes);
|
||||
else if (strncmp("seek=", argv[i], 5) == 0)
|
||||
seek = parse_number(argv[i]+5, dd_suffixes);
|
||||
else if (strncmp("skip=", argv[i], 5) == 0)
|
||||
skip = parse_number(argv[i]+5, dd_suffixes);
|
||||
else if (strncmp("if=", argv[i], 3) == 0)
|
||||
infile = argv[i]+3;
|
||||
else if (strncmp("of=", argv[i], 3) == 0)
|
||||
outfile = argv[i]+3;
|
||||
else if (strncmp("conv=", argv[i], 5) == 0) {
|
||||
buf = argv[i]+5;
|
||||
while (1) {
|
||||
if (strncmp("notrunc", buf, 7) == 0) {
|
||||
trunc = FALSE;
|
||||
buf += 7;
|
||||
} else if (strncmp("sync", buf, 4) == 0) {
|
||||
sync_flag = TRUE;
|
||||
buf += 4;
|
||||
} else {
|
||||
error_msg_and_die("invalid conversion `%s'", argv[i]+5);
|
||||
}
|
||||
if (buf[0] == '\0')
|
||||
break;
|
||||
if (buf[0] == ',')
|
||||
buf++;
|
||||
}
|
||||
} else
|
||||
show_usage();
|
||||
}
|
||||
|
||||
/* Parse any options */
|
||||
while (argc) {
|
||||
if (inFile == NULL && (strncmp(*argv, "if", 2) == 0))
|
||||
inFile = ((strchr(*argv, '=')) + 1);
|
||||
else if (outFile == NULL && (strncmp(*argv, "of", 2) == 0))
|
||||
outFile = ((strchr(*argv, '=')) + 1);
|
||||
else if (strncmp("count", *argv, 5) == 0) {
|
||||
count = getNum((strchr(*argv, '=')) + 1);
|
||||
if (count <= 0) {
|
||||
fprintf(stderr, "Bad count value %s\n", *argv);
|
||||
goto usage;
|
||||
}
|
||||
} else if (strncmp(*argv, "bs", 2) == 0) {
|
||||
blockSize = getNum((strchr(*argv, '=')) + 1);
|
||||
if (blockSize <= 0) {
|
||||
fprintf(stderr, "Bad block size value %s\n", *argv);
|
||||
goto usage;
|
||||
}
|
||||
} else if (strncmp(*argv, "skip", 4) == 0) {
|
||||
skipBlocks = getNum((strchr(*argv, '=')) + 1);
|
||||
if (skipBlocks <= 0) {
|
||||
fprintf(stderr, "Bad skip value %s\n", *argv);
|
||||
goto usage;
|
||||
}
|
||||
buf = xmalloc(bs);
|
||||
|
||||
} else if (strncmp(*argv, "seek", 4) == 0) {
|
||||
seekBlocks = getNum((strchr(*argv, '=')) + 1);
|
||||
if (seekBlocks <= 0) {
|
||||
fprintf(stderr, "Bad seek value %s\n", *argv);
|
||||
goto usage;
|
||||
}
|
||||
if (infile != NULL) {
|
||||
if ((ifd = open(infile, O_RDONLY)) < 0)
|
||||
perror_msg_and_die("%s", infile);
|
||||
} else {
|
||||
ifd = STDIN_FILENO;
|
||||
infile = "standard input";
|
||||
}
|
||||
|
||||
} else {
|
||||
goto usage;
|
||||
if (outfile != NULL) {
|
||||
oflag = O_WRONLY | O_CREAT;
|
||||
|
||||
if (!seek && trunc)
|
||||
oflag |= O_TRUNC;
|
||||
|
||||
if ((ofd = open(outfile, oflag, 0666)) < 0)
|
||||
perror_msg_and_die("%s", outfile);
|
||||
|
||||
if (seek && trunc) {
|
||||
if (ftruncate(ofd, seek * bs) < 0)
|
||||
perror_msg_and_die("%s", outfile);
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
statusfp = stdout;
|
||||
} else {
|
||||
ofd = STDOUT_FILENO;
|
||||
outfile = "standard output";
|
||||
statusfp = stderr;
|
||||
}
|
||||
|
||||
buf = malloc(blockSize);
|
||||
if (buf == NULL) {
|
||||
fprintf(stderr, "Cannot allocate buffer\n");
|
||||
exit(FALSE);
|
||||
if (skip) {
|
||||
if (lseek(ifd, skip * bs, SEEK_CUR) < 0)
|
||||
perror_msg_and_die("%s", infile);
|
||||
}
|
||||
|
||||
intotal = 0;
|
||||
outTotal = 0;
|
||||
|
||||
if (inFile == NULL)
|
||||
inFd = fileno(stdin);
|
||||
else
|
||||
inFd = open(inFile, 0);
|
||||
|
||||
if (inFd < 0) {
|
||||
perror(inFile);
|
||||
free(buf);
|
||||
exit(FALSE);
|
||||
if (seek) {
|
||||
if (lseek(ofd, seek * bs, SEEK_CUR) < 0)
|
||||
perror_msg_and_die("%s", outfile);
|
||||
}
|
||||
|
||||
if (outFile == NULL)
|
||||
outFd = fileno(stdout);
|
||||
else
|
||||
outFd = open(outFile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
||||
|
||||
if (outFd < 0) {
|
||||
perror(outFile);
|
||||
close(inFd);
|
||||
free(buf);
|
||||
exit(FALSE);
|
||||
}
|
||||
|
||||
lseek(inFd, skipBlocks * blockSize, SEEK_SET);
|
||||
lseek(outFd, seekBlocks * blockSize, SEEK_SET);
|
||||
//
|
||||
//TODO: Convert to using fullRead & fullWrite
|
||||
// from utility.c
|
||||
// -Erik
|
||||
while (outTotal < count * blockSize) {
|
||||
inCc = read(inFd, buf, blockSize);
|
||||
if (inCc < 0) {
|
||||
perror(inFile);
|
||||
goto cleanup;
|
||||
} else if (inCc == 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
intotal += inCc;
|
||||
cp = buf;
|
||||
|
||||
while (intotal > outTotal) {
|
||||
if (outTotal + inCc > count * blockSize)
|
||||
inCc = count * blockSize - outTotal;
|
||||
outCc = write(outFd, cp, inCc);
|
||||
if (outCc < 0) {
|
||||
perror(outFile);
|
||||
goto cleanup;
|
||||
} else if (outCc == 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
inCc -= outCc;
|
||||
cp += outCc;
|
||||
outTotal += outCc;
|
||||
while (in_full + in_part != count) {
|
||||
n = safe_read(ifd, buf, bs);
|
||||
if (n < 0)
|
||||
perror_msg_and_die("%s", infile);
|
||||
if (n == 0)
|
||||
break;
|
||||
if (n == bs)
|
||||
in_full++;
|
||||
else
|
||||
in_part++;
|
||||
if (sync_flag) {
|
||||
memset(buf + n, '\0', bs - n);
|
||||
n = bs;
|
||||
}
|
||||
n = full_write(ofd, buf, n);
|
||||
if (n < 0)
|
||||
perror_msg_and_die("%s", outfile);
|
||||
if (n == bs)
|
||||
out_full++;
|
||||
else
|
||||
out_part++;
|
||||
}
|
||||
|
||||
if (inCc < 0)
|
||||
perror(inFile);
|
||||
fprintf(statusfp, "%ld+%ld records in\n", (long)in_full, (long)in_part);
|
||||
fprintf(statusfp, "%ld+%ld records out\n", (long)out_full, (long)out_part);
|
||||
|
||||
cleanup:
|
||||
close(inFd);
|
||||
close(outFd);
|
||||
free(buf);
|
||||
|
||||
printf("%ld+%d records in\n", (long) (intotal / blockSize),
|
||||
(intotal % blockSize) != 0);
|
||||
printf("%ld+%d records out\n", (long) (outTotal / blockSize),
|
||||
(outTotal % blockSize) != 0);
|
||||
exit(TRUE);
|
||||
usage:
|
||||
|
||||
usage(dd_usage);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+97
-57
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Mini df implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
* based on original code by (I think) Bruce Perens <bruce@pixar.com>.
|
||||
*
|
||||
@@ -22,48 +22,63 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <mntent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <fstab.h>
|
||||
|
||||
static const char df_usage[] = "df [filesystem ...]\n"
|
||||
|
||||
"\n" "\tPrint the filesystem space used and space available.\n";
|
||||
#include <getopt.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern const char mtab_file[]; /* Defined in utility.c */
|
||||
#ifdef BB_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;
|
||||
struct fstab *fstabItem;
|
||||
|
||||
if (statfs(mountPoint, &s) != 0) {
|
||||
perror(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;
|
||||
blocks_percent_used = (long)
|
||||
(blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5);
|
||||
/* Note that if /etc/fstab is missing, libc can't fix up /dev/root for us */
|
||||
if (strcmp(device, "/dev/root") == 0) {
|
||||
fstabItem = getfsfile("/");
|
||||
if (fstabItem != NULL)
|
||||
device = fstabItem->fs_spec;
|
||||
if(blocks_used == 0)
|
||||
blocks_percent_used = 0;
|
||||
else {
|
||||
blocks_percent_used = (long)
|
||||
(blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5);
|
||||
}
|
||||
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);
|
||||
if (strcmp(device, "/dev/root") == 0) {
|
||||
/* Adjusts device to be the real root device,
|
||||
* or leaves device alone if it can't find it */
|
||||
device = find_real_root_device_name(device);
|
||||
if(device==NULL)
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef BB_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 / (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;
|
||||
@@ -71,42 +86,67 @@ static int df(char *device, const char *mountPoint)
|
||||
|
||||
extern int df_main(int argc, char **argv)
|
||||
{
|
||||
printf("%-20s %-14s %s %s %s %s\n", "Filesystem",
|
||||
"1k-blocks", "Used", "Available", "Use%", "Mounted on");
|
||||
int status = EXIT_SUCCESS;
|
||||
int opt = 0;
|
||||
int i = 0;
|
||||
char disp_units_hdr[80] = "1k-blocks"; /* default display is kilobytes */
|
||||
|
||||
if (argc > 1) {
|
||||
struct mntent *mountEntry;
|
||||
int status;
|
||||
|
||||
while (argc > 1) {
|
||||
if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
|
||||
fprintf(stderr, "%s: can't find mount point.\n", argv[1]);
|
||||
exit(FALSE);
|
||||
}
|
||||
status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
|
||||
if (status != 0)
|
||||
exit(status);
|
||||
argc--;
|
||||
argv++;
|
||||
while ((opt = getopt(argc, argv, "k"
|
||||
#ifdef BB_FEATURE_HUMAN_READABLE
|
||||
"hm"
|
||||
#endif
|
||||
)) > 0)
|
||||
{
|
||||
switch (opt) {
|
||||
#ifdef BB_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 'k':
|
||||
/* default display is kilobytes */
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
exit(TRUE);
|
||||
} else {
|
||||
FILE *mountTable;
|
||||
struct mntent *mountEntry;
|
||||
|
||||
mountTable = setmntent(mtab_file, "r");
|
||||
if (mountTable == 0) {
|
||||
perror(mtab_file);
|
||||
exit(FALSE);
|
||||
}
|
||||
|
||||
while ((mountEntry = getmntent(mountTable))) {
|
||||
df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
|
||||
}
|
||||
endmntent(mountTable);
|
||||
}
|
||||
|
||||
exit(TRUE);
|
||||
printf("%-20s %-14s %s %s %s %s\n", "Filesystem", disp_units_hdr,
|
||||
"Used", "Available", "Use%", "Mounted on");
|
||||
|
||||
if(optind < argc) {
|
||||
struct mntent *mount_entry;
|
||||
for(i = optind; i < argc; 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 (!do_df(mount_entry->mnt_fsname, mount_entry->mnt_dir))
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
} else {
|
||||
FILE *mount_table;
|
||||
struct mntent *mount_entry;
|
||||
|
||||
mount_table = setmntent(mtab_file, "r");
|
||||
if (mount_table == 0) {
|
||||
perror_msg("%s", mtab_file);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
while ((mount_entry = getmntent(mount_table))) {
|
||||
if (!do_df(mount_entry->mnt_fsname, mount_entry->mnt_dir))
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
endmntent(mount_table);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+26
-132
@@ -1,146 +1,40 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This is temporary -- needs to be rewritten to be tighter */
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* Mini dirname implementation for busybox
|
||||
*
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#ifndef lint
|
||||
static char copyright[] = "@(#) Copyright (c) 1991, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
/* getopt not needed */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)dirname.c 8.4 (Berkeley) 5/4/95";
|
||||
#endif /* not lint */
|
||||
#endif /* #if 0 */
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
void dirname_usage()
|
||||
extern int dirname_main(int argc, char **argv)
|
||||
{
|
||||
if ((argc < 2) || (**(argv + 1) == '-'))
|
||||
show_usage();
|
||||
argv++;
|
||||
|
||||
(void) fprintf(stderr, "usage: dirname path\n");
|
||||
exit(1);
|
||||
}
|
||||
puts (dirname (argv[0]));
|
||||
|
||||
extern int dirname_main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *p;
|
||||
int ch;
|
||||
|
||||
while ((ch = getopt(argc, argv, "")) != -1)
|
||||
switch (ch) {
|
||||
case '?':
|
||||
default:
|
||||
dirname_usage();
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc != 1)
|
||||
dirname_usage();
|
||||
|
||||
/*
|
||||
* (1) If string is //, skip steps (2) through (5).
|
||||
* (2) If string consists entirely of slash characters, string
|
||||
* shall be set to a single slash character. In this case,
|
||||
* skip steps (3) through (8).
|
||||
*/
|
||||
for (p = *argv;; ++p) {
|
||||
if (!*p) {
|
||||
if (p > *argv)
|
||||
(void) printf("/\n");
|
||||
else
|
||||
(void) printf(".\n");
|
||||
exit(0);
|
||||
}
|
||||
if (*p != '/')
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* (3) If there are any trailing slash characters in string, they
|
||||
* shall be removed.
|
||||
*/
|
||||
for (; *p; ++p);
|
||||
while (*--p == '/')
|
||||
continue;
|
||||
*++p = '\0';
|
||||
|
||||
/*
|
||||
* (4) If there are no slash characters remaining in string,
|
||||
* string shall be set to a single period character. In this
|
||||
* case skip steps (5) through (8).
|
||||
*
|
||||
* (5) If there are any trailing nonslash characters in string,
|
||||
* they shall be removed.
|
||||
*/
|
||||
while (--p >= *argv)
|
||||
if (*p == '/')
|
||||
break;
|
||||
++p;
|
||||
if (p == *argv) {
|
||||
(void) printf(".\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* (6) If the remaining string is //, it is implementation defined
|
||||
* whether steps (7) and (8) are skipped or processed.
|
||||
*
|
||||
* This case has already been handled, as part of steps (1) and (2).
|
||||
*/
|
||||
|
||||
/*
|
||||
* (7) If there are any trailing slash characters in string, they
|
||||
* shall be removed.
|
||||
*/
|
||||
while (--p >= *argv)
|
||||
if (*p != '/')
|
||||
break;
|
||||
++p;
|
||||
|
||||
/*
|
||||
* (8) If the remaining string is empty, string shall be set to
|
||||
* a single slash character.
|
||||
*/
|
||||
*p = '\0';
|
||||
(void) printf("%s\n", p == *argv ? "/" : *argv);
|
||||
exit(0);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* dos2unix for BusyBox
|
||||
*
|
||||
* dos2unix '\n' convertor 0.5.0
|
||||
* based on Unix2Dos 0.9.0 by Peter Hanecak (made 19.2.1997)
|
||||
* Copyright 1997,.. by Peter Hanecak <hanecak@megaloman.sk>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* dos2unix filters reading input from stdin and writing output to stdout.
|
||||
* Without arguments it reverts the format (e.i. if source is in UNIX format,
|
||||
* output is in DOS format and vice versa).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* See the COPYING file for license information.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include "busybox.h"
|
||||
|
||||
// if fn is NULL then input is stdin and output is stdout
|
||||
static int convert(char *fn, int ConvType) {
|
||||
int c;
|
||||
char *tempFn = NULL;
|
||||
FILE *in = stdin, *out = stdout;
|
||||
|
||||
if (fn != NULL) {
|
||||
if ((in = wfopen(fn, "r")) == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if ((out = tmpfile()) == NULL) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
while ((c = fgetc(in)) != EOF) {
|
||||
if (c == '\r') {
|
||||
if ((ConvType == CT_UNIX2DOS) && (fn != NULL)) {
|
||||
// file is alredy in DOS format so it is not necessery to touch it
|
||||
if (fclose(in) < 0 || fclose(out) < 0) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (!ConvType)
|
||||
ConvType = CT_DOS2UNIX;
|
||||
break;
|
||||
}
|
||||
if (c == '\n') {
|
||||
if ((ConvType == CT_DOS2UNIX) && (fn != NULL)) {
|
||||
// file is alredy in UNIX format so it is not necessery to touch it
|
||||
if ((fclose(in) < 0) || (fclose(out) < 0)) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (!ConvType) {
|
||||
ConvType = CT_UNIX2DOS;
|
||||
}
|
||||
if (ConvType == CT_UNIX2DOS) {
|
||||
fputc('\r', out);
|
||||
}
|
||||
fputc('\n', out);
|
||||
break;
|
||||
}
|
||||
fputc(c, out);
|
||||
}
|
||||
if (c != EOF)
|
||||
while ((c = fgetc(in)) != EOF) {
|
||||
if (c == '\r')
|
||||
continue;
|
||||
if (c == '\n') {
|
||||
if (ConvType == CT_UNIX2DOS)
|
||||
fputc('\r', out);
|
||||
fputc('\n', out);
|
||||
continue;
|
||||
}
|
||||
fputc(c, out);
|
||||
}
|
||||
|
||||
if (fn != NULL) {
|
||||
if (fclose(in) < 0 || fclose(out) < 0 ||
|
||||
(in = fopen(tempFn, "r")) == NULL || (out = fopen(fn, "w")) == NULL) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
}
|
||||
|
||||
while ((c = fgetc(in)) != EOF) {
|
||||
fputc(c, out);
|
||||
}
|
||||
|
||||
if ((fclose(in) < 0) || (fclose(out) < 0)) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dos2unix_main(int argc, char *argv[]) {
|
||||
int ConvType = CT_AUTO;
|
||||
int o;
|
||||
|
||||
// process parameters
|
||||
while ((o = getopt(argc, argv, "du")) != EOF) {
|
||||
switch (o) {
|
||||
case 'd':
|
||||
ConvType = CT_UNIX2DOS;
|
||||
break;
|
||||
case 'u':
|
||||
ConvType = CT_DOS2UNIX;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc) {
|
||||
while(optind < argc)
|
||||
if ((o = convert(argv[optind++], ConvType)) < 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
o = convert(NULL, ConvType);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
+121
-56
@@ -3,7 +3,7 @@
|
||||
* Mini du implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by John Beppu <beppu@lineo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -22,28 +22,23 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#define BB_DECLARE_EXTERN
|
||||
#define bb_need_name_too_long
|
||||
#include "messages.c"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/param.h> /* for PATH_MAX */
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
#ifdef BB_FEATURE_HUMAN_READABLE
|
||||
static unsigned long disp_hr = KILOBYTE;
|
||||
#endif
|
||||
|
||||
typedef void (Display) (long, char *);
|
||||
|
||||
static const char du_usage[] =
|
||||
"du [OPTION]... [FILE]...\n\n"
|
||||
"Summarize disk space used for each FILE and/or directory.\n"
|
||||
"Disk space is printed in units of 1024 bytes.\n\n"
|
||||
"Options:\n"
|
||||
"\t-l\tcount sizes many times if hard linked\n"
|
||||
"\t-s\tdisplay only a total for each argument\n";
|
||||
|
||||
static int du_depth = 0;
|
||||
static int count_hardlinks = 0;
|
||||
|
||||
@@ -51,7 +46,11 @@ static Display *print;
|
||||
|
||||
static void print_normal(long size, char *filename)
|
||||
{
|
||||
fprintf(stdout, "%ld\t%s\n", size, filename);
|
||||
#ifdef BB_FEATURE_HUMAN_READABLE
|
||||
printf("%s\t%s\n", make_human_readable_str(size<<10, 1, disp_hr), filename);
|
||||
#else
|
||||
printf("%ld\t%s\n", size, filename);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void print_summary(long size, char *filename)
|
||||
@@ -61,15 +60,86 @@ static void print_summary(long size, char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
#define HASH_SIZE 311 /* Should be prime */
|
||||
#define hash_inode(i) ((i) % HASH_SIZE)
|
||||
|
||||
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;
|
||||
|
||||
static ino_dev_hashtable_bucket_t *ino_dev_hashtable[HASH_SIZE];
|
||||
|
||||
/*
|
||||
* Return 1 if statbuf->st_ino && statbuf->st_dev are recorded in
|
||||
* `ino_dev_hashtable', else return 0
|
||||
*
|
||||
* If NAME is a non-NULL pointer to a character pointer, and there is
|
||||
* a match, then set *NAME to the value of the name slot in that
|
||||
* bucket.
|
||||
*/
|
||||
static int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name)
|
||||
{
|
||||
ino_dev_hashtable_bucket_t *bucket;
|
||||
|
||||
bucket = ino_dev_hashtable[hash_inode(statbuf->st_ino)];
|
||||
while (bucket != NULL) {
|
||||
if ((bucket->ino == statbuf->st_ino) &&
|
||||
(bucket->dev == statbuf->st_dev))
|
||||
{
|
||||
if (name) *name = bucket->name;
|
||||
return 1;
|
||||
}
|
||||
bucket = bucket->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Add statbuf to statbuf hash table */
|
||||
static void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name)
|
||||
{
|
||||
int i;
|
||||
size_t s;
|
||||
ino_dev_hashtable_bucket_t *bucket;
|
||||
|
||||
i = hash_inode(statbuf->st_ino);
|
||||
s = name ? strlen(name) : 0;
|
||||
bucket = xmalloc(sizeof(ino_dev_hashtable_bucket_t) + s);
|
||||
bucket->ino = statbuf->st_ino;
|
||||
bucket->dev = statbuf->st_dev;
|
||||
if (name)
|
||||
strcpy(bucket->name, name);
|
||||
else
|
||||
bucket->name[0] = '\0';
|
||||
bucket->next = ino_dev_hashtable[i];
|
||||
ino_dev_hashtable[i] = bucket;
|
||||
}
|
||||
|
||||
/* Clear statbuf hash table */
|
||||
static void reset_ino_dev_hashtable(void)
|
||||
{
|
||||
int i;
|
||||
ino_dev_hashtable_bucket_t *bucket;
|
||||
|
||||
for (i = 0; i < HASH_SIZE; i++) {
|
||||
while (ino_dev_hashtable[i] != NULL) {
|
||||
bucket = ino_dev_hashtable[i]->next;
|
||||
free(ino_dev_hashtable[i]);
|
||||
ino_dev_hashtable[i] = bucket;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* tiny recursive du */
|
||||
static long du(char *filename)
|
||||
{
|
||||
struct stat statbuf;
|
||||
long sum;
|
||||
int len;
|
||||
|
||||
if ((lstat(filename, &statbuf)) != 0) {
|
||||
printf("du: %s: %s\n", filename, strerror(errno));
|
||||
perror_msg("%s", filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -79,12 +149,13 @@ static long du(char *filename)
|
||||
/* Don't add in stuff pointed to by symbolic links */
|
||||
if (S_ISLNK(statbuf.st_mode)) {
|
||||
sum = 0L;
|
||||
if (du_depth == 1)
|
||||
print(sum, filename);
|
||||
if (du_depth == 1) {
|
||||
}
|
||||
}
|
||||
if (S_ISDIR(statbuf.st_mode)) {
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
char *newfile;
|
||||
|
||||
dir = opendir(filename);
|
||||
if (!dir) {
|
||||
@@ -92,27 +163,20 @@ static long du(char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
len = strlen(filename);
|
||||
if (filename[len - 1] == '/')
|
||||
filename[--len] = '\0';
|
||||
newfile = last_char_is(filename, '/');
|
||||
if (newfile)
|
||||
*newfile = '\0';
|
||||
|
||||
while ((entry = readdir(dir))) {
|
||||
char newfile[PATH_MAX + 1];
|
||||
char *name = entry->d_name;
|
||||
|
||||
if ((strcmp(name, "..") == 0)
|
||||
|| (strcmp(name, ".") == 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (len + strlen(name) + 1 > PATH_MAX) {
|
||||
fprintf(stderr, name_too_long, "du");
|
||||
du_depth--;
|
||||
return 0;
|
||||
}
|
||||
sprintf(newfile, "%s/%s", filename, name);
|
||||
|
||||
newfile = concat_path_file(filename, name);
|
||||
sum += du(newfile);
|
||||
free(newfile);
|
||||
}
|
||||
closedir(dir);
|
||||
print(sum, filename);
|
||||
@@ -134,55 +198,56 @@ static long du(char *filename)
|
||||
|
||||
int du_main(int argc, char **argv)
|
||||
{
|
||||
int status = EXIT_SUCCESS;
|
||||
int i;
|
||||
char opt;
|
||||
int c;
|
||||
|
||||
/* default behaviour */
|
||||
print = print_normal;
|
||||
|
||||
/* parse argv[] */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
opt = argv[i][1];
|
||||
switch (opt) {
|
||||
while ((c = getopt(argc, argv, "sl"
|
||||
#ifdef BB_FEATURE_HUMAN_READABLE
|
||||
"hm"
|
||||
#endif
|
||||
"k")) != EOF) {
|
||||
switch (c) {
|
||||
case 's':
|
||||
print = print_summary;
|
||||
break;
|
||||
print = print_summary;
|
||||
break;
|
||||
case 'l':
|
||||
count_hardlinks = 1;
|
||||
break;
|
||||
case 'h':
|
||||
case '-':
|
||||
usage(du_usage);
|
||||
break;
|
||||
count_hardlinks = 1;
|
||||
break;
|
||||
#ifdef BB_FEATURE_HUMAN_READABLE
|
||||
case 'h': disp_hr = 0; break;
|
||||
case 'm': disp_hr = MEGABYTE; break;
|
||||
#endif
|
||||
case 'k': break;
|
||||
default:
|
||||
fprintf(stderr, "du: invalid option -- %c\n", opt);
|
||||
usage(du_usage);
|
||||
show_usage();
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* go through remaining args (if any) */
|
||||
if (i >= argc) {
|
||||
du(".");
|
||||
if (optind >= argc) {
|
||||
if (du(".") == 0)
|
||||
status = EXIT_FAILURE;
|
||||
} else {
|
||||
long sum;
|
||||
|
||||
for (; i < argc; i++) {
|
||||
for (i=optind; i < argc; i++) {
|
||||
sum = du(argv[i]);
|
||||
if (sum && isDirectory(argv[i], FALSE, NULL)) {
|
||||
if(is_directory(argv[i], FALSE, NULL)==FALSE) {
|
||||
print_normal(sum, argv[i]);
|
||||
}
|
||||
reset_ino_dev_hashtable();
|
||||
}
|
||||
}
|
||||
|
||||
exit(0);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* $Id: du.c,v 1.16 2000/03/04 21:19:32 erik Exp $ */
|
||||
/* $Id: du.c,v 1.50 2001/06/30 17:54:20 andersen Exp $ */
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* echo implementation for busybox
|
||||
*
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Original copyright notice is retained at the end of this file.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int
|
||||
echo_main(int argc, char** argv)
|
||||
{
|
||||
int nflag = 0;
|
||||
int eflag = 0;
|
||||
|
||||
/* Skip argv[0]. */
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
while (argc > 0 && *argv[0] == '-')
|
||||
{
|
||||
register char *temp;
|
||||
register int ix;
|
||||
|
||||
/*
|
||||
* If it appears that we are handling options, then make sure
|
||||
* that all of the options specified are actually valid.
|
||||
* Otherwise, the string should just be echoed.
|
||||
*/
|
||||
temp = argv[0] + 1;
|
||||
|
||||
for (ix = 0; temp[ix]; ix++)
|
||||
{
|
||||
if (strrchr("neE", temp[ix]) == 0)
|
||||
goto just_echo;
|
||||
}
|
||||
|
||||
if (!*temp)
|
||||
goto just_echo;
|
||||
|
||||
/*
|
||||
* All of the options in temp are valid options to echo.
|
||||
* Handle them.
|
||||
*/
|
||||
while (*temp)
|
||||
{
|
||||
if (*temp == 'n')
|
||||
nflag = 1;
|
||||
else if (*temp == 'e')
|
||||
eflag = 1;
|
||||
else if (*temp == 'E')
|
||||
eflag = 0;
|
||||
else
|
||||
goto just_echo;
|
||||
|
||||
temp++;
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
just_echo:
|
||||
while (argc > 0) {
|
||||
const char *arg = argv[0];
|
||||
register int c;
|
||||
|
||||
while ((c = *arg++)) {
|
||||
|
||||
/* Check for escape sequence. */
|
||||
if (c == '\\' && eflag && *arg) {
|
||||
if (*arg == 'c') {
|
||||
/* '\c' means cancel newline. */
|
||||
nflag = 1;
|
||||
arg++;
|
||||
continue;
|
||||
} else {
|
||||
c = process_escape_sequence(&arg);
|
||||
}
|
||||
}
|
||||
|
||||
putchar(c);
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
if (argc > 0)
|
||||
putchar(' ');
|
||||
}
|
||||
if (!nflag)
|
||||
putchar('\n');
|
||||
fflush(stdout);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Kenneth Almquist.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
|
||||
* ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
|
||||
*
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)echo.c 8.1 (Berkeley) 5/31/93
|
||||
*/
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* env implementation for busybox
|
||||
*
|
||||
* Copyright (c) 1988, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Original copyright notice is retained at the end of this file.
|
||||
*
|
||||
* Modified for BusyBox by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int env_main(int argc, char** argv)
|
||||
{
|
||||
char **ep, *p;
|
||||
char *cleanenv[1];
|
||||
int ignore_environment = 0;
|
||||
int ch;
|
||||
|
||||
while ((ch = getopt(argc, argv, "+iu:")) != -1) {
|
||||
switch(ch) {
|
||||
case 'i':
|
||||
ignore_environment = 1;
|
||||
break;
|
||||
case 'u':
|
||||
unsetenv(optarg);
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
if (optind != argc && !strcmp(argv[optind], "-")) {
|
||||
ignore_environment = 1;
|
||||
argv++;
|
||||
}
|
||||
if (ignore_environment) {
|
||||
environ = cleanenv;
|
||||
cleanenv[0] = NULL;
|
||||
}
|
||||
for (argv += optind; *argv && (p = strchr(*argv, '=')); ++argv)
|
||||
if (putenv(*argv) < 0)
|
||||
perror_msg_and_die("%s", *argv);
|
||||
if (*argv) {
|
||||
execvp(*argv, argv);
|
||||
perror_msg_and_die("%s", *argv);
|
||||
}
|
||||
for (ep = environ; *ep; ep++)
|
||||
puts(*ep);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
|
||||
* ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
|
||||
*
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
@@ -0,0 +1,535 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini expr implementation for busybox
|
||||
*
|
||||
* based on GNU expr Mike Parker.
|
||||
* Copyright (C) 86, 1991-1997, 1999 Free Software Foundation, Inc.
|
||||
*
|
||||
* Busybox modifications
|
||||
* Copyright (c) 2000 Edward Betts <edward@debian.org>.
|
||||
*
|
||||
* this program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the gnu general public license as published by
|
||||
* the free software foundation; either version 2 of the license, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* this program is distributed in the hope that it will be useful,
|
||||
* but without any warranty; without even the implied warranty of
|
||||
* merchantability or fitness for a particular purpose. see the gnu
|
||||
* general public license for more details.
|
||||
*
|
||||
* you should have received a copy of the gnu general public license
|
||||
* along with this program; if not, write to the free software
|
||||
* foundation, inc., 59 temple place, suite 330, boston, ma 02111-1307 usa
|
||||
*
|
||||
*/
|
||||
|
||||
/* This program evaluates expressions. Each token (operator, operand,
|
||||
* parenthesis) of the expression must be a seperate argument. The
|
||||
* parser used is a reasonably general one, though any incarnation of
|
||||
* it is language-specific. It is especially nice for expressions.
|
||||
*
|
||||
* No parse tree is needed; a new node is evaluated immediately.
|
||||
* One function can handle multiple operators all of equal precedence,
|
||||
* provided they all associate ((x op x) op x). */
|
||||
|
||||
/* no getopt needed */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <regex.h>
|
||||
#include <sys/types.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
/* The kinds of value we can have. */
|
||||
enum valtype {
|
||||
integer,
|
||||
string
|
||||
};
|
||||
typedef enum valtype TYPE;
|
||||
|
||||
/* A value is.... */
|
||||
struct valinfo {
|
||||
TYPE type; /* Which kind. */
|
||||
union { /* The value itself. */
|
||||
int i;
|
||||
char *s;
|
||||
} u;
|
||||
};
|
||||
typedef struct valinfo VALUE;
|
||||
|
||||
/* The arguments given to the program, minus the program name. */
|
||||
static char **args;
|
||||
|
||||
static VALUE *docolon (VALUE *sv, VALUE *pv);
|
||||
static VALUE *eval (void);
|
||||
static VALUE *int_value (int i);
|
||||
static VALUE *str_value (char *s);
|
||||
static int nextarg (char *str);
|
||||
static int null (VALUE *v);
|
||||
static int toarith (VALUE *v);
|
||||
static void freev (VALUE *v);
|
||||
static void tostring (VALUE *v);
|
||||
|
||||
int expr_main (int argc, char **argv)
|
||||
{
|
||||
VALUE *v;
|
||||
|
||||
if (argc == 1) {
|
||||
error_msg_and_die("too few arguments");
|
||||
}
|
||||
|
||||
args = argv + 1;
|
||||
|
||||
v = eval ();
|
||||
if (*args)
|
||||
error_msg_and_die ("syntax error");
|
||||
|
||||
if (v->type == integer)
|
||||
printf ("%d\n", v->u.i);
|
||||
else
|
||||
puts (v->u.s);
|
||||
|
||||
exit (null (v));
|
||||
}
|
||||
|
||||
/* Return a VALUE for I. */
|
||||
|
||||
static VALUE *int_value (int i)
|
||||
{
|
||||
VALUE *v;
|
||||
|
||||
v = xmalloc (sizeof(VALUE));
|
||||
v->type = integer;
|
||||
v->u.i = i;
|
||||
return v;
|
||||
}
|
||||
|
||||
/* Return a VALUE for S. */
|
||||
|
||||
static VALUE *str_value (char *s)
|
||||
{
|
||||
VALUE *v;
|
||||
|
||||
v = xmalloc (sizeof(VALUE));
|
||||
v->type = string;
|
||||
v->u.s = strdup (s);
|
||||
return v;
|
||||
}
|
||||
|
||||
/* Free VALUE V, including structure components. */
|
||||
|
||||
static void freev (VALUE *v)
|
||||
{
|
||||
if (v->type == string)
|
||||
free (v->u.s);
|
||||
free (v);
|
||||
}
|
||||
|
||||
/* Return nonzero if V is a null-string or zero-number. */
|
||||
|
||||
static int null (VALUE *v)
|
||||
{
|
||||
switch (v->type) {
|
||||
case integer:
|
||||
return v->u.i == 0;
|
||||
case string:
|
||||
return v->u.s[0] == '\0' || strcmp (v->u.s, "0") == 0;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Coerce V to a string value (can't fail). */
|
||||
|
||||
static void tostring (VALUE *v)
|
||||
{
|
||||
char *temp;
|
||||
|
||||
if (v->type == integer) {
|
||||
temp = xmalloc (4 * (sizeof (int) / sizeof (char)));
|
||||
sprintf (temp, "%d", v->u.i);
|
||||
v->u.s = temp;
|
||||
v->type = string;
|
||||
}
|
||||
}
|
||||
|
||||
/* Coerce V to an integer value. Return 1 on success, 0 on failure. */
|
||||
|
||||
static int toarith (VALUE *v)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (v->type) {
|
||||
case integer:
|
||||
return 1;
|
||||
case string:
|
||||
i = 0;
|
||||
/* Don't interpret the empty string as an integer. */
|
||||
if (v->u.s == 0)
|
||||
return 0;
|
||||
i = atoi(v->u.s);
|
||||
free (v->u.s);
|
||||
v->u.i = i;
|
||||
v->type = integer;
|
||||
return 1;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Return nonzero if the next token matches STR exactly.
|
||||
STR must not be NULL. */
|
||||
|
||||
static int
|
||||
nextarg (char *str)
|
||||
{
|
||||
if (*args == NULL)
|
||||
return 0;
|
||||
return strcmp (*args, str) == 0;
|
||||
}
|
||||
|
||||
/* The comparison operator handling functions. */
|
||||
|
||||
#define cmpf(name, rel) \
|
||||
static int name (l, r) VALUE *l; VALUE *r; \
|
||||
{ \
|
||||
if (l->type == string || r->type == string) { \
|
||||
tostring (l); \
|
||||
tostring (r); \
|
||||
return strcmp (l->u.s, r->u.s) rel 0; \
|
||||
} \
|
||||
else \
|
||||
return l->u.i rel r->u.i; \
|
||||
}
|
||||
cmpf (less_than, <)
|
||||
cmpf (less_equal, <=)
|
||||
cmpf (equal, ==)
|
||||
cmpf (not_equal, !=)
|
||||
cmpf (greater_equal, >=)
|
||||
cmpf (greater_than, >)
|
||||
|
||||
#undef cmpf
|
||||
|
||||
/* The arithmetic operator handling functions. */
|
||||
|
||||
#define arithf(name, op) \
|
||||
static \
|
||||
int name (l, r) VALUE *l; VALUE *r; \
|
||||
{ \
|
||||
if (!toarith (l) || !toarith (r)) \
|
||||
error_msg_and_die ("non-numeric argument"); \
|
||||
return l->u.i op r->u.i; \
|
||||
}
|
||||
|
||||
#define arithdivf(name, op) \
|
||||
static int name (l, r) VALUE *l; VALUE *r; \
|
||||
{ \
|
||||
if (!toarith (l) || !toarith (r)) \
|
||||
error_msg_and_die ( "non-numeric argument"); \
|
||||
if (r->u.i == 0) \
|
||||
error_msg_and_die ( "division by zero"); \
|
||||
return l->u.i op r->u.i; \
|
||||
}
|
||||
|
||||
arithf (plus, +)
|
||||
arithf (minus, -)
|
||||
arithf (multiply, *)
|
||||
arithdivf (divide, /)
|
||||
arithdivf (mod, %)
|
||||
|
||||
#undef arithf
|
||||
#undef arithdivf
|
||||
|
||||
/* Do the : operator.
|
||||
SV is the VALUE for the lhs (the string),
|
||||
PV is the VALUE for the rhs (the pattern). */
|
||||
|
||||
static VALUE *docolon (VALUE *sv, VALUE *pv)
|
||||
{
|
||||
VALUE *v;
|
||||
const char *errmsg;
|
||||
struct re_pattern_buffer re_buffer;
|
||||
struct re_registers re_regs;
|
||||
int len;
|
||||
|
||||
tostring (sv);
|
||||
tostring (pv);
|
||||
|
||||
if (pv->u.s[0] == '^') {
|
||||
fprintf (stderr, "\
|
||||
warning: unportable BRE: `%s': using `^' as the first character\n\
|
||||
of a basic regular expression is not portable; it is being ignored",
|
||||
pv->u.s);
|
||||
}
|
||||
|
||||
len = strlen (pv->u.s);
|
||||
memset (&re_buffer, 0, sizeof (re_buffer));
|
||||
memset (&re_regs, 0, sizeof (re_regs));
|
||||
re_buffer.allocated = 2 * len;
|
||||
re_buffer.buffer = (unsigned char *) xmalloc (re_buffer.allocated);
|
||||
re_buffer.translate = 0;
|
||||
re_syntax_options = RE_SYNTAX_POSIX_BASIC;
|
||||
errmsg = re_compile_pattern (pv->u.s, len, &re_buffer);
|
||||
if (errmsg) {
|
||||
error_msg_and_die("%s", errmsg);
|
||||
}
|
||||
|
||||
len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs);
|
||||
if (len >= 0) {
|
||||
/* Were \(...\) used? */
|
||||
if (re_buffer.re_nsub > 0) { /* was (re_regs.start[1] >= 0) */
|
||||
sv->u.s[re_regs.end[1]] = '\0';
|
||||
v = str_value (sv->u.s + re_regs.start[1]);
|
||||
}
|
||||
else
|
||||
v = int_value (len);
|
||||
}
|
||||
else {
|
||||
/* Match failed -- return the right kind of null. */
|
||||
if (re_buffer.re_nsub > 0)
|
||||
v = str_value ("");
|
||||
else
|
||||
v = int_value (0);
|
||||
}
|
||||
free (re_buffer.buffer);
|
||||
return v;
|
||||
}
|
||||
|
||||
/* Handle bare operands and ( expr ) syntax. */
|
||||
|
||||
static VALUE *eval7 (void)
|
||||
{
|
||||
VALUE *v;
|
||||
|
||||
if (!*args)
|
||||
error_msg_and_die ( "syntax error");
|
||||
|
||||
if (nextarg ("(")) {
|
||||
args++;
|
||||
v = eval ();
|
||||
if (!nextarg (")"))
|
||||
error_msg_and_die ( "syntax error");
|
||||
args++;
|
||||
return v;
|
||||
}
|
||||
|
||||
if (nextarg (")"))
|
||||
error_msg_and_die ( "syntax error");
|
||||
|
||||
return str_value (*args++);
|
||||
}
|
||||
|
||||
/* Handle match, substr, index, length, and quote keywords. */
|
||||
|
||||
static VALUE *eval6 (void)
|
||||
{
|
||||
VALUE *l, *r, *v, *i1, *i2;
|
||||
|
||||
if (nextarg ("quote")) {
|
||||
args++;
|
||||
if (!*args)
|
||||
error_msg_and_die ( "syntax error");
|
||||
return str_value (*args++);
|
||||
}
|
||||
else if (nextarg ("length")) {
|
||||
args++;
|
||||
r = eval6 ();
|
||||
tostring (r);
|
||||
v = int_value (strlen (r->u.s));
|
||||
freev (r);
|
||||
return v;
|
||||
}
|
||||
else if (nextarg ("match")) {
|
||||
args++;
|
||||
l = eval6 ();
|
||||
r = eval6 ();
|
||||
v = docolon (l, r);
|
||||
freev (l);
|
||||
freev (r);
|
||||
return v;
|
||||
}
|
||||
else if (nextarg ("index")) {
|
||||
args++;
|
||||
l = eval6 ();
|
||||
r = eval6 ();
|
||||
tostring (l);
|
||||
tostring (r);
|
||||
v = int_value (strcspn (l->u.s, r->u.s) + 1);
|
||||
if (v->u.i == (int) strlen (l->u.s) + 1)
|
||||
v->u.i = 0;
|
||||
freev (l);
|
||||
freev (r);
|
||||
return v;
|
||||
}
|
||||
else if (nextarg ("substr")) {
|
||||
args++;
|
||||
l = eval6 ();
|
||||
i1 = eval6 ();
|
||||
i2 = eval6 ();
|
||||
tostring (l);
|
||||
if (!toarith (i1) || !toarith (i2)
|
||||
|| i1->u.i > (int) strlen (l->u.s)
|
||||
|| i1->u.i <= 0 || i2->u.i <= 0)
|
||||
v = str_value ("");
|
||||
else {
|
||||
v = xmalloc (sizeof(VALUE));
|
||||
v->type = string;
|
||||
v->u.s = strncpy ((char *) xmalloc (i2->u.i + 1),
|
||||
l->u.s + i1->u.i - 1, i2->u.i);
|
||||
v->u.s[i2->u.i] = 0;
|
||||
}
|
||||
freev (l);
|
||||
freev (i1);
|
||||
freev (i2);
|
||||
return v;
|
||||
}
|
||||
else
|
||||
return eval7 ();
|
||||
}
|
||||
|
||||
/* Handle : operator (pattern matching).
|
||||
Calls docolon to do the real work. */
|
||||
|
||||
static VALUE *eval5 (void)
|
||||
{
|
||||
VALUE *l, *r, *v;
|
||||
|
||||
l = eval6 ();
|
||||
while (nextarg (":")) {
|
||||
args++;
|
||||
r = eval6 ();
|
||||
v = docolon (l, r);
|
||||
freev (l);
|
||||
freev (r);
|
||||
l = v;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
/* Handle *, /, % operators. */
|
||||
|
||||
static VALUE *eval4 (void)
|
||||
{
|
||||
VALUE *l, *r;
|
||||
int (*fxn) (), val;
|
||||
|
||||
l = eval5 ();
|
||||
while (1) {
|
||||
if (nextarg ("*"))
|
||||
fxn = multiply;
|
||||
else if (nextarg ("/"))
|
||||
fxn = divide;
|
||||
else if (nextarg ("%"))
|
||||
fxn = mod;
|
||||
else
|
||||
return l;
|
||||
args++;
|
||||
r = eval5 ();
|
||||
val = (*fxn) (l, r);
|
||||
freev (l);
|
||||
freev (r);
|
||||
l = int_value (val);
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle +, - operators. */
|
||||
|
||||
static VALUE *eval3 (void)
|
||||
{
|
||||
VALUE *l, *r;
|
||||
int (*fxn) (), val;
|
||||
|
||||
l = eval4 ();
|
||||
while (1) {
|
||||
if (nextarg ("+"))
|
||||
fxn = plus;
|
||||
else if (nextarg ("-"))
|
||||
fxn = minus;
|
||||
else
|
||||
return l;
|
||||
args++;
|
||||
r = eval4 ();
|
||||
val = (*fxn) (l, r);
|
||||
freev (l);
|
||||
freev (r);
|
||||
l = int_value (val);
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle comparisons. */
|
||||
|
||||
static VALUE *eval2 (void)
|
||||
{
|
||||
VALUE *l, *r;
|
||||
int (*fxn) (), val;
|
||||
|
||||
l = eval3 ();
|
||||
while (1) {
|
||||
if (nextarg ("<"))
|
||||
fxn = less_than;
|
||||
else if (nextarg ("<="))
|
||||
fxn = less_equal;
|
||||
else if (nextarg ("=") || nextarg ("=="))
|
||||
fxn = equal;
|
||||
else if (nextarg ("!="))
|
||||
fxn = not_equal;
|
||||
else if (nextarg (">="))
|
||||
fxn = greater_equal;
|
||||
else if (nextarg (">"))
|
||||
fxn = greater_than;
|
||||
else
|
||||
return l;
|
||||
args++;
|
||||
r = eval3 ();
|
||||
toarith (l);
|
||||
toarith (r);
|
||||
val = (*fxn) (l, r);
|
||||
freev (l);
|
||||
freev (r);
|
||||
l = int_value (val);
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle &. */
|
||||
|
||||
static VALUE *eval1 (void)
|
||||
{
|
||||
VALUE *l, *r;
|
||||
|
||||
l = eval2 ();
|
||||
while (nextarg ("&")) {
|
||||
args++;
|
||||
r = eval2 ();
|
||||
if (null (l) || null (r)) {
|
||||
freev (l);
|
||||
freev (r);
|
||||
l = int_value (0);
|
||||
}
|
||||
else
|
||||
freev (r);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
/* Handle |. */
|
||||
|
||||
static VALUE *eval (void)
|
||||
{
|
||||
VALUE *l, *r;
|
||||
|
||||
l = eval1 ();
|
||||
while (nextarg ("|")) {
|
||||
args++;
|
||||
r = eval1 ();
|
||||
if (null (l)) {
|
||||
freev (l);
|
||||
l = r;
|
||||
}
|
||||
else
|
||||
freev (r);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
+49
-62
@@ -3,7 +3,7 @@
|
||||
* Mini head implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by John Beppu <beppu@lineo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -22,29 +22,23 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
const char head_usage[] =
|
||||
"head [OPTION] [FILE]...\n\n"
|
||||
"Print first 10 lines of each FILE to standard output.\n"
|
||||
"With more than one FILE, precede each with a header giving the\n"
|
||||
"file name. With no FILE, or when FILE is -, read standard input.\n\n"
|
||||
|
||||
"Options:\n" "\t-n NUM\t\tPrint first NUM lines instead of first 10\n";
|
||||
|
||||
int head(int len, FILE * src)
|
||||
static int head(int len, FILE *fp)
|
||||
{
|
||||
int i;
|
||||
char buffer[1024];
|
||||
char *input;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
fgets(buffer, 1024, src);
|
||||
if (feof(src)) {
|
||||
if ((input = get_line_from_file(fp)) == NULL)
|
||||
break;
|
||||
}
|
||||
fputs(buffer, stdout);
|
||||
fputs(input, stdout);
|
||||
free(input);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -52,61 +46,54 @@ int head(int len, FILE * src)
|
||||
/* BusyBoxed head(1) */
|
||||
int head_main(int argc, char **argv)
|
||||
{
|
||||
char opt;
|
||||
int len = 10, tmplen, i;
|
||||
FILE *fp;
|
||||
int need_headers, opt, len = 10, status = EXIT_SUCCESS;
|
||||
|
||||
/* parse argv[] */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
opt = argv[i][1];
|
||||
switch (opt) {
|
||||
case 'n':
|
||||
tmplen = 0;
|
||||
if (++i < argc)
|
||||
tmplen = atoi(argv[i]);
|
||||
if (tmplen < 1)
|
||||
usage(head_usage);
|
||||
len = tmplen;
|
||||
while ((opt = getopt(argc, argv, "n:")) > 0) {
|
||||
switch (opt) {
|
||||
case 'n':
|
||||
len = atoi(optarg);
|
||||
if (len >= 1)
|
||||
break;
|
||||
case '-':
|
||||
case 'h':
|
||||
usage(head_usage);
|
||||
default:
|
||||
fprintf(stderr, "head: invalid option -- %c\n", opt);
|
||||
usage(head_usage);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
/* fallthrough */
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
/* get rest of argv[] or stdin if nothing's left */
|
||||
if (i >= argc) {
|
||||
if (argv[optind] == NULL) {
|
||||
head(len, stdin);
|
||||
return status;
|
||||
}
|
||||
|
||||
} else {
|
||||
int need_headers = ((argc - i) > 1);
|
||||
|
||||
for (; i < argc; i++) {
|
||||
FILE *src;
|
||||
|
||||
src = fopen(argv[i], "r");
|
||||
if (!src) {
|
||||
fprintf(stderr, "head: %s: %s\n", argv[i],
|
||||
strerror(errno));
|
||||
} else {
|
||||
/* emulating GNU behaviour */
|
||||
if (need_headers) {
|
||||
fprintf(stdout, "==> %s <==\n", argv[i]);
|
||||
}
|
||||
head(len, src);
|
||||
if (i < argc - 1) {
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
}
|
||||
need_headers = optind != (argc - 1);
|
||||
while (argv[optind]) {
|
||||
if (strcmp(argv[optind], "-") == 0) {
|
||||
fp = stdin;
|
||||
argv[optind] = "standard input";
|
||||
} else {
|
||||
if ((fp = wfopen(argv[optind], "r")) == NULL)
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
if (fp) {
|
||||
if (need_headers) {
|
||||
printf("==> %s <==\n", argv[optind]);
|
||||
}
|
||||
head(len, fp);
|
||||
if (errno) {
|
||||
perror_msg("%s", argv[optind]);
|
||||
status = EXIT_FAILURE;
|
||||
errno = 0;
|
||||
}
|
||||
if (optind < argc - 1)
|
||||
putchar('\n');
|
||||
if (fp != stdin)
|
||||
fclose(fp);
|
||||
}
|
||||
optind++;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* $Id: head.c,v 1.8 2000/02/08 19:58:47 erik Exp $ */
|
||||
return status;
|
||||
}
|
||||
+4
-2
@@ -20,11 +20,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int hostid_main(int argc, char **argv)
|
||||
{
|
||||
printf("%lx\n", gethostid());
|
||||
exit(TRUE);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini id implementation for busybox
|
||||
*
|
||||
* Copyright (C) 2000 by Randolph Chung <tausq@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"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
extern int id_main(int argc, char **argv)
|
||||
{
|
||||
int no_user = 0, no_group = 0, print_real = 0;
|
||||
int name_not_number = 0;
|
||||
char user[9], group[9];
|
||||
long gid;
|
||||
long pwnam, grnam;
|
||||
int opt;
|
||||
|
||||
gid = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "ugrn")) > 0) {
|
||||
switch (opt) {
|
||||
case 'u':
|
||||
no_group++;
|
||||
break;
|
||||
case 'g':
|
||||
no_user++;
|
||||
break;
|
||||
case 'r':
|
||||
print_real++;
|
||||
break;
|
||||
case 'n':
|
||||
name_not_number++;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (no_user && no_group) show_usage();
|
||||
|
||||
if (argv[optind] == NULL) {
|
||||
if (print_real) {
|
||||
my_getpwuid(user, getuid());
|
||||
my_getgrgid(group, getgid());
|
||||
} else {
|
||||
my_getpwuid(user, geteuid());
|
||||
my_getgrgid(group, getegid());
|
||||
}
|
||||
} else {
|
||||
strncpy(user, argv[optind], 8);
|
||||
user[8] = '\0';
|
||||
gid = my_getpwnamegid(user);
|
||||
my_getgrgid(group, gid);
|
||||
}
|
||||
|
||||
pwnam=my_getpwnam(user);
|
||||
grnam=my_getgrnam(group);
|
||||
|
||||
if (no_group) {
|
||||
if(name_not_number && user)
|
||||
puts(user);
|
||||
else
|
||||
printf("%ld\n", pwnam);
|
||||
} else if (no_user) {
|
||||
if(name_not_number && group)
|
||||
puts(group);
|
||||
else
|
||||
printf("%ld\n", grnam);
|
||||
} else {
|
||||
printf("uid=%ld(%s) gid=%ld(%s)\n", pwnam, user, grnam, group);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* END CODE */
|
||||
+5
-6
@@ -1,14 +1,13 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
#include "internal.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int length_main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 2 || **(argv + 1) == '-') {
|
||||
usage("length string\n");
|
||||
}
|
||||
printf("%d\n", strlen(argv[1]));
|
||||
return (TRUE);
|
||||
if (argc != 2 || **(argv + 1) == '-')
|
||||
show_usage();
|
||||
printf("%lu\n", (long)strlen(argv[1]));
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+81
-88
@@ -2,8 +2,7 @@
|
||||
/*
|
||||
* Mini ln implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* 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
|
||||
@@ -22,111 +21,105 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#define BB_DECLARE_EXTERN
|
||||
#define bb_need_name_too_long
|
||||
#define bb_need_not_a_directory
|
||||
#include "messages.c"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <sys/param.h> /* for PATH_MAX */
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
static const char ln_usage[] =
|
||||
"ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n\n"
|
||||
"Create a link named LINK_NAME or DIRECTORY to the specified TARGET\n\n"
|
||||
"Options:\n"
|
||||
"\t-s\tmake symbolic links instead of hard links\n"
|
||||
|
||||
"\t-f\tremove existing destination files\n"
|
||||
"\t-n\tno dereference symlinks - treat like normal file\n";
|
||||
static const int LN_SYMLINK = 1;
|
||||
static const int LN_FORCE = 2;
|
||||
static const int LN_NODEREFERENCE = 4;
|
||||
|
||||
static int symlinkFlag = FALSE;
|
||||
static int removeoldFlag = FALSE;
|
||||
static int followLinks = TRUE;
|
||||
/*
|
||||
* linkDestName is where the link points to,
|
||||
* linkSrcName is the name of the link to be created.
|
||||
*/
|
||||
static int fs_link(const char *link_destname, const char *link_srcname,
|
||||
const int flag)
|
||||
{
|
||||
int status;
|
||||
int src_is_dir;
|
||||
char *src_name;
|
||||
|
||||
if (link_destname==NULL)
|
||||
return(FALSE);
|
||||
|
||||
src_name = (char *) xmalloc(strlen(link_srcname)+strlen(link_destname)+1);
|
||||
|
||||
if (link_srcname==NULL)
|
||||
strcpy(src_name, link_destname);
|
||||
else
|
||||
strcpy(src_name, link_srcname);
|
||||
|
||||
if (flag&LN_NODEREFERENCE)
|
||||
src_is_dir = is_directory(src_name, TRUE, NULL);
|
||||
else
|
||||
src_is_dir = is_directory(src_name, FALSE, NULL);
|
||||
|
||||
if ((src_is_dir==TRUE)&&((flag&LN_NODEREFERENCE)==0)) {
|
||||
char* srcdir_name;
|
||||
|
||||
srcdir_name = xstrdup(link_destname);
|
||||
strcat(src_name, "/");
|
||||
strcat(src_name, get_last_path_component(srcdir_name));
|
||||
free(srcdir_name);
|
||||
}
|
||||
|
||||
if (flag&LN_FORCE)
|
||||
unlink(src_name);
|
||||
|
||||
if (flag&LN_SYMLINK)
|
||||
status = symlink(link_destname, src_name);
|
||||
else
|
||||
status = link(link_destname, src_name);
|
||||
|
||||
if (status != 0) {
|
||||
perror_msg(src_name);
|
||||
return(FALSE);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
extern int ln_main(int argc, char **argv)
|
||||
{
|
||||
char *linkName;
|
||||
int linkIntoDirFlag;
|
||||
|
||||
if (argc < 3) {
|
||||
usage(ln_usage);
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
int status = EXIT_SUCCESS;
|
||||
int flag = 0;
|
||||
int opt;
|
||||
|
||||
/* Parse any options */
|
||||
while (**argv == '-') {
|
||||
while (*++(*argv))
|
||||
switch (**argv) {
|
||||
while ((opt=getopt(argc, argv, "sfn")) != -1) {
|
||||
switch(opt) {
|
||||
case 's':
|
||||
symlinkFlag = TRUE;
|
||||
flag |= LN_SYMLINK;
|
||||
break;
|
||||
case 'f':
|
||||
removeoldFlag = TRUE;
|
||||
flag |= LN_FORCE;
|
||||
break;
|
||||
case 'n':
|
||||
followLinks = FALSE;
|
||||
flag |= LN_NODEREFERENCE;
|
||||
break;
|
||||
default:
|
||||
usage(ln_usage);
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
linkName = argv[argc - 1];
|
||||
|
||||
if (strlen(linkName) > PATH_MAX) {
|
||||
fprintf(stderr, name_too_long, "ln");
|
||||
exit FALSE;
|
||||
}
|
||||
|
||||
linkIntoDirFlag = isDirectory(linkName, TRUE, NULL);
|
||||
|
||||
if ((argc > 3) && !linkIntoDirFlag) {
|
||||
fprintf(stderr, not_a_directory, "ln", linkName);
|
||||
exit FALSE;
|
||||
}
|
||||
|
||||
while (argc-- >= 2) {
|
||||
char srcName[PATH_MAX + 1];
|
||||
int nChars, status;
|
||||
|
||||
if (strlen(*argv) > PATH_MAX) {
|
||||
fprintf(stderr, name_too_long, "ln");
|
||||
exit FALSE;
|
||||
}
|
||||
|
||||
if (followLinks == FALSE) {
|
||||
strcpy(srcName, *argv);
|
||||
} else {
|
||||
/* Warning! This can silently truncate if > PATH_MAX, but
|
||||
I don't think that there can be one > PATH_MAX anyway. */
|
||||
nChars = readlink(*argv, srcName, PATH_MAX);
|
||||
srcName[nChars] = '\0';
|
||||
}
|
||||
|
||||
if (removeoldFlag == TRUE) {
|
||||
status = (unlink(linkName) && errno != ENOENT);
|
||||
if (status != 0) {
|
||||
perror(linkName);
|
||||
exit FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (symlinkFlag == TRUE)
|
||||
status = symlink(*argv, linkName);
|
||||
else
|
||||
status = link(*argv, linkName);
|
||||
if (status != 0) {
|
||||
perror(linkName);
|
||||
exit FALSE;
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
exit TRUE;
|
||||
if (optind > (argc-1)) {
|
||||
show_usage();
|
||||
}
|
||||
if (optind == (argc-1)) {
|
||||
if (fs_link(argv[optind],
|
||||
get_last_path_component(argv[optind]), flag)==FALSE)
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
while(optind<(argc-1)) {
|
||||
if (fs_link(argv[optind], argv[argc-1], flag)==FALSE)
|
||||
status = EXIT_FAILURE;
|
||||
optind++;
|
||||
}
|
||||
exit(status);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+10
-13
@@ -20,25 +20,22 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static const char logname_usage[] = "logname\n\n"
|
||||
|
||||
"Print the name of the current user.\n";
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int logname_main(int argc, char **argv)
|
||||
{
|
||||
char *cp;
|
||||
char user[9];
|
||||
|
||||
if (argc > 1)
|
||||
usage(logname_usage);
|
||||
show_usage();
|
||||
|
||||
cp = getlogin();
|
||||
if (cp) {
|
||||
puts(cp);
|
||||
exit(TRUE);
|
||||
my_getpwuid(user, geteuid());
|
||||
if (*user) {
|
||||
puts(user);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
fprintf(stderr, "%s: no login name\n", argv[0]);
|
||||
exit(FALSE);
|
||||
error_msg_and_die("no login name");
|
||||
}
|
||||
+799
-429
File diff suppressed because it is too large.
Load diff
+1144
File diff suppressed because it is too large.
Load diff
+32
-83
@@ -2,9 +2,7 @@
|
||||
/*
|
||||
* Mini mkdir implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
* Copyright (C) 2001 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,94 +20,45 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#define bb_need_name_too_long
|
||||
#define BB_DECLARE_EXTERN
|
||||
#include "messages.c"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/param.h> /* for PATH_MAX */
|
||||
#include <getopt.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static const char mkdir_usage[] =
|
||||
"mkdir [OPTION] DIRECTORY...\n\n"
|
||||
"Create the DIRECTORY(ies), if they do not already exist\n\n"
|
||||
"Options:\n"
|
||||
#include "busybox.h"
|
||||
|
||||
"\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n"
|
||||
"\t-p\tno error if existing, make parent directories as needed\n";
|
||||
|
||||
|
||||
static int parentFlag = FALSE;
|
||||
static mode_t mode = 0777;
|
||||
|
||||
|
||||
extern int mkdir_main(int argc, char **argv)
|
||||
extern int mkdir_main (int argc, char **argv)
|
||||
{
|
||||
int i = FALSE;
|
||||
mode_t mode = -1;
|
||||
int flags = 0;
|
||||
int status = 0;
|
||||
int i, opt;
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
/* Parse any options */
|
||||
while (argc > 0 && **argv == '-') {
|
||||
while (i == FALSE && *++(*argv)) {
|
||||
switch (**argv) {
|
||||
case 'm':
|
||||
if (--argc == 0)
|
||||
usage(mkdir_usage);
|
||||
/* Find the specified modes */
|
||||
mode = 0;
|
||||
if (parse_mode(*(++argv), &mode) == FALSE) {
|
||||
fprintf(stderr, "Unknown mode: %s\n", *argv);
|
||||
exit FALSE;
|
||||
}
|
||||
/* Set the umask for this process so it doesn't
|
||||
* screw up whatever the user just entered. */
|
||||
umask(0);
|
||||
i = TRUE;
|
||||
break;
|
||||
case 'p':
|
||||
parentFlag = TRUE;
|
||||
break;
|
||||
default:
|
||||
usage(mkdir_usage);
|
||||
}
|
||||
while ((opt = getopt (argc, argv, "m:p")) != -1) {
|
||||
switch (opt) {
|
||||
case 'm':
|
||||
mode = 0777;
|
||||
if (!parse_mode (optarg, &mode))
|
||||
error_msg_and_die ("invalid mode `%s'", optarg);
|
||||
break;
|
||||
case 'p':
|
||||
flags |= FILEUTILS_RECUR;
|
||||
break;
|
||||
default:
|
||||
show_usage ();
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
usage(mkdir_usage);
|
||||
}
|
||||
if (optind == argc)
|
||||
show_usage ();
|
||||
|
||||
while (argc > 0) {
|
||||
int status;
|
||||
struct stat statBuf;
|
||||
char buf[PATH_MAX + 1];
|
||||
for (i = optind; i < argc; i++)
|
||||
if (make_directory (argv[i], mode, flags) < 0)
|
||||
status = 1;
|
||||
|
||||
if (strlen(*argv) > PATH_MAX - 1) {
|
||||
fprintf(stderr, name_too_long, "mkdir");
|
||||
exit FALSE;
|
||||
}
|
||||
strcpy(buf, *argv);
|
||||
status = stat(buf, &statBuf);
|
||||
if (parentFlag == FALSE && status != -1 && errno != ENOENT) {
|
||||
fprintf(stderr, "%s: File exists\n", buf);
|
||||
exit FALSE;
|
||||
}
|
||||
if (parentFlag == TRUE) {
|
||||
strcat(buf, "/");
|
||||
createPath(buf, mode);
|
||||
} else {
|
||||
if (mkdir(buf, mode) != 0 && parentFlag == FALSE) {
|
||||
perror(buf);
|
||||
exit FALSE;
|
||||
}
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
exit TRUE;
|
||||
return status;
|
||||
}
|
||||
+9
-18
@@ -20,17 +20,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n"
|
||||
"Create the named fifo\n\n"
|
||||
|
||||
"Options:\n"
|
||||
"\t-m\tcreate the fifo with the specified mode; default = a=rw-umask\n";
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int mkfifo_main(int argc, char **argv)
|
||||
{
|
||||
@@ -43,7 +37,7 @@ extern int mkfifo_main(int argc, char **argv)
|
||||
/* Parse any options */
|
||||
while (argc > 1) {
|
||||
if (**argv != '-')
|
||||
usage(mkfifo_usage);
|
||||
show_usage();
|
||||
thisarg = *argv;
|
||||
thisarg++;
|
||||
switch (*thisarg) {
|
||||
@@ -53,17 +47,14 @@ extern int mkfifo_main(int argc, char **argv)
|
||||
parse_mode(*argv, &mode);
|
||||
break;
|
||||
default:
|
||||
usage(mkfifo_usage);
|
||||
show_usage();
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
if (argc < 1)
|
||||
usage(mkfifo_usage);
|
||||
if (mkfifo(*argv, mode) < 0) {
|
||||
perror("mkfifo");
|
||||
exit(255);
|
||||
} else {
|
||||
exit(TRUE);
|
||||
}
|
||||
if (argc < 1 || *argv[0] == '-')
|
||||
show_usage();
|
||||
if (mkfifo(*argv, mode) < 0)
|
||||
perror_msg_and_die("mkfifo");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+41
-25
@@ -20,31 +20,48 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static const char mknod_usage[] = "mknod NAME TYPE MAJOR MINOR\n\n"
|
||||
"Make block or character special files.\n\n"
|
||||
"TYPEs include:\n"
|
||||
"\tb:\tMake a block (buffered) device.\n"
|
||||
|
||||
"\tc or u:\tMake a character (un-buffered) device.\n"
|
||||
"\tp:\tMake a named pipe. Major and minor are ignored for named pipes.\n";
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include "busybox.h"
|
||||
|
||||
int mknod_main(int argc, char **argv)
|
||||
{
|
||||
char *thisarg;
|
||||
mode_t mode = 0;
|
||||
mode_t perm = 0666;
|
||||
dev_t dev = 0;
|
||||
|
||||
if (argc != 5 || **(argv + 1) == '-') {
|
||||
usage(mknod_usage);
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
/* Parse any options */
|
||||
while (argc > 1) {
|
||||
if (**argv != '-')
|
||||
break;
|
||||
thisarg = *argv;
|
||||
thisarg++;
|
||||
switch (*thisarg) {
|
||||
case 'm':
|
||||
argc--;
|
||||
argv++;
|
||||
parse_mode(*argv, &perm);
|
||||
umask(0);
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
switch (argv[2][0]) {
|
||||
if (argc != 4 && argc != 2) {
|
||||
show_usage();
|
||||
}
|
||||
switch (argv[1][0]) {
|
||||
case 'c':
|
||||
case 'u':
|
||||
mode = S_IFCHR;
|
||||
@@ -54,23 +71,22 @@ int mknod_main(int argc, char **argv)
|
||||
break;
|
||||
case 'p':
|
||||
mode = S_IFIFO;
|
||||
if (argc!=2) {
|
||||
show_usage();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usage(mknod_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if (mode == S_IFCHR || mode == S_IFBLK) {
|
||||
dev = (atoi(argv[3]) << 8) | atoi(argv[4]);
|
||||
if (argc != 5) {
|
||||
usage(mknod_usage);
|
||||
}
|
||||
dev = (atoi(argv[2]) << 8) | atoi(argv[3]);
|
||||
}
|
||||
|
||||
mode |= 0666;
|
||||
mode |= perm;
|
||||
|
||||
if (mknod(argv[1], mode, dev) != 0) {
|
||||
perror(argv[1]);
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
if (mknod(argv[0], mode, dev) != 0)
|
||||
perror_msg_and_die("%s", argv[0]);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini mv 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 <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "busybox.h"
|
||||
|
||||
static int flags;
|
||||
|
||||
static int manual_rename(const char *source, const char *dest)
|
||||
{
|
||||
struct stat source_stat;
|
||||
struct stat dest_stat;
|
||||
int source_exists = 1;
|
||||
int dest_exists = 1;
|
||||
|
||||
if (stat(source, &source_stat) < 0) {
|
||||
if (errno != ENOENT) {
|
||||
perror_msg("unable to stat `%s'", source);
|
||||
return -1;
|
||||
}
|
||||
source_exists = 0;
|
||||
}
|
||||
|
||||
if (stat(dest, &dest_stat) < 0) {
|
||||
if (errno != ENOENT) {
|
||||
perror_msg("unable to stat `%s'", dest);
|
||||
return -1;
|
||||
}
|
||||
dest_exists = 0;
|
||||
}
|
||||
|
||||
if (dest_exists) {
|
||||
if (S_ISDIR(dest_stat.st_mode) &&
|
||||
(!source_exists || !S_ISDIR(source_stat.st_mode))) {
|
||||
error_msg("cannot overwrite directory with non-directory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!S_ISDIR(dest_stat.st_mode) && source_exists &&
|
||||
S_ISDIR(source_stat.st_mode)) {
|
||||
error_msg("cannot overwrite non-directory with directory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (unlink(dest) < 0) {
|
||||
perror_msg("cannot remove `%s'", dest);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (copy_file(source, dest, FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS |
|
||||
FILEUTILS_PRESERVE_SYMLINKS) < 0)
|
||||
return -1;
|
||||
|
||||
if (remove_file(source, FILEUTILS_RECUR | FILEUTILS_FORCE) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int move_file(const char *source, const char *dest)
|
||||
{
|
||||
struct stat dest_stat;
|
||||
int dest_exists = 1;
|
||||
|
||||
if (stat(dest, &dest_stat) < 0) {
|
||||
if (errno != ENOENT) {
|
||||
perror_msg("unable to stat `%s'", dest);
|
||||
return -1;
|
||||
}
|
||||
dest_exists = 0;
|
||||
}
|
||||
|
||||
if (dest_exists && !(flags & FILEUTILS_FORCE) &&
|
||||
((access(dest, W_OK) < 0 && isatty(0)) ||
|
||||
(flags & FILEUTILS_INTERACTIVE))) {
|
||||
fprintf(stderr, "mv: overwrite `%s'? ", dest);
|
||||
if (!ask_confirmation())
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rename(source, dest) < 0) {
|
||||
if (errno == EXDEV)
|
||||
return manual_rename(source, dest);
|
||||
|
||||
perror_msg("unable to rename `%s'", source);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int mv_main(int argc, char **argv)
|
||||
{
|
||||
int status = 0;
|
||||
int opt;
|
||||
int i;
|
||||
|
||||
while ((opt = getopt(argc, argv, "fi")) != -1)
|
||||
switch (opt) {
|
||||
case 'f':
|
||||
flags &= ~FILEUTILS_INTERACTIVE;
|
||||
flags |= FILEUTILS_FORCE;
|
||||
break;
|
||||
case 'i':
|
||||
flags &= ~FILEUTILS_FORCE;
|
||||
flags |= FILEUTILS_INTERACTIVE;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if (optind + 2 > argc)
|
||||
show_usage();
|
||||
|
||||
if (optind + 2 == argc) {
|
||||
struct stat dest_stat;
|
||||
int dest_exists = 1;
|
||||
|
||||
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 (!dest_exists || !S_ISDIR(dest_stat.st_mode)) {
|
||||
if (move_file(argv[optind], argv[optind + 1]) < 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 (move_file(argv[i], dest) < 0)
|
||||
status = 1;
|
||||
free(dest);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
+5
-29
@@ -47,22 +47,19 @@
|
||||
|
||||
// 19990508 Busy Boxed! Dave Cinege
|
||||
|
||||
#include "internal.h"
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <libintl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
#ifndef S_IFMT
|
||||
# define S_IFMT 0170000
|
||||
static const int S_IFMT = 0170000;
|
||||
#endif
|
||||
#if !defined(S_ISBLK) && defined(S_IFBLK)
|
||||
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
@@ -95,28 +92,9 @@
|
||||
|
||||
#define IN_CTYPE_DOMAIN(c) 1
|
||||
|
||||
#ifdef isblank
|
||||
# define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (c))
|
||||
#else
|
||||
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
|
||||
#endif
|
||||
#ifdef isgraph
|
||||
# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (c))
|
||||
#else
|
||||
# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (c) && !isspace (c))
|
||||
#endif
|
||||
|
||||
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
|
||||
#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
|
||||
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
|
||||
#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
|
||||
#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
|
||||
#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c))
|
||||
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
|
||||
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
|
||||
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
|
||||
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
||||
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
|
||||
#define ISDIGIT(c) (((unsigned char) (c)) - '0' <= 9)
|
||||
|
||||
#define isodigit(c) ((c) >= '0' && (c) <= '7')
|
||||
#define hextobin(c) ((c)>='a'&&(c)<='f' ? (c)-'a'+10 : (c)>='A'&&(c)<='F' ? (c)-'A'+10 : (c)-'0')
|
||||
@@ -139,8 +117,6 @@ static void verify __P((char *s, char *end));
|
||||
/* The value to return to the calling program. */
|
||||
static int exit_status;
|
||||
|
||||
static const char printf_usage[] = "printf format [argument...]\n";
|
||||
|
||||
int printf_main(int argc, char **argv)
|
||||
{
|
||||
char *format;
|
||||
@@ -148,7 +124,7 @@ int printf_main(int argc, char **argv)
|
||||
|
||||
exit_status = 0;
|
||||
if (argc <= 1 || **(argv + 1) == '-') {
|
||||
usage(printf_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
format = argv[1];
|
||||
@@ -167,7 +143,7 @@ int printf_main(int argc, char **argv)
|
||||
fprintf(stderr, "excess args ignored");
|
||||
*/
|
||||
|
||||
exit(exit_status);
|
||||
return(exit_status);
|
||||
}
|
||||
|
||||
/* Print the text in FORMAT, using ARGV (with ARGC elements) for
|
||||
|
||||
+14
-10
@@ -21,20 +21,24 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
/* getopt not needed */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/param.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int pwd_main(int argc, char **argv)
|
||||
{
|
||||
char buf[PATH_MAX + 1];
|
||||
|
||||
if (getcwd(buf, sizeof(buf)) == NULL) {
|
||||
perror("get working directory");
|
||||
exit(FALSE);
|
||||
static char *buf;
|
||||
|
||||
buf = xgetcwd(buf);
|
||||
|
||||
if (buf != NULL) {
|
||||
puts(buf);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
printf("%s\n", buf);
|
||||
exit(TRUE);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
+43
-70
@@ -3,8 +3,8 @@
|
||||
* Mini rm implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
* Copyright (C) 2001 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,83 +22,56 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <utime.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
static const char *rm_usage = "rm [OPTION]... FILE...\n\n"
|
||||
"Remove (unlink) the FILE(s).\n\n"
|
||||
"Options:\n"
|
||||
|
||||
"\t-f\t\tremove existing destinations, never prompt\n"
|
||||
"\t-r or -R\tremove the contents of directories recursively\n";
|
||||
|
||||
|
||||
static int recursiveFlag = FALSE;
|
||||
static int forceFlag = FALSE;
|
||||
static const char *srcName;
|
||||
|
||||
|
||||
static int fileAction(const char *fileName, struct stat *statbuf)
|
||||
{
|
||||
if (unlink(fileName) < 0) {
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static int dirAction(const char *fileName, struct stat *statbuf)
|
||||
{
|
||||
if (rmdir(fileName) < 0) {
|
||||
perror(fileName);
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int rm_main(int argc, char **argv)
|
||||
{
|
||||
struct stat statbuf;
|
||||
int status = 0;
|
||||
int opt;
|
||||
int flags = 0;
|
||||
int i;
|
||||
|
||||
if (argc < 2) {
|
||||
usage(rm_usage);
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
/* Parse any options */
|
||||
while (**argv == '-') {
|
||||
while (*++(*argv))
|
||||
switch (**argv) {
|
||||
case 'R':
|
||||
case 'r':
|
||||
recursiveFlag = TRUE;
|
||||
break;
|
||||
case 'f':
|
||||
forceFlag = TRUE;
|
||||
break;
|
||||
default:
|
||||
usage(rm_usage);
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
while (argc-- > 0) {
|
||||
srcName = *(argv++);
|
||||
if (forceFlag == TRUE && lstat(srcName, &statbuf) != 0
|
||||
&& errno == ENOENT) {
|
||||
/* do not reports errors for non-existent files if -f, just skip them */
|
||||
} else {
|
||||
if (recursiveAction(srcName, recursiveFlag, FALSE,
|
||||
TRUE, fileAction, dirAction) == FALSE) {
|
||||
exit(FALSE);
|
||||
}
|
||||
while ((opt = getopt(argc, argv, "fiRr")) != -1) {
|
||||
switch (opt) {
|
||||
case 'f':
|
||||
flags &= ~FILEUTILS_INTERACTIVE;
|
||||
flags |= FILEUTILS_FORCE;
|
||||
break;
|
||||
case 'i':
|
||||
flags &= ~FILEUTILS_FORCE;
|
||||
flags |= FILEUTILS_INTERACTIVE;
|
||||
break;
|
||||
case 'R':
|
||||
case 'r':
|
||||
flags |= FILEUTILS_RECUR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
exit(TRUE);
|
||||
|
||||
if (!(flags & FILEUTILS_FORCE) && optind == argc)
|
||||
show_usage();
|
||||
|
||||
for (i = optind; i < argc; i++) {
|
||||
char *base = get_last_path_component(argv[i]);
|
||||
|
||||
if (strcmp(base, ".") == 0 || strcmp(base, "..") == 0) {
|
||||
error_msg("cannot remove `.' or `..'");
|
||||
status = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (remove_file(argv[i], flags) < 0)
|
||||
status = 1;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
+11
-10
@@ -3,7 +3,7 @@
|
||||
* Mini rmdir implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* 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
|
||||
@@ -22,23 +22,24 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int rmdir_main(int argc, char **argv)
|
||||
{
|
||||
if (argc == 1 || **(argv + 1) == '-') {
|
||||
usage
|
||||
("rmdir [OPTION]... DIRECTORY...\n\nRemove the DIRECTORY(ies), if they are empty.\n");
|
||||
}
|
||||
int status = EXIT_SUCCESS;
|
||||
|
||||
if (argc == 1 || **(argv + 1) == '-')
|
||||
show_usage();
|
||||
|
||||
while (--argc > 0) {
|
||||
if (rmdir(*(++argv)) == -1) {
|
||||
fprintf(stderr, "%s: %s\n", *argv, strerror(errno));
|
||||
exit(FALSE);
|
||||
perror_msg("%s", *argv);
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
exit(TRUE);
|
||||
return status;
|
||||
}
|
||||
+7
-9
@@ -21,20 +21,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
|
||||
const char sleep_usage[] = "sleep N\n\n" "Pause for N seconds.\n";
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int sleep_main(int argc, char **argv)
|
||||
{
|
||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||
usage(sleep_usage);
|
||||
show_usage();
|
||||
}
|
||||
|
||||
if (sleep(atoi(*(++argv))) != 0) {
|
||||
perror("sleep");
|
||||
exit(FALSE);
|
||||
} else
|
||||
exit(TRUE);
|
||||
if (sleep(atoi(*(++argv))) != 0)
|
||||
perror_msg_and_die("sleep");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+58
-275
@@ -3,8 +3,7 @@
|
||||
* Mini sort implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* Written by John Beppu <beppu@lineo.com>
|
||||
* 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
|
||||
@@ -22,302 +21,86 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "busybox.h"
|
||||
|
||||
static const char sort_usage[] = "sort [-n]"
|
||||
#ifdef BB_FEATURE_SORT_REVERSE
|
||||
" [-r]"
|
||||
#endif
|
||||
" [FILE]...\n\n";
|
||||
|
||||
#ifdef BB_FEATURE_SORT_REVERSE
|
||||
#define APPLY_REVERSE(x) (reverse ? -(x) : (x))
|
||||
static int reverse = 0;
|
||||
#else
|
||||
#define APPLY_REVERSE(x) (x)
|
||||
#endif
|
||||
|
||||
/* typedefs _______________________________________________________________ */
|
||||
|
||||
/* line node */
|
||||
typedef struct Line {
|
||||
char *data; /* line data */
|
||||
struct Line *next; /* pointer to next line node */
|
||||
} Line;
|
||||
|
||||
/* singly-linked list of lines */
|
||||
typedef struct {
|
||||
int len; /* number of Lines */
|
||||
Line **sorted; /* array fed to qsort */
|
||||
|
||||
Line *head; /* head of List */
|
||||
Line *current; /* current Line */
|
||||
} List;
|
||||
|
||||
/* comparison function */
|
||||
typedef int (Compare) (const void *, const void *);
|
||||
|
||||
|
||||
/* methods ________________________________________________________________ */
|
||||
|
||||
static const int max = 1024;
|
||||
|
||||
/* mallocate Line */
|
||||
static Line *line_alloc()
|
||||
static int compare_ascii(const void *x, const void *y)
|
||||
{
|
||||
Line *self;
|
||||
|
||||
self = malloc(1 * sizeof(Line));
|
||||
return self;
|
||||
return strcmp(*(char **)x, *(char **)y);
|
||||
}
|
||||
|
||||
/* Initialize Line with string */
|
||||
static Line *line_init(Line * self, const char *string)
|
||||
static int compare_numeric(const void *x, const void *y)
|
||||
{
|
||||
self->data = malloc((strlen(string) + 1) * sizeof(char));
|
||||
|
||||
if (self->data == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
strcpy(self->data, string);
|
||||
self->next = NULL;
|
||||
return self;
|
||||
int z = atoi(*(char **)x) - atoi(*(char **)y);
|
||||
return z ? z : strcmp(*(char **)x, *(char **)y);
|
||||
}
|
||||
|
||||
/* Construct Line from FILE* */
|
||||
static Line *line_newFromFile(FILE * src)
|
||||
{
|
||||
char buffer[max];
|
||||
Line *self;
|
||||
|
||||
if (fgets(buffer, max, src)) {
|
||||
self = line_alloc();
|
||||
if (self == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
line_init(self, buffer);
|
||||
return self;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Line destructor */
|
||||
static Line *line_release(Line * self)
|
||||
{
|
||||
if (self->data) {
|
||||
free(self->data);
|
||||
free(self);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
/* Comparison */
|
||||
|
||||
/* ascii order */
|
||||
static int compare_ascii(const void *a, const void *b)
|
||||
{
|
||||
Line **doh;
|
||||
Line *x, *y;
|
||||
|
||||
doh = (Line **) a;
|
||||
x = *doh;
|
||||
doh = (Line **) b;
|
||||
y = *doh;
|
||||
|
||||
// fprintf(stdout, "> %p: %s< %p: %s", x, x->data, y, y->data);
|
||||
return APPLY_REVERSE(strcmp(x->data, y->data));
|
||||
}
|
||||
|
||||
/* numeric order */
|
||||
static int compare_numeric(const void *a, const void *b)
|
||||
{
|
||||
Line **doh;
|
||||
Line *x, *y;
|
||||
int xint, yint;
|
||||
|
||||
doh = (Line **) a;
|
||||
x = *doh;
|
||||
doh = (Line **) b;
|
||||
y = *doh;
|
||||
|
||||
xint = strtoul(x->data, NULL, 10);
|
||||
yint = strtoul(y->data, NULL, 10);
|
||||
|
||||
return APPLY_REVERSE(xint - yint);
|
||||
}
|
||||
|
||||
|
||||
/* List */
|
||||
|
||||
/* */
|
||||
static List *list_init(List * self)
|
||||
{
|
||||
self->len = 0;
|
||||
self->sorted = NULL;
|
||||
self->head = NULL;
|
||||
self->current = NULL;
|
||||
return self;
|
||||
}
|
||||
|
||||
/* for simplicity, the List gains ownership of the line */
|
||||
static List *list_insert(List * self, Line * line)
|
||||
{
|
||||
if (line == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* first insertion */
|
||||
if (self->head == NULL) {
|
||||
self->head = line;
|
||||
self->current = line;
|
||||
|
||||
/* all subsequent insertions */
|
||||
} else {
|
||||
self->current->next = line;
|
||||
self->current = line;
|
||||
}
|
||||
self->len++;
|
||||
return self;
|
||||
}
|
||||
|
||||
/* order the list according to compare() */
|
||||
static List *list_sort(List * self, Compare * compare)
|
||||
{
|
||||
int i;
|
||||
Line *line;
|
||||
|
||||
/* mallocate array of Line*s */
|
||||
self->sorted = (Line **) malloc(self->len * sizeof(Line *));
|
||||
if (self->sorted == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* fill array w/ List's contents */
|
||||
i = 0;
|
||||
line = self->head;
|
||||
while (line) {
|
||||
self->sorted[i++] = line;
|
||||
line = line->next;
|
||||
}
|
||||
|
||||
/* apply qsort */
|
||||
qsort(self->sorted, self->len, sizeof(Line *), compare);
|
||||
return self;
|
||||
}
|
||||
|
||||
/* precondition: list must be sorted */
|
||||
static List *list_writeToFile(List * self, FILE * dst)
|
||||
{
|
||||
int i;
|
||||
Line **line = self->sorted;
|
||||
|
||||
if (self->sorted == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < self->len; i++) {
|
||||
fprintf(dst, "%s", line[i]->data);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/* deallocate */
|
||||
static void list_release(List * self)
|
||||
{
|
||||
Line *i;
|
||||
Line *die;
|
||||
|
||||
i = self->head;
|
||||
while (i) {
|
||||
die = i;
|
||||
i = die->next;
|
||||
line_release(die);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* I need a list
|
||||
* to insert lines into
|
||||
* then I need to sort this list
|
||||
* and finally print it
|
||||
*/
|
||||
|
||||
int sort_main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
char opt;
|
||||
List list;
|
||||
Line *l;
|
||||
Compare *compare;
|
||||
FILE *fp;
|
||||
char *line, **lines = NULL;
|
||||
int i, opt, nlines = 0;
|
||||
int (*compare)(const void *, const void *) = compare_ascii;
|
||||
#ifdef BB_FEATURE_SORT_REVERSE
|
||||
int reverse = FALSE;
|
||||
#endif
|
||||
#ifdef BB_FEATURE_SORT_UNIQUE
|
||||
int unique = FALSE;
|
||||
#endif
|
||||
|
||||
/* init */
|
||||
compare = compare_ascii;
|
||||
list_init(&list);
|
||||
|
||||
/* parse argv[] */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
opt = argv[i][1];
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
usage(sort_usage);
|
||||
break;
|
||||
while ((opt = getopt(argc, argv, "nru")) != -1) {
|
||||
switch (opt) {
|
||||
case 'n':
|
||||
/* numeric comparison */
|
||||
compare = compare_numeric;
|
||||
break;
|
||||
#ifdef BB_FEATURE_SORT_REVERSE
|
||||
case 'r':
|
||||
/* reverse */
|
||||
reverse = 1;
|
||||
reverse = TRUE;
|
||||
break;
|
||||
#endif
|
||||
#ifdef BB_FEATURE_SORT_UNIQUE
|
||||
case 'u':
|
||||
unique = TRUE;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
fprintf(stderr, "sort: invalid option -- %c\n", opt);
|
||||
usage(sort_usage);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
/* this could be factored better */
|
||||
/* read the input */
|
||||
for (i = optind; i == optind || i < argc; i++) {
|
||||
if (argv[i] == NULL)
|
||||
fp = stdin;
|
||||
else
|
||||
fp = xfopen(argv[i], "r");
|
||||
|
||||
/* work w/ stdin */
|
||||
if (i >= argc) {
|
||||
while ((l = line_newFromFile(stdin))) {
|
||||
list_insert(&list, l);
|
||||
while ((line = get_line_from_file(fp)) != NULL) {
|
||||
lines = xrealloc(lines, sizeof(char *) * (nlines + 1));
|
||||
chomp(line);
|
||||
lines[nlines++] = line;
|
||||
}
|
||||
list_sort(&list, compare);
|
||||
list_writeToFile(&list, stdout);
|
||||
list_release(&list);
|
||||
|
||||
/* work w/ what's left in argv[] */
|
||||
} else {
|
||||
FILE *src;
|
||||
|
||||
for (; i < argc; i++) {
|
||||
src = fopen(argv[i], "r");
|
||||
if (src == NULL) {
|
||||
break;
|
||||
}
|
||||
while ((l = line_newFromFile(src))) {
|
||||
list_insert(&list, l);
|
||||
}
|
||||
fclose(src);
|
||||
}
|
||||
list_sort(&list, compare);
|
||||
list_writeToFile(&list, stdout);
|
||||
list_release(&list);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
/* sort it */
|
||||
qsort(lines, nlines, sizeof(char *), compare);
|
||||
|
||||
/* print it */
|
||||
#ifdef BB_FEATURE_SORT_REVERSE
|
||||
if (reverse) {
|
||||
for (i = --nlines; 0 <= i; i--)
|
||||
#ifdef BB_FEATURE_SORT_UNIQUE
|
||||
if((!unique) || (i == nlines) || (strcmp(lines[i + 1], lines[i])))
|
||||
#endif
|
||||
puts(lines[i]);
|
||||
} else
|
||||
#endif
|
||||
for (i = 0; i < nlines; i++)
|
||||
#ifdef BB_FEATURE_SORT_UNIQUE
|
||||
if((!unique) || (!i) || (strcmp(lines[i - 1], lines[i])))
|
||||
#endif
|
||||
puts(lines[i]);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* $Id: sort.c,v 1.12 2000/03/04 21:19:32 erik Exp $ */
|
||||
+1376
File diff suppressed because it is too large.
Load diff
+7
-5
@@ -21,13 +21,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
extern int sync_main(int argc, char **argv)
|
||||
{
|
||||
if (argc > 1 && **(argv + 1) == '-') {
|
||||
usage("sync\n\nWrite all buffered filesystem blocks to disk.\n");
|
||||
}
|
||||
exit(sync());
|
||||
if (argc > 1 && **(argv + 1) == '-')
|
||||
show_usage();
|
||||
sync();
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
+219
-1186
File diff suppressed because it is too large.
Load diff
+33
-97
@@ -2,9 +2,8 @@
|
||||
/*
|
||||
* Mini tee implementation for busybox
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999 by Lineo, inc.
|
||||
* Written by John Beppu <beppu@lineo.com>
|
||||
* 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
|
||||
@@ -22,111 +21,48 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <errno.h>
|
||||
#include "busybox.h"
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static const char tee_usage[] =
|
||||
"tee [OPTION]... [FILE]...\n\n"
|
||||
"Copy standard input to each FILE, and also to standard output.\n\n"
|
||||
"Options:\n" "\t-a\tappend to the given FILEs, do not overwrite\n"
|
||||
#if 0
|
||||
"\t-i\tignore interrupt signals\n"
|
||||
#endif
|
||||
;
|
||||
|
||||
|
||||
/* FileList _______________________________________________________________ */
|
||||
|
||||
#define FL_MAX 1024
|
||||
static FILE **FileList;
|
||||
static int FL_end;
|
||||
|
||||
typedef void (FL_Function) (FILE * file, char c);
|
||||
|
||||
|
||||
/* apply a function to everything in FileList */
|
||||
static void FL_apply(FL_Function * f, char c)
|
||||
int
|
||||
tee_main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
char *mode = "w";
|
||||
int c, i, status = 0, nfiles = 0;
|
||||
FILE **files;
|
||||
|
||||
for (i = 0; i <= FL_end; i++) {
|
||||
f(FileList[i], c);
|
||||
}
|
||||
}
|
||||
|
||||
/* FL_Function for writing to files*/
|
||||
static void tee_fwrite(FILE * file, char c)
|
||||
{
|
||||
fputc(c, file);
|
||||
}
|
||||
|
||||
/* FL_Function for closing files */
|
||||
static void tee_fclose(FILE * file, char c)
|
||||
{
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
/* ________________________________________________________________________ */
|
||||
|
||||
/* BusyBoxed tee(1) */
|
||||
int tee_main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
char c;
|
||||
char opt;
|
||||
char opt_fopen[2] = "w";
|
||||
FILE *file;
|
||||
|
||||
/* parse argv[] */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
opt = argv[i][1];
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
opt_fopen[0] = 'a';
|
||||
break;
|
||||
#if 0
|
||||
case 'i':
|
||||
fprintf(stderr, "ignore interrupt not implemented\n");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
usage(tee_usage);
|
||||
}
|
||||
} else {
|
||||
while ((c = getopt(argc, argv, "a")) != EOF) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
mode = "a";
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
/* init FILE pointers */
|
||||
FileList = calloc(FL_MAX, sizeof(FILE*));
|
||||
if (!FileList) {
|
||||
fprintf(stderr, "tee: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
FL_end = 0;
|
||||
FileList[0] = stdout;
|
||||
for (; i < argc; i++) {
|
||||
/* add a file to FileList */
|
||||
file = fopen(argv[i], opt_fopen);
|
||||
if (!file) {
|
||||
continue;
|
||||
}
|
||||
if (FL_end < FL_MAX) {
|
||||
FileList[++FL_end] = file;
|
||||
files = (FILE **)xmalloc(sizeof(FILE *) * (argc - optind + 1));
|
||||
files[nfiles++] = stdout;
|
||||
while (optind < argc) {
|
||||
if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) {
|
||||
nfiles--;
|
||||
perror_msg("%s", argv[optind-1]);
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* read and redirect */
|
||||
while ((c = (char) getchar()) && (!feof(stdin))) {
|
||||
FL_apply(tee_fwrite, c);
|
||||
}
|
||||
while ((c = getchar()) != EOF)
|
||||
for (i = 0; i < nfiles; i++)
|
||||
putc(c, files[i]);
|
||||
|
||||
/* clean up */
|
||||
FL_apply(tee_fclose, 0);
|
||||
free(FileList);
|
||||
exit(0);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* $Id: tee.c,v 1.7 2000/03/08 00:14:35 beppu Exp $ */
|
||||
/*
|
||||
Local Variables:
|
||||
c-file-style: "linux"
|
||||
c-basic-offset: 4
|
||||
tab-width: 4
|
||||
End:
|
||||
*/
|
||||
@@ -0,0 +1,579 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* test implementation for busybox
|
||||
*
|
||||
* Copyright (c) by a whole pile of folks:
|
||||
*
|
||||
* test(1); version 7-like -- author Erik Baalbergen
|
||||
* modified by Eric Gisin to be used as built-in.
|
||||
* modified by Arnold Robbins to add SVR3 compatibility
|
||||
* (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket).
|
||||
* modified by J.T. Conklin for NetBSD.
|
||||
* modified by Herbert Xu to be used as built-in in ash.
|
||||
* modified by Erik Andersen <andersee@debian.org> to be used
|
||||
* in busybox.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Original copyright notice states:
|
||||
* "This program is in the Public Domain."
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* test(1) accepts the following grammar:
|
||||
oexpr ::= aexpr | aexpr "-o" oexpr ;
|
||||
aexpr ::= nexpr | nexpr "-a" aexpr ;
|
||||
nexpr ::= primary | "!" primary
|
||||
primary ::= unary-operator operand
|
||||
| operand binary-operator operand
|
||||
| operand
|
||||
| "(" oexpr ")"
|
||||
;
|
||||
unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-c"|"-b"|"-p"|
|
||||
"-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S";
|
||||
|
||||
binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"|
|
||||
"-nt"|"-ot"|"-ef";
|
||||
operand ::= <any legal UNIX file name>
|
||||
*/
|
||||
|
||||
enum token {
|
||||
EOI,
|
||||
FILRD,
|
||||
FILWR,
|
||||
FILEX,
|
||||
FILEXIST,
|
||||
FILREG,
|
||||
FILDIR,
|
||||
FILCDEV,
|
||||
FILBDEV,
|
||||
FILFIFO,
|
||||
FILSOCK,
|
||||
FILSYM,
|
||||
FILGZ,
|
||||
FILTT,
|
||||
FILSUID,
|
||||
FILSGID,
|
||||
FILSTCK,
|
||||
FILNT,
|
||||
FILOT,
|
||||
FILEQ,
|
||||
FILUID,
|
||||
FILGID,
|
||||
STREZ,
|
||||
STRNZ,
|
||||
STREQ,
|
||||
STRNE,
|
||||
STRLT,
|
||||
STRGT,
|
||||
INTEQ,
|
||||
INTNE,
|
||||
INTGE,
|
||||
INTGT,
|
||||
INTLE,
|
||||
INTLT,
|
||||
UNOT,
|
||||
BAND,
|
||||
BOR,
|
||||
LPAREN,
|
||||
RPAREN,
|
||||
OPERAND
|
||||
};
|
||||
|
||||
enum token_types {
|
||||
UNOP,
|
||||
BINOP,
|
||||
BUNOP,
|
||||
BBINOP,
|
||||
PAREN
|
||||
};
|
||||
|
||||
static const struct t_op {
|
||||
const char *op_text;
|
||||
short op_num, op_type;
|
||||
} ops [] = {
|
||||
{"-r", FILRD, UNOP},
|
||||
{"-w", FILWR, UNOP},
|
||||
{"-x", FILEX, UNOP},
|
||||
{"-e", FILEXIST,UNOP},
|
||||
{"-f", FILREG, UNOP},
|
||||
{"-d", FILDIR, UNOP},
|
||||
{"-c", FILCDEV,UNOP},
|
||||
{"-b", FILBDEV,UNOP},
|
||||
{"-p", FILFIFO,UNOP},
|
||||
{"-u", FILSUID,UNOP},
|
||||
{"-g", FILSGID,UNOP},
|
||||
{"-k", FILSTCK,UNOP},
|
||||
{"-s", FILGZ, UNOP},
|
||||
{"-t", FILTT, UNOP},
|
||||
{"-z", STREZ, UNOP},
|
||||
{"-n", STRNZ, UNOP},
|
||||
{"-h", FILSYM, UNOP}, /* for backwards compat */
|
||||
{"-O", FILUID, UNOP},
|
||||
{"-G", FILGID, UNOP},
|
||||
{"-L", FILSYM, UNOP},
|
||||
{"-S", FILSOCK,UNOP},
|
||||
{"=", STREQ, BINOP},
|
||||
{"!=", STRNE, BINOP},
|
||||
{"<", STRLT, BINOP},
|
||||
{">", STRGT, BINOP},
|
||||
{"-eq", INTEQ, BINOP},
|
||||
{"-ne", INTNE, BINOP},
|
||||
{"-ge", INTGE, BINOP},
|
||||
{"-gt", INTGT, BINOP},
|
||||
{"-le", INTLE, BINOP},
|
||||
{"-lt", INTLT, BINOP},
|
||||
{"-nt", FILNT, BINOP},
|
||||
{"-ot", FILOT, BINOP},
|
||||
{"-ef", FILEQ, BINOP},
|
||||
{"!", UNOT, BUNOP},
|
||||
{"-a", BAND, BBINOP},
|
||||
{"-o", BOR, BBINOP},
|
||||
{"(", LPAREN, PAREN},
|
||||
{")", RPAREN, PAREN},
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
static char **t_wp;
|
||||
static struct t_op const *t_wp_op;
|
||||
static gid_t *group_array = NULL;
|
||||
static int ngroups;
|
||||
|
||||
static enum token t_lex();
|
||||
static int oexpr();
|
||||
static int aexpr();
|
||||
static int nexpr();
|
||||
static int binop();
|
||||
static int primary();
|
||||
static int filstat();
|
||||
static int getn();
|
||||
static int newerf();
|
||||
static int olderf();
|
||||
static int equalf();
|
||||
static void syntax();
|
||||
static int test_eaccess();
|
||||
static int is_a_group_member();
|
||||
static void initialize_group_array();
|
||||
|
||||
extern int
|
||||
test_main(int argc, char** argv)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (strcmp(applet_name, "[") == 0) {
|
||||
if (strcmp(argv[--argc], "]"))
|
||||
error_msg_and_die("missing ]");
|
||||
argv[argc] = NULL;
|
||||
}
|
||||
/* Implement special cases from POSIX.2, section 4.62.4 */
|
||||
switch (argc) {
|
||||
case 1:
|
||||
exit( 1);
|
||||
case 2:
|
||||
exit (*argv[1] == '\0');
|
||||
case 3:
|
||||
if (argv[1][0] == '!' && argv[1][1] == '\0') {
|
||||
exit (!(*argv[2] == '\0'));
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (argv[1][0] != '!' || argv[1][1] != '\0') {
|
||||
if (t_lex(argv[2]),
|
||||
t_wp_op && t_wp_op->op_type == BINOP) {
|
||||
t_wp = &argv[1];
|
||||
exit (binop() == 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (argv[1][0] == '!' && argv[1][1] == '\0') {
|
||||
if (t_lex(argv[3]),
|
||||
t_wp_op && t_wp_op->op_type == BINOP) {
|
||||
t_wp = &argv[2];
|
||||
exit (!(binop() == 0));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
t_wp = &argv[1];
|
||||
res = !oexpr(t_lex(*t_wp));
|
||||
|
||||
if (*t_wp != NULL && *++t_wp != NULL)
|
||||
syntax(*t_wp, "unknown operand");
|
||||
|
||||
return( res);
|
||||
}
|
||||
|
||||
static void
|
||||
syntax(op, msg)
|
||||
char *op;
|
||||
char *msg;
|
||||
{
|
||||
if (op && *op)
|
||||
error_msg_and_die("%s: %s", op, msg);
|
||||
else
|
||||
error_msg_and_die("%s", msg);
|
||||
}
|
||||
|
||||
static int
|
||||
oexpr(n)
|
||||
enum token n;
|
||||
{
|
||||
int res;
|
||||
|
||||
res = aexpr(n);
|
||||
if (t_lex(*++t_wp) == BOR)
|
||||
return oexpr(t_lex(*++t_wp)) || res;
|
||||
t_wp--;
|
||||
return res;
|
||||
}
|
||||
|
||||
static int
|
||||
aexpr(n)
|
||||
enum token n;
|
||||
{
|
||||
int res;
|
||||
|
||||
res = nexpr(n);
|
||||
if (t_lex(*++t_wp) == BAND)
|
||||
return aexpr(t_lex(*++t_wp)) && res;
|
||||
t_wp--;
|
||||
return res;
|
||||
}
|
||||
|
||||
static int
|
||||
nexpr(n)
|
||||
enum token n; /* token */
|
||||
{
|
||||
if (n == UNOT)
|
||||
return !nexpr(t_lex(*++t_wp));
|
||||
return primary(n);
|
||||
}
|
||||
|
||||
static int
|
||||
primary(n)
|
||||
enum token n;
|
||||
{
|
||||
int res;
|
||||
|
||||
if (n == EOI)
|
||||
syntax(NULL, "argument expected");
|
||||
if (n == LPAREN) {
|
||||
res = oexpr(t_lex(*++t_wp));
|
||||
if (t_lex(*++t_wp) != RPAREN)
|
||||
syntax(NULL, "closing paren expected");
|
||||
return res;
|
||||
}
|
||||
if (t_wp_op && t_wp_op->op_type == UNOP) {
|
||||
/* unary expression */
|
||||
if (*++t_wp == NULL)
|
||||
syntax(t_wp_op->op_text, "argument expected");
|
||||
switch (n) {
|
||||
case STREZ:
|
||||
return strlen(*t_wp) == 0;
|
||||
case STRNZ:
|
||||
return strlen(*t_wp) != 0;
|
||||
case FILTT:
|
||||
return isatty(getn(*t_wp));
|
||||
default:
|
||||
return filstat(*t_wp, n);
|
||||
}
|
||||
}
|
||||
|
||||
if (t_lex(t_wp[1]), t_wp_op && t_wp_op->op_type == BINOP) {
|
||||
return binop();
|
||||
}
|
||||
|
||||
return strlen(*t_wp) > 0;
|
||||
}
|
||||
|
||||
static int
|
||||
binop()
|
||||
{
|
||||
const char *opnd1, *opnd2;
|
||||
struct t_op const *op;
|
||||
|
||||
opnd1 = *t_wp;
|
||||
(void) t_lex(*++t_wp);
|
||||
op = t_wp_op;
|
||||
|
||||
if ((opnd2 = *++t_wp) == (char *)0)
|
||||
syntax(op->op_text, "argument expected");
|
||||
|
||||
switch (op->op_num) {
|
||||
case STREQ:
|
||||
return strcmp(opnd1, opnd2) == 0;
|
||||
case STRNE:
|
||||
return strcmp(opnd1, opnd2) != 0;
|
||||
case STRLT:
|
||||
return strcmp(opnd1, opnd2) < 0;
|
||||
case STRGT:
|
||||
return strcmp(opnd1, opnd2) > 0;
|
||||
case INTEQ:
|
||||
return getn(opnd1) == getn(opnd2);
|
||||
case INTNE:
|
||||
return getn(opnd1) != getn(opnd2);
|
||||
case INTGE:
|
||||
return getn(opnd1) >= getn(opnd2);
|
||||
case INTGT:
|
||||
return getn(opnd1) > getn(opnd2);
|
||||
case INTLE:
|
||||
return getn(opnd1) <= getn(opnd2);
|
||||
case INTLT:
|
||||
return getn(opnd1) < getn(opnd2);
|
||||
case FILNT:
|
||||
return newerf (opnd1, opnd2);
|
||||
case FILOT:
|
||||
return olderf (opnd1, opnd2);
|
||||
case FILEQ:
|
||||
return equalf (opnd1, opnd2);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
filstat(nm, mode)
|
||||
char *nm;
|
||||
enum token mode;
|
||||
{
|
||||
struct stat s;
|
||||
unsigned int i;
|
||||
|
||||
if (mode == FILSYM) {
|
||||
#ifdef S_IFLNK
|
||||
if (lstat(nm, &s) == 0) {
|
||||
i = S_IFLNK;
|
||||
goto filetype;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (stat(nm, &s) != 0)
|
||||
return 0;
|
||||
|
||||
switch (mode) {
|
||||
case FILRD:
|
||||
return test_eaccess(nm, R_OK) == 0;
|
||||
case FILWR:
|
||||
return test_eaccess(nm, W_OK) == 0;
|
||||
case FILEX:
|
||||
return test_eaccess(nm, X_OK) == 0;
|
||||
case FILEXIST:
|
||||
return 1;
|
||||
case FILREG:
|
||||
i = S_IFREG;
|
||||
goto filetype;
|
||||
case FILDIR:
|
||||
i = S_IFDIR;
|
||||
goto filetype;
|
||||
case FILCDEV:
|
||||
i = S_IFCHR;
|
||||
goto filetype;
|
||||
case FILBDEV:
|
||||
i = S_IFBLK;
|
||||
goto filetype;
|
||||
case FILFIFO:
|
||||
#ifdef S_IFIFO
|
||||
i = S_IFIFO;
|
||||
goto filetype;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
case FILSOCK:
|
||||
#ifdef S_IFSOCK
|
||||
i = S_IFSOCK;
|
||||
goto filetype;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
case FILSUID:
|
||||
i = S_ISUID;
|
||||
goto filebit;
|
||||
case FILSGID:
|
||||
i = S_ISGID;
|
||||
goto filebit;
|
||||
case FILSTCK:
|
||||
i = S_ISVTX;
|
||||
goto filebit;
|
||||
case FILGZ:
|
||||
return s.st_size > 0L;
|
||||
case FILUID:
|
||||
return s.st_uid == geteuid();
|
||||
case FILGID:
|
||||
return s.st_gid == getegid();
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
filetype:
|
||||
return ((s.st_mode & S_IFMT) == i);
|
||||
|
||||
filebit:
|
||||
return ((s.st_mode & i) != 0);
|
||||
}
|
||||
|
||||
static enum token
|
||||
t_lex(s)
|
||||
char *s;
|
||||
{
|
||||
struct t_op const *op = ops;
|
||||
|
||||
if (s == 0) {
|
||||
t_wp_op = (struct t_op *)0;
|
||||
return EOI;
|
||||
}
|
||||
while (op->op_text) {
|
||||
if (strcmp(s, op->op_text) == 0) {
|
||||
t_wp_op = op;
|
||||
return op->op_num;
|
||||
}
|
||||
op++;
|
||||
}
|
||||
t_wp_op = (struct t_op *)0;
|
||||
return OPERAND;
|
||||
}
|
||||
|
||||
/* atoi with error detection */
|
||||
static int
|
||||
getn(s)
|
||||
char *s;
|
||||
{
|
||||
char *p;
|
||||
long r;
|
||||
|
||||
errno = 0;
|
||||
r = strtol(s, &p, 10);
|
||||
|
||||
if (errno != 0)
|
||||
error_msg_and_die("%s: out of range", s);
|
||||
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
|
||||
if (*p)
|
||||
error_msg_and_die("%s: bad number", s);
|
||||
|
||||
return (int) r;
|
||||
}
|
||||
|
||||
static int
|
||||
newerf (f1, f2)
|
||||
char *f1, *f2;
|
||||
{
|
||||
struct stat b1, b2;
|
||||
|
||||
return (stat (f1, &b1) == 0 &&
|
||||
stat (f2, &b2) == 0 &&
|
||||
b1.st_mtime > b2.st_mtime);
|
||||
}
|
||||
|
||||
static int
|
||||
olderf (f1, f2)
|
||||
char *f1, *f2;
|
||||
{
|
||||
struct stat b1, b2;
|
||||
|
||||
return (stat (f1, &b1) == 0 &&
|
||||
stat (f2, &b2) == 0 &&
|
||||
b1.st_mtime < b2.st_mtime);
|
||||
}
|
||||
|
||||
static int
|
||||
equalf (f1, f2)
|
||||
char *f1, *f2;
|
||||
{
|
||||
struct stat b1, b2;
|
||||
|
||||
return (stat (f1, &b1) == 0 &&
|
||||
stat (f2, &b2) == 0 &&
|
||||
b1.st_dev == b2.st_dev &&
|
||||
b1.st_ino == b2.st_ino);
|
||||
}
|
||||
|
||||
/* Do the same thing access(2) does, but use the effective uid and gid,
|
||||
and don't make the mistake of telling root that any file is
|
||||
executable. */
|
||||
static int
|
||||
test_eaccess (path, mode)
|
||||
char *path;
|
||||
int mode;
|
||||
{
|
||||
struct stat st;
|
||||
unsigned int euid = geteuid();
|
||||
|
||||
if (stat (path, &st) < 0)
|
||||
return (-1);
|
||||
|
||||
if (euid == 0) {
|
||||
/* Root can read or write any file. */
|
||||
if (mode != X_OK)
|
||||
return (0);
|
||||
|
||||
/* Root can execute any file that has any one of the execute
|
||||
bits set. */
|
||||
if (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (st.st_uid == euid) /* owner */
|
||||
mode <<= 6;
|
||||
else if (is_a_group_member (st.st_gid))
|
||||
mode <<= 3;
|
||||
|
||||
if (st.st_mode & mode)
|
||||
return (0);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
initialize_group_array ()
|
||||
{
|
||||
ngroups = getgroups(0, NULL);
|
||||
group_array = xrealloc(group_array, ngroups * sizeof(gid_t));
|
||||
getgroups(ngroups, group_array);
|
||||
}
|
||||
|
||||
/* Return non-zero if GID is one that we have in our groups list. */
|
||||
static int
|
||||
is_a_group_member (gid)
|
||||
gid_t gid;
|
||||
{
|
||||
register int i;
|
||||
|
||||
/* Short-circuit if possible, maybe saving a call to getgroups(). */
|
||||
if (gid == getgid() || gid == getegid())
|
||||
return (1);
|
||||
|
||||
if (ngroups == 0)
|
||||
initialize_group_array ();
|
||||
|
||||
/* Search through the list looking for GID. */
|
||||
for (i = 0; i < ngroups; i++)
|
||||
if (gid == group_array[i])
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
Loaded 100 of 448 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user