Commit Graph

926 Commits

Author SHA1 Message Date
Eric Andersen
3102ac4b58 This is vodz' latest ash update. 2001-07-06 04:26:23 +00:00
Eric Andersen
8df319b213 A bit of testing today showed that ASH_BBAPPS_AS_BUILTINS was
totally breaking the shell.  Simple thinge like 'FOO=100' caused
it to segfault.  It turns out that disabling "bltincmd" is a very
bad idea.
 -Erik
2001-07-05 05:24:12 +00:00
Eric Andersen
2870d964f8 Some updates to ash from vodz. Makes ash smaller. I made a few
changes, esp describing all the current ash configuration options.
Now ash adds 66k in the default configuration.
2001-07-02 17:27:21 +00:00
Eric Andersen
8f6978405d Patch from vodz to fix freeing a static in cmdedit. 2001-07-02 15:36:57 +00:00
Eric Andersen
ff9eee475f This is a busybox port of the Minix shell. It is reasonably capable,
handles all the basic stuff (for, case/esac, while, if/then/else), and
is very small (adds just 38k on x86).  It is not as rigorously correct
about Bourne semantics as bash, but for most things it is quite
workable.  There is still some work to be done to further shrink it (it
has its own globbing functions instead of using the libc ones, for
example), but it is quite usable as is.
 -Erik
2001-06-29 04:57:14 +00:00
Eric Andersen
ec23c4920f Remove vodz from credits, per his request 2001-06-28 16:43:57 +00:00
Eric Andersen
df82f611c8 Scrub up the licensing block
-Erik
2001-06-28 07:46:40 +00:00
Eric Andersen
cb57d551a2 This a an ash applet I put together. It is similar to the one put
together by vodz, but uses newer sources, has the removed features
commented out instead of simply deleted (so they could be re-enabled)
and the builtins all work.  This adds 72k.
 -Erik
2001-06-28 07:25:16 +00:00
Eric Andersen
184d73636d Remove unneeded stuff. 2001-06-28 03:22:19 +00:00
Eric Andersen
028b65b060 More thrashing about trying to make hush behave itself wrt job
control...
2001-06-28 01:10:11 +00:00
Eric Andersen
07abfe2092 don't whine if all we need to do is remove a bg job 2001-06-27 17:29:11 +00:00
Eric Andersen
4b6b5e4314 Re-enable globbing (I'd accidentaly removed it) and finish off the last
of the job control polishing.  Works fine now.
 -Erik
2001-06-27 04:30:11 +00:00
Eric Andersen
5c66d06104 Explicitly call setsid() 2001-06-26 23:16:31 +00:00
Eric Andersen
a90f20b1c3 Don't choke if /etc/profile is not available 2001-06-26 23:00:21 +00:00
Glenn L McGrath
78b0e379d7 Vladimir's last_patch_15 2001-06-26 02:06:08 +00:00
Eric Andersen
6c947d289f Fix the code for establishing a controlling terminal.
-Erik
2001-06-25 22:24:38 +00:00
Eric Andersen
2d848a476a This should finish off the job control issues with lash. Make certain
we have a controlling terminal...
 -Erik
2001-06-25 17:11:54 +00:00
Eric Andersen
52a97ca00c Some more cleanups. Of special importance, never free a pipe
that still has running jobs.  Instead, we ignore it and expect
it to be cleaned by the background job stuff.
 -Erik
2001-06-22 06:49:26 +00:00
Eric Andersen
c798b07762 Some cleanups for hush. Saves about 350bytes.
-Erik
2001-06-22 06:23:03 +00:00
Eric Andersen
8a646dd293 This commit guts lash, restoring it to what it was originally intended to do,
just be a simple command line interpreter with basic pipe, redirect, and job
control.  For all the more fancy things, people should use hush or ash.
 -Erik
2001-06-21 16:38:11 +00:00
Eric Andersen
04407e522b Another hush update from Larry:
Fixes the interaction between if/then/else/fi syntax and variables.
    I planned to do it right from the beginning, but my implementation
    was buggy.  Also adds the relevant test cases.  Also adds some old
    Matt Kraai variable test cases that got left out somehow.
2001-06-07 16:42:05 +00:00
Eric Andersen
817e73cb63 A patch from Larry to fix pathological things like '>""' 2001-06-06 17:56:09 +00:00
Matt Kraai
c616e53ca2 Don't close file descriptors when we are duplicating them. 2001-06-05 16:50:08 +00:00
Eric Andersen
4f6753e586 Cope gracefully when people type something, then hit ^C.
-Erik
2001-05-31 17:17:12 +00:00
Eric Andersen
4f990533e3 Patch from Vladimir to fix up autocompletion on a files/dirs with spaces in
them in the presence of a quoting.  Also revert my signal handling patch,
which seems to not solve the problem I thought it solved.
2001-05-31 17:15:57 +00:00
Eric Andersen
a813afc24f Plug another memory leak 2001-05-24 16:19:36 +00:00
Eric Andersen
a15dc15f12 Plug another memory leak in hush. This one showed up when backticked
commands were run.  This one was sure a bugger to find.
 -Erik
2001-05-23 23:46:09 +00:00
Eric Andersen
bf7df04ec1 Fix a massive memory leak in the run_list_test() function.
Rename run_list_test() as free_pipe_list().
Rename run_pipe_test() as free_pipe().
 -Erik
2001-05-23 22:18:35 +00:00
Eric Andersen
77d9268892 Patch from larry to fix some grammar errors. 2001-05-23 20:32:09 +00:00
Matt Kraai
bdd4eced84 Commit a patch by Larry Doolittle which fixes recursive calls to file_peek,
and improves some debugging messages.
2001-05-23 17:43:00 +00:00
Eric Andersen
57e6a49e5b Excellent. This patch from Larry fixes the behavior of hush
when builtins are included in pipes.
2001-05-22 22:34:51 +00:00
Eric Andersen
9978576f15 Fix this case. No, really this time.
unset FOO
    export FOO=bar
    FOO=baz
    echo "global env: " `env | grep ^FOO`
    echo "local env:  " `set | grep ^FOO`
 -Erik
2001-05-22 21:37:48 +00:00
Eric Andersen
aeb44c4da6 Fix a race. Sometimes by the time we got to checkjobs(), the
pipe struct had already been freed.  Return immediately if the
pipe is NULL.
2001-05-22 20:29:00 +00:00
Eric Andersen
816867858b Oops. Remove some debug noise I left in. 2001-05-22 19:23:35 +00:00
Eric Andersen
94ac244dea Updates from both Vladimir and Larry 2001-05-22 19:05:18 +00:00
Eric Andersen
004015e9c4 Patch from Lars Kellogg-Stedman <lars@larsshack.org> to fix bug
#1130 (i.e. When you turn on features it should always ADD features)
2001-05-21 20:30:51 +00:00
Eric Andersen
ada18ff0f5 The latest patch from Larry 2001-05-21 16:18:22 +00:00
Eric Andersen
9ffb7dd9a4 This is a patch from Vladimir:
> I rewrite *local_variable* function in hush.c with:
    > 1) remove many memory leaks
    > 2) add support read_only protect (require write builtin function for set this,
    > I write this special for variable HUSH_VERION=0.01)
    > 3) commad read set only local variable now
    > 4) remove many error messages if "set unset export" not defined variable
    > (bash syntax not put and set error code). Hmm, if I set result to -1, you hush
    > called waitpid and returned with error "no waitpid" ( i not found place this
    > error).
    > 5) destroy error in new version check xgetcwd()==NULL and set "(unknow)" -
    > this have error: crashe in next call `pwd`, but xgetcwd(not null) called
    > free(arg).
    > 6) next add integraion with libbb

Valdimir's patch missed two cases of local variable handling
    FOO=bar
    export FOO=baz
    unset FOO
and
    export FOO=bar
    FOO=baz
which were working before, so I fixed those two cases.
2001-05-19 03:00:46 +00:00
Eric Andersen
bfae2529b8 It turns out job control in both hush and lash was broken by the
signal handling in cmdedit.c.  Disabling it makes the shells behave
themselves again.  hush isn't quite there, but is getting close...
 -Erik
2001-05-17 00:14:27 +00:00
Matt Kraai
59df6f7398 Change 'printf("%s\n", ...)' into 'puts(...)'. Noted and patched in hostname.c
by Larry Doolittle.
2001-05-16 14:21:09 +00:00
Eric Andersen
bc604a2f41 Move init of a bunch of globals into main so we are at least
a bit more reentrant.
 -Erik
2001-05-16 05:24:03 +00:00
Eric Andersen
f72f562b2f Fix the behavior of local shell variables to match that of bash and ash.
-Erik
2001-05-15 23:21:41 +00:00
Eric Andersen
15649c11f3 Oops. I left in some debug noise. 2001-05-15 17:28:26 +00:00
Eric Andersen
20a69a77d2 Write set_local_var() and fixup lookup_param() so you can now use
shell local variables.
 -Erik
2001-05-15 17:24:44 +00:00
Eric Andersen
78a7c99f7f This patch covers one big part of variable handling.
$ a=b foo
should be handled correctly.
$ a=b
is parsed OK, but the actual variable setting is not
yet written.  Except for some weird exceptions related
to quoting rules, this code passes (matches ash behavior)
all the tests I threw at it.

If someone now writes set_local_var(), and updates lookup_param()
to match, we can claim success!

       - Larry
2001-05-15 16:30:25 +00:00
Eric Andersen
cfa88ecb72 Fix up some silly warnings 2001-05-11 18:08:16 +00:00
Eric Andersen
5f265b755a Fix a segfault in lash, hush, and cmdedit. Each of these used
xgetcwd, but did not check the return for a NULL, and then continued
to call strlen on the NULL when the cwd had been removed from under it.
 -Erik
2001-05-11 16:58:46 +00:00
Eric Andersen
9d94deabd3 Use xgetcwd 2001-05-11 16:36:03 +00:00
Eric Andersen
1a6d39b259 A few more structural updates for job control.
-Erik
2001-05-08 05:11:54 +00:00
Eric Andersen
0a36de0580 Fix a stupid segfault caused by dereferencing a NULL ptr.
-Erik
2001-05-08 04:25:46 +00:00
Eric Andersen
45e92ba2ce This patch from Evin Robertson <nitfol@my-deja.com> fixes export so it works.
This way leaks memory, but oh well.  We will probably fix that when we get
around to doing local variables.
2001-05-07 23:53:09 +00:00
Eric Andersen
83a2ae2184 More hush updates from Larry:
Update some comments.  Generate partial placeholders for the missing
    builtins.  Write builtin_umask.  Properly treat exec without arguments
    as a means to open/close files within the running script.  Implement
    "4<&-" that encodes for file descriptor closure.
2001-05-07 17:59:25 +00:00
Eric Andersen
2dcfba7117 Larry's variant on Evin Robertson's fix to what I messed up
trying to make job control work.  This fix makes it so that
hush doesn't error out when init hasn't set up job control,
as in when init=/bin/sh
2001-05-04 22:13:37 +00:00
Matt Kraai
d24f878546 Don't reset parents context when we encounter an terminator. Fixes
if true; then if true; then true; fi; fi
2001-05-04 21:20:20 +00:00
Eric Andersen
e5ffb911e8 If it fails to run a builtin, let it fall through to
exec the real thing.
 -Erik
2001-05-04 16:30:29 +00:00
Matt Kraai
80abc45182 Move up waitpid error check so that errno isn't clobbered by tcsetpgrp. 2001-05-02 21:48:17 +00:00
Eric Andersen
0fcd447d59 Some more job control updates. It will now sucessfully background
stuff.  Good luck getting things back into the foreground though...
 -Erik
2001-05-02 20:12:03 +00:00
Matt Kraai
20a3069ec0 Don't treat newline as pipe separator when processing substitutions. 2001-05-02 17:52:49 +00:00
Matt Kraai
9f8caf134f Fix $(...) construction. Noted and patched by Larry Doolittle
<ldoolitt@recycle.lbl.gov>.  I'm just a patch whore.  :)
2001-05-02 16:26:12 +00:00
Eric Andersen
bafd94f154 First pass at getting job control working. This gets the infrastructure
in place, but something is still missing/wrong in there.  Testing with
'grep foo &' seems to put _hush_ into the background.  Pondering...
 -Erik
2001-05-02 16:11:59 +00:00
Matt Kraai
1c8a59ab95 Use the current pgrp, not pid, when resetting the foreground process group.
Fixes bizarre suspension when executing `echo`.
2001-05-02 15:37:09 +00:00
Matt Kraai
f162e7d09d Don't segfault if the first word is the empty string. 2001-05-02 14:48:48 +00:00
Eric Andersen
e67c3ce327 Another update from Larry:
Makes hush return code equal to that of the last command executed.
    Fixes the mode where input comes from a file.
2001-05-02 02:09:36 +00:00
Eric Andersen
4ed5e37d4b Another hush update from Larry:
Minor improvements.  Something is still broken with running
    scripts via "hush filename".  All the following are now handled
    acceptably (matches ash, not bash).

    if true; then echo foo1; fi
    if
     true; then echo foo2; fi
    if true; false; then echo bar; else echo foo3; fi
    if true || false; then echo foo4; fi

	  - Larry
2001-05-01 01:49:50 +00:00
Eric Andersen
aac75e5a78 Some more hush.c updates from Larry Doolittle. 2001-04-30 18:18:45 +00:00
Eric Andersen
088875fec4 Use BUFSIZ for the_command to match size used in cmdedit 2001-04-27 07:49:41 +00:00
Eric Andersen
af44a0e8f4 An update to hush from Larry:
It should recover more smoothly from syntax errors, and it now
    has a decent guess when the reserved word construct is over
    (or not) to control execution and prompting.  I took out all the
    redundant standalone test copies of libbb routines, but left in a
    hook so I can include those for my testing.  I'll post that include
    file on my web site.

	    - Larry
2001-04-27 07:26:12 +00:00
Eric Andersen
25f2703015 This is the initial checkin of Larry Doolittle's hush.c, using his
April 25, 2001 snapshot, adjusted a bit by me so it has cmdedit support.

This checkin also removes sh.c.  In the future sh.c will be a symlink to
your shell of choice.  For now, this symlink will default to pointing to
lash.c (as in the past).  If you change the symlink to point to hush.c,
then thats what you will get.  This symlink business is a temporary situation,
which will be cleaned up Real Soon Now(tm).

 -Erik
2001-04-26 23:22:31 +00:00
Mark Whitley
4b541a8817 Moved some #ifdefs down below #include "busybox.h" where they belong. 2001-04-25 17:10:30 +00:00
Eric Andersen
ed424dbf1d Some patches from Gennady Feldman. Fixed a glob problem such that
'ls *.h Config.h' works.  Fixed a silly typo with fg/bg process control.
Made cmdedit exit sanely when it cannot read input.
2001-04-23 15:28:28 +00:00
Matt Kraai
4ef40c02f4 Another banner consolidation from Larry Doolittle <ldoolitt@recycle.lbl.gov>. 2001-04-12 20:44:21 +00:00
Matt Kraai
be66ad3212 Fix handling of '' and "". 2001-04-12 15:42:17 +00:00
Eric Andersen
e5dfced23a Apply Vladimir's latest cleanup patch.
-Erik
2001-04-09 22:48:12 +00:00
Eric Andersen
c270ec1fa2 Add support of /W prompts
-Erik
2001-04-05 23:00:47 +00:00
Matt Kraai
2129f97cd9 Avoid segfault when export is invoked with no arguments. Thanks to
Gennady Feldman.
2001-04-04 17:50:04 +00:00
Eric Andersen
84e229cfbe Add in a new standalone env applet for fixing up app's environments
-Erik
2001-03-29 22:48:33 +00:00
Mark Whitley
a82a00397f Fix to last patch: locale code should be 9, not 7. 2001-03-27 17:07:15 +00:00
Mark Whitley
1c6581a865 Applied patch from Vladimir N. Oleynik to add locale support to the shell per
bug report from Ralph Jones.
2001-03-27 16:35:16 +00:00
Eric Andersen
82ab8da245 -Wshadow sh fix from Jeff Garzik 2001-03-23 17:06:01 +00:00
Eric Andersen
1ca20a7747 A nice patch from Larry Doolittle that adds -Wshadow and
cleans up most of the now-revealed problems.
2001-03-21 07:34:27 +00:00
Eric Andersen
92d23245c9 Another cleanup patch from Jeff Garzik <jgarzik@mandrakesoft.com> 2001-03-19 23:49:41 +00:00
Eric Andersen
61173a5371 Fix to cmdedit.c from Vladimir 2001-03-19 17:48:55 +00:00
Eric Andersen
341744781a Patch from Larry and Vladimir to clean up sh.c and fix
shell expansion to work in non POSIX locales.
2001-03-17 00:20:10 +00:00
Eric Andersen
4aaefc2a50 Fix from Larry for glob problems.
-Erik
2001-03-15 23:01:19 +00:00
Eric Andersen
f9ff8a7d90 cmdedit.c bugfix patch from Vladimir.
-Erik
2001-03-15 20:51:09 +00:00
Mark Whitley
730cdb1904 Reversed previous patch. The right way is to fix uClibc. 2001-03-15 19:39:40 +00:00
Mark Whitley
0b57e28373 Applied patch from Andreas Neuhaus to fix namespace conflict that made busybox
not compile with uClibc.
2001-03-15 19:12:06 +00:00
Eric Andersen
1ef92685cf Yesterday I make strsep_space include post-token whitespace,
so we should not be adding another " " between tokens.
 -Erik
2001-03-14 19:33:45 +00:00
Eric Andersen
ce4a586edb I forgot to malloc space for the NULL.
-Erik
2001-03-14 18:57:54 +00:00
Mark Whitley
44a9914709 Applied patch from Larry Doolittle to fix '>\na\n' bug. Should close bug #1132 2001-03-14 17:26:37 +00:00
Eric Andersen
4e7244e6b2 libc5 glob is pretty stupid and doesn't do GLOB_BRACE or GLOB_TILDE
-Erik
2001-03-14 00:49:52 +00:00
Mark Whitley
f594986b37 - Changed name of BB_FEATURE_SIMPLE_PROMPT to BB_FEATURE_SH_SIMPLE_PROMPT
- Set BB_FEATURE_SH_STANDALONE_SHELL and BB_FEATURE_SH_APPLETS_ALWAYS_WIN to
   be off by default
 - Set BB_FEATURE_SH_SIMPLE_PROMPT to be on by default
 - Added some more magic to the Olympus section to make all the dependencies
   on the shell, cmdline editing, tab completion and friend work properly.
 - Tidied up the Olympus section with some whitespace. Checked the various
   scrips that parse through there and the extra whitespace shouldn't break
   anything.
2001-03-14 00:29:14 +00:00
Eric Andersen
b3d6e2df95 Update the lash shell (hopefully the last time...) so things like
echo "foo   bar" and echo -n "foo\t\\\\\tbar" work as expected.
Merge prompt printing work from Vladimir.
 -Erik
2001-03-13 22:57:56 +00:00
Eric Andersen
4987bbf979 A fix from Larry Doolittle for some nasty segfaults when sh.c tried to free a
corrupted cmd pointer, and where it would truncate a command line at the first
double space.
 -Erik
2001-03-12 21:36:49 +00:00
Eric Andersen
1365bb7861 When using wordexp, only try to use the expand command
when something actually got expanded.  Skip it otherwise.
 -Erik
2001-03-10 07:12:12 +00:00
Eric Andersen
74e056bfc8 Fixed a couple more cases. $FOO/bar ${FOO} and such now work
without wordexp.  Of course for stuff like ${1:-foo} you still
need wordexp for them to work.
 -Erik
2001-03-09 20:34:46 +00:00
Eric Andersen
3c7361f53a Allow wordexp to be used if available 2001-03-09 19:45:26 +00:00
Eric Andersen
ce89871ff7 Urg. Remove the debug noise 2001-03-09 19:43:57 +00:00
Eric Andersen
195743f195 Ok, sh.c should be working now. Many thanks to Larry Doolittle
for his timely help -- nearly all of the work in this patch is
his.
 -Erik
2001-03-09 19:21:37 +00:00
Eric Andersen
01658a3eec Fix sh.c for the glab case. I was messing things up for
single argument commands.  It should now work as expected...
 -Erik
2001-03-09 01:24:02 +00:00
Eric Andersen
3dbf1e877a A '.' is a legal seperator. 2001-03-09 01:08:06 +00:00
Eric Andersen
b180dd9e50 Cleanup patch from Larry 2001-03-09 00:42:46 +00:00
Eric Andersen
13d1fa1d01 Add in 'trim' routine. Fix up sh.c so it works when wordexp
is not available.
 -Erik
2001-03-08 23:59:45 +00:00
Mark Whitley
7e5291f111 Whitespace / formatting / bracket cleanup. 2001-03-08 19:31:12 +00:00
Eric Andersen
32f8c170b0 Remember to delete un-expandable variables, and do a better job of expanding
shell-specific things in case the wordexp implementation is broken (ie. the
stubbed out wordexp in uClibc).
 -Erik
2001-03-08 17:44:37 +00:00
Eric Andersen
ca6045955d Rework environment variable handling to use wordexp, per a suggestion from
Larry Doolittle a couple of months ago.  This makes the stuff-expansion in lash
be ever so standards compliant.   This change needs testing by everyone, but
appears to be solid enough to let us close bug #1090.

It works for me; however, please test this change!
 -Erik
2001-03-08 17:17:13 +00:00
Eric Andersen
11ae573320 remove an unused variable 2001-03-07 03:51:27 +00:00
Eric Andersen
702ec5926f Fix the memory leak. No really this time.
-Erik
2001-03-06 22:17:29 +00:00
Eric Andersen
36278b9576 Fix func prototype 2001-03-06 20:47:31 +00:00
Eric Andersen
54851d3c65 Fixed a memory leak in lash. It seems that close_all was calling close()
directly instead of calling mark_closed(), which allowed the memory allocated
by mark_open() to never be freed.
 -Erik
2001-03-06 20:44:39 +00:00
Eric Andersen
07f2f3917a Close open files before calling builtin_exec(). I've tested this
and it fixes bug #1121.
 -Erik
2001-03-06 20:28:22 +00:00
Eric Andersen
5165fbed63 Oops. Since dirent.h depends on BB_FEATURE_SH_TAB_COMPLETION, put it
after busybox.h is included.
2001-02-20 06:42:29 +00:00
Eric Andersen
caeeb36784 This fixes lash so it handles environment variable expansion, regardless
of where the environment variables are located in an argument.  This allows
things like 'echo foo$1$SHELL' to expand the same way bash would expand it.
Of course, to make this work I introduced a memory leak, and I am too tired
to find a way to fix it.
 -Erik
2001-02-20 06:38:44 +00:00
Eric Andersen
cbe31dace5 It turns out that DODMALLOC was broken when I reorganized busybox.h
header file usage before the 0.49 release.  To fix it, I had to move
the '#include "busybox.h"' to the end of the list of #include files.
 -Erik
2001-02-20 06:14:08 +00:00
Eric Andersen
94456f5984 Put back Vladimir's testing defines, which I mistakenly removed. 2001-02-18 20:26:48 +00:00
Eric Andersen
28a78ab62c Several features were hard coded on. Stop that. List tab completion
as working (thanks Vladimir!) and taking 4k.
 -Erik
2001-02-16 20:26:50 +00:00
Eric Andersen
6faae7deb4 Commit Vladimir's latest cmdedit. I modified it slightly to ensure
parse_prompt() would be called before cmdedit_init(), since cmdedit_init()
calls cmdedit_setwidth() which uses cmdedit_prmt_len, which is set by
parse_prompt().  Also, added a mod, so very narrow terminals should now wrap
properly...  This is working very nicely for me -- Vladimir has done some
very good work.
2001-02-16 20:09:17 +00:00
Eric Andersen
5f2c79d8c7 Make ar be crossed. 2001-02-16 18:36:04 +00:00
Eric Andersen
67991cf824 This patch, put together by Manuel Novoa III, is a merge of work
done by Evin Robertson (bug#1105) and work from Manuel to make
usage messages occupy less space and simplify how usage messages
are displayed.
2001-02-14 21:23:06 +00:00
Eric Andersen
af4ac77d9d Apply a patch from Larry Doolittle to add "-all" and "-none" switches
to multibuild.pl.  I did a little formatting adjustments to make it
_very_ obvious when things stop working.  I also removed the USE_PROCFS
config option -- just do the right thing when USE_DEVPS_PATCH is enabled.
 -Erik
2001-02-01 22:43:49 +00:00
Matt Kraai
f2cc2762bb Create find_applet_by_name function. Save 32 bytes. 2001-02-01 19:21:20 +00:00
Matt Kraai
dd19c69904 Removed trailing \n from error_msg{,_and_die} messages. 2001-01-31 19:00:21 +00:00
Eric Andersen
306f4fe480 If the ioctl fails to tell us the winsize, default to 79.
-Erik
2001-01-31 00:30:45 +00:00
Eric Andersen
22332fd26f Patch from Bryan Rittmeyer -- be more conservative by default
with the lash prompt.
 -Erik
2001-01-30 23:40:39 +00:00
Eric Andersen
4bbdd788e0 Fix the pwd and group functions. The bb_ stuff was a leftover from
a brief past that mercifully (except for this) never made it into CVS.
 -Erik
2001-01-30 22:23:17 +00:00
Eric Andersen
8ec10a9483 Fix up copyright msgs. Bump version to 0.49 in preparation for
a release.  Update the website with release details.
 -Erik
2001-01-27 09:33:39 +00:00
Eric Andersen
ab050f5522 Add in a patch to make busybox use the normal pwd.h and grp.h
functions.  Add in simple implementations of these functions,
which can, optionally, be used instead of the system versions.
 -Erik
2001-01-27 06:01:43 +00:00
Mark Whitley
4e33875759 Applied patch from Vladimir N. Oleynik <dzo@simtreas.ru> to do tab-completion
in Busybox shell.  (Thanks, Vlad.)
2001-01-26 20:42:23 +00:00
Mark Whitley
6e25f92636 Fixed a li'l thinko. 2001-01-26 19:19:23 +00:00
Mark Whitley
59ab025363 #define -> static const int. Also got rid of some big static buffers. 2001-01-23 22:30:04 +00:00
Eric Andersen
2b8d07c590 Bug fix. 2001-01-23 00:27:51 +00:00
Eric Andersen
6f65a3a7e8 More printf cleanups 2001-01-20 01:10:07 +00:00
Matt Kraai
12f417edbd Eliminate calls of the form "fprintf(stdout,". Thanks for the idea to
Vladimir N. Oleynik.
2001-01-18 02:57:08 +00:00
Eric Andersen
744b064a34 Needs to be NULL at init in all cases. 2001-01-05 21:23:44 +00:00
Eric Andersen
8ea28be6d2 Patch from larry doolittle to be ever so careful to cleanup
all open file descriptors, lest wierdness happen later.
2001-01-05 20:58:22 +00:00
Eric Andersen
0bcc813a34 Better label the globals. 2001-01-05 19:37:32 +00:00
Eric Andersen
b0970d4fed Patch from Larry Doolittle to set values to static variables that live in the
bss at runtime, since sh.c can call sh.c, which causes these variables to not
be set to their defaults as god intended.
 -Erik
2001-01-05 19:34:52 +00:00
Matt Kraai
defcd5e75e Fix a segfault by only constructing the prompt when we need to. If we don't
do this we will segfault processing /etc/.profile since cwd isn't yet set.
2001-01-05 02:53:11 +00:00
Eric Andersen
09acc06c10 Move window size handling to cmdedit.c. Move prompt setup to setup_prompt_string() 2001-01-04 11:10:38 +00:00
Eric Andersen
849083c886 Update interface per what now exists... 2001-01-04 11:09:00 +00:00
Eric Andersen
b3dc3b8990 Cleanup -- move win handling to cmdedit.c, static-ify many functions. 2001-01-04 11:08:45 +00:00
Eric Andersen
2d5b64273f Cleanup from Gennady Feldman <gfeldman@mail.com> 2000-12-22 18:02:02 +00:00
Matt Kraai
a9819b2908 Use busybox error handling functions wherever possible. 2000-12-22 01:48:07 +00:00
Eric Andersen
e9f07fb6e8 Another sh.c patch from Larry Doolittle. This makes redirects work properly
with non-forking shell builtins.  Especially helpful for "read".  This patch
also beautifies builtin_fg_bg, clarifies the problems with
run_command_predicate, makes if/then/else support the default, and corrects the
sense of the BB_FEATURE_SH_ENVIRONMENT comment.
2000-12-21 18:31:36 +00:00
Eric Andersen
70da6a66d2 Fix a warning in sh.c. Remove use of getline() in md5sum since
nobody else uses it and it is a GNU extension anyways...
2000-12-20 22:59:16 +00:00
Eric Andersen
86349776d0 Ok, this is a pretty major update to sh.c. I renamed all the variables and
function names to conform with the style guide.  I also did a lot of work on
the if-then-alse-fi logic and added prototype (i.e. it segfaults when enabled)
line continuation support.

Furthermore, this patch includes Larry Doolittle's work on restructuring some
of the data structures that represent the job and child_program, allowing
several simplifications and fixing several bugs.

 -Erik
2000-12-18 20:25:50 +00:00
Eric Andersen
f361ac29b0 Mem leak fix from Matt Kraai 2000-12-12 23:45:36 +00:00
Eric Andersen
b2356f6de9 Patch from Matt Kraai to fox sh.c escape problem such that
running things like 'echo "\n\tHi\n\t\!"' and 'echo -e "\n\tHi\n\t\!"'
behave as under bash.
2000-12-11 19:14:40 +00:00
Eric Andersen
f21aa84389 Put in i to getopt, so i will work... 2000-12-08 20:50:30 +00:00
Mark Whitley
f57c944e09 Changed names of functions in utility.c and all affected files, to make
compliant with the style guide. Everybody rebuild your tags file!
2000-12-07 19:56:48 +00:00
Eric Andersen
1e7cea952b Bettwr document the hidden internal sh.c #defines, and which folks
might want to use...
2000-12-06 23:47:38 +00:00
Eric Andersen
1d3523b7aa patch from Larry Doolittle to rename BB_FEATURE_SH_BUILTINS_ALWAYS_WIN
to the more pedantically correct BB_FEATURE_SH_APPLETS_ALWAYS_WIN.
2000-12-06 19:07:39 +00:00
Eric Andersen
87559829ff Remove #ifdef __STDC__ junk. We don't do K&R round these parts,
so no point acting like we do.
2000-12-01 19:02:24 +00:00
Matt Kraai
3e856ce428 Stop using TRUE and FALSE for exit status. 2000-12-01 02:55:13 +00:00
Eric Andersen
b558e76eb1 Apply some patches from Gennady Feldman <gfeldman@mail.com> to
. /etc/profile, and to emulate bash prompt.  I've cleaned up
his patches a bit and all looks good now...
2000-11-30 22:43:16 +00:00
Eric Andersen
8c725e624a Patch from Larry Doolittle (with minor touchups from me so everything compiles
and works) to use the applet definitions in applets.h to autogenerate the applet
function and usage prototypes.
2000-11-30 00:27:06 +00:00
Eric Andersen
8c2d3f46ab Fix escape char problem. 2000-11-30 00:03:57 +00:00
Eric Andersen
a683ee81d9 "I will always compile before I commit."
"I will always compile before I commit."
"I will always compile before I commit."
 -Erik
2000-11-17 18:51:45 +00:00
Eric Andersen
e5aef92e22 Fix up builtin overrides, and hack in the binary search for finding
matching applets into the shell.
2000-11-17 18:25:26 +00:00
Eric Andersen
50b3113dc2 Add in a new FEATURE (off by default) BB_FEATURE_SH_BUILTINS_ALWAYS_WIN.
Make the sh default to using external commands when a path is provided.
2000-11-17 18:07:30 +00:00
Eric Andersen
46f0beb167 Patch from Gennady Feldman <gfeldman@tradeline.net> to:
1. Opens redirections w/ the right access.
    2. Doesn't do globbing for every single parameter (so it
	doesn't stat every parameter).
2000-11-14 21:59:22 +00:00
Eric Andersen
63a862272c Cleanup of duplicated symbols -- found by compiling with
LDFLAGS += -Wl,-warn-common
2000-11-07 06:52:13 +00:00
Eric Andersen
a75466e981 Warning cleanup from Gennady Feldman
-Erik
2000-11-02 17:02:26 +00:00
Matt Kraai
bbaef66b3f Consolidate handling of some fopen failures. 2000-09-27 02:43:35 +00:00
Eric Andersen
3570a34de4 Renamed "internal.h" to the more sensible "busybox.h".
-Erik
2000-09-25 21:45:58 +00:00
Eric Andersen
d2f5677762 Add in exec support (patch from Torbj?rn Axelsson <torax@cendio.se>)
and disable backticks (since they are still wierdly broken in some
cases.
2000-09-21 02:48:07 +00:00
Eric Andersen
06f64b2370 I think these featires are fairly safe...
-Erik
2000-09-19 07:16:39 +00:00
Matt Kraai
0b2da467a8 Avoid segfaults by not using snprintf to copy strings. 2000-09-19 06:46:44 +00:00
Pavel Roskin
5f84fd7066 "exit NUMBER" should exit, not return 2000-09-15 00:46:51 +00:00
Matt Kraai
131241f71c Backslashes shouldn't be treated as backticks. 2000-09-14 00:43:20 +00:00
Matt Kraai
cbbe4d6bc2 Copy the string terminator. 2000-09-14 00:26:50 +00:00
Matt Kraai
dd450a0ded Don't fork for the . (source) command so that environment settings are
preserved.
2000-09-13 03:43:36 +00:00
Matt Kraai
322ae93a5e Fix calls to {m,c,re}alloc so that they use x{m,c,re}alloc instead of
segfaulting or handling errors the same way themselves.
2000-09-13 02:46:14 +00:00
Matt Kraai
b89075298e Fix unchecked calls to {m,c,re}alloc so that they print an error and
exit rather than segfaulting (what an improvement).
2000-09-13 02:08:21 +00:00
Matt Kraai
6085c72b6e Reset optind so that getopt works in busybox applets called directly by sh.
Change the behavior of -c to correctly handle $1..$9.
2000-09-06 01:46:18 +00:00
Eric Andersen
851ce895bd Turn off some debug noise.
-Erik
2000-08-21 22:34:23 +00:00
Eric Andersen
6a4c33c5c0 Clean up the nasty blunder I'd made of how different behaviors happen.
-Erik
2000-07-28 17:08:36 +00:00
Eric Andersen
1428c4f136 Oops. Forgot an ifdef
-Erik
2000-07-28 15:19:30 +00:00
Eric Andersen
501c88b245 More sh updates (with related changes to everything else). Switched
to using getopt and cleaned up the resulting mess.  if-then-else-fi
is now basically working (given a bunch of constraints).
 -Erik
2000-07-28 15:14:45 +00:00
Eric Andersen
6a99aaf020 More shell features.... if-then-else-fi is now basically usable (disable
by default pending further debugging).  Added in some basic shell environment
support (i.e. $?, $0-$9, $$, $!, $#).
 -Erik
2000-07-27 00:15:20 +00:00
Eric Andersen
e92108ae6d Minor style cleanups. 2000-07-26 00:53:56 +00:00
Eric Andersen
fad9c1198a Finish off fixing up the memleaks (I think). Added the beginnings of
some if-then-else-fi support (nonfunctional and turned off)
 -Erik
2000-07-25 18:06:52 +00:00
Eric Andersen
b040d4f3da Use BB_FEATURE_CLEAN_UP where appropriate
-Erik
2000-07-25 18:01:20 +00:00
Eric Andersen
91a4400fd5 Avoid trying to free NULL ptrs. Comment on malloc usages.
-Erik
2000-07-19 17:37:57 +00:00
Eric Andersen
6efc48c1ae Sigh -- can't sleep. Clean up some mem leaks, fixed some bugs.
-Erik
2000-07-18 08:16:39 +00:00
Pavel Roskin
9c5fcc3408 New message added to messages.c: full_version
Used where possible
2000-07-17 23:45:12 +00:00
Eric Andersen
a1d187a8a8 Backtick support to infinite (memory limited) levels of nesting is
now implemented...  So now busybox shell can do cool stuff like:

    /home/andersen/CVS/busybox # echo foo `wc README` bar
    foo 71 422 2951 README bar

I love writing cool new features....  Muhahahaha...  (I think this is
leaking a little bit of memory every time it expands a backtick process,
so I still needs to do a bit of cleanup...)
 -Erik
2000-07-17 19:14:41 +00:00
Matt Kraai
bf181b9338 Extract usage information into a separate file. 2000-07-16 20:57:15 +00:00
Eric Andersen
fad04fdd12 More cleanups.
-Erik
2000-07-14 06:49:52 +00:00
Matt Kraai
d537a95fdb Use errorMsg rather than fprintf. 2000-07-14 01:51:25 +00:00
Eric Andersen
4ac6cb534d Fix some stupid memory bugs.
-Erik
2000-07-14 01:13:37 +00:00
Eric Andersen
ec10b9d534 Add in redimentary backtick suport (doesn't work properly yet, but is
close).
 -Erik
2000-07-14 01:13:11 +00:00
Mark Whitley
55380700d8 Added a smallish TODO comment. 2000-07-13 17:20:23 +00:00
Mark Whitley
37653aaf9c Added some smallish comments to help folks understand why we have two tables
of builtins and the reasoning behind it.
2000-07-12 23:36:17 +00:00
Matt Kraai
be84cd4ef6 Always report the applet name when doing error reporting. 2000-07-12 17:02:35 +00:00
Eric Andersen
34e1941c32 Function name cleanup.
-Erik
2000-07-10 18:47:24 +00:00
Eric Andersen
03f9c81cec Naming fix
-Erik
2000-07-07 20:37:12 +00:00
Eric Andersen
b2731b11ef Had an extra tcsetpgrp.
-Erik
2000-07-06 16:56:56 +00:00
Eric Andersen
72965e3454 Fixed a potential infinite loop. First delete any chars after the
cursor, then delete everything before it.  Before this, we would just
delete everything before the cursor and freak out if there were still
chars left (i.e. stuff after the cursor).
 -Erik
2000-07-04 06:22:18 +00:00
Eric Andersen
b54833cde0 sh fixes from Marius Groeger <mag@sysgo.de>
-Erik
2000-07-03 23:56:26 +00:00
Eric Andersen
1c314ad655 * Fixed a _horrible_ bug where 'tar -tvf' could unlink
local files!!!  Fix thanks to Marius Groeger <mgroeger@sysgo.de>
* Added support for "sh -c command args...", also thanks to
    Marius Groeger <mgroeger@sysgo.de>

 -Erik
2000-06-28 16:56:25 +00:00
Eric Andersen
b610615be9 Updates to a number of apps to remove warnings/compile errors under libc5.
Tested under both libc5 and libc6 and all seems well with these fixes.
 -Erik
2000-06-19 17:25:40 +00:00
Eric Andersen
74c66ad06e Fix some spelling errors in the source as well.
-Erik
2000-06-16 19:57:44 +00:00
Erik Andersen
8ea7d8cdaf First pass at fixing tar segfault, and more portability updates.
-Erik
2000-05-20 00:40:08 +00:00
Erik Andersen
330fd2b576 More libc portability updates, add in the website (which has not been
archived previously).  Wrote 'which' during the meeting today.
 -Erik
2000-05-19 05:35:19 +00:00
Erik Andersen
c3f5c9c2ee Minor fixes to being a standalone shell.
-Erik
2000-05-13 19:00:07 +00:00
Erik Andersen
bcd6177853 BusyBox shell (lash) can now be used as a standalone shell when
BB_FEATURE_STANDALONE_SHELL is defined (i.e. BusyBox can now completely replace
sash).  Also fixed it so shell builtins now respect pipes and redirects.
 -Erik
2000-05-13 06:33:19 +00:00
Erik Andersen
7ab9c7ee52 Lots of updates. Finished implementing BB_FEATURE_TRIVIAL_HELP
which lets you compile out most of the "--help" output, saving
up to 17k.

Renamed mnc to nc.
 -Erik
2000-05-12 19:41:47 +00:00
Erik Andersen
1d1d95051a More Doc updates. cmdedit and more termio fixes. 2000-04-21 01:26:49 +00:00
Erik Andersen
a6c752201e Updates
-Erik
2000-04-18 00:00:52 +00:00
John Beppu
6e703034f4 + no need for comments. 2000-04-17 16:53:45 +00:00
Erik Andersen
e5b6c7dd9c More updates to the docs, and fixes to sync things with the docs.
-Erik
2000-04-17 16:16:10 +00:00
Erik Andersen
61677feff7 Upates to include copyright 2000 to everything
-Erik
2000-04-13 01:18:56 +00:00
Erik Andersen
f0657d3229 Some enhancements I've been working on over the weekend,
-Erik
2000-04-12 17:49:52 +00:00
Erik Andersen
a2685735b1 Make tab completion an option
-Erik
2000-04-09 18:27:46 +00:00
Erik Andersen
f3b3d17060 More minor patches
-Erik
2000-04-09 18:24:05 +00:00
Erik Andersen
d4bc1fcad8 Minor noise removal
-Erik
2000-04-05 05:19:03 +00:00
Erik Andersen
6acaa40f27 First stages of (re-)writing busybox's tar creation support.
-Erik
2000-03-26 14:03:20 +00:00
Erik Andersen
1dbe340eba more minor fixes
-Erik
2000-03-19 10:46:06 +00:00
Erik Andersen
c7c634bd88 Some more stuff.
-Erik
2000-03-19 05:28:55 +00:00
Erik Andersen
531bcb6826 Minor update 2000-03-17 20:49:55 +00:00
Erik Andersen
6273f655c8 Several fixes.
-Erik
2000-03-17 01:12:41 +00:00
Erik Andersen
161220c498 Fix fg bug
-Erik
2000-03-16 08:12:48 +00:00
Erik Andersen
13456d1fcd Forgot these files...
-Erik
2000-03-16 08:09:57 +00:00
Erik Andersen
d75af99529 Major build system updates...
-Erik
2000-03-16 08:09:09 +00:00
Erik Andersen
3522eb1ab3 First pass at writing a shell for busybox.
Works fine, full job control support, etc.
No syntax yet (if, then, while, etc).  Handles
pipes and & processes fine.

TODO: add command editing, add syntax suport.

 -Erik
2000-03-12 23:49:18 +00:00