Commit Graph

636 Commits

Author SHA1 Message Date
Denis Vlasenko
9650f36210 ash: cleanup part 3 2007-02-23 01:04:37 +00:00
Denis Vlasenko
aa74445514 ash: cleanup part 2 2007-02-23 01:04:22 +00:00
Denis Vlasenko
0c032a49b9 ash: cleanup part 1 2007-02-23 01:03:40 +00:00
Denis Vlasenko
a624c11d5e ash: move ash_main() and helpers to end of ash.c, more fuctions renamed,
superfluous casts from memory allocators removed
2007-02-19 22:45:43 +00:00
Denis Vlasenko
2da584fc4e ash: more renaming and style fixes 2007-02-19 22:44:05 +00:00
Denis Vlasenko
b012b10dbd ash: rearrange code to reduce forward references, rename some functions 2007-02-19 22:43:01 +00:00
Denis Vlasenko
e5570da2cf ash: tiny style fixes 2007-02-19 22:41:55 +00:00
Denis Vlasenko
5cedb75aa7 ash: de-obfuscate code, add 'static' keyword, etc. 2007-02-18 19:56:41 +00:00
Denis Vlasenko
131ae177a7 ash: convert #ifdef CONFIG_ to #if ENABLE_ 2007-02-18 13:00:19 +00:00
Denis Vlasenko
a0f82e928a ash: fix indentation and style. no code changes 2007-02-18 12:35:30 +00:00
Denis Vlasenko
6ca0444420 syslogd: fix "readpath bug" by using readlink instead
libbb: rename xgetcwd and xreadlink
2007-02-11 16:19:28 +00:00
Denis Vlasenko
d244c5eaf8 msh: fix my buglet 2007-02-09 17:30:14 +00:00
Denis Vlasenko
cf787cf3a5 find: support for ! 2007-02-04 17:11:25 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
4c97863109 assorted fixes for bugs found with randomconfig 2007-02-03 03:31:13 +00:00
Denis Vlasenko
1e3b068689 msh: cleaning up for -Wwrite-strings part #4 2007-02-01 01:43:54 +00:00
Denis Vlasenko
6b50f73171 msh: cleaning up for -Wwrite-strings part #3 2007-02-01 01:43:39 +00:00
Denis Vlasenko
489f93ebae msh: cleaning up for -Wwrite-strings part #2 2007-02-01 01:43:16 +00:00
Denis Vlasenko
00ccf95bc8 msh: cleaning up for -Wwrite-strings 2007-02-01 01:39:24 +00:00
Denis Vlasenko
71d8abf30c lash: -Wwrite-strings fixes 2007-01-30 22:44:07 +00:00
Denis Vlasenko
bb81c5831a hush: style fixes 2007-01-30 22:32:09 +00:00
Denis Vlasenko
c72c1ed932 hush: now it's -Wwrite-strings clean 2007-01-30 22:31:26 +00:00
Denis Vlasenko
0c886c65de hush: style fixes 2007-01-30 22:30:09 +00:00
Denis Vlasenko
15d78fb724 hust: -Wwrite-strings fixes 2007-01-30 22:28:21 +00:00
Bernhard Reutner-Fischer
eb10e17b7b - improve spelling 2007-01-29 23:56:13 +00:00
Denis Vlasenko
b6aae0f381 preparatory patch for -Wwrite-strings #2 2007-01-29 22:51:25 +00:00
Denis Vlasenko
703e20235a cleanups: unnecessary casts, unified const_1, eliminate cross-.c file
prototypes (heresy!), add spaces in places like "flags&NETSTAT_CONNECTED",
removed unused #defines, #ifdef -> #if, use uint32_t for ipv4 addrs.
2007-01-22 14:12:08 +00:00
Denis Vlasenko
95fef7071e move shell/cmdedit.c -> libbb/lineedit.c 2007-01-22 09:03:42 +00:00
Denis Vlasenko
38f6319421 cmdedit is not a 'command' editing anymore, it's just editing (generic),
so rename stuff accordingly.
2007-01-22 09:03:07 +00:00
Denis Vlasenko
253ce00296 cmdedit: fix breakage 2007-01-22 08:34:44 +00:00
Denis Vlasenko
b01b4e2a1f cmdedit.h: remove 2007-01-22 08:17:14 +00:00
Denis Vlasenko
6258fd3454 cmdedit: stop playing dirty games with atexit 2007-01-22 07:30:26 +00:00
Denis Vlasenko
8e1c71529c Convert cmdedit into more generic line input facility
(make history and completion optional at runtime).
Use it for fdisk, as an example.
Some unrelated fixes in fdisk are also here.
2007-01-22 07:21:38 +00:00
Denis Vlasenko
00cdbd8fc2 Introduce FEATURE_EDITING_FANCY_KEYS, so that user can disable
less-known keys (e.g. Ctrl-B/E/F)
2007-01-21 19:21:21 +00:00
Denis Vlasenko
5592fac308 cmdedit: more optimizations 2007-01-21 19:19:46 +00:00
Denis Vlasenko
47bdb3ac48 cmdedit: small optimizations 2007-01-21 19:18:59 +00:00
Denis Vlasenko
82b39e83ab sanitize cmdedit a bit (group functions by task etc) 2007-01-21 19:18:19 +00:00
Denis Vlasenko
2f0c0d0b88 Introduce FEATURE_EXEC_PREFER_APPLETS = "re-execute our own
executable if we asked to exec someting with argv[0] == known_applet"
Use it in init. Also respect PATH in init, remove explicit "/sbin" etc
from exec. Patch by Gabriel L. Somlo <somlo@cmu.edu>
2007-01-21 00:41:04 +00:00
Denis Vlasenko
9af7c9d6b6 openvt,getty,vfork_daemon_rexec,mount: tighten up fd cleanup code
(will close all fd's > 2 on daemonization now)
getty: fix "getty -" support, and also do not try to chown/chmod "-"
telnetd: fix "lost ctty" bug
Yet another attempt on saner function names:
bb_sanitize_server_stdio(0/1) -> bb_sanitize_stdio() + bb_daemonize();
2007-01-19 21:19:35 +00:00
Denis Vlasenko
7f0d7ae4f5 fix subtle bug inherited from dash 2007-01-18 01:12:57 +00:00
Denis Vlasenko
f7996f3b70 Trailing whitespace removal over entire tree 2007-01-11 17:20:00 +00:00
Denis Vlasenko
62a6983a81 execute "safe applets" exev if not standalone shell
(patch by "Eric Spakman" <E.Spakman@inter.nl.net>)
2007-01-10 00:24:50 +00:00
Denis Vlasenko
b2abef3e54 stty: fix width of a field for ppc32
sort: fix -u to match coreutils 6.3
msh: compile fix (my fault)
2007-01-01 18:18:04 +00:00
Denis Vlasenko
e27f15615f msh: double "static char line[LINELIM]" etc deleted.
massive amounts of assignments-in-ifs deleted
(some of which were VERY nasty)
2007-01-01 06:00:38 +00:00
Mike Frysinger
57ec574af7 * precision requires the argument be an integer, not size_t 2006-12-28 21:41:09 +00:00
Denis Vlasenko
8f27c34c28 ash: is_safe_applet mustn't affect disabled applets 2006-12-26 21:31:11 +00:00
Denis Vlasenko
666da5e2c6 merge post-1.3.0 fixes 2006-12-26 18:17:42 +00:00
Denis Vlasenko
bf0a201008 style fixes
last xcalloc replaced by xzalloc
2006-12-26 10:42:51 +00:00
Denis Vlasenko
0ee3999d13 random tiny size savings 2006-12-24 15:23:28 +00:00
Denis Vlasenko
f4dff77355 less: implement waiting for input using select(). Rather tricky business.
But we do not read entire input anymore up-front.
2006-12-24 07:14:17 +00:00
Denis Vlasenko
7e46cf748e #define FEATURE_GETUSERNAME_AND_HOMEDIR should be always #defined 2006-12-23 01:21:55 +00:00
Denis Vlasenko
4cccc03768 remove useless casts (type*) xzalloc(...) 2006-12-22 18:37:07 +00:00
Denis Vlasenko
afc9ff99fd removal of commented-out cruft 2006-12-22 00:45:27 +00:00
Denis Vlasenko
0a8a774179 cmdedit: reformat code a bit, no algorithm changes 2006-12-21 22:27:10 +00:00
Denis Vlasenko
d56b47f9a6 fix type character mixup in command completion 2006-12-21 22:24:46 +00:00
Denis Vlasenko
bf66fbc8e2 introduce LONE_CHAR (optimized strcmp with one-char string) 2006-12-21 13:23:14 +00:00
Denis Vlasenko
f58906b646 cmdedit: fix my bug, improve code a bit 2006-12-19 19:30:37 +00:00
Denis Vlasenko
7f1dc21a5d cmdedit: use qsort for sorting command completion results; style fixes 2006-12-19 01:10:25 +00:00
Denis Vlasenko
15b213ef5a su: make /etc/shells check configurable
ash: missing ';'
2006-12-19 00:20:20 +00:00
Denis Vlasenko
7cfecc4b36 xfuncs.c: dietlibc actually HAS fdprintf!
platform.h: define strchrnul for dietlibc
ash: stop using few non-standard functions
2006-12-18 22:32:45 +00:00
Denis Vlasenko
83e5d6f772 A bunch of defined(__GLIBC__) added. static-linking warning expanded 2006-12-18 21:49:06 +00:00
Denis Vlasenko
9f739445cd inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid] 2006-12-16 23:49:13 +00:00
Denis Vlasenko
097c324f59 fix remaining survivors of the return(a) cleanup 2006-11-27 16:59:15 +00:00
Denis Vlasenko
d9e15f2068 style cleanup: return(a) -> return a, part 2 2006-11-27 16:49:55 +00:00
Denis Vlasenko
079f8afa0a style cleanup: return(a) -> return a, part 1 2006-11-27 16:49:31 +00:00
Denis Vlasenko
d398ecab9d hunt down improper include <>, make mkswap output 4Gb+ friendly 2006-11-24 15:38:03 +00:00
Denis Vlasenko
fcdb00f735 httpd: LC_TIME locale _must_ be POSIX to httpd! We speak over the net! 2006-11-21 00:09:37 +00:00
Denis Vlasenko
89f0b3486d rodata cleanup. "unable to" == "cannot". -300 bytes 2006-11-18 22:04:09 +00:00
Denis Vlasenko
a7189f01a4 add -Wundef, fix uncovered bugs 2006-11-17 20:29:00 +00:00
Mike Frysinger
3672fe9e91 remove duplicate flag decls 2006-11-15 21:52:10 +00:00
Denis Vlasenko
9d4533ede1 Fix kbuild bugs noticed by Bernhard Fischer <rep.nop@aon.at> 2006-11-02 22:09:37 +00:00
Denis Vlasenko
966ec7c067 #if CONFIG_xxx -> #if ENABLE_xxx 2006-11-01 09:13:26 +00:00
Denis Vlasenko
ddec5af6b0 rename functions to more understandable names 2006-10-26 23:25:17 +00:00
Denis Vlasenko
c6f188def8 silly size savings and capitalization fixes 2006-10-26 00:37:00 +00:00
Denis Vlasenko
d18a3a20db use skip_whitespace where appropriate 2006-10-25 12:46:03 +00:00
Denis Vlasenko
e1a0d486e4 message string changes, mostly for consistency, also -32 bytes in .rodata 2006-10-20 13:28:22 +00:00
Denis Vlasenko
5f03158f66 ash: fix segfault in ash.
patch by walter harms <wharms@bfs.de>
2006-10-16 01:33:16 +00:00
Denis Vlasenko
ea62077b85 add open_read_close() and similar stuff 2006-10-14 02:23:43 +00:00
Denis Vlasenko
2d5ca60bfb bb_get_[chomped]line_from_file wasn't descriptive enough.
Renaming...
2006-10-12 22:43:20 +00:00
Denis Vlasenko
8de82bf84f hush.c: stop using __FILE__ (bad in out-of-tree builds) 2006-10-11 21:38:33 +00:00
Denis Vlasenko
cba9ef5523 fixes from Vladimir Dronnikov <dronnikov@gmail.ru> 2006-10-10 21:00:47 +00:00
Denis Vlasenko
7d219aab70 build system overhaul 2006-10-05 10:17:08 +00:00
Denis Vlasenko
8f8f268cfd bb_applet_name -> applet_name 2006-10-03 21:00:43 +00:00
Denis Vlasenko
67b23e6043 getopt_ulflags -> getopt32.
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
2006-10-03 21:00:06 +00:00
Denis Vlasenko
9275814a9e lots of silly indent fixes 2006-10-03 19:56:34 +00:00
Denis Vlasenko
a959588b80 Yet another silly little byte saving. couldn't -> cannot 2006-09-29 21:30:43 +00:00
Denis Vlasenko
e175ff252f several fixes from openWRT project 2006-09-26 17:41:00 +00:00
Rob Landley
4ef6f647a3 The version checked into the tree is a snapshot of an unifinished applet, and
you just made lots of ">>>>>>> mine" lines show up in my working copy of this.

Please don't do that again.
2006-09-20 21:57:36 +00:00
Denis Vlasenko
9213a9e0f2 whitespace cleanup 2006-09-17 16:28:10 +00:00
Rob Landley
215c61d3c2 Unbreak allbareconfig. 2006-09-15 04:10:05 +00:00
Rob Landley
ef08184d9e Fix warnings. 2006-09-08 17:21:19 +00:00
Rob Landley
3476ad651d Second drop. More infrastructure in place, especially for parsing pipelines.
The minimal version got a couple hundred bytes bigger, partly because it's
broken into more functions but mostly because it now dynamically reallocates
and frees everything with no hard-coded limits.  (I thought about making
that optional, but there's a limit to what I can debug and maintain.  It
should still be reasonably NOMMU friendly, the allocations are small and
short lived, and shouldn't contribute noticeably to long-term memory
fragmentation.)
2006-09-08 16:59:08 +00:00
Rob Landley
02add9e53a Might as well commit this to have the history. It's not linked in to the
applet list yet (and won't be until it can replace lash, I'm not having five
shells in menuconfig at once), but you can build it with scripts/individual
and mostly this is checked in so I can bloatcheck future versions against it
easily....

This is about as small as a shell can get and still be a shell.
2006-09-05 03:22:19 +00:00
Rob Landley
88621d7398 Svn 16007 broke the build under gcc 4.0.3. This fixes up some of the damage
(the e2fsprogs directory is too twisty and evil to easily fix, but I plan
to rewrite it anyway so I'll just bump that up in priority a bit).
2006-08-29 19:41:06 +00:00
Bernhard Reutner-Fischer
d591a360d3 - merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines

- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly

------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines

- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.

------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines

- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
   text    data     bss     dec     hex filename
 862434   10156  645924 1518514  172bb2 busybox.old
 862322   10156  645892 1518370  172b22 busybox
function                                             old     new   delta
z_len                                                  4       -      -4
textend                                                4       -      -4
part_nb                                                4       -      -4
insize                                                 4       -      -4
ifile_size                                             4       -      -4
do_link                                                4       -      -4
new_text                                              70      60     -10
ipaddr_list_link                                      33      23     -10
gzip_main                                            898     822     -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120)           Total: -120 bytes


------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines

- remove useless global exports
function                                             old     new   delta
rpm_main                                             940    1601    +661
rpm_getstring                                        107     112      +5
rpm_getint                                           148     153      +5
loop_through_files                                   103     106      +3
fileaction_dobackup                                  115     113      -2
fileaction_list                                        5       -      -5
rpm_getcount                                          42       -     -42
extract_cpio_gz                                      161       -    -161
rpm_gettags                                          504       -    -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714)          Total: -40 bytes

   text    data     bss     dec     hex filename
 862322   10156  645892 1518370  172b22 busybox.old
 862290   10156  645892 1518338  172b02 busybox


------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines

- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
  stats:
function                                             old     new   delta
logMessage                                           395     427     +32
message                                             1245    1257     +12
opts                                                   -       4      +4
small                                                  1       -      -1
local_logging                                          4       -      -4
doRemoteLog                                            4       -      -4
circular_logging                                       4       -      -4
syslogd_main                                        1299    1285     -14
static.res                                            36      16     -20
.rodata                                           186650  186586     -64
static.line                                         1025       -   -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136)        Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
   text    data     bss     dec     hex filename
   3723     348    5242    9313    2461 sysklogd/syslogd.o.orig
   3697     348    4188    8233    2029 sysklogd/syslogd.o

==============================================================================
Overall bloatcheck for the changeset mentioned above:
function                                             old     new   delta
rpm_main                                             953    1608    +655
logMessage                                           395     427     +32
message                                             1245    1257     +12
opts                                                   -       4      +4
rpm_getstring                                        107     110      +3
rpm_getint                                           148     151      +3
loop_through_files                                   103     104      +1
small                                                  1       -      -1
fileaction_dobackup                                  115     113      -2
z_len                                                  4       -      -4
textend                                                4       -      -4
part_nb                                                4       -      -4
local_logging                                          4       -      -4
insize                                                 4       -      -4
ifile_size                                             4       -      -4
do_link                                                4       -      -4
doRemoteLog                                            4       -      -4
circular_logging                                       4       -      -4
fileaction_list                                        5       -      -5
new_text                                              70      60     -10
ipaddr_list_link                                      33      23     -10
clear_bufs                                            31      21     -10
syslogd_main                                        1287    1273     -14
builtin_help                                         190     176     -14
static.res                                            36      16     -20
builtin_source                                       229     199     -30
rpm_getcount                                          42       -     -42
gzip_main                                            842     786     -56
.rodata                                           227176  227112     -64
lash_main                                            609     527     -82
busy_loop                                           3883    3739    -144
extract_cpio_gz                                      155       -    -155
rpm_gettags                                          501       -    -501
static.line                                         1025       -   -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221)     Total: -1511 bytes
2006-08-20 17:35:13 +00:00
Rob Landley
a299efb7b0 Make a warning go away when standalone shell is disabled. 2006-08-10 21:46:43 +00:00
Rob Landley
081e38483e Remove xcalloc() and convert its callers to xzalloc(). About half of them
were using "1" as one of the arguments anyway, and as for the rest a multiply
and a push isn't noticeably bigger than pushing two arguments on the stack.
2006-08-03 20:07:35 +00:00
Rob Landley
d921b2ecc0 Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes...  General cleanup pass.  What I've
been doing for the last couple days.

And it conflicts!  I've removed httpd.c from this checkin due to somebody else
touching that file.  It builds for me.  I have to catch a bus.  (Now you know
why I'm looking forward to Mercurial.)
2006-08-03 15:41:12 +00:00
Rob Landley
53702e53ba Replace the previous checkin with the correct fix. 2006-07-19 21:43:53 +00:00
"Robert P. J. Day"
3e4da920bd For now, get around the error that "child" might be uninitialized. 2006-07-18 12:05:43 +00:00