Commit Graph

59 Commits

Author SHA1 Message Date
christos f629aa28d9 implement noclobber. From Ben Harris, with minor tweaks from me. Two
unimplemented comments to go. Go Ben!
2002-05-15 16:33:35 +00:00
christos 06ea4006cb PR/11542: Back-out previous change that caused
set -e
for x in a; do
    BAR="foo"
    false && echo true
    echo mumble
done

not to echo mumble...
2002-02-14 21:51:41 +00:00
christos 3380980447 remove redundant declarations and nexted externs. 2001-02-04 19:52:06 +00:00
elric e6bccfe4be Back out previous vfork changes. 2000-05-22 10:18:46 +00:00
elric f5dccf4728 When vforking ensure that the environment passed to exec is built before
vforking as a set of local variables which can be popped by the parent.

Addresses bin/10124.
2000-05-17 07:37:12 +00:00
elric e8b0f2b813 INTON and FORCEINTON modify global variables, and so should not be
executed while we are vforked.
2000-05-15 03:42:48 +00:00
elric c55fa30be8 Added includes for waitpid, sys/types.h and sys/wait.h. 2000-05-13 21:11:45 +00:00
elric 756a2ca1bd Now we use vfork(2) instead of fork(2) when we can. 2000-05-13 20:50:14 +00:00
christos 9fcfbaea4d Fix problem where commands that caused exitstatus != 0 inside loops did
not cause the shell to exit when -e was set.
2000-02-09 20:26:53 +00:00
christos d6ac7627ea Fix bin/9184, bin/9194, bin/9265, bin/9266
Exitcode and negation problems (From Martin Husemann)
2000-01-27 23:39:38 +00:00
mrg 1b23e7d142 back out previous; it causes /etc/rc to break on my alpha and other lossage as reported in PR#8614 1999-10-13 00:59:10 +00:00
pk ef45922abf Backtrack `exitstatus' to make the shell really ignore the status
of `tested commands' as in this example:

	set -e
	true; false && echo "not reached"
1999-10-10 21:22:24 +00:00
christos 3d42469030 compile with WARNS = 2 1999-07-09 03:05:49 +00:00
christos 02048e84df PR/7814: Matthias Scheler: shell does not fork for builtins in backquotes,
leading to unexpected behaviour. Disable the no-fork optimization for now.
We need to revisit this and keep enough state around to recover from such
changes.
1999-06-26 16:31:47 +00:00
christos 6e50d7a816 PR/4966: Joel Reicher: Implement <> redirections which are documented in
the man page.
1999-02-04 16:17:39 +00:00
mycroft ee9e50eacb Be more retentive about use of NOTREACHED and noreturn. 1998-07-28 11:41:40 +00:00
mycroft 9dc385beb1 Delint. 1998-07-28 05:31:22 +00:00
christos d8a1d3710c Re-enabled EXP_RECORD 1998-02-05 08:34:49 +00:00
mikel a235399817 back out last change until christos fixes EXP_RECORD; PR 4932 1998-02-04 06:25:55 +00:00
christos 5a36c00160 PR/4851: Benjamin Lorenz: In the "for <var> in <args>" construct <args>
was not marked as a region to be handled by ifsbreakup. Add EXP_RECORD
to indicate that the argument string needs to be recorded.
1998-01-31 12:45:06 +00:00
thorpej 23eb2db171 Avoid a segv in bltinlookup() reported by Ronald Khoo <ronald@demon.net>
in PR #3929, fix submitted by hiroy@NETCOM.COM (Hiroyuki Ito).
1997-08-26 20:09:59 +00:00
christos c996803cad PR/3888: Chris Demetriou: type command-with-slash prints
$PATH[0]/command-with-slash...
1997-07-20 21:27:35 +00:00
christos 18ad58a639 PR/3866: bayer@informatik.uni-leipzig.de: core dump using xon script.
cmdenviron is pointing to varlist.list; varlist gets reset everytime
you enter evalcommand, but cmdenviron does not. The wonders of global
variables...
1997-07-15 17:49:15 +00:00
christos cd799663e4 Fix compiler warnings. 1997-07-04 21:01:48 +00:00
christos 7accaec421 NO_HISTORY->SMALL 1997-03-14 01:42:18 +00:00
tls 48250187e6 kill 'register' 1997-01-11 02:04:27 +00:00
christos 07aeb5b266 remove a debugging printf that was left from the last POSIX error code fixes. 1996-11-09 01:04:07 +00:00
christos ccce082dd2 Fix miscellaneous getopts problems:
- the 3 argument version of getopts would not reset properly
- OPTARG did not get cleared after a non argument option was found
- OPTIND was not set properly after a non argument option.
1996-11-06 01:17:10 +00:00
christos 886c875a97 PR/287: Exit with 127/126 when command is not found/permission denied.
PR/2808: don't bomb out on "set -e; false && true"
1996-10-16 14:31:57 +00:00
christos 66824391d1 Fix PR/2504: return with no args returns 0 instead of the return value of
the previous command in functions
1996-06-03 12:21:17 +00:00
pk 0b9acf16f8 Return zero status if `else' clause is empty. 1996-03-06 14:49:29 +00:00
christos b09ffc42b1 - parser.c: Fix prompting in old style backquote expansion. Fixes PR/2139
and many user complaints why the shell hangs in echo "`"
- eval.c:   Fix exitstatus invalid resetting in `if' statements were:
		if (exit 3); then
			echo foo $?
		else
			echo bar $?
		fi
	    printed 'bar 0' instead of bar 3
1996-03-05 21:03:52 +00:00
christos f9382bca1a Fix return builtin to work like it does in ksh:
When not in a function, it skips the rest of the current input file.
Instances of `return' outside function definitions were previously ignored.
What does joe posix have to say about this?
[fixes PR/1444]
1995-09-11 17:05:41 +00:00
christos a45947b2a4 Changed so that 'PATH=newpath command' works, instead of looking at the
old path. Synced input.c with vangogh.
1995-06-09 01:53:44 +00:00
christos 4fb6f609aa Changed so that syntax errors (EXERROR) set the exit status to 2,
and commands that are not found set the exit status to 1 like all
other bourne shells.
[It used to be 0 and 2 respectively]
1995-05-19 15:08:55 +00:00
cgd b5f33fc18e re-add an #endif that was (apprently) clobbered. 1995-05-15 03:29:54 +00:00
christos fbac2e9de2 Fixed new bug the previous fix introduced:
false
    foo=bar
    echo $?

would print 1
Also fixed the long standing bug:

    false
    echo `echo $?`

would print 0
The exitstatus needs rethinking and rewriting. The trial and error method
is not very efficient
1995-05-15 02:47:38 +00:00
christos 2e1970487e Fixed bug caused by previous x=`false` not preserving the exit status fix.
The if statement exit status broke...
1995-05-14 04:19:18 +00:00
christos 07bae7eddd Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0
bug.
1995-05-11 21:28:33 +00:00
christos df504509f1 1. Don't core dump on 'fc -l' (From Gerard J van der Grinten)
2. PATH=xxx ls, does the PATH assignment first and then tries to find ls in xxx
3. VAR=xxx exec ls, does the variable assignment.
1995-03-31 21:58:09 +00:00
cgd 49f0ad8601 convert to new RCS id conventions. 1995-03-21 09:01:59 +00:00
cgd 58f1733118 be more careful with casts. 1994-12-23 13:24:39 +00:00
cgd 4ce0d34a31 clean up further. more patches from Jim Jegers 1994-12-05 19:07:32 +00:00
cgd 5dad143982 from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch
some of the worst style errors.
1994-12-04 07:11:37 +00:00
mycroft 08a6730054 Fix a core dump and another parse error related to null commands. 1994-08-24 05:48:26 +00:00
jtc 918ce04f57 From Christos:
1. Fix `-' quoting in [ ] expressions.
  2. Fix expansion of variables in redirections
1994-06-14 05:49:19 +00:00
jtc 212ba62f56 Set the status variable ($?) to 0 after a successful variable assignment. 1994-06-12 02:31:28 +00:00
mycroft cafd1f7e9f Add RCS ids. 1994-06-11 16:11:35 +00:00
cgd 242337bcae a few more things to omit when NO_HISTORY defined. from noel@cs.oberlin.edu 1994-05-21 01:42:30 +00:00
cgd e3c63ad9f3 add back in support for building w/o obj dir. also, add NO_HISTORY
define, which (if you invoke mkbuiltins properly) gets you a sh w/o
history of command line editing (for floppy sh).
1994-05-14 22:20:04 +00:00