Compare commits

...
505 Commits
Author SHA1 Message Date
Denys Vlasenko fbb12ddc6a post 1.14.1 fixes; bump version to 1.14.2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-22 00:47:18 +02:00
Mike Frysinger b6bca7703b hush: add support for special vars in braces
Some people like to use ${?} rather than $?, so make sure we support all
the special single char vars that use this form.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 16:01:28 -04:00
Mike Frysinger 77508d70bf depmod.pl: updates and fixes galore
The helper script needs updating to match latest busybox modprobe behavior
in that all dependencies need to be listed, not just the immediate ones.
Along the way, fix symbol prefixed ports, optimize the output, and add
some more depmod compatible options.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-27 15:53:25 -04:00
Denys Vlasenko e6f6d82940 hush: more fixes from trunk; bump version to 1.14.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-27 18:07:29 +02:00
Denys Vlasenko 20cc390b9b post-1.14.0 fixes
hush significantly updated.
fixes for acpid, awk, depmod, dhcp, gzip, mdev, modprobe, sysctl.
libbb fixes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-27 18:01:42 +02:00
Denis Vlasenko bae3abf2c7 website: another tweak 2009-04-15 11:55:27 +00:00
Denis Vlasenko 9367734bd6 website: yet another small tweak 2009-04-15 11:51:18 +00:00
Denis Vlasenko 6c76a96f23 website: another tiny tweak 2009-04-15 11:48:25 +00:00
Denis Vlasenko 4e4c5db66a website: textual fixes in 1.14.0 announcement text 2009-04-15 11:11:19 +00:00
Denis Vlasenko 5dcb43a5d1 website: announce 1.14.0 and 1.13.4
Makefile: bump version to 1.14.0
2009-04-15 02:13:14 +00:00
Denis Vlasenko 32a3d084d3 mdev: safer handling of $SUBSYSTEM in mdev -s 2009-04-14 21:23:33 +00:00
Denis Vlasenko 7223424815 pointless whitespace/comment fixes, no code changes 2009-04-14 09:58:11 +00:00
Denis Vlasenko 7f9593753a randomconfig fixes 2009-04-14 08:06:59 +00:00
Denis Vlasenko b024f8da8f website: update ActionTec URL to http://opensource.actiontec.com/ 2009-04-14 01:31:41 +00:00
Denis Vlasenko 33c6b2a91a website: fix obsolete
"svn co svn://busybox.net/branches/busybox_1_12_stable"
 example
2009-04-14 00:59:37 +00:00
Denis Vlasenko 829bbd3b57 *: unify concurrent-safe update of /etc/{passwd,group,[g]shadow}
by Tito (farmatito AT tiscali.it)

function                                             old     new   delta
update_passwd                                        743    1171    +428
bb_perror_nomsg                                        -       9      +9
find_main                                            436     444      +8
passwd_main                                         1023    1027      +4
nameval                                              202     206      +4
chpasswd_main                                        315     319      +4
bb__parsespent                                       119     117      -2
adduser_main                                         654     650      -4
addgroup_main                                        345     341      -4
sv_main                                             1228    1222      -6
deluser_main                                         173     160     -13
bb_internal_putpwent                                  69       -     -69
add_user_to_group                                    231       -    -231
del_line_matching                                    460      31    -429
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 5/6 up/down: 457/-758)         Total: -301 bytes
2009-04-14 00:51:05 +00:00
Denis Vlasenko f2b39e088d mdev: add support for - "dont stop here" char
function                                             old     new   delta
make_device                                         1340    1362     +22
packed_usage                                       26291   26299      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 30/0)               Total: 30 bytes
2009-04-13 23:18:52 +00:00
Denis Vlasenko 065c714791 mdev: provide $SUBSYSTEM (by Vladimir)
function                                             old     new   delta
make_device                                         1265    1340     +75
dirAction                                             14      60     +46
mdev_main                                            676     695     +19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 140/0)             Total: 140 bytes
2009-04-13 22:23:02 +00:00
Denis Vlasenko 0b791d9a97 move llist_find_str from modutils to libbb 2009-04-13 20:52:00 +00:00
Denis Vlasenko 4144504912 modutils: remove redundant sanitization 2009-04-13 20:32:31 +00:00
Denis Vlasenko 2b2183a77d hush: make function support configurable 2009-04-13 14:23:12 +00:00
Denis Vlasenko 323cbbfaa2 mdev: fix a bug where \t is not treated as delimiter after [>|=PATH] 2009-04-13 13:59:26 +00:00
Denis Vlasenko aafbae6181 mdev: make usage text more useful
function                                             old     new   delta
packed_usage                                       26235   26291     +56
2009-04-13 13:33:02 +00:00
Denis Vlasenko e8a796828e dhcprelay: fix usage text. Simplify and make code more readable.
Add TODOs.
2009-04-13 03:33:46 +00:00
Denis Vlasenko 1f63229a8e rmmod: fix bug 263
"modutils/rmmod can't remove modules with dash in name on 2.4 kernels"

function                                             old     new   delta
rmmod_main                                           187     220     +33
2009-04-13 02:25:40 +00:00
Denis Vlasenko 1fb26da071 mdev: ignore events with "$SUBSYSTEM" == "firmware" && "$ACTION" == "remove"
function                                             old     new   delta
mdev_main                                            665     676     +11
2009-04-13 02:15:57 +00:00
Denis Vlasenko 1d925affa9 website: add http://www.dream-multimedia-tv.de/ to list of products
using bbox
2009-04-13 00:55:42 +00:00
Denis Vlasenko bc56974062 hush: pass functions to child shells on NOMMU
function                                             old     new   delta
new_function                                           -     123    +123
hush_main                                           1198    1262     +64
re_execute_shell                                     341     387     +46
run_pipe                                            1872    1790     -82
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/1 up/down: 233/-82)           Total: 151 bytes
2009-04-12 20:35:19 +00:00
Denis Vlasenko ef1b439669 dnsd: stop using oversized buffer. trim comment. 2009-04-12 19:03:01 +00:00
Denis Vlasenko e12c90217b halt/reboot/powerdown: accept and ignore -i 2009-04-12 15:59:35 +00:00
Denis Vlasenko 51056b382a modutils: small optimization
function                                             old     new   delta
bb_init_module_24                                   4570    4565      -5
2009-04-12 14:21:29 +00:00
Denis Vlasenko f1df35c40b mdev: do not complain if /sys/block doesn't exist 2009-04-12 14:00:12 +00:00
Denis Vlasenko 67b5eeb933 awk: fix long field separators case. By Ian Wienand (ianw AT vmware.com) 2009-04-12 13:54:13 +00:00
Denis Vlasenko 32a385f5b0 getty: fix handling of speed 0;
stop using non-portable way of setting speeds.

function                                             old     new   delta
cfsetispeed                                            -      76     +76
cfsetospeed                                            -      57     +57
cfgetispeed                                            -      20     +20
2009-04-12 13:05:40 +00:00
Denis Vlasenko 5c32993009 mount: users report that CIFS support is breaking things,
mostly remove it.
2009-04-12 12:16:21 +00:00
Denis Vlasenko f8de411e24 dnsd: removed highly questionable setting of signals to SIG_IGN 2009-04-12 04:20:22 +00:00
Denis Vlasenko ddbf3bf35f dnsd: fix a number of bugs. Ideas by Ming-Ching Tiew (mctiew AT yahoo.com)
function                                             old     new   delta
undot                                                  -      42     +42
dnsd_main                                           1394    1213    -181
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 42/-181)          Total: -139 bytes
2009-04-12 04:09:09 +00:00
Denis Vlasenko 135cecbbce ash: fix warning in debug build 2009-04-12 00:00:57 +00:00
Denis Vlasenko c43430f1b9 hush: remove functions from TODOs 2009-04-11 11:07:22 +00:00
Denis Vlasenko 0701dca88c hush: improve debugging output 2009-04-11 10:38:47 +00:00
Denis Vlasenko ed055214bb hush: fix "while...do f1() {a;}; f1; f1 {b;}; f1; done" bug 2009-04-11 10:37:10 +00:00
Denis Vlasenko 75bccfa375 hush: tweak tests 2009-04-10 23:48:03 +00:00
Denis Vlasenko ce4acbbab6 hush: add function tests 2009-04-10 23:23:41 +00:00
Denis Vlasenko 6ba6f546ac hush: pass $n to functions
function                                             old     new   delta
run_pipe                                            1183    1325    +142
run_list                                            1219    1220      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 143/0)             Total: 143 bytes
2009-04-10 21:57:50 +00:00
Denis Vlasenko c0ea329297 hush: fix a few thinkos in function support; make it work on NOMMU;
functions in child shells now even have $n passed to them! :)
 (in main shell it still doesn't work)
2009-04-10 21:22:02 +00:00
Denis Vlasenko b7d8c0dbbd hush: first stab at function support. argv passing is not coded yet.
Only very rudimentary testing was done.
 With function support off, code growth is zero, with it on:

function                                             old     new   delta
run_list                                            2158    2339    +181
parse_stream                                        1929    2044    +115
find_builtin                                          24      67     +43
find_function                                          -      36     +36
file_get                                             244     264     +20
pseudo_exec_argv                                     145     160     +15
free_strings                                           -       7      +7
free_pipe                                            183     181      -2
done_word                                            735     728      -7
expand_variables                                    2227    2204     -23
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 5/3 up/down: 417/-32)           Total: 385 bytes
2009-04-10 19:05:43 +00:00
Denis Vlasenko 835fcfd33d hush: reinstate accidentally reverted comment fix 2009-04-10 13:51:56 +00:00
Denis Vlasenko 0b677d8337 hush: fix some TODOs. TODO in export builting: +250 bytes.
simplify unexpected EOF handling.

function                                             old     new   delta
builtin_export                                       117     374    +257
o_reset_to_empty_unquoted                              -      21     +21
parse_stream                                        1926    1929      +3
syntax_error_unterm_ch                                31      32      +1
handle_dollar                                        644     641      -3
parse_stream_dquoted                                 307     298      -9
add_till_backquote                                   106      97      -9
add_till_closing_paren                               303     286     -17
o_reset                                               21       -     -21
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 3/4 up/down: 282/-59)           Total: 223 bytes
2009-04-10 13:49:10 +00:00
Denis Vlasenko 1fd1ea4395 hush: tighten up "for" variable name check.
Add TODOs.
 Disable redir4.right part where we differ from bash.
 It is not a bug per standards.
 Add a few tests, one is in hush-bugs section:
 and_or_and_backgrounding.right. It will likely bite users
 in real world usage.
2009-04-10 12:03:20 +00:00
Denis Vlasenko 551bdfecb7 hush: fix typo in comment 2009-04-10 11:13:26 +00:00
Denis Vlasenko ed7823738c fix segfault on syntax error code path 2009-04-10 00:45:02 +00:00
Denis Vlasenko c96865f445 hush: readability improvements.
fix some more obscure bugs.
 a new redir4.tests is known to fail.
2009-04-10 00:20:58 +00:00
Mike Frysinger e05f9286a9 add test cases for parameter substitution with unset/null strings 2009-04-09 23:01:47 +00:00
Mike Frysinger 57e746781c dont crash if the variable we do substitution on is not set 2009-04-09 23:00:33 +00:00
Denis Vlasenko d68ae08cde hush: shrink and make more versatile error-reporting machinery
function                                             old     new   delta
syntax_error_unterm_ch                                 -      31     +31
syntax_error_unterm_str                                -      14     +14
parse_stream                                        2356    2361      +5
syntax_error_at                                       12      14      +2
syntax_error                                          25      27      +2
syntax_error_unterminated                             28       -     -28
expand_variables                                    2063    2031     -32
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/1 up/down: 54/-60)             Total: -6 bytes
   text    data     bss     dec     hex filename
  67278     197    3184   70659   11403 busybox_old
  67228     197    3184   70609   113d1 busybox_unstripped
2009-04-09 20:41:34 +00:00
Denis Vlasenko 05d3b7cc0d hush: deal with some easier TODOs
function                                             old     new   delta
is_well_formed_var_name                                -      87     +87
builtin_read                                          49      86     +37
die_if_script                                          -      31     +31
syntax_error_unterminated                              -      28     +28
syntax_error                                          26      51     +25
done_word                                            768     788     +20
syntax_error_at                                        -      12     +12
parse_stream_dquoted                                 320     328      +8
expand_variables                                    2064    2063      -1
run_list                                            1225    1220      -5
add_till_closing_paren                               308     303      -5
add_till_backquote                                   111     106      -5
handle_dollar                                        812     803      -9
parse_stream                                        2378    2356     -22
parse_redirect                                       408     372     -36
maybe_die                                             44       -     -44
is_assignment                                        215     134     -81
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 4/8 up/down: 248/-208)           Total: 40 bytes
2009-04-09 19:16:15 +00:00
Denis Vlasenko 1943aec2ec hush: plug the leak of expanded heredoc 2009-04-09 14:15:57 +00:00
Denis Vlasenko efea9d2819 hush: fix EXIT trap recursion case; check redirection failures
function                                             old     new   delta                          
run_pipe                                            1299    1328     +29                          
hush_exit                                             90     102     +12                          
hush_main                                           1172    1179      +7                          
run_list                                            1226    1225      -1                          
------------------------------------------------------------------------------                    
(add/remove: 0/0 grow/shrink: 3/1 up/down: 48/-1)              Total: 47 bytes
2009-04-09 13:43:11 +00:00
Denis Vlasenko f81e8dbc74 *: make "pragma GCC visibility push(hidden)" less ugly 2009-04-09 12:35:13 +00:00
Mike Frysinger 327fd47f36 skip some tests when fancy echo support is turned off 2009-04-09 07:50:18 +00:00
Mike Frysinger c3d91952d6 we arent testing echo -n here so use printf instead 2009-04-09 07:50:02 +00:00
Mike Frysinger 20300d0129 source the .config so tests can signal they need to be skipped due to feature disable 2009-04-09 07:49:43 +00:00
Mike Frysinger fe013a74ff patch by Stuart Hughes <seh@zee2.com> and Guenter <lists@gknw.net> to make "0" a special baud rate for getty where it uses this as "leave baud rate unchanged" 2009-04-09 07:08:04 +00:00
Denis Vlasenko f50caac53c hush: typo in comment 2009-04-09 01:40:15 +00:00
Denis Vlasenko a2218dd862 hush: fix thinko in re_execute_shell; pass even less junk to heredoc helper
function                                             old     new   delta
re_execute_shell                                     284     314     +30
setup_heredoc                                        290     303     +13
execv                                                 23       -     -23
2009-04-09 01:39:02 +00:00
Denis Vlasenko 5c090a96f9 hush: more rodust detection of unterminated strings etc;
fix a case where we forget to copy `cmd` text;
 optimize nommu heredoc helper by not passing environment to it;
 add several tests

function                                             old     new   delta
add_till_closing_paren                               256     308     +52
parse_stream                                        2337    2378     +41
add_till_backquote                                    82     111     +29
re_execute_shell                                     269     284     +15
handle_dollar                                        802     812     +10
parse_stream_dquoted                                 316     320      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/0 up/down: 151/0)             Total: 151 bytes
2009-04-08 21:51:33 +00:00
Denis Vlasenko ffe6f80851 expand leak_all1.tests 2009-04-08 16:59:24 +00:00
Denis Vlasenko 14725f82b6 slight tweak to the leak detector 2009-04-08 16:46:45 +00:00
Denis Vlasenko cc90f44402 hush: plug leak in run_pipe(). NOMMU only. 2009-04-08 16:40:34 +00:00
Denis Vlasenko 08daf564ae hush: add a leak test which currently fails 2009-04-08 12:11:23 +00:00
Denis Vlasenko c73b70c701 hush: add leak detector helper; fix/add tests for it
function                                             old     new   delta
builtin_memleak                                        -      92     +92
bltins                                               288     300     +12
2009-04-08 11:48:57 +00:00
Denis Vlasenko 3dfb035d8d hush: echo \2>file fix 2009-04-08 09:29:14 +00:00
Denis Vlasenko df6f95cedf FEATURE_FANCY_ECHO needs to be accessible for hush 2009-04-07 20:07:23 +00:00
Denis Vlasenko 02d6f1ad72 hush: fix heredoc expansion of $var and cmd
function                                             old     new   delta
expand_pseudo_dquoted                                  -     104    +104
setup_heredoc                                        215     275     +60
done_word                                            669     691     +22
parse_stream                                        1899    1902      +3
setup_redirects                                      196     191      -5
free_pipe                                            189     183      -6
expand_variables                                    2349    2229    -120
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/3 up/down: 189/-131)           Total: 58 bytes
2009-04-07 19:56:55 +00:00
Denis Vlasenko 25af86f73d hush: fix wrong comment 2009-04-07 13:29:27 +00:00
Denis Vlasenko af07b7c5b6 hush: fix heredoc <<- handling.
hush-misc/heredoc2.tests testcase needs only one fix now -
 $var and `cmd` expancsion in heredocs

function                                             old     new   delta
parse_redirect                                       265     306     +41
parse_stream                                        1866    1899     +33
2009-04-07 13:26:18 +00:00
Denis Vlasenko 50f3aa4547 hush: NOMMU-safe support of big heredocs
function                                             old     new   delta
setup_heredoc                                        116     215     +99
2009-04-07 10:52:40 +00:00
Mike Frysinger d4a24f2aae here documents have been added, so drop from TODO 2009-04-07 07:28:25 +00:00
Mike Frysinger 932e111418 use sleep rather than usleep 2009-04-07 06:08:14 +00:00
Mike Frysinger b509c9c670 add a pathological test case for here doc related to eof marker and other ugly corner cases 2009-04-07 06:06:05 +00:00
Mike Frysinger a4f331d3c3 implement support for parameter substitution via #/% operators 2009-04-07 06:03:22 +00:00
Denis Vlasenko 6c9be7f451 hush: heredoc support, based on patch by Mike Frysinger (vapier AT gentoo.org)
some TODOs are to be attacked later

function                                             old     new   delta
parse_stream                                        1461    1866    +405
parse_redirect                                         -     265    +265
setup_heredoc                                          -     116    +116
setup_redirects                                      151     196     +45
builtin_exit                                          49      47      -2
redirect_opt_num                                      61      55      -6
setup_redirect                                       212       -    -212
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 2/2 up/down: 831/-220)          Total: 611 bytes
2009-04-07 02:29:51 +00:00
Denis Vlasenko ab2b064342 hush: s/last_return_code/last_exitcode/g 2009-04-06 18:42:11 +00:00
Denis Vlasenko 0e15138c03 hush: fix "if false; then...fi" exitcode;
trim "keyword"-less hush by 10 bytes
2009-04-06 18:40:31 +00:00
Denis Vlasenko 4ed67dd3d5 make hush-misc/*.tests executable 2009-04-06 18:10:20 +00:00
Denis Vlasenko cd418a2670 hush: fix a bunch of obscure while/until/continue bugs
function                                             old     new   delta
run_list                                            1159    1214     +55
done_pipe                                            106     123     +17
done_command                                          86      98     +12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 84/0)               Total: 84 bytes
2009-04-06 18:08:35 +00:00
Denis Vlasenko 8f8d013afc *.tests should be executable 2009-04-06 16:27:51 +00:00
Denis Vlasenko 715f712d15 move hush-parsing/and-or.tests to hush-misc/*
(which probably needs to be renamed to hush-execution...)
2009-04-06 16:17:51 +00:00
Mike Frysinger 3a64833eb9 add some brute force logic tests 2009-04-06 14:22:54 +00:00
Denis Vlasenko a2b11e3395 hush: fix "false && echo yes || echo no" bug 265
function                                             old     new   delta
run_list                                            1159    1189     +30
2009-04-06 14:11:13 +00:00
Denis Vlasenko 0969a49c08 hush: beautify re_execute_shell more 2009-04-06 13:05:57 +00:00
Denis Vlasenko 34e573d2ce hush: drop allocations in re_execute_shell
function                                             old     new   delta
hush_main                                           1127    1138     +11
re_execute_shell                                     286     256     -30
clean_up_after_re_execute                             66      30     -36
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 11/-66)            Total: -55 bytes
2009-04-06 12:56:28 +00:00
Mike Frysinger 3c7167b508 add tests for basic fd open/close/dupe 2009-04-06 12:36:10 +00:00
Mike Frysinger dc4178050a fix #>&- syntax for closing fds 2009-04-06 12:35:41 +00:00
Mike Frysinger 9052600feb fix redir1 tests -- usleep isnt standard in $PATH 2009-04-06 12:34:27 +00:00
Denis Vlasenko 5e883fb00d hush: micro-optimization. -37 bytes 2009-04-06 12:28:34 +00:00
Denis Vlasenko b1d11bf45e hush: more efficient filtering of "safe" arithmetic
function                                             old     new   delta
expand_variables                                    2170    2147     -23
2009-04-06 12:24:58 +00:00
Denis Vlasenko d0b4a8c285 hush: add <> and () as "safe" arith chars 2009-04-06 12:09:55 +00:00
Denis Vlasenko bfbc971f9f hush: print cd error to stderr; use fopen_or_warn in builtin_source;
prepare builtin_unset for function support
libbb: do not clear errno in fopen_or_warn

function                                             old     new   delta
builtin_unset                                        242     271     +29
fopen_or_warn                                         42      31     -11
builtin_cd                                            90      74     -16
builtin_source                                        89      72     -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 29/-44)            Total: -15 bytes
2009-04-06 12:04:42 +00:00
Denis Vlasenko b0a6478eef hush: fix "export a=a b=b" (was not setting and exporting b)
function                                             old     new   delta
builtin_export                                       103     117     +14
2009-04-06 11:33:07 +00:00
Denis Vlasenko c8d27334a0 hush: update TODO list; + my usual pointless tweaks :( 2009-04-06 10:47:21 +00:00
Denis Vlasenko d3f973eab2 hush: mark SIGHUP TODOs better; don't disable SIGHUP for now,
small tweaks to comments
2009-04-06 10:21:42 +00:00
Denis Vlasenko a0e65120b5 hush: cosmetics, no code changes 2009-04-05 23:39:14 +00:00
Denis Vlasenko f4393046ef modprobe/insmod for 2.4: support compressed modules.
by Guenter (lists AT gknw.net)

function                                             old     new   delta
bb_init_module_24                                   4551    4570     +19
obj_load                                             786     794      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 27/0)               Total: 27 bytes
2009-04-05 23:25:09 +00:00
Denis Vlasenko 913a201bf0 hush: strip NULs from file input, they are PITA/impossible to handle correctly
function                                             old     new   delta
file_peek                                             89      93      +4
file_get                                             260     264      +4
2009-04-05 22:17:04 +00:00
Mike Frysinger 258275d85f drop HUSH_VER_STR since it has no relevance anymore -- just use BB_VER 2009-04-05 21:19:43 +00:00
Denis Vlasenko c4a7af55e9 hush: fix trap clearing in subshells on MMU; simplify NOMMU a bit:
function                                             old     new   delta
parse_stream_dquoted                                 335     324     -11
handle_dollar                                        849     800     -49
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-60)             Total: -60 bytes
2009-04-05 20:33:27 +00:00
Denis Vlasenko f937528571 hush: audit and fix "interactive shell" setup code.
function                                             old     new   delta
block_signals                                          -     139    +139
maybe_set_to_sigexit                                   -      47     +47
run_list                                            2018    2030     +12
expand_variables                                    2155    2165     +10
maybe_set_sighandler                                  47       -     -47
hush_main                                            992     918     -74
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 2/1 up/down: 208/-121)           Total: 87 bytes
2009-04-05 19:13:39 +00:00
Denis Vlasenko 46f9b6db80 hush: pass $! thru re-execution; try harder on re-exec; give error
msg if re-exec didn't work; other tweaks in main()

function                                             old     new   delta
hush_main                                           1144    1199     +55
re_execute_shell                                     237     286     +49
file_get                                             240     260     +20
clean_up_after_re_execute                             58      66      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 132/0)             Total: 132 bytes
2009-04-05 10:39:03 +00:00
Denis Vlasenko 232be3e79b hush: suppress bogus warning from 4.2.1 2009-04-05 09:16:00 +00:00
Denis Vlasenko 18f2a79f9b build system tweaks to account for latest hush changes 2009-04-05 09:02:11 +00:00
Denis Vlasenko d85a5df159 hush: randomconfig fixes 2009-04-05 08:43:57 +00:00
Denis Vlasenko cc4c693ec5 hush: plug the leak on NOMMU re-execute path
function                                             old     new   delta
clean_up_after_re_execute                              -      58     +58
re_execute_shell                                     226     244     +18
run_pipe                                            1271    1276      +5
generate_stream_from_string                          133     138      +5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 86/0)               Total: 86 bytes
2009-04-05 07:38:48 +00:00
Denis Vlasenko c3ff48b921 fixing mode on hush-leak/leak_argv1.tests 2009-04-05 02:14:59 +00:00
Denis Vlasenko 8a496d5db0 fixing mode on hush-leak/leak_argv1.tests 2009-04-05 02:14:37 +00:00
Denis Vlasenko 30db43b5c5 hush: fix passing of $n on NOMMU 2009-04-05 02:10:39 +00:00
Denis Vlasenko 16a0c74f63 hush: fix hush-misc/break5.tests NOMMU failure
function                                             old     new   delta
hush_main                                           1118    1144     +26
re_execute_shell                                     188     204     +16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 42/0)               Total: 42 bytes
2009-04-05 01:46:59 +00:00
Denis Vlasenko 0bb4a23506 hush: fix all testsuite failures on NOMMU except memory leak.
known TODOs: we do not pass traps and positional args yet.
2009-04-05 01:42:59 +00:00
Denis Vlasenko 609f2ab434 hush: enable NOMMU re-execution logic. Some testsuite entries
fail on NOMMU. Before it was much worse.
 No regressions on MMU, size:

function                                             old     new   delta
handle_dollar                                        626     632      +6
run_list                                            2018    2022      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 10/0)               Total: 10 bytes
2009-04-04 23:15:14 +00:00
Denis Vlasenko 9aa7d6fdc5 hush: preparatory patch for NOMMU-safe { list } handling.
function                                             old     new   delta
o_addblock                                             -      58     +58
o_addstr_with_NUL                                      -      27     +27
builtin_exit                                          47      49      +2
run_list                                            2020    2018      -2
o_addstrauto                                          27       -     -27
parse_stream                                        1508    1461     -47
o_addstr                                              58       -     -58
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/2 up/down: 87/-134)           Total: -47 bytes
2009-04-04 22:47:50 +00:00
Denis Vlasenko 42e78b978f ftpd: s/CONFIG_BUSYBOX_EXEC_PATH/bb_busybox_exec_path/ 2009-04-04 20:34:22 +00:00
Denis Vlasenko 34d4d89b2d hush: fix NOMMU hangs in pseudo_exec_argv. Add forgotted setting
of signal mask. Reuse same help string in all shells.

function                                             old     new   delta
builtin_exit                                          49      47      -2
pseudo_exec_argv                                     149     145      -4
builtin_help                                          74      63     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-17)             Total: -17 bytes
   text    data     bss     dec     hex filename
 825379     476    7616  833471   cb7bf busybox_old
 825341     476    7616  833433   cb799 busybox_unstripped
2009-04-04 20:24:37 +00:00
Denis Vlasenko 552433bc5a hush: fix "var=val >file" not creating file
function                                             old     new   delta
static.null_ptr                                        -       4      +4
run_list                                            2018    2020      +2
handle_dollar                                        667     626     -41
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 6/-41)             Total: -35 bytes
2009-04-04 19:29:21 +00:00
Denis Vlasenko a24c8caeb2 hush: remove code which errors out on $- and $_, it's useless;
wrap some longish lines

function                                             old     new   delta
handle_dollar                                        667     626     -41
2009-04-04 15:24:40 +00:00
Denis Vlasenko 7c9861214b hush: remove CHAR_xxx constants 2009-04-04 12:15:42 +00:00
Denis Vlasenko 6da69cddc0 hush: get rid of charmap[]
function                                             old     new   delta
parse_stream                                        1447    1508     +61
get_local_var_value                                    -      31     +31
run_list                                            2018    2020      +2
pseudo_exec_argv                                     151     149      -2
maybe_set_sighandler                                  50      47      -3
hush_exit                                             93      90      -3
builtin_wait                                         275     272      -3
check_and_run_traps                                  169     164      -5
hush_main                                            985     977      -8
file_get                                             260     240     -20
builtin_trap                                         438     414     -24
set_in_charmap                                        30       -     -30
lookup_param                                          31       -     -31
parse_and_run_stream                                 153      54     -99
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/9 up/down: 94/-228)          Total: -134 bytes
2009-04-04 12:12:58 +00:00
Mike Frysinger dfa9de7176 simplify maybe_die() slightly 2009-04-03 22:48:10 +00:00
Denis Vlasenko db2a9b683a hush: finally make cmd safe on NOMMU
function                                             old     new   delta
generate_stream_from_string                            -     157    +157
expand_variables                                    2050    2003     -47
generate_stream_from_list                            139       -    -139
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 157/-186)          Total: -29 bytes
2009-04-03 22:31:18 +00:00
Denis Vlasenko e0755e58ca hush: yet another randomconfig fix 2009-04-03 21:16:45 +00:00
Denis Vlasenko cc8289dc04 shell/math: randomconfig fix 2009-04-03 21:13:31 +00:00
Denis Vlasenko 60b392fd5b hush: randomconfig fixes 2009-04-03 19:14:32 +00:00
Denis Vlasenko b6e6556b31 hush: improve parse_stream: does not require parsing context struct;
cleans up on syntax errors (we used to leak memory in this case);
 much simplified interface to the rest of hush.

function                                             old     new   delta
parse_stream                                        1204    1447    +243
done_word                                            658     669     +11
static_get                                            22      28      +6
builtin_source                                        84      89      +5
parse_and_run_file                                    27      30      +3
parse_and_run_string                                  31      27      -4
builtin_eval                                          55      50      -5
hush_main                                            991     985      -6
free_pipe_list                                        39      31      -8
free_pipe                                            210     189     -21
expand_variables                                    2242    2199     -43
parse_and_run_stream                                 289     153    -136
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/7 up/down: 268/-223)           Total: 45 bytes
2009-04-03 16:49:04 +00:00
Denis Vlasenko 240c255d8b hush: simplify parse_stream
function                                             old     new   delta
parse_and_run_stream                                 292     289      -3
parse_stream                                        1218    1204     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-17)             Total: -17 bytes
2009-04-03 03:45:05 +00:00
Denis Vlasenko 3718168b87 hush: fix bug with local environment vars in pipes; simplify parse_stream()
function                                             old     new   delta
parse_stream                                        1238    1218     -20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-20)             Total: -20 bytes
2009-04-03 03:19:15 +00:00
Denis Vlasenko f9f7429346 hush: explain parsing context structure
plug leak in setup_redirect on error path

function                                             old     new   delta
done_command                                          84      86      +2
done_word                                            657     658      +1
done_pipe                                            105     106      +1
initialize_context                                    39      38      -1
setup_redirect                                       219     212      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 4/-8)               Total: -4 bytes
2009-04-03 00:07:05 +00:00
Denis Vlasenko 027e3fddb5 hush: straighten parse_stream() API a bit
function                                             old     new   delta
parse_stream                                        1240    1238      -2
expand_variables                                    2272    2242     -30
parse_and_run_stream                                 338     292     -46
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-78)             Total: -78 bytes
2009-04-02 22:50:40 +00:00
Mike Frysinger a36258f288 trim trailing slashes from specified subdir so we output to the right place 2009-04-02 22:46:52 +00:00
Denis Vlasenko b7aaae9052 hush: rename ->o_quote to ->o_escape
hush_test/hush-arith/*: new tests for arithmetic evaluation
2009-04-02 20:17:49 +00:00
Mike Frysinger 7a79afa3ca Arithmetic Expansion is supported now in hush, so drop from TODO 2009-04-02 17:06:35 +00:00
Denis Vlasenko f328e00b10 hush: do not inadvertently parse $((1 + "22")) as ok.
-20 bytes code size
2009-04-02 16:55:38 +00:00
Denis Vlasenko 2f1d394214 hush: make
a=55; echo $(($a + 1)) $((1 + $((2)) + `echo $a`))
 work as expected

function                                             old     new   delta
handle_dollar                                          -     667    +667
parse_stream_dquoted                                   -     316    +316
expand_variables                                    2124    2272    +148
is_assignment                                        134     215     +81
parse_stream                                        2038    1240    -798
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/1 up/down: 1212/-798)         Total: 414 bytes
2009-04-02 16:31:29 +00:00
Denis Vlasenko b29eb6ed25 shells: do not need to have math state global
function                                             old     new   delta                           
ash_arith                                              -     143    +143                           
expand_variables                                    2102    2124     +22                           
popstring                                            134     140      +6                           
parse_command                                       1460    1463      +3                           
trapcmd                                              236     238      +2                           
changepath                                           197     196      -1                           
raise_interrupt                                       86      83      -3                           
hush_main                                           1012     991     -21                           
ash_main                                            1388    1364     -24                           
arith_set_local_var                                   73      34     -39                           
dash_arith                                           117       -    -117                           
------------------------------------------------------------------------------                     
(add/remove: 1/1 grow/shrink: 4/5 up/down: 176/-205)          Total: -29 bytes
2009-04-02 13:46:27 +00:00
Denis Vlasenko 0dfe1d26a9 fix ash-alias/alias.tests failure 2009-04-02 12:57:38 +00:00
Mike Frysinger 98c52645c0 split math code out of ash and into a standalone library so we can use it in any shell (like hush!) 2009-04-02 10:02:37 +00:00
Denis Vlasenko 551ffdccea more of pointless whitespace fixes 2009-04-01 19:48:05 +00:00
Denis Vlasenko bd79c3d337 dhcpd: remember and record hostnames; optimize get_option
dumpleases: show hostnames

function                                             old     new   delta
add_lease                                            230     292     +62
send_offer                                           403     421     +18
send_ACK                                             232     249     +17
read_leases                                          249     258      +9
dumpleases_main                                      604     609      +5
nobody_responds_to_arp                                84      86      +2
udhcp_end_option                                      32      30      -2
udhcp_get_option                                     222     171     -51
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/2 up/down: 113/-53)            Total: 60 bytes
2009-04-01 12:36:09 +00:00
Denis Vlasenko 3266aa9ec2 trailing whitespace removal 2009-04-01 11:24:04 +00:00
Denis Vlasenko 88b8f0a347 sendmail: update by Vladimir
build system: tweak for rare case where include/autoconf.h
  does not get updated

function                                             old     new   delta
packed_usage                                       26238   26242      +4
sendmail_main                                       1353     897    -456
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 4/-456)           Total: -452 bytes
2009-03-31 23:41:53 +00:00
Denis Vlasenko d308106245 hust_test/*: use "$THIS_SH" instead of hush 2009-03-31 22:14:32 +00:00
Denis Vlasenko 9983d806d9 volumeid: fix bug 249 "findfs finds the wrong partition" 2009-03-31 19:47:34 +00:00
Denis Vlasenko f6fbd62760 ash: add/improve comments, no code changes 2009-03-31 19:36:58 +00:00
Denis Vlasenko 46aeab9a34 ash: fix $IFS handling in read. closes bug 235 2009-03-31 19:18:17 +00:00
Denis Vlasenko 7566bae197 hush: fix wait builtin
function                                             old     new   delta
builtin_wait                                         174     275    +101
sigwaitinfo                                            -      48     +48
__GI_sigwaitinfo                                       -      48     +48
check_and_run_traps                                  133     169     +36
checkjobs                                            349     380     +31
hush_main                                            971     991     +20
static.zero_timespec                                   -       8      +8
run_list                                            2010    2016      +6
file_get                                             254     260      +6
static.zero_ts                                         8       -      -8
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 6/0 up/down: 304/-8)            Total: 296 bytes
2009-03-31 17:24:49 +00:00
Denis Vlasenko 70c6e40e47 libbb: fix typo in comment 2009-03-31 13:14:18 +00:00
Denis Vlasenko 1b62ead313 hush: don't lie in comment 2009-03-31 13:13:17 +00:00
Denis Vlasenko 7b830e78f2 hush: fix comments, no code changes 2009-03-31 13:05:32 +00:00
Denis Vlasenko 422cd7c81c hush: make ^C work again, ^Z probably isn't working
function                                             old     new   delta
file_get                                             219     254     +35
check_and_run_traps                                  122     133     +11
run_list                                            2001    2010      +9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 55/0)               Total: 55 bytes
2009-03-31 12:41:52 +00:00
Denis Vlasenko abedaac842 hush: do not reset sighaldlers after fork - instead, prevent them from doing any harm
if they will be called. saves many sigaction calls on every fork.

function                                             old     new   delta
hush_main                                            887     971     +84
sigexit                                               54      65     +11
run_list                                            2006    2001      -5
maybe_set_sighandler                                  76      50     -26
set_fatal_sighandler                                 186       -    -186
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/2 up/down: 95/-217)          Total: -122 bytes
2009-03-31 12:03:40 +00:00
Denis Vlasenko d5762932fb hush: rework signal and trap handling. Some smaller bits are TODO,
expect minor breakage

function                                             old     new   delta
set_fatal_sighandler                                  12     186    +174
check_and_run_traps                                    -     122    +122
maybe_set_sighandler                                   -      76     +76
hush_main                                            831     887     +56
sigtimedwait                                           -      50     +50
__GI_sigtimedwait                                      -      50     +50
hush_exit                                             49      93     +44
set_mode                                             749     777     +28
pseudo_exec_argv                                     131     151     +20
static.zero_ts                                         -       8      +8
expand_variables                                    1962    1970      +8
builtin_wait                                         172     174      +2
set_misc_sighandler                                   12       -     -12
set_jobctrl_sighandler                                12       -     -12
handler_ctrl_c                                        16       -     -16
builtin_set_mode                                      28       -     -28
handle_trap                                           97       -     -97
handler_ctrl_z                                       107       -    -107
builtin_trap                                         545     438    -107
run_list                                            2149    2006    -143
------------------------------------------------------------------------------
(add/remove: 5/6 grow/shrink: 7/2 up/down: 638/-522)          Total: 116 bytes
2009-03-31 11:22:57 +00:00
Mike Frysinger d690f68554 implement unset semantics as required by POSIX 2009-03-30 06:50:54 +00:00
Mike Frysinger 5f9f1506ad fix DOC build output to be like kbuild standard 2009-03-30 05:26:34 +00:00
Mike Frysinger 0080ea7992 update trap poisx link 2009-03-30 03:50:07 +00:00
Mike Frysinger 87824e0e50 do not automatically display job information when the shell is not interactive 2009-03-30 00:19:30 +00:00
Mike Frysinger 681a4b7f06 enable trap tests 2009-03-29 23:49:46 +00:00
Mike Frysinger 9f8128f480 first pass at trap support in hush 2009-03-29 23:49:37 +00:00
Denis Vlasenko 0d907eab6c modutils: dont pass NULL options to init_module() 2009-03-29 17:25:14 +00:00
Denis Vlasenko a83dbd4146 build system: hdparm -d is not that dangerous, remove warning 2009-03-29 17:13:20 +00:00
Denis Vlasenko a6eb7f4ddf sendmail: add more example in usage text 2009-03-29 16:53:25 +00:00
Denis Vlasenko e1de3af989 module loading for 2.4: use fd-based io instead of FILE based;
use xlseek and xread; simpler check for ELF signature.

   text    data     bss     dec     hex filename
 824460     476    7616  832552   cb428 busybox_old
 824333     476    7616  832425   cb3a9 busybox_unstripped
2009-03-29 16:38:59 +00:00
Mike Frysinger fd303b11ef add test cases for trap ... but disabled for now until trap support is committed 2009-03-29 09:54:40 +00:00
Denis Vlasenko 038fe44713 sysctl: move code around to get rid of forward references.
(incidentally it helps gcc to make code smaller)
2009-03-29 02:23:16 +00:00
Denis Vlasenko 5a6617acb8 sysctl: fix broken -p [file] - close bug 231 2009-03-29 02:22:19 +00:00
Mike Frysinger b975febeea mark msh as deprecated 2009-03-29 00:52:41 +00:00
Mike Frysinger 40b8dc410e use bb_strtou() in umask/wait and check errno to see if there was a problem rather than using endp 2009-03-29 00:50:30 +00:00
Mike Frysinger 8ec1c9dc6e make sure we check job status whenever updating the prompt 2009-03-29 00:45:26 +00:00
Mike Frysinger 0b87e4ad15 test for invalid named variables 2009-03-28 21:06:38 +00:00
Mike Frysinger 7c3e52c1bd do not let handle_dollar() accept vars that start with a digit 2009-03-28 21:06:22 +00:00
Mike Frysinger 56bdea1b43 implement wait builtin 2009-03-28 20:01:58 +00:00
Denis Vlasenko e61f07f036 remove ((expr)) bash'ism 2009-03-28 19:31:34 +00:00
Denis Vlasenko 701ac1864b randomconfig fix 2009-03-28 19:22:08 +00:00
Mike Frysinger 5a82845f60 update the normally disabled debug code around the syntax() func to use new maybe_die() 2009-03-28 19:09:04 +00:00
Denis Vlasenko a2333c8938 randomtest fixes 2009-03-28 19:08:23 +00:00
Mike Frysinger 78f9d8eb7a add hush tests for parameter expansion 2009-03-28 18:55:34 +00:00
Mike Frysinger 6379bb4fde implement most POSIX parameter expansions (~+500bytes) 2009-03-28 18:55:03 +00:00
Mike Frysinger 42ab86520e make sure we exit based on test failure rather than always exiting with 0 2009-03-28 15:43:47 +00:00
Mike Frysinger 25a6ca0dd4 split up feature todo by posix/bash 2009-03-28 13:59:26 +00:00
Mike Frysinger ad88d5a4cf unify set handling with command line processing, fixup set argv processing so it doesnt clobber argv when setting options, and barf on unhandled set options 2009-03-28 13:44:51 +00:00
Mike Frysinger 19a7ea126a handle the "-s" command line option that POSIX requires 2009-03-28 13:02:11 +00:00
Mike Frysinger a71cfa8aa1 rename "-f" (fake) option to "-n" to match POSIX 2009-03-28 12:57:54 +00:00
Mike Frysinger d006edb2ca tweak format modifier in debug code to fixup gcc warning 2009-03-28 12:43:53 +00:00
Mike Frysinger ec2c655702 convert some of the ENABLE_FEATURE_EDITING from CPP if to C if 2009-03-28 12:24:44 +00:00
Mike Frysinger 39456a18a1 stop lying about [[ test support 2009-03-28 12:21:57 +00:00
Denis Vlasenko 781b672b37 mkfs.vfat: fix a problem with over-estimating FAT size 2009-03-28 12:17:20 +00:00
Mike Frysinger 70a2c8d531 make lash deprecation more prominent 2009-03-28 12:12:58 +00:00
Denis Vlasenko f54dd09171 mkfs.vfat: mkdosfs compat with choosing clyster size 2009-03-28 03:22:08 +00:00
Denis Vlasenko 14ee4e65f1 mkfs.vfat: more of pointless tweaking 2009-03-28 02:28:58 +00:00
Denis Vlasenko 020f465cbd mkfs.vfat: small tweak to comments 2009-03-28 02:18:49 +00:00
Denis Vlasenko 9d04b6b630 mkdosfs (aka mkfs.vfat): new applet by Vladimir
text    data     bss     dec     hex filename
 821202     476    7616  829294   ca76e busybox_old
 823577     476    7616  831669   cb0b5 busybox_unstripped
2009-03-28 02:13:01 +00:00
Denis Vlasenko 4d3a812b71 ls: warning fix
rm: accept and ignore -v (verbose)
2009-03-27 17:22:00 +00:00
Denis Vlasenko 3603cd2808 tail: fix tail +N syntax not working. Closes bug 221. 2009-03-27 02:36:02 +00:00
Mike Frysinger bfc0fae952 enable most job functions on no-mmu systems 2009-03-26 18:14:16 +00:00
Denis Vlasenko f9beb61a81 tftp: when we infer local name from remote (-r [/]path/path/file),
strip path. This mimics wget and is generally more intuitive.
2009-03-25 03:55:53 +00:00
Mike Frysinger b2705e1652 do not make startup banner depend on job support 2009-03-23 08:44:02 +00:00
Denis Vlasenko c0ea82a457 libbb: revent previous version of "concurrent history updating"
and replace it with one which does not "snoop" history written
by others. (1) it is what bug 185 needs, and (2) it is less bloaty:

function                                             old     new   delta
load_history                                           -     252    +252
read_line_input                                     3155    3287    +132
next_token                                           914     918      +4
qrealloc                                              36      33      -3
getoptscmd                                           713     708      -5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/2 up/down: 388/-8)            Total: 380 bytes
2009-03-23 06:33:37 +00:00
Mike Frysinger ddbee974b4 move parse_stream out of ENABLE_HUSH_TICK to avoid implicit decl/build error 2009-03-22 22:48:41 +00:00
Denis Vlasenko 57abf9e947 libbb: make history saving/loading concurrent-safe
* all history writers always append (not overwrite) history files
* they reload history if they detect that file length has changed since last
write
* they trim history file only when it grows 4 times longer than MAXLINES
* they do this atomically by creating new file and renaming it to old

Unfortunately, this comes at a price:

function                                             old     new   delta
load_history                                           -     346    +346
read_line_input                                     3155    3358    +203
new_line_input_t                                      17      31     +14
...irrelevant small jitter...
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/5 up/down: 573/-13)           Total: 560 bytes
2009-03-22 19:00:05 +00:00
Denis Vlasenko 3fd1046300 timeout: fix parsing of -t NUM on MMU 2009-03-22 14:49:00 +00:00
Denis Vlasenko 424f79b48f hush: rearrange functions to reduce amount of forward references.
Minimal code changes.
2009-03-22 14:23:34 +00:00
Denis Vlasenko e1300f6fc7 hush: fix segv at repeated "set -- a b c" + "shift" 2009-03-22 11:41:18 +00:00
Denis Vlasenko 786ce17d6d hush: fix strcpy of potentially overlapping strings 2009-03-21 21:51:11 +00:00
Denis Vlasenko ccff0b962c msh testsuite: fix false positive, tweak run stript 2009-03-21 19:58:58 +00:00
Denis Vlasenko 3a014b85dc ls: make readlink error to not disrupt output (try ls -l /proc/self/fd).
libbb: make xmalloc_readlink_or_warn warning more specific.

function                                             old     new   delta
xmalloc_readlink_or_warn                              33      61     +28
showfiles                                           1495    1460     -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 28/-35)             Total: -7 bytes
2009-03-21 19:11:23 +00:00
Denis Vlasenko 05af832097 cpio: more compat: -0 and -L options
function                                             old     new   delta
cpio_main                                           1417    1473     +56
2009-03-20 23:01:48 +00:00
Denis Vlasenko 83518d18a3 Compatibility fixes:
grep: support -z
find: support --mindepth
  together +45 bytes
cpio: support -p (configurable, +230 bytes)
libbb: tweaks for cpio
2009-03-20 22:17:13 +00:00
Denis Vlasenko 0b28103cc7 cd: "support" -v by ignoring it 2009-03-20 14:04:00 +00:00
Denis Vlasenko feecc7b74e hush: tweak testsuite 2009-03-20 12:12:33 +00:00
Denis Vlasenko a8b6dff97f hush: fix bug 207 and "hush -c" parameter passing.
Now hush -c 'printf "%s\n" "$@"' (prints "\n")
 and hush -c 'printf "%s\n" "$@"' qwe asd (prints "asd\n")
 both work correctly
2009-03-20 12:05:14 +00:00
Denis Vlasenko 5368ad53e9 ash: expand comment 2009-03-20 10:20:08 +00:00
Denis Vlasenko 11fb7cf5af hush: fix set [--] params. Closes bug 199.
function                                             old     new   delta
builtin_set                                           55     194    +139
add_strings_to_strings                                 -     130    +130
add_string_to_strings                                110      26     -84
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 269/-84)           Total: 185 bytes
2009-03-20 10:13:08 +00:00
Denis Vlasenko 1bb3d7e450 ash: add missing comma in debug scaffolding 2009-03-20 07:45:36 +00:00
Denis Vlasenko b9e70ddf2d ash: fix a case where we close wrong descriptor; add debug hack for that 2009-03-20 01:24:08 +00:00
Denis Vlasenko f173395c4a ash: DEBUG should be 0 :) 2009-03-19 23:21:55 +00:00
Denis Vlasenko b21f379639 ash: fix TRACE commands 2009-03-19 23:09:58 +00:00
Denis Vlasenko 653d8e79b2 ash: make evaltree save/restore int suppression depth.
Hopefully this fixes bug 189. Not confirmed by users yet.

function                                             old     new   delta
evaltree                                             809     842     +33
evalvar                                             1374    1376      +2
2009-03-19 21:59:35 +00:00
Denis Vlasenko 731de5ce76 doc update 2009-03-19 13:42:05 +00:00
Denis Vlasenko 4b875708c1 ash: in dotrap(), do not clear gotsig[] for SIGINT if there is no handler
for it, otherwise raise interrupt gets confused later.
 The rest are readability fixes.

function                                             old     new   delta                                                                                                       
evaltreenr                                           817     818      +1                                                                                                       
evaltree                                             817     818      +1                                                                                                       
evalstring                                            88      89      +1                                                                                                       
cmdloop                                              420     419      -1                                                                                                       
evalskip                                               4       1      -3                                                                                                       
breakcmd                                              84      81      -3                                                                                                       
ash_main                                            1382    1379      -3                                                                                                       
evalloop                                             183     177      -6                                                                                                       
evalfor                                              231     225      -6                                                                                                       
------------------------------------------------------------------------------                                                                                                 
(add/remove: 0/0 grow/shrink: 3/6 up/down: 3/-22)             Total: -19 bytes
2009-03-19 13:30:04 +00:00
Denis Vlasenko 0354aba9a1 df: fix FEATURE_DF_FANCY=off, FEATURE_HUMAN_READABLE=on case. 2009-03-19 03:56:20 +00:00
Denis Vlasenko 7f88e34e1a ash: tentatively fix bug 189. 2009-03-19 03:36:18 +00:00
Denis Vlasenko 5981ba5843 init: test for vt terminal with VT_OPENQRY,
assume that anything else is TERM=vt102, not TERM=linux.
 (Serial console test is less correct)
 Tentatively closes bug 195.

function                                             old     new   delta
init_main                                            946     919     -27
2009-03-19 02:35:44 +00:00
Denis Vlasenko 5c2b81470d ash: fix "ash -c 'exec 1>&0'" complaining that fd 0 is busy 2009-03-19 01:59:59 +00:00
Denis Vlasenko c1969f69b1 ls: make color-related code more readable. Fix a case when
it was working non-deterministically.

function                                             old     new   delta
bold                                                   -      34     +34
showfiles                                           1508    1495     -13
fgcolor                                               50      34     -16
bgcolor                                               34       -     -34
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 34/-63)            Total: -29 bytes
2009-03-18 22:39:34 +00:00
Denis Vlasenko cbb4e61dd5 httpd: add comment explaining why SERVER_NAME etc is not set. 2009-03-18 20:00:46 +00:00
Denis Vlasenko 9f57cf6604 ftpd: fix command fetching to not do it in 1-byte reads;
fix command de-escaping. Tested to download files with embeeded \xff and LF.
libbb: tweaks for the above

function                                             old     new   delta
ftpd_main                                           2231    2321     +90
xmalloc_fgets_internal                               190     222     +32
xmalloc_fgets_str_len                                  -      27     +27
xmalloc_fgets_str                                      7      23     +16
xmalloc_fgetline_str                                  10      26     +16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 181/0)             Total: 181 bytes
2009-03-18 17:32:44 +00:00
Denis Vlasenko fce4a9454c ftpd: add some comments 2009-03-18 16:02:54 +00:00
Denis Vlasenko e3b840ce98 ftpd: trim messages (but make sure they still make sense)
text    data     bss     dec     hex filename                                                                                                                               
   4400       0       0    4400    1130 ftpd_old.o
   4346       0       0    4346    10fa ftpd.o
2009-03-18 14:25:28 +00:00
Denis Vlasenko 5b492ee876 ftpd: do not use nasty tricks for re-execing if we are on MMU machine.
On NOMMU, code is alomost the same, on MMU:

function                                             old     new   delta
handle_dir_common                                    223     390    +167
ftpd_main                                           2306    2231     -75
popen_ls                                             203       -    -203
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 167/-278)         Total: -111 bytes
2009-03-18 14:12:22 +00:00
Denis Vlasenko 1432cb4bd9 ftpd: add support for MDTM, I see clients often use it,
it may allow client-side caching.

function                                             old     new   delta
ftpd_main                                           2232    2306     +74
gmtime_r                                               -      19     +19
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 93/0)               Total: 93 bytes
2009-03-18 00:45:00 +00:00
Denis Vlasenko 3a7a1eba2e ftpd: document NLST format 2009-03-17 13:03:06 +00:00
Denis Vlasenko 1a82555108 ftpd: instead of wordy HELP, implement useful, and smaller, FEAT.
(HELP is still "supported" as an alias to FEAT)

   text    data     bss     dec     hex filename
 807331     468    7856  815655   c7227 busybox_old
 807246     468    7856  815570   c71d2 busybox_unstripped
2009-03-17 12:40:34 +00:00
Denis Vlasenko edb0de4283 ftpd: implement -vv verbosity
function                                             old     new   delta
ftpd_main                                           2097    2190     +93
verbose_log                                            -      33     +33
cmdio_write_raw                                       12      34     +22
cmdio_write_ok                                        25      45     +20
cmdio_write_error                                     25      45     +20
cmdio_write                                           62      78     +16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/0 up/down: 204/0)             Total: 204 bytes
2009-03-17 12:23:24 +00:00
Denis Vlasenko e6c94a611a ftpd: tweak timeout code 2009-03-17 05:11:51 +00:00
Denis Vlasenko 99d71da1cf chat: update by Vladimir
1) to treat timeout more correctly (timeout affects whole send command
    duration, not a single char); 
 2) to recognize RECORD directive.

function                                             old     new   delta
chat_main                                           1246    1359    +113
exitcode                                               1       -      -1
2009-03-16 23:06:23 +00:00
Denis Vlasenko 074c9036b2 ftpd: fix thinko: set_nport takes port in network order 2009-03-16 21:01:41 +00:00
Denis Vlasenko fbf5846ce1 ftpd: dont use fdprintf for simple status messages
function                                             old     new   delta
ftpd_main                                           2025    2055     +30
cmdio_write_ok                                        17      25      +8
cmdio_write_error                                     17      25      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 46/0)               Total: 46 bytes
2009-03-16 20:54:45 +00:00
Denis Vlasenko 43bb7bba3b ftpd: simplify PORT check by assuming IP = peer's IP.
Should be as safe as before this change.

function                                             old     new   delta
ftpd_main                                           2115    2025     -90
2009-03-16 19:54:06 +00:00
Denis Vlasenko 20c8216897 ftpd: add idle and absolute timeouts. This is a security issue,
otherwise ftpd may end up hanging indefinitely.

function                                             old     new   delta
timeout_handler                                        -     110    +110
ftpd_main                                           2019    2115     +96
packed_usage                                       25662   25685     +23
handle_upload_common                                 306     322     +16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 245/0)             Total: 245 bytes
2009-03-16 16:19:53 +00:00
Denis Vlasenko f2160b6a09 ftpd: security tightened up:
PORT is not allowed on !IPv4
 PORT must have IP == peer's IP
 upload is allowed only into regular files

function                                             old     new   delta
ftpd_main                                           1815    2019    +204
handle_upload_common                                 260     306     +46
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 250/0)             Total: 250 bytes
2009-03-16 14:53:54 +00:00
Denis Vlasenko 7a6766428e awk: fix compat issue found by gpm build
function                                             old     new   delta
as_regex                                             105     131     +26
hash_find                                            247     233     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 26/-14)             Total: 12 bytes
2009-03-15 22:20:31 +00:00
Denis Vlasenko 9210a36495 tr: support -C as synonym to -c 2009-03-15 16:41:55 +00:00
Denis Vlasenko fc58ba1298 ftpd: fix the bug where >2GB file ops report errors;
make a few simplifications; add TODOs.

function                                             old     new   delta
port_or_pasv_was_seen                                  -      37     +37
get_remote_transfer_fd                               104     109      +5
handle_upload_common                                 265     260      -5
handle_dir_common                                    228     223      -5
popen_ls                                             211     203      -8
ftpd_main                                           1825    1815     -10
data_transfer_checks_ok                               37       -     -37
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/4 up/down: 42/-65)            Total: -23 bytes
2009-03-15 15:54:58 +00:00
Denis Vlasenko 823f10b8f0 sha: merge K[] for sha256 and 512
function                                             old     new   delta
sha_K                                                  -     640    +640
sha256_process_block64                               440     425     -15
sha512_process_block128                             1336    1283     -53
K512_lo                                              320       -    -320
K256                                                 320       -    -320
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 0/2 up/down: 640/-708)          Total: -68 bytes
2009-03-15 04:56:51 +00:00
Denis Vlasenko 8ec8d5e3db sha: fix thinko in sha512; add FAST_FUNC to sha1/sha256
function                                             old     new   delta
sha512_process_block128                             1334    1336      +2
sha1_hash                                            112     111      -1
sha256_process_block64                               446     440      -6
sha1_process_block64                                 494     484     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 2/-17)             Total: -15 bytes
2009-03-15 02:56:00 +00:00
Denis Vlasenko e9afc468fa sha: merge sha1/sha256 handling (they are similar enough for this),
shrink sha215 code

function                                             old     new   delta
sha1_end                                             129     142     +13
sha1_process_block64                                 486     494      +8
sha256_begin                                          37      44      +7
sha1_begin                                            49      56      +7
sha1_hash                                            108     112      +4
...
sha512_end                                           204     184     -20
sha512_process_block128                             1405    1334     -71
sha256_process_block64                               520     446     -74
sha256_end                                           147       -    -147
sha512_hash                                          297     130    -167
sha256_hash                                          260       -    -260
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 11/9 up/down: 59/-752)         Total: -693 bytes
2009-03-15 02:28:05 +00:00
Denis Vlasenko 7241e6d377 uname: correct cut/paste error
touch: add long options

function                                             old     new   delta
static.longopts                                      137     162     +25
touch_main                                           221     231     +10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 35/0)               Total: 35 bytes
2009-03-15 01:28:30 +00:00
Denis Vlasenko 7aaedcf21e mount: support "-O option"; stop trying to mount swap partitions
function                                             old     new   delta
mount_main                                           975    1152    +177
umount_main                                          640     636      -4
packed_usage                                       25666   25662      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 177/-8)            Total: 169 bytes
2009-03-14 22:57:20 +00:00
Denis Vlasenko 447ab18cf6 uname: support long options 2009-03-14 18:41:19 +00:00
Denis Vlasenko 3b5c9b8885 insmod/modprobe: do not pass NULL to kernel as module parameter 2009-03-13 23:43:26 +00:00
Denis Vlasenko 1f0b95f147 tar: make FEATURE_TAR_AUTODETECT work with DESKTOP off too. 2009-03-13 14:26:44 +00:00
Denis Vlasenko c8329c9568 sha: reduce sha256/512 context size. Make sha1/sha256 code more similar
function                                             old     new   delta
sha512_end                                           182     204     +22
sha256_end                                           137     147     +10
sha1_hash                                            113     108      -5
sha1_end                                             143     129     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 32/-19)             Total: 13 bytes
2009-03-12 19:06:18 +00:00
Denis Vlasenko 4a43057268 sha: tiny shrink 2009-03-12 17:50:50 +00:00
Denis Vlasenko ddb1b85053 add comment about sha testing 2009-03-12 16:05:02 +00:00
Denis Vlasenko cd2cd312b7 shrink sha hashing a bit more (remove wbuflen field from ctx),
remove the requirement for aligned buffer

function                                             old     new   delta
sha512_hash                                          262     297     +35
sha1_end                                             136     143      +7
passwd_main                                         1019    1023      +4
sha256_end                                           135     137      +2
count_lines                                           72      74      +2
sha256_hash                                          259     260      +1
popstring                                            164     158      -6
sha512_begin                                          88      81      -7
sha256_begin                                          44      37      -7
parse_expr                                           832     824      -8
bbunpack                                             446     438      -8
sha256_process_block64                               529     520      -9
md5_end                                              166     151     -15
evaltreenr                                           817     802     -15
evaltree                                             817     802     -15
sha512_end                                           204     182     -22
sha512_process_block128                             1444    1405     -39
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/11 up/down: 51/-151)         Total: -100 bytes
2009-03-12 15:40:27 +00:00
Denis Vlasenko 6a5d9faa29 shrink sha hashing
function                                             old     new   delta
sha512_hash                                          262     281     +19
sha512_end                                           204     221     +17
sha1_hash                                            128     113     -15
static.mask                                           16       -     -16
static.bits                                           16       -     -16
sha1_end                                             160     136     -24
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/2 up/down: 36/-71)            Total: -35 bytes
2009-03-12 15:39:11 +00:00
Denis Vlasenko 4abaec50a2 popmaildir: fix several grave bugs with using memory past end of malloc block 2009-03-12 15:35:26 +00:00
Mike Frysinger dec37b3232 the -elf2flt flag can be used w/out -Wl, so drop the requirement so people can use either form 2009-03-12 07:56:49 +00:00
Denis Vlasenko 98c87f7575 sha256/512: code shrink. Run-tested.
function                                             old     new   delta
sha512_process_block128                                -    1444   +1444
sha1_process_block64                                   -     542    +542
sha256_process_block64                                 -     529    +529
K512_lo                                                -     320    +320
K256                                                   -     320    +320
init512_lo                                             -      32     +32
init256                                                -      32     +32
sha1_hash                                             99     128     +29
sha256_end                                           160     135     -25
sha1_end                                             189     160     -29
sha512_end                                           237     204     -33
sha256_begin                                          77      44     -33
sha512_begin                                         154      88     -66
sha256_hash                                          338     259     -79
sha512_hash                                          358     262     -96
sha1_compile                                         542       -    -542
sha256_process_block                                 594       -    -594
static.K                                             896       -    -896
sha512_process_block                                1861       -   -1861
------------------------------------------------------------------------------
(add/remove: 7/4 grow/shrink: 1/7 up/down: 3248/-4254)      Total: -1006 bytes
   text    data     bss     dec     hex filename
 808013     468    7856  816337   c74d1 busybox_old
 807007     468    7856  815331   c70e3 busybox_unstripped
2009-03-11 21:15:51 +00:00
Denis Vlasenko 54ac03a618 *: remove LOG_NOWAIT 2009-03-11 15:59:49 +00:00
Denis Vlasenko 4221e90ae4 ftpd: stop unconditional logging to syslog. This was the only applet
which was doing it. Added option -S to enable it when desired.

function                                             old     new   delta
packed_usage                                       25647   25666     +19
ftpd_main                                           1826    1825      -1
2009-03-11 15:07:44 +00:00
Denis Vlasenko a19e64933c docs/logging_and_backgrounding.txt: new mini-doc
dnsd: remove statics, remove nerly-useless SIGINT handler
crond: correct more of logfile to 0666 (as usual, umask allows
 user to remove unwanted bits).
nameif: print errors to stderr too, not just to syslog

function                                             old     new   delta
udhcp_read_interface                                 308     306      -2
ttl                                                    4       -      -4
fileconf                                               4       -      -4
dnsentry                                               4       -      -4
interrupt                                             19       -     -19
dnsd_main                                           1463    1394     -69
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 0/2 up/down: 0/-102)           Total: -102 bytes
   text    data     bss     dec     hex filename
 808161     476    7864  816501   c7575 busybox_old
 807994     468    7856  816318   c74be busybox_unstripped
2009-03-11 14:40:00 +00:00
Denis Vlasenko 4774179cb9 mail.c: more robust handling of SIGCHLD
init: more robust signal handling
2009-03-10 16:01:57 +00:00
Denis Vlasenko 245f91b649 ftpd + ls - timestamp = confused Mozilla. Prevent that. 2009-03-09 22:37:23 +00:00
Denis Vlasenko 5b28d314e7 ftpd: add LOG_NDELAY to openlog 2009-03-09 17:22:16 +00:00
Denis Vlasenko 1a6adbd71b uniq: strncmp(a,b, -1) might be problematic, use INT_MAX instead 2009-03-09 16:43:28 +00:00
Denis Vlasenko 9257671c76 fix typo in help text 2009-03-09 16:25:33 +00:00
Denis Vlasenko c41cba5a57 ftpd: reuse ls applet for LIST/NLST/STAT generation
function                                             old     new   delta
popen_ls                                               -     211    +211
ftpd_main                                           1760    1826     +66
handle_dir_common                                    199     228     +29
get_remote_transfer_fd                                89     104     +15
replace_char                                          30      34      +4
handle_upload_common                                 263     265      +2
bind_for_passive_mode                                129     121      -8
cmdio_write                                           84      62     -22
escape_text                                          166     136     -30
init_data_sock_params                                 81       -     -81
ftpdataio_dispose_transfer_fd                         87       -     -87
write_dirstats                                       149       -    -149
write_filestats                                      603       -    -603
------------------------------------------------------------------------------
(add/remove: 1/4 grow/shrink: 11/5 up/down: 384/-986)        Total: -602 bytes
   text    data     bss     dec     hex filename
 808804     476    7864  817144   c77f8 busybox_old
 808156     476    7864  816496   c7570 busybox_unstripped
2009-03-09 15:46:07 +00:00
Denis Vlasenko 9b2fbda538 ftpd: EPSV and SIZE support. Tested to work on IPv6 too.
libbb: str2sockaddr shuld accept [IPv6] addr without port -
 wget 'ftp://[::1]/file' needs that to work.

function                                             old     new   delta
bind_for_passive_mode                                  -     129    +129
get_nport                                              -      30     +30
ftpd_main                                           1731    1760     +29
str2sockaddr                                         412     431     +19
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 207/0)             Total: 207 bytes
   text    data     bss     dec     hex filename
 808568     476    7864  816908   c770c busybox_old
 808804     476    7864  817144   c77f8 busybox_unstripped
2009-03-09 13:01:08 +00:00
Denis Vlasenko 57a3b17498 ftp: reduce amount of realloc's done in cmdio_write
text    data     bss     dec     hex filename
 808562     476    7864  816902   c7706 busybox_old
 808568     476    7864  816908   c770c busybox_unstripped
2009-03-09 04:38:37 +00:00
Denis Vlasenko d42eb81206 ftpd: code shrink 2009-03-09 04:22:52 +00:00
Denis Vlasenko 3455285339 ftpd: code shrink 2009-03-09 04:18:00 +00:00
Denis Vlasenko f1a11b5a4e ftp: code shrink
text    data     bss     dec     hex filename
 809078     476    7864  817418   c790a busybox_old
 808590     476    7864  816930   c7722 busybox_unstripped
2009-03-09 04:13:59 +00:00
Denis Vlasenko 9e95920efd ftpd: code shuffled a bit, added comments 2009-03-09 03:15:05 +00:00
Denis Vlasenko 51c9bb1fd1 ftpd: add comment 2009-03-09 02:51:46 +00:00
Denis Vlasenko ffb4bb3034 ftpd: further code shrink
function                                             old     new   delta      
port_pasv_cleanup                                      -      50     +50      
replace_char                                           -      30     +30      
ftp_write_str_common                                 102     104      +2
handle_dir_common                                    209     204      -5
ftpd_main                                           1990    1970     -20
port_cleanup                                          23       -     -23
pasv_cleanup                                          28       -     -28
handle_upload_common                                 320     273     -47
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/3 up/down: 82/-123)           Total: -41 bytes
2009-03-09 02:23:45 +00:00
Denis Vlasenko 73c571a5ff *: move get_sock_lsa and xwrite_str to libbb, use where appropriate
function                                             old     new   delta
get_sock_lsa                                           -      72     +72
buffer_fill_and_print                                179     196     +17
parse_expr                                           824     832      +8
read_base64                                          343     348      +5
nameval                                              202     206      +4
fbset_main                                          1694    1698      +4
expand                                              1849    1853      +4
udhcp_send_kernel_packet                             249     252      +3
udhcp_get_option                                     223     222      -1
chat_main                                           1246    1245      -1
pack_gzip                                           1661    1659      -2
doset                                                299     297      -2
bb__parsespent                                       119     117      -2
test_main                                            260     257      -3
qgravechar                                           109     106      -3
tcpudpsvd_main                                      1834    1830      -4
sysctl_display_all                                   589     580      -9
xopen_xwrite_close                                    44      33     -11
prs                                                   30      18     -12
find_main                                            418     406     -12
full_write2_str                                       25      12     -13
adduser_main                                         667     654     -13
evaltreenr                                           817     802     -15
evaltree                                             817     802     -15
tftpd_main                                           526     493     -33
ftpd_main                                           2050    1990     -60
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 7/18 up/down: 117/-211)         Total: -94 bytes
2009-03-09 00:12:37 +00:00
Denis Vlasenko 5e4fda0aff ftpd: code chrink, fixed some minor bugs
ls: update comment
*: openlog fixes (added LOG_PID, set LOG_DAEMON as appropriate)

function                                             old     new   delta
xwrite_str                                             -      26     +26
cmdio_write_ok                                         -      15     +15
handle_cwd                                            40      45      +5
packed_usage                                       25668   25670      +2
cmdio_write_raw                                        7       9      +2
handle_upload_common                                 322     320      -2
udhcpd_main                                         1375    1372      -3
udhcpc_main                                         2362    2359      -3
port_cleanup                                          27      23      -4
handle_dir_common                                    221     209     -12
str_netfd_write                                       26       -     -26
cmdio_get_cmd_and_arg                                122       -    -122
ftpd_main                                           2208    2050    -158
------------------------------------------------------------------------------
   text    data     bss     dec     hex filename
 809933     476    7864  818273   c7c61 busybox_old
 809199     476    7864  817539   c7983 busybox_unstripped
2009-03-08 23:46:48 +00:00
Denis Vlasenko bf9d17949e adding forgotten new file 2009-03-08 09:31:28 +00:00
Denis Vlasenko 16b4a2de97 ftpd: new applet by Adam Tkac
$ size ftpd.o
   text    data     bss     dec     hex filename
   5703       0       0    5703    1647 ftpd.o
2009-03-08 09:30:56 +00:00
Denis Vlasenko c8985bf353 website: mention fixes to syslogd 2009-03-08 01:06:18 +00:00
Denis Vlasenko 01034172f5 website: announce 1.13.3 2009-03-08 01:00:16 +00:00
Denis Vlasenko fb1a23d73b halt/reboot/poweroff: improve error reporting
function                                             old     new   delta
halt_main                                            207     185     -22
2009-03-07 01:54:24 +00:00
Denis Vlasenko a6b6f05379 further work on modprobe
function                                             old     new   delta
gather_options_str                                     -      75     +75
config_file_action                                   388     413     +25
load_modules_dep                                     175     192     +17
add_probe                                             67      72      +5
modprobe_main                                        494     488      -6
gather_options                                        89       -     -89
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 3/1 up/down: 122/-95)            Total: 27 bytes
2009-03-06 22:48:11 +00:00
Bernhard Reutner-Fischer 8517d6fc1f - test commit 2009-03-05 17:27:39 +00:00
Denis Vlasenko 0e2f362a61 modprobe: rework/speedup by Timo Teras (timo.teras AT iki.fi)
function                                             old     new   delta
load_modules_dep                                       -     175    +175
helper_get_module                                      -     106    +106
gather_options                                         -      89     +89
add_probe                                              -      67     +67
config_file_action                                   345     388     +43
get_or_add_modentry                                    -      10     +10
loaded                                                 4       -      -4
read_config                                          239     234      -5
llist_find                                            34       -     -34
add_option                                            60       -     -60
modprobe_main                                        567     494     -73
do_modprobe                                          601     273    -328
------------------------------------------------------------------------------
(add/remove: 5/3 grow/shrink: 1/3 up/down: 490/-504)          Total: -14 bytes
   text    data     bss     dec     hex filename
 816778     476    7888  825142   c9736 busybox_old
 816768     476    7880  825124   c9724 busybox_unstripped
2009-03-05 16:32:27 +00:00
Denis Vlasenko c5741003e9 modutils: delete unused global variable
function                                             old     new   delta
modprobe_main                                        570     567      -3
insmod_main                                          101      98      -3
insmod_outputname                                      4       -      -4
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-10)             Total: -10 bytes
   text    data     bss     dec     hex filename
 816784     476    7892  825152   c9740 busybox_old
 816778     476    7888  825142   c9736 busybox_unstripped
2009-03-05 09:26:17 +00:00
Denis Vlasenko 76140a77c9 networking/libiproute/*: code shrink by optimizing numeric conversions
and other misc stuff

function                                             old     new   delta
print_tunnel                                         660     656      -4
format_host                                            5       -      -5
get_unsigned                                          70      54     -16
get_u32                                               70      54     -16
do_iplink                                           1173    1151     -22
get_prefix                                           417     393     -24
print_rule                                           800     771     -29
print_addrinfo                                      1374    1342     -32
print_route                                         1745    1709     -36
iprule_modify                                        905     866     -39
iproute_modify                                      1105    1048     -57
get_integer                                           70       -     -70
parse_args                                          1684    1440    -244
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/11 up/down: 0/-594)          Total: -594 bytes
   text    data     bss     dec     hex filename
 817378     476    7892  825746   c9992 busybox_old
 816784     476    7892  825152   c9740 busybox_unstripped
2009-03-05 09:21:57 +00:00
Denis Vlasenko 021de3f029 sendmail: document and fix usage of fd #4, fix check for helper failure.
function                                             old     new   delta
packed_usage                                       25663   25694     +31
signal_handler                                       191     215     +24
kill_helper                                           22      31      +9
launch_helper                                        194     184     -10
get_cred_or_die                                      142     129     -13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 64/-23)             Total: 41 bytes
2009-03-04 17:56:00 +00:00
Denis Vlasenko 5a2ad699fc wget: --post-data support by Harald Kuthe (harald-tuxbox AT arcor.de)
function                                             old     new   delta
wget_main                                           2467    2793    +326
static.wget_longopts                                 110     122     +12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 338/0)             Total: 338 bytes
2009-03-04 14:13:37 +00:00
Denis Vlasenko 9604e1b8fc modprobe: emit "can't open 'modules.dep': (errno)" instead of "module not found"
*: s/can't open %s/can't open '%s'/, it's better to use same string.

function                                             old     new   delta
do_modprobe                                          588     601     +13
config_file_action                                   339     345      +6
modprobe_main                                        565     570      +5
unable_to_open                                        14      16      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 26/0)               Total: 26 bytes
   text    data     bss     dec     hex filename
 816800     476    7892  825168   c9750 busybox_old
 816812     476    7892  825180   c975c busybox_unstripped
2009-03-03 18:47:56 +00:00
Denis Vlasenko 787a492f23 ip: in "ip rule add from all table 1", "all" is taken as 0.0.0.0/32,
whereas "any" and "default" would be 0.0.0.0/0. They must be all 0.0.0.0/0.
Closes bug 57.
2009-03-03 14:55:29 +00:00
Denis Vlasenko 230997bd61 expr: a bit more robust handling of regexps with groups (closes bug 87) 2009-03-03 14:27:36 +00:00
Denis Vlasenko 6852effbc2 printf: fix 1.12.0 breakage (from %*d fix). It was misinterpreting "*" 2009-03-03 14:14:44 +00:00
Denis Vlasenko 248ce91017 ls: implement -Q and -g (-g was accepted but ignored)
function                                             old     new   delta
print_name                                             -     198    +198
showfiles                                           1489    1508     +19
ls_options                                            30      31      +1
opt_flags                                            112     108      -4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/1 up/down: 218/-4)            Total: 214 bytes
2009-03-03 14:09:04 +00:00
Denis Vlasenko 11a6f9b44f ls: do not follow links with -s (closes bug 33),
display unsigned data with %XXu, not %XXd.
2009-03-03 13:20:22 +00:00
Denis Vlasenko 7886275c98 top: make it work again on 2.4 kernels (closes bug 125) 2009-03-03 11:55:31 +00:00
Denis Vlasenko 7e0c243ad5 sendmail: improve help text 2009-03-02 16:12:00 +00:00
Denis Vlasenko 50af926ecf wget: fix --header handling 2009-03-02 15:08:06 +00:00
Denis Vlasenko d9415d6335 syslogd: create logfile with 0666, not 0600. 2009-03-02 14:26:28 +00:00
Denis Vlasenko 37ad6b323d tr: update testsuite 2009-03-02 12:07:15 +00:00
Denis Vlasenko 491d6e3b56 tr: fix overflow in expand and complement, fix stop after [:class:],
fix order of [:xdigit:], make tr require one param at least.

function                                             old     new   delta
expand                                              1743    1849    +106
tr_main                                              463     518     +55
complement                                            72      75      +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 164/0)             Total: 164 bytes
2009-03-02 12:05:57 +00:00
Denis Vlasenko 1bfcc8b08e tr: support [:xdigit:], fix handling of ranges and [x]'s.
add testsuite entry for each of 3 bugs fixed.

function                                             old     new   delta      
static.classes                                        73      82      +9      
expand                                              1738    1743      +5      
complement                                            74      72      -2      
tr_main                                              472     463      -9      
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 14/-11)              Total: 3 bytes
2009-03-01 04:50:18 +00:00
Denis Vlasenko 31773b71e8 runsv: another tiny optimization
function                                             old     new   delta
startservice                                         297     288      -9
ctrl                                                 435     426      -9
2009-02-26 12:38:01 +00:00
Denis Vlasenko f09f4e015b runsv: small optimization
*: more paranoia around passing NULL to execl[e]

function                                             old     new   delta
custom                                               240     221     -19
2009-02-26 12:29:59 +00:00
Denis Vlasenko 48637e0924 modutils: oveflow fix 2009-02-26 12:00:52 +00:00
Denis Vlasenko 9aa5c652e9 unzip: fix thinko with le/be conv and size (closes bug 129)
awk: make "struct global" hack more robust wrt alignment (closes bug 131)
2009-02-26 11:21:04 +00:00
Denis Vlasenko 8e5de2aab7 login: fix buglet introduced by "simplification" 2009-02-24 17:10:24 +00:00
Denis Vlasenko e261bba6a5 flash_eraseall.c: fix vda's breakage 2009-02-24 16:47:03 +00:00
Bernhard Reutner-Fischer 30e3df3817 - rephrase helptext for clarity 2009-02-24 10:05:15 +00:00
Bernhard Reutner-Fischer 12aca796ba - improve wording 2009-02-24 10:03:22 +00:00
Bernhard Reutner-Fischer 0adf7f2d46 - by not calling getpagesize() twice we can save 2 bytes (walter harms) 2009-02-23 16:51:25 +00:00
Bernhard Reutner-Fischer f3b39a27a6 - fix typo (thanks to Peter Kjellerstedt for noticing) 2009-02-23 16:21:53 +00:00
Bernhard Reutner-Fischer a31187dbea - Dual-license the config parser also under "LGLPv2.1 or later"
(Vladimir Dronnikov)
2009-02-22 10:57:23 +00:00
Ned Ludd 039ed437d3 make modutils compile again 2009-02-20 04:56:00 +00:00
Denis Vlasenko a430b695a2 depmod: accept and ignore -r (Linux kernle build needs this) 2009-02-19 01:25:42 +00:00
Denis Vlasenko 962e3656f6 flash_eraseall: shrink
function                                             old     new   delta
flash_eraseall_main                                 1044    1006     -38
2009-02-19 01:17:12 +00:00
Bernhard Reutner-Fischer 02468c2063 - add big busybox logo as transparent png 2009-02-18 21:09:07 +00:00
Bernhard Reutner-Fischer 7307e06122 - bail out if screen resolution does not match PPM dimensions.
Previously a 640x480 PPM on an e.g. 720x400 console would just segfault when
  reading the lines. While this bug should perhaps be fixed to handle such cases
  properly we just exit gracefully until somebody is willing to take care of it
  properly.
2009-02-18 15:28:43 +00:00
Bernhard Reutner-Fischer 8dcb33c3eb - document ppm header and skip whitespace 2009-02-18 15:13:05 +00:00
Bernhard Reutner-Fischer e455f6ec27 - update TODOs 2009-02-18 14:05:54 +00:00
Bernhard Reutner-Fischer 8af23f8fc3 - eliminate globals 2009-02-18 13:42:51 +00:00
Bernhard Reutner-Fischer 7d9d251543 - make it compile and shrink it a little bit (~-110 bytes)
text	   data	    bss	    dec	    hex	filename
   1533	      4	      0	   1537	    601	miscutils/flash_eraseall.o.old
   1415	      4	      0	   1419	    58b	miscutils/flash_eraseall.o
- add some FIXMEs
2009-02-18 13:26:29 +00:00
Bernhard Reutner-Fischer 0d22d1755c - add flash_eraseall
This is the result after converting mtd-utils' flash_eraseall to BB.
The functionality given by this patch almost the same except that this
one does not support long options.
I needed this tool a system which does not have a lot of flash for RFS
and merging this into BB as the only way out.

[bigeasy@]$ ./scripts/bloat-o-meter bb_wo_fl bb_w_fl
function                                             old     new   delta
flash_eraseall_main                                    -    1072   +1072
show_progress                                          -      62     +62
packed_usage                                       25156   25176     +20
applet_names                                        1958    1973     +15
applet_main                                         2352    2360      +8
target_endian                                          -       4      +4
applet_nameofs                                       588     590      +2
applet_install_loc                                   147     148      +1
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 5/0 up/down: 1184/0)           Total: 1184 bytes
[bigeasy@]$ size miscutils/flash_eraseall.o
   text    data     bss     dec     hex filename
   1586       4       0    1590     636 miscutils/flash_eraseall.o

Signed-off-by: Benedigt Spranger <b.spranger@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2009-02-18 13:23:46 +00:00
Bernhard Reutner-Fischer 051fdb9e7a - PPMs can have comments in the header.
Thanks to Denys for pointing that out. (~+7b)
2009-02-16 12:36:50 +00:00
Denis Vlasenko 8ad78e1ec7 ash: make dot command search current directory first, as bash does. 2009-02-15 12:40:30 +00:00
Denis Vlasenko c6ab085002 Make "shadowed" numeric config entries (ones which depend on
other options which are off) to have the value of 0, not "".
2009-02-15 12:01:14 +00:00
Denis Vlasenko 28ea4298e3 volume_id: abort early on read failures.
should help with probing missing fdd's
2009-02-15 05:51:19 +00:00
Denis Vlasenko 93b38208d1 init: fix compile breakage with '# CONFIG_FEATURE_KILL_REMOVED is not set'
runsvdir.c: fix typo in comment
2009-02-14 20:58:13 +00:00
Bernhard Reutner-Fischer 97b954decb - improve wording 2009-02-14 13:17:48 +00:00
Bernhard Reutner-Fischer 51d943d761 - improve helptext 2009-02-14 12:58:48 +00:00
Bernhard Reutner-Fischer 4efcec9378 - misc untested shrinkage:
$ ./scripts/bloat-o-meter _bb_un.oorig busybox_unstripped
function                                             old     new   delta
fbsplash_main                                        595     985    +390
fb_drawimage                                         493       -    -493
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 390/-493)         Total: -103 bytes

$ size miscutils/fbsplash.o*
   text           data     bss     dec     hex filename
   2019              0       0    2019     7e3 miscutils/fbsplash.o.oorig
   1857              0       0    1857     741 miscutils/fbsplash.o.new
2009-02-14 12:36:16 +00:00
Bernhard Reutner-Fischer 52b56b7585 - improve helptext of obsolete devfs stuff.. 2009-02-14 12:19:37 +00:00
Bernhard Reutner-Fischer bb5f8eddc4 - cosmetic typo in helptext 2009-02-14 12:13:13 +00:00
Denis Vlasenko 9f00e05781 killall and sestatus also need ARGVN scanning 2009-02-14 01:36:11 +00:00
Denis Vlasenko d63cd1bf1c mdev: if /sys/class/block exists, don't scan /sys/block 2009-02-13 00:02:54 +00:00
Denis Vlasenko a0ab943492 function old new delta
kill_main                                            706     884    +178
2009-02-07 22:30:39 +00:00
Denis Vlasenko 2ca84f6064 httpd: tiny optimization 2009-02-05 12:38:21 +00:00
Denis Vlasenko 1cbfd98ded httpd:
Kill config options by making them always on:

FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES

This makes httpd.c remotely readable - it had ~125 #ifdefs, now it has ~100.
The growth on a .config with all FEATURE_HTTPDs off is:

function                                             old     new   delta
send_file_and_exit                                     -     269    +269
parse_conf                                           683     763     +80
free_llist                                             -      32     +32
httpd_main                                           427     454     +27
sighup_handler                                         -      15     +15
handle_incoming_and_exit                            1110     905    -205
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/1 up/down: 423/-205)          Total: 218 bytes
2009-02-04 23:43:44 +00:00
Denis Vlasenko 6d5590f9d0 sendmail: remove erroneous usage lines 2009-02-04 00:01:07 +00:00
Denis Vlasenko ded5dfef6e crond,crontab: make cron directory location configurable 2009-02-03 23:59:41 +00:00
Denis Vlasenko d814c98692 telnetd: do not advertise TELNET_LFLOW, we do not support
it properly.
2009-02-02 23:43:57 +00:00
Denis Vlasenko 04158e0459 udhcpd: add code which rejects lease files with suspicious or old timestamp.
*: s/time(0)/time(NULL)/g
2009-02-02 10:48:06 +00:00
Denis Vlasenko 512c8ae053 login: small simplification by Walter Harms. -10 bytes 2009-02-02 00:15:57 +00:00
Denis Vlasenko 4eff8efa59 login: cleanup work by Walter Harms. No logic changes. 2009-02-02 00:15:00 +00:00
Denis Vlasenko 73121c3c8c dhcpd,dumpleases: write and use 64-bit current time in lease file.
without it, determination of remaining lease time is unreliable.
 Yes, it's costly in code size, but without it, dumpleases output
 is misleading!

function                                             old     new   delta
read_leases                                          143     282    +139
dumpleases_main                                      447     572    +125
write_leases                                         193     233     +40
hton64                                                29      58     +29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 333/0)             Total: 333 bytes
2009-02-01 00:40:45 +00:00
Denis Vlasenko 49325969e7 modutils-24: code shrink
function                                             old     new   delta
helper_create_alloced_section                          -     117    +117
print_load_map                                       474     450     -24
bb_init_module_24                                   4615    4545     -70
obj_create_alloced_section                           131      30    -101
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 117/-195)          Total: -78 bytes
2009-01-31 23:33:54 +00:00
Denis Vlasenko 4acdb46ff1 ionice: new applet, adapted from Linux kernel' example by Walter Harms
text    data     bss     dec     hex filename
1050316     924   10952 1062192  103530 busybox_old
1050758     924   10952 1062634  1036ea busybox_unstripped
2009-01-31 21:45:57 +00:00
Denis Vlasenko 802cab15e5 brctl: fix compilation on 2.4.x kernels 2009-01-31 20:08:21 +00:00
Denis Vlasenko 9ec0ecbfdd init: remove wait() loop on restart, it may be dangerous 2009-01-31 19:26:12 +00:00
Denis Vlasenko 4ae8a05b13 init: fix a bug where on reload order of entries might be wrong
function                                             old     new   delta
run_shutdown_and_kill_processes                        -      97     +97
pause_and_low_level_reboot                             -      48     +48
run_actions                                           81     107     +26
restart_handler                                       56      81     +25
new_init_action                                      137     150     +13
run                                                  576     579      +3
open_stdio_to_tty                                    110      98     -12
check_delayed_sigs                                   195     170     -25
waitfor                                              354     318     -36
low_level_reboot                                      53       -     -53
kill_all_processes                                   115       -    -115
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 4/3 up/down: 212/-241)          Total: -29 bytes
2009-01-31 18:55:54 +00:00
Denis Vlasenko e35af56790 modutils-24: use xasprintf and xzalloc where appropriate,
remove unreachanble code
build system: correct some dependencies in config system
init: convert one #if into if() - for Rob.

function                                             old     new   delta
obj_string_patch                                     136     129      -7
bb_init_module_24                                   4759    4615    -144
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-151)           Total: -151 bytes
2009-01-31 14:22:24 +00:00
Denis Vlasenko fc2a4fc2ba init: small correction in a comment 2009-01-31 01:07:05 +00:00
Denis Vlasenko 72c99af0b4 init: major improvement in documentation and signal handling.
Lots of nasty, but hard to trip, races are fixed.

   text    data     bss     dec     hex filename
1038828     924   10932 1050684  10083c busybox_old
1038787     924   10932 1050643  100813 busybox_unstripped
2009-01-31 01:03:45 +00:00
Denis Vlasenko cab28aa7de init: preparatory patch, no code changes 2009-01-31 01:02:07 +00:00
Denis Vlasenko 6c62246a35 init: reinstate proper handling of !ENABLE_FEATURE_USE_INITTAB 2009-01-29 02:01:04 +00:00
Denis Vlasenko b2b2c404b5 init: reduce ifdef forest (specially for Rob's happiness) 2009-01-28 23:56:31 +00:00
Bernhard Reutner-Fischer a7542dd619 - be gentle to syntax highlighting 2009-01-27 18:54:41 +00:00
Bernhard Reutner-Fischer dd76b79962 - update Michele address 2009-01-27 12:56:33 +00:00
Denis Vlasenko 41d5ebee17 awk: in BEGIN section $0 should be "", not "0". 2009-01-25 01:00:15 +00:00
Denis Vlasenko bdea2c06dc traceroute: allow -w NUM as small as 1 2009-01-24 21:23:41 +00:00
Denis Vlasenko 766c10c386 traceroute: rewrite. Do not emit raw IP packets, instead send UDP or ICMP
packets and rely on the kernel to form IP headers, select source IP
 and interface. Doing it in traceroute wasn't working too good,
 and was bloating it.

function                                             old     new   delta
freehostinfo                                          29       -     -29
setsin                                                30       -     -30
in_cksum                                              57       -     -57
gethostinfo                                          165       -    -165
ifaddrlist                                           364       -    -364
traceroute_main                                     3713    2951    -762
------------------------------------------------------------------------------
(add/remove: 0/5 grow/shrink: 0/1 up/down: 0/-1407)         Total: -1407 bytes
2009-01-24 20:14:24 +00:00
Denis Vlasenko fa65a3d78f traceroute: preparatory trivial cleanups
function                                             old     new   delta
traceroute_main                                     3932    3713    -219
2009-01-24 20:11:36 +00:00
Denis Vlasenko 39b681343b tunctl: new applet by Vladimir
function                                             old     new   delta
tunctl_main                                            -     371    +371
packed_usage                                       25669   25799    +130
applet_names                                        1981    1988      +7
applet_main                                         1192    1196      +4
applet_nameofs                                       596     598      +2
applet_install_loc                                   149     150      +1
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/0 up/down: 515/0)             Total: 515 bytes
2009-01-23 02:07:14 +00:00
Bernhard Reutner-Fischer f6107c7e88 - add CONFIG_EXTRA_CFLAGS (thanks to keesj)
This helps with remembering additional flags like e.g. cpu settings for
  people who did not configured their compiler to produce code for their cpu
  per default.
2009-01-22 13:27:14 +00:00
Denis Vlasenko 498436586e tar: stop changing net tarfile's mode, GNU tar doesn't do it 2009-01-20 02:52:57 +00:00
Denis Vlasenko 038eec7c8b uname: use wider integer for option bits 2009-01-19 16:38:30 +00:00
Denis Vlasenko 059138fd08 uname: add support for -i and -o, fix printing of unknown -p
value with -a option

function                                             old     new   delta
uname_main                                           166     185     +19
utsname_offset                                        12      16      +4
options                                              621     623      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 25/0)               Total: 25 bytes
2009-01-19 16:32:23 +00:00
Denis Vlasenko ec64a5775e dhcpc: suppress "warning: 'timestamp_before_wait' might be used uninitialized 2009-01-14 00:28:03 +00:00
Denis Vlasenko 1265df1f31 libbb: shrink linked list ops (by xmaks AT email.cz)
function                                             old     new   delta
llist_pop                                             33      29      -4
llist_unlink                                          47      28     -19
llist_add_to_end                                      50      31     -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-42)             Total: -42 bytes
2009-01-13 15:22:50 +00:00
Denis Vlasenko 35261159e6 depmod: fix -b option (by timo.teras AT iki.fi)
function                                             old     new   delta
xfreopen_write                                         -      35     +35
parse_module                                         346     353      +7
depmod_main                                          553     546      -7
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 42/-7)              Total: 35 bytes
2009-01-12 22:12:22 +00:00
Denis Vlasenko f478fde33c adduser: allow adding to group 0; don't _create_ /etc/shadow,
only append data if it exists.

function                                             old     new   delta
adduser_main                                         642     667     +25
2009-01-12 09:20:49 +00:00
Denis Vlasenko 319fe129a1 mdev: fix breakage caused by unified parser usage 2009-01-12 07:57:52 +00:00
Bernhard Reutner-Fischer f0dc2c1d5c - use https for bugzilla URLs 2009-01-10 11:36:38 +00:00
Bernhard Reutner-Fischer e44a4e316d - isascii() is obsolescent in SUSv4 and furthermore looks redundant in this spot 2009-01-09 14:49:11 +00:00
Mike Frysinger 870ccd7212 do not whine if /sys/block does not exist ... embedded systems dont need stinkin block devices 2009-01-08 17:19:01 +00:00
Denis Vlasenko 501b0e335f sysctl: fix another corner case with "dots and slashes" 2009-01-08 03:35:47 +00:00
Denis Vlasenko cb39a7ca6d printf: make integer format strings print long long-sized values.
function                                             old     new   delta
printf_main                                          668     834    +166
bb_strtoll                                             -      84     +84
print_direc                                          391     431     +40
conv_strtoull                                          -      19     +19
conv_strtoll                                           -      19     +19
conv_strtoul                                          16       -     -16
conv_strtol                                           16       -     -16
------------------------------------------------------------------------------
(add/remove: 4/2 grow/shrink: 2/0 up/down: 342/-32)           Total: 296 bytes
2009-01-04 02:58:58 +00:00
Denis Vlasenko 0416e3dde1 udhcpd: disable opton to have absolute lease times in lease file
(that does not work with dumpleases)
dumpleases: fix -a option.
networking/udhcp/*: code shrink, more compact static leases struture,
 better comments, etc

function                                             old     new   delta
find_free_or_expired_address                           -     147    +147
nobody_responds_to_arp                                 -      84     +84
read_opt                                             781     830     +49
dumpleases_main                                      435     447     +12
send_ACK                                             229     232      +3
read_staticlease                                      90      93      +3
addStaticLease                                        60      61      +1
getIpByMac                                            46      43      -3
reservedIp                                            31      20     -11
keywords                                             304     288     -16
send_offer                                           428     403     -25
write_leases                                         225     193     -32
read_leases                                          184     143     -41
read_yn                                               64       -     -64
find_address                                         191       -    -191
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 5/6 up/down: 299/-383)          Total: -84 bytes
2009-01-01 17:52:09 +00:00
Denis Vlasenko b2ec03813c website: announce 1.13.2 amd 1.12.4 2008-12-31 03:43:24 +00:00
Denis Vlasenko d8850f2d0d dc: fix the "base 2" patch omission of base not being set 2008-12-30 10:40:05 +00:00
Denis Vlasenko 76ddc2e3e4 libbb: add bb_unsetenv (taken from hush).
udhcpc: stop filtering environment passed to the script.
crond: fix uncovered potential bug (failing unsetenv)
mdev: fix uncovered potential bug (failing unsetenv)
tcp, udpsvd: fix uncovered potential bug (failing unsetenv)

function                                             old     new   delta
safe_setenv                                            -      58     +58
bb_unsetenv                                            -      55     +55
builtin_unset                                        139     138      -1
tcpudpsvd_main                                      1843    1830     -13
free_strings_and_unsetenv                             87      53     -34
udhcp_run_script                                    1186    1133     -53
safe_setenv4                                          62       -     -62
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/4 up/down: 113/-163)          Total: -50 bytes
2008-12-30 05:05:31 +00:00
Denis Vlasenko d6e8f9450c sysctl: fix gcc warning (false positive) 2008-12-29 01:03:17 +00:00
Denis Vlasenko e40e76f3cd unexpand: fix incorrect expansion, add test for it
function                                             old     new   delta
expand_main                                          676     656     -20
2008-12-26 14:56:03 +00:00
Denis Vlasenko 73ac056f50 s/an user/a user/ 2008-12-25 01:01:23 +00:00
Denis Vlasenko 54d10059c9 *: tweak error messages
sysctl: shrink; support recursing if name is a directory:
 "sysctl net.ipv4.conf". Patch by xmaks AT email.cz

   text    data     bss     dec     hex filename
 793659     504    7492  801655   c3b77 busybox_old
 793576     504    7492  801572   c3b24 busybox_unstripped
2008-12-24 03:11:43 +00:00
Denis Vlasenko 4e12b1a2a9 libbb: introduce and use xmalloc_ttyname (-32 in bss).
ash: small code shrink

   text    data     bss     dec     hex filename
 793669     504    7524  801697   c3ba1 busybox_old
 793659     504    7492  801655   c3b77 busybox_unstripped
2008-12-23 23:36:47 +00:00
Bernhard Reutner-Fischer b3523b9cd3 - we already have an impl for man 2008-12-22 17:09:12 +00:00
Bernhard Reutner-Fischer 54143af9ef Add fancy svn browser thingy (via Lance Albertson of OSL) 2008-12-18 00:44:58 +00:00
Bernhard Reutner-Fischer 9b143a9e39 Update links to new site locations (via Lance Albertson at OSL) 2008-12-18 00:43:31 +00:00
Denis Vlasenko 68819d1232 ash: fix CONFIG_ASH_OPTIMIZE_FOR_SIZE off + high-bit chars case
(do we even need CONFIG_ASH_OPTIMIZE_FOR_SIZE conditional?)
2008-12-15 11:26:36 +00:00
Denis Vlasenko 3139ea7f15 expand: fix incorrect expansion exactly on tab boundary; shrink the code
function                                             old     new   delta
expand_main                                          698     676     -22
xputchar                                              53       -     -53
2008-12-14 15:45:25 +00:00
Denis Vlasenko 005ff882ba watchdog: build fixes, no code changes 2008-12-14 14:49:06 +00:00
Denis Vlasenko ab6b446e95 header_verbose_list: show off_t size, not cast to (unsigned)
get_header_tar: support GNU tar's "base256" encoding

function                                             old     new   delta
get_header_tar                                      1536    1600     +64
header_verbose_list                                  242     257     +15
2008-12-12 02:14:35 +00:00
Denis Vlasenko 12abcb36c8 libiproute: fix buggy open check: s/if (fd)/if (fd >= 0)/
less: small optimization -15 bytes
2008-12-10 14:14:09 +00:00
Denis Vlasenko 311c19a661 ash: printf builtin with no arguments should not exit 2008-12-10 11:51:45 +00:00
Denis Vlasenko 6a2d0d9b8d mount: make it more readable 2008-12-10 11:39:18 +00:00
Denis Vlasenko 3f8f4b2a93 placate Rob's qualms about mount.c 2008-12-10 11:28:30 +00:00
Denis Vlasenko a3ca7cf069 add a note that SO_BINDTODEVICE needs padded iface name on 2.6.26 2008-12-10 11:24:33 +00:00
Denis Vlasenko 517413f9af bb_info_msg: make it do atomic, unbuffered writes
udhcpc: fix a problem where we don't open listening socket fast enough

function                                             old     new   delta
bb_info_msg                                           70     126     +56
change_listen_mode                                    37      78     +41
udhcp_listen_socket                                  151     124     -27
udhcpc_main                                         2344    2285     -59
2008-12-10 11:16:47 +00:00
Denis Vlasenko e53738558f *: fix SO_BINDTODEVICE. Kernel wants at least IFNAMSIZ bytes there. 2008-12-10 11:12:16 +00:00
Denis Vlasenko 0d94820adf syslogd: comment out file locking;
make signal handling syncronous (old was racy)

function                                             old     new   delta
syslogd_main                                         963    1090    +127
quit_signal                                           96       -     -96
log_locally                                          743     595    -148
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 127/-244)         Total: -117 bytes
2008-12-09 22:53:31 +00:00
Denis Vlasenko 1bcdcd2ef0 init: do not eat last char in messages;
do not print duplicate "init:" prefix to syslog
2008-12-09 21:23:31 +00:00
Denis Vlasenko efb545b9bd optimize 16- and 32-bit moves
function                                             old     new   delta
udhcpd_main                                         1239    1257     +18
udhcp_add_simple_option                               93      92      -1
buffer_read_le_u32                                    19      18      -1
unpack_gz_stream_with_info                           526     520      -6
dnsd_main                                           1470    1463      -7
udhcp_run_script                                    1208    1186     -22
send_ACK                                             255     229     -26
arping_main                                         1661    1623     -38
send_offer                                           470     428     -42
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/8 up/down: 18/-143)          Total: -125 bytes
2008-12-08 22:56:18 +00:00
Denis Vlasenko d1a84a2880 libbb: move crypt_make_salt() to pw_encrypt.c, reuse
bin-to-ascii64 conversion which does not require an array.

function                                             old     new   delta
to64                                                  29      33      +4
to64_msb_first                                        63      62      -1
ascii64                                               65       -     -65
2008-12-07 01:16:34 +00:00
Denis Vlasenko db12d1d733 Fix forgotten license comments 2008-12-07 00:52:58 +00:00
Denis Vlasenko 30e5cf8875 mount: cosmetics, no code changes (verified with objdump -drsx) 2008-12-05 16:40:36 +00:00
Denis Vlasenko 15437e3e2a libbb: add xgetgrnam too. ~0 code size change 2008-12-05 16:23:06 +00:00
Denis Vlasenko d324e1b808 libbb/crypt: code shrink
function                                             old     new   delta
to64_msb_first                                         -      63     +63
des_crypt                                           1509    1338    -171
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 63/-171)          Total: -108 bytes
2008-12-04 15:29:35 +00:00
Bernhard Reutner-Fischer 9c6d12993f - -4b and use proper define; add license note 2008-12-04 14:19:21 +00:00
Denis Vlasenko 3f70b87c59 clarify which version of crond is known to put tasks in separate pgrps 2008-12-04 13:57:59 +00:00
Denis Vlasenko 3246c0de12 iproute: fix ipXXX utilities trying to parse their applet name
as their 1st parameter.
2008-12-04 12:15:19 +00:00
Denis Vlasenko e45930e890 Fold mkpasswd applet into cryptpw.
mkpasswd is in Debian, OTOH cryptpw was added to busybox earlier.
Trying to make both camps happy by making those two applets just aliases.
They are command-line compatible. We can decide whether we want to drop one
(and which one) later.

function                                             old     new   delta
cryptpw_main                                         183     314    +131
static.methods                                        21       -     -21
packed_usage                                       25707   25648     -59
mkpasswd_main                                        307       -    -307
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/1 up/down: 131/-387)         Total: -256 bytes
2008-12-04 12:05:26 +00:00
Denis Vlasenko 196a953f21 iptunnel: fix problems with including linux/ip_tunnel.h
on some systems
2008-12-03 20:16:11 +00:00
Denis Vlasenko d7a805efaf libbb: introduce and use xgetpwnam. ~ -150 bytes. 2008-12-03 19:05:55 +00:00
Bernhard Reutner-Fischer ac1c96f673 - remove superfluous comment from previous commit 2008-12-03 18:49:44 +00:00
Bernhard Reutner-Fischer 82b1429966 - add new applet mkpasswd(1)
function                                             old     new   delta
bb_ask                                                 -     355    +355
mkpasswd_main                                          -     296    +296
.rodata                                           121746  121847    +101
packed_usage                                       24632   24689     +57
static.methods                                         -      21     +21
gmatch                                               229     248     +19
bb_ask_stdin                                           -      11     +11
applet_names                                        1949    1958      +9
applet_main                                         1172    1176      +4
sulogin_main                                         503     505      +2
applet_nameofs                                       586     588      +2
sha256_hash                                          329     327      -2
correct_password                                     208     206      -2
parse_command                                       1442    1439      -3
get_cred_or_die                                      145     141      -4
passwd_main                                         1054    1044     -10
bb_askpass                                           348       -    -348
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 7/5 up/down: 877/-369)          Total: 508 bytes
2008-12-03 18:48:39 +00:00
Denis Vlasenko 81c3a1d0b2 ash: remove TODO which seems to actually work now.
no code changes
2008-12-03 11:59:12 +00:00
Denis Vlasenko 6ebb2f56d5 crond: use bb_setpgrp, not setpgrp
platform.h: make a bit more readable
2008-12-03 10:46:12 +00:00
Denis Vlasenko f8535ccd65 ash: finally installed it as /bin/sh on my machine.
some breakage noticed, the most dire is mishandled ^C.
 fixing it.

function                                             old     new   delta
blocking_wait_with_raise_on_sig                        -      40     +40
waitforjob                                            85     100     +15
setsignal                                            280     278      -2
evalvar                                             1376    1374      -2
waitcmd                                              186     182      -4
dowait                                               350     316     -34
redirect                                            1231    1185     -46
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/5 up/down: 55/-88)            Total: -33 bytes
2008-12-03 10:36:26 +00:00
Denis Vlasenko 0c68a874e7 libbb: password/group function helpers rewritten by Tito:
function                                             old     new   delta
xgetpwuid                                              -      27     +27
uid2uname_utoa                                         -      22     +22
gid2group_utoa                                         -      22     +22
uid2uname                                              -      18     +18
gid2group                                              -      18     +18
buffer_fill_and_print                                179     196     +17
print_user                                            12      24     +12
print_group                                           12      24     +12
get_cached                                            89      99     +10
...
print_common                                         134     120     -14
vlock_main                                           415     396     -19
logger_main                                          410     387     -23
crontab_main                                         642     609     -33
bb_getpwuid                                           42       -     -42
bb_getgrgid                                           42       -     -42
bb_getug                                              80       -     -80
------------------------------------------------------------------------------
(add/remove: 6/3 grow/shrink: 9/11 up/down: 187/-296)        Total: -109 bytes
2008-12-02 22:56:59 +00:00
Denis Vlasenko b6ddee2425 crond: put tasks in separate process groups 2008-12-02 21:52:24 +00:00
Denis Vlasenko c5045fdbf1 vconfig: style fix, no code changes 2008-12-02 20:38:36 +00:00
Denis Vlasenko 360d9661b6 libbb: add strncpy_IFNAMSIZ
function                                             old     new   delta
...
udhcp_read_interface                                 225     220      -5
brctl_main                                          1151    1146      -5
add_interface                                        109     104      -5
ipaddr_list_or_flush                                2174    2167      -7
do_add_ioctl                                          88      80      -8
vconfig_main                                         249     240      -9
do_del_ioctl                                          78      68     -10
do_iplink                                           1186    1173     -13
do_if_fetch                                          766     753     -13
buffer_fill_and_print                                196     179     -17
parse_args                                          1709    1684     -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/20 up/down: 11/-140)         Total: -129 bytes
2008-12-02 18:18:50 +00:00
Denis Vlasenko 928b2c0fee ...and exclude LC_ALL too 2008-12-01 12:38:36 +00:00
Denis Vlasenko dcc921e3ca build system: fix sorting + locale in make objsizes 2008-12-01 12:36:41 +00:00
Denis Vlasenko 1e10afcdfb volume_id/fat: careful with sector#, it may not fit in 32 bits. +91 bytes
volume_id/*: a bit of code shrink
2008-11-30 17:41:31 +00:00
Denis Vlasenko a34b8a4d30 init: O_NONBLOCK needs more thought. reverted for now 2008-11-29 23:14:37 +00:00
Denis Vlasenko 7a1ddf20f3 mountpoint: add -n option (by Vladimir)
text    data     bss     dec     hex filename
 799859     560    7748  808167   c54e7 busybox_old
 799845     560    7748  808153   c54d9 busybox_unstripped
2008-11-29 12:54:16 +00:00
Denis Vlasenko d723fb155d inotifyd: save resourses by closing unused inotify descriptors 2008-11-29 09:07:24 +00:00
Denis Vlasenko d16950ded9 acpid: new applet by Vladimir. +737 bytes 2008-11-29 09:05:50 +00:00
Denis Vlasenko f7d87f9b18 Announce 1.13.1 and 1.12.3 2008-11-29 06:57:53 +00:00
Denis Vlasenko e27dafd338 ash: add FIXME 2008-11-28 04:01:03 +00:00
Denis Vlasenko 7b2294edff ash: "ash: syntax error: XXX unexpected" -> "ash: syntax error: unexpected XXX" 2008-11-28 03:50:46 +00:00
Denis Vlasenko 41eb300ff6 ash: shrink on top of previous change
function                                             old     new   delta
readtoken1                                          3201    3221     +20
xxreadtoken                                          306     313      +7
pungetc                                               13      12      -1
ash_main                                            1380    1379      -1
setinputfile                                         196     192      -4
plinno                                                 4       -      -4
parsenleft                                             4       -      -4
parsenextc                                             4       -      -4
parselleft                                             4       -      -4
setinputstring                                        67      62      -5
pushstring                                           123     114      -9
pgetc                                                455     438     -17
pushfile                                              69      31     -38
popfile                                              114      76     -38
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 2/8 up/down: 27/-129)          Total: -102 bytes
   text    data     bss     dec     hex filename
 798750     564    7756  807070   c509e busybox_old
 798664     560    7748  806972   c503c busybox_unstripped
2008-11-28 03:42:31 +00:00
Denis Vlasenko 727752d2d2 ash: better fix for ash -c 'echo 5&' and ash -c 'sleep 5&'
with testcase
2008-11-28 03:41:47 +00:00
Denis Vlasenko 9e0a7c9c41 remove a few superfluous includes 2008-11-25 13:33:11 +00:00
Denis Vlasenko 61befda93b ash,hush: add TODO for rare build failure
*: remove some redundant includes
2008-11-25 01:36:03 +00:00
Denis Vlasenko 1689840672 ash: fix bad interaction between ash -c '....&' and bash compat 2008-11-25 01:34:52 +00:00
Denis Vlasenko 8a2f6bfc2f timeout: fix a few bugs. vda is stupid 2008-11-24 22:34:47 +00:00
Denis Vlasenko 4240408b70 trim help text a bit 2008-11-24 13:42:24 +00:00
Denis Vlasenko a9acbe6cad timeout: new applet. 370 bytes. by Roberto Foglietta. 2008-11-24 13:25:20 +00:00
Denis Vlasenko 00d8417631 vi: speedup and code shrink (Walter Harms)
networking/interface.c: silence warning (Vladimir)
wget: more robust EINTR detection
2008-11-24 07:34:42 +00:00
Denis Vlasenko 4b5709496b strings: code shrink -22 bytes by Tito 2008-11-23 14:58:14 +00:00
Denis Vlasenko 4c83025ea6 diff: emit /dev/null if diff -rN diffs a file against /dev/null
function                                             old     new   delta
diffreg                                             1782    1786      +4
2008-11-23 14:40:00 +00:00
Bernhard Reutner-Fischer 9a280fa7e6 - documentation fix 2008-11-22 20:30:53 +00:00
Denis Vlasenko 9d1d4c06d7 httpd: set $HOST to Host: header value. +83 bytes.
by Tobias Poschwatta (tp AT fonz.de)
2008-11-22 20:29:35 +00:00
Denis Vlasenko 3bc3f08370 modutils-24: small fixes by Harald Kuthe (harald-tuxbox AT arcor.de)
function                                             old     new   delta
obj_load                                             819     832     +13
obj_allocate_commons                                 488     462     -26
bb_init_module_24                                   4800    4759     -41
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 13/-67)            Total: -54 bytes
2008-11-22 20:18:37 +00:00
Denis Vlasenko 12ff9dc714 networking/interface.c: better readability (by Walter Harms)
mkfs_minix: whitespace fix
2008-11-22 18:58:11 +00:00
Denis Vlasenko ae6e135ae8 tftpd: can also have TFTP_DEBUG 2008-11-22 18:41:41 +00:00
Denis Vlasenko 36309cf3f4 insmod: clarify module_name / file_name distinction 2008-11-22 18:29:01 +00:00
Denis Vlasenko cc5feabeba ash: NTO2 needs #if ENABLE_ASH_BASH_COMPAT 2008-11-22 01:32:40 +00:00
Denis Vlasenko 340299a8bc ash: fix miscalculation of memory needed for eval tree
found by Timo Teras (timo.teras AT iki.fi)
2008-11-21 10:36:36 +00:00
Denis Vlasenko b8baf407aa dpkg: better and shorter code to compare versions
(taken from "official" dpkg).
 By Eugene T. Bordenkircher (eugebo AT gmail.com)

function                                             old     new   delta
order                                                  -      48     +48
test_version                                         273     276      +3
version_compare_part                                 396     187    -209
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 51/-209)          Total: -158 bytes
2008-11-20 23:41:56 +00:00
Denis Vlasenko 9a4c0d59a7 inotifyd: exit if x event happened for all files
fix FIONREAD parameter type
 fix default mask code
 shrink help text

function                                             old     new   delta
inotifyd_main                                        497     506      +9
packed_usage                                       25446   25431     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 9/-15)              Total: -6 bytes
2008-11-20 01:24:39 +00:00
Denis Vlasenko 4ae1e13d3f vi: fix several instances of major goof: when text grows, text[]
might get reallocated! We were keeping around pointers to old place...

function                                             old     new   delta
colon                                               3017    3037     +20
char_insert                                          336     354     +18
stupid_insert                                         18      24      +6
string_insert                                         89      94      +5
do_cmd                                              4461    4465      +4
file_insert                                          328     329      +1
text_hole_make                                       134     120     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/1 up/down: 54/-14)             Total: 40 bytes
2008-11-19 13:25:14 +00:00
Denis Vlasenko 58a88916b9 klogd: fix small buglet in previous commit 2008-11-19 09:35:00 +00:00
Denis Vlasenko 2e7dc5d37b klogctl: fix a problem where we don't terminate read data with '\0'
and then misinterpret it. Code shrink while at it.

function                                             old     new   delta
klogd_main                                           404     362     -42
2008-11-19 07:59:49 +00:00
Denis Vlasenko a09a42cd83 inotify: add x, o, and u events 2008-11-17 22:19:18 +00:00
Denis Vlasenko 249d948e39 nslookup: glibc + IPv6 address of DNS server don't mix (yet) 2008-11-17 15:36:36 +00:00
Denis Vlasenko de7a52fff2 id: do not abort build if we use internal password/group functions. 2008-11-17 00:12:17 +00:00
Denis Vlasenko 3eb4466bf8 libbb: replace some memmove's with memcpy's (Ron (ron AT debian.org))
bb_dump_dump                                        2674    2611     -63
2008-11-16 22:21:23 +00:00
Denis Vlasenko 3f5f246466 nslookup: allow usage of IPv6 addresses or hostnames
for DNS server name; allow for port specification.
 Tested to work: "nslookup google.com [::1]:5353"
2008-11-16 19:02:26 +00:00
Denis Vlasenko 5ff1265691 id: abort the build of uclibc is less than 0.9.30 2008-11-16 15:03:11 +00:00
Denis Vlasenko e88bd2d931 man: better check for duplicated MANPATH. Also -10 bytes. 2008-11-16 04:05:13 +00:00
Denis Vlasenko 2479cd4a5d inotifyd: fix "inotifyd with no params" case 2008-11-14 22:14:12 +00:00
Denis Vlasenko 289ff0e341 inotify: document waiting behavior 2008-11-14 21:52:16 +00:00
Denis Vlasenko b0e5d42d4f inotify: fix buffer overflow and "unreaped zombies" problem 2008-11-14 21:34:13 +00:00
Wade Berrier 142c5cb2a2 ifupdown.c: allow options to udhcpc to be configurable from .config
This allows more control over options that are passed to udhcpc
that are not configurable via /etc/network/interfaces.

Example: rather than quit when an initial lease isn't found,
you could use "--background" so that udhcpc keeps running and
continually attempts to get an ip.  That way, when you plug in
the ethernet after powering on the device, you'll still get an ip.
2008-11-14 21:18:45 +00:00
Denis Vlasenko 86c285d900 stat: fix compile breakage (get_f_fsid() is used even if !FEATURE_STAT_FORMAT) 2008-11-13 21:53:32 +00:00
Denis Vlasenko 3470f9297e libbb: sha_crypt -123 bytes 2008-11-13 13:25:18 +00:00
Denis Vlasenko 6bd54d48f4 libbb/pw_encrypt_sha: -28 bytes 2008-11-13 12:55:11 +00:00
Denis Vlasenko 6b1e3d7e73 libbb: remove glibc-style bloat from sha_crypt. -1130 bytes.
cryptpw: add more difficult test vectors.
2008-11-13 12:23:46 +00:00
Denis Vlasenko 4d47692fb8 arp: stop using globals
function                                             old     new   delta
hw_set                                                 1       -      -1
arp_main                                            1559    1558      -1
sockfd                                                 8       4      -4
hw                                                     4       -      -4
device                                                 4       -      -4
ap                                                     4       -      -4
packed_usage                                       25402   25393      -9
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 0/3 up/down: 0/-27)             Total: -27 bytes
2008-11-13 00:05:17 +00:00
Denis Vlasenko fd5a3d2812 gzip: fix gzip -dc case caused by using stale getopt state 2008-11-12 22:06:46 +00:00
Denis Vlasenko 7753ea49bd seq: shrink by 10 bytes 2008-11-12 21:37:19 +00:00
Denis Vlasenko cf3e05bbdb correct help texts 2008-11-12 21:18:58 +00:00
Denis Vlasenko 81c6a91251 telnetd: fix compile problem for non-standalone telnetd 2008-11-12 21:14:50 +00:00
Bernhard Reutner-Fischer c021cb08b5 - add support for seq -s <separator> 2008-11-12 13:22:24 +00:00
Bernhard Reutner-Fischer 2598f761bb - add seq -w support (Natanael Copa) 2008-11-12 12:59:56 +00:00
Denis Vlasenko 1ad4db1d8e modprobe-small: fix failure to load when no arguments are given
modutils-24: fix bad interaction of xzalloc with xrealloc_vector; style fixes
2008-11-12 00:09:58 +00:00
Denis Vlasenko f91f14d221 cksum, printenv: report errors via exitcode
function                                             old     new   delta
cksum_main                                           296     315     +19
printenv_main                                         74      86     +12
2008-11-11 22:59:41 +00:00
Denis Vlasenko 0d8736772d head: report file open errors with exitcode 1 (was happily returning 0)
head_main                                            409     417      +8
2008-11-11 22:43:10 +00:00
Denis Vlasenko 272710fe93 expr: on error, exit with exitcode 2
expr_main                                            101     110      +9
2008-11-11 22:36:58 +00:00
Denis Vlasenko 98f5cdfca7 stat: make stat -f show filesystem "ID:" as coreutils does
print_statfs                                         358     370     +12
2008-11-11 22:25:34 +00:00
Denis Vlasenko f3c2d13602 env: support -uVAR=VAL
function                                             old     new   delta
env_main                                             245     233     -12
2008-11-11 21:32:39 +00:00
Denis Vlasenko 618a3027ed du: fix "du /dir /dir" case
reset_ino_dev_hashtable                                -      84     +84
du                                                   388     376     -12
du_main                                              327     301     -26
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 84/-38)             Total: 46 bytes
2008-11-11 21:15:56 +00:00
Denis Vlasenko 3b35fbb632 runsvdir: straighten some convoluted code. logic is unchanged 2008-11-11 09:33:24 +00:00
Denis Vlasenko 9f2f808b0d telnetd: correctly output 0xff char. ~100 bytes.
telnet: fix some atrocious names and style. no code changes
2008-11-11 02:56:39 +00:00
Denis Vlasenko e9b9a19ad3 libbb: disable a second md5 implementation which managed to creep in :)
function                                             old     new   delta
sha512_end                                           239     237      -2
sha256_end                                           162     160      -2
sha1_end                                             191     189      -2
md5_end                                              168     166      -2
__md5__magic                                           4       -      -4
md5_crypt                                            627     621      -6
static.S                                              16       -     -16
__md5_Init                                            42       -     -42
static.P                                              64       -     -64
__md5_Final                                          131       -    -131
__md5_Update                                         153       -    -153
static.C                                             268      12    -256
__md5_Transform                                      293       -    -293
------------------------------------------------------------------------------
(add/remove: 0/7 grow/shrink: 0/6 up/down: 0/-973)           Total: -973 bytes
2008-11-11 01:38:04 +00:00
Denis Vlasenko 6f05874b9d webpage: announce 1.13.0 and 1.12.2 2008-11-10 22:23:20 +00:00
Denis Vlasenko 2211d5268c libbb: add optionl support for SHA256/512 encrypted passwords
function                                             old     new   delta
sha_crypt                                              -    2423   +2423
cryptpw_main                                         128     183     +55
to64                                                   -      29     +29
pw_encrypt                                           974    1000     +26
str_rounds                                             -      11     +11
login_main                                          1532    1541      +9
packed_usage                                       25215   25200     -15
__md5_to64                                            29       -     -29
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 3/1 up/down: 2553/-44)         Total: 2509 bytes
2008-11-10 18:52:35 +00:00
Denis Vlasenko 56dceb9b77 sha256,sha512: new applets. +4.9kb
we will require sha256/512 code for new $5$ and $6$ style
 password hashes anyway, they are showing up already
 in people's /etc/passwd...
2008-11-10 13:32:50 +00:00
Denis Vlasenko c028ec280a Typo fixes 2008-11-10 10:47:47 +00:00
Denis Vlasenko 0a009c3c6b libbb: constify some data in sha1. gcc is clever enough to do it itself,
thus no actual code changes. Also some pointless beautifuing crept in.
2008-11-10 09:51:15 +00:00
Denis Vlasenko 4cfa5a27aa build system: reorder less' options in config so that
they are properly indented
2008-11-10 09:33:42 +00:00
Denis Vlasenko f8a22575f7 Bump version to 1.14.0.svn 2008-11-09 17:32:46 +00:00
Denis Vlasenko 90dbff7267 Bump version to 1.13.0 2008-11-09 17:28:41 +00:00
459 changed files with 22409 additions and 11971 deletions

No files matched your search

+6
View File
@@ -411,6 +411,12 @@ config CROSS_COMPILER_PREFIX
Native builds leave this empty.
config EXTRA_CFLAGS
string "Additional CFLAGS"
default ""
help
Additional CFLAGS to pass to the compiler verbatim.
endmenu
menu 'Debugging Options'
+4 -3
View File
@@ -1,7 +1,7 @@
VERSION = 1
PATCHLEVEL = 13
SUBLEVEL = 0
EXTRAVERSION = .svn
PATCHLEVEL = 14
SUBLEVEL = 2
EXTRAVERSION =
NAME = Unnamed
# *DOCUMENTATION*
@@ -168,6 +168,7 @@ ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(shell grep ^CONFIG_CROSS_COMPILER_PREFIX .config 2>/dev/null)
CROSS_COMPILE := $(subst CONFIG_CROSS_COMPILER_PREFIX=,,$(CROSS_COMPILE))
CROSS_COMPILE := $(subst ",,$(CROSS_COMPILE))
#")
endif
# SUBARCH tells the usermode build what the underlying arch is. That is set
+4 -2
View File
@@ -106,8 +106,10 @@ bigdata: busybox_unstripped
doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
# FIXME: Doesn't belong here
disp_doc = \
@$(if $(quiet),echo " DOC $(@F)")
cmd_doc =
quiet_cmd_doc = $(Q)echo " DOC $(@F)"
silent_cmd_doc =
disp_doc = $($(quiet)cmd_doc)
docs/busybox.pod: $(srctree)/docs/busybox_header.pod \
$(srctree)/include/usage.h \
+9 -3
View File
@@ -23,6 +23,7 @@ CFLAGS += $(call cc-option,-Wwrite-strings,)
CFLAGS += $(call cc-option,-Wundef,)
CFLAGS += $(call cc-option,-Wstrict-prototypes,)
CFLAGS += $(call cc-option,-Wunused -Wunused-parameter,)
CFLAGS += $(call cc-option,-Wunused-function -Wunused-value,)
CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,)
# warn about C99 declaration after statement
CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
@@ -81,6 +82,11 @@ CFLAGS_busybox += $(ARCH_PIE)
CFLAGS += $(ARCH_FPIE)
endif
ifneq ($(CONFIG_EXTRA_CFLAGS),)
CFLAGS += $(strip $(subst ",,$(CONFIG_EXTRA_CFLAGS)))
#"))
endif
LDLIBS += m crypt
ifeq ($(CONFIG_PAM),y)
@@ -99,12 +105,12 @@ ifeq ($(CONFIG_DMALLOC),y)
LDLIBS += dmalloc
endif
# If a flat binary should be built, CFLAGS_busybox="-Wl,-elf2flt"
# If a flat binary should be built, CFLAGS_busybox="-elf2flt"
# env var should be set for make invocation.
# Here we check whether CFLAGS_busybox indeed contains that flag.
# (For historical reasons, we also check LDFLAGS, which doesn't
# seem to be entirely correct variable to put "-Wl,-elf2flt" into).
W_ELF2FLT = -Wl,-elf2flt
# seem to be entirely correct variable to put "-elf2flt" into).
W_ELF2FLT = -elf2flt
ifneq (,$(findstring $(W_ELF2FLT),$(LDFLAGS) $(CFLAGS_busybox)))
SKIP_STRIP = y
endif
+1 -1
View File
@@ -78,7 +78,7 @@ Downloading the current source code:
http://busybox.net/developer.html
The developers also have a bug and patch tracking system
(http://bugs.busybox.net) although posting a bug/patch to the mailing list
(https://bugs.busybox.net) although posting a bug/patch to the mailing list
is generally a faster way of getting it fixed, and the complete archive of
what happened is the subversion changelog.
+4 -17
View File
@@ -23,7 +23,7 @@ Rob Landley suggested these:
lash is phased out. hush can be configured down to be nearly as small,
but less buggy :)
init
General cleanup (should use ENABLE_FEATURE_INIT_SYSLOG and ENABLE_FEATURE_INIT_DEBUG).
General cleanup (should use ENABLE_FEATURE_INIT_SYSLOG).
Do a SUSv3 audit
Look at the full Single Unix Specification version 3 (available online at
"http://www.opengroup.org/onlinepubs/009695399/nfindex.html") and
@@ -103,11 +103,6 @@ Bernhard Reutner-Fischer <busybox@busybox.net> suggests to look at these:
New debug options:
-Wlarger-than-127
Cleanup any big users
-Wunused-parameter
Facilitate applet PROTOTYPES to provide means for having applets that
do a) not take any arguments b) need only one of argc or argv c) need
both argc and argv. All of these three options should go for the most
feature complete denominator.
Collate BUFSIZ IOBUF_SIZE MY_BUF_SIZE PIPE_PROGRESS_SIZE BUFSIZE PIPESIZE
make bb_common_bufsiz1 configurable, size wise.
make pipesize configurable, size wise.
@@ -132,14 +127,6 @@ patch
And while we're at it, a new patch filename quoting format is apparently
coming soon: http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2
---
man
It would be nice to have a man command. Not one that handles troff or
anything, just one that can handle preformatted ascii man pages, possibly
compressed. This could probably be a script in the extras directory that
calls cat/zcat/bzcat | less
(How doclifter might work into this is anybody's guess.)
---
ar
Write support!
---
@@ -183,8 +170,7 @@ Unify archivers
---
Text buffer support.
Several existing applets (sort, vi, less...) read
a whole file into memory and act on it. There might be an opportunity
for shared code in there that could be moved into libbb...
a whole file into memory and act on it. Use open_read_close().
---
Memory Allocation
We have a CONFIG_BUFFER mechanism that lets us select whether to do memory
@@ -236,7 +222,7 @@ Switch CONFIG_SYMBOLS to ENABLE_SYMBOLS
FEATURE_CLEAN_UP
This is more an unresolved issue than a to-do item. More thought is needed.
Normally we rely on exit() to free memory, close files, and unmap segments
Normally we rely on exit() to free memory, close files and unmap segments
for us. This makes most calls to free(), close(), and unmap() optional in
busybox applets that don't intend to run for very long, and optional stuff
can be omitted to save size.
@@ -287,6 +273,7 @@ Minor stuff:
---
in_ether duplicated in network/{interface,ifconfig}.c
---
unify progress_meter. wget, flash_eraseall, pipe_progress, fbsplash, setfiles.
Code cleanup:
+1 -2
View File
@@ -110,6 +110,7 @@ CONFIG_BUNZIP2=y
CONFIG_BZIP2=y
CONFIG_CPIO=y
CONFIG_FEATURE_CPIO_O=y
CONFIG_FEATURE_CPIO_P=y
CONFIG_DPKG=y
CONFIG_DPKG_DEB=y
CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY=y
@@ -630,11 +631,9 @@ CONFIG_HOSTNAME=y
CONFIG_HTTPD=y
CONFIG_FEATURE_HTTPD_RANGES=y
CONFIG_FEATURE_HTTPD_USE_SENDFILE=y
CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP=y
CONFIG_FEATURE_HTTPD_SETUID=y
CONFIG_FEATURE_HTTPD_BASIC_AUTH=y
CONFIG_FEATURE_HTTPD_AUTH_MD5=y
CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES=y
CONFIG_FEATURE_HTTPD_CGI=y
CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y
CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y
+5
View File
@@ -1,4 +1,9 @@
/* vi: set sw=4 ts=4: */
/*
* Copyright (C) 2008 Denys Vlasenko.
*
* Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
#include <unistd.h>
/* Just #include "autoconf.h" doesn't work for builds in separate
+7
View File
@@ -110,6 +110,13 @@ config FEATURE_CPIO_O
This implementation of cpio can create cpio archives in the "newc"
format only.
config FEATURE_CPIO_P
bool "Support for passthrough mode"
default n
depends on FEATURE_CPIO_O
help
Passthrough mode. Rarely used.
config DPKG
bool "dpkg"
default n
+150 -91
View File
@@ -14,6 +14,87 @@
#include "libbb.h"
#include "unarchive.h"
/* GNU cpio 2.9 --help (abridged):
Modes:
-t, --list List the archive
-i, --extract Extract files from an archive
-o, --create Create the archive
-p, --pass-through Copy-pass mode [was ist das?!]
Options valid in any mode:
--block-size=SIZE I/O block size = SIZE * 512 bytes
-B I/O block size = 5120 bytes
-c Use the old portable (ASCII) archive format
-C, --io-size=NUMBER I/O block size in bytes
-f, --nonmatching Only copy files that do not match given pattern
-F, --file=FILE Use FILE instead of standard input or output
-H, --format=FORMAT Use given archive FORMAT
-M, --message=STRING Print STRING when the end of a volume of the
backup media is reached
-n, --numeric-uid-gid If -v, show numeric UID and GID
--quiet Do not print the number of blocks copied
--rsh-command=COMMAND Use remote COMMAND instead of rsh
-v, --verbose Verbosely list the files processed
-V, --dot Print a "." for each file processed
-W, --warning=FLAG Control warning display: 'none','truncate','all';
multiple options accumulate
Options valid only in --extract mode:
-b, --swap Swap both halfwords of words and bytes of
halfwords in the data (equivalent to -sS)
-r, --rename Interactively rename files
-s, --swap-bytes Swap the bytes of each halfword in the files
-S, --swap-halfwords Swap the halfwords of each word (4 bytes)
--to-stdout Extract files to standard output
-E, --pattern-file=FILE Read additional patterns specifying filenames to
extract or list from FILE
--only-verify-crc Verify CRC's, don't actually extract the files
Options valid only in --create mode:
-A, --append Append to an existing archive
-O FILE File to use instead of standard output
Options valid only in --pass-through mode:
-l, --link Link files instead of copying them, when possible
Options valid in --extract and --create modes:
--absolute-filenames Do not strip file system prefix components from
the file names
--no-absolute-filenames Create all files relative to the current dir
Options valid in --create and --pass-through modes:
-0, --null A list of filenames is terminated by a NUL
-a, --reset-access-time Reset the access times of files after reading them
-I FILE File to use instead of standard input
-L, --dereference Dereference symbolic links (copy the files
that they point to instead of copying the links)
-R, --owner=[USER][:.][GROUP] Set owner of created files
Options valid in --extract and --pass-through modes:
-d, --make-directories Create leading directories where needed
-m, --preserve-modification-time Retain mtime when creating files
--no-preserve-owner Do not change the ownership of the files
--sparse Write files with blocks of zeros as sparse files
-u, --unconditional Replace all files unconditionally
*/
enum {
CPIO_OPT_EXTRACT = (1 << 0),
CPIO_OPT_TEST = (1 << 1),
CPIO_OPT_NUL_TERMINATED = (1 << 2),
CPIO_OPT_UNCONDITIONAL = (1 << 3),
CPIO_OPT_VERBOSE = (1 << 4),
CPIO_OPT_CREATE_LEADING_DIR = (1 << 5),
CPIO_OPT_PRESERVE_MTIME = (1 << 6),
CPIO_OPT_DEREF = (1 << 7),
CPIO_OPT_FILE = (1 << 8),
CPIO_OPT_CREATE = (1 << 9) * ENABLE_FEATURE_CPIO_O,
CPIO_OPT_FORMAT = (1 << 10) * ENABLE_FEATURE_CPIO_O,
CPIO_OPT_PASSTHROUGH = (1 << 11) * ENABLE_FEATURE_CPIO_P,
};
#define OPTION_STR "it0uvdmLF:"
#if ENABLE_FEATURE_CPIO_O
static off_t cpio_pad4(off_t size)
{
@@ -49,7 +130,9 @@ static int cpio_o(void)
char *line;
struct stat st;
line = xmalloc_fgetline(stdin);
line = (option_mask32 & CPIO_OPT_NUL_TERMINATED)
? bb_get_chunk_from_file(stdin, NULL)
: xmalloc_fgetline(stdin);
if (line) {
/* Strip leading "./[./]..." from the filename */
@@ -62,7 +145,10 @@ static int cpio_o(void)
free(line);
continue;
}
if (lstat(name, &st)) {
if ((option_mask32 & CPIO_OPT_DEREF)
? stat(name, &st)
: lstat(name, &st)
) {
abort_cpio_o:
bb_simple_perror_msg_and_die(name);
}
@@ -179,71 +265,6 @@ static int cpio_o(void)
}
#endif
/* GNU cpio 2.9 --help (abridged):
Modes:
-i, --extract Extract files from an archive
-o, --create Create the archive
-p, --pass-through Copy-pass mode [was ist das?!]
-t, --list List the archive
Options valid in any mode:
--block-size=SIZE I/O block size = SIZE * 512 bytes
-B I/O block size = 5120 bytes
-c Use the old portable (ASCII) archive format
-C, --io-size=NUMBER I/O block size in bytes
-f, --nonmatching Only copy files that do not match given pattern
-F, --file=FILE Use FILE instead of standard input or output
-H, --format=FORMAT Use given archive FORMAT
-M, --message=STRING Print STRING when the end of a volume of the
backup media is reached
-n, --numeric-uid-gid If -v, show numeric UID and GID
--quiet Do not print the number of blocks copied
--rsh-command=COMMAND Use remote COMMAND instead of rsh
-v, --verbose Verbosely list the files processed
-V, --dot Print a "." for each file processed
-W, --warning=FLAG Control warning display: 'none','truncate','all';
multiple options accumulate
Options valid only in --extract mode:
-b, --swap Swap both halfwords of words and bytes of
halfwords in the data (equivalent to -sS)
-r, --rename Interactively rename files
-s, --swap-bytes Swap the bytes of each halfword in the files
-S, --swap-halfwords Swap the halfwords of each word (4 bytes)
--to-stdout Extract files to standard output
-E, --pattern-file=FILE Read additional patterns specifying filenames to
extract or list from FILE
--only-verify-crc Verify CRC's, don't actually extract the files
Options valid only in --create mode:
-A, --append Append to an existing archive
-O FILE File to use instead of standard output
Options valid only in --pass-through mode:
-l, --link Link files instead of copying them, when possible
Options valid in --extract and --create modes:
--absolute-filenames Do not strip file system prefix components from
the file names
--no-absolute-filenames Create all files relative to the current dir
Options valid in --create and --pass-through modes:
-0, --null A list of filenames is terminated by a NUL
-a, --reset-access-time Reset the access times of files after reading them
-I FILE File to use instead of standard input
-L, --dereference Dereference symbolic links (copy the files
that they point to instead of copying the links)
-R, --owner=[USER][:.][GROUP] Set owner of created files
Options valid in --extract and --pass-through modes:
-d, --make-directories Create leading directories where needed
-m, --preserve-modification-time Retain mtime when creating files
--no-preserve-owner Do not change the ownership of the files
--sparse Write files with blocks of zeros as sparse files
-u, --unconditional Replace all files unconditionally
*/
int cpio_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int cpio_main(int argc UNUSED_PARAM, char **argv)
{
@@ -251,17 +272,6 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
char *cpio_filename;
USE_FEATURE_CPIO_O(const char *cpio_fmt = "";)
unsigned opt;
enum {
CPIO_OPT_EXTRACT = (1 << 0),
CPIO_OPT_TEST = (1 << 1),
CPIO_OPT_UNCONDITIONAL = (1 << 2),
CPIO_OPT_VERBOSE = (1 << 3),
CPIO_OPT_FILE = (1 << 4),
CPIO_OPT_CREATE_LEADING_DIR = (1 << 5),
CPIO_OPT_PRESERVE_MTIME = (1 << 6),
CPIO_OPT_CREATE = (1 << 7),
CPIO_OPT_FORMAT = (1 << 8),
};
#if ENABLE_GETOPT_LONG
applet_long_options =
@@ -270,21 +280,67 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
#if ENABLE_FEATURE_CPIO_O
"create\0" No_argument "o"
"format\0" Required_argument "H"
#if ENABLE_FEATURE_CPIO_P
"pass-through\0" No_argument "p"
#endif
#endif
;
#endif
/* Initialize */
archive_handle = init_handle();
archive_handle->src_fd = STDIN_FILENO;
archive_handle->seek = seek_by_read;
archive_handle->ah_flags = ARCHIVE_EXTRACT_NEWER;
/* As of now we do not enforce this: */
/* -i,-t,-o,-p are mutually exclusive */
/* -u,-d,-m make sense only with -i or -p */
/* -L makes sense only with -o or -p */
#if ENABLE_FEATURE_CPIO_O
opt = getopt32(argv, "ituvF:dmoH:", &cpio_filename, &cpio_fmt);
#if !ENABLE_FEATURE_CPIO_O
opt = getopt32(argv, OPTION_STR, &cpio_filename);
#else
opt = getopt32(argv, OPTION_STR "oH:" USE_FEATURE_CPIO_P("p"), &cpio_filename, &cpio_fmt);
if (opt & CPIO_OPT_PASSTHROUGH) {
pid_t pid;
struct fd_pair pp;
if (argv[optind] == NULL)
bb_show_usage();
if (opt & CPIO_OPT_CREATE_LEADING_DIR)
mkdir(argv[optind], 0777);
/* Crude existence check:
* close(xopen(argv[optind], O_RDONLY | O_DIRECTORY));
* We can also xopen, fstat, IS_DIR, later fchdir.
* This would check for existence earlier and cleaner.
* As it stands now, if we fail xchdir later,
* child dies on EPIPE, unless it caught
* a diffrerent problem earlier.
* This is good enough for now.
*/
#if !BB_MMU
pp.rd = 3;
pp.wr = 4;
if (!re_execed) {
close(3);
close(4);
xpiped_pair(pp);
}
#else
xpiped_pair(pp);
#endif
pid = fork_or_rexec(argv);
if (pid == 0) { /* child */
close(pp.rd);
xmove_fd(pp.wr, STDOUT_FILENO);
goto dump;
}
/* parent */
xchdir(argv[optind++]);
close(pp.wr);
xmove_fd(pp.rd, STDIN_FILENO);
opt &= ~CPIO_OPT_PASSTHROUGH;
opt |= CPIO_OPT_EXTRACT;
goto skip;
}
/* -o */
if (opt & CPIO_OPT_CREATE) {
if (*cpio_fmt != 'n')
if (*cpio_fmt != 'n') /* we _require_ "-H newc" */
bb_show_usage();
if (opt & CPIO_OPT_FILE) {
fclose(stdout);
@@ -292,13 +348,18 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
/* Paranoia: I don't trust libc that much */
xdup2(fileno(stdout), STDOUT_FILENO);
}
dump:
return cpio_o();
}
#else
opt = getopt32(argv, "ituvF:dm", &cpio_filename);
skip:
#endif
argv += optind;
archive_handle = init_handle();
archive_handle->src_fd = STDIN_FILENO;
archive_handle->seek = seek_by_read;
archive_handle->ah_flags = ARCHIVE_EXTRACT_NEWER;
/* One of either extract or test options must be given */
if ((opt & (CPIO_OPT_TEST | CPIO_OPT_EXTRACT)) == 0) {
bb_show_usage();
@@ -306,9 +367,7 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
if (opt & CPIO_OPT_TEST) {
/* if both extract and test options are given, ignore extract option */
if (opt & CPIO_OPT_EXTRACT) {
opt &= ~CPIO_OPT_EXTRACT;
}
opt &= ~CPIO_OPT_EXTRACT;
archive_handle->action_header = header_list;
}
if (opt & CPIO_OPT_EXTRACT) {
+57 -66
View File
@@ -6,6 +6,10 @@
* written by glenn mcgrath with the help of others
* copyright (c) 2001 by glenn mcgrath
*
* parts of the version comparison code is plucked from the real dpkg
* application which is licensed GPLv2 and
* copyright (c) 1995 Ian Jackson <ian@chiark.greenend.org.uk>
*
* started life as a busybox implementation of udpkg
*
* licensed under gplv2 or later, see file license in this tarball for details.
@@ -135,7 +139,7 @@ static void make_hash(const char *key, unsigned *start, unsigned *decrement, con
/* shifts the ascii based value and adds it to previous value
* shift amount is mod 24 because long int is 32 bit and data
* to be shifted is 8, don't want to shift data to where it has
* no effect*/
* no effect */
hash_num += (key[i] + key[i-1]) << ((key[i] * i) % 24);
}
*start = (unsigned) hash_num % hash_prime;
@@ -183,60 +187,52 @@ static unsigned search_status_hashtable(const char *key)
return probe_address;
}
/* Need to rethink version comparison, maybe the official dpkg has something i can use ? */
static int version_compare_part(const char *version1, const char *version2)
static int order(char x)
{
int upstream_len1 = 0;
int upstream_len2 = 0;
char *name1_char;
char *name2_char;
int len1 = 0;
int len2 = 0;
int tmp_int;
int ver_num1;
int ver_num2;
return (x == '~' ? -1
: x == '\0' ? 0
: isdigit(x) ? 0
: isalpha(x) ? x
: (unsigned char)x + 256
);
}
if (version1 == NULL) {
version1 = xstrdup("");
}
if (version2 == NULL) {
version2 = xstrdup("");
}
upstream_len1 = strlen(version1);
upstream_len2 = strlen(version2);
/* This code is taken from dpkg and modified slightly to work with busybox */
static int version_compare_part(const char *val, const char *ref)
{
if (!val) val = "";
if (!ref) ref = "";
while ((len1 < upstream_len1) || (len2 < upstream_len2)) {
/* Compare non-digit section */
tmp_int = strcspn(&version1[len1], "0123456789");
name1_char = xstrndup(&version1[len1], tmp_int);
len1 += tmp_int;
tmp_int = strcspn(&version2[len2], "0123456789");
name2_char = xstrndup(&version2[len2], tmp_int);
len2 += tmp_int;
tmp_int = strcmp(name1_char, name2_char);
free(name1_char);
free(name2_char);
if (tmp_int != 0) {
return tmp_int;
while (*val || *ref) {
int first_diff;
while ((*val && !isdigit(*val)) || (*ref && !isdigit(*ref))) {
int vc = order(*val);
int rc = order(*ref);
if (vc != rc)
return vc - rc;
val++;
ref++;
}
/* Compare digits */
tmp_int = strspn(&version1[len1], "0123456789");
name1_char = xstrndup(&version1[len1], tmp_int);
len1 += tmp_int;
tmp_int = strspn(&version2[len2], "0123456789");
name2_char = xstrndup(&version2[len2], tmp_int);
len2 += tmp_int;
ver_num1 = atoi(name1_char);
ver_num2 = atoi(name2_char);
free(name1_char);
free(name2_char);
if (ver_num1 < ver_num2) {
return -1;
while (*val == '0')
val++;
while (*ref == '0')
ref++;
first_diff = 0;
while (isdigit(*val) && isdigit(*ref)) {
if (first_diff == 0)
first_diff = *val - *ref;
val++;
ref++;
}
if (ver_num1 > ver_num2) {
if (isdigit(*val))
return 1;
}
if (isdigit(*ref))
return -1;
if (first_diff)
return first_diff;
}
return 0;
}
@@ -249,39 +245,34 @@ static int version_compare(const unsigned ver1, const unsigned ver2)
{
char *ch_ver1 = name_hashtable[ver1];
char *ch_ver2 = name_hashtable[ver2];
char epoch1, epoch2;
unsigned long epoch1 = 0, epoch2 = 0;
char *colon;
char *deb_ver1, *deb_ver2;
char *ver1_ptr, *ver2_ptr;
char *upstream_ver1;
char *upstream_ver2;
int result;
/* Compare epoch */
if (ch_ver1[1] == ':') {
epoch1 = ch_ver1[0];
ver1_ptr = strchr(ch_ver1, ':') + 1;
} else {
epoch1 = '0';
ver1_ptr = ch_ver1;
colon = strchr(ch_ver1, ':');
if (colon) {
epoch1 = atoi(ch_ver1);
ch_ver1 = colon + 1;
}
if (ch_ver2[1] == ':') {
epoch2 = ch_ver2[0];
ver2_ptr = strchr(ch_ver2, ':') + 1;
} else {
epoch2 = '0';
ver2_ptr = ch_ver2;
colon = strchr(ch_ver2, ':');
if (colon) {
epoch2 = atoi(ch_ver2);
ch_ver2 = colon + 1;
}
if (epoch1 < epoch2) {
return -1;
}
else if (epoch1 > epoch2) {
if (epoch1 > epoch2) {
return 1;
}
/* Compare upstream version */
upstream_ver1 = xstrdup(ver1_ptr);
upstream_ver2 = xstrdup(ver2_ptr);
upstream_ver1 = xstrdup(ch_ver1);
upstream_ver2 = xstrdup(ch_ver2);
/* Chop off debian version, and store for later use */
deb_ver1 = strrchr(upstream_ver1, '-');
+31 -37
View File
@@ -388,19 +388,6 @@ static void put_32bit(ulg n)
put_16bit(n >> 16);
}
/* ===========================================================================
* Clear input and output buffers
*/
static void clear_bufs(void)
{
G1.outcnt = 0;
#ifdef DEBUG
G1.insize = 0;
#endif
G1.isize = 0;
}
/* ===========================================================================
* Run a set of bytes through the crc shift register. If s is a NULL
* pointer, then initialize the crc shift register contents instead.
@@ -2019,7 +2006,37 @@ USE_DESKTOP(long long) int pack_gzip(unpack_info_t *info UNUSED_PARAM)
{
struct stat s;
clear_bufs();
/* Clear input and output buffers */
G1.outcnt = 0;
#ifdef DEBUG
G1.insize = 0;
#endif
G1.isize = 0;
/* Reinit G2.xxx */
memset(&G2, 0, sizeof(G2));
G2.l_desc.dyn_tree = G2.dyn_ltree;
G2.l_desc.static_tree = G2.static_ltree;
G2.l_desc.extra_bits = extra_lbits;
G2.l_desc.extra_base = LITERALS + 1;
G2.l_desc.elems = L_CODES;
G2.l_desc.max_length = MAX_BITS;
//G2.l_desc.max_code = 0;
G2.d_desc.dyn_tree = G2.dyn_dtree;
G2.d_desc.static_tree = G2.static_dtree;
G2.d_desc.extra_bits = extra_dbits;
//G2.d_desc.extra_base = 0;
G2.d_desc.elems = D_CODES;
G2.d_desc.max_length = MAX_BITS;
//G2.d_desc.max_code = 0;
G2.bl_desc.dyn_tree = G2.bl_tree;
//G2.bl_desc.static_tree = NULL;
G2.bl_desc.extra_bits = extra_blbits,
//G2.bl_desc.extra_base = 0;
G2.bl_desc.elems = BL_CODES;
G2.bl_desc.max_length = MAX_BL_BITS;
//G2.bl_desc.max_code = 0;
s.st_ctime = 0;
fstat(STDIN_FILENO, &s);
zip(s.st_ctime);
@@ -2064,29 +2081,6 @@ int gzip_main(int argc UNUSED_PARAM, char **argv)
SET_PTR_TO_GLOBALS(xzalloc(sizeof(struct globals) + sizeof(struct globals2))
+ sizeof(struct globals));
barrier();
G2.l_desc.dyn_tree = G2.dyn_ltree;
G2.l_desc.static_tree = G2.static_ltree;
G2.l_desc.extra_bits = extra_lbits;
G2.l_desc.extra_base = LITERALS + 1;
G2.l_desc.elems = L_CODES;
G2.l_desc.max_length = MAX_BITS;
//G2.l_desc.max_code = 0;
G2.d_desc.dyn_tree = G2.dyn_dtree;
G2.d_desc.static_tree = G2.static_dtree;
G2.d_desc.extra_bits = extra_dbits;
//G2.d_desc.extra_base = 0;
G2.d_desc.elems = D_CODES;
G2.d_desc.max_length = MAX_BITS;
//G2.d_desc.max_code = 0;
G2.bl_desc.dyn_tree = G2.bl_tree;
//G2.bl_desc.static_tree = NULL;
G2.bl_desc.extra_bits = extra_blbits,
//G2.bl_desc.extra_base = 0;
G2.bl_desc.elems = BL_CODES;
G2.bl_desc.max_length = MAX_BL_BITS;
//G2.bl_desc.max_code = 0;
/* Allocate all global buffers (for DYN_ALLOC option) */
ALLOC(uch, G1.l_buf, INBUFSIZ);
+2 -3
View File
@@ -1083,8 +1083,7 @@ static uint16_t buffer_read_le_u16(STATE_PARAM_ONLY)
{
uint16_t res;
#if BB_LITTLE_ENDIAN
/* gcc 4.2.1 is very clever */
memcpy(&res, &bytebuffer[bytebuffer_offset], 2);
move_from_unaligned16(res, &bytebuffer[bytebuffer_offset]);
#else
res = bytebuffer[bytebuffer_offset];
res |= bytebuffer[bytebuffer_offset + 1] << 8;
@@ -1097,7 +1096,7 @@ static uint32_t buffer_read_le_u32(STATE_PARAM_ONLY)
{
uint32_t res;
#if BB_LITTLE_ENDIAN
memcpy(&res, &bytebuffer[bytebuffer_offset], 4);
move_from_unaligned32(res, &bytebuffer[bytebuffer_offset]);
#else
res = bytebuffer[bytebuffer_offset];
res |= bytebuffer[bytebuffer_offset + 1] << 8;
+74 -3
View File
@@ -14,6 +14,74 @@
#include "libbb.h"
#include "unarchive.h"
/*
* GNU tar uses "base-256 encoding" for very large numbers (>8 billion).
* Encoding is binary, with highest bit always set as a marker
* and sign in next-highest bit:
* 80 00 .. 00 - zero
* bf ff .. ff - largest positive number
* ff ff .. ff - minus 1
* c0 00 .. 00 - smallest negative number
*
* We expect it only in size field, where negative numbers don't make sense.
*/
static off_t getBase256_len12(const char *str)
{
off_t value;
int len;
/* if (*str & 0x40) error; - caller prevents this */
if (sizeof(off_t) >= 12) {
/* Probably 128-bit (16 byte) off_t. Can be optimized. */
len = 12;
value = *str++ & 0x3f;
while (--len)
value = (value << 8) + (unsigned char) *str++;
return value;
}
#ifdef CHECK_FOR_OVERFLOW
/* Can be optimized to eat 32-bit chunks */
char c = *str++ & 0x3f;
len = 12;
while (1) {
if (c)
bb_error_msg_and_die("overflow in base-256 encoded file size");
if (--len == sizeof(off_t))
break;
c = *str++;
}
#else
str += (12 - sizeof(off_t));
#endif
/* Now str points to sizeof(off_t) least significant bytes.
*
* Example of tar file with 8914993153 (0x213600001) byte file.
* Field starts at offset 7c:
* 00070 30 30 30 00 30 30 30 30 30 30 30 00 80 00 00 00 |000.0000000.....|
* 00080 00 00 00 02 13 60 00 01 31 31 31 32 30 33 33 36 |.....`..11120336|
*
* str is at offset 80 or 84 now (64-bit or 32-bit off_t).
* We (ab)use the fact that value happens to be aligned,
* and fetch it in one go:
*/
if (sizeof(off_t) == 8) {
value = *(off_t*)str;
value = SWAP_BE64(value);
} else if (sizeof(off_t) == 4) {
value = *(off_t*)str;
value = SWAP_BE32(value);
} else {
value = 0;
len = sizeof(off_t);
while (--len)
value = (value << 8) + (unsigned char) *str++;
}
return value;
}
/* NB: _DESTROYS_ str[len] character! */
static unsigned long long getOctal(char *str, int len)
{
@@ -91,7 +159,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
again_after_align:
#if ENABLE_DESKTOP
#if ENABLE_DESKTOP || ENABLE_FEATURE_TAR_AUTODETECT
/* to prevent misdetection of bz2 sig */
*(uint32_t*)(&tar) = 0;
i = full_read(archive_handle->src_fd, &tar, 512);
@@ -142,7 +210,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
#if ENABLE_FEATURE_TAR_AUTODETECT
char FAST_FUNC (*get_header_ptr)(archive_handle_t *);
USE_DESKTOP(autodetect:)
autodetect:
/* tar gz/bz autodetect: check for gz/bz2 magic.
* If we see the magic, and it is the very first block,
* we can switch to get_header_tar_gz/bz2/lzma().
@@ -234,7 +302,10 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
file_header->gname = tar.gname[0] ? xstrndup(tar.gname, sizeof(tar.gname)) : NULL;
#endif
file_header->mtime = GET_OCTAL(tar.mtime);
file_header->size = GET_OCTAL(tar.size);
/* Size field: handle GNU tar's "base256 encoding" */
file_header->size = (*tar.size & 0xc0) == 0x80 /* positive base256? */
? getBase256_len12(tar.size)
: GET_OCTAL(tar.size);
file_header->gid = GET_OCTAL(tar.gid);
file_header->uid = GET_OCTAL(tar.uid);
/* Set bits 0-11 of the files mode */
+2 -2
View File
@@ -24,11 +24,11 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
snprintf(gid, sizeof(gid), "%u", (unsigned)file_header->gid);
group = gid;
}
printf("%s %s/%s %9u %4u-%02u-%02u %02u:%02u:%02u %s",
printf("%s %s/%s %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
bb_mode_string(file_header->mode),
user,
group,
(unsigned int) file_header->size,
file_header->size,
1900 + mtime->tm_year,
1 + mtime->tm_mon,
mtime->tm_mday,
+2 -3
View File
@@ -357,7 +357,8 @@ static int writeTarHeader(struct TarBallInfo *tbInfo,
if (tbInfo->verboseFlag) {
FILE *vbFd = stdout;
if (tbInfo->tarFd == STDOUT_FILENO) /* If the archive goes to stdout, verbose to stderr */
/* If archive goes to stdout, verbose goes to stderr */
if (tbInfo->tarFd == STDOUT_FILENO)
vbFd = stderr;
/* GNU "tar cvvf" prints "extended" listing a-la "ls -l" */
/* We don't have such excesses here: for us "v" == "vv" */
@@ -591,8 +592,6 @@ static NOINLINE int writeTarFile(int tar_fd, int verboseFlag,
struct TarBallInfo tbInfo;
tbInfo.hlInfoHead = NULL;
fchmod(tar_fd, 0644);
tbInfo.tarFd = tar_fd;
tbInfo.verboseFlag = verboseFlag;
+1 -1
View File
@@ -140,7 +140,7 @@ struct BUG_cde_header_must_be_16_bytes {
};
#define FIX_ENDIANNESS_CDE(cde_header) do { \
(cde_header).formatted.cds_offset = SWAP_LE16((cde_header).formatted.cds_offset); \
(cde_header).formatted.cds_offset = SWAP_LE32((cde_header).formatted.cds_offset); \
} while (0)
enum { zip_fd = 3 };
+2
View File
@@ -6,6 +6,8 @@
*
* Loads the console font, and possibly the corresponding screen map(s).
* (Adapted for busybox by Matej Vela.)
*
* Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
#include "libbb.h"
#include <sys/kd.h>
+14 -2
View File
@@ -189,7 +189,7 @@ config ECHO
config FEATURE_FANCY_ECHO
bool "Enable echo options (-n and -e)"
default y
depends on ECHO || ASH_BUILTIN_ECHO
depends on ECHO || ASH_BUILTIN_ECHO || HUSH
help
This adds options (-n and -e) to echo.
@@ -509,6 +509,18 @@ config SHA1SUM
help
Compute and check SHA1 message digest
config SHA256SUM
bool "sha256sum"
default n
help
Compute and check SHA256 message digest
config SHA512SUM
bool "sha512sum"
default n
help
Compute and check SHA512 message digest
config SLEEP
bool "sleep"
default n
@@ -754,7 +766,7 @@ config FEATURE_WC_LARGE
default n
depends on WC
help
Use "unsigned long long" in wc for count variables.
Use "unsigned long long" in wc for counter variables.
config WHO
bool "who"
+3
View File
@@ -44,6 +44,7 @@ lib-$(CONFIG_LENGTH) += length.o
lib-$(CONFIG_LN) += ln.o
lib-$(CONFIG_LOGNAME) += logname.o
lib-$(CONFIG_LS) += ls.o
lib-$(CONFIG_FTPD) += ls.o
lib-$(CONFIG_MD5SUM) += md5_sha1_sum.o
lib-$(CONFIG_MKDIR) += mkdir.o
lib-$(CONFIG_MKFIFO) += mkfifo.o
@@ -62,6 +63,8 @@ lib-$(CONFIG_RM) += rm.o
lib-$(CONFIG_RMDIR) += rmdir.o
lib-$(CONFIG_SEQ) += seq.o
lib-$(CONFIG_SHA1SUM) += md5_sha1_sum.o
lib-$(CONFIG_SHA256SUM) += md5_sha1_sum.o
lib-$(CONFIG_SHA512SUM) += md5_sha1_sum.o
lib-$(CONFIG_SLEEP) += sleep.o
lib-$(CONFIG_SPLIT) += split.o
lib-$(CONFIG_SORT) += sort.o
+5 -2
View File
@@ -15,6 +15,7 @@ int cksum_main(int argc UNUSED_PARAM, char **argv)
uint32_t crc;
off_t length, filesize;
int bytes_read;
int exit_code = EXIT_SUCCESS;
uint8_t *cp;
#if ENABLE_DESKTOP
@@ -27,8 +28,10 @@ int cksum_main(int argc UNUSED_PARAM, char **argv)
do {
int fd = open_or_warn_stdin(*argv ? *argv : bb_msg_standard_input);
if (fd < 0)
if (fd < 0) {
exit_code = EXIT_FAILURE;
continue;
}
crc = 0;
length = 0;
@@ -60,5 +63,5 @@ int cksum_main(int argc UNUSED_PARAM, char **argv)
crc, filesize, *argv);
} while (*argv && *++argv);
fflush_stdout_and_exit(EXIT_SUCCESS);
fflush_stdout_and_exit(exit_code);
}
+49 -1
View File
@@ -46,7 +46,55 @@ int cp_main(int argc, char **argv)
// -R (and therefore -r) turns on -d (coreutils does this)
// -a = -pdR
opt_complementary = "-2:l--s:s--l:Pd:rRd:Rd:apdR:HL";
flags = getopt32(argv, FILEUTILS_CP_OPTSTR "arPH");
// -v (--verbose) is ignored
flags = getopt32(argv, FILEUTILS_CP_OPTSTR "arPHv");
/* Options of cp from GNU coreutils 6.10:
* -a, --archive
* -f, --force
* -i, --interactive
* -l, --link
* -L, --dereference
* -P, --no-dereference
* -R, -r, --recursive
* -s, --symbolic-link
* -v, --verbose
* -H follow command-line symbolic links in SOURCE
* -d same as --no-dereference --preserve=links
* -p same as --preserve=mode,ownership,timestamps
* -c same as --preserve=context
* NOT SUPPORTED IN BBOX:
* long options are not supported (even those above).
* --backup[=CONTROL]
* make a backup of each existing destination file
* -b like --backup but does not accept an argument
* --copy-contents
* copy contents of special files when recursive
* --preserve[=ATTR_LIST]
* preserve attributes (default: mode,ownership,timestamps),
* if possible additional attributes: security context,links,all
* --no-preserve=ATTR_LIST
* --parents
* use full source file name under DIRECTORY
* --remove-destination
* remove each existing destination file before attempting to open
* --sparse=WHEN
* control creation of sparse files
* --strip-trailing-slashes
* remove any trailing slashes from each SOURCE argument
* -S, --suffix=SUFFIX
* override the usual backup suffix
* -t, --target-directory=DIRECTORY
* copy all SOURCE arguments into DIRECTORY
* -T, --no-target-directory
* treat DEST as a normal file
* -u, --update
* copy only when the SOURCE file is newer than the destination
* file or when the destination file is missing
* -x, --one-file-system
* stay on this file system
* -Z, --context=CONTEXT
* (SELinux) set SELinux security context of copy to CONTEXT
*/
argc -= optind;
argv += optind;
flags ^= FILEUTILS_DEREFERENCE; /* the sense of this flag was reversed */
-1
View File
@@ -8,7 +8,6 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <signal.h> /* For FEATURE_DD_SIGNAL_HANDLING */
#include "libbb.h"
/* This is a NOEXEC applet. Be very careful! */
+6 -7
View File
@@ -44,8 +44,7 @@ int df_main(int argc, char **argv)
FILE *mount_table;
struct mntent *mount_entry;
struct statfs s;
static const char ignored_mounts[] ALIGN1 =
"rootfs\0";
static const char ignored_mounts[] ALIGN1 = "rootfs\0";
enum {
OPT_KILO = (1 << 0),
@@ -53,8 +52,8 @@ int df_main(int argc, char **argv)
OPT_ALL = (1 << 2) * ENABLE_FEATURE_DF_FANCY,
OPT_INODE = (1 << 3) * ENABLE_FEATURE_DF_FANCY,
OPT_BSIZE = (1 << 4) * ENABLE_FEATURE_DF_FANCY,
OPT_HUMAN = (1 << 5) * ENABLE_FEATURE_HUMAN_READABLE,
OPT_MEGA = (1 << 6) * ENABLE_FEATURE_HUMAN_READABLE,
OPT_HUMAN = (1 << (2 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE,
OPT_MEGA = (1 << (3 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE,
};
const char *disp_units_hdr = NULL;
char *chp;
@@ -124,7 +123,7 @@ int df_main(int argc, char **argv)
mount_entry = find_mount_point(mount_point, bb_path_mtab_file);
if (!mount_entry) {
bb_error_msg("%s: can't find mount point", mount_point);
SET_ERROR:
set_error:
status = EXIT_FAILURE;
continue;
}
@@ -135,7 +134,7 @@ int df_main(int argc, char **argv)
if (statfs(mount_point, &s) != 0) {
bb_simple_perror_msg(mount_point);
goto SET_ERROR;
goto set_error;
}
if ((s.f_blocks > 0) || !mount_table || (opt & OPT_ALL)) {
@@ -166,7 +165,7 @@ int df_main(int argc, char **argv)
* or leaves device alone if it can't find it */
device = find_block_device("/");
if (!device) {
goto SET_ERROR;
goto set_error;
}
}
#endif
+35 -47
View File
@@ -25,19 +25,28 @@
#include "libbb.h"
enum {
OPT_a_files_too = (1 << 0),
OPT_H_follow_links = (1 << 1),
OPT_k_kbytes = (1 << 2),
OPT_L_follow_links = (1 << 3),
OPT_s_total_norecurse = (1 << 4),
OPT_x_one_FS = (1 << 5),
OPT_d_maxdepth = (1 << 6),
OPT_l_hardlinks = (1 << 7),
OPT_c_total = (1 << 8),
OPT_h_for_humans = (1 << 9),
OPT_m_mbytes = (1 << 10),
};
struct globals {
#if ENABLE_FEATURE_HUMAN_READABLE
unsigned long disp_hr;
#else
unsigned disp_k;
#endif
int max_print_depth;
nlink_t count_hardlinks;
bool status;
bool one_file_system;
int print_files;
int slink_depth;
int du_depth;
dev_t dir_dev;
@@ -72,7 +81,7 @@ static unsigned long du(const char *filename)
return 0;
}
if (G.one_file_system) {
if (option_mask32 & OPT_x_one_FS) {
if (G.du_depth == 0) {
G.dir_dev = statbuf.st_dev;
} else if (G.dir_dev != statbuf.st_dev) {
@@ -83,7 +92,7 @@ static unsigned long du(const char *filename)
sum = statbuf.st_blocks;
if (S_ISLNK(statbuf.st_mode)) {
if (G.slink_depth > G.du_depth) { /* -H or -L */
if (G.slink_depth > G.du_depth) { /* -H or -L */
if (stat(filename, &statbuf) != 0) {
bb_simple_perror_msg(filename);
G.status = EXIT_FAILURE;
@@ -91,12 +100,15 @@ static unsigned long du(const char *filename)
}
sum = statbuf.st_blocks;
if (G.slink_depth == 1) {
G.slink_depth = INT_MAX; /* Convert -H to -L. */
/* Convert -H to -L */
G.slink_depth = INT_MAX;
}
}
}
if (statbuf.st_nlink > G.count_hardlinks) {
if (!(option_mask32 & OPT_l_hardlinks)
&& statbuf.st_nlink > 1
) {
/* Add files/directories with links only once */
if (is_in_ino_dev_hashtable(&statbuf)) {
return 0;
@@ -115,14 +127,8 @@ static unsigned long du(const char *filename)
return sum;
}
newfile = last_char_is(filename, '/');
if (newfile)
*newfile = '\0';
while ((entry = readdir(dir))) {
char *name = entry->d_name;
newfile = concat_subpath_file(filename, name);
newfile = concat_subpath_file(filename, entry->d_name);
if (newfile == NULL)
continue;
++G.du_depth;
@@ -131,8 +137,9 @@ static unsigned long du(const char *filename)
free(newfile);
}
closedir(dir);
} else if (G.du_depth > G.print_files) {
return sum;
} else {
if (!(option_mask32 & OPT_a_files_too) && G.du_depth != 0)
return sum;
}
if (G.du_depth <= G.max_print_depth) {
print(sum, filename);
@@ -145,7 +152,6 @@ int du_main(int argc UNUSED_PARAM, char **argv)
{
unsigned long total;
int slink_depth_save;
bool print_final_total;
unsigned opt;
#if ENABLE_FEATURE_HUMAN_READABLE
@@ -158,7 +164,6 @@ int du_main(int argc UNUSED_PARAM, char **argv)
/* SKIP_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 0;) - G is pre-zeroed */
#endif
G.max_print_depth = INT_MAX;
G.count_hardlinks = 1;
/* Note: SUSv3 specifies that -a and -s options cannot be used together
* in strictly conforming applications. However, it also says that some
@@ -170,16 +175,13 @@ int du_main(int argc UNUSED_PARAM, char **argv)
opt_complementary = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s:d+";
opt = getopt32(argv, "aHkLsx" "d:" "lc" "hm", &G.max_print_depth);
argv += optind;
if (opt & (1 << 9)) {
/* -h opt */
if (opt & OPT_h_for_humans) {
G.disp_hr = 0;
}
if (opt & (1 << 10)) {
/* -m opt */
if (opt & OPT_m_mbytes) {
G.disp_hr = 1024*1024;
}
if (opt & (1 << 2)) {
/* -k opt */
if (opt & OPT_k_kbytes) {
G.disp_hr = 1024;
}
#else
@@ -187,34 +189,20 @@ int du_main(int argc UNUSED_PARAM, char **argv)
opt = getopt32(argv, "aHkLsx" "d:" "lc", &G.max_print_depth);
argv += optind;
#if !ENABLE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
if (opt & (1 << 2)) {
/* -k opt */
if (opt & OPT_k_kbytes) {
G.disp_k = 1;
}
#endif
#endif
if (opt & (1 << 0)) {
/* -a opt */
G.print_files = INT_MAX;
}
if (opt & (1 << 1)) {
/* -H opt */
if (opt & OPT_H_follow_links) {
G.slink_depth = 1;
}
if (opt & (1 << 3)) {
/* -L opt */
if (opt & OPT_L_follow_links) {
G.slink_depth = INT_MAX;
}
if (opt & (1 << 4)) {
/* -s opt */
if (opt & OPT_s_total_norecurse) {
G.max_print_depth = 0;
}
G.one_file_system = opt & (1 << 5); /* -x opt */
if (opt & (1 << 7)) {
/* -l opt */
G.count_hardlinks = MAXINT(nlink_t);
}
print_final_total = opt & (1 << 8); /* -c opt */
/* go through remaining args (if any) */
if (!*argv) {
@@ -228,12 +216,12 @@ int du_main(int argc UNUSED_PARAM, char **argv)
total = 0;
do {
total += du(*argv);
/* otherwise du /dir /dir won't show /dir twice: */
reset_ino_dev_hashtable();
G.slink_depth = slink_depth_save;
} while (*++argv);
if (ENABLE_FEATURE_CLEAN_UP)
reset_ino_dev_hashtable();
if (print_final_total)
if (opt & OPT_c_total)
print(total, "total");
fflush_stdout_and_exit(G.status);
+10 -8
View File
@@ -43,8 +43,6 @@ static const char env_longopts[] ALIGN1 =
int env_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int env_main(int argc UNUSED_PARAM, char **argv)
{
/* cleanenv was static - why? */
char *cleanenv[1];
char **ep;
unsigned opt;
llist_t *unset_env = NULL;
@@ -60,12 +58,16 @@ int env_main(int argc UNUSED_PARAM, char **argv)
++argv;
}
if (opt & 1) {
cleanenv[0] = NULL;
environ = cleanenv;
} else {
while (unset_env) {
unsetenv(llist_pop(&unset_env));
}
clearenv();
}
while (unset_env) {
char *var = llist_pop(&unset_env);
/* This does not handle -uVAR=VAL
* (coreutils _sets_ the variable in that case): */
/*unsetenv(var);*/
/* This does, but uses somewhan undocumented feature that
* putenv("name_without_equal_sign") unsets the variable: */
putenv(var);
}
while (*argv && (strchr(*argv, '=') != NULL)) {
+50 -70
View File
@@ -29,98 +29,78 @@ enum {
OPT_ALL = 1 << 2,
};
static void xputchar(char c)
{
if (putchar(c) < 0)
bb_error_msg_and_die(bb_msg_write_error);
}
#if ENABLE_EXPAND
static void expand(FILE *file, unsigned tab_size, unsigned opt)
static void expand(FILE *file, int tab_size, unsigned opt)
{
char *line;
char *ptr;
int convert;
unsigned pos;
/* Increment tab_size by 1 locally.*/
tab_size++;
tab_size = -tab_size;
while ((line = xmalloc_fgets(file)) != NULL) {
convert = 1;
pos = 0;
ptr = line;
while (*line) {
pos++;
if (*line == '\t' && convert) {
for (; pos < tab_size; pos++) {
xputchar(' ');
}
} else {
if ((opt & OPT_INITIAL) && !isblank(*line)) {
convert = 0;
}
xputchar(*line);
int pos;
unsigned char c;
char *ptr = line;
goto start;
while ((c = *ptr) != '\0') {
if ((opt & OPT_INITIAL) && !isblank(c)) {
fputs(ptr, stdout);
break;
}
if (pos == tab_size) {
pos = 0;
ptr++;
if (c == '\t') {
c = ' ';
while (++pos < 0)
bb_putchar(c);
}
bb_putchar(c);
if (++pos >= 0) {
start:
pos = tab_size;
}
line++;
}
free(ptr);
free(line);
}
}
#endif
#if ENABLE_UNEXPAND
static void unexpand(FILE *file, unsigned int tab_size, unsigned opt)
static void unexpand(FILE *file, unsigned tab_size, unsigned opt)
{
char *line;
char *ptr;
int convert;
int pos;
int i = 0;
unsigned column = 0;
while ((line = xmalloc_fgets(file)) != NULL) {
convert = 1;
pos = 0;
ptr = line;
while (*line) {
while ((*line == ' ' || *line == '\t') && convert) {
pos += (*line == ' ') ? 1 : tab_size;
line++;
char *ptr = line;
unsigned column = 0;
while (*ptr) {
unsigned n;
while (*ptr == ' ') {
column++;
if ((opt & OPT_ALL) && column == tab_size) {
column = 0;
goto put_tab;
}
ptr++;
}
if (pos) {
i = pos / tab_size;
if (i) {
for (; i > 0; i--) {
put_tab:
xputchar('\t');
}
} else {
for (i = pos % tab_size; i > 0; i--) {
xputchar(' ');
}
}
pos = 0;
} else {
if (opt & OPT_INITIAL) {
convert = 0;
}
if (opt & OPT_ALL) {
column++;
}
xputchar(*line);
line++;
if (*ptr == '\t') {
column += tab_size - (column % tab_size);
ptr++;
continue;
}
n = column / tab_size;
column = column % tab_size;
while (n--)
putchar('\t');
if ((opt & OPT_INITIAL) && ptr != line) {
printf("%*s%s", column, "", ptr);
break;
}
n = strcspn(ptr, "\t ");
printf("%*s%.*s", column, "", n, ptr);
ptr += n;
column = (column + n) % tab_size;
}
free(ptr);
free(line);
}
}
#endif
+10 -13
View File
@@ -223,13 +223,13 @@ static VALUE *docolon(VALUE *sv, VALUE *pv)
tostring(pv);
if (pv->u.s[0] == '^') {
bb_error_msg("\
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);
bb_error_msg(
"warning: '%s': using '^' as the first character\n"
"of a basic regular expression is not portable; it is ignored", pv->u.s);
}
memset(&re_buffer, 0, sizeof(re_buffer));
memset(re_regs, 0, sizeof(*re_regs));
memset(re_regs, 0, sizeof(re_regs));
xregcomp(&re_buffer, pv->u.s, 0);
/* expr uses an anchored pattern match, so check that there was a
@@ -238,7 +238,7 @@ of a basic regular expression is not portable; it is being ignored", pv->u.s);
&& re_regs[0].rm_so == 0
) {
/* Were \(...\) used? */
if (re_buffer.re_nsub > 0) {
if (re_buffer.re_nsub > 0 && re_regs[1].rm_so >= 0) {
sv->u.s[re_regs[1].rm_eo] = '\0';
v = str_value(sv->u.s + re_regs[1].rm_so);
} else {
@@ -251,7 +251,7 @@ of a basic regular expression is not portable; it is being ignored", pv->u.s);
else
v = int_value(0);
}
//FIXME: sounds like here is a bit missing: regfree(&re_buffer);
regfree(&re_buffer);
return v;
}
@@ -481,24 +481,21 @@ static VALUE *eval(void)
}
int expr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int expr_main(int argc, char **argv)
int expr_main(int argc UNUSED_PARAM, char **argv)
{
VALUE *v;
if (argc == 1) {
xfunc_error_retval = 2; /* coreutils compat */
G.args = argv + 1;
if (*G.args == NULL) {
bb_error_msg_and_die("too few arguments");
}
G.args = argv + 1;
v = eval();
if (*G.args)
bb_error_msg_and_die("syntax error");
if (v->type == INTEGER)
printf("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i);
else
puts(v->u.s);
fflush_stdout_and_exit(null(v));
}
+4 -4
View File
@@ -40,7 +40,6 @@ int head_main(int argc, char **argv)
int count_bytes = 0;
int header_threshhold = 1;
#endif
FILE *fp;
const char *fmt;
char *p;
@@ -50,7 +49,7 @@ int head_main(int argc, char **argv)
#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
/* Allow legacy syntax of an initial numeric option without -n. */
if (argc > 1 && argv[1][0] == '-'
if (argv[1] && argv[1][0] == '-'
&& isdigit(argv[1][1])
) {
--argc;
@@ -79,7 +78,6 @@ int head_main(int argc, char **argv)
#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
GET_COUNT:
#endif
#if !ENABLE_FEATURE_FANCY_HEAD
count = xatoul(p);
#else
@@ -128,10 +126,12 @@ int head_main(int argc, char **argv)
putchar(c);
}
if (fclose_if_not_stdin(fp)) {
bb_simple_perror_msg(*argv); /* Avoid multibyte problems. */
bb_simple_perror_msg(*argv);
retval = EXIT_FAILURE;
}
die_if_ferror_stdout();
} else {
retval = EXIT_FAILURE;
}
fmt = header_fmt_str;
} while (*++argv);
+12 -10
View File
@@ -17,6 +17,14 @@
#include "libbb.h"
#if !ENABLE_USE_BB_PWD_GRP
#if defined(__UCLIBC_MAJOR__) && (__UCLIBC_MAJOR__ == 0)
#if (__UCLIBC_MINOR__ < 9) || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 30)
#error "Sorry, you need at least uClibc version 0.9.30 for id applet to build"
#endif
#endif
#endif
enum {
PRINT_REAL = (1 << 0),
NAME_NOT_NUMBER = (1 << 1),
@@ -28,12 +36,8 @@ enum {
#endif
};
static int print_common(unsigned id,
char* FAST_FUNC bb_getXXXid(char *name, int bufsize, long uid),
const char *prefix)
static int print_common(unsigned id, const char *name, const char *prefix)
{
const char *name = bb_getXXXid(NULL, 0, id);
if (prefix) {
printf("%s", prefix);
}
@@ -57,12 +61,12 @@ static int print_common(unsigned id,
static int print_group(gid_t id, const char *prefix)
{
return print_common(id, bb_getgrgid, prefix);
return print_common(id, gid2group(id), prefix);
}
static int print_user(uid_t id, const char *prefix)
{
return print_common(id, bb_getpwuid, prefix);
return print_common(id, uid2uname(id), prefix);
}
/* On error set *n < 0 and return >= 0
@@ -120,9 +124,7 @@ int id_main(int argc UNUSED_PARAM, char **argv)
username = argv[optind];
if (username) {
struct passwd *p = getpwnam(username);
if (!p)
bb_error_msg_and_die("unknown user %s", username);
struct passwd *p = xgetpwnam(username);
euid = ruid = p->pw_uid;
egid = rgid = p->pw_gid;
} else {
+3
View File
@@ -1,4 +1,7 @@
/* vi: set sw=4 ts=4: */
/*
* Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
+3 -7
View File
@@ -4,11 +4,9 @@
*/
#ifndef COREUTILS_H
#define COREUTILS_H 1
#define COREUTILS_H 1
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
typedef int (*stat_func)(const char *fn, struct stat *ps);
@@ -17,8 +15,6 @@ int cp_mv_stat(const char *fn, struct stat *fn_stat) FAST_FUNC;
mode_t getopt_mk_fifo_nod(char **argv) FAST_FUNC;
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif
+283 -209
View File
@@ -6,7 +6,7 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/*
/* [date unknown. Perhaps before year 2000]
* To achieve a small memory footprint, this version of 'ls' doesn't do any
* file sorting, and only has the most essential command line switches
* (i.e., the ones I couldn't live without :-) All features which involve
@@ -18,8 +18,7 @@
*
* KNOWN BUGS:
* 1. ls -l of a directory doesn't give "total <blocks>" header
* 2. ls of a symlink to a directory doesn't list directory contents
* 3. hidden files can make column width too large
* 2. hidden files can make column width too large
*
* NON-OPTIMAL BEHAVIOUR:
* 1. autowidth reads directories twice
@@ -27,6 +26,9 @@
* appended, there's no need to stat each one
* PORTABILITY:
* 1. requires lstat (BSD) - how do you do it without?
*
* [2009-03]
* ls sorts listing now, and supports almost all options.
*/
#include "libbb.h"
@@ -38,6 +40,21 @@
/* This is a NOEXEC applet. Be very careful! */
#if ENABLE_FTPD
/* ftpd uses ls, and without timestamps Mozilla won't understand
* ftpd's LIST output.
*/
# undef CONFIG_FEATURE_LS_TIMESTAMPS
# undef ENABLE_FEATURE_LS_TIMESTAMPS
# undef USE_FEATURE_LS_TIMESTAMPS
# undef SKIP_FEATURE_LS_TIMESTAMPS
# define CONFIG_FEATURE_LS_TIMESTAMPS 1
# define ENABLE_FEATURE_LS_TIMESTAMPS 1
# define USE_FEATURE_LS_TIMESTAMPS(...) __VA_ARGS__
# define SKIP_FEATURE_LS_TIMESTAMPS(...)
#endif
enum {
TERMINAL_WIDTH = 80, /* use 79 if terminal has linefold bug */
@@ -59,7 +76,7 @@ LIST_ID_NAME = 1 << 4,
LIST_ID_NUMERIC = 1 << 5,
LIST_CONTEXT = 1 << 6,
LIST_SIZE = 1 << 7,
LIST_DEV = 1 << 8,
//LIST_DEV = 1 << 8, - unused, synonym to LIST_SIZE
LIST_DATE_TIME = 1 << 9,
LIST_FULLTIME = 1 << 10,
LIST_FILENAME = 1 << 11,
@@ -110,13 +127,102 @@ SPLIT_SUBDIR = 2,
};
#define TYPEINDEX(mode) (((mode) >> 12) & 0x0f)
#define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)])
#define APPCHAR(mode) ("\0|\0\0/\0\0\0\0\0@\0=\0\0\0" [TYPEINDEX(mode)])
#define COLOR(mode) ("\000\043\043\043\042\000\043\043"\
"\000\000\044\000\043\000\000\040" [TYPEINDEX(mode)])
#define ATTR(mode) ("\00\00\01\00\01\00\01\00"\
"\00\00\01\00\01\00\00\01" [TYPEINDEX(mode)])
/* "[-]Cadil1", POSIX mandated options, busybox always supports */
/* "[-]gnsx", POSIX non-mandated options, busybox always supports */
/* "[-]Q" GNU option? busybox always supports */
/* "[-]Ak" GNU options, busybox always supports */
/* "[-]FLRctur", POSIX mandated options, busybox optionally supports */
/* "[-]p", POSIX non-mandated options, busybox optionally supports */
/* "[-]SXvThw", GNU options, busybox optionally supports */
/* "[-]K", SELinux mandated options, busybox optionally supports */
/* "[-]e", I think we made this one up */
static const char ls_options[] ALIGN1 =
"Cadil1gnsxQAk" /* 13 opts, total 13 */
USE_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */
USE_FEATURE_LS_SORTFILES("SXrv") /* 4, 21 */
USE_FEATURE_LS_FILETYPES("Fp") /* 2, 23 */
USE_FEATURE_LS_FOLLOWLINKS("L") /* 1, 24 */
USE_FEATURE_LS_RECURSIVE("R") /* 1, 25 */
USE_FEATURE_HUMAN_READABLE("h") /* 1, 26 */
USE_SELINUX("K") /* 1, 27 */
USE_SELINUX("Z") /* 1, 28 */
USE_FEATURE_AUTOWIDTH("T:w:") /* 2, 30 */
;
enum {
//OPT_C = (1 << 0),
//OPT_a = (1 << 1),
//OPT_d = (1 << 2),
//OPT_i = (1 << 3),
//OPT_l = (1 << 4),
//OPT_1 = (1 << 5),
OPT_g = (1 << 6),
//OPT_n = (1 << 7),
//OPT_s = (1 << 8),
//OPT_x = (1 << 9),
OPT_Q = (1 << 10),
//OPT_A = (1 << 11),
//OPT_k = (1 << 12),
};
enum {
LIST_MASK_TRIGGER = 0,
STYLE_MASK_TRIGGER = STYLE_MASK,
DISP_MASK_TRIGGER = DISP_ROWS,
SORT_MASK_TRIGGER = SORT_MASK,
};
/* TODO: simple toggles may be stored as OPT_xxx bits instead */
static const unsigned opt_flags[] = {
LIST_SHORT | STYLE_COLUMNS, /* C */
DISP_HIDDEN | DISP_DOT, /* a */
DISP_NOLIST, /* d */
LIST_INO, /* i */
LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */
LIST_SHORT | STYLE_SINGLE, /* 1 */
0, /* g (don't show group) - handled via OPT_g */
LIST_ID_NUMERIC, /* n */
LIST_BLOCKS, /* s */
DISP_ROWS, /* x */
0, /* Q (quote filename) - handled via OPT_Q */
DISP_HIDDEN, /* A */
ENABLE_SELINUX * LIST_CONTEXT, /* k (ignored if !SELINUX) */
#if ENABLE_FEATURE_LS_TIMESTAMPS
TIME_CHANGE | (ENABLE_FEATURE_LS_SORTFILES * SORT_CTIME), /* c */
LIST_FULLTIME, /* e */
ENABLE_FEATURE_LS_SORTFILES * SORT_MTIME, /* t */
TIME_ACCESS | (ENABLE_FEATURE_LS_SORTFILES * SORT_ATIME), /* u */
#endif
#if ENABLE_FEATURE_LS_SORTFILES
SORT_SIZE, /* S */
SORT_EXT, /* X */
SORT_REVERSE, /* r */
SORT_VERSION, /* v */
#endif
#if ENABLE_FEATURE_LS_FILETYPES
LIST_FILETYPE | LIST_EXEC, /* F */
LIST_FILETYPE, /* p */
#endif
#if ENABLE_FEATURE_LS_FOLLOWLINKS
FOLLOW_LINKS, /* L */
#endif
#if ENABLE_FEATURE_LS_RECURSIVE
DISP_RECURSIVE, /* R */
#endif
#if ENABLE_FEATURE_HUMAN_READABLE
LS_DISP_HR, /* h */
#endif
#if ENABLE_SELINUX
LIST_MODEBITS|LIST_NLINKS|LIST_CONTEXT|LIST_SIZE|LIST_DATE_TIME, /* K */
#endif
#if ENABLE_SELINUX
LIST_MODEBITS|LIST_ID_NAME|LIST_CONTEXT, /* Z */
#endif
(1U<<31)
/* options after Z are not processed through opt_flags:
* T, w - ignored
*/
};
/*
* a directory entry and its stat info are stored here
@@ -230,18 +336,46 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f
return cur;
}
/* FYI type values: 1:fifo 2:char 4:dir 6:blk 8:file 10:link 12:socket
* (various wacky OSes: 13:Sun door 14:BSD whiteout 5:XENIX named file
* 3/7:multiplexed char/block device)
* and we use 0 for unknown and 15 for executables (see below) */
#define TYPEINDEX(mode) (((mode) >> 12) & 0x0f)
#define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)])
#define APPCHAR(mode) ("\0|\0\0/\0\0\0\0\0@\0=\0\0\0" [TYPEINDEX(mode)])
/* 036 black foreground 050 black background
037 red foreground 051 red background
040 green foreground 052 green background
041 brown foreground 053 brown background
042 blue foreground 054 blue background
043 magenta (purple) foreground 055 magenta background
044 cyan (light blue) foreground 056 cyan background
045 gray foreground 057 white background
*/
#define COLOR(mode) ( \
/*un fi chr dir blk file link sock exe */ \
"\037\043\043\045\042\045\043\043\000\045\044\045\043\045\045\040" \
[TYPEINDEX(mode)])
/* Select normal (0) [actually "reset all"] or bold (1)
* (other attributes are 2:dim 4:underline 5:blink 7:reverse,
* let's use 7 for "impossible" types, just for fun)
* Note: coreutils 6.9 uses inverted red for setuid binaries.
*/
#define ATTR(mode) ( \
/*un fi chr dir blk file link sock exe */ \
"\01\00\01\07\01\07\01\07\00\07\01\07\01\07\07\01" \
[TYPEINDEX(mode)])
#if ENABLE_FEATURE_LS_COLOR
/* mode of zero is interpreted as "unknown" (stat failed) */
static char fgcolor(mode_t mode)
{
/* Check wheter the file is existing (if so, color it red!) */
if (errno == ENOENT)
return '\037';
if (S_ISREG(mode) && (mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
return COLOR(0xF000); /* File is executable ... */
return COLOR(mode);
}
static char bgcolor(mode_t mode)
static char bold(mode_t mode)
{
if (S_ISREG(mode) && (mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
return ATTR(0xF000); /* File is executable ... */
@@ -264,6 +398,7 @@ static char append_char(mode_t mode)
}
#endif
#define countdirs(A, B) count_dirs((A), (B), 1)
#define countsubdirs(A, B) count_dirs((A), (B), 0)
static int count_dirs(struct dnode **dn, int nfiles, int notsubdirs)
@@ -573,10 +708,41 @@ static struct dnode **list_dir(const char *path)
}
static int print_name(const char *name)
{
if (option_mask32 & OPT_Q) {
#if ENABLE_FEATURE_ASSUME_UNICODE
int len = 2 + mbstrlen(name);
#else
int len = 2;
#endif
putchar('"');
while (*name) {
if (*name == '"') {
putchar('\\');
len++;
}
putchar(*name++);
if (!ENABLE_FEATURE_ASSUME_UNICODE)
len++;
}
putchar('"');
return len;
}
/* No -Q: */
#if ENABLE_FEATURE_ASSUME_UNICODE
fputs(name, stdout);
return mbstrlen(name);
#else
return printf("%s", name);
#endif
}
static int list_single(const struct dnode *dn)
{
int i, column = 0;
int column = 0;
char *lpath = lpath; /* for compiler */
#if ENABLE_FEATURE_LS_TIMESTAMPS
char *filetime;
time_t ttime, age;
@@ -601,219 +767,128 @@ static int list_single(const struct dnode *dn)
append = append_char(dn->dstat.st_mode);
#endif
for (i = 0; i <= 31; i++) {
switch (all_fmt & (1 << i)) {
case LIST_INO:
column += printf("%7ld ", (long) dn->dstat.st_ino);
break;
case LIST_BLOCKS:
column += printf("%4"OFF_FMT"d ", (off_t) dn->dstat.st_blocks >> 1);
break;
case LIST_MODEBITS:
column += printf("%-10s ", (char *) bb_mode_string(dn->dstat.st_mode));
break;
case LIST_NLINKS:
column += printf("%4ld ", (long) dn->dstat.st_nlink);
break;
case LIST_ID_NAME:
/* Do readlink early, so that if it fails, error message
* does not appear *inside* of the "ls -l" line */
if (all_fmt & LIST_SYMLINK)
if (S_ISLNK(dn->dstat.st_mode))
lpath = xmalloc_readlink_or_warn(dn->fullname);
if (all_fmt & LIST_INO)
column += printf("%7lu ", (long) dn->dstat.st_ino);
if (all_fmt & LIST_BLOCKS)
column += printf("%4"OFF_FMT"u ", (off_t) dn->dstat.st_blocks >> 1);
if (all_fmt & LIST_MODEBITS)
column += printf("%-10s ", (char *) bb_mode_string(dn->dstat.st_mode));
if (all_fmt & LIST_NLINKS)
column += printf("%4lu ", (long) dn->dstat.st_nlink);
#if ENABLE_FEATURE_LS_USERNAME
printf("%-8.8s %-8.8s",
if (all_fmt & LIST_ID_NAME) {
if (option_mask32 & OPT_g) {
column += printf("%-8.8s",
get_cached_username(dn->dstat.st_uid));
} else {
column += printf("%-8.8s %-8.8s",
get_cached_username(dn->dstat.st_uid),
get_cached_groupname(dn->dstat.st_gid));
column += 17;
break;
}
}
#endif
case LIST_ID_NUMERIC:
column += printf("%-8d %-8d", dn->dstat.st_uid, dn->dstat.st_gid);
break;
case LIST_SIZE:
case LIST_DEV:
if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) {
column += printf("%4d, %3d ", (int) major(dn->dstat.st_rdev),
(int) minor(dn->dstat.st_rdev));
if (all_fmt & LIST_ID_NUMERIC) {
if (option_mask32 & OPT_g)
column += printf("%-8u", (int) dn->dstat.st_uid);
else
column += printf("%-8u %-8u",
(int) dn->dstat.st_uid,
(int) dn->dstat.st_gid);
}
if (all_fmt & (LIST_SIZE /*|LIST_DEV*/ )) {
if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) {
column += printf("%4u, %3u ",
(int) major(dn->dstat.st_rdev),
(int) minor(dn->dstat.st_rdev));
} else {
if (all_fmt & LS_DISP_HR) {
column += printf("%9s ",
make_human_readable_str(dn->dstat.st_size, 1, 0));
} else {
if (all_fmt & LS_DISP_HR) {
column += printf("%9s ",
make_human_readable_str(dn->dstat.st_size, 1, 0));
} else {
column += printf("%9"OFF_FMT"d ", (off_t) dn->dstat.st_size);
}
column += printf("%9"OFF_FMT"u ", (off_t) dn->dstat.st_size);
}
break;
}
}
#if ENABLE_FEATURE_LS_TIMESTAMPS
case LIST_FULLTIME:
printf("%24.24s ", filetime);
column += 25;
break;
case LIST_DATE_TIME:
if ((all_fmt & LIST_FULLTIME) == 0) {
/* current_time_t ~== time(NULL) */
age = current_time_t - ttime;
printf("%6.6s ", filetime + 4);
if (age < 3600L * 24 * 365 / 2 && age > -15 * 60) {
/* hh:mm if less than 6 months old */
printf("%5.5s ", filetime + 11);
} else {
printf(" %4.4s ", filetime + 20);
}
column += 13;
if (all_fmt & LIST_FULLTIME)
column += printf("%24.24s ", filetime);
if (all_fmt & LIST_DATE_TIME)
if ((all_fmt & LIST_FULLTIME) == 0) {
/* current_time_t ~== time(NULL) */
age = current_time_t - ttime;
printf("%6.6s ", filetime + 4);
if (age < 3600L * 24 * 365 / 2 && age > -15 * 60) {
/* hh:mm if less than 6 months old */
printf("%5.5s ", filetime + 11);
} else {
printf(" %4.4s ", filetime + 20);
}
break;
column += 13;
}
#endif
#if ENABLE_SELINUX
case LIST_CONTEXT:
{
char context[80];
int len = 0;
if (dn->sid) {
/* I assume sid initilized with NULL */
len = strlen(dn->sid) + 1;
safe_strncpy(context, dn->sid, len);
freecon(dn->sid);
} else {
safe_strncpy(context, "unknown", 8);
}
printf("%-32s ", context);
column += MAX(33, len);
}
break;
if (all_fmt & LIST_CONTEXT) {
column += printf("%-32s ", dn->sid ? dn->sid : "unknown");
freecon(dn->sid);
}
#endif
case LIST_FILENAME:
errno = 0;
if (all_fmt & LIST_FILENAME) {
#if ENABLE_FEATURE_LS_COLOR
if (show_color && !lstat(dn->fullname, &info)) {
printf("\033[%d;%dm", bgcolor(info.st_mode),
fgcolor(info.st_mode));
if (show_color) {
info.st_mode = 0; /* for fgcolor() */
lstat(dn->fullname, &info);
printf("\033[%u;%um", bold(info.st_mode),
fgcolor(info.st_mode));
}
#endif
column += print_name(dn->name);
if (show_color) {
printf("\033[0m");
}
}
if (all_fmt & LIST_SYMLINK) {
if (S_ISLNK(dn->dstat.st_mode) && lpath) {
printf(" -> ");
#if ENABLE_FEATURE_LS_FILETYPES || ENABLE_FEATURE_LS_COLOR
#if ENABLE_FEATURE_LS_COLOR
info.st_mode = 0; /* for fgcolor() */
#endif
if (stat(dn->fullname, &info) == 0) {
append = append_char(info.st_mode);
}
#endif
#if ENABLE_FEATURE_ASSUME_UNICODE
printf("%s", dn->name);
column += mbstrlen(dn->name);
#else
column += printf("%s", dn->name);
#if ENABLE_FEATURE_LS_COLOR
if (show_color) {
printf("\033[%u;%um", bold(info.st_mode),
fgcolor(info.st_mode));
}
#endif
column += print_name(lpath) + 4;
if (show_color) {
printf("\033[0m");
}
break;
case LIST_SYMLINK:
if (S_ISLNK(dn->dstat.st_mode)) {
char *lpath = xmalloc_readlink_or_warn(dn->fullname);
if (!lpath) break;
printf(" -> ");
#if ENABLE_FEATURE_LS_FILETYPES || ENABLE_FEATURE_LS_COLOR
if (!stat(dn->fullname, &info)) {
append = append_char(info.st_mode);
}
#endif
#if ENABLE_FEATURE_LS_COLOR
if (show_color) {
errno = 0;
printf("\033[%d;%dm", bgcolor(info.st_mode),
fgcolor(info.st_mode));
}
#endif
column += printf("%s", lpath) + 4;
if (show_color) {
printf("\033[0m");
}
free(lpath);
}
break;
#if ENABLE_FEATURE_LS_FILETYPES
case LIST_FILETYPE:
if (append) {
putchar(append);
column++;
}
break;
#endif
free(lpath);
}
}
#if ENABLE_FEATURE_LS_FILETYPES
if (all_fmt & LIST_FILETYPE) {
if (append) {
putchar(append);
column++;
}
}
#endif
return column;
}
/* "[-]Cadil1", POSIX mandated options, busybox always supports */
/* "[-]gnsx", POSIX non-mandated options, busybox always supports */
/* "[-]Ak" GNU options, busybox always supports */
/* "[-]FLRctur", POSIX mandated options, busybox optionally supports */
/* "[-]p", POSIX non-mandated options, busybox optionally supports */
/* "[-]SXvThw", GNU options, busybox optionally supports */
/* "[-]K", SELinux mandated options, busybox optionally supports */
/* "[-]e", I think we made this one up */
static const char ls_options[] ALIGN1 =
"Cadil1gnsxAk"
USE_FEATURE_LS_TIMESTAMPS("cetu")
USE_FEATURE_LS_SORTFILES("SXrv")
USE_FEATURE_LS_FILETYPES("Fp")
USE_FEATURE_LS_FOLLOWLINKS("L")
USE_FEATURE_LS_RECURSIVE("R")
USE_FEATURE_HUMAN_READABLE("h")
USE_SELINUX("K")
USE_FEATURE_AUTOWIDTH("T:w:")
USE_SELINUX("Z");
enum {
LIST_MASK_TRIGGER = 0,
STYLE_MASK_TRIGGER = STYLE_MASK,
DISP_MASK_TRIGGER = DISP_ROWS,
SORT_MASK_TRIGGER = SORT_MASK,
};
static const unsigned opt_flags[] = {
LIST_SHORT | STYLE_COLUMNS, /* C */
DISP_HIDDEN | DISP_DOT, /* a */
DISP_NOLIST, /* d */
LIST_INO, /* i */
LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */
LIST_SHORT | STYLE_SINGLE, /* 1 */
0, /* g - ingored */
LIST_ID_NUMERIC, /* n */
LIST_BLOCKS, /* s */
DISP_ROWS, /* x */
DISP_HIDDEN, /* A */
ENABLE_SELINUX * LIST_CONTEXT, /* k (ignored if !SELINUX) */
#if ENABLE_FEATURE_LS_TIMESTAMPS
TIME_CHANGE | (ENABLE_FEATURE_LS_SORTFILES * SORT_CTIME), /* c */
LIST_FULLTIME, /* e */
ENABLE_FEATURE_LS_SORTFILES * SORT_MTIME, /* t */
TIME_ACCESS | (ENABLE_FEATURE_LS_SORTFILES * SORT_ATIME), /* u */
#endif
#if ENABLE_FEATURE_LS_SORTFILES
SORT_SIZE, /* S */
SORT_EXT, /* X */
SORT_REVERSE, /* r */
SORT_VERSION, /* v */
#endif
#if ENABLE_FEATURE_LS_FILETYPES
LIST_FILETYPE | LIST_EXEC, /* F */
LIST_FILETYPE, /* p */
#endif
#if ENABLE_FEATURE_LS_FOLLOWLINKS
FOLLOW_LINKS, /* L */
#endif
#if ENABLE_FEATURE_LS_RECURSIVE
DISP_RECURSIVE, /* R */
#endif
#if ENABLE_FEATURE_HUMAN_READABLE
LS_DISP_HR, /* h */
#endif
#if ENABLE_SELINUX
LIST_MODEBITS|LIST_NLINKS|LIST_CONTEXT|LIST_SIZE|LIST_DATE_TIME, /* K */
#endif
#if ENABLE_FEATURE_AUTOWIDTH
0, 0, /* T, w - ignored */
#endif
#if ENABLE_SELINUX
LIST_MODEBITS|LIST_ID_NAME|LIST_CONTEXT, /* Z */
#endif
(1U<<31)
};
/* colored LS support by JaWi, janwillem.janssen@lxtreme.nl */
#if ENABLE_FEATURE_LS_COLOR
/* long option entry used only for --color, which has no short option
@@ -824,7 +899,6 @@ static const char ls_color_opt[] ALIGN1 =
#endif
int ls_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int ls_main(int argc UNUSED_PARAM, char **argv)
{
struct dnode **dnd;
@@ -932,8 +1006,8 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
dn = NULL;
nfiles = 0;
do {
/* ls w/o -l follows links on command line */
cur = my_stat(*argv, *argv, !(all_fmt & STYLE_LONG));
/* NB: follow links on command line unless -l or -s */
cur = my_stat(*argv, *argv, !(all_fmt & (STYLE_LONG|LIST_BLOCKS)));
argv++;
if (!cur)
continue;
+26 -9
View File
@@ -8,7 +8,13 @@
#include "libbb.h"
typedef enum { HASH_SHA1, HASH_MD5 } hash_algo_t;
typedef enum {
/* 4th letter of applet_name is... */
HASH_MD5 = 's', /* "md5>s<um" */
HASH_SHA1 = '1',
HASH_SHA256 = '2',
HASH_SHA512 = '5',
} hash_algo_t;
#define FLAG_SILENT 1
#define FLAG_CHECK 2
@@ -24,10 +30,12 @@ static unsigned char *hash_bin_to_hex(unsigned char *hash_value,
return (unsigned char *)hex_value;
}
static uint8_t *hash_file(const char *filename, hash_algo_t hash_algo)
static uint8_t *hash_file(const char *filename /*, hash_algo_t hash_algo*/)
{
int src_fd, hash_len, count;
union _ctx_ {
sha512_ctx_t sha512;
sha256_ctx_t sha256;
sha1_ctx_t sha1;
md5_ctx_t md5;
} context;
@@ -35,6 +43,7 @@ static uint8_t *hash_file(const char *filename, hash_algo_t hash_algo)
RESERVE_CONFIG_UBUFFER(in_buf, 4096);
void FAST_FUNC (*update)(const void*, size_t, void*);
void FAST_FUNC (*final)(void*, void*);
hash_algo_t hash_algo = applet_name[3];
src_fd = open_or_warn_stdin(filename);
if (src_fd < 0) {
@@ -42,16 +51,26 @@ static uint8_t *hash_file(const char *filename, hash_algo_t hash_algo)
}
/* figure specific hash algorithims */
if (ENABLE_MD5SUM && hash_algo==HASH_MD5) {
if (ENABLE_MD5SUM && hash_algo == HASH_MD5) {
md5_begin(&context.md5);
update = (void*)md5_hash;
final = (void*)md5_end;
hash_len = 16;
} else if (ENABLE_SHA1SUM && hash_algo==HASH_SHA1) {
} else if (ENABLE_SHA1SUM && hash_algo == HASH_SHA1) {
sha1_begin(&context.sha1);
update = (void*)sha1_hash;
final = (void*)sha1_end;
hash_len = 20;
} else if (ENABLE_SHA256SUM && hash_algo == HASH_SHA256) {
sha256_begin(&context.sha256);
update = (void*)sha256_hash;
final = (void*)sha256_end;
hash_len = 32;
} else if (ENABLE_SHA512SUM && hash_algo == HASH_SHA512) {
sha512_begin(&context.sha512);
update = (void*)sha512_hash;
final = (void*)sha512_end;
hash_len = 64;
} else {
bb_error_msg_and_die("algorithm not supported");
}
@@ -80,9 +99,7 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
int return_value = EXIT_SUCCESS;
uint8_t *hash_value;
unsigned flags;
hash_algo_t hash_algo = ENABLE_MD5SUM
? (ENABLE_SHA1SUM ? (applet_name[0] == 'm' ? HASH_MD5 : HASH_SHA1) : HASH_MD5)
: HASH_SHA1;
/*hash_algo_t hash_algo = applet_name[3];*/
if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK)
flags = getopt32(argv, "scw");
@@ -136,7 +153,7 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
*filename_ptr = '\0';
filename_ptr += 2;
hash_value = hash_file(filename_ptr, hash_algo);
hash_value = hash_file(filename_ptr /*, hash_algo*/);
if (hash_value && (strcmp((char*)hash_value, line) == 0)) {
if (!(flags & FLAG_SILENT))
@@ -162,7 +179,7 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
*/
} else {
do {
hash_value = hash_file(*argv, hash_algo);
hash_value = hash_file(*argv/*, hash_algo*/);
if (hash_value == NULL) {
return_value = EXIT_FAILURE;
} else {
+5 -1
View File
@@ -13,6 +13,8 @@
int printenv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int printenv_main(int argc UNUSED_PARAM, char **argv)
{
int exit_code = EXIT_SUCCESS;
/* no variables specified, show whole env */
if (!argv[1]) {
int e = 0;
@@ -26,8 +28,10 @@ int printenv_main(int argc UNUSED_PARAM, char **argv)
env = getenv(arg);
if (env)
puts(env);
else
exit_code = EXIT_FAILURE;
}
}
fflush_stdout_and_exit(EXIT_SUCCESS);
fflush_stdout_and_exit(exit_code);
}
+76 -57
View File
@@ -75,13 +75,13 @@ static int multiconvert(const char *arg, void *result, converter convert)
return 0;
}
static void FAST_FUNC conv_strtoul(const char *arg, void *result)
static void FAST_FUNC conv_strtoull(const char *arg, void *result)
{
*(unsigned long*)result = bb_strtoul(arg, NULL, 0);
*(unsigned long long*)result = bb_strtoull(arg, NULL, 0);
}
static void FAST_FUNC conv_strtol(const char *arg, void *result)
static void FAST_FUNC conv_strtoll(const char *arg, void *result)
{
*(long*)result = bb_strtol(arg, NULL, 0);
*(long long*)result = bb_strtoll(arg, NULL, 0);
}
static void FAST_FUNC conv_strtod(const char *arg, void *result)
{
@@ -96,17 +96,17 @@ static void FAST_FUNC conv_strtod(const char *arg, void *result)
}
/* Callers should check errno to detect errors */
static unsigned long my_xstrtoul(const char *arg)
static unsigned long long my_xstrtoull(const char *arg)
{
unsigned long result;
if (multiconvert(arg, &result, conv_strtoul))
unsigned long long result;
if (multiconvert(arg, &result, conv_strtoull))
result = 0;
return result;
}
static long my_xstrtol(const char *arg)
static long long my_xstrtoll(const char *arg)
{
long result;
if (multiconvert(arg, &result, conv_strtol))
long long result;
if (multiconvert(arg, &result, conv_strtoll))
result = 0;
return result;
}
@@ -134,61 +134,63 @@ static void print_direc(char *format, unsigned fmt_length,
int field_width, int precision,
const char *argument)
{
long lv;
long long llv;
double dv;
char saved;
char *have_prec, *have_width;
saved = format[fmt_length];
format[fmt_length] = '\0';
have_prec = strstr(format, ".*");
have_width = strchr(format, '*');
if (have_width - 1 == have_prec)
have_width = NULL;
saved = format[fmt_length];
format[fmt_length] = '\0';
switch (format[fmt_length - 1]) {
case 'c':
printf(format, *argument);
break;
case 'd':
case 'i':
lv = my_xstrtol(argument);
llv = my_xstrtoll(argument);
print_long:
/* if (errno) return; - see comment at the top */
if (!have_width) {
if (!have_prec)
printf(format, lv);
printf(format, llv);
else
printf(format, precision, lv);
printf(format, precision, llv);
} else {
if (!have_prec)
printf(format, field_width, lv);
printf(format, field_width, llv);
else
printf(format, field_width, precision, lv);
printf(format, field_width, precision, llv);
}
break;
case 'o':
case 'u':
case 'x':
case 'X':
lv = my_xstrtoul(argument);
llv = my_xstrtoull(argument);
/* cheat: unsigned long and long have same width, so... */
goto print_long;
case 's':
/* Are char* and long the same? (true for most arches) */
if (sizeof(argument) == sizeof(lv)) {
lv = (long)(ptrdiff_t)argument;
/* Are char* and long long the same? */
if (sizeof(argument) == sizeof(llv)) {
llv = (long long)(ptrdiff_t)argument;
goto print_long;
} else { /* Hope compiler will optimize it out */
} else {
/* Hope compiler will optimize it out by moving call
* instruction after the ifs... */
if (!have_width) {
if (!have_prec)
printf(format, argument);
printf(format, argument, /*unused:*/ argument, argument);
else
printf(format, precision, argument);
printf(format, precision, argument, /*unused:*/ argument);
} else {
if (!have_prec)
printf(format, field_width, argument);
printf(format, field_width, argument, /*unused:*/ argument);
else
printf(format, field_width, precision, argument);
}
@@ -286,38 +288,48 @@ static char **print_formatted(char *f, char **argv)
}
}
}
/* Remove size modifiers - "%Ld" would try to printf
* long long, we pass long, and it spews garbage */
if ((*f | 0x20) == 'l' || *f == 'h' || *f == 'z') {
/* Remove "lLhz" size modifiers, repeatedly.
* bash does not like "%lld", but coreutils
* would happily take even "%Llllhhzhhzd"!
* We will be permissive like coreutils */
while ((*f | 0x20) == 'l' || *f == 'h' || *f == 'z') {
overlapping_strcpy(f, f + 1);
}
//FIXME: actually, the same happens with bare "%d":
//it printfs an int, but we pass long!
//What saves us is that on most arches stack slot
//is pointer-sized -> long-sized -> ints are promoted to longs
// for variadic functions -> printf("%d", int_v) is in reality
// indistinqushable from printf("%d", long_v) ->
// since printf("%d", int_v) works, printf("%d", long_v) has to work.
//But "clean" solution would be to add "l" to d,i,o,x,X.
//Probably makes sense to go all the way to "ll" then.
//Coreutils support long long-sized arguments.
/* needed - try "printf %" without it */
if (!strchr("diouxXfeEgGcs", *f)) {
bb_error_msg("%s: invalid format", direc_start);
/* causes main() to exit with error */
return saved_argv - 1;
/* Add "ll" if integer modifier, then print */
{
static const char format_chars[] ALIGN1 = "diouxXfeEgGcs";
char *p = strchr(format_chars, *f);
/* needed - try "printf %" without it */
if (p == NULL) {
bb_error_msg("%s: invalid format", direc_start);
/* causes main() to exit with error */
return saved_argv - 1;
}
++direc_length;
if (p - format_chars <= 5) {
/* it is one of "diouxX" */
p = xmalloc(direc_length + 3);
memcpy(p, direc_start, direc_length);
p[direc_length + 1] = p[direc_length - 1];
p[direc_length - 1] = 'l';
p[direc_length] = 'l';
//bb_error_msg("<%s>", p);
direc_length += 2;
direc_start = p;
} else {
p = NULL;
}
if (*argv) {
print_direc(direc_start, direc_length, field_width,
precision, *argv);
++argv;
} else {
print_direc(direc_start, direc_length, field_width,
precision, "");
}
free(p);
}
++direc_length;
if (*argv) {
print_direc(direc_start, direc_length, field_width,
precision, *argv);
++argv;
} else {
print_direc(direc_start, direc_length, field_width,
precision, "");
}
/* if (errno) return saved_argv - 1; */
break;
case '\\':
if (*++f == 'c') {
@@ -359,8 +371,15 @@ int printf_main(int argc UNUSED_PARAM, char **argv)
* We will mimic coreutils. */
if (argv[1] && argv[1][0] == '-' && argv[1][1] == '-' && !argv[1][2])
argv++;
if (!argv[1])
if (!argv[1]) {
if (ENABLE_ASH_BUILTIN_PRINTF
&& applet_name[0] != 'p'
) {
bb_error_msg("usage: printf FORMAT [ARGUMENT...]");
return 2; /* bash compat */
}
bb_show_usage();
}
format = argv[1];
argv2 = argv + 2;
+28 -5
View File
@@ -6,9 +6,31 @@
*
* Licensed under GPL v2 or later, see file LICENSE in this tarball for details.
*/
#include "libbb.h"
/*
* # readlink --version
* readlink (GNU coreutils) 6.10
* # readlink --help
* -f, --canonicalize
* canonicalize by following every symlink in
* every component of the given name recursively;
* all but the last component must exist
* -e, --canonicalize-existing
* canonicalize by following every symlink in
* every component of the given name recursively,
* all components must exist
* -m, --canonicalize-missing
* canonicalize by following every symlink in
* every component of the given name recursively,
* without requirements on components existence
* -n, --no-newline do not output the trailing newline
* -q, --quiet, -s, --silent suppress most error messages
* -v, --verbose report error messages
*
* bbox supports: -f -n -v (fully), -q -s (accepts but ignores)
*/
int readlink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int readlink_main(int argc UNUSED_PARAM, char **argv)
{
@@ -20,7 +42,7 @@ int readlink_main(int argc UNUSED_PARAM, char **argv)
unsigned opt;
/* We need exactly one non-option argument. */
opt_complementary = "=1";
opt = getopt32(argv, "f");
opt = getopt32(argv, "fnvsq");
fname = argv[optind];
)
SKIP_FEATURE_READLINK_FOLLOW(
@@ -30,9 +52,10 @@ int readlink_main(int argc UNUSED_PARAM, char **argv)
)
/* compat: coreutils readlink reports errors silently via exit code */
logmode = LOGMODE_NONE;
if (!(opt & 4)) /* not -v */
logmode = LOGMODE_NONE;
if (opt) {
if (opt & 1) { /* -f */
buf = realpath(fname, pathbuf);
} else {
buf = xmalloc_readlink_or_warn(fname);
@@ -40,7 +63,7 @@ int readlink_main(int argc UNUSED_PARAM, char **argv)
if (!buf)
return EXIT_FAILURE;
puts(buf);
printf((opt & 2) ? "%s" : "%s\n", buf);
if (ENABLE_FEATURE_CLEAN_UP && !opt)
free(buf);
+3 -2
View File
@@ -27,13 +27,14 @@ int rm_main(int argc UNUSED_PARAM, char **argv)
unsigned opt;
opt_complementary = "f-i:i-f";
opt = getopt32(argv, "fiRr");
/* -v (verbose) is ignored */
opt = getopt32(argv, "fiRrv");
argv += optind;
if (opt & 1)
flags |= FILEUTILS_FORCE;
if (opt & 2)
flags |= FILEUTILS_INTERACTIVE;
if (opt & 12)
if (opt & (8|4))
flags |= FILEUTILS_RECUR;
if (*argv != NULL) {
+18 -5
View File
@@ -15,26 +15,39 @@
int seq_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int seq_main(int argc, char **argv)
{
enum {
OPT_w = (1 << 0),
OPT_s = (1 << 1),
};
double last, increment, i;
const char *sep, *opt_s = "\n";
unsigned opt = getopt32(argv, "+ws:", &opt_s);
unsigned width = 0;
argc -= optind;
argv += optind;
i = increment = 1;
switch (argc) {
case 4:
increment = atof(argv[2]);
case 3:
i = atof(argv[1]);
increment = atof(argv[1]);
case 2:
i = atof(*argv);
case 1:
last = atof(argv[argc-1]);
break;
default:
bb_show_usage();
}
if (opt & OPT_w) /* Pad to length of start or last */
width = MAX(strlen(*argv), strlen(argv[argc-1]));
/* You should note that this is pos-5.0.91 semantics, -- FK. */
sep = "";
while ((increment > 0 && i <= last) || (increment < 0 && i >= last)) {
printf("%g\n", i);
printf("%s%0*g", sep, width, i);
sep = opt_s;
i += increment;
}
bb_putchar('\n');
return fflush(stdout);
}
+21 -6
View File
@@ -125,6 +125,20 @@ static const char *human_fstype(uint32_t f_type)
return humantypes[i].fs;
}
/* "man statfs" says that statfsbuf->f_fsid is a mess */
/* coreutils treats it as an array of ints, most significant first */
static unsigned long long get_f_fsid(const struct statfs *statfsbuf)
{
const unsigned *p = (const void*) &statfsbuf->f_fsid;
unsigned sz = sizeof(statfsbuf->f_fsid) / sizeof(unsigned);
unsigned long long r = 0;
do
r = (r << (sizeof(unsigned)*8)) | *p++;
while (--sz > 0);
return r;
}
#if ENABLE_FEATURE_STAT_FORMAT
static void strcatc(char *str, char c)
{
@@ -148,11 +162,11 @@ static void print_statfs(char *pformat, const char m,
if (m == 'n') {
printfs(pformat, filename);
} else if (m == 'i') {
strcat(pformat, "Lx");
printf(pformat, statfsbuf->f_fsid);
strcat(pformat, "llx");
printf(pformat, get_f_fsid(statfsbuf));
} else if (m == 'l') {
strcat(pformat, "lu");
printf(pformat, statfsbuf->f_namelen);
printf(pformat, (unsigned long) (statfsbuf->f_namelen));
} else if (m == 't') {
strcat(pformat, "lx");
printf(pformat, (unsigned long) (statfsbuf->f_type)); /* no equiv */
@@ -349,10 +363,11 @@ static void print_it(const char *masterformat, const char *filename,
#endif
static bool do_statfs(const char *filename, const char *format)
{
struct statfs statfsbuf;
#if !ENABLE_FEATURE_STAT_FORMAT
const char *format;
#endif
struct statfs statfsbuf;
#if ENABLE_SELINUX
security_context_t scontext = NULL;
@@ -406,10 +421,10 @@ static bool do_statfs(const char *filename, const char *format)
format = (option_mask32 & OPT_TERSE
? "%s %llx %lu "
: " File: \"%s\"\n"
" ID: %-8Lx Namelen: %-7lu ");
" ID: %-8llx Namelen: %-7lu ");
printf(format,
filename,
statfsbuf.f_fsid,
get_f_fsid(&statfsbuf),
statfsbuf.f_namelen);
if (option_mask32 & OPT_TERSE)
+1 -1
View File
@@ -104,7 +104,7 @@ int tail_main(int argc, char **argv)
if (argv[1] && (argv[1][0] == '+' || argv[1][0] == '-')
&& isdigit(argv[1][1])
) {
count = eat_num(&argv[1][1]);
count = eat_num(argv[1]);
argv++;
argc--;
}
-1
View File
@@ -11,7 +11,6 @@
/* http://www.opengroup.org/onlinepubs/007904975/utilities/tee.html */
#include "libbb.h"
#include <signal.h>
int tee_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int tee_main(int argc, char **argv)
+17 -3
View File
@@ -41,6 +41,13 @@ int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int touch_main(int argc UNUSED_PARAM, char **argv)
{
#if ENABLE_DESKTOP
#if ENABLE_GETOPT_LONG
static const char longopts[] ALIGN1 =
/* name, has_arg, val */
"no-create\0" No_argument "c"
"reference\0" Required_argument "r"
;
#endif
struct utimbuf timebuf;
char *reference_file = NULL;
#else
@@ -49,11 +56,18 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
#endif
int fd;
int status = EXIT_SUCCESS;
int flags = getopt32(argv, "c" USE_DESKTOP("r:")
int opts;
#if ENABLE_DESKTOP
#if ENABLE_GETOPT_LONG
applet_long_options = longopts;
#endif
#endif
opts = getopt32(argv, "c" USE_DESKTOP("r:")
/*ignored:*/ "fma"
USE_DESKTOP(, &reference_file));
flags &= 1; /* only -c bit is left */
opts &= 1; /* only -c bit is left */
argv += optind;
if (!*argv) {
bb_show_usage();
@@ -69,7 +83,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
do {
if (utime(*argv, reference_file ? &timebuf : NULL)) {
if (errno == ENOENT) { /* no such file */
if (flags) { /* creation is disabled, so ignore */
if (opts) { /* creation is disabled, so ignore */
continue;
}
/* Try to create the file. */
+174 -125
View File
@@ -16,235 +16,284 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/* http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html
* TODO: xdigit, graph, print
* TODO: graph, print
*/
#include "libbb.h"
#define ASCII 0377
enum {
ASCII = 256,
/* string buffer needs to be at least as big as the whole "alphabet".
* BUFSIZ == ASCII is ok, but we will realloc in expand
* even for smallest patterns, let's avoid that by using *2:
*/
TR_BUFSIZ = (BUFSIZ > ASCII*2) ? BUFSIZ : ASCII*2,
};
static void map(char *pvector,
unsigned char *string1, unsigned int string1_len,
unsigned char *string2, unsigned int string2_len)
char *string1, unsigned string1_len,
char *string2, unsigned string2_len)
{
char last = '0';
unsigned int i, j;
unsigned i, j;
for (j = 0, i = 0; i < string1_len; i++) {
if (string2_len <= j)
pvector[string1[i]] = last;
pvector[(unsigned char)(string1[i])] = last;
else
pvector[string1[i]] = last = string2[j++];
pvector[(unsigned char)(string1[i])] = last = string2[j++];
}
}
/* supported constructs:
* Ranges, e.g., 0-9 ==> 0123456789
* Ranges, e.g., [0-9] ==> 0123456789
* Escapes, e.g., \a ==> Control-G
* Character classes, e.g. [:upper:] ==> A...Z
* Equiv classess, e.g. [=A=] ==> A (hmmmmmmm?)
* not supported:
* \ooo-\ooo - octal ranges
* [x*N] - repeat char x N times
* [x*] - repeat char x until it fills STRING2:
* # echo qwe123 | /usr/bin/tr 123456789 '[d]'
* qwe[d]
* # echo qwe123 | /usr/bin/tr 123456789 '[d*]'
* qweddd
*/
static unsigned int expand(const char *arg, char *buffer)
static unsigned expand(const char *arg, char **buffer_p)
{
char *buffer_start = buffer;
char *buffer = *buffer_p;
unsigned pos = 0;
unsigned size = TR_BUFSIZ;
unsigned i; /* can't be unsigned char: must be able to hold 256 */
unsigned char ac;
while (*arg) {
if (pos + ASCII > size) {
size += ASCII;
*buffer_p = buffer = xrealloc(buffer, size);
}
if (*arg == '\\') {
arg++;
*buffer++ = bb_process_escape_sequence(&arg);
buffer[pos++] = bb_process_escape_sequence(&arg);
continue;
}
if (arg[1] == '-') { /* "0-9..." */
ac = arg[2];
if (ac == '\0') { /* "0-": copy verbatim */
*buffer++ = *arg++; /* copy '0' */
buffer[pos++] = *arg++; /* copy '0' */
continue; /* next iter will copy '-' and stop */
}
i = *arg;
i = (unsigned char) *arg;
while (i <= ac) /* ok: i is unsigned _int_ */
*buffer++ = i++;
buffer[pos++] = i++;
arg += 3; /* skip 0-9 */
continue;
}
if (*arg == '[') { /* "[xyz..." */
if ((ENABLE_FEATURE_TR_CLASSES || ENABLE_FEATURE_TR_EQUIV)
&& *arg == '['
) {
arg++;
i = *arg++;
/* "[xyz...", i=x, arg points to y */
if (ENABLE_FEATURE_TR_CLASSES && i == ':') {
i = (unsigned char) *arg++;
/* "[xyz...". i=x, arg points to y */
if (ENABLE_FEATURE_TR_CLASSES && i == ':') { /* [:class:] */
#define CLO ":]\0"
static const char classes[] ALIGN1 =
"alpha"CLO "alnum"CLO "digit"CLO
"lower"CLO "upper"CLO "space"CLO
"blank"CLO "punct"CLO "cntrl"CLO;
#define CLASS_invalid 0 /* we increment the retval */
#define CLASS_alpha 1
#define CLASS_alnum 2
#define CLASS_digit 3
#define CLASS_lower 4
#define CLASS_upper 5
#define CLASS_space 6
#define CLASS_blank 7
#define CLASS_punct 8
#define CLASS_cntrl 9
//#define CLASS_xdigit 10
//#define CLASS_graph 11
//#define CLASS_print 12
"blank"CLO "punct"CLO "cntrl"CLO
"xdigit"CLO;
enum {
CLASS_invalid = 0, /* we increment the retval */
CLASS_alpha = 1,
CLASS_alnum = 2,
CLASS_digit = 3,
CLASS_lower = 4,
CLASS_upper = 5,
CLASS_space = 6,
CLASS_blank = 7,
CLASS_punct = 8,
CLASS_cntrl = 9,
CLASS_xdigit = 10,
//CLASS_graph = 11,
//CLASS_print = 12,
};
smalluint j;
{ /* not really pretty.. */
char *tmp = xstrndup(arg, 7); // warning: xdigit would need 8, not 7
j = index_in_strings(classes, tmp) + 1;
free(tmp);
}
if (j == CLASS_alnum || j == CLASS_digit) {
char *tmp;
/* xdigit needs 8, not 7 */
i = 7 + (arg[0] == 'x');
tmp = xstrndup(arg, i);
j = index_in_strings(classes, tmp) + 1;
free(tmp);
if (j == CLASS_invalid)
goto skip_bracket;
arg += i;
if (j == CLASS_alnum || j == CLASS_digit || j == CLASS_xdigit) {
for (i = '0'; i <= '9'; i++)
*buffer++ = i;
buffer[pos++] = i;
}
if (j == CLASS_alpha || j == CLASS_alnum || j == CLASS_upper) {
for (i = 'A'; i <= 'Z'; i++)
*buffer++ = i;
buffer[pos++] = i;
}
if (j == CLASS_alpha || j == CLASS_alnum || j == CLASS_lower) {
for (i = 'a'; i <= 'z'; i++)
*buffer++ = i;
buffer[pos++] = i;
}
if (j == CLASS_space || j == CLASS_blank) {
*buffer++ = '\t';
buffer[pos++] = '\t';
if (j == CLASS_space) {
*buffer++ = '\n';
*buffer++ = '\v';
*buffer++ = '\f';
*buffer++ = '\r';
buffer[pos++] = '\n';
buffer[pos++] = '\v';
buffer[pos++] = '\f';
buffer[pos++] = '\r';
}
*buffer++ = ' ';
buffer[pos++] = ' ';
}
if (j == CLASS_punct || j == CLASS_cntrl) {
for (i = '\0'; i <= ASCII; i++)
for (i = '\0'; i < ASCII; i++) {
if ((j == CLASS_punct && isprint(i) && !isalnum(i) && !isspace(i))
|| (j == CLASS_cntrl && iscntrl(i)))
*buffer++ = i;
|| (j == CLASS_cntrl && iscntrl(i))
) {
buffer[pos++] = i;
}
}
}
if (j == CLASS_invalid) {
*buffer++ = '[';
*buffer++ = ':';
continue;
if (j == CLASS_xdigit) {
for (i = 'A'; i <= 'F'; i++) {
buffer[pos + 6] = i | 0x20;
buffer[pos++] = i;
}
pos += 6;
}
break;
continue;
}
/* "[xyz...", i=x, arg points to y */
if (ENABLE_FEATURE_TR_EQUIV && i == '=') { /* [=CHAR=] */
*buffer++ = *arg; /* copy CHAR */
if (!*arg || arg[1] != '=' || arg[2] != ']')
buffer[pos++] = *arg; /* copy CHAR */
if (!arg[0] || arg[1] != '=' || arg[2] != ']')
bb_show_usage();
arg += 3; /* skip CHAR=] */
continue;
}
if (i == '\0' || *arg != '-') { /* not [x-...] - copy verbatim */
*buffer++ = '[';
arg--; /* points to x */
continue; /* copy all, including eventual ']' */
}
/* [x-z] */
arg++; /* skip - */
if (arg[0] == '\0' || arg[1] != ']')
bb_show_usage();
ac = *arg++;
while (i <= ac)
*buffer++ = i++;
arg++; /* skip ] */
continue;
/* The rest of "[xyz..." cases is treated as normal
* string, "[" has no special meaning here:
* tr "[a-z]" "[A-Z]" can be written as tr "a-z" "A-Z",
* also try tr "[a-z]" "_A-Z+" and you'll see that
* [] is not special here.
*/
skip_bracket:
arg -= 2; /* points to "[" in "[xyz..." */
}
*buffer++ = *arg++;
buffer[pos++] = *arg++;
}
return (buffer - buffer_start);
return pos;
}
/* NB: buffer is guaranteed to be at least TR_BUFSIZE
* (which is >= ASCII) big.
*/
static int complement(char *buffer, int buffer_len)
{
int i, j, ix;
char conv[ASCII + 2];
int len;
char conv[ASCII];
unsigned char ch;
ix = 0;
for (i = '\0'; i <= ASCII; i++) {
for (j = 0; j < buffer_len; j++)
if (buffer[j] == i)
break;
if (j == buffer_len)
conv[ix++] = i & ASCII;
len = 0;
ch = '\0';
while (1) {
if (memchr(buffer, ch, buffer_len) == NULL)
conv[len++] = ch;
if (++ch == '\0')
break;
}
memcpy(buffer, conv, ix);
return ix;
memcpy(buffer, conv, len);
return len;
}
int tr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int tr_main(int argc UNUSED_PARAM, char **argv)
{
int output_length = 0, input_length;
int i;
smalluint flags;
ssize_t read_chars = 0;
size_t in_index = 0, out_index = 0;
smalluint opts;
ssize_t read_chars;
size_t in_index, out_index;
unsigned last = UCHAR_MAX + 1; /* not equal to any char */
unsigned char coded, c;
unsigned char *output = xmalloc(BUFSIZ);
char *vector = xzalloc((ASCII+1) * 3);
char *invec = vector + (ASCII+1);
char *outvec = vector + (ASCII+1) * 2;
char *str1 = xmalloc(TR_BUFSIZ);
char *str2 = xmalloc(TR_BUFSIZ);
int str2_length;
int str1_length;
char *vector = xzalloc(ASCII * 3);
char *invec = vector + ASCII;
char *outvec = vector + ASCII * 2;
#define TR_OPT_complement (1 << 0)
#define TR_OPT_delete (1 << 1)
#define TR_OPT_squeeze_reps (1 << 2)
#define TR_OPT_complement (3 << 0)
#define TR_OPT_delete (1 << 2)
#define TR_OPT_squeeze_reps (1 << 3)
flags = getopt32(argv, "+cds"); /* '+': stop at first non-option */
argv += optind;
for (i = 0; i <= ASCII; i++) {
for (i = 0; i < ASCII; i++) {
vector[i] = i;
/*invec[i] = outvec[i] = FALSE; - done by xzalloc */
}
#define tr_buf bb_common_bufsiz1
if (*argv != NULL) {
input_length = expand(*argv++, tr_buf);
if (flags & TR_OPT_complement)
input_length = complement(tr_buf, input_length);
if (*argv) {
if (argv[0][0] == '\0')
bb_error_msg_and_die("STRING2 cannot be empty");
output_length = expand(*argv, (char *)output);
map(vector, (unsigned char *)tr_buf, input_length, output, output_length);
}
for (i = 0; i < input_length; i++)
invec[(unsigned char)tr_buf[i]] = TRUE;
for (i = 0; i < output_length; i++)
outvec[output[i]] = TRUE;
}
/* -C/-c difference is that -C complements "characters",
* and -c complements "values" (binary bytes I guess).
* In POSIX locale, these are the same.
*/
opt_complementary = "-1";
opts = getopt32(argv, "+Ccds"); /* '+': stop at first non-option */
argv += optind;
str1_length = expand(*argv++, &str1);
str2_length = 0;
if (opts & TR_OPT_complement)
str1_length = complement(str1, str1_length);
if (*argv) {
if (argv[0][0] == '\0')
bb_error_msg_and_die("STRING2 cannot be empty");
str2_length = expand(*argv, &str2);
map(vector, str1, str1_length,
str2, str2_length);
}
for (i = 0; i < str1_length; i++)
invec[(unsigned char)(str1[i])] = TRUE;
for (i = 0; i < str2_length; i++)
outvec[(unsigned char)(str2[i])] = TRUE;
goto start_from;
/* In this loop, str1 space is reused as input buffer,
* str2 - as output one. */
for (;;) {
/* If we're out of input, flush output and read more input. */
if ((ssize_t)in_index == read_chars) {
if (out_index) {
xwrite(STDOUT_FILENO, (char *)output, out_index);
xwrite(STDOUT_FILENO, str2, out_index);
start_from:
out_index = 0;
}
read_chars = safe_read(STDIN_FILENO, tr_buf, BUFSIZ);
read_chars = safe_read(STDIN_FILENO, str1, TR_BUFSIZ);
if (read_chars <= 0) {
if (read_chars < 0)
bb_perror_msg_and_die(bb_msg_read_error);
exit(EXIT_SUCCESS);
break;
}
in_index = 0;
}
c = tr_buf[in_index++];
c = str1[in_index++];
if ((opts & TR_OPT_delete) && invec[c])
continue;
coded = vector[c];
if ((flags & TR_OPT_delete) && invec[c])
if ((opts & TR_OPT_squeeze_reps) && last == coded
&& (invec[c] || outvec[coded])
) {
continue;
if ((flags & TR_OPT_squeeze_reps) && last == coded
&& (invec[c] || outvec[coded]))
continue;
output[out_index++] = last = coded;
}
str2[out_index++] = last = coded;
}
/* NOTREACHED */
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -30,7 +30,7 @@ int tty_main(int argc, char **argv SKIP_INCLUDE_SUSv2(UNUSED_PARAM))
retval = 0;
s = ttyname(0);
s = xmalloc_ttyname(0);
if (s == NULL) {
/* According to SUSv3, ttyname can fail with EBADF or ENOTTY.
* We know the file descriptor is good, so failure means not a tty. */
+90 -35
View File
@@ -9,25 +9,43 @@
/* http://www.opengroup.org/onlinepubs/007904975/utilities/uname.html */
/* Option Example
-s, --sysname SunOS
-n, --nodename rocky8
-r, --release 4.0
-v, --version
-m, --machine sun
-a, --all SunOS rocky8 4.0 sun
The default behavior is equivalent to '-s'.
David MacKenzie <djm@gnu.ai.mit.edu> */
/* Busyboxed by Erik Andersen */
/* Further size reductions by Glenn McGrath and Manuel Novoa III. */
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
* -s, --sysname SunOS
* -n, --nodename rocky8
* -r, --release 4.0
* -v, --version
* -m, --machine sun
* -a, --all SunOS rocky8 4.0 sun
*
* Now does proper error checking on i/o. Plus some further space savings.
* The default behavior is equivalent to '-s'.
*
* David MacKenzie <djm@gnu.ai.mit.edu>
*
* GNU coreutils 6.10:
* Option: struct Example(s):
* utsname
* field:
* -s, --kernel-name sysname Linux
* -n, --nodename nodename localhost.localdomain
* -r, --kernel-release release 2.6.29
* -v, --kernel-version version #1 SMP Sun Jan 11 20:52:37 EST 2009
* -m, --machine machine x86_64 i686
* -p, --processor (none) x86_64 i686
* -i, --hardware-platform (none) x86_64 i386
* NB: vanilla coreutils reports "unknown" -p and -i,
* x86_64 and i686/i386 shown above are Fedora's inventions.
* -o, --operating-system (none) GNU/Linux
* -a, --all: all of the above, in the order shown.
* If -p or -i is not known, don't show them
*/
/* Busyboxed by Erik Andersen
*
* Before 2003: Glenn McGrath and Manuel Novoa III
* Further size reductions.
* Mar 16, 2003: Manuel Novoa III (mjn3@codepoet.org)
* Now does proper error checking on i/o. Plus some further space savings.
* Jan 2009:
* Fix handling of -a to not print "unknown", add -o and -i support.
*/
#include <sys/utsname.h>
@@ -35,37 +53,60 @@
typedef struct {
struct utsname name;
char processor[8]; /* for "unknown" */
char processor[sizeof(((struct utsname*)NULL)->machine)];
char platform[sizeof(((struct utsname*)NULL)->machine)];
char os[sizeof("GNU/Linux")];
} uname_info_t;
static const char options[] ALIGN1 = "snrvmpa";
static const char options[] ALIGN1 = "snrvmpioa";
static const unsigned short utsname_offset[] = {
offsetof(uname_info_t, name.sysname),
offsetof(uname_info_t, name.nodename),
offsetof(uname_info_t, name.release),
offsetof(uname_info_t, name.version),
offsetof(uname_info_t, name.machine),
offsetof(uname_info_t, processor)
offsetof(uname_info_t, name.sysname), /* -s */
offsetof(uname_info_t, name.nodename), /* -n */
offsetof(uname_info_t, name.release), /* -r */
offsetof(uname_info_t, name.version), /* -v */
offsetof(uname_info_t, name.machine), /* -m */
offsetof(uname_info_t, processor), /* -p */
offsetof(uname_info_t, platform), /* -i */
offsetof(uname_info_t, os), /* -o */
};
int uname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int uname_main(int argc UNUSED_PARAM, char **argv)
{
#if ENABLE_GETOPT_LONG
static const char longopts[] ALIGN1 =
/* name, has_arg, val */
"all\0" No_argument "a"
"kernel-name\0" No_argument "s"
"nodename\0" No_argument "n"
"kernel-release\0" No_argument "r"
"release\0" No_argument "r"
"kernel-version\0" No_argument "v"
"machine\0" No_argument "m"
"processor\0" No_argument "p"
"hardware-platform\0" No_argument "i"
"operating-system\0" No_argument "o"
;
#endif
uname_info_t uname_info;
#if defined(__sparc__) && defined(__linux__)
char *fake_sparc = getenv("FAKE_SPARC");
#endif
const char *unknown_str = "unknown";
const char *fmt;
const unsigned short *delta;
char toprint;
unsigned toprint;
USE_GETOPT_LONG(applet_long_options = longopts);
toprint = getopt32(argv, options);
if (argv[optind]) { /* coreutils-6.9 compat */
bb_show_usage();
}
if (toprint & (1 << 6)) { /* -a => all opts on */
toprint = 0x3f;
if (toprint & (1 << 8)) { /* -a => all opts on */
toprint = (1 << 8) - 1;
unknown_str = ""; /* -a does not print unknown fields */
}
if (toprint == 0) { /* no opts => -s (sysname) */
@@ -79,16 +120,30 @@ int uname_main(int argc UNUSED_PARAM, char **argv)
strcpy(uname_info.name.machine, "sparc");
}
#endif
strcpy(uname_info.processor, "unknown");
strcpy(uname_info.processor, unknown_str);
strcpy(uname_info.platform, unknown_str);
strcpy(uname_info.os, "GNU/Linux");
#if 0
/* Fedora does something like this */
strcpy(uname_info.processor, uname_info.name.machine);
strcpy(uname_info.platform, uname_info.name.machine);
if (uname_info.platform[0] == 'i'
&& uname_info.platform[1]
&& uname_info.platform[2] == '8'
&& uname_info.platform[3] == '6'
) {
uname_info.platform[1] = '3';
}
#endif
delta = utsname_offset;
fmt = " %s" + 1;
do {
if (toprint & 1) {
/* printf would not be safe here */
fputs((char *)(&uname_info) + *delta, stdout);
if (toprint > 1) {
bb_putchar(' ');
const char *p = (char *)(&uname_info) + *delta;
if (p[0]) {
printf(fmt, p);
fmt = " %s";
}
}
++delta;
+1 -1
View File
@@ -45,7 +45,7 @@ int uniq_main(int argc UNUSED_PARAM, char **argv)
};
skip_fields = skip_chars = 0;
max_chars = -1;
max_chars = INT_MAX;
opt_complementary = "f+:s+:w+";
opt = getopt32(argv, "cduf:s:w:", &skip_fields, &skip_chars, &max_chars);
-1
View File
@@ -20,7 +20,6 @@
#include "libbb.h"
#include <utmp.h>
#include <time.h>
static void idle_string(char *str6, time_t t)
{
+1 -1
View File
@@ -20,7 +20,7 @@ int whoami_main(int argc, char **argv UNUSED_PARAM)
bb_show_usage();
/* Will complain and die if username not found */
puts(bb_getpwuid(NULL, -1, geteuid()));
puts(xuid2uname(geteuid()));
return fflush(stdout);
}
+1 -1
View File
@@ -370,7 +370,7 @@ within each applet. More build coverage testing.</p></li>
only so much they can keep in their brains at a time. You can post a
polite reminder after 2-3 days without offending anybody. If that doesn't
result in a solution, please use the
<a href="http://bugs.busybox.net/">BusyBox Bug
<a href="https://bugs.busybox.net/">BusyBox Bug
and Patch Tracking System</a> to submit a detailed explanation and we'll
get to it as soon as we can.
</p>
+1 -1
View File
@@ -44,7 +44,7 @@ the latest development source tree for those wishing to follow BusyBox developme
but cannot or do not wish to use Subversion (svn).
<ul>
<li> Click here to <a href="/cgi-bin/viewcvs.cgi/trunk/busybox/">browse the source tree</a>.
<li> Click here to <a href="http://sources.busybox.net/index.py/trunk/busybox/">browse the source tree</a>.
</li>
<li>Anonymous <a href="subversion.html">Subversion access</a> is available.
+2 -2
View File
@@ -60,11 +60,11 @@
</ul>
<b>Development</b>
<ul>
<li><a href="/cgi-bin/viewcvs.cgi/trunk/busybox/">Browse Source</a></li>
<li><a href="http://sources.busybox.net/index.py/trunk/busybox/">Browse Source</a></li>
<li><a href="subversion.html">Source Control</a></li>
<!--li><a href="/downloads/patches/recent.html">Recent Changes</a></li-->
<li><a href="lists.html">Mailing Lists</a></li>
<li><a href="http://bugs.busybox.net/">Bug Tracking</a></li>
<li><a href="https://bugs.busybox.net/">Bug Tracking</a></li>
</ul>
<p><b>Links</b>
<ul>
Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

+2 -2
View File
@@ -6,7 +6,7 @@
<h3>Mailing List Information</h3>
BusyBox has a <a href="/lists/busybox/">mailing list</a> for discussion and
development. You can subscribe by visiting
<a href="http://busybox.net/mailman/listinfo/busybox">this page</a>.
<a href="http://lists.busybox.net/mailman/listinfo/busybox">this page</a>.
Only subscribers to the BusyBox mailing list are allowed to post
to this list.
@@ -14,7 +14,7 @@ to this list.
There is also a mailing list for <a href="/lists/busybox-cvs/">active developers</a>
wishing to read the complete diff of each and every change to busybox -- not for the
faint of heart. Active developers can subscribe by visiting
<a href="http://busybox.net/mailman/listinfo/busybox-cvs">this page</a>.
<a href="http://lists.busybox.net/mailman/listinfo/busybox-cvs">this page</a>.
The Subversion server is the only one permtted to post to this list. And yes,
this list name uses the word 'cvs' even though we don't use that anymore...
+296 -8
View File
@@ -22,13 +22,304 @@
</p>
</li>
<li><b>15 April 2009 -- BusyBox 1.14.0 (unstable), BusyBox 1.13.4 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.14.0.tar.bz2">BusyBox 1.14.0</a>.
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_14_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.14.0/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p><a href="http://busybox.net/downloads/busybox-1.13.4.tar.bz2">BusyBox 1.13.4</a>.
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_13_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.13.4/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p>Sizes of busybox-1.13.4 and busybox-1.14.0 (with equivalent config, static uclibc build):<pre>
text data bss dec hex filename
785501 483 7036 793020 c19bc busybox.1.13.4/busybox
788380 467 6960 795807 c249f busybox.1.14.0/busybox
15361 0 0 15361 3c01 busybox.1.13.4/shell/hush.o
20724 0 0 20724 50f4 busybox.1.14.0/shell/hush.o
</pre>
<p>Most of growth is in hush. The rest shrank a bit.
<p>New applets:
<ul>
<li>flash_eraseall: by Sebastian Andrzej Siewior (bigeasy AT linutronix.de)</li>
<li>acpid, mkdosfs, tunctl: by Vladimir</li>
<li>ftpd: by Adam Tkac (vonsch AT gmail.com)</li>
<li>timeout: by Roberto Foglietta</li>
<li>ionice: adapted from Linux kernel example by Walter Harms</li>
<li>mkpasswd: synonym to cryptpw. mkpasswd is in Debian, OTOH cryptpw was added to busybox earlier. Trying to make both camps happy by making those two applets just aliases. They are command-line compatible</li>
</ul>
<p>Changes since previous release:
<p>lash and msh are deprecated, please migrate to hush.
<p>hush had many, many fixes and features added: here documents, arithmetic evaluation, function support, and all this works on NOMMU too, safely, including 100kb-sized `command` and here documents. Here document support, arithmetic evaluation, improved ${var} operations, other fixes are by Mike Frysinger (vapier AT gentoo.org).
<p>Other changes:
<ul>
<li>libbb: unify concurrent-safe update of /etc/{passwd,group,[g]shadow}. By Tito (farmatito AT tiscali.it)</li>
<li>libbb/sha{1,256,512}: major code shrink</li>
<li>libbb/lineedit: make history saving/loading concurrent-safe</li>
<li>libbb: shrink linked list ops. By xmaks AT email.cz</li>
<li>libbb: str2sockaddr should accept [IPv6] addr without port - wget 'ftp://[::1]/file' needs that to work</li>
<li>libbb: make bb_info_msg do atomic, unbuffered writes</li>
<li>util-linux/volumeid: abort early on read failures. Should help with probing missing fdd's</li>
<li>util-linux/volumeid: fix bug 249 "findfs finds the wrong partition"</li>
<li>adduser: allow adding to group 0; don't _create_ /etc/shadow, only append data if it exists</li>
<li>ash: fix mishandled ^C and SIGINT (several cases)</li>
<li>ash: fix "ash -c 'exec 1&gt;&amp;0'" complaining that fd 0 is busy</li>
<li>ash: fix $IFS handling in read. Closes bug 235</li>
<li>ash: fix a case where we were closing wrong descriptor</li>
<li>ash: fix bad interaction between ash -c '....&amp;' and bash compat</li>
<li>ash: fix miscalculation of memory needed for eval tree. Found by Timo Teras (timo.teras AT iki.fi)</li>
<li>ash: make dot command search current directory first, as bash does</li>
<li>ash: printf builtin with no arguments should not exit</li>
<li>awk: fix long field separators case. By Ian Wienand (ianw AT vmware.com)</li>
<li>awk: in BEGIN section $0 should be "", not "0"</li>
<li>awk: make "struct global" hack more robust wrt alignment. Closes bug 131</li>
<li>brctl: fix compilation on 2.4.x kernels</li>
<li>chat: treat timeout more correctly</li>
<li>chat: recognize RECORD directive</li>
<li>cksum, head, printenv: report errors via exitcode</li>
<li>cpio: add -p, -0 and -L options</li>
<li>crond, crontab: make cron directory location configurable</li>
<li>crond: correct more of logfile to 0666 (as usual, umask allows user to remove unwanted bits)</li>
<li>crond: put tasks in separate process groups</li>
<li>dc: fix the "base 2" patch omission of base not being set</li>
<li>depmod: accept and ignore -r. Linux kernel build needs this</li>
<li>depmod: fix -b option. By timo.teras AT iki.fi</li>
<li>udhcpc: fix a problem where we don't open listening socket fast enough</li>
<li>udhcpc: stop filtering environment passed to the script</li>
<li>udhcpd: disable option to have absolute lease times in lease file (that does not work with dumpleases)</li>
<li>udhcpd: write 64-bit current time in lease file. Without it, determination of remaining lease time is unreliable</li>
<li>udhcpd: remember hostnames of clients</li>
<li>dumpleases: fix -a option, use recorded current time in lease file, show hostnames</li>
<li>dnsd: fix a number of bugs. Ideas by Ming-Ching Tiew (mctiew AT yahoo.com)</li>
<li>dpkg: better and shorter code to compare versions. Taken from "official" dpkg by Eugene T. Bordenkircher (eugebo AT gmail.com)</li>
<li>du: fix "du /dir /dir" case</li>
<li>env: support -uVAR=VAL</li>
<li>expand, unexpand: fix incorrect expansion in some cases</li>
<li>expr: a bit more robust handling of regexps with groups. Closes bug 87</li>
<li>find: support --mindepth</li>
<li>getty: make speed 0 mean "don't change speed", stop using non-portable way of setting speeds</li>
<li>grep: support -z</li>
<li>gzip: fix gzip -dc bug caused by using stale getopt state</li>
<li>httpd: set $HOST to Host: header value. By Tobias Poschwatta (tp AT fonz.de)</li>
<li>ifupdown: allow options to udhcpc to be configurable from .config</li>
<li>init: do not eat last char in messages; do not print duplicate "init:" prefix to syslog</li>
<li>init: fix a bug where on reload order of entries might be wrong</li>
<li>init: major improvement in documentation and signal handling. Lots of nasty, but hard to trip, races are fixed</li>
<li>init: reinstate proper handling of !ENABLE_FEATURE_USE_INITTAB</li>
<li>init: remove wait loop on restart, it may be dangerous</li>
<li>init: test for vt terminal with VT_OPENQRY, assume that anything else is TERM=vt102, not TERM=linux. Closes bug 195</li>
<li>inotifyd: add x, o, and u events</li>
<li>inotifyd: fix buffer overflow and "unreaped zombies" problem</li>
<li>inotifyd: conserve resourses by closing unused inotify descriptors</li>
<li>insmod/modprobe: do not pass NULL to kernel as module parameter</li>
<li>ip: in "ip rule add from all table 1", "all" is taken as 0.0.0.0/32, whereas "any" and "default" would be 0.0.0.0/0. They must be all 0.0.0.0/0. Closes bug 57</li>
<li>iproute: fix ipXXX utilities trying to parse their applet name as their 1st parameter</li>
<li>klogctl: fix a problem where we don't terminate read data with '\0' and then misinterpret it</li>
<li>ls: do not follow links with -s. Closes bug 33</li>
<li>ls: implement -Q and -g (-g was accepted but ignored)</li>
<li>ls: make readlink error to not disrupt output (try ls -l /proc/self/fd)</li>
<li>man: better check for duplicated MANPATH</li>
<li>mdev: add support for - ("dont stop here") char</li>
<li>mdev: if /sys/class/block exists, don't scan /sys/block</li>
<li>mdev: ignore events with "$SUBSYSTEM" == "firmware" &amp;&amp; "$ACTION" == "remove"</li>
<li>mdev: provide $SUBSYSTEM. By Vladimir</li>
<li>modprobe/insmod for 2.4: support compressed modules. By Guenter (lists AT gknw.net)</li>
<li>modprobe: rework/speedup by Timo Teras (timo.teras AT iki.fi)</li>
<li>modutils-24: fix bad interaction of xzalloc with xrealloc_vector</li>
<li>mount: support "-O option", stop trying to mount swap partitions, fix CIFS support</li>
<li>mountpoint: add -n option. By Vladimir</li>
<li>nslookup: allow usage of IPv6 addresses or hostnames for DNS server name; allow for port specification. Tested to work on uclibc svn: "nslookup google.com [::1]:5353". glibc + IPv6 address of DNS server still does not work</li>
<li>popmaildir: fix several grave bugs with using memory past end of malloc block</li>
<li>printf: fix 1.12.0 breakage (from %*d fix), it was misinterpreting "*"</li>
<li>printf: make integer format strings print long long-sized values</li>
<li>rmmod: fix bug 263 "modutils/rmmod can't remove modules with dash in name on 2.4 kernels"</li>
<li>sendmail: document and fix usage of fd #4, fix check for helper failure</li>
<li>sendmail: update by Vladimir</li>
<li>seq: add -w support. By Natanael Copa</li>
<li>seq: add support for "-s separator"</li>
<li>stat: make stat -f show filesystem "ID:" as coreutils does</li>
<li>sysctl: fix another corner case with "dots and slashes"</li>
<li>sysctl: fix broken -p [file]. Closes bug 231</li>
<li>sysctl: support recursing if name is a directory: "sysctl net.ipv4.conf". Patch by xmaks AT email.cz</li>
<li>syslogd: make signal handling syncronous</li>
<li>syslogd: create logfile with 0666 (affected by umask as usual), not 0600</li>
<li>tail: fix tail +N syntax not working. Closes bug 221</li>
<li>tar: do not change new tarfile's mode, GNU tar doesn't do it</li>
<li>tar: support GNU tar's "base256" encoding</li>
<li>telnetd: correctly output 0xff char</li>
<li>telnetd: do not advertise TELNET_LFLOW, we do not support it properly</li>
<li>tftp: when we infer local name from remote (-r [/]path/path/file), strip path. This mimics wget and is generally more intuitive</li>
<li>timeout: fix parsing of -t NUM on MMU</li>
<li>top: make it work again on 2.4 kernels. Closes bug 125</li>
<li>tr: fix overflow in expand and complement, fix stop after [:class:], fix handling of ranges and [x]'s</li>
<li>tr: support -C as synonym to -c, support [:xdigit:]</li>
<li>traceroute: rewrite. Do not emit raw IP packets, instead send UDP or ICMP packets and rely on the kernel to form IP headers, select source IP and interface</li>
<li>uname: add support for -i and -o, fix printing of unknown -p value with -a option, support long options</li>
<li>unzip: fix thinko with le/be conv and size. Closes bug 129</li>
<li>vi: fix several instances of major goof: when text grows, text[] might get reallocated! We were keeping around pointers to old place</li>
<li>vi: speedup and code shrink. By Walter Harms</li>
<li>wget: --post-data support. By Harald Kuthe (harald-tuxbox AT arcor.de)</li>
<li>wget: fix --header handling, more robust EINTR detection</li>
</ul>
</p>
<li><b>8 March 2009 -- BusyBox 1.13.3 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.13.3.tar.bz2">BusyBox 1.13.3</a>.
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_13_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.13.3/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p>1.13.3 is a bug fix release. It has fixes for awk, depmod, init, killall, mdev,
modprobe, printf, syslogd, tar, top, unzip, wget.
</p>
</li>
<li><b>31 December 2008 -- BusyBox 1.13.2 (stable), BusyBox 1.12.4 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.13.2.tar.bz2">BusyBox 1.13.2</a>.
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_13_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.13.2/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p><a href="http://busybox.net/downloads/busybox-1.12.4.tar.bz2">BusyBox 1.12.4</a>.
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_12_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.12.4/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p>Bug fix releases. 1.13.2 has fixes for crond, dc, init, ip, printf.
1.12.4 has fixes for ip and printf.
</p>
</li>
<li><b>29 November 2008 -- BusyBox 1.13.1 (stable), BusyBox 1.12.3 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.13.1.tar.bz2">BusyBox 1.13.1</a>.
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_13_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.13.1/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p><a href="http://busybox.net/downloads/busybox-1.12.3.tar.bz2">BusyBox 1.12.3</a>.
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_12_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.12.3/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p>Bug fix releases. 1.13.1 has fixes for ash, option parsing, id, init,
inotifyd, klogd, line editing and modprobe. 1.12.3 has fixes
for option parsing and line editing.
</p>
</li>
<li><b>10 November 2008 -- BusyBox 1.13.0 (unstable), BusyBox 1.12.2 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.13.0.tar.bz2">BusyBox 1.13.0</a>.
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_13_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.13.0/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p><a href="http://busybox.net/downloads/busybox-1.12.2.tar.bz2">BusyBox 1.12.2</a>.
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_12_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.12.2/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p>Sizes of busybox-1.12.2 and busybox-1.13.0 (with equivalent config, static uclibc build):<pre>
text data bss dec hex filename
778291 551 7856 786698 c010a busybox-1.12.2/busybox
778981 551 7852 787384 c03b8 busybox-1.13.0/busybox
</pre>
<p>New applets: blkid, devmem
<p>Changes since previous release:
<ul>
<li>mail applets: total overhaul. Vladimir as usual</li>
<li>ash: fix "while kill -0 $child; do true; done" looping forever</li>
<li>ash: fix NOEXEC mode - we were forgetting to pass environment</li>
<li>ash: fix a bug in standalone mode (corrupted getopt state)</li>
<li>ash: optionally support "&gt;&amp;file" and "&amp;&gt;file" redirections</li>
<li>awk: bitwise ops cast oprands and results to unsigned long, not signed. closes bug 4774</li>
<li>awk: fix typo in atan2 code. closes bug 5594</li>
<li>awk: improve handling of negative numbers in bitwise ops; fix handling of octal costants</li>
<li>awk: support hex constants</li>
<li>basename: fix error code (again)</li>
<li>cpio: emit TRAILER even when hard links were found. By Pascal Bellard (pascal.bellard AT ads-lu.com)</li>
<li>crontab: do not destroy STDIN_FILENO, editor may need it (crontab -e)</li>
<li>dc: support for bases 2 and 8, by Nate Case (ncase AT xes-inc.com)</li>
<li>dhcpc: treat "discover...select...discover..." loop the same way as "discover...discover...discover..."</li>
<li>dpkg: add dpkg -l PACKAGE_PATTERN. By Peter Korsgaard</li>
<li>fbset: fix mode matching code: original code may trigger false positive.</li>
<li>findfs: fix LUKS and FAT detection routines; do not exit if corrupted FAT fs makes us try to seek past the end</li>
<li>grep: fix 'echo aaa | grep -o a' + ENABLE_EXTRA_COMPAT case. By Natanael Copa</li>
<li>grep: fix EXTRA_COMPAT grep to honor -E and -i</li>
<li>gunzip: restore mtime</li>
<li>halt: reinstate -w even if !FEATURE_WTMP</li>
<li>hexdump: fix SEGV in hexdump -e ""</li>
<li>httpd: pass "Accept:" and "Accept-Language:" header to CGI scripts (Alina Friedrichsen)</li>
<li>hush: fix environment and memory leaks</li>
<li>hush: fix trashing of environment by local env vars: a=a; a=b cmd; - a was unset</li>
<li>id: improve compatibility with coreutils. By Tito Ragusa</li>
<li>inetd: fix a case when we have zero services</li>
<li>inetd: use config parser. by Vladimir</li>
<li>init: set stderr to NONBLOCK</li>
<li>insmod: fix detection of open failure</li>
<li>install: support -D</li>
<li>ip: fix ip route rejecting dotted quads as prefix</li>
<li>ip: route metric support (Natanael Copa)</li>
<li>iplink: accept shorthands for "address" keyword: "ip link set address 00:11:22:33:44:55"</li>
<li>kbd_mode: support -C TTY</li>
<li>kill[all[5]]: accept -s SIG too. By Steve Bennett (steveb AT workware.net.au)</li>
<li>klogd: handle many lines at once. By Steve Bennett (steveb AT workware.net.au)</li>
<li>less: support -I to be able to search case-insensitively</li>
<li>less: add optional line number toggle and resizing on window resize</li>
<li>libbb: do not reject floating point strings like ".15"</li>
<li>lineedit: fix bug 5824 "since rev 23530 fdisk and ed don't work any more"</li>
<li>lineedit: fix problems with empty commands in history</li>
<li>login: fix /etc/nologin handling</li>
<li>man: fix inconsistencies in handling $MANPATH</li>
<li>mdev: support match by major,minor. See bug 4714</li>
<li>modprobe-small: make insmod command line compatible</li>
<li>modprobe-small: support "blacklist" keyword in /etc/modules/MODULE_NAME</li>
<li>modprobe: fix a segfault when modprobe is called with no arguments at all</li>
<li>modutils/*: rewrite by Timo Teras (timo.teras AT iki.fi)</li>
<li>mount: fix "-o parm1 -o parm2" not accumulating</li>
<li>nmeter: 4k buffers are too small for /proc files, make them dynamically sized with 16k upper limit</li>
<li>ping: SO_RCVBUF must be bigger than packet size, otherwise large ping packets might fail to be received</li>
<li>route: fix for 64-bit BE machines by Seonghun Lim (wariua AT gmail.com)</li>
<li>rpm: fix incompatibilities which prevented rpm -i foo.src.rpm</li>
<li>runsvdir: support runsvdir-as-init</li>
<li>setarch: do not try to use non-existent data in argv[]</li>
<li>setfont: support -m and -C, support -m TEXTUAL_MAP (by Vladimir)</li>
<li>setup_environment: cd $HOME regardless of clear_env value</li>
<li>slattach: preserve speed in non-raw mode. By Matthieu Castet (matthieu.castet AT parrot.com)</li>
<li>start_stop_daemon: accept (and ignore) -R PARAM</li>
<li>sv: make default service dir configurable (Vladimir wants it)</li>
<li>sysctl: fix bug 3894 (by Kryzhanovskyy Maksym)</li>
<li>tar: fix bug 3844: non-root tar does not preserve perms</li>
<li>telnetd: handle emacs M-DEL and IAC-NOP. by Jim Cathey (jcathey AT ciena.com)</li>
<li>top: fix "top -d 1" (bug 5144)</li>
<li>top: optional SMP support by Vineet Gupta (vineetg76 AT gmail.com)</li>
<li>trylink: make messages less confusing</li>
<li>unzip: handle "central directory". needed for OpenOffice, gmail attachment .zips etc</li>
<li>vi: Rob's algorithm of reading and matching ESC sequences (nice work btw!)</li>
<li>vi: deal with EOF/error on stdin and with input NULs</li>
<li>vi: fix uninitialized last_search_pattern (bug 5794)</li>
<li>vi: handle chars 0x80, 0x81 etc correctly</li>
<li>volume identification: abolish /proc/partitions and /proc/cdroms scanning. It does not catch volume managers and such. Simply scan /dev/* for any block devices</li>
<li>watchdog: WDIOC_SETTIMEOUT accepts seconds, not milliseconds</li>
<li>watchdog: add -T option</li>
</ul>
<p>
The email address gpl@busybox.net is the recommended way to contact
the Software Freedom Law Center to report BusyBox license violations.
</p>
</li>
<li><b>28 September 2008 -- BusyBox 1.12.1 (stable), BusyBox 1.11.3 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.12.1.tar.bz2">BusyBox 1.12.1</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_12_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_12_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.12.1/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p><a href="http://busybox.net/downloads/busybox-1.11.3.tar.bz2">BusyBox 1.11.3</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_11_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_11_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.11.3/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p>
@@ -38,11 +329,11 @@
<li><b>21 August 2008 -- BusyBox 1.12.0 (unstable), BusyBox 1.11.2 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.12.0.tar.bz2">BusyBox 1.12.0</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_12_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_12_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.12.0/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p><a href="http://busybox.net/downloads/busybox-1.11.2.tar.bz2">BusyBox 1.11.2</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_11_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_11_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.11.2/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -178,14 +469,11 @@
<li>xargs: fix -e default to match newer GNU xargs, add SUS mandated -E (closes bug 4414)</li>
<li>other fixes and code size reductions in many applets</li>
</ul>
<p>
The email address gpl@busybox.net is the recommended way to contact
the Software Freedom Law Center to report BusyBox license violations.
</p>
<li><b>12 July 2008 -- BusyBox 1.11.1 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.11.1.tar.bz2">BusyBox 1.11.1</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_11_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_11_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.11.1/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p>
+21 -21
View File
@@ -6,11 +6,11 @@
<li><b>25 June 2008 -- BusyBox 1.11.0 (unstable), BusyBox 1.10.4 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.11.0.tar.bz2">BusyBox 1.11.0</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_11_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_11_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.11.0/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p><a href="http://busybox.net/downloads/busybox-1.10.4.tar.bz2">BusyBox 1.10.4</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_10_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_10_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.10.4/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p>Sizes of busybox-1.10.4 and busybox-1.11.0 (with equivalent config, static uclibc build):<pre>
@@ -77,7 +77,7 @@
<li><b>5 June 2008 -- BusyBox 1.10.3 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.10.3.tar.bz2">BusyBox 1.10.3</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_10_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_10_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.10.3/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p>
@@ -88,7 +88,7 @@
<li><b>8 May 2008 -- BusyBox 1.10.2 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.10.2.tar.bz2">BusyBox 1.10.2</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_10_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_10_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.10.2/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p>
@@ -101,7 +101,7 @@
<li><b>19 April 2008 -- BusyBox 1.10.1 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.10.1.tar.bz2">BusyBox 1.10.1</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_10_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_10_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.10.1/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p>
@@ -111,7 +111,7 @@
<li><b>21 March 2008 -- BusyBox 1.10.0 (unstable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.10.0.tar.bz2">BusyBox 1.10.0</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_10_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_10_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.10.0/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -285,7 +285,7 @@ iproute_list_or_flush 3680 readhere 2308
<li><b>12 February 2008 -- BusyBox 1.9.1 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.9.1.tar.bz2">BusyBox 1.9.1</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_9_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_9_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.9.1/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -298,7 +298,7 @@ iproute_list_or_flush 3680 readhere 2308
<li><b>24 December 2007 -- BusyBox 1.9.0 (unstable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.9.0.tar.bz2">BusyBox 1.9.0</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_9_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_9_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.9.0/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -366,11 +366,11 @@ parse_prompt 4132 insmod_main 3152
<li><b>23 November 2007 -- BusyBox 1.8.2 (stable), BusyBox 1.7.4 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.8.2.tar.bz2">BusyBox 1.8.2</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_8_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_8_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.8.2/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
<p><a href="http://busybox.net/downloads/busybox-1.7.4.tar.bz2">BusyBox 1.7.4</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_7_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_7_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.7.4/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -381,7 +381,7 @@ parse_prompt 4132 insmod_main 3152
<li><b>9 November 2007 -- BusyBox 1.8.1 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.8.1.tar.bz2">BusyBox 1.8.1</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_8_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_8_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.8.1/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -390,7 +390,7 @@ parse_prompt 4132 insmod_main 3152
<li><b>4 November 2007 -- BusyBox 1.8.0 (unstable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.8.0.tar.bz2">BusyBox 1.8.0</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_8_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_8_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.8.0/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -497,7 +497,7 @@ Equivalent .config, i386 uclibc static builds:
<li><b>4 November 2007 -- BusyBox 1.7.3 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.7.3.tar.bz2">BusyBox 1.7.3</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_7_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_7_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.7.3/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -506,7 +506,7 @@ Equivalent .config, i386 uclibc static builds:
<li><b>30 September 2007 -- BusyBox 1.7.2 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.7.2.tar.bz2">BusyBox 1.7.2</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_7_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_7_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.7.2/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -515,7 +515,7 @@ Equivalent .config, i386 uclibc static builds:
<li><b>16 September 2007 -- BusyBox 1.7.1 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.7.1.tar.bz2">BusyBox 1.7.1</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_7_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_7_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.7.1/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -524,7 +524,7 @@ Equivalent .config, i386 uclibc static builds:
<li><b>24 August 2007 -- BusyBox 1.7.0 (unstable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.7.0.tar.bz2">BusyBox 1.7.0</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_7_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_7_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.7.0/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -671,7 +671,7 @@ Same .config built against static uclibc:
<li><b>30 June 2007 -- BusyBox 1.6.1 (stable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.6.1.tar.bz2">BusyBox 1.6.1</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_6_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_6_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.6.1/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -680,7 +680,7 @@ Same .config built against static uclibc:
<li><b>1 June 2007 -- BusyBox 1.6.0 (unstable)</b>
<p><a href="http://busybox.net/downloads/busybox-1.6.0.tar.bz2">BusyBox 1.6.0</a>.
(<a href="http://busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_6_stable/">svn</a>,
(<a href="http://sources.busybox.net/index.py/branches/busybox_1_6_stable/">svn</a>,
<a href="http://busybox.net/downloads/fixes-1.6.0/">patches</a>,
<a href="http://busybox.net/fix.html">how to add a patch</a>)</p>
@@ -1086,7 +1086,7 @@ Same .config built against static uclibc:
several existing applets. This prerelease should be noticeably more
<a href="http://www.opengroup.org/onlinepubs/009695399/">standards
compliant</a> than earlier versions of busybox, although we're
still working out the <a href="http://bugs.busybox.net">bugs</a>.</p>
still working out the <a href="https://bugs.busybox.net">bugs</a>.</p>
<li><b>16 August 2005 -- 1.01 is out</b>
@@ -1102,7 +1102,7 @@ Same .config built against static uclibc:
in their brains at a time. In my case, I'm lucky if I can remember my own
name, much less a bug report posted last week... To prevent your bug report
from getting lost, if you find a bug in BusyBox, please use the
<a href="http://bugs.busybox.net/">shiny new Bug and Patch Tracking System</a>
<a href="https://bugs.busybox.net/">shiny new Bug and Patch Tracking System</a>
to post all the gory details.
<p>
@@ -2042,7 +2042,7 @@ image</a>. Here's how you use it:
Also, some exciting infrastructure news! Busybox now has its own
<a href="lists/busybox/">mailing list</a>,
publically browsable
<a href="/cgi-bin/viewcvs.cgi/trunk/busybox/">CVS tree</a>,
<a href="http://sources.busybox.net/index.py/trunk/busybox/">CVS tree</a>,
anonymous
<a href="cvs_anon.html">CVS access</a>, and
for those that are actively contributing there is even
+2 -1
View File
@@ -114,6 +114,7 @@ And here are products that use BusyBox --
<ul>
<li><a href="http://www.dream-multimedia-tv.de/">Dreambox (Linux based PVR)</a>
<li><a href="http://www.elpa.it/eng/rd129gb.html">RD129 embedded board from ELPA</a>
<li>EMTEC MovieCube R700 uses Busybox 1.1.3.
<li><a href="http://tuxscreen.net">Tuxscreen Linux Phone</a>
@@ -145,7 +146,7 @@ And here are products that use BusyBox --
with source <a href="http://www.usr.com/support/s-gpl-code.asp">here</a>
<li><a href="http://www.actiontec.com/products/broadband/54mbps_wireless_gateway_1p/index.html">
ActionTec GT701-WG Wireless Gateway/DSL Modem</a>
with source <a href="http://128.121.226.214/gtproducts/index.html">here</a>
with source <a href="http://opensource.actiontec.com/">here</a>
<li><a href="http://smartlinux.sourceforge.net/">S.M.A.R.T. Linux</a>
<li><a href="http://www.dlink.com/">DLink - Model GSL-G604T, DSL-300T, and possibly other models</a>
with source <a href="ftp://ftp.dlink.co.uk/dsl_routers_modems/">here,</a>
+2 -2
View File
@@ -18,9 +18,9 @@ grab a copy of the latest version of BusyBox using anonymous svn access:
svn co svn://busybox.net/trunk/busybox</pre>
<p>
The current <em>stable branch</em> can be obtained with
The <em>stable branches</em> can be obtained with
<pre>
svn co svn://busybox.net/branches/busybox_1_12_stable
svn co svn://busybox.net/branches/busybox_1_NN_stable
</pre>
<p>
+92
View File
@@ -0,0 +1,92 @@
/* A sample style sheet for displaying the Subversion directory listing
that is generated by mod_dav_svn and "svnindex.xsl". */
body{
margin: 0;
padding: 0;
}
a {
color: navy;
}
.header {
padding-top: 5px;
text-align: center;
}
.footer {
margin-top: 8em;
padding: 0.5em 1em 0.5em;
border: 1px solid;
border-width: 1px 0;
clear: both;
border-color: rgb(30%,30%,50%) navy rgb(75%,80%,85%) navy;
background: rgb(88%,90%,92%);
font-size: 80%;
}
.svn {
margin: 3em;
}
.rev {
margin-right: 3px;
padding-left: 3px;
text-align: left;
font-size: 120%;
}
.dir a {
text-decoration: none;
color: black;
}
.file a {
text-decoration: none;
color: black;
}
.path {
margin: 3px;
padding: 3px;
background: #FFCC66;
font-size: 120%;
}
.updir {
margin: 3px;
padding: 3px;
margin-left: 3em;
background: #FFEEAA;
}
.file {
margin: 3px;
padding: 3px;
margin-left: 3em;
background: rgb(95%,95%,95%);
}
.file:hover {
margin: 3px;
padding: 3px;
margin-left: 3em;
background: rgb(100%,100%,90%);
/* border: 1px black solid; */
}
.dir {
margin: 3px;
padding: 3px;
margin-left: 3em;
background: rgb(90%,90%,90%);
}
.dir:hover {
margin: 3px;
padding: 3px;
margin-left: 3em;
background: rgb(100%,100%,80%);
/* border: 1px black solid; */
}
+108
View File
@@ -0,0 +1,108 @@
<?xml version="1.0"?>
<!-- A sample XML transformation style sheet for displaying the Subversion
directory listing that is generated by mod_dav_svn when the "SVNIndexXSLT"
directive is used. -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="*"/>
<xsl:template match="svn">
<html>
<head>
<title>
<xsl:if test="string-length(index/@name) != 0">
<xsl:value-of select="index/@name"/>
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:value-of select="index/@path"/>
</title>
<link rel="stylesheet" type="text/css" href="/svnindex.css"/>
</head>
<body>
<div class="header" style="font-family: lucida, helvetica; font-size: 248%">
<xsl:text>BUSYBOX</xsl:text>
</div>
<div class="header">
<a href="http://www.busybox.net"><img src="/images/busybox1.png" border="0" /></a>
</div>
<div class="svn">
<xsl:apply-templates/>
</div>
<div class="footer">
<xsl:text>Powered by </xsl:text>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="@href"/>
</xsl:attribute>
<xsl:text>Subversion</xsl:text>
</xsl:element>
<xsl:text> </xsl:text>
<xsl:value-of select="@version"/>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="index">
<div class="rev">
<xsl:value-of select="@name"/>
<xsl:if test="@base">
<xsl:if test="@name">
<xsl:text>:&#xA0; </xsl:text>
</xsl:if>
<xsl:value-of select="@base" />
</xsl:if>
<xsl:if test="@rev">
<xsl:if test="@base | @name">
<xsl:text> &#x2014; </xsl:text>
</xsl:if>
<xsl:text>Revision </xsl:text>
<xsl:value-of select="@rev"/>
</xsl:if>
</div>
<div class="path">
<xsl:value-of select="@path"/>
</div>
<xsl:apply-templates select="updir"/>
<xsl:apply-templates select="dir"/>
<xsl:apply-templates select="file"/>
</xsl:template>
<xsl:template match="updir">
<div class="updir">
<xsl:text>[</xsl:text>
<xsl:element name="a">
<xsl:attribute name="href">..</xsl:attribute>
<xsl:text>Parent Directory</xsl:text>
</xsl:element>
<xsl:text>]</xsl:text>
</div>
</xsl:template>
<xsl:template match="dir">
<div class="dir">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="@href"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
<xsl:text>/</xsl:text>
</xsl:element>
</div>
</xsl:template>
<xsl:template match="file">
<div class="file">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="@href"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
</xsl:element>
</div>
</xsl:template>
</xsl:stylesheet>
+96
View File
@@ -0,0 +1,96 @@
Logging and backgrounding
By default, bb_[p]error_msg[_and_die] messages go to stderr,
and of course, usually applets do not auto-background. :)
Historically, daemons and inetd services are different.
Busybox is trying to provide compatible behavior, thus if an applet
is emulating an existing utility, it should mimic it. If utility
auto-backgrounds itself, busybox applet should do the same.
If utility normally logs to syslog, busybox applet should do
the same too.
However, busybox should not needlessly restrict the freedom
of the users. And users have different needs and different preferences.
Some might like logging everything from daemons to syslog.
Others prefer running stuff under runsv/svlogd and thus would like
logging to stderr and no daemonization.
To help with that, busybox applets should have options to override
default behavior, whatever that is for a given applet.
Current sutiation is a bit of a mess:
acpid - auto-backgrounds unless -d
crond - auto-backgrounds unless -f, logs to syslog unless -d or -L.
option -d logs to stderr, -L FILE logs to FILE
devfsd - (obsolete)
dnsd - option -d makes it background and log to syslog
fakeidentd - inetd service. Auto-backgrounds and logs to syslog
if no -f and no -i and no -w (-i is "inetd service" flag,
-w is "inetd-wait service" flag)
ftpd - inetd service. Logs to syslog with -S, with -v logs to strerr too
httpd - auto-backgrounds unless -f or -i (-i is "inetd service" flag)
inetd - auto-backgrounds unless -f, logs to syslog unless -e
klogd - auto-backgrounds unless -n
syslogd - auto-backgrounds unless -n
telnetd - auto-backgrounds unless -f or -i (-i is "inetd service" flag)
udhcpc - auto-backgrounds unless -f after lease is obtained,
option -b makes it background sooner (when lease attempt
fails and retries start),
after backgrounding it stops logging to stderr;
logs to stderr, but option -S makes it log *also* to syslog
udhcpd - auto-backgrounds and do not log to stderr unless -f,
otherwise logs to stderr, but option -S makes it log *also* to syslog
zcip - auto-backgrounds and logs *also* to syslog unless -f
Total: 13 applets (+1 obsolete),
4 log to syslog by default (crond fakeidentd inetd zcip),
5 never log to syslog (acpid httpd telnetd klogd syslogd, last two
- for obviously correct reasons),
there are no daemons which always log to syslog,
12 auto-background if not run as inetd servies (all except dnsd.
Note that there is no "standard" dnsd AFAIKS). But see below
for daemons (tcpsvd etc) which don't auto-background.
miscutils/crond.c: logmode = LOGMODE_SYSLOG;
networking/dnsd.c: logmode = LOGMODE_SYSLOG;
networking/ftpd.c: logmode = LOGMODE_NONE;
networking/ftpd.c: logmode |= LOGMODE_SYSLOG;
networking/inetd.c: logmode = LOGMODE_SYSLOG;
networking/isrv_identd.c: logmode = LOGMODE_SYSLOG;
networking/telnetd.c: logmode = LOGMODE_SYSLOG;
networking/udhcp/dhcpc.c: logmode = LOGMODE_NONE;
networking/udhcp/dhcpc.c: logmode |= LOGMODE_SYSLOG;
networking/udhcp/dhcpc.c: logmode &= ~LOGMODE_STDIO;
networking/udhcp/dhcpd.c: logmode = LOGMODE_NONE;
networking/udhcp/dhcpd.c: logmode |= LOGMODE_SYSLOG;
networking/zcip.c: logmode |= LOGMODE_SYSLOG;
These daemons never auto-background and never log to syslog:
lpd - inetd service. Has nothing to log so far, though
dhcprelay - standard behavior
inotifyd - standard behavior
runsv - standard behavior
runsvdir - standard behavior
svlogd - standard behavior
tcpsvd, udpsvd - standard behavior
tftpd - standard behavior
Non-daemons (seems to be use syslog for a good reason):
networking/nameif.c: logmode |= LOGMODE_SYSLOG;
loginutils/chpasswd.c: logmode = LOGMODE_BOTH;
loginutils/chpasswd.c: logmode = LOGMODE_STDIO;
loginutils/getty.c: logmode = LOGMODE_BOTH;
loginutils/getty.c: logmode = LOGMODE_NONE;
loginutils/passwd.c: logmode = LOGMODE_STDIO;
loginutils/passwd.c: logmode = LOGMODE_BOTH;
loginutils/sulogin.c: logmode = LOGMODE_SYSLOG; (used if stdio isn't a tty)
loginutils/sulogin.c: logmode = LOGMODE_BOTH;
util-linux/mount.c: logmode = LOGMODE_SYSLOG; (used in a backgrounded NFS mount helper)
+3 -3
View File
@@ -10,8 +10,8 @@
* Copyright (C) 1991, 1992 Linus Torvalds
*/
#ifndef _LINUX_EXT2_FS_H
#define _LINUX_EXT2_FS_H
#ifndef LINUX_EXT2_FS_H
#define LINUX_EXT2_FS_H 1
/*
* Special inode numbers
@@ -558,4 +558,4 @@ struct ext2_dir_entry_2 {
#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
~EXT2_DIR_ROUND)
#endif /* _LINUX_EXT2_FS_H */
#endif
+1 -2
View File
@@ -2,8 +2,7 @@
/*
* See README for additional information
*
* This file can be redistributed under the terms of the GNU Library General
* Public License
* Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
#include "libbb.h"
+2 -6
View File
@@ -9,9 +9,7 @@
/* Constants and structures */
#include "e2fs_defs.h"
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
/* Iterate a function on each entry of a directory */
int iterate_on_dir(const char *dir_name,
@@ -46,6 +44,4 @@ extern const char e2attr_flags_sname[];
#define e2attr_flags_sname_chattr (&e2attr_flags_sname[1])
#endif
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
+1 -4
View File
@@ -20,10 +20,7 @@
* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
* 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
* Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
/* All filesystem specific hooks have been removed.
+3 -4
View File
@@ -10,9 +10,8 @@
* GNU Lesser General Public License.
* %End-Header%
*/
#ifndef _BLKID_BLKID_H
#define _BLKID_BLKID_H
#ifndef BLKID_BLKID_H
#define BLKID_BLKID_H 1
#include <sys/types.h>
#include <linux/types.h>
@@ -102,4 +101,4 @@ extern int blkid_parse_tag_string(const char *token, char **ret_type,
}
#endif
#endif /* _BLKID_BLKID_H */
#endif
+3 -4
View File
@@ -10,9 +10,8 @@
* GNU Lesser General Public License.
* %End-Header%
*/
#ifndef _BLKID_BLKIDP_H
#define _BLKID_BLKIDP_H
#ifndef BLKID_BLKIDP_H
#define BLKID_BLKIDP_H 1
#include <sys/types.h>
#include <stdio.h>
@@ -184,4 +183,4 @@ extern void blkid_free_dev(blkid_dev dev);
}
#endif
#endif /* _BLKID_BLKIDP_H */
#endif
+2 -2
View File
@@ -273,7 +273,7 @@ int blkid_probe_all(blkid_cache cache)
return -BLKID_ERR_PARAM;
if (cache->bic_flags & BLKID_BIC_FL_PROBED &&
time(0) - cache->bic_time < BLKID_PROBE_INTERVAL)
time(NULL) - cache->bic_time < BLKID_PROBE_INTERVAL)
return 0;
blkid_read_cache(cache);
@@ -335,7 +335,7 @@ int blkid_probe_all(blkid_cache cache)
fclose(proc);
cache->bic_time = time(0);
cache->bic_time = time(NULL);
cache->bic_flags |= BLKID_BIC_FL_PROBED;
blkid_flush_cache(cache);
return 0;
+2 -2
View File
@@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */
#if !defined(_BLKID_LIST_H) && !defined(LIST_HEAD)
#define _BLKID_LIST_H
#define BLKID_LIST_H 1
#ifdef __cplusplus
extern "C" {
@@ -70,4 +70,4 @@ void list_splice(struct list_head *list, struct list_head *head);
}
#endif
#endif /* _BLKID_LIST_H */
#endif
+2 -2
View File
@@ -562,7 +562,7 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
if (!dev)
return NULL;
now = time(0);
now = time(NULL);
diff = now - dev->bid_time;
if ((now < dev->bid_time) ||
@@ -659,7 +659,7 @@ try_again:
found_type:
if (dev && type) {
dev->bid_devno = st.st_rdev;
dev->bid_time = time(0);
dev->bid_time = time(NULL);
dev->bid_flags |= BLKID_BID_FL_VERIFIED;
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
+8 -9
View File
@@ -11,9 +11,8 @@
* GNU Lesser General Public License.
* %End-Header%
*/
#ifndef _BLKID_PROBE_H
#define _BLKID_PROBE_H
#ifndef BLKID_PROBE_H
#define BLKID_PROBE_H 1
#include <linux/types.h>
@@ -308,9 +307,9 @@ _INLINE_ __u32 blkid_swab32(__u32 val)
#ifdef EXT2FS_REQUIRE_486
__asm__("bswap %0" : "=r" (val) : "0" (val));
#else
__asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
"rorl $16,%0\n\t" /* swap words */
"xchgb %b0,%h0" /* swap higher bytes */
__asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
"rorl $16,%0\n\t" /* swap words */
"xchgb %b0,%h0" /* swap higher bytes */
:"=q" (val)
: "0" (val));
#endif
@@ -319,9 +318,9 @@ _INLINE_ __u32 blkid_swab32(__u32 val)
_INLINE_ __u16 blkid_swab16(__u16 val)
{
__asm__("xchgb %b0,%h0" /* swap bytes */ \
: "=q" (val) \
: "0" (val)); \
__asm__("xchgb %b0,%h0" /* swap bytes */
: "=q" (val)
: "0" (val));
return val;
}
+3 -3
View File
@@ -6,8 +6,8 @@
* instead. This makes upgrade between e2fsprogs versions easy.
*/
#ifndef __E2FSBB_H__
#define __E2FSBB_H__ 1
#ifndef E2FSBB_H
#define E2FSBB_H 1
#include "libbb.h"
@@ -40,4 +40,4 @@ typedef long errcode_t;
#define WORDS_BIGENDIAN 1
#endif
#endif /* __E2FSBB_H__ */
#endif
+19 -19
View File
@@ -2270,7 +2270,7 @@ static void e2fsck_move_ext3_journal(e2fsck_t ctx)
ext2fs_mark_super_dirty(fs);
fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
inode.i_links_count = 0;
inode.i_dtime = time(0);
inode.i_dtime = time(NULL);
if ((retval = ext2fs_write_inode(fs, ino, &inode)) != 0)
goto err_out;
@@ -3381,7 +3381,7 @@ static void e2fsck_pass1(e2fsck_t ctx)
*/
if (!LINUX_S_ISDIR(inode->i_mode)) {
if (fix_problem(ctx, PR_1_ROOT_NO_DIR, &pctx)) {
inode->i_dtime = time(0);
inode->i_dtime = time(NULL);
inode->i_links_count = 0;
ext2fs_icount_store(ctx->inode_link_info,
ino, 0);
@@ -3475,7 +3475,7 @@ static void e2fsck_pass1(e2fsck_t ctx)
inode->i_dtime < ctx->fs->super->s_inodes_count) {
if (fix_problem(ctx, PR_1_LOW_DTIME, &pctx)) {
inode->i_dtime = inode->i_links_count ?
0 : time(0);
0 : time(NULL);
e2fsck_write_inode(ctx, ino, inode,
"pass1");
}
@@ -3489,7 +3489,7 @@ static void e2fsck_pass1(e2fsck_t ctx)
if (!inode->i_dtime && inode->i_mode) {
if (fix_problem(ctx,
PR_1_ZERO_DTIME, &pctx)) {
inode->i_dtime = time(0);
inode->i_dtime = time(NULL);
e2fsck_write_inode(ctx, ino, inode,
"pass1");
}
@@ -3659,7 +3659,7 @@ static void e2fsck_pass1(e2fsck_t ctx)
}
e2fsck_read_inode(ctx, EXT2_RESIZE_INO, inode,
"recreate inode");
inode->i_mtime = time(0);
inode->i_mtime = time(NULL);
e2fsck_write_inode(ctx, EXT2_RESIZE_INO, inode,
"recreate inode");
fs->block_map = save_bmap;
@@ -4169,7 +4169,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
if (pb.clear) {
inode->i_links_count = 0;
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
inode->i_dtime = time(0);
inode->i_dtime = time(NULL);
dirty_inode++;
ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, ino);
ext2fs_unmark_inode_bitmap(ctx->inode_reg_map, ino);
@@ -4202,7 +4202,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
if (fix_problem(ctx, PR_1_ZERO_LENGTH_DIR, pctx)) {
inode->i_links_count = 0;
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
inode->i_dtime = time(0);
inode->i_dtime = time(NULL);
dirty_inode++;
ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, ino);
ext2fs_unmark_inode_bitmap(ctx->inode_reg_map, ino);
@@ -5147,7 +5147,7 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
/* Inode may have changed by block_iterate, so reread it */
e2fsck_read_inode(ctx, ino, &inode, "delete_file");
inode.i_links_count = 0;
inode.i_dtime = time(0);
inode.i_dtime = time(NULL);
if (inode.i_file_acl &&
(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
count = 1;
@@ -6393,7 +6393,7 @@ static void deallocate_inode(e2fsck_t ctx, ext2_ino_t ino, char* block_buf)
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
e2fsck_read_inode(ctx, ino, &inode, "deallocate_inode");
inode.i_links_count = 0;
inode.i_dtime = time(0);
inode.i_dtime = time(NULL);
e2fsck_write_inode(ctx, ino, &inode, "deallocate_inode");
clear_problem_context(&pctx);
pctx.ino = ino;
@@ -6890,7 +6890,7 @@ static void check_root(e2fsck_t ctx)
memset(&inode, 0, sizeof(inode));
inode.i_mode = 040755;
inode.i_size = fs->blocksize;
inode.i_atime = inode.i_ctime = inode.i_mtime = time(0);
inode.i_atime = inode.i_ctime = inode.i_mtime = time(NULL);
inode.i_links_count = 2;
inode.i_blocks = fs->blocksize / 512;
inode.i_block[0] = blk;
@@ -7138,7 +7138,7 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix)
memset(&inode, 0, sizeof(inode));
inode.i_mode = 040700;
inode.i_size = fs->blocksize;
inode.i_atime = inode.i_ctime = inode.i_mtime = time(0);
inode.i_atime = inode.i_ctime = inode.i_mtime = time(NULL);
inode.i_links_count = 2;
inode.i_blocks = fs->blocksize / 512;
inode.i_block[0] = blk;
@@ -7492,7 +7492,7 @@ static int disconnect_inode(e2fsck_t ctx, ext2_ino_t i)
if (fix_problem(ctx, PR_4_ZERO_LEN_INODE, &pctx)) {
ext2fs_icount_store(ctx->inode_link_info, i, 0);
inode.i_links_count = 0;
inode.i_dtime = time(0);
inode.i_dtime = time(NULL);
e2fsck_write_inode(ctx, i, &inode,
"disconnect_inode");
/*
@@ -11558,7 +11558,7 @@ static int release_orphan_inodes(e2fsck_t ctx)
if (!inode.i_links_count) {
ext2fs_inode_alloc_stats2(fs, ino, -1,
LINUX_S_ISDIR(inode.i_mode));
inode.i_dtime = time(0);
inode.i_dtime = time(NULL);
} else {
inode.i_dtime = 0;
}
@@ -12632,7 +12632,7 @@ static void check_mount(e2fsck_t ctx)
retval = ext2fs_check_if_mounted(ctx->filesystem_name,
&ctx->mount_flags);
if (retval) {
bb_error_msg(_("while determining whether %s is mounted."),
bb_error_msg(_("while determining whether %s is mounted"),
ctx->filesystem_name);
return;
}
@@ -12653,7 +12653,7 @@ static void check_mount(e2fsck_t ctx)
printf(_("%s is mounted. "), ctx->filesystem_name);
if (!ctx->interactive)
bb_error_msg_and_die(_("Cannot continue, aborting."));
bb_error_msg_and_die(_("cannot continue, aborting"));
printf(_("\n\n\007\007\007\007WARNING!!! "
"Running e2fsck on a mounted filesystem may cause\n"
"SEVERE filesystem damage.\007\007\007\n\n"));
@@ -12714,7 +12714,7 @@ static void check_if_skip(e2fsck_t ctx)
unsigned int reason_arg = 0;
long next_check;
int batt = is_on_batt();
time_t now = time(0);
time_t now = time(NULL);
if ((ctx->options & E2F_OPT_FORCE) || cflag || swapfs)
return;
@@ -12892,7 +12892,7 @@ static int e2fsck_update_progress(e2fsck_t ctx, int pass,
if (ctx->progress_fd) {
sprintf(buf, "%d %lu %lu\n", pass, cur, max);
write(ctx->progress_fd, buf, strlen(buf));
xwrite_str(ctx->progress_fd, buf);
} else {
percent = calc_percent(&e2fsck_tbl, pass, cur, max);
e2fsck_simple_progress(ctx, ctx->device_name,
@@ -13060,7 +13060,7 @@ static errcode_t PRS(int argc, char **argv, e2fsck_t *ret_ctx)
case 'a':
if (ctx->options & (E2F_OPT_YES|E2F_OPT_NO)) {
conflict_opt:
bb_error_msg_and_die(_("Only one the options -p/-a, -n or -y may be specified."));
bb_error_msg_and_die(_("only one the options -p/-a, -n or -y may be specified"));
}
ctx->options |= E2F_OPT_PREEN;
break;
@@ -13405,7 +13405,7 @@ restart:
#ifdef ENABLE_COMPRESSION
/* FIXME - do we support this at all? */
if (sb->s_feature_incompat & EXT2_FEATURE_INCOMPAT_COMPRESSION)
bb_error_msg(_("Warning: compression support is experimental."));
bb_error_msg(_("warning: compression support is experimental"));
#endif
#ifndef ENABLE_HTREE
if (sb->s_feature_compat & EXT2_FEATURE_COMPAT_DIR_INDEX) {
+2 -2
View File
@@ -125,9 +125,9 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list)
if (retval)
goto cleanup;
inode.i_atime = inode.i_mtime = time(0);
inode.i_atime = inode.i_mtime = time(NULL);
if (!inode.i_ctime)
inode.i_ctime = time(0);
inode.i_ctime = time(NULL);
inode.i_blocks = rec.bad_block_count * (fs->blocksize / 512);
inode.i_size = rec.bad_block_count * fs->blocksize;
+3 -4
View File
@@ -13,9 +13,8 @@
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
#ifndef _LINUX_EXT2_FS_H
#define _LINUX_EXT2_FS_H
#ifndef LINUX_EXT2_FS_H
#define LINUX_EXT2_FS_H 1
#include "ext2_types.h" /* Changed from linux/types.h */
@@ -567,4 +566,4 @@ struct ext2_dir_entry_2 {
#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
~EXT2_DIR_ROUND)
#endif /* _LINUX_EXT2_FS_H */
#endif
+3 -5
View File
@@ -9,9 +9,8 @@
* License.
* %End-Header%
*/
#ifndef _EXT2FS_EXT2_IO_H
#define _EXT2FS_EXT2_IO_H
#ifndef EXT2FS_EXT2_IO_H
#define EXT2FS_EXT2_IO_H 1
/*
* ext2_loff_t is defined here since unix_io.c needs it.
@@ -110,5 +109,4 @@ extern void (*test_io_cb_write_blk)
extern void (*test_io_cb_set_blksize)
(int blksize, errcode_t err);
#endif /* _EXT2FS_EXT2_IO_H */
#endif
+3 -4
View File
@@ -9,9 +9,8 @@
* License.
* %End-Header%
*/
#ifndef _EXT2FS_EXT2FS_H
#define _EXT2FS_EXT2FS_H
#ifndef EXT2FS_EXT2FS_H
#define EXT2FS_EXT2FS_H 1
#define EXT2FS_ATTR(x)
@@ -920,4 +919,4 @@ extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
}
#endif
#endif /* _EXT2FS_EXT2FS_H */
#endif
+3 -4
View File
@@ -13,9 +13,8 @@
* Definitions for transaction data structures for the buffer cache
* filesystem journaling support.
*/
#ifndef _LINUX_JBD_H
#define _LINUX_JBD_H
#ifndef LINUX_JBD_H
#define LINUX_JBD_H 1
#include <sys/types.h>
#include <linux/types.h>
@@ -233,4 +232,4 @@ extern void journal_brelse_array(struct buffer_head *b[], int n);
extern void journal_destroy_revoke(journal_t *);
#endif /* _LINUX_JBD_H */
#endif
+2 -2
View File
@@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */
#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H
#ifndef LINUX_LIST_H
#define LINUX_LIST_H 1
/*
* Simple doubly linked list implementation.
+1 -1
View File
@@ -231,7 +231,7 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino,
inode.i_size += fs->blocksize * size;
inode.i_blocks += (fs->blocksize / 512) * es.newblocks;
inode.i_mtime = inode.i_ctime = time(0);
inode.i_mtime = inode.i_ctime = time(NULL);
inode.i_links_count = 1;
inode.i_mode = LINUX_S_IFREG | 0600;
+2 -2
View File
@@ -117,7 +117,7 @@ errcode_t ext2fs_create_resize_inode(ext2_filsys fs)
sb->s_feature_ro_compat |=
EXT2_FEATURE_RO_COMPAT_LARGE_FILE;
}
inode.i_ctime = time(0);
inode.i_ctime = time(NULL);
}
for (rsv_off = 0, gdt_off = fs->desc_blocks,
@@ -209,7 +209,7 @@ out_inode:
inode.i_size);
#endif
if (inode_dirty) {
inode.i_atime = inode.i_mtime = time(0);
inode.i_atime = inode.i_mtime = time(NULL);
retval2 = ext2fs_write_inode(fs, EXT2_RESIZE_INO, &inode);
if (!retval)
retval = retval2;
+1 -4
View File
@@ -20,10 +20,7 @@
* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
* 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
* Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
#include <sys/types.h>
+1 -2
View File
@@ -5,8 +5,7 @@
* Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
* 2003, 2004, 2005 by Theodore Ts'o.
*
* This file may be redistributed under the terms of the GNU Public
* License.
* Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
/* Usage: mke2fs [options] device
+1 -4
View File
@@ -8,10 +8,7 @@
*
* Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
* Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
/*
+1 -4
View File
@@ -4,10 +4,7 @@
*
* Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
* Licensed under GPLv2, see file LICENSE in this tarball for details.
*/
#include <stdio.h>
+1 -1
View File
@@ -165,7 +165,7 @@ static int get_node_id(unsigned char *node_id)
n = ifc.ifc_len;
for (i = 0; i < n; i+= ifreq_size(*ifrp) ) {
ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);
strncpy_IFNAMSIZ(ifr.ifr_name, ifrp->ifr_name);
#ifdef SIOCGIFHWADDR
if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
continue;
+2 -3
View File
@@ -32,9 +32,8 @@
* DAMAGE.
* %End-Header%
*/
#ifndef _UUID_UUID_H
#define _UUID_UUID_H
#ifndef UUID_UUID_H
#define UUID_UUID_H 1
#include <sys/types.h>
#include <time.h>
+38 -24
View File
@@ -366,25 +366,22 @@ static const uint32_t tokeninfo[] = {
enum {
CONVFMT, OFMT, FS, OFS,
ORS, RS, RT, FILENAME,
SUBSEP, ARGIND, ARGC, ARGV,
ERRNO, FNR,
NR, NF, IGNORECASE,
ENVIRON, F0, NUM_INTERNAL_VARS
SUBSEP, F0, ARGIND, ARGC,
ARGV, ERRNO, FNR, NR,
NF, IGNORECASE, ENVIRON, NUM_INTERNAL_VARS
};
static const char vNames[] ALIGN1 =
"CONVFMT\0" "OFMT\0" "FS\0*" "OFS\0"
"ORS\0" "RS\0*" "RT\0" "FILENAME\0"
"SUBSEP\0" "ARGIND\0" "ARGC\0" "ARGV\0"
"ERRNO\0" "FNR\0"
"NR\0" "NF\0*" "IGNORECASE\0*"
"ENVIRON\0" "$\0*" "\0";
"SUBSEP\0" "$\0*" "ARGIND\0" "ARGC\0"
"ARGV\0" "ERRNO\0" "FNR\0" "NR\0"
"NF\0*" "IGNORECASE\0*" "ENVIRON\0" "\0";
static const char vValues[] ALIGN1 =
"%.6g\0" "%.6g\0" " \0" " \0"
"\n\0" "\n\0" "\0" "\0"
"\034\0"
"\377";
"\034\0" "\0" "\377";
/* hash size may grow to these values */
#define FIRST_PRIME 61
@@ -392,8 +389,12 @@ static const uint16_t PRIMES[] ALIGN2 = { 251, 1021, 4093, 16381, 65521 };
/* Globals. Split in two parts so that first one is addressed
* with (mostly short) negative offsets */
* with (mostly short) negative offsets.
* NB: it's unsafe to put members of type "double"
* into globals2 (gcc may fail to align them).
*/
struct globals {
double t_double;
chain beginseq, mainseq, endseq;
chain *seq;
node *break_ptr, *continue_ptr;
@@ -442,16 +443,16 @@ struct globals2 {
tsplitter exec_builtin__tspl;
/* biggest and least used members go last */
double t_double;
tsplitter fsplitter, rsplitter;
};
#define G1 (ptr_to_globals[-1])
#define G (*(struct globals2 *)ptr_to_globals)
/* For debug. nm --size-sort awk.o | grep -vi ' [tr] ' */
/* char G1size[sizeof(G1)]; - 0x6c */
/* char Gsize[sizeof(G)]; - 0x1cc */
/*char G1size[sizeof(G1)]; - 0x74 */
/*char Gsize[sizeof(G)]; - 0x1c4 */
/* Trying to keep most of members accessible with short offsets: */
/* char Gofs_seed[offsetof(struct globals2, evaluate__seed)]; - 0x90 */
/*char Gofs_seed[offsetof(struct globals2, evaluate__seed)]; - 0x90 */
#define t_double (G1.t_double )
#define beginseq (G1.beginseq )
#define mainseq (G1.mainseq )
#define endseq (G1.endseq )
@@ -479,7 +480,6 @@ struct globals2 {
#define t_info (G.t_info )
#define t_tclass (G.t_tclass )
#define t_string (G.t_string )
#define t_double (G.t_double )
#define t_lineno (G.t_lineno )
#define t_rollback (G.t_rollback )
#define intvar (G.intvar )
@@ -604,8 +604,8 @@ static void *hash_find(xhash *hash, const char *name)
hash_rebuild(hash);
l = strlen(name) + 1;
hi = xzalloc(sizeof(hash_item) + l);
memcpy(hi->name, name, l);
hi = xzalloc(sizeof(*hi) + l);
strcpy(hi->name, name);
idx = hashidx(name) % hash->csize;
hi->next = hash->items[idx];
@@ -1482,6 +1482,7 @@ static node *mk_splitter(const char *s, tsplitter *spl)
*/
static regex_t *as_regex(node *op, regex_t *preg)
{
int cflags;
var *v;
const char *s;
@@ -1490,7 +1491,17 @@ static regex_t *as_regex(node *op, regex_t *preg)
}
v = nvalloc(1);
s = getvar_s(evaluate(op, v));
xregcomp(preg, s, icase ? REG_EXTENDED | REG_ICASE : REG_EXTENDED);
cflags = icase ? REG_EXTENDED | REG_ICASE : REG_EXTENDED;
/* Testcase where REG_EXTENDED fails (unpaired '{'):
* echo Hi | awk 'gsub("@(samp|code|file)\{","");'
* gawk 3.1.5 eats this. We revert to ~REG_EXTENDED
* (maybe gsub is not supposed to use REG_EXTENDED?).
*/
if (regcomp(preg, s, cflags)) {
cflags &= ~REG_EXTENDED;
xregcomp(preg, s, cflags);
}
nvfree(v);
return preg;
}
@@ -1560,10 +1571,14 @@ static int awk_split(const char *s, node *spl, char **slist)
n++; /* we saw yet another delimiter */
} else {
pmatch[0].rm_eo = l;
if (s[l]) pmatch[0].rm_eo++;
if (s[l])
pmatch[0].rm_eo++;
}
memcpy(s1, s, l);
s1[l] = '\0';
/* make sure we remove *all* of the separator chars */
do {
s1[l] = '\0';
} while (++l < pmatch[0].rm_eo);
nextword(&s1);
s += pmatch[0].rm_eo;
} while (*s);
@@ -1856,7 +1871,6 @@ static int fmt_num(char *b, int size, const char *format, double n, int int_as_i
return r;
}
/* formatted output into an allocated buffer, return ptr to buffer */
static char *awk_printf(node *n)
{
@@ -2866,18 +2880,18 @@ int awk_main(int argc, char **argv)
parse_program(s + 1);
free(s);
} while (list_f);
argc++;
} else { // no -f: take program from 1st parameter
if (!argc)
bb_show_usage();
g_progname = "cmd. line";
parse_program(*argv++);
argc--;
}
if (opt & 0x8) // -W
bb_error_msg("warning: unrecognized option '-W %s' ignored", opt_W);
/* fill in ARGV array */
setvar_i(intvar[ARGC], argc + 1);
setvar_i(intvar[ARGC], argc);
setari_u(intvar[ARGV], 0, "awk");
i = 0;
while (*argv)
+7 -9
View File
@@ -858,7 +858,7 @@ static void print_header(const char *file1, const char *file2)
* lines appended (beginning at b). If c is greater than d then there are
* lines missing from the to file.
*/
static void change(char *file1, FILE *f1, char *file2, FILE *f2,
static void change(const char *file1, FILE *f1, const char *file2, FILE *f2,
int a, int b, int c, int d)
{
if ((a > b && c > d) || (option_mask32 & FLAG_q)) {
@@ -902,7 +902,7 @@ static void change(char *file1, FILE *f1, char *file2, FILE *f2,
}
static void output(char *file1, FILE *f1, char *file2, FILE *f2)
static void output(const char *file1, FILE *f1, const char *file2, FILE *f2)
{
/* Note that j0 and j1 can't be used as they are defined in math.h.
* This also allows the rather amusing variable 'j00'... */
@@ -999,7 +999,7 @@ static void output(char *file1, FILE *f1, char *file2, FILE *f2)
*/
/* NB: files can be not REGular. The only sure thing that they
* are not both DIRectories. */
static unsigned diffreg(char *file1, char *file2, int flags)
static unsigned diffreg(const char *file1, const char *file2, int flags)
{
int *member; /* will be overlaid on nfile[1] */
int *class; /* will be overlaid on nfile[0] */
@@ -1022,13 +1022,11 @@ static unsigned diffreg(char *file1, char *file2, int flags)
if (flags & D_EMPTY1)
/* can't be stdin, but xfopen_stdin() is smaller code */
f1 = xfopen_stdin(bb_dev_null);
else
f1 = xfopen_stdin(file1);
file1 = bb_dev_null;
f1 = xfopen_stdin(file1);
if (flags & D_EMPTY2)
f2 = xfopen_stdin(bb_dev_null);
else
f2 = xfopen_stdin(file2);
file2 = bb_dev_null;
f2 = xfopen_stdin(file2);
/* NB: if D_EMPTY1/2 is set, other file is always a regular file,
* not pipe/fifo/chardev/etc - D_EMPTY is used by "diff -r" only,
+93 -64
View File
@@ -300,13 +300,17 @@ static void dot_delete(void); // delete the char at 'dot'
static char *bound_dot(char *); // make sure text[0] <= P < "end"
static char *new_screen(int, int); // malloc virtual screen memory
static char *char_insert(char *, char); // insert the char c at 'p'
static char *stupid_insert(char *, char); // stupidly insert the char c at 'p'
// might reallocate text[]! use p += stupid_insert(p, ...),
// and be careful to not use pointers into potentially freed text[]!
static uintptr_t stupid_insert(char *, char); // stupidly insert the char c at 'p'
static int find_range(char **, char **, char); // return pointers for an object
static int st_test(char *, int, int, char *); // helper for skip_thing()
static char *skip_thing(char *, int, int, int); // skip some object
static char *find_pair(char *, char); // find matching pair () [] {}
static char *text_hole_delete(char *, char *); // at "p", delete a 'size' byte hole
static char *text_hole_make(char *, int); // at "p", make a 'size' byte hole
// might reallocate text[]! use p += text_hole_make(p, ...),
// and be careful to not use pointers into potentially freed text[]!
static uintptr_t text_hole_make(char *, int); // at "p", make a 'size' byte hole
static char *yank_delete(char *, char *, int, int); // yank text[] into register then delete
static void show_help(void); // display some help info
static void rawmode(void); // set "raw" mode on tty
@@ -316,11 +320,11 @@ static int mysleep(int);
static int readit(void); // read (maybe cursor) key from stdin
static int get_one_char(void); // read 1 char from stdin
static int file_size(const char *); // what is the byte size of "fn"
#if ENABLE_FEATURE_VI_READONLY
static int file_insert(const char *, char *, int);
#else
static int file_insert(const char *, char *);
#if !ENABLE_FEATURE_VI_READONLY
#define file_insert(fn, p, update_ro_status) file_insert(fn, p)
#endif
// file_insert might reallocate text[]!
static int file_insert(const char *, char *, int);
static int file_write(char *, char *, char *);
#if !ENABLE_FEATURE_VI_OPTIMIZE_CURSOR
#define place_cursor(a, b, optimize) place_cursor(a, b)
@@ -370,7 +374,9 @@ static void end_cmd_q(void); // stop saving input chars
static void showmatching(char *); // show the matching pair () [] {}
#endif
#if ENABLE_FEATURE_VI_YANKMARK || (ENABLE_FEATURE_VI_COLON && ENABLE_FEATURE_VI_SEARCH) || ENABLE_FEATURE_VI_CRASHME
static char *string_insert(char *, char *); // insert the string at 'p'
// might reallocate text[]! use p += string_insert(p, ...),
// and be careful to not use pointers into potentially freed text[]!
static uintptr_t string_insert(char *, const char *); // insert the string at 'p'
#endif
#if ENABLE_FEATURE_VI_YANKMARK
static char *text_yank(char *, char *, int); // save copy of "p" into a register
@@ -486,8 +492,7 @@ static int init_text_buffer(char *fn)
char_insert(text, '\n');
rc = 0;
} else {
rc = file_insert(fn, text
USE_FEATURE_VI_READONLY(, 1));
rc = file_insert(fn, text, 1);
}
file_modified = 0;
last_file_modified = -1;
@@ -584,7 +589,8 @@ static void edit_file(char *fn)
crash_dummy(); // generate a random command
} else {
crashme = 0;
dot = string_insert(text, "\n\n##### Ran out of text to work on. #####\n\n"); // insert the string
string_insert(text, "\n\n##### Ran out of text to work on. #####\n\n"); // insert the string
dot = text;
refresh(FALSE);
}
}
@@ -656,7 +662,7 @@ static char *get_one_address(char *p, int *addr) // get colon addr, if present
c = c - 'a';
q = mark[(unsigned char) c];
if (q != NULL) { // is mark valid
*addr = count_lines(text, q); // count lines
*addr = count_lines(text, q);
}
}
}
@@ -976,7 +982,11 @@ static void colon(char *buf)
// read after current line- unless user said ":0r foo"
if (b != 0)
q = next_line(q);
ch = file_insert(fn, q USE_FEATURE_VI_READONLY(, 0));
{ // dance around potentially-reallocated text[]
uintptr_t ofs = q - text;
ch = file_insert(fn, q, 0);
q = text + ofs;
}
if (ch < 0)
goto vc1; // nothing was inserted
// how many lines in text[]?
@@ -990,7 +1000,7 @@ static void colon(char *buf)
// if the insert is before "dot" then we need to update
if (q <= dot)
dot += ch;
file_modified++;
/*file_modified++; - done by file_insert */
}
} else if (strncasecmp(cmd, "rewind", i) == 0) { // rewind cmd line args
if (file_modified && !useforce) {
@@ -1063,10 +1073,12 @@ static void colon(char *buf)
c = orig_buf[1]; // what is the delimiter
F = orig_buf + 2; // start of "find"
R = strchr(F, c); // middle delimiter
if (!R) goto colon_s_fail;
if (!R)
goto colon_s_fail;
*R++ = '\0'; // terminate "find"
buf1 = strchr(R, c);
if (!buf1) goto colon_s_fail;
if (!buf1)
goto colon_s_fail;
*buf1++ = '\0'; // terminate "replace"
if (*buf1 == 'g') { // :s/foo/bar/g
buf1++;
@@ -1084,10 +1096,14 @@ static void colon(char *buf)
vc4:
buf1 = char_search(q, F, FORWARD, LIMITED); // search cur line only for "find"
if (buf1) {
uintptr_t bias;
// we found the "find" pattern - delete it
text_hole_delete(buf1, buf1 + strlen(F) - 1);
// inset the "replace" patern
string_insert(buf1, R); // insert the string
bias = string_insert(buf1, R); // insert the string
buf1 += bias;
ls += bias;
/*q += bias; - recalculated anyway */
// check for "global" :s/foo/bar/g
if (gflag == 1) {
if ((buf1 + strlen(R)) < end_line(ls)) {
@@ -1623,8 +1639,7 @@ static char *char_search(char *p, const char *pat, int dir, int range)
static char *char_insert(char *p, char c) // insert the char c at 'p'
{
if (c == 22) { // Is this an ctrl-V?
p = stupid_insert(p, '^'); // use ^ to indicate literal next
p--; // backup onto ^
p += stupid_insert(p, '^'); // use ^ to indicate literal next
refresh(FALSE); // show the ^
c = get_one_char();
*p = c;
@@ -1651,17 +1666,23 @@ static char *char_insert(char *p, char c) // insert the char c at 'p'
if (c == 13)
c = '\n'; // translate \r to \n
sp = p; // remember addr of insert
p = stupid_insert(p, c); // insert the char
p += 1 + stupid_insert(p, c); // insert the char
#if ENABLE_FEATURE_VI_SETOPTS
if (showmatch && strchr(")]}", *sp) != NULL) {
showmatching(sp);
}
if (autoindent && c == '\n') { // auto indent the new line
char *q;
q = prev_line(p); // use prev line as templet
for (; isblank(*q); q++) {
p = stupid_insert(p, *q); // insert the char
size_t len;
q = prev_line(p); // use prev line as template
len = strspn(q, " \t"); // space or tab
if (len) {
uintptr_t bias;
bias = text_hole_make(p, len);
p += bias;
q += bias;
memcpy(p, q, len);
p += len;
}
}
#endif
@@ -1669,12 +1690,16 @@ static char *char_insert(char *p, char c) // insert the char c at 'p'
return p;
}
static char *stupid_insert(char *p, char c) // stupidly insert the char c at 'p'
// might reallocate text[]! use p += stupid_insert(p, ...),
// and be careful to not use pointers into potentially freed text[]!
static uintptr_t stupid_insert(char *p, char c) // stupidly insert the char c at 'p'
{
p = text_hole_make(p, 1);
uintptr_t bias;
bias = text_hole_make(p, 1);
p += bias;
*p = c;
//file_modified++; - done by text_hole_make()
return p + 1;
return bias;
}
static int find_range(char **start, char **stop, char c)
@@ -1854,26 +1879,31 @@ static void showmatching(char *p)
}
#endif /* FEATURE_VI_SETOPTS */
// open a hole in text[]
static char *text_hole_make(char *p, int size) // at "p", make a 'size' byte hole
// open a hole in text[]
// might reallocate text[]! use p += text_hole_make(p, ...),
// and be careful to not use pointers into potentially freed text[]!
static uintptr_t text_hole_make(char *p, int size) // at "p", make a 'size' byte hole
{
uintptr_t bias = 0;
if (size <= 0)
return p;
return bias;
end += size; // adjust the new END
if (end >= (text + text_size)) {
char *new_text;
text_size += end - (text + text_size) + 10240;
new_text = xrealloc(text, text_size);
screenbegin = new_text + (screenbegin - text);
dot = new_text + (dot - text);
end = new_text + (end - text);
p = new_text + (p - text);
bias = (new_text - text);
screenbegin += bias;
dot += bias;
end += bias;
p += bias;
text = new_text;
}
memmove(p + size, p, end - size - p);
memset(p, ' ', size); // clear new hole
file_modified++;
return p;
return bias;
}
// close a hole in text[]
@@ -2006,42 +2036,41 @@ static void end_cmd_q(void)
#if ENABLE_FEATURE_VI_YANKMARK \
|| (ENABLE_FEATURE_VI_COLON && ENABLE_FEATURE_VI_SEARCH) \
|| ENABLE_FEATURE_VI_CRASHME
static char *string_insert(char *p, char *s) // insert the string at 'p'
// might reallocate text[]! use p += string_insert(p, ...),
// and be careful to not use pointers into potentially freed text[]!
static uintptr_t string_insert(char *p, const char *s) // insert the string at 'p'
{
int cnt, i;
uintptr_t bias;
int i;
i = strlen(s);
text_hole_make(p, i);
strncpy(p, s, i);
for (cnt = 0; *s != '\0'; s++) {
if (*s == '\n')
cnt++;
}
bias = text_hole_make(p, i);
p += bias;
memcpy(p, s, i);
#if ENABLE_FEATURE_VI_YANKMARK
status_line("Put %d lines (%d chars) from [%c]", cnt, i, what_reg());
{
int cnt;
for (cnt = 0; *s != '\0'; s++) {
if (*s == '\n')
cnt++;
}
status_line("Put %d lines (%d chars) from [%c]", cnt, i, what_reg());
}
#endif
return p;
return bias;
}
#endif
#if ENABLE_FEATURE_VI_YANKMARK
static char *text_yank(char *p, char *q, int dest) // copy text into a register
{
char *t;
int cnt;
if (q < p) { // they are backwards- reverse them
t = q;
q = p;
p = t;
int cnt = q - p;
if (cnt < 0) { // they are backwards- reverse them
p = q;
cnt = -cnt;
}
cnt = q - p + 1;
t = reg[dest];
free(t); // if already a yank register, free it
t = xmalloc(cnt + 1); // get a new register
memset(t, '\0', cnt + 1); // clear new text[]
strncpy(t, p, cnt); // copy text[] into bufer
reg[dest] = t;
free(reg[dest]); // if already a yank register, free it
reg[dest] = xstrndup(p, cnt + 1);
return p;
}
@@ -2273,8 +2302,8 @@ static int file_size(const char *fn) // what is the byte size of "fn"
return cnt;
}
static int file_insert(const char *fn, char *p
USE_FEATURE_VI_READONLY(, int update_ro_status))
// might reallocate text[]!
static int file_insert(const char *fn, char *p, int update_ro_status)
{
int cnt = -1;
int fd, size;
@@ -2302,7 +2331,7 @@ static int file_insert(const char *fn, char *p
goto fi0;
}
size = statbuf.st_size;
p = text_hole_make(p, size);
p += text_hole_make(p, size);
cnt = safe_read(fd, p, size);
if (cnt < 0) {
status_line_bold("\"%s\" %s", fn, strerror(errno));
@@ -3082,7 +3111,7 @@ static void do_cmd(int c)
case 'P': // P- Put register before
case 'p': // p- put register after
p = reg[YDreg];
if (p == 0) {
if (p == NULL) {
status_line_bold("Nothing in register %c", what_reg());
break;
}
@@ -3103,7 +3132,7 @@ static void do_cmd(int c)
if (c == 'p')
dot_right(); // move to right, can move to NL
}
dot = string_insert(dot, p); // insert the string
string_insert(dot, p); // insert the string
end_cmd_q(); // stop adding to q
break;
case 'U': // U- Undo; replace current line with original version
@@ -3111,7 +3140,7 @@ static void do_cmd(int c)
p = begin_line(dot);
q = end_line(dot);
p = text_hole_delete(p, q); // delete cur line
p = string_insert(p, reg[Ureg]); // insert orig line
p += string_insert(p, reg[Ureg]); // insert orig line
dot = p;
dot_skip_over_ws();
}
+56 -9
View File
@@ -13,7 +13,7 @@
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
use Getopt::Long;
use Getopt::Long qw(:config no_auto_abbrev no_ignore_case);
use File::Find;
use strict;
@@ -23,6 +23,9 @@ my $basedir="";
my $kernel="";
my $kernelsyms="";
my $symprefix="";
my $all=0;
my $quick=0;
my $errsyms=0;
my $stdout=0;
my $verbose=0;
my $help=0;
@@ -44,6 +47,8 @@ $0 -b basedir { -k <vmlinux> | -F <System.map> } [options]...
-n --stdout : Write to stdout instead of <basedir>/modules.dep
-v --verbose : Print out lots of debugging stuff
-P --symbol-prefix : Symbol prefix
-a --all : Probe all modules (default/only thing supported)
-e --errsyms : Report any symbols not supplied by modules/kernel
TXT
# get command-line options
@@ -55,14 +60,23 @@ GetOptions(
"stdout|n" => \$stdout,
"verbose|v" => \$verbose,
"symbol-prefix|P=s" => \$symprefix,
"all|a" => \$all,
# unsupported options
"quick|A" => \$quick,
# ignored options (for historical usage)
"quiet|q",
"root|r",
"unresolved-error|u"
);
die $usage if $help;
die $usage unless $basedir && ( $kernel || $kernelsyms );
die "can't use both -k and -F\n\n$usage" if $kernel && $kernelsyms;
die "sorry, -A/--quick is not supported" if $quick;
die "--errsyms requires --kernelsyms" if $errsyms && !$kernelsyms;
# Strip any trailing or multiple slashes from basedir
$basedir =~ s-(/)\1+-/-g;
$basedir =~ s-/+$--g;
# The base directory should contain /lib/modules somewhere
if($basedir !~ m-/lib/modules-) {
@@ -137,6 +151,35 @@ foreach my $module (keys %$dep) {
}
}
# build a complete dependency list for each module and make sure it
# is kept in order proper order
my $mod2 = {};
sub maybe_unshift
{
my ($array, $ele) = @_;
# chop off the leading path /lib/modules/<kver>/ as modprobe
# will handle relative paths just fine
$ele =~ s:^/lib/modules/[^/]*/::;
foreach (@{$array}) {
if ($_ eq $ele) {
return;
}
}
unshift (@{$array}, $ele);
}
foreach my $module (keys %$mod) {
warn "filling out module: $module\n" if $verbose;
@{$mod2->{$module}} = ();
foreach my $md (keys %{$mod->{$module}}) {
foreach my $md2 (keys %{$mod->{$md}}) {
warn "outputting $md2\n" if $verbose;
maybe_unshift (\@{$mod2->{$module}}, $md2);
}
warn "outputting $md\n" if $verbose;
maybe_unshift (\@{$mod2->{$module}}, $md);
}
}
# figure out where the output should go
if ($stdout == 0) {
open(STDOUT, ">$basedir/modules.dep")
@@ -151,8 +194,11 @@ foreach my $module ( keys %$mod ) {
print join(" \\\n\t",@sorted);
print "\n\n";
} else {
print "$module: ";
my @sorted = sort bydep keys %{$mod->{$module}};
my $shortmod = $module;
$shortmod =~ s:^/lib/modules/[^/]*/::;
print "$shortmod:";
my @sorted = @{$mod2->{$module}};
printf " " if @sorted;
print join(" ",@sorted);
print "\n";
}
@@ -163,15 +209,16 @@ sub build_ref_tables
{
my ($name, $sym_ar, $exp, $dep) = @_;
my $ksymtab = grep m/ __ksymtab/, @$sym_ar;
my $ksymtab = grep m/ ${symprefix}__ksymtab/, @$sym_ar;
# gather the exported symbols
if($ksymtab){
# explicitly exported
foreach ( @$sym_ar ) {
/ __ksymtab_(.*)$/ and do {
warn "sym = $1\n" if $verbose;
$exp->{$1} = $name;
/ ${symprefix}__ksymtab_(.*)$/ and do {
my $sym = ${symprefix} . $1;
warn "sym = $sym\n" if $verbose;
$exp->{$sym} = $name;
};
}
} else {
@@ -189,7 +236,7 @@ sub build_ref_tables
# gather the unresolved symbols
foreach ( @$sym_ar ) {
!/ __this_module/ && / U (.*)$/ and do {
!/ ${symprefix}__this_module/ && / U (.*)$/ and do {
warn "und = $1\n" if $verbose;
push @{$dep->{$name}}, $1;
};
+12 -10
View File
@@ -381,9 +381,11 @@ static int FAST_FUNC fileAction(const char *fileName,
{
int i;
#if ENABLE_FEATURE_FIND_MAXDEPTH
int maxdepth = (int)(ptrdiff_t)userData;
#define minmaxdepth ((int*)userData)
if (depth > maxdepth) return SKIP;
if (depth < minmaxdepth[0]) return TRUE;
if (depth > minmaxdepth[1]) return SKIP;
#undef minmaxdepth
#endif
#if ENABLE_FEATURE_FIND_XDEV
@@ -812,19 +814,21 @@ int find_main(int argc, char **argv)
static const char options[] ALIGN1 =
"-follow\0"
USE_FEATURE_FIND_XDEV( "-xdev\0" )
USE_FEATURE_FIND_MAXDEPTH("-maxdepth\0")
USE_FEATURE_FIND_MAXDEPTH("-mindepth\0""-maxdepth\0")
;
enum {
OPT_FOLLOW,
USE_FEATURE_FIND_XDEV( OPT_XDEV ,)
USE_FEATURE_FIND_MAXDEPTH(OPT_MAXDEPTH,)
USE_FEATURE_FIND_MAXDEPTH(OPT_MINDEPTH,)
};
char *arg;
char **argp;
int i, firstopt, status = EXIT_SUCCESS;
#if ENABLE_FEATURE_FIND_MAXDEPTH
int maxdepth = INT_MAX;
int minmaxdepth[2] = { 0, INT_MAX };
#else
#define minmaxdepth NULL
#endif
for (firstopt = 1; firstopt < argc; firstopt++) {
@@ -875,10 +879,10 @@ USE_FEATURE_FIND_MAXDEPTH(OPT_MAXDEPTH,)
}
#endif
#if ENABLE_FEATURE_FIND_MAXDEPTH
if (opt == OPT_MAXDEPTH) {
if (opt == OPT_MINDEPTH || opt == OPT_MINDEPTH + 1) {
if (!argp[1])
bb_show_usage();
maxdepth = xatoi_u(argp[1]);
minmaxdepth[opt - OPT_MINDEPTH] = xatoi_u(argp[1]);
argp[0] = (char*)"-a";
argp[1] = (char*)"-a";
argp++;
@@ -895,9 +899,7 @@ USE_FEATURE_FIND_MAXDEPTH(OPT_MAXDEPTH,)
fileAction, /* file action */
fileAction, /* dir action */
#if ENABLE_FEATURE_FIND_MAXDEPTH
/* double cast suppresses
* "cast to ptr from int of different size" */
(void*)(ptrdiff_t)maxdepth,/* user data */
minmaxdepth, /* user data */
#else
NULL, /* user data */
#endif
+15 -6
View File
@@ -28,7 +28,9 @@
USE_FEATURE_GREP_CONTEXT("A:B:C:") \
USE_FEATURE_GREP_EGREP_ALIAS("E") \
USE_DESKTOP("w") \
USE_EXTRA_COMPAT("z") \
"aI"
/* ignored: -a "assume all files to be text" */
/* ignored: -I "assume binary files have no matches" */
@@ -54,6 +56,7 @@ enum {
USE_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */
USE_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) /* extended regexp */
USE_DESKTOP( OPTBIT_w ,) /* whole word match */
USE_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */
OPT_l = 1 << OPTBIT_l,
OPT_n = 1 << OPTBIT_n,
OPT_q = 1 << OPTBIT_q,
@@ -75,6 +78,7 @@ enum {
OPT_C = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0,
OPT_E = USE_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0,
OPT_w = USE_DESKTOP( (1 << OPTBIT_w)) + 0,
OPT_z = USE_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0,
};
#define PRINT_FILES_WITH_MATCHES (option_mask32 & OPT_l)
@@ -84,6 +88,7 @@ enum {
#define PRINT_MATCH_COUNTS (option_mask32 & OPT_c)
#define FGREP_FLAG (option_mask32 & OPT_F)
#define PRINT_FILES_WITHOUT_MATCHES (option_mask32 & OPT_L)
#define NUL_DELIMITED (option_mask32 & OPT_z)
struct globals {
int max_matches;
@@ -186,7 +191,7 @@ static void print_line(const char *line, size_t line_len, int linenum, char deco
puts(line);
#else
fwrite(line, 1, line_len, stdout);
putchar('\n');
putchar(NUL_DELIMITED ? '\0' : '\n');
#endif
}
}
@@ -197,12 +202,13 @@ static ssize_t FAST_FUNC bb_getline(char **line_ptr, size_t *line_alloc_len, FIL
{
ssize_t res_sz;
char *line;
int delim = (NUL_DELIMITED ? '\0' : '\n');
res_sz = getline(line_ptr, line_alloc_len, file);
res_sz = getdelim(line_ptr, line_alloc_len, delim, file);
line = *line_ptr;
if (res_sz > 0) {
if (line[res_sz - 1] == '\n')
if (line[res_sz - 1] == delim)
line[--res_sz] = '\0';
} else {
free(line); /* uclibc allocates a buffer even on EOF. WTF? */
@@ -374,11 +380,11 @@ static int grep_file(FILE *file)
break;
#else
if (re_search(&gl->compiled_regex, line, line_len,
gl->matched_range.rm_eo, line_len - gl->matched_range.rm_eo,
gl->matched_range.rm_eo, line_len - gl->matched_range.rm_eo,
&gl->matched_range) < 0)
break;
#endif
}
}
} else {
print_line(line, line_len, linenum, ':');
}
@@ -407,8 +413,11 @@ static int grep_file(FILE *file)
#endif
/* Did we print all context after last requested match? */
if ((option_mask32 & OPT_m)
&& !print_n_lines_after && nmatches == max_matches)
&& !print_n_lines_after
&& nmatches == max_matches
) {
break;
}
} /* while (read line) */
/* special-case file post-processing for options where we don't print line
+12
View File
@@ -69,6 +69,7 @@ s - suid type:
USE_TEST(APPLET_NOFORK([, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER, test))
USE_TEST(APPLET_NOFORK([[, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER, test))
USE_ACPID(APPLET(acpid, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_ADDGROUP(APPLET(addgroup, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_ADDUSER(APPLET(adduser, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_ADJTIMEX(APPLET(adjtimex, _BB_DIR_SBIN, _BB_SUID_NEVER))
@@ -154,6 +155,8 @@ USE_FDISK(APPLET(fdisk, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_FEATURE_GREP_FGREP_ALIAS(APPLET_ODDNAME(fgrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER, fgrep))
USE_FIND(APPLET_NOEXEC(find, find, _BB_DIR_USR_BIN, _BB_SUID_NEVER, find))
USE_FINDFS(APPLET(findfs, _BB_DIR_SBIN, _BB_SUID_MAYBE))
//USE_FLASH_ERASEALL(APPLET_ODDNAME(flash_eraseall, flash_eraseall, _BB_DIR_USR_SBIN, _BB_SUID_NEVER, flash_eraseall))
USE_FLASH_ERASEALL(APPLET(flash_eraseall, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_FOLD(APPLET(fold, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_FREE(APPLET(free, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_FREERAMDISK(APPLET(freeramdisk, _BB_DIR_SBIN, _BB_SUID_NEVER))
@@ -161,6 +164,7 @@ USE_FSCK(APPLET(fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
//USE_E2FSCK(APPLET_ODDNAME(fsck.ext2, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_ext2))
//USE_E2FSCK(APPLET_ODDNAME(fsck.ext3, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_ext3))
USE_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_minix))
USE_FTPD(APPLET(ftpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ftpget))
USE_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ftpput))
USE_FUSER(APPLET(fuser, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
@@ -192,6 +196,7 @@ USE_INOTIFYD(APPLET(inotifyd, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_INSMOD(APPLET(insmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MODPROBE_SMALL(APPLET_ODDNAME(insmod, modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER, modprobe))
USE_INSTALL(APPLET(install, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_IONICE(APPLET(ionice, _BB_DIR_BIN, _BB_SUID_NEVER))
#if ENABLE_FEATURE_IP_ADDRESS \
|| ENABLE_FEATURE_IP_ROUTE \
|| ENABLE_FEATURE_IP_LINK \
@@ -245,12 +250,15 @@ USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_MICROCOM(APPLET(microcom, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_MKDIR(APPLET_NOFORK(mkdir, mkdir, _BB_DIR_BIN, _BB_SUID_NEVER, mkdir))
USE_MKFS_VFAT(APPLET_ODDNAME(mkdosfs, mkfs_vfat, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_vfat))
//USE_MKE2FS(APPLET(mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MKFIFO(APPLET(mkfifo, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
//USE_MKE2FS(APPLET_ODDNAME(mkfs.ext2, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_ext2))
//USE_MKE2FS(APPLET_ODDNAME(mkfs.ext3, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_ext3))
USE_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_minix))
USE_MKFS_VFAT(APPLET_ODDNAME(mkfs.vfat, mkfs_vfat, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_vfat))
USE_MKNOD(APPLET(mknod, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_CRYPTPW(APPLET_ODDNAME(mkpasswd, cryptpw, _BB_DIR_USR_BIN, _BB_SUID_NEVER, mkpasswd))
USE_MKSWAP(APPLET(mkswap, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MKTEMP(APPLET(mktemp, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_MODPROBE(APPLET(modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER))
@@ -334,6 +342,8 @@ USE_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_NEVER, sh))
USE_FEATURE_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, _BB_DIR_BIN, _BB_SUID_NEVER, sh))
USE_FEATURE_SH_IS_MSH(APPLET_ODDNAME(sh, msh, _BB_DIR_BIN, _BB_SUID_NEVER, sh))
USE_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha1sum))
USE_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha256sum))
USE_SHA512SUM(APPLET_ODDNAME(sha512sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha512sum))
USE_SHOWKEY(APPLET(showkey, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_SLATTACH(APPLET(slattach, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_SLEEP(APPLET_NOFORK(sleep, sleep, _BB_DIR_BIN, _BB_SUID_NEVER, sleep))
@@ -370,6 +380,7 @@ USE_TFTP(APPLET(tftp, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TFTPD(APPLET(tftpd, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
#endif
USE_TIME(APPLET(time, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TIMEOUT(APPLET(timeout, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TOP(APPLET(top, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TOUCH(APPLET_NOFORK(touch, touch, _BB_DIR_BIN, _BB_SUID_NEVER, touch))
USE_TR(APPLET(tr, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
@@ -377,6 +388,7 @@ USE_TRACEROUTE(APPLET(traceroute, _BB_DIR_USR_BIN, _BB_SUID_MAYBE))
USE_TRUE(APPLET_NOFORK(true, true, _BB_DIR_BIN, _BB_SUID_NEVER, true))
USE_TTY(APPLET(tty, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TTYSIZE(APPLET(ttysize, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TUNCTL(APPLET(tunctl, _BB_DIR_SBIN, _BB_SUID_NEVER))
//USE_TUNE2FS(APPLET(tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_APP_UDHCPC(APPLET(udhcpc, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_APP_UDHCPD(APPLET(udhcpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
+5 -9
View File
@@ -4,14 +4,12 @@
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#ifndef _BB_INTERNAL_H_
#define _BB_INTERNAL_H_ 1
#ifndef BUSYBOX_H
#define BUSYBOX_H 1
#include "libbb.h"
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
/* order matters: used as index into "install_dir[]" in appletlib.c */
typedef enum bb_install_loc_t {
@@ -71,8 +69,6 @@ int lbb_main(char **argv);
#endif
#endif
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif /* _BB_INTERNAL_H_ */
#endif
+2 -6
View File
@@ -1,8 +1,6 @@
/* vi: set sw=4 ts=4: */
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
#define F_IGNORE 0x01 /* %_A */
#define F_SETREP 0x02 /* rep count set, not default */
@@ -55,6 +53,4 @@ dumper_t* alloc_dumper(void) FAST_FUNC;
extern void bb_dump_add(dumper_t *dumper, const char *fmt) FAST_FUNC;
extern int bb_dump_dump(dumper_t *dumper, char **argv) FAST_FUNC;
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
+6 -11
View File
@@ -15,18 +15,15 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
02111-1307 USA.
*/
/*
* POSIX Standard: 9.2.1 Group Database Access <grp.h>
*/
#ifndef BB_GRP_H
#define BB_GRP_H 1
#ifndef BB_GRP_H
#define BB_GRP_H 1
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
/* This file is #included after #include <grp.h>
* We will use libc-defined structures, but will #define function names
@@ -115,8 +112,6 @@ extern int getgrouplist(const char *__user, gid_t __group,
of which USER is a member. Also include GROUP. */
extern int initgroups(const char *__user, gid_t __group);
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif
+104 -43
View File
@@ -7,8 +7,8 @@
*
* Licensed under the GPL version 2, see the file LICENSE in this tarball.
*/
#ifndef __LIBBUSYBOX_H__
#define __LIBBUSYBOX_H__ 1
#ifndef LIBBB_H
#define LIBBB_H 1
#include "platform.h"
@@ -110,9 +110,7 @@ int sysinfo(struct sysinfo* info);
/* Make all declarations hidden (-fvisibility flag only affects definitions) */
/* (don't include system headers after this until corresponding pop!) */
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
#if ENABLE_USE_BB_PWD_GRP
@@ -150,6 +148,7 @@ int sysinfo(struct sysinfo* info);
/* CONFIG_LFS is on */
# if ULONG_MAX > 0xffffffff
/* "long" is long enough on this system */
typedef unsigned long uoff_t;
# define XATOOFF(a) xatoul_range(a, 0, LONG_MAX)
/* usage: sz = BB_STRTOOFF(s, NULL, 10); if (errno || sz < 0) die(); */
# define BB_STRTOOFF bb_strtoul
@@ -158,6 +157,7 @@ int sysinfo(struct sysinfo* info);
# define OFF_FMT "l"
# else
/* "long" is too short, need "long long" */
typedef unsigned long long uoff_t;
# define XATOOFF(a) xatoull_range(a, 0, LLONG_MAX)
# define BB_STRTOOFF bb_strtoull
# define STRTOOFF strtoull
@@ -168,11 +168,13 @@ int sysinfo(struct sysinfo* info);
# if UINT_MAX == 0xffffffff
/* While sizeof(off_t) == sizeof(int), off_t is typedef'ed to long anyway.
* gcc will throw warnings on printf("%d", off_t). Crap... */
typedef unsigned long uoff_t;
# define XATOOFF(a) xatoi_u(a)
# define BB_STRTOOFF bb_strtou
# define STRTOOFF strtol
# define OFF_FMT "l"
# else
typedef unsigned long uoff_t;
# define XATOOFF(a) xatoul_range(a, 0, LONG_MAX)
# define BB_STRTOOFF bb_strtoul
# define STRTOOFF strtol
@@ -353,8 +355,8 @@ enum {
void bb_signals(int sigs, void (*f)(int)) FAST_FUNC;
/* Unlike signal() and bb_signals, sets handler with sigaction()
* and in a way that while signal handler is run, no other signals
* will be blocked: */
void bb_signals_recursive(int sigs, void (*f)(int)) FAST_FUNC;
* will be blocked; syscalls will not be restarted: */
void bb_signals_recursive_norestart(int sigs, void (*f)(int)) FAST_FUNC;
/* syscalls like read() will be interrupted with EINTR: */
void signal_no_SA_RESTART_empty_mask(int sig, void (*handler)(int)) FAST_FUNC;
/* syscalls like read() won't be interrupted (though select/poll will be): */
@@ -377,6 +379,7 @@ void xsetuid(uid_t uid) FAST_FUNC;
void xchdir(const char *path) FAST_FUNC;
void xchroot(const char *path) FAST_FUNC;
void xsetenv(const char *key, const char *value) FAST_FUNC;
void bb_unsetenv(const char *key) FAST_FUNC;
void xunlink(const char *pathname) FAST_FUNC;
void xstat(const char *pathname, struct stat *buf) FAST_FUNC;
int xopen(const char *pathname, int flags) FAST_FUNC FAST_FUNC;
@@ -437,6 +440,7 @@ ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to,
* Turn it on before you call bind(). */
void setsockopt_reuseaddr(int fd) FAST_FUNC; /* On Linux this never fails. */
int setsockopt_broadcast(int fd) FAST_FUNC;
int setsockopt_bindtodevice(int fd, const char *iface) FAST_FUNC;
/* NB: returns port in host byte order */
unsigned bb_lookup_port(const char *port, const char *protocol, unsigned default_port) FAST_FUNC;
typedef struct len_and_sockaddr {
@@ -487,6 +491,8 @@ int create_and_bind_dgram_or_die(const char *bindaddr, int port) FAST_FUNC;
int create_and_connect_stream_or_die(const char *peer, int port) FAST_FUNC;
/* Connect to peer identified by lsa */
int xconnect_stream(const len_and_sockaddr *lsa) FAST_FUNC;
/* Get local address of bound or accepted socket */
len_and_sockaddr *get_sock_lsa(int fd) FAST_FUNC;
/* Return malloc'ed len_and_sockaddr with socket address of host:port
* Currently will return IPv4 or IPv6 sockaddrs only
* (depending on host), but in theory nothing prevents e.g.
@@ -540,6 +546,7 @@ char *xstrdup(const char *s) FAST_FUNC;
char *xstrndup(const char *s, int n) FAST_FUNC;
void overlapping_strcpy(char *dst, const char *src) FAST_FUNC;
char *safe_strncpy(char *dst, const char *src, size_t size) FAST_FUNC;
char *strncpy_IFNAMSIZ(char *dst, const char *src) FAST_FUNC;
/* Guaranteed to NOT be a macro (smallest code). Saves nearly 2k on uclibc.
* But potentially slow, don't use in one-billion-times loops */
int bb_putchar(int ch) FAST_FUNC;
@@ -589,9 +596,9 @@ extern ssize_t open_read_close(const char *filename, void *buf, size_t maxsz) FA
// Reads byte-by-byte. Useful when it is important to not read ahead.
// Bytes are appended to pfx (which must be malloced, or NULL).
extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p) FAST_FUNC;
/* Reads block up to *maxsz_p (default: MAX_INT(ssize_t)) */
/* Reads block up to *maxsz_p (default: INT_MAX - 4095) */
extern void *xmalloc_read(int fd, size_t *maxsz_p) FAST_FUNC;
/* Returns NULL if file can't be opened */
/* Returns NULL if file can't be opened (default max size: INT_MAX - 4095) */
extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC;
/* Autodetects .gz etc */
extern int open_zipped(const char *fname) FAST_FUNC;
@@ -604,6 +611,7 @@ extern ssize_t safe_write(int fd, const void *buf, size_t count) FAST_FUNC;
// if some data was written before error occurred
extern ssize_t full_write(int fd, const void *buf, size_t count) FAST_FUNC;
extern void xwrite(int fd, const void *buf, size_t count) FAST_FUNC;
extern void xwrite_str(int fd, const char *str) FAST_FUNC;
extern void xopen_xwrite_close(const char* file, const char *str) FAST_FUNC;
/* Reads and prints to stdout till eof, then closes FILE. Exits on error: */
@@ -613,6 +621,8 @@ extern char *bb_get_chunk_from_file(FILE *file, int *end) FAST_FUNC;
extern char *bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno) FAST_FUNC;
/* Reads up to (and including) TERMINATING_STRING: */
extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string) FAST_FUNC;
/* Same, with limited max size, and returns the length (excluding NUL): */
extern char *xmalloc_fgets_str_len(FILE *file, const char *terminating_string, size_t *maxsz_p) FAST_FUNC;
/* Chops off TERMINATING_STRING from the end: */
extern char *xmalloc_fgetline_str(FILE *file, const char *terminating_string) FAST_FUNC;
/* Reads up to (and including) "\n" or NUL byte: */
@@ -701,14 +711,16 @@ int get_uidgid(struct bb_uidgid_t*, const char*, int numeric_ok) FAST_FUNC;
void xget_uidgid(struct bb_uidgid_t*, const char*) FAST_FUNC;
/* chown-like handling of "user[:[group]" */
void parse_chown_usergroup_or_die(struct bb_uidgid_t *u, char *user_group) FAST_FUNC;
/* bb_getpwuid, bb_getgrgid:
* bb_getXXXid(buf, bufsz, id) - copy user/group name or id
* as a string to buf, return user/group name or NULL
* bb_getXXXid(NULL, 0, id) - return user/group name or NULL
* bb_getXXXid(NULL, -1, id) - return user/group name or exit
*/
char *bb_getpwuid(char *name, int bufsize, long uid) FAST_FUNC;
char *bb_getgrgid(char *group, int bufsize, long gid) FAST_FUNC;
struct passwd* xgetpwnam(const char *name) FAST_FUNC;
struct group* xgetgrnam(const char *name) FAST_FUNC;
struct passwd* xgetpwuid(uid_t uid) FAST_FUNC;
struct group* xgetgrgid(gid_t gid) FAST_FUNC;
char* xuid2uname(uid_t uid) FAST_FUNC;
char* xgid2group(gid_t gid) FAST_FUNC;
char* uid2uname(uid_t uid) FAST_FUNC;
char* gid2group(gid_t gid) FAST_FUNC;
char* uid2uname_utoa(long uid) FAST_FUNC;
char* gid2group_utoa(long gid) FAST_FUNC;
/* versions which cache results (useful for ps, ls etc) */
const char* get_cached_username(uid_t uid) FAST_FUNC;
const char* get_cached_groupname(gid_t gid) FAST_FUNC;
@@ -787,9 +799,9 @@ int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char **
* Both of the above will redirect fd 0,1,2 to /dev/null and drop ctty
* (will do setsid()).
*
* forkexit_or_rexec(argv) = bare-bones "fork + parent exits" on MMU,
* fork_or_rexec(argv) = bare-bones "fork" on MMU,
* "vfork + re-exec ourself" on NOMMU. No fd redirection, no setsid().
* Currently used for setsid only. On MMU ignores argv.
* On MMU ignores argv.
*
* Helper for network daemons in foreground mode:
*
@@ -803,14 +815,14 @@ enum {
DAEMON_ONLY_SANITIZE = 8, /* internal use */
};
#if BB_MMU
void forkexit_or_rexec(void) FAST_FUNC;
pid_t fork_or_rexec(void) FAST_FUNC;
enum { re_execed = 0 };
# define forkexit_or_rexec(argv) forkexit_or_rexec()
# define fork_or_rexec(argv) fork_or_rexec()
# define bb_daemonize_or_rexec(flags, argv) bb_daemonize_or_rexec(flags)
# define bb_daemonize(flags) bb_daemonize_or_rexec(flags, bogus)
#else
void re_exec(char **argv) NORETURN FAST_FUNC;
void forkexit_or_rexec(char **argv) FAST_FUNC;
pid_t fork_or_rexec(char **argv) FAST_FUNC;
extern bool re_execed;
int BUG_fork_is_unavailable_on_nommu(void) FAST_FUNC;
int BUG_daemon_is_unavailable_on_nommu(void) FAST_FUNC;
@@ -847,6 +859,7 @@ void *llist_pop(llist_t **elm) FAST_FUNC;
void llist_unlink(llist_t **head, llist_t *elm) FAST_FUNC;
void llist_free(llist_t *elm, void (*freeit)(void *data)) FAST_FUNC;
llist_t *llist_rev(llist_t *list) FAST_FUNC;
llist_t *llist_find_str(llist_t *first, const char *str) FAST_FUNC;
/* BTW, surprisingly, changing API to
* llist_t *llist_add_to(llist_t *old_head, void *data)
* etc does not result in smaller code... */
@@ -882,7 +895,7 @@ extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, f
extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
extern void bb_simple_perror_msg(const char *s) FAST_FUNC;
extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
extern void bb_simple_perror_msg_and_die(const char *s) __attribute__ ((noreturn)) FAST_FUNC;
extern void bb_simple_perror_msg_and_die(const char *s) NORETURN FAST_FUNC;
extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
extern void bb_perror_nomsg_and_die(void) NORETURN FAST_FUNC;
@@ -909,6 +922,8 @@ int test_main(int argc, char **argv) USE_TEST(MAIN_EXTERNALLY_VISIBLE);
int kill_main(int argc, char **argv) USE_KILL(MAIN_EXTERNALLY_VISIBLE);
/* Similar, but used by chgrp, not shell */
int chown_main(int argc, char **argv) USE_CHOWN(MAIN_EXTERNALLY_VISIBLE);
/* Used by ftpd */
int ls_main(int argc, char **argv) USE_LS(MAIN_EXTERNALLY_VISIBLE);
/* Don't need USE_xxx() guard for these */
int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@@ -923,7 +938,7 @@ void bb_displayroutes(int noresolve, int netstatfmt) FAST_FUNC;
* yet doesn't represent any valid Unicode characher.
* Also, -1 is reserved for error indication and we don't use it. */
enum {
KEYCODE_UP = -2,
KEYCODE_UP = -2,
KEYCODE_DOWN = -3,
KEYCODE_RIGHT = -4,
KEYCODE_LEFT = -5,
@@ -950,6 +965,12 @@ enum {
/* How long the longest ESC sequence we know? */
KEYCODE_BUFFER_SIZE = 4
};
/* Note: fd may be in blocking or non-blocking mode, both make sense.
* For one, less uses non-blocking mode.
* Only the first read syscall inside read_key may block indefinitely
* (unless fd is in non-blocking mode),
* subsequent reads will time out after a few milliseconds.
*/
int read_key(int fd, smalluint *nbuffered, char *buffer) FAST_FUNC;
@@ -1020,9 +1041,10 @@ extern int del_loop(const char *device) FAST_FUNC;
* return value: 1: read-only loopdev was setup, 0: rw, < 0: error */
extern int set_loop(char **devname, const char *file, unsigned long long offset) FAST_FUNC;
/* Like bb_ask below, but asks on stdin with no timeout. */
char *bb_ask_stdin(const char * prompt) FAST_FUNC;
//TODO: pass buf pointer or return allocated buf (avoid statics)?
char *bb_askpass(int timeout, const char * prompt) FAST_FUNC;
char *bb_ask(const int fd, int timeout, const char * prompt) FAST_FUNC;
int bb_ask_confirmation(void) FAST_FUNC;
int bb_parse_mode(const char* s, mode_t* theMode) FAST_FUNC;
@@ -1077,6 +1099,8 @@ const char *get_signame(int number) FAST_FUNC;
void print_signames(void) FAST_FUNC;
char *bb_simplify_path(const char *path) FAST_FUNC;
/* Returns ptr to NUL */
char *bb_simplify_abs_path_inplace(char *path) FAST_FUNC;
#define FAIL_DELAY 3
extern void bb_do_delay(int seconds) FAST_FUNC;
@@ -1126,9 +1150,16 @@ extern int obscure(const char *old, const char *newval, const struct passwd *pwd
* (otherwise we risk having same salt generated)
*/
extern int crypt_make_salt(char *p, int cnt, int rnd) FAST_FUNC;
/* Returns number of lines changed, or -1 on error */
extern int update_passwd(const char *filename, const char *username,
const char *new_pw) FAST_FUNC;
#if !(ENABLE_FEATURE_ADDUSER_TO_GROUP || ENABLE_FEATURE_DEL_USER_FROM_GROUP)
#define update_passwd(filename, username, data, member) \
update_passwd(filename, username, data)
#endif
extern int update_passwd(const char *filename,
const char *username,
const char *data,
const char *member) FAST_FUNC;
int index_in_str_array(const char *const string_array[], const char *key) FAST_FUNC;
int index_in_strings(const char *strings, const char *key) FAST_FUNC;
@@ -1139,6 +1170,7 @@ const char *nth_string(const char *strings, int n) FAST_FUNC;
extern void print_login_issue(const char *issue_file, const char *tty) FAST_FUNC;
extern void print_login_prompt(void) FAST_FUNC;
char *xmalloc_ttyname(int fd) FAST_FUNC;
/* NB: typically you want to pass fd 0, not 1. Think 'applet | grep something' */
int get_terminal_width_height(int fd, unsigned *width, unsigned *height) FAST_FUNC;
@@ -1173,9 +1205,9 @@ unsigned long long bb_makedev(unsigned int major, unsigned int minor) FAST_FUNC;
#if ENABLE_FEATURE_EDITING
/* It's NOT just ENABLEd or disabled. It's a number: */
#ifdef CONFIG_FEATURE_EDITING_HISTORY
#define MAX_HISTORY (CONFIG_FEATURE_EDITING_HISTORY + 0)
# define MAX_HISTORY (CONFIG_FEATURE_EDITING_HISTORY + 0)
#else
#define MAX_HISTORY 0
# define MAX_HISTORY 0
#endif
typedef struct line_input_t {
int flags;
@@ -1183,7 +1215,10 @@ typedef struct line_input_t {
#if MAX_HISTORY
int cnt_history;
int cur_history;
USE_FEATURE_EDITING_SAVEHISTORY(const char *hist_file;)
#if ENABLE_FEATURE_EDITING_SAVEHISTORY
unsigned cnt_history_in_file;
const char *hist_file;
#endif
char *history[MAX_HISTORY + 1];
#endif
} line_input_t;
@@ -1197,6 +1232,7 @@ enum {
FOR_SHELL = DO_HISTORY | SAVE_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION,
};
line_input_t *new_line_input_t(int flags) FAST_FUNC;
/* so far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */
/* Returns:
* -1 on read errors or EOF, or on bare Ctrl-D,
* 0 on ctrl-C (the line entered is still returned in 'command'),
@@ -1274,7 +1310,13 @@ enum {
PSSCAN_UTIME = 1 << 13,
PSSCAN_TTY = 1 << 14,
PSSCAN_SMAPS = (1 << 15) * ENABLE_FEATURE_TOPMEM,
PSSCAN_ARGVN = (1 << 16) * (ENABLE_PGREP || ENABLE_PKILL || ENABLE_PIDOF),
/* NB: used by find_pid_by_name(). Any applet using it
* needs to be mentioned here. */
PSSCAN_ARGVN = (1 << 16) * (ENABLE_KILLALL
|| ENABLE_PGREP || ENABLE_PKILL
|| ENABLE_PIDOF
|| ENABLE_SESTATUS
),
USE_SELINUX(PSSCAN_CONTEXT = 1 << 17,)
PSSCAN_START_TIME = 1 << 18,
PSSCAN_CPU = 1 << 19,
@@ -1303,14 +1345,27 @@ extern const char bb_uuenc_tbl_std[];
void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_FUNC;
typedef struct sha1_ctx_t {
uint32_t count[2];
uint32_t hash[5];
uint32_t wbuf[16];
uint32_t hash[8]; /* 5, +3 elements for sha256 */
uint64_t total64;
uint8_t wbuffer[64]; /* NB: always correctly aligned for uint64_t */
void (*process_block)(struct sha1_ctx_t*) FAST_FUNC;
} sha1_ctx_t;
void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC;
void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx) FAST_FUNC;
void *sha1_end(void *resbuf, sha1_ctx_t *ctx) FAST_FUNC;
void sha1_end(void *resbuf, sha1_ctx_t *ctx) FAST_FUNC;
typedef struct sha1_ctx_t sha256_ctx_t;
void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC;
#define sha256_hash sha1_hash
#define sha256_end sha1_end
typedef struct sha512_ctx_t {
uint64_t hash[8];
uint64_t total64[2];
uint8_t wbuffer[128]; /* NB: always correctly aligned for uint64_t */
} sha512_ctx_t;
void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC;
void sha512_hash(const void *buffer, size_t len, sha512_ctx_t *ctx) FAST_FUNC;
void sha512_end(void *resbuf, sha512_ctx_t *ctx) FAST_FUNC;
#if 1
typedef struct md5_ctx_t {
uint32_t A;
uint32_t B;
@@ -1320,9 +1375,18 @@ typedef struct md5_ctx_t {
uint32_t buflen;
char buffer[128];
} md5_ctx_t;
#else
/* libbb/md5prime.c uses a bit different one: */
typedef struct md5_ctx_t {
uint32_t state[4]; /* state (ABCD) */
uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} md5_ctx_t;
#endif
void md5_begin(md5_ctx_t *ctx) FAST_FUNC;
void md5_hash(const void *data, size_t length, md5_ctx_t *ctx) FAST_FUNC;
void *md5_end(void *resbuf, md5_ctx_t *ctx) FAST_FUNC;
void md5_end(void *resbuf, md5_ctx_t *ctx) FAST_FUNC;
uint32_t *crc32_filltable(uint32_t *tbl256, int endian) FAST_FUNC;
@@ -1482,9 +1546,6 @@ extern const char bb_default_login_shell[];
#define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
POP_SAVED_FUNCTION_VISIBILITY
#endif
#endif /* __LIBBUSYBOX_H__ */
+49 -28
View File
@@ -4,8 +4,8 @@
Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#ifndef __PLATFORM_H
#define __PLATFORM_H 1
#ifndef BB_PLATFORM_H
#define BB_PLATFORM_H 1
/* Convenience macros to test the version of gcc. */
#undef __GNUC_PREREQ
@@ -78,7 +78,7 @@
//__attribute__ ((__externally_visible__))
#else
# define EXTERNALLY_VISIBLE
#endif /* GNUC >= 4.1 */
#endif
/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
@@ -110,6 +110,16 @@
# define FAST_FUNC
#endif
/* Make all declarations hidden (-fvisibility flag only affects definitions) */
/* (don't include system headers after this until corresponding pop!) */
#if __GNUC_PREREQ(4,1)
# define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)")
# define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop")
#else
# define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
# define POP_SAVED_FUNCTION_VISIBILITY
#endif
/* ---- Endian Detection ------------------------------------ */
#if (defined __digital__ && defined __unix__)
@@ -151,13 +161,22 @@
/* ---- Unaligned access ------------------------------------ */
/* parameter is supposed to be an uint32_t* ptr */
/* NB: unaligned parameter should be a pointer, aligned one -
* a lvalue. This makes it more likely to not swap them by mistake
*/
#if defined(i386) || defined(__x86_64__)
#define get_unaligned_u32p(u32p) (*(u32p))
#define move_from_unaligned16(v, u16p) ((v) = *(uint16_t*)(u16p))
#define move_from_unaligned32(v, u32p) ((v) = *(uint32_t*)(u32p))
#define move_to_unaligned32(u32p, v) (*(uint32_t*)(u32p) = (v))
/* #elif ... - add your favorite arch today! */
#else
/* performs reasonably well (gcc usually inlines memcpy here) */
#define get_unaligned_u32p(u32p) ({ uint32_t __t; memcpy(&__t, (u32p), 4); __t; })
#define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2))
#define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4))
#define move_to_unaligned32(u32p, v) do { \
uint32_t __t = (v); \
memcpy((u32p), &__t, 4); \
} while (0)
#endif
/* ---- Networking ------------------------------------------ */
@@ -185,7 +204,7 @@ typedef int socklen_t;
* until userspace is widely fixed. */
#if (defined __INTEL_COMPILER && !defined __GNUC__) || \
(defined __GNUC__ && defined __STRICT_ANSI__)
__extension__ typedef __signed__ long long __s64;
__extension__ typedef long long __s64;
__extension__ typedef unsigned long long __u64;
#endif
@@ -296,30 +315,32 @@ static ALWAYS_INLINE char* strchrnul(const char *s, char c)
#endif
#if (defined __digital__ && defined __unix__)
#include <standards.h>
#define HAVE_STANDARDS_H
#include <inttypes.h>
#define HAVE_INTTYPES_H
#define PRIu32 "u"
# include <standards.h>
# define HAVE_STANDARDS_H
# include <inttypes.h>
# define HAVE_INTTYPES_H
# define PRIu32 "u"
/* use legacy setpgrp(pid_t,pid_t) for now. move to platform.c */
#define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me,__me); } while (0)
# define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me,__me); } while (0)
#if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
#define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
#endif
#if !defined ADJ_FREQUENCY && defined MOD_FREQUENCY
#define ADJ_FREQUENCY MOD_FREQUENCY
#endif
#if !defined ADJ_TIMECONST && defined MOD_TIMECONST
#define ADJ_TIMECONST MOD_TIMECONST
#endif
#if !defined ADJ_TICK && defined MOD_CLKB
#define ADJ_TICK MOD_CLKB
#endif
# if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
# define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
# endif
# if !defined ADJ_FREQUENCY && defined MOD_FREQUENCY
# define ADJ_FREQUENCY MOD_FREQUENCY
# endif
# if !defined ADJ_TIMECONST && defined MOD_TIMECONST
# define ADJ_TIMECONST MOD_TIMECONST
# endif
# if !defined ADJ_TICK && defined MOD_CLKB
# define ADJ_TICK MOD_CLKB
# endif
#else /* !__digital__ */
# define bb_setpgrp() setpgrp()
#else
#define bb_setpgrp() setpgrp()
#endif
#if defined(__linux__)
@@ -363,4 +384,4 @@ static ALWAYS_INLINE char* strchrnul(const char *s, char c)
#endif
#endif
#endif /* platform.h */
#endif
+4 -8
View File
@@ -21,12 +21,10 @@
* POSIX Standard: 9.2.2 User Database Access <pwd.h>
*/
#ifndef BB_PWD_H
#define BB_PWD_H 1
#ifndef BB_PWD_H
#define BB_PWD_H 1
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility push(hidden)
#endif
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
/* This file is #included after #include <pwd.h>
* We will use libc-defined structures, but will #define function names
@@ -107,8 +105,6 @@ extern int fgetpwent_r(FILE *__restrict __stream,
will expect, but this need not be the format of the password file. */
/* UNUSED extern int getpw(uid_t __uid, char *__buffer); */
#if __GNUC_PREREQ(4,1)
# pragma GCC visibility pop
#endif
POP_SAVED_FUNCTION_VISIBILITY
#endif /* pwd.h */
Loaded 100 of 459 files, more files were not shown because too many files have changed in this diff. Show more