summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorstefanf <stefanf@FreeBSD.org>2006-04-02 18:43:33 +0000
committerstefanf <stefanf@FreeBSD.org>2006-04-02 18:43:33 +0000
commit0db401540e16ebc8779d7806d228249018f618ea (patch)
tree2e6fe76395c7ff7cd45cf3c8720c11c04c3b141c /bin/sh
parent23153e3ef86a0ab2bdb1079dfeeb9e07459a1021 (diff)
downloadFreeBSD-src-0db401540e16ebc8779d7806d228249018f618ea.zip
FreeBSD-src-0db401540e16ebc8779d7806d228249018f618ea.tar.gz
Use -s to flag POSIX's "special built-in" utilities in builtins.def. Add a
new member to struct builtincmd and set it to 1 if -s was specified. This is done because there are cases where special builtins must be treated differently from other builtins. Obtained from: NetBSD (builtins.def part)
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/builtins.def42
-rwxr-xr-xbin/sh/mkbuiltins10
2 files changed, 30 insertions, 22 deletions
diff --git a/bin/sh/builtins.def b/bin/sh/builtins.def
index 8159a38..75f83b5 100644
--- a/bin/sh/builtins.def
+++ b/bin/sh/builtins.def
@@ -36,13 +36,15 @@
#
# This file lists all the builtin commands. The first column is the name
-# of a C routine. The -j flag, if present, specifies that this command
-# is to be excluded from systems without job control, and the -h flag,
-# if present specifies that this command is to be excluded from systems
-# based on the NO_HISTORY compile-time symbol. The rest of the line
-# specifies the command name or names used to run the command. The entry
-# for bltincmd, which is run when the user does not specify a command, must
-# come first.
+# of a C routine.
+# The -j flag specifies that this command is to be excluded from systems
+# without job control.
+# The -h flag specifies that this command is to be excluded from systems
+# based on the NO_HISTORY compile-time symbol.
+# The -s flag specifies that this is a POSIX 'special built-in' command.
+# The rest of the line specifies the command name or names used to run the
+# command. The entry for bltincmd, which is run when the user does not specify
+# a command, must come first.
#
# NOTE: bltincmd must come first!
@@ -50,16 +52,16 @@ bltincmd builtin
aliascmd alias
bgcmd -j bg
bindcmd bind
-breakcmd break continue
+breakcmd -s break -s continue
cdcmd cd chdir
commandcmd command
-dotcmd .
+dotcmd -s .
echocmd echo
-evalcmd eval
-execcmd exec
-exitcmd exit
+evalcmd -s eval
+execcmd -s exec
+exitcmd -s exit
expcmd exp let
-exportcmd export readonly
+exportcmd -s export -s readonly
#exprcmd expr
falsecmd false
fgcmd -j fg
@@ -72,18 +74,18 @@ localcmd local
#printfcmd printf
pwdcmd pwd
readcmd read
-returncmd return
-setcmd set
+returncmd -s return
+setcmd -s set
setvarcmd setvar
-shiftcmd shift
+shiftcmd -s shift
testcmd test [
-timescmd times
-trapcmd trap
-truecmd : true
+timescmd -s times
+trapcmd -s trap
+truecmd -s : true
typecmd type
ulimitcmd ulimit
umaskcmd umask
unaliascmd unalias
-unsetcmd unset
+unsetcmd -s unset
waitcmd wait
wordexpcmd wordexp
diff --git a/bin/sh/mkbuiltins b/bin/sh/mkbuiltins
index 144505c..7b77649 100755
--- a/bin/sh/mkbuiltins
+++ b/bin/sh/mkbuiltins
@@ -66,9 +66,14 @@ echo '};
const struct builtincmd builtincmd[] = {'
awk '{ for (i = 2 ; i <= NF ; i++) {
- printf "\t{ \"%s\", %d },\n", $i, NR-1
+ if ($i == "-s") {
+ spc = 1;
+ } else {
+ printf "\t{ \"%s\", %d, %d },\n", $i, NR-1, spc
+ spc = 0;
+ }
}}' $temp
-echo ' { NULL, 0 }
+echo ' { NULL, 0, 0 }
};'
exec > ${objdir}/builtins.h
@@ -85,6 +90,7 @@ echo '
struct builtincmd {
char *name;
int code;
+ int special;
};
extern int (*const builtinfunc[])(int, char **);
OpenPOWER on IntegriCloud