Commit Graph

372 Commits

Author SHA1 Message Date
wiz
4c99916337 va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
2001-09-24 13:22:25 +00:00
itojun
31952d578f make sure we do not truncate arith expresssion > 10 digits.
freebsd bin/sh/expand.c revision 1.15.  NetBSD PR 13943.
2001-09-19 06:38:19 +00:00
wiz
456dff6cb8 Spell 'occurred' with two 'r's. 2001-09-16 16:34:23 +00:00
assar
50ed29b359 (waitproc): handle jp == NULL, it happens 2001-09-13 21:33:05 +00:00
christos
a7560f06ec Don't wait with UNTRACED for jobs that have not been started with job control
(i.e. processes started from shell scripts). Fixes problem where kill -STOP'ing
a subprocess of a shell script would cause the shell to proceed to the next
command.
2001-09-10 15:47:03 +00:00
lukem
c0b18597d8 fix grammar 2001-06-13 08:48:06 +00:00
wiz
40ac848024 Fix various misspellings of compatible/compatibility. 2001-06-11 01:50:48 +00:00
bjh21
45a6b58c3e Use ${MACHINE_CPU} == "arm" to test for ARMishness. 2001-04-18 17:35:36 +00:00
christos
ea8e5cf90b PR/12533: Koji Mori: eval gets misparsed when it has a trailing semi-colon. 2001-04-03 15:00:11 +00:00
wiz
242b959069 Don't xref set(1) and case(1), since they are builtins and we don't
have separate man pages for them.
Xref passwd 5 instead of 4, environ 7 instead of 5, and comment out xref
to profile(4), which we don't have.
Improve markup of SYNOPSIS.
Some whitespace fixes while I'm here.
2001-04-03 10:56:03 +00:00
toddpw
e08886d505 Correct {list;} example and fix formatting/typo in the operator lists. 2001-04-01 02:15:45 +00:00
mycroft
59771e308b Globbing should match broken symlinks. stat()->lstat() to fix this. 2001-03-30 17:45:00 +00:00
wulf
8d23cb0373 Extended functionality of the trap builtin, which now closely follows
POSIX recommendations.

	- trap now accepts signal names and signal numbers
	  e.g. INT, SIGINT, 2
	- added option -l that outputs a list of valid signals
	- added signal EXIT to list of valid signals
	- a `-' in the action part will reset specified signal to their
	  default behaviour
	- changed standard output format to make it suitable as an input
	  to another shell that achieves the same trapping results
2001-03-18 04:04:23 +00:00
wiz
8d35854b5d Fix command name in error message for 'sh nonexistingfile'. 2001-02-26 13:06:43 +00:00
christos
3380980447 remove redundant declarations and nexted externs. 2001-02-04 19:52:06 +00:00
christos
80d86b9e7c remove redundant declaration of yyparse, and move code to the bottom of
the file.
2001-02-04 19:51:43 +00:00
lukem
10fc746e6d if HAVE_VASPRINTF (set ifdef BSD4_4), use vasprintf() instead of homegrown
code in doformat().  results in slightly smaller /bin/sh.  idea suggested by
Witold J. Wnuk <witek@pd37.warszawa.sdi.tpnet.pl>, approved by christos.
2001-01-07 23:39:07 +00:00
lukem
dd7296f47a support %ll (as synonym for %q) in doformat(), since my changes to %q -> %ll
broke this :/
problem reported in private email by Witold J. Wnuk.
<witek@pd37.warszawa.sdi.tpnet.pl>.
2001-01-07 22:19:53 +00:00
lukem
f819878ce7 use more standard %ll_ in favour of %q_ 2001-01-04 15:39:50 +00:00
bjh21
c9ee8d3362 arm26 has unsigned chars too. 2000-12-29 16:30:31 +00:00
cgd
84d782a52f __CONCAT does token pasting, not string concatnation. if something like:
__CONCAT("PATH=",_PATH_STDPATH);
actually works to concantate strings, it's because the preprocessor expands
it into "PATH=""whatever _PATH_STDPATH is" as separate strings, and then
ANSI string concatenation is performed on that.  It's more straightforward
to just use ANSI string concatenation directly, and newer GCCs complain
(rightly) about mis-use of token pasting.
2000-12-20 00:15:10 +00:00
christos
1d9dab3e95 error message cleanup:
- don't print the builtin name twice
    - explain why things fail
    - no extra newline
2000-11-22 19:20:31 +00:00
christos
212627911f fix typo. 2000-11-20 17:48:05 +00:00
christos
fb16d6d0ec Add an example on how to use getopts, stolen from the getopt manual page :-) 2000-11-20 16:59:56 +00:00
mycroft
3112db7eb8 Call el_source() to use .editrc. 2000-11-06 04:21:14 +00:00
christos
8e2797bc1e PR/11283: Hubert Feyrer: random memory corruption executing commands:
Fix from FreeBSD:

    growstackblock() sometimes relocates a stack_block considered empty
    without properly relocating stack marks referencing that block.
    The first call to popstackmark() with the unrelocated stack mark
    as argument then causes sh to abort.

    Relocating the relevant stack marks seems to solve this problem.

    The patch changes the semantics of popstackmark() somewhat.  It can
    only be called once after a call to setstackmark(), thus cmdloop() in
    main.c needs an extra call to setstackmark().
2000-11-01 19:56:01 +00:00
christos
9cc4e15f46 handle type command on names that contain slashes, and print a : in the not
found case. From FreeBSD.
2000-11-01 19:21:41 +00:00
mycroft
8f48358936 Wrap malloc() calls with an INTOFF/INTON pair. Fixes PR 8414. 2000-10-21 04:37:17 +00:00
phil
34ad57a779 .Bl takes parameter "-offset indent", not "-indent". 2000-09-21 21:04:56 +00:00
kleink
2caf6aacdd For commands and utilities, use EXIT STATUS rather than RETURN VALUES as
appropriate (and documented in mdoc(7)).
2000-09-04 07:30:07 +00:00
hubertf
1cb54f68ac Add 'RETURN VALUE' section header. 2000-08-28 02:11:04 +00:00
cgd
2a1ee59131 un-__P functions declared in parser.h. host programs include parser.h,
and so it shouldn't use __P.  (this should probably be done better, by
not declaring the parser functions in headers used by host programs,
but this works well enough.)
2000-07-27 04:09:27 +00:00
cgd
96df053cba host program portability: set infp to stdin at runtime, since apparently
some systems (e.g. linux) define stdin in such a way that it can't
be used to initialize values at compile time.
2000-07-27 04:06:49 +00:00
cgd
28728fd305 host program portability: don't use <sys/cdefs.h>, __COPYRIGHT(),
__RCSID(), or __P().  (these programs have been de-__P()'d.)
Repeat after me: "Not all cross-compilation host systems are NetBSD."
2000-07-18 19:13:20 +00:00
jhawk
9d53f2aee6 Various mandoc updates to the Builtins
section; mostly .Ic, a few other nits.
2000-07-18 01:55:48 +00:00
jhawk
45a8e6b7e3 Note the meaning of 'trap 0' (execute on exit from shell) 2000-07-17 21:18:47 +00:00
matt
e2056eada9 include <stdlib.h>, <string.h>, or whatever as appropriate to shut up
gcc 2.96
2000-07-03 03:26:17 +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
a0ef2ea948 In order to use __NetBSD_Version__, I needed to include sys/param.h. 2000-05-13 21:11:16 +00:00
elric
0eece24a3a Unused variable pgrp on line 576. 2000-05-13 20:59:41 +00:00
elric
4aeaa113a7 Quick fix.
jobs.h:91: warning: declaration of `vfork' shadows global declaration
2000-05-13 20:56:08 +00:00
elric
756a2ca1bd Now we use vfork(2) instead of fork(2) when we can. 2000-05-13 20:50:14 +00:00
simonb
d2f6a4723d Include <errno.h> instead of using "extern int errno;". 2000-04-14 05:54:20 +00:00
simonb
51ee9dc68d Don't declare 'extern opt*' getopt variables. 2000-04-14 05:52:56 +00:00
christos
b252543484 PR/9847: Geoff C. Wing: Make test(1) a builtin. 2000-04-09 23:27:03 +00:00
soren
1594850f00 Fix doubled 'the' in comment. 2000-03-13 22:46:59 +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