summaryrefslogtreecommitdiffstats
path: root/bin/sh/eval.c
Commit message (Collapse)AuthorAgeFilesLines
* The PR diff I committed recently had one bug noticed bycracauer2004-01-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Joe Marcus Clarke <marcus@FreeBSD.ORG>, subshells could lose a non-zero exit status. This commit is Joe's proposed patch. Thanks! I verified that the problem Joe found is fixed and I ran a full world with this patch. I don't plan to ever commit language patches to /bin/sh again. It is a minefield too big to navigate without a full-time committment, which I am not willing to do on our /bin/sh. Under normal circumstances I would recommend using NetBSD's sh which has a lot of language fixes (like the ones what these patches were about) but unfortunately they had implemented broken signal behaviour for shellscript containing interactive programs. Similar issues apply to pdksh which is OpenBSD's sh. From my perspective bash2 is the only really working bourne sh out there and that one is GPLed. Oh well.
* Replace home-grown dup2() implementation with actual dup2() calls. Thisdes2004-01-211-8/+4
| | | | | | | should slightly reduce the number of system calls in critical portions of the shell, and select a more efficient path through the fdalloc code. Reviewed by: bde
* o Spell 'diretories' correctly.maxim2003-12-301-1/+1
| | | | | | PR: misc/60730 Submitted by: Eugene Grosbein MFC after: 3 days
* PR 28852cracauer2003-12-281-24/+1
| | | | | | | | | | | | | | | sh -e behaviour was incorrect when && and || statements where used in "if" clauses. This is the patch submitted by MORI Kouji <mori@tri.asanuma.co.jp>. It fixes the issue at hand, but sh fixes like this are super-hard to verify that they don't break anything else. I ran some of my old test cases and a few big GNU configure scripts that detected mistakes before, with the previous sh, patched sh and bash. No differences in behaviour found. MFC recommended after longer than usual time. Compiles on i386 and sledge.
* Make this compile with DEBUG defined now that WARNS=0 has been removedtjr2003-01-211-1/+1
| | | | | | | | from the Makefile: - Print pointers with %p instead of %x. - Include missing headers to get prototypes. Noticed by: benno
* Add <stdlib.h> to get a prototype for exit().keramida2002-08-291-0/+1
| | | | Reviewed by: tjr
* Set opterr to zero to avoid duplicate warnings from getopt(3) for unknowntjr2002-07-251-0/+1
| | | | options.
* Implement the P1003.2 `command' builtin command, which is used to suppresstjr2002-07-211-2/+54
| | | | | | shell function and alias lookup. The -p option has been implemented, the UPE -v and -V options have not. The old `command' command has been renamed to `builtin'.
* Consistently use FBSDIDobrien2002-06-301-2/+2
|
* Implement the -C (-o noclobber) option, which prevents existing regulartjr2002-05-191-0/+1
| | | | files from being overwritten by shell redirection.
* o __P has been reovedimp2002-02-021-58/+27
| | | | | | | | | | | | | | | | | | o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are. o Change int foo() { ... to int foo(void) { ...
* Fix how /bin/sh handles 'for' and 'case' statements when it is called to dogad2001-06-011-0/+16
| | | | | | | | 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
* Implement the <> redirection operator.brian2000-10-031-0/+1
|
* Fix environment passung to eval'ed commands.cracauer2000-05-151-0/+1
| | | | | | PR: bin/6577 Submitted by: Anatoly Vorobey <mellon@pobox.com> Approved by: silence amoung other sh experts
* Fix command hash handling oncracauer1999-12-201-1/+27
| | | | | | PATH=... command Noted by and fix works for Marcel Moolenaar <marcel@scc.nl>
* Include strerror(errno) in error messages after failed system calls.cracauer1999-11-291-3/+4
| | | | Fix a warning.
* The pipleline problem introduced in version 1.22 wasn't fully fixed incracauer1999-11-171-1/+1
| | | | | | | 1.23. This revision should work for long pipes both in here-documents/backquote and in normal cases. Fix works for jmz, bde.
* Correct logic from previous commit - middle processes in long pipessteve1999-11-071-1/+1
| | | | | | don't have their stdin closed indisciminantly. Reviewed by: markm
* When a backquote command inside a here-document had a pipe with morecracauer1999-11-051-1/+2
| | | | | | | | 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
* Fix ';' command when used with -e flag.cracauer1999-10-261-1/+8
| | | | PR: bin/14509
* $Id$ -> $FreeBSD$peter1999-08-271-1/+1
|
* Fix handling of the cd command inside evaluations. It was changing PWD,sheldonh1999-07-191-1/+2
| | | | | | | | which it should not do. PR: 12578 Reported by: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> Submitted by: Niall Smart <niall@pobox.com>
* Various spelling/formatting changes.kris1999-05-081-2/+2
| | | | Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
* Next approach to make loops in interactive interruptable.cracauer1999-04-211-5/+6
| | | | PR: bin/9173
* In interactive shells, break loops to the topmost level when a childcracauer1999-04-031-1/+6
| | | | | | | | | is killed by a signal. (In non-interactive shells - that means a shellscript - the shell just exits, this was already working) PR: bin/9173
* The immediate execution of traps I introduced in September 1998 (tocracauer1999-04-011-2/+3
| | | | | | | | | | 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.
* Add rcsid. Spelling.charnier1998-05-181-3/+5
|
* When calling a shell function, remember whether exit status is tested.cracauer1998-05-041-2/+5
| | | | | | This is needed for the '-e' option. See the PR for more details. PR: 6047 Reviewed by: PR submitter, silence on review request.
* Use the __unused attribute where warranted.steve1997-05-191-7/+7
|
* Nuke register keyword usage and #if -> #ifdef.steve1997-04-281-2/+2
| | | | Obtained from: NetBSD
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Merge in NetBSD mods and -Wall cleaning.steve1996-12-141-42/+40
| | | | Obtained from: NetBSD, me
* Back out rev 1.7 which was to fix PR#1206 (to be reopened).peter1996-11-121-19/+2
| | | | | | | | | | This patch causes too many side effects, one of which bites hard is when interrupting a 'make fetch' in the ports tree (PR#1990). This whole area is a real can of worms.... This most definately should go into 2.2 Reviewed by: steve, bde
* Close PR# 1206. sh(1) now ignores SIGINT and SIGQUITsteve1996-10-221-3/+19
| | | | | | | when a child is forked and the -c commandline switch has been specified. Reviewed by: joerg
* Fix a problem with sh that conflicts with the -esteve1996-10-061-2/+5
| | | | | | | | | flag text in the man page. Now this will work correctly: /bin/sh -ec 'false && true; echo hi' Obtained from: VaX#n8 <vax@linkdead.paranoia.com>
* Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is apeter1996-09-011-76/+144
| | | | | | | | | | | | | | merge of parallel duplicate work by Steve Price and myself. :-] There are some changes to the build that are my fault... mkinit.c was trying (poorly) to duplicate some of the work that make(1) is designed to do. The Makefile hackery is my fault too, the depend list was incomplete because of some explicit OBJS+= entries, so mkdep wasn't picking up their source file #includes. This closes a pile of /bin/sh PR's, but not all of them.. Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
* Don't dereference a NULL pointer in the case of a null pipe.dg1995-09-201-2/+3
| | | | | | | e.g.: ls |> foo.out sh now behaves the same as it does under SunOS 4.x for this case.
* Remove trailing whitespace.rgrimes1995-05-301-4/+4
| | | | Reviewed by: phk
* Added $Id$dg1994-09-241-0/+2
|
* BSD 4.4 Lite bin Sourcesrgrimes1994-05-261-0/+933
OpenPOWER on IntegriCloud