Commit Graph

160 Commits

Author SHA1 Message Date
sheldonh
506aa9c1b6 Revert to using .Xr for builtins. The cross-references don't work now,
but that doesn't mean that they will never work.

Requested by:	mpp, rgrimes
1999-08-31 12:44:52 +00:00
sheldonh
b337d66e78 Clean-up:
Fix grammar and spelling nits.
	Use .Dq and .Qq where appropriate.
	Divorce trailing punctuation from quoted elements.
	Use .Dq instead of .Xr for builtins.
	Remove trailing whitespace and blank lines.

PR:	13340
1999-08-30 10:13:04 +00:00
peter
66312e4a8d $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
tg
da827dcea3 Make the behaviour of `read -e', ie. treating backslashes as special,
the default. Add -r option for the read builtin to reverse this.

PR:		13274
Reviewed by:	cpiazza, hoek, sheldonh
1999-08-26 08:16:27 +00:00
sheldonh
3f0530abee Fix handling of the cd command inside evaluations. It was changing PWD,
which it should not do.

PR:	12578
Reported by:	Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
Submitted by:	Niall Smart <niall@pobox.com>
1999-07-19 11:00:33 +00:00
kris
713dd62834 Various spelling/formatting changes.
Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
1999-05-08 10:22:15 +00:00
imp
321c551969 First set of fixes to keep egcs happy. These include {} around single
statement if blocks[*] when the else could be ambiguous, not defaulting
to int type and removal of some unused variables.

[*] This is explicitly allowed by style(9) when the single statement
spans more than one line.

Reviewed by: obrien, chuckr
1999-04-25 21:13:34 +00:00
cracauer
da2b842fad Next approach to make loops in interactive interruptable.
PR:		bin/9173
1999-04-21 11:52:39 +00:00
max
3ee4dda734 Typo fix. 1999-04-19 18:48:26 +00:00
cracauer
fd7050b5fd Remove my temporary detection for PR 7059, Tor Egge fixed this bug.
PR:		7059
1999-04-13 12:43:55 +00:00
tegge
82a8c819f3 During variable expansion, the internal representation of the expression
might be relocated.  Handle this case.
PR:		7059
1999-04-13 04:13:09 +00:00
cracauer
6fcc4a0cb0 Fix typo in source-explaining comment. 1999-04-12 15:23:27 +00:00
cracauer
532c73c7d7 Add a guarded abort() for the problem in PR bin/7059 (no fix so far,
this is hairy).

Reformat this file to comply to style(9). It had mixed styles before.

PR:		bin/7059
1999-04-12 14:23:36 +00:00
tegge
e35119550e When a variable expansion is enclosed in double quotes, the internal
representation of the expression is quoted.  Take care of this when
doing pattern matching in conjunction with trimming.

	#!/bin/sh
	c=d:e; echo "${c%:e}"

PR:		NetBSD PR#7231
Noticed by:	Havard Eidnes <Havard.Eidnes@runit.sintef.no>
1999-04-09 15:23:48 +00:00
cracauer
1ea5fe55b8 In interactive shells, break loops to the topmost level when a child
is killed by a signal.

(In non-interactive shells - that means a shellscript - the shell just
exits, this was already working)

PR:		bin/9173
1999-04-03 12:55:51 +00:00
cracauer
affd55a23b Implement -a flag. A test shell script can be found at
http://www.cons.org/cracauer/download/sh-interrupt/testsuite/test_export.sh
The PR also had test cases the new version passes.

Fix typo in comment.

PR:		bin/1030
1999-04-03 11:41:46 +00:00
cracauer
b3dc9a5f33 -T was missing in the synopsis line.
Submitted by:	BDE
1999-04-02 09:28:00 +00:00
cracauer
5610584759 The immediate execution of traps I introduced in September 1998 (to
make /etc/rc interruptible in cases when programs hang with blocked
signals) isn't standard enough.

It is now switched off by default and a new switch -T enables it.

You should update /etc/rc to the version I'm about to commit in a few
minutes to keep it interruptible.
1999-04-01 13:27:36 +00:00
brian
52fb511664 sh doesn't support <> redirections.
PR:	7325
1999-03-31 21:02:01 +00:00
jkoshy
50a4f62af0 Add references to test(1) and expr(1). 1998-12-18 03:51:18 +00:00
imp
3b3da1d9ef Free memory from setmode.
Obtained from: OpenBSD
1998-12-16 04:45:35 +00:00
bde
c586f2866a Fixed warnx format errors in printf and csh, and snprintf format errors
in sh, by using separate macros for the 1, 2 and 3-arg calls to warnx.
(The 3-arg warnx macro in sh/bltin/bltin.h used to require bogus dummy
args.)
1998-12-07 12:14:04 +00:00
billf
a20e40c35a Fix typo. "If the an entry" --> "If an entry"
PR:		docs/8140
Submitted by:	Sue Blake <sue@vedanix.welearn.com.au>
1998-12-02 23:20:11 +00:00
tegge
c82e121ce7 Be more consistent with handling of quote mark control character.
Don't output double-quotes inside variable expansion/arithmetic
expansion region in here-documents.  When leaving the arithmetic
expansion syntax mode, adjust the dblquote flag according to
previous syntax, in order to avoid splitting of quoted variables.
1998-09-13 19:24:57 +00:00
cracauer
62616a44cf Narrow down conditions to break wait() to process traps.
Improve comments.
1998-09-10 22:09:11 +00:00
cracauer
1d2e8c5367 Fix an inefficiency I introduced in my last commit.
Include "expand.h" vom memalloc.c to pull function declartion into scope
1998-09-10 14:51:06 +00:00
cracauer
b1a46a64f8 If traps are set, they are now executed even when a signal-blocking
foreground child is running. Formerly, traps were exceuted after the
next child exit.

The enables the user to put a breaking wrapper around a blocking
application:
  (trap 'echo trap ; exit 1' 2; ./pestyblocker; echo -n)

The "echo -n" after the child call is needed to prevent sh from
optimizing the trap-executing shell away. I'm working on this.
1998-09-08 13:16:52 +00:00
tegge
ac59a0c5cd Better handling of word splitting. Don't record the same region
multiple times when performing nested variable expansion, and
preserve some quoting information in order to avoid removing
apparently empty expansion result.
1998-09-06 21:13:09 +00:00
tegge
59e6a57bc1 Don't blindly eliminate `..' and the previous pathname component.
PR:		2541
Obtained from:	NetBSD
1998-09-06 21:01:57 +00:00
cracauer
2ca0a9a7fb Improve bookkeeping of in_waitcmd and style fixes.
Submitted by:	Bruce Evans
1998-08-25 09:33:34 +00:00
cracauer
3fc10b7719 Re-enable killing childs with SIGQUIT. Spotted by Bruce Evans. 1998-08-25 08:49:47 +00:00
cracauer
57a57a05ca Got two volatile sig_atomic_t and int mixed up. Spotted by Gary Palmer. 1998-08-24 19:15:48 +00:00
cracauer
8a3c521f04 Do not exit on SIGINT in non-interactive shells, fixes PR 1206,
i.e. this makes emacs usable from system(3). Programs called from
shellscripts are now required to exit with proper signal status. That
means, they have to kill themself. Exiting with faked numerical exit
code is not sufficient.

Exit with proper signal status if script exits on signal.

Make the wait builtin interruptable, both with and without traps set.

Use volatile sig_atomic_t where (and only where) appropriate.

(Almost) fix printing of newlines on SIGINT.

Make traps setable from trap handlers. This is needed for shellscripts
that catch SIGINT for cleanup work but intend to exit on it, hance
have to kill themself from a trap handler. I.e. mkdep.

While I'm at it, make it -Wall clean. -Wall is not enabled in
Makefile, since vararg warnx() macro calls in usr.bin/printf/printf.c
are not -Wall-able.
PR:		1206
Obtained from:	Basic SIGINT fix from Bruce Evans
1998-08-24 10:20:37 +00:00
jkoshy
b755766186 Document behaviour of "-" and "--" on the command line.
PR: docs/5399
1998-07-30 04:47:56 +00:00
bde
3b038012cb Added a `build-tools' target for internal tools.
Removed explicit dependencies of foo.o on foo.c.  These were mainly
placeholders for comments about missing dependencies of tools objects
on headers.  This problem needs to be handled more generally.
1998-07-07 01:06:58 +00:00
charnier
86bc037e71 Add rcsid. Spelling. 1998-05-18 06:44:24 +00:00
bde
196c9f6d89 Backed out previous backout. Put y.tab.h back in SRCS. 1998-05-06 15:33:59 +00:00
bde
dba406f638 Backed out previous commit. It was tested, but not for the case where
a separate object tree doesn't exist.  Crufty makefiles will have to
put y.tab.h in SRCS so that we know not to create foo.h from foo.y.
1998-05-05 07:36:55 +00:00
bde
f701fbc7d5 Fixed races in `make -jN' using new yacc rules. 1998-05-04 20:09:06 +00:00
cracauer
5b12149227 When calling a shell function, remember whether exit status is tested.
This is needed for the '-e' option. See the PR for more details.
PR:		6047
Reviewed by:	PR submitter, silence on review request.
1998-05-04 07:24:10 +00:00
bde
ea697874b9 Backed out most of rev.1.19 (explicit dependencies of object files
on generated headers).  This is now handled generally in bsd.prog.mk.
1998-04-26 16:12:23 +00:00
jdp
4911b4c5bd Explicitly describe the rules the shell uses to search for a file
sourced by the "." command.
1998-02-12 01:23:11 +00:00
cracauer
cc1e6a2611 Back out my previous attempt to fix SIGINT/SIGTERM behaviour 1998-02-06 23:50:39 +00:00
cracauer
69ec138f35 Fix handling of SIGINT/SIGQUIT for foreground subprocesses. Most
urgent need is when you run sh around a program that intentionally
uses SIGQUIT/SIGINT for asynchronous events, i.e. $EDITOR started from
system(2), like many mailers do. This fixes PR bin/1206 and possibly
bin/4241.

The solution committed has been tested for a large number of possible
cases (see recent discussion on cvs-committers). I completed a make
world, made sure 'make world' is interruptable and used the changed
/bin/sh as a login shell all day, including job control and using
SIGQUIT-catching programs (to write this message :-).

PR:		bin/1206
Reviewed by:	discussion on cvs-commiters
1998-02-06 18:14:26 +00:00
steve
27cda073a4 Correct a bogon in an example.
PR:		5415
Submitted by:	Sergei S. Laskavy <laskavy@pc759.cs.msu.su>
1998-01-02 19:23:05 +00:00
alex
0f42dce470 Added $Id$. 1997-12-29 00:00:10 +00:00
eivind
2208ac1acf Remove simultaneous include of <sys/param.h> and <sys/types.h>.
Reorder includes to be alphabetical some places since I already was in
here.
1997-12-10 22:18:54 +00:00
jdp
33bb94d305 Document the exit status for a command that was terminated by a
signal.
1997-11-12 04:32:50 +00:00
bde
9dbc4bc4ff Fixed some type and value mismatches. setsignal() returned a bogusly
cast value that was always ignored.  Rev.1.9 of trap.c made this
more bogus by returning a semantically different value after calling
siginterrupt().  Avoid these problems by not returning a value.
1997-11-10 11:32:24 +00:00
ache
01ee8c1bbd 1) Fix longstanding bug:
trap 'echo xxx' 1 2 3 15
	read x
is not interrupted by ^C (due to restartable read syscall) and must be
interrupted per POSIX
Worse case:
	read -t 5 x
hangs forever after ^C pressed (supposed to timeout after 5 secs)
Fixed by adding siginterrupt(signo, 1) after catch handler installed

2) Do not reinstall sighandler immediately after it is called,
BSD do it for us
1997-11-05 23:33:58 +00:00