Commit graph

212 commits

Author SHA1 Message Date
David Malone b82561452f Use the correct printf format to print a long.
Approved by:	cracauer
2001-06-26 11:11:30 +00:00
Dima Dorfman cafefe8c1b Include missing header files which define functions for which gcc has
builtins (e.g., exit, strcmp).
2001-06-24 23:04:23 +00:00
Dima Dorfman a910f192bb Remove duplicate words. 2001-06-24 01:34:38 +00:00
Dag-Erling Smørgrav 26f6b0fbe8 Add more headers that are required with -fno-builtin (stdlib and strings) 2001-06-19 15:41:57 +00:00
Garance A Drosehn 0a315e79df Fix how /bin/sh handles 'for' and 'case' statements when it is called to do
errexit (-e) processing.  This solves a problem where 'make clean' would
fail with an unspecified error in certain automake-generated makefiles.

Reviewed by:	no objections from -hackers...
MFC after:	2 weeks
2001-06-01 00:07:09 +00:00
Warner Losh 92e331afed Use PATH_MAX in preference in MAXPATHLEN. 2001-05-30 03:37:28 +00:00
Dima Dorfman 9434a1c780 Document "chdir" builtin. 2001-04-28 02:13:58 +00:00
Kris Kennaway a2e73040f4 -Wnon-const-format sweep: make format strings const char *'s, add
__printflike()/__printf0like() to function prototypes, as appropriate.

Reviewed by:	bde, -audit
2001-04-17 07:46:38 +00:00
Brian Somers b785bd7d3b `|'' should be more binding than `!'' so that this isn't broken:
if ! echo bla | wc -c ; then
		echo broken
	fi

Obtained from: NetBSD
2001-04-09 12:46:19 +00:00
Brian Somers 6c0bde79a8 A much better (more correct) fix for handling ``!'' characters
Obtained from: NetBSD
2001-04-04 10:11:43 +00:00
Brian Somers 51a9b1c281 Handle ``!'' characters when they appear as second and subsequent
parts of an && or || expression.

This makes this expression work as expected:

	if true && ! false; then echo yes; fi
2001-04-04 09:30:50 +00:00
Martin Cracauer adce2a1b4b Fix child's SIGSTOP behaviour in scripts.
When a child is receiving SIGSTOP, eval continues with the next
command.  While that is correct for the interactive case (Control-Z
and you get the prompt back), it is wrong for a shellscript, which
just continues with the next command, never again waiting for the
stopped child.  Noted when childs from cronjobs were stopped, just to
make more processes (by wosch).

The fix is not to return from a job wait when the wait returned for a
stopped child while in non-interactive mode.  This bahaviour seems to
be what bash2 and ksh implement.  I tested for correct behaviour for
finnaly killing the child with and without forgrounding it first.
When not foregrouding before killing, the shell continues with the
script, which is what the other shells do as well.

Reviewed by:	Silence on -current
2001-02-06 10:29:34 +00:00
Ruslan Ermilov d0353b836e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00
Ruslan Ermilov 32f6256a49 Prepare for mdoc(7)NG. 2001-01-16 09:08:22 +00:00
Ruslan Ermilov 1586940ea5 Prepare for mdoc(7)NG. 2000-12-18 14:48:17 +00:00
Ruslan Ermilov 12e720d78b Prepare for mdoc(7)NG. 2000-12-15 17:37:31 +00:00
David E. O'Brien 1a37aa566b Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.
2000-12-09 09:35:55 +00:00
Ruslan Ermilov b4f0f4aa81 mdoc(7) police: Er macro usage cleanup. 2000-11-22 15:55:01 +00:00
Kris Kennaway c8b46b3ee3 Use secure temporary filenames during build.
Audited by:	markm, cracauer
2000-11-22 11:05:51 +00:00
Brian Somers 4682f420f2 Implement the <> redirection operator. 2000-10-03 23:13:14 +00:00
Martin Cracauer b5803eae6a Disable part of my 8-bits fixes from December 1999.
Serious fix still needed, see discussion on -current
(Subject: /bin/sh dumps core with here-document of 8bit text)

Problem in this code originally spotted by
Jun Kuriyama <kuriyama@FreeBSD.org>
2000-08-16 12:23:57 +00:00
Martin Cracauer d753a42598 Fix type builtin for absolute paths and relative paths with directory
names in them.

Also use a colon in the answer of `type` everytime the questioned item
is not usable.

PR:		bin/20567
2000-08-16 12:08:02 +00:00
Martin Cracauer 84c3800cdc From submitter:
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().

PR:		bin/19983
Submitted by:	Tor.Egge@fast.no
Reviewed by:	Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
2000-08-16 10:39:43 +00:00
Sheldon Hearn 1b9735e6f2 Mark up the -a flag to unalias as a flag (Fl), not an argument (Ar). 2000-07-24 15:02:04 +00:00
Sheldon Hearn 5d3b843b57 Add missing punctuation to one line. 2000-07-24 14:59:50 +00:00
Mark Ovens 501e74b7ca Document the builtin echo command
Reviewed by:	Matthew Hunt <mph@astro.caltech.edu>
2000-07-17 23:37:55 +00:00
SADA Kenji 410fb0acaa Fixd with alias missing.
PR:		bin/19475
Approved by:	Martin Cracauer <cracauer@cons.org> (with conditions)
2000-07-15 14:34:37 +00:00
Matthew Hunt a585d13451 Add \a and \e to "echo -e" escape handling. 2000-06-26 22:43:30 +00:00
Martin Cracauer 98e05fd3ef Fix parsing of string for eval command.
PR:		18447
Submitted by:	Koji Mori <mori@tri.asanuma.co.jp>
2000-05-15 13:02:07 +00:00
Martin Cracauer b2acf8878e Fix environment passung to eval'ed commands.
PR:		bin/6577
Submitted by:	Anatoly Vorobey <mellon@pobox.com>
Approved by:	silence amoung other sh experts
2000-05-15 12:33:17 +00:00
Martin Cracauer d62ec71c31 Rename the trace() function (that is build only in the -DDEBUG=2
case), so that it doesn't clash with the ncurses function of the same
name when linking statically with -ltermcap.

The linker only complains when -static is used, and it is not clear
whether this is a bug.

PR:		bin/18104
Submitted by:	Anatoly Vorobey <mellon@pobox.com>
2000-04-20 11:39:11 +00:00
Martin Cracauer e988388eff Include <errno.h> when compiling with -DDEBUG=2
PR:		bin/18104
Submitted by:	mellon@pobox.com
2000-04-20 09:55:57 +00:00
Martin Cracauer f01e3d0cfe Fix warnings, some of them serious because sh violated name
spaces reserved by the header files it includes.

mkinit.c still produces C code with redundant declarations, although
they are more harmless since they automatically derived from the right
places.
2000-04-20 09:49:16 +00:00
Warner Losh fba0ed115e Use #include <errno.h> rather than extern int errno;. 2000-04-14 06:03:39 +00:00
Martin Cracauer c11e75cfcf Fix ${#varname} (getting length of string) when in double-quotes.
Approved-by:	jkh

PR:		bin/12137
Submitted by:	"Danny J. Zerkel" <dzerkel@columbus.rr.com>
2000-02-15 08:00:11 +00:00
Martin Cracauer a436dc79f5 Fix command hash handling on
PATH=... command

Noted by and fix works for Marcel Moolenaar <marcel@scc.nl>
1999-12-20 13:42:59 +00:00
Martin Cracauer 2dde9ce37a Second part of 8-bit fixes. 1999-12-16 12:03:46 +00:00
Martin Cracauer 3652a236fa Document ulimit -b for RLIMIT_SBSIZE. 1999-12-15 16:12:32 +00:00
Martin Cracauer 73f612b50d First round of 8-bit fixes. 1999-12-15 11:46:32 +00:00
Martin Cracauer 671356079b make '|' character visible.
PR:		docs/15265
Submitted by:	takamune@avrl.mei.co.jp
1999-12-05 12:13:54 +00:00
Martin Cracauer e92feeebb1 Fix "subscript has type `char'" warnings by casting to int, as
discussed on -arch.
1999-12-04 17:12:47 +00:00
Martin Cracauer 6c48b6cf75 Include strerror(errno) in error messages after failed system calls.
Fix a warning.
1999-11-29 19:11:01 +00:00
Sheldon Hearn e918fc8f72 Follow-up on mdoc fixes in rev 1.35; this includes things that I missed
in that revision as well as things I broke in that revision.  A note-
worthy instance of the latter case was the inversion of -E and -V in the
subsection on Commandline Editing.
1999-11-18 08:13:21 +00:00
Martin Cracauer 6d9efc2432 The pipleline problem introduced in version 1.22 wasn't fully fixed in
1.23. This revision should work for long pipes both in
here-documents/backquote and in normal cases.

Fix works for jmz, bde.
1999-11-17 16:53:34 +00:00
Sheldon Hearn 150c3a33b9 Don't call bash(1) a Korn shell clone. Instead, use pdksh(1) as an
example of such a clone.

PR:		14601
Submitted by:	Matthias Buelow <mkb@altair.mayn.de>
1999-11-10 13:27:54 +00:00
Steve Price 6edf2a5be8 Correct logic from previous commit - middle processes in long pipes
don't have their stdin closed indisciminantly.

Reviewed by:	markm
1999-11-07 17:07:05 +00:00
Martin Cracauer 74eeb719fd When a backquote command inside a here-document had a pipe with more
than two processes (got that? :-), the stdin fd of the middle
processes that has just been set up was accidetially closed. Don't do
this.

PR:		bin/14527
1999-11-05 12:06:30 +00:00
Martin Cracauer 905f2e447b Fix ';' command when used with -e flag.
PR:		bin/14509
1999-10-26 13:17:18 +00:00
Brian Feldman 7cde774d15 Implement ulimit -b for RLIMIT_SBSIZE. 1999-10-09 20:56:06 +00:00
Sheldon Hearn 49e11e3a66 Mdoc cleanup, with a few grammar cleanups on the side.
Reviewed by:	mpp
1999-10-07 13:56:43 +00:00