Commit Graph

231 Commits

Author SHA1 Message Date
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
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +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
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
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
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
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
bf66fbc8e2 introduce LONE_CHAR (optimized strcmp with one-char string) 2006-12-21 13:23:14 +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
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
a7189f01a4 add -Wundef, fix uncovered bugs 2006-11-17 20:29:00 +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
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
e175ff252f several fixes from openWRT project 2006-09-26 17:41:00 +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
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
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
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"
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
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
a34b48abe5 Upgrade the standalone shell code to use CONFIG_BUSYBOX_EXEC_PATH. 2006-06-14 01:27:01 +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
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
Rob Landley
299a6b4d7b Consolidate #include <sys/time.h> so libbb.h does it. 2006-05-27 21:42:58 +00:00
Bernhard Reutner-Fischer
0a8812bdc5 - replace _PATH_DEVNULL with bb_dev_null 2006-05-19 13:12:21 +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
"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
Eric Andersen
a68ea1cb93 fix up yet more annoying signed/unsigned and mixed type errors 2006-01-30 22:48:39 +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
"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
"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
"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"
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
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"
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
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
c3850c83d9 applying fix from:
0000152: ash: quoting rules for local variables different to globals
2005-07-20 18:23:39 +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
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
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
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
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
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
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
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
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
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
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
fa06a77040 Patch from vodz, based on bug report from Richard Kojedzinszky:
Richard,

>I have a problem, which I can reproduce now. I am using pre7 version of
>busybox, and the tab completion works fine. I mean, with an empty command
>line I press the TAB twice, and ash shows me the available commands. But
>when i process the profile file below, as
> $ . /etc/profile
>then it stops working, and the double-tab lists the directories available
>from the cwd, and not the commands. Has someone else meet this problem
>before, or am i doing something wrong?
>
>This is  my '/etc/profile':
>- ---
># System profile
>
>PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
>export PATH
>trap ":" INT QUIT TERM
>
>export PS1="\h \w # "

Thanks. Patch attached.


--w
vodz
2004-02-06 10:33:19 +00:00
Glenn L McGrath
16e45d7e29 Vodz last_patch_125_2, this patch have:
- synced with dash 0.4.21
- better handle trap "cmds..." SIGINT (strange, i make bad hack for ash 
  and cmdedit, but this work only with this...)
- may be haven`t problem with Ctrl-D
2004-02-04 08:24:39 +00:00
Glenn L McGrath
bbbe21d6b0 Fix compile error when tab completion disabled 2004-01-25 08:46:10 +00:00
Glenn L McGrath
67285965f3 Vodz last_patch_122, Check $PATH at runtime to fix tab completion 2004-01-14 09:34:51 +00:00
Glenn L McGrath
76620620ec Vodz last_patch_121, syncing with dash_0.4.19, reduce code size. 2004-01-13 10:19:37 +00:00
Glenn L McGrath
4ddddd180e Fix for "Broken pipe" issue, vodz last_patch116_3 2003-11-25 20:45:38 +00:00
Glenn L McGrath
5c2c8eca4a Fix a "broken pipe" problem. vodz, last_patch_116-2 2003-11-14 21:01:26 +00:00
Eric Andersen
a48b0a3af7 last_patch116 from vodz:
Stephane,

>Using busybox+uclibc, crond syslog messages look like:
>
>Oct  9 09:04:46 soekris cron.notice crond[347]: ^Icrond 2.3.2 dillon,
>started, log level 8

Thanks for testing.

>The attached patch corrects the problem.

Your patch is not correct.
Correct patch attached.

Also. Last patch have
- add "Broken pipe" message to ash.c
- busybox ash synced with dash_0.4.18

--w
vodz
2003-10-22 10:56:47 +00:00