Commit Graph

710 Commits

Author SHA1 Message Date
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
Rob Landley
534374755d Cleaup read() and write() variants, plus a couple of new functions like
xlseek and fdlength() for the new mkswap.
2006-07-16 08:14:35 +00:00
Rob Landley
c9c1a41c58 A couple things that got tangled up in my tree, easier to check in both than
untangle them:

Rewrite u_signal_names() into get_signum() and get_signame(), plus trim the
signal list to that required by posix (they can specify the numbers for
the rest if they really need them).  (This is preparatory cleanup for adding
a timeout applet like Roberto Foglietta wants.)

Export the itoa (added due to Denis Vlasenko, although it's not quite his
preferred implementation) from xfuncs.c so it's actually used, and remove
several other redundant implementations of itoa and utoa() in the tree.
2006-07-12 19:17:55 +00:00
Rob Landley
acf448d4f6 Bugfix from Shaun Jackman (check that argv[optind] isn't null before
dereferencing it) plus a bunch of tweaks from me.
2006-07-09 17:03:07 +00:00
Rob Landley
f296f0b77d Bug fix from Vladimir Oleynic via Paul Fox for:
echo "+bond0" > /sys/class/net/bonding_masters
while true; do
  echo hello
done
2006-07-06 01:09:21 +00:00
"Robert P. J. Day"
4eddb42bbc Remove the silly redundancy from that header file include. 2006-07-03 00:46:47 +00:00
"Robert P. J. Day"
63fc1a9e08 Standardize on the vi editing directives being on the first line. 2006-07-02 19:47:05 +00:00
Rob Landley
7a8e491dff Patch from Shaun Jackman moving the var=value logic to here it can do some good. 2006-07-01 17:19:02 +00:00
"Robert P. J. Day"
177c9f3128 Get rid of all "#if 0" content. 2006-07-01 14:30:28 +00:00
"Robert P. J. Day"
68229837ff Remove all usage of the "register" storage class specifier. 2006-07-01 13:08:46 +00:00
"Robert P. J. Day"
f350160963 Remove "#if 1" directives. 2006-07-01 12:19:39 +00:00
Mike Frysinger
42705abc28 dont setpgrp() for now as it breaks system() and that is more important than ctrl+c handling of background processes 2006-06-26 20:42:36 +00:00
Bernhard Reutner-Fischer
f087798e8b - convert old-style parameter declarations (K&R) to modern style. 2006-06-25 22:08:53 +00:00
Bernhard Reutner-Fischer
35492137f8 - add note about strict ordering 2006-06-21 18:19:53 +00:00
Mike Frysinger
c2ad4f5d27 Jean Wolter writes: ash uses bsearch to search in the list of built-in commands, therefore the list of built-in commands has to be ordered. Revision 15077 introduced the source built-in and destroyed this order. And now ash doesn't find the shift command anymore. 2006-06-21 18:04:49 +00:00
Rob Landley
5483de1cb7 Cleanup patch from Shaun Jackman converting %m to perror. 2006-06-20 21:35:26 +00:00
Mike Frysinger
14ff19b28a assign default debug level to the MSHDEBUG define 2006-06-20 20:37:01 +00:00
Rob Landley
7a260f01ce Make some 64 bit warnings go away on x86-64. 2006-06-19 03:20:03 +00:00
Rob Landley
a34b48abe5 Upgrade the standalone shell code to use CONFIG_BUSYBOX_EXEC_PATH. 2006-06-14 01:27:01 +00:00
Rob Landley
68286770b6 Patch from Shaun Jackman to detect "name=value" variable assignments. Random
cleanup at the end by me to make some unrelated #ifdefs go away...
2006-06-13 19:01:30 +00:00
Rob Landley
f946379599 Make lash smaller. (Use llist_t for file closing, and different allocation
functions.)
2006-06-13 18:50:20 +00:00
Paul Fox
7ba12c6957 remove leading "Enable" from the config option text. not only is it
redundant, but it made the menuconfig shortcut mechanism mostly
useless, since so many of the entries started with 'E'.
2006-06-08 21:48:47 +00:00
Paul Fox
6ab037872f made "test" an ash built-in.
moved the contents of libbb/bb_echo.c back into coreutils/echo.c,
which is a more reasonable place for them than libbb.  this
forces anyone who wants echo and test to be builtin to ash to
also have them available as applets.  their cost is very small,
and the number of people who wouldn't want them as applets is
also very small.

added warning about shell builtins vs. CONFIG_FEATURE_SH_STANDALONE_SHELL,
which conflicts with their use.

thanks to nathanael copa for debugging help.

some string size optimization in test.c may have been lost with
this commit, but this is a good new baseline.
2006-06-08 21:37:26 +00:00
Bernhard Reutner-Fischer
19008b8373 - reuse strings and messages. Saves about 600B 2006-06-07 20:17:41 +00:00
Mike Frysinger
2a13175440 make the default prompt suck less when using fancy prompts 2006-06-06 06:26:12 +00:00
Bernhard Reutner-Fischer
62558765b9 2006-06-02 Shaun Jackman <sjackman@gmail.com>
* shell/lash.c (pseudo_exec) [_NEWLIB_VERSION]: Remove the
	__getopt_initialized hackery.
2006-06-03 10:28:25 +00:00
Bernhard Reutner-Fischer
e15d7573a1 - move #include busybox.h to the very top so we pull in the config
and eventual platform specific includes in early.
2006-06-02 20:56:16 +00:00
Mike Frysinger
3132e9d830 use xmalloc() 2006-06-02 06:30:30 +00:00
Rob Landley
299a6b4d7b Consolidate #include <sys/time.h> so libbb.h does it. 2006-05-27 21:42:58 +00:00
Bernhard Reutner-Fischer
b180e5a766 - use portability wrapper define bb_setpgrp. 2006-05-26 14:24:56 +00:00
Bernhard Reutner-Fischer
0a8812bdc5 - replace _PATH_DEVNULL with bb_dev_null 2006-05-19 13:12:21 +00:00
Mike Frysinger
39440e520c pull Rules.mak from top_srcdir as pointed out by Robert P. J. Day on the mailing list 2006-05-13 02:33:09 +00:00
Rob Landley
47b1838957 Patch from Lucas C. Villa Real adding "source" as a synonym for the "." command. 2006-05-12 20:44:16 +00:00
Mike Frysinger
1781188a9d didnt mean to commit debug enable 2006-05-05 20:33:07 +00:00
Mike Frysinger
02d8fa48ad use %p when printing pointers, not %x 2006-05-05 20:32:31 +00:00
Mike Frysinger
4e512f1062 fix Bug 659 as reported by Robin Getz 2006-05-05 18:38:07 +00:00
Rob Landley
2ec922eed5 Patch from Robert P Day: let menuconfig indent stuff for us, we don't have
to do it in Config.in.
2006-04-13 23:22:16 +00:00
Bernhard Reutner-Fischer
df10094870 - revert back to r14406 2006-03-13 19:04:00 +00:00
Rob Landley
bc68cd14cc Patch from Denis Vlasenko turning static const int (which gets emitted into
the busybox binary) into enums (which don't).
2006-03-10 19:22:06 +00:00
Bernhard Reutner-Fischer
07a79e75f5 - backout using features which are not available with the previous stable
version of make (3.71.1).
2006-03-09 09:03:37 +00:00
Paul Fox
0f2dd9f4eb vi-mode changes: eliminate warnings from out-of-range-for-type
case labels that are emitted by gcc4.  rearrange macros to
eliminate these extra case labels entirely (since the optimizer
may no longer do it for us).  eliminate static BUFSIZ character
deletion buffer -- malloc it, and make it much much smaller.
2006-03-07 20:26:11 +00:00
Rob Landley
dfba741457 Robert P. Day removed 8 gazillion occurrences of "extern" on function
definitions.  (That should only be on prototypes.)
2006-03-06 20:47:33 +00:00
Rob Landley
06ec8cff83 Typo fixes brought to you by the letters a, l, and Robert P. Day. 2006-03-03 19:02:50 +00:00
Bernhard Reutner-Fischer
022eb311d5 - use absolute path for top_builddir and top_srcdir.
Fixes make trying to include the very same file in an endless loop.
2006-03-02 17:33:25 +00:00
Bernhard Reutner-Fischer
5d26126b9e - fixes parallel builds (make -j)
- use less resources for the buildsystem itself
2006-03-01 22:54:48 +00:00
Rob Landley
75cc0cace3 I was playing around with a dependency generator a couple weeks ago and I found
some #include files that aren't in the tree.  No biggie...
2006-02-24 03:15:34 +00:00
Rob Landley
d6e14d8bee Don't build directory libraries unless we're building an applet that needs it.
Cherry-picked from Devin Bayer's big MacOS X patch.
2006-02-21 19:11:35 +00:00
"Vladimir N. Oleynik"
dd1ccddf1b moved BB_BANNER to applets/version.c file: make kernel like version,
removed depend loop: busybox.h depend with BB_BT, and all sources depend with busybox.h
2006-02-16 15:40:24 +00:00
Rob Landley
32251b4825 Convert some help text to english. 2006-02-08 18:34:21 +00:00
Mike Frysinger
b38673fb9f make the build system puuuuuuuuuuurty 2006-02-02 01:41:53 +00:00
"Vladimir N. Oleynik"
4ccd2b4697 quick analize signed->unsigned: protect overflow of map[char], getchar->EOF. Use ATTRIBUTE_UNUSE. 2006-01-31 09:27:48 +00:00
Eric Andersen
a68ea1cb93 fix up yet more annoying signed/unsigned and mixed type errors 2006-01-30 22:48:39 +00:00
Rob Landley
49576c0018 Note on SVN 13424: Don't mix "default y" and select of something earlier
in the menu hierarchy or else make allnoconfig winds up leaving whatever the
select  points to as "y".  (In this case, "make allnoconfig" is leaving 
CONFIG_TEST as "y".)
2006-01-30 06:11:42 +00:00
"Vladimir N. Oleynik"
84005af7ef C99 say: "char" declaration may be signed or unsigned default 2006-01-25 17:53:04 +00:00
"Vladimir N. Oleynik"
fdb871c498 Add more bash-like dot-dirs cmdedit feature
Close bug 648.
Restore my whitespace
2006-01-25 11:53:47 +00:00
Tim Riker
c1ef7bdd8d just whitespace 2006-01-25 00:08:53 +00:00
Bernhard Reutner-Fischer
86f5c9906b - add platform.h.
- use shorter boilerplate while at it.
2006-01-22 22:55:11 +00:00
Bernhard Reutner-Fischer
96002bba67 - cleanup Config.in. Use "select CONFIG_FOO" and add the corresponding
"depends on CONFIG_BAR" instead of the if !CONFIG_FOO ...default y stanza.
2006-01-19 14:42:23 +00:00
"Vladimir N. Oleynik"
cfc8f59649 restore 8-bit syntax works, last debian patch is broken. Noticed by Vladimir Dronnikov 2006-01-19 11:23:34 +00:00
"Vladimir N. Oleynik"
fb29b46201 sync with dash_0.5.3-1 2006-01-15 14:21:01 +00:00
Bernhard Reutner-Fischer
7ca61b6f33 - shared libbusybox.
- IMA compilation option (aka IPO, IPA,..)
Please holler if i broke something..
2006-01-15 14:04:57 +00:00
"Vladimir N. Oleynik"
ddc280ec43 sync license from mainstream 2005-12-15 12:01:49 +00:00
"Vladimir N. Oleynik"
e6d88ea2a1 remove sigsetmask, noticed by Bernhard 2005-12-13 13:24:23 +00:00
Rob Landley
032e2cbf20 Uninitialized variable causing intermittent syntax errors (bug 449). 2005-12-12 06:52:45 +00:00
"Vladimir N. Oleynik"
485d7cbdf1 data --> text 2005-10-17 09:48:57 +00:00
"Vladimir N. Oleynik"
6f347ef9dc common BUFSIZ BSS buffer, small reduce code, data and bss 2005-10-15 10:23:55 +00:00
"Vladimir N. Oleynik"
6c35c7c976 usage bb_dev_null 2005-10-12 15:34:25 +00:00
"Vladimir N. Oleynik"
39a841cecf change interface to bb_xasprintf() - more perfect for me.
ln.c: error_msg(str)->error_msg(%s, str) - remove standart "feature" for hackers
reduce 100 bytes don't care in sum
2005-09-29 16:18:57 +00:00
"Vladimir N. Oleynik"
11d7c52912 correct set prompt if CONFIG_ASH_EXPAND_PRMT enabled, small automatic space->tabs convert by my personal editor 2005-09-26 13:24:45 +00:00
Mike Frysinger
62f18e1f20 use the shorter license header 2005-09-24 07:16:29 +00:00
Mike Frysinger
0d4ee68be5 use brief license line 2005-09-24 06:01:57 +00:00
Mike Frysinger
9ac178ab40 rename menu and touchup whitespace 2005-09-24 05:49:36 +00:00
"Vladimir N. Oleynik"
ac9731704a Reduce exported from msh applet 2005-09-22 14:38:17 +00:00
"Vladimir N. Oleynik"
264e771b8b Reduce exported from lash applet 2005-09-22 14:35:29 +00:00
"Vladimir N. Oleynik"
19c370167a Reduce exported from hush applet 2005-09-22 14:33:15 +00:00
"Vladimir N. Oleynik"
e4baaa2d27 more remove lost exported 2005-09-22 12:59:26 +00:00
Paul Fox
02eb934b0f committing:
Summary      0000242: ash: read -t broken
this also implements -n and -s options to read.  (they're configured
together because most of their code is in common, and separating them
seemed silly.
2005-09-07 16:56:02 +00:00
"Vladimir N. Oleynik"
f087480da1 destroy bug [0000404] 2005-09-05 15:46:26 +00:00
"Vladimir N. Oleynik"
bef14d7a87 1) sync with dash_0.5.2-7
2) but expand PS# as config option
3) correct kill error message again
4) remove show "line number" for interactive run (patch pending for dash)
2005-09-05 13:25:11 +00:00
Rob Landley
23246f39ed Patch from Stephane Billiart to improve ash error message. 2005-08-14 19:16:51 +00:00
Paul Fox
0b62158475 implemented a builtin echo command in ash. moved the guts of the
echo applet into libbb, and now call bb_echo() from both echo.c
and ash.c
2005-08-09 19:38:05 +00:00
Paul Fox
3f11b1bf63 commiting:
0000025: vi-editing mode for ash
2005-08-04 19:04:46 +00:00
Mike Frysinger
4d00896d05 use toplevel ARFLAGS and update default ARFLAGS to be quiet 2005-07-27 01:09:24 +00:00
Paul Fox
8de331def0 revert 10881, and refix by changing "if (vallen)" to "if (val)". this
is per the upstream fix for dash, in dash_0.5.2-6.diff.  thanks vodz, for
catching this.
2005-07-21 12:03:05 +00:00
Paul Fox
6f267f022f applying fix for:
0000261: Unsafe empty env var export in ash
2005-07-20 19:18:45 +00:00
Paul Fox
54690dc0b2 applyinf fix for:
0000155: variable expansion with braces in backticks in msh
2005-07-20 18:33:12 +00:00
Paul Fox
c3850c83d9 applying fix from:
0000152: ash: quoting rules for local variables different to globals
2005-07-20 18:23:39 +00:00
Paul Fox
574fee4f99 applying:
0000054: Tab completing filenames in ash causes SEGV
	Simple tab completion operations cause busybox (ash) to
	access illegal addresses.
2005-07-19 20:41:06 +00:00
Rob Landley
0fcd9430ce This one's from me. Fix ash "standalone shell".
If we exec /proc/self/exe and only fall back to /bin/busybox if /proc isn't
there, then we have a reasonable chance of having the standalone shell work
even if busybox isn't installed in /bin on the system in question.

Still won't work in a chroot environment, but it's an improvement.
2005-05-07 08:27:34 +00:00
Mike Frysinger
dcc40b7ecc Shaun Jackman writes: Newlib uses both __getopt_initialized and optind to track initialization of getopt() 2005-03-04 01:33:17 +00:00
Ned Ludd
d1e3cbdb5a - no need to check if JOBS is defined. Config.in ensures it. 2005-02-10 00:44:31 +00:00
Ned Ludd
2123b7cded - add ash read -t timeout support. initial code provided by Tim Yamin on Oct/21/2004 on the busybox mailing list. Edited his code a little to keep syntax highlighers happy and make it optional when CONFIG_ASH_TIMEOUT is defined 2005-02-09 21:07:23 +00:00
Eric Andersen
ad63cb2514 Fix CONFIG_ASH_MATH_SUPPORT_64 so it actually works 2004-10-08 09:43:34 +00:00
Eric Andersen
c00e11df85 Hiroshi Ito writes:
ash
   "unset OLDPWD; cd -"  causes segmentation fault.
    ( OLDPWD is not set when sh is invoked from getty. )

patch against current CVS is attached.
2004-10-08 08:14:58 +00:00
Eric Andersen
7daa076d3e egor duda writes:
Hi!

I've created a patch to busybox' build system to allow building it in
separate tree in a manner similar to kbuild from kernel version 2.6.

That is, one runs command like
'make O=/build/some/where/for/specific/target/and/options'
and everything is built in this exact directory, provided that it exists.

I understand that applyingc such invasive changes during 'release
candidates' stage of development is at best unwise. So, i'm currently
asking for comments about this patch, starting from whether such thing
is needed at all to whether it coded properly.

'make check' should work now, and one make creates Makefile in build
directory, so one can run 'make' in build directory after that.

One possible caveat is that if we build in some directory other than
source one, the source directory should be 'distclean'ed first.

egor
2004-10-08 07:46:08 +00:00
Glenn L McGrath
53090cdedd Fix a typo 2004-09-24 09:09:44 +00:00
Eric Andersen
6f8542b98d A bit of extra explanation regarding STANDALONE 2004-09-24 01:25:39 +00:00
Eric Andersen
4a79c0e9e1 Patrick Huesmann noticed BusyBox would not link when
CONFIG_FEATURE_COMMAND_EDITING was defined *and*
CONFIG_FEATURE_COMMAND_TAB_COMPLETION was undefined.

Vladimir N. Oleynik writes:

Its declare always, also if CONFIG_FEATURE_COMMAND_TAB_COMPLETION
undefined.
Patch to CVS version attached.

--w
vodz
2004-09-08 10:01:07 +00:00
Eric Andersen
fd7a4c8c28 Jonas Holmberg from axis dot com writes:
This patch makes msh handle variable expansion within backticks more
correctly.

Current behaviour (wrong):
--------------------------

BusyBox v1.00-rc3 (2004.08.26-11:51+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.

$ A='`echo hello`'
$ echo $A
`echo hello`
$ echo `echo $A`
hello
$


New behaviour (correct):
------------------------

BusyBox v1.00-rc3 (2004.08.26-11:51+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.

$ A='`echo hello`'
$ echo $A
`echo hello`
$ echo `echo $A`
`echo hello`
$

The current behaviour (wrong according to standards) was actually my
fault. msh handles backticks by executing a subshell (which makes it
work on MMU-less systems). Executing a subshell makes it hard to only
expand variables once in the parent. Therefore I export all variables
that will be expanded within the backticks and let the subshell handle
the expansion instead.

The bug was found while searching for security leaks in CGI-scripts.
Current behaviour of msh makes it easy to expand backticks by mistake
in $QUERY_STRING. I recommend appling the patch before release of bb
1.00.

/Jonas
2004-09-02 23:13:10 +00:00
Eric Andersen
785001468d Quiet a few warnings 2004-08-27 19:55:28 +00:00
Eric Andersen
cb01bb1d68 Patch from Vladimir N. Oleynik:
On Wed Aug 18, 2004 at 06:52:57PM +0800, Matt Johnston wrote:
> I've come across some strange-seeming behaviour when running programs
> under Busybox (1.0.0-rc3) ash. If the child process sets stdin to be
> non-blocking and then exits, the parent ash will also exit. A quick strace
> shows that a subsequent read() from stdin returns EAGAIN (as would be
> expected):

Thanks!
Patch attached.


--w
vodz
2004-08-19 18:22:13 +00:00
Eric Andersen
acd647c877 Joe.C writes:
This bug is in busybox 1.0.0-rc2. When using lash exec
builtin with redirection, the opened file fd keep increasing.
For example, please try the following command with lash.


ls -al /proc/<lash pid>/fd
exec /bin/sh 2>/dev/null
ls -al /proc/<lash pid>/fd

  The last 'ls' command output will look like this. The fd
number 4 shouldn't exist.

lrwx------    1 501      100         64 Aug 13 13:56 4 -> /dev/pts/5
l-wx------    1 501      100         64 Aug 13 13:56 2 -> /dev/null
lrwx------    1 501      100         64 Aug 13 13:56 1 -> /dev/pts/5
lrwx------    1 501      100         64 Aug 13 13:56 0 -> /dev/pts/5
dr-xr-xr-x    3 501      100          0 Aug 13 13:56 ..
dr-x------    2 501      100          0 Aug 13 13:56 .

  This one-line patch fix this problem by setting CLOEXEC flag for
squirrel fd. Please apply.

Joe.C
2004-08-16 08:38:34 +00:00
Glenn L McGrath
2f325a030b Patch from Tito to fix warnings about redifined functionions barrier and likely. 2004-08-06 01:49:04 +00:00
Eric Andersen
12de6cf0d7 Michael Leibow, MichaelLe at belkin.com writes:
A question was posted a month ago by Mark Alamo to see if others had
problems with sourcing subscripts within msh.  We asked his firm to fix the
msh.c bug he described because we didn't have enough time to do it
ourselves.

When msh.c is executing a compound statement and there is a . command to
source another script file, msh.c will not execute the subscript until it's
completed executing the rest of the compound statement.

His example was this:

Echo "Start" ; . ./subA; echo "mid" ; . ./subB ; echo "end"

subA and subB execute AFTER end is printed in reverse order.  The same is
true if the sourced files are inside an if else fi, case esac, or any
compound statement.

Attached is a patch to msh.c.  It fixes the problem.  Cd to the root of your
busybox tree and execute "patch -p1 < msh.c.patch"

Unfortunately, I won't have more time to work on this so I hope that there
aren't any problems!

Michael Leibow
Senior Software Engineer

Belkin Corporation
2004-08-04 19:19:10 +00:00
Eric Andersen
8401eeafd6 Run msh through indent 2004-08-04 19:16:54 +00:00
Eric Andersen
5dcf15e02d Paul Whittaker writes:
With job control enabled, ash fails to tcsetpgrp back to initialpgrp
upon exit.  exitshell() should call setjobctl(0) to do this.

Context: I am using a lightweight menu system (replimenu[.sf.net]) on my
console, which invokes "/bin/sh -i -c /bin/login", where /bin/sh and
/bin/login are busybox applets.   /bin/sh is ash, with
CONFIG_ASH_JOB_CONTROL=y as the sole suboption.  The shell of the user
concerned (nobody) is also /bin/sh (ash).  When the user /bin/sh exits
(and thereby login and its parent sh), replimenu receives EIO when it
tries to read from the terminal.
2004-07-24 12:44:13 +00:00
Glenn L McGrath
28939ade2d Patch from Jean Wolter, fixes compiler warning when ASH_ALIAS is
disabled.
2004-07-21 10:20:19 +00:00
Glenn L McGrath
5f2a23c3c6 Fix compile error when math support disabled. 2004-06-25 07:05:13 +00:00
Eric Andersen
fac312d78b Stupidity-1, Erik-0 2004-06-22 20:09:40 +00:00
Eric Andersen
e983584c70 Bastian Blank notices a couple of int64_ts that should have
been longs
2004-06-22 19:07:21 +00:00
Eric Andersen
ed9ecf7894 Patch from Bastian Blank:
The updated patch adds a config option to explicitely enable 64 bit
    arithmetic.

    Also it removes the arith prototype from libbb.h as it is not used
    outside of ash.

    Bastian

this patch has been slightly modified by Erik for cleanliness.
2004-06-22 08:29:45 +00:00
Eric Andersen
aff114c33d Larry Doolittle writes:
This is a bulk spelling fix patch against busybox-1.00-pre10.
If anyone gets a corrupted copy (and cares), let me know and
I will make alternate arrangements.

Erik - please apply.

Authors - please check that I didn't corrupt any meaning.

Package importers - see if any of these changes should be
passed to the upstream authors.

I glossed over lots of sloppy capitalizations, missing apostrophes,
mixed American/British spellings, and German-style compound words.

What is "pretect redefined for test" in cmdedit.c?

Good luck on the 1.00 release!

      - Larry
2004-04-14 17:51:38 +00:00
Eric Andersen
99fcd168cc Wolfgang Denk writes:
He,

there is a bug in HUSH's handling of "if" / "elif" commands:

        $  if true
        > then
        > echo 1
        > elif
        > true
        > then
        > echo 2
        > elif
        > true
        > then
        > echo 3
        > else
        > echo 4
        > fi
        1
        2
        3
        $

The same bug exists in all versions of HUSH from BB v0.60.x up to and
including v1.00-pre9. The attached patch fixes this:

        $ if true
        > then
        > echo 1
        > elif
        > true
        > then
        > echo 2
        > elif
        > true
        > then
        > echo 3
        > else
        > echo 4
        > fi
        1
        $



Best regards,

Wolfgang Denk
2004-04-12 21:41:29 +00:00
Eric Andersen
1e6aba967c Peter Milne writes:
Just upgraded from 0.6 to 1.00-pre8

Dot command handling handled args correctly (same as bash) in 0.60,
but failed in 1.00:

I fixed this by reverting the dotcmd function back to previous 0.60
instantiation,
please consider using the older version.

Thanks


Peter
2004-04-12 19:12:13 +00:00
Eric Andersen
e3efc9230c Jamie Guinan writes:
It looks like latest uClibc defines ARCH_HAS_MMU, but a few busybox files
test UCLIBC_HAS_MMU, resulting in vfork() getting called instead of
fork(), etc.

Patch below.   Only tested for lash.

Cheers,
-Jamie
2004-04-12 17:59:24 +00:00
Eric Andersen
9b3ce77b07 Fix spelling. "sort of" is two words. 2004-04-12 15:03:51 +00:00
Eric Andersen
075dd81c44 Remove the CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN option. It was sortof
stupid and didn't work properly anyways.
2004-04-07 09:34:27 +00:00
Eric Andersen
009617f413 Per suggestion by Pawel Sakowski, fix the dash_arith() prototype
to return a long.  We were needlessly truncating to an int.
2004-04-05 13:24:07 +00:00
Eric Andersen
70060d25d2 s/fileno\(stdin\)/STDIN_FILENO/g
s/fileno\(stdout\)/STDOUT_FILENO/g
2004-03-27 10:02:48 +00:00
Eric Andersen
16767e2377 Patch from vodz to fix the dynamic vars patch, which I should not
have checked in.  Vladimir writes:

Your patch have many problem.
1. You always added + time(). This cannot reset RANDOM=value for debuging
with
replay sequential.
2. Hmm. I examine bash 2.04 source. This pseudorandom generator use low bits
of
counter value. You use high bits. This make bad pseudorandom values after
have
0-value. For example, if + time() do remove, your generator always return 0
after
first generate 0.
3. Memory leak per call. Use ash-unlike unecessary bb_strdup function.
4. Unsupport show last $RANDOM value for "set" and "export" command.
5. Bloat code. Busybox-unlike patch - added unstandart feature as default
hardcode.

Last patch attached.

Erik, why you apply Paul patch with have 5-th point problem? :(

Last patch have ash change xwrite() to fresh libbb/bb_full_write interfase
(haved loop after EINTR).


--w
vodz
2004-03-16 05:14:10 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Eric Andersen
d20d37559f Fix some goofy formatting 2004-03-12 22:08:42 +00:00
Eric Andersen
ef02f82bcf Paul Mundt, lethal at linux-sh dot org writes:
Here's a follow-up replacement to the patch I sent earlier, this adjusts some
of the semantics of the dynamic variable setting. Namely, dynamic vars can hook
a set handler (which RANDOM uses to adjust the seed). They'll only lose their
dynamic status if they're unset.

I've used the same approach that bash does to come up with the random number,
mostly just for consistency.

For example:

$ echo $RANDOM
13759
$ echo $RANDOM
20057
$ echo $RANDOM
1502
$ export RANDOM=42
$ echo $RANDOM
24179
$ echo $RANDOM
2046
$ unset RANDOM
$ echo $RANDOM

$ export RANDOM=42
$ echo $RANDOM
42
$
2004-03-11 13:34:24 +00:00
Glenn L McGrath
c45146cf24 Patch by Felipe Kellermann to fix a compiler compatability problem 2004-03-05 12:55:30 +00:00
Glenn L McGrath
7fc504c6f7 Vodz. last_patch_128
- declare applet_using as static from applets.c
- small correction to cmdedit,
   previous version cleared history after Ctrl-C
- small spelling correction (by Friedrich Lobenstock)
2004-02-22 11:13:28 +00:00
Manuel Novoa III
be8a6ae6eb Fix vstype[] to match VS* defines. Patch from OpenWrt by mbm. 2004-02-18 09:40:41 +00:00
Eric Andersen
95b26250a7 oops. Leave the default feature set enbled for now... 2004-02-10 01:30:21 +00:00