aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c
AgeCommit message (Collapse)Author
2001-06-07Another hush update from Larry:Eric Andersen
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-06A patch from Larry to fix pathological things like '>""'Eric Andersen
2001-06-05Don't close file descriptors when we are duplicating them.Matt Kraai
2001-05-31Cope gracefully when people type something, then hit ^C.Eric Andersen
-Erik
2001-05-24Plug another memory leakEric Andersen
2001-05-23Plug another memory leak in hush. This one showed up when backtickedEric Andersen
commands were run. This one was sure a bugger to find. -Erik
2001-05-23Fix a massive memory leak in the run_list_test() function.Eric Andersen
Rename run_list_test() as free_pipe_list(). Rename run_pipe_test() as free_pipe(). -Erik
2001-05-23Commit a patch by Larry Doolittle which fixes recursive calls to file_peek,Matt Kraai
and improves some debugging messages.
2001-05-22Excellent. This patch from Larry fixes the behavior of hushEric Andersen
when builtins are included in pipes.
2001-05-22Fix this case. No, really this time.Eric Andersen
unset FOO export FOO=bar FOO=baz echo "global env: " `env | grep ^FOO` echo "local env: " `set | grep ^FOO` -Erik
2001-05-22Fix a race. Sometimes by the time we got to checkjobs(), theEric Andersen
pipe struct had already been freed. Return immediately if the pipe is NULL.
2001-05-22Oops. Remove some debug noise I left in.Eric Andersen
2001-05-22Updates from both Vladimir and LarryEric Andersen
2001-05-21Patch from Lars Kellogg-Stedman <lars@larsshack.org> to fix bugEric Andersen
#1130 (i.e. When you turn on features it should always ADD features)
2001-05-21The latest patch from LarryEric Andersen
2001-05-19This is a patch from Vladimir:Eric Andersen
> 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-17It turns out job control in both hush and lash was broken by theEric Andersen
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-16Move init of a bunch of globals into main so we are at leastEric Andersen
a bit more reentrant. -Erik
2001-05-15Fix the behavior of local shell variables to match that of bash and ash.Eric Andersen
-Erik
2001-05-15Oops. I left in some debug noise.Eric Andersen
2001-05-15Write set_local_var() and fixup lookup_param() so you can now useEric Andersen
shell local variables. -Erik
2001-05-15This patch covers one big part of variable handling.Eric Andersen
$ 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-11Fix up some silly warningsEric Andersen
2001-05-11Fix a segfault in lash, hush, and cmdedit. Each of these usedEric Andersen
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-11Use xgetcwdEric Andersen
2001-05-08A few more structural updates for job control.Eric Andersen
-Erik
2001-05-08Fix a stupid segfault caused by dereferencing a NULL ptr.Eric Andersen
-Erik
2001-05-07This patch from Evin Robertson <nitfol@my-deja.com> fixes export so it works.Eric Andersen
This way leaks memory, but oh well. We will probably fix that when we get around to doing local variables.
2001-05-07More hush updates from Larry:Eric Andersen
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-04Larry's variant on Evin Robertson's fix to what I messed upEric Andersen
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-04Don't reset parents context when we encounter an terminator. FixesMatt Kraai
if true; then if true; then true; fi; fi
2001-05-04If it fails to run a builtin, let it fall through toEric Andersen
exec the real thing. -Erik
2001-05-02Move up waitpid error check so that errno isn't clobbered by tcsetpgrp.Matt Kraai
2001-05-02Some more job control updates. It will now sucessfully backgroundEric Andersen
stuff. Good luck getting things back into the foreground though... -Erik
2001-05-02Don't treat newline as pipe separator when processing substitutions.Matt Kraai
2001-05-02Fix $(...) construction. Noted and patched by Larry DoolittleMatt Kraai
<ldoolitt@recycle.lbl.gov>. I'm just a patch whore. :)
2001-05-02First pass at getting job control working. This gets the infrastructureEric Andersen
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-02Use the current pgrp, not pid, when resetting the foreground process group.Matt Kraai
Fixes bizarre suspension when executing `echo`.
2001-05-02Don't segfault if the first word is the empty string.Matt Kraai
2001-05-02Another update from Larry:Eric Andersen
Makes hush return code equal to that of the last command executed. Fixes the mode where input comes from a file.
2001-05-01Another hush update from Larry:Eric Andersen
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-04-30Some more hush.c updates from Larry Doolittle.Eric Andersen
2001-04-27Use BUFSIZ for the_command to match size used in cmdeditEric Andersen
2001-04-27An update to hush from Larry:Eric Andersen
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-26This is the initial checkin of Larry Doolittle's hush.c, using hisEric Andersen
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