aboutsummaryrefslogtreecommitdiff
path: root/bin/sh/exec.h
Commit message (Collapse)AuthorAgeFilesLines
* bin: Remove ancient SCCS tags.Warner Losh2023-11-271-2/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* sh: introduce a function to iterate over all hashed commandsPiotr Pawel Stefaniak2023-09-121-0/+2
| | | | | | | | | | | | | While aliases and built-ins are opportunistically stored in cmdtable, each function will be added to it immediately on definition. Factor out the hashing function, write the iterator function and make it use the hashing function. Add the cmdname pointer to struct cmdentry so that the command name can be exposed that way. Differential Revision: https://reviews.freebsd.org/D40619
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sh: Use exitstatus instead of exerrno to pass EXEXEC statusJilles Tjoelker2018-10-271-2/+0
| | | | | | | No functional change is intended. Notes: svn path=/head/; revision=339822
* sh: Don't treat % specially in CDPATHJilles Tjoelker2018-07-151-2/+1
| | | | Notes: svn path=/head/; revision=336320
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* sh: Expand assignment-like words specially for export/readonly/local.Jilles Tjoelker2012-07-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Examples: export x=~ now expands the tilde local y=$1 is now safe, even if $1 contains IFS characters or metacharacters. For a word to "look like an assignment", it must start with a name followed by an equals sign, none of which may be quoted. The special treatment applies when the first word (potentially after "command") is "export", "readonly" or "local". There may be quoting characters but no expansions. If "local" is overridden with a function there is no special treatment ("export" and "readonly" cannot be overridden with a function). If things like local arr=(1 2 3) are ever allowed in the future, they cannot call a "local" function. This would either be a run-time error or it would call the builtin. This matches Austin Group bug #351, planned for the next issue of POSIX.1. PR: bin/166771 Notes: svn path=/head/; revision=238468
* sh: Make various functions static.Jilles Tjoelker2012-01-011-1/+0
| | | | Notes: svn path=/head/; revision=229220
* sh: Fix duplicate prototypes for builtins.Jilles Tjoelker2011-06-131-2/+0
| | | | | | | | | Have mkbuiltins write the prototypes for the *cmd functions to builtins.h instead of builtins.c and include builtins.h in more .c files instead of duplicating prototypes for *cmd functions in other headers. Notes: svn path=/head/; revision=223060
* sh: Remove clearcmdentry()'s now unused argument.Jilles Tjoelker2011-02-051-1/+1
| | | | Notes: svn path=/head/; revision=218324
* sh: Remove special code for shell scripts without magic number.Jilles Tjoelker2011-02-041-1/+0
| | | | | | | | | | | | | These are called "shell procedures" in the source. If execve() failed with [ENOEXEC], the shell would reinitialize itself and execute the program as a script. This requires a fair amount of code which is not frequently used (most scripts have a #! magic number). Therefore just execute a new instance of sh (_PATH_BSHELL) to run the script. Notes: svn path=/head/; revision=218306
* sh: Improve the command builtin:Jilles Tjoelker2010-03-061-0/+4
| | | | | | | | | | | * avoid unnecessary fork * allow executing builtins via command * executing a special builtin via command removes its special properties Obtained from: NetBSD (parts) Notes: svn path=/head/; revision=204800
* sh: Allow command -pv and command -pV (lookup using _PATH_STDPATH).Jilles Tjoelker2009-12-311-1/+1
| | | | Notes: svn path=/head/; revision=201343
* sh: Add some __dead2 to indicate functions that do not return.Jilles Tjoelker2009-12-241-1/+1
| | | | Notes: svn path=/head/; revision=200967
* sh: Constify various strings.Jilles Tjoelker2009-12-241-8/+8
| | | | | | | | Most of this is adding const keywords, but setvar() in var.c had to be changed somewhat more. Notes: svn path=/head/; revision=200956
* sh: Fix crash when undefining or redefining a currently executing function.Jilles Tjoelker2009-08-231-1/+2
| | | | | | | | | | | Add a reference count to function definitions. Memory may leak if multiple SIGINTs arrive in interactive mode, this will be fixed later by changing SIGINT handling. PR: bin/137640 Notes: svn path=/head/; revision=196483
* Implement some of the differences between special built-ins and other builtinsStefan Farfeleder2006-04-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | demanded by POSIX. - A redirection error is only fatal (meaning the execution of a shell script is terminated) for special built-ins. Previously it was fatal for all shell builtins, causing problems like the one reported in PR 88845. - Variable assignments remain in effect for special built-ins. - Option or operand errors are only fatal for special built-ins. This change also makes errors from 'fc' non-fatal (I could not find any reasons for this behaviour). Somewhat independently from the above down-grade the error handling in the shift built-in if the operand is bigger than $# from an error() call (which is now fatal) to a return 1. I'm not sure if this should be considered a POSIX "operand error", however this change is needed for now as we trigger that error while building libncurses. Comparing with other shells, zsh does the same as our sh before this change (write a diagnostic, return 1), bash behaves as our sh after this commit (no diagnostic, return 1) and ksh93 and NetBSD's sh treat it as a fatal error. Notes: svn path=/head/; revision=157601
* Add the POSIX options -v and -V to the 'command' builtin. Both describe theStefan Farfeleder2005-10-281-0/+7
| | | | | | | | | | type of their argument, if it is a shell function, an alias, a builtin, etc. -V is more verbose than -v. PR: 77259, 84539 Notes: svn path=/head/; revision=151810
* Remove clause 3 from the UCB licenses.Mark Murray2004-04-061-4/+0
| | | | | | | OK'ed by: imp, core Notes: svn path=/head/; revision=127958
* Changes following CScout analysis:Diomidis Spinellis2003-07-051-1/+0
| | | | | | | | | | | | | | - Removed dead declarations - Made objects that should have been declared as static, static. The changes use STATIC instead of static, following the existing convention in the rest of the code. Approved by: schweikh (mentor) MFC after: 2 weeks Notes: svn path=/head/; revision=117261
* o __P has been reovedWarner Losh2002-02-021-14/+14
| | | | | | | | | | | | | | | | | | | | | 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) { ... Notes: svn path=/head/; revision=90111
* Fix command hash handling onMartin Cracauer1999-12-201-0/+1
| | | | | | | | | PATH=... command Noted by and fix works for Marcel Moolenaar <marcel@scc.nl> Notes: svn path=/head/; revision=54884
* $Id$ -> $FreeBSD$Peter Wemm1999-08-271-1/+1
| | | | Notes: svn path=/head/; revision=50471
* Add a type builtin and nuke register keyword usage.Steve Price1997-04-281-1/+2
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=25223
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-221-1/+1
| | | | Notes: svn path=/head/; revision=22988
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-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. Notes: svn path=/head/; revision=21673
* Merge in NetBSD mods and -Wall cleaning.Steve Price1996-12-141-2/+3
| | | | | | | Obtained from: NetBSD, me Notes: svn path=/head/; revision=20425
* Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is aPeter Wemm1996-09-011-21/+14
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=17987
* Added $Id$David Greenman1994-09-241-0/+1
| | | | Notes: svn path=/head/; revision=3044
* BSD 4.4 Lite bin SourcesRodney W. Grimes1994-05-261-0/+75
Notes: svn path=/head/; revision=1556