SCCS-vsn: bin/sh/Makefile 8.3
SCCS-vsn: bin/sh/nodes.c.pat 8.2
SCCS-vsn: bin/sh/mkbuiltins 8.2
SCCS-vsn: bin/sh/arith.y 8.3
SCCS-vsn: bin/sh/sh.1 8.6
SCCS-vsn: bin/sh/arith_lex.l 8.3
SCCS-vsn: bin/sh/builtins.def 8.4
-# @(#)Makefile 8.4 (Berkeley) %G%
+# @(#)Makefile 8.3 (Berkeley) %G%
PROG= sh
SRCS= alias.c builtins.c cd.c echo.c error.c eval.c exec.c expand.c \
PROG= sh
SRCS= alias.c builtins.c cd.c echo.c error.c eval.c exec.c expand.c \
-static char sccsid[] = "@(#)arith.y 8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)arith.y 8.3 (Berkeley) %G%";
#endif /* not lint */
#include "shell.h"
#endif /* not lint */
#include "shell.h"
char *arith_buf, *arith_startbuf;
char *arith_buf, *arith_startbuf;
/*
* The exp(1) builtin.
*/
/*
* The exp(1) builtin.
*/
-static char sccsid[] = "@(#)arith_lex.l 8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)arith_lex.l 8.3 (Berkeley) %G%";
extern yylval;
extern char *arith_buf, *arith_startbuf;
extern yylval;
extern char *arith_buf, *arith_startbuf;
. { error("arith: syntax error: \"%s\"\n", arith_startbuf); }
%%
. { error("arith: syntax error: \"%s\"\n", arith_startbuf); }
%%
arith_lex_reset() {
YY_NEW_FILE;
}
arith_lex_reset() {
YY_NEW_FILE;
}
#
# %sccs.include.redist.sh%
#
#
# %sccs.include.redist.sh%
#
-# @(#)builtins.def 8.3 (Berkeley) %G%
+# @(#)builtins.def 8.4 (Berkeley) %G%
#
# 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
#
# 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. The rest of the line
+# 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.
# 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.
exportcmd export readonly
#exprcmd expr test [
falsecmd false
exportcmd export readonly
#exprcmd expr test [
falsecmd false
fgcmd -j fg
getoptscmd getopts
hashcmd hash
fgcmd -j fg
getoptscmd getopts
hashcmd hash
#linecmd line
localcmd local
#nlechocmd nlecho
#linecmd line
localcmd local
#nlechocmd nlecho
pwdcmd pwd
readcmd read
returncmd return
pwdcmd pwd
readcmd read
returncmd return
waitcmd wait
#foocmd foo
aliascmd alias
waitcmd wait
#foocmd foo
aliascmd alias
#
# %sccs.include.redist.sh%
#
#
# %sccs.include.redist.sh%
#
-# @(#)mkbuiltins 8.1 (Berkeley) %G%
+# @(#)mkbuiltins 8.2 (Berkeley) %G%
temp=/tmp/ka$$
havejobs=0
if grep '^#define JOBS[ ]*1' shell.h > /dev/null
then havejobs=1
fi
temp=/tmp/ka$$
havejobs=0
if grep '^#define JOBS[ ]*1' shell.h > /dev/null
then havejobs=1
fi
+havehist=1
+if [ "X$1" = "X-h" ]; then
+ havehist=0
+ shift
+fi
+objdir=$1
+exec > ${objdir}/builtins.c
cat <<\!
/*
* This file was generated by the mkbuiltins program.
cat <<\!
/*
* This file was generated by the mkbuiltins program.
-awk '/^[^#]/ {if('$havejobs' || $2 != "-j") print $0}' builtins |
- sed 's/-j//' > $temp
+awk '/^[^#]/ {if(('$havejobs' || $2 != "-j") && ('$havehist' || $2 != "-h")) \
+ print $0}' builtins.def | sed 's/-j//' > $temp
awk '{ printf "int %s();\n", $1}' $temp
echo '
int (*const builtinfunc[])() = {'
awk '{ printf "int %s();\n", $1}' $temp
echo '
int (*const builtinfunc[])() = {'
const struct builtincmd builtincmd[] = {'
awk '{ for (i = 2 ; i <= NF ; i++) {
const struct builtincmd builtincmd[] = {'
awk '{ for (i = 2 ; i <= NF ; i++) {
- printf "\t\"%s\", %d,\n", $i, NR-1
+ printf "\t{ \"%s\", %d },\n", $i, NR-1
+exec > ${objdir}/builtins.h
cat <<\!
/*
* This file was generated by the mkbuiltins program.
cat <<\!
/*
* This file was generated by the mkbuiltins program.
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)nodes.c.pat 8.1 (Berkeley) %G%
+ * @(#)nodes.c.pat 8.2 (Berkeley) %G%
/*
* Routine for dealing with parsed shell commands.
*/
/*
* Routine for dealing with parsed shell commands.
*/
-int funcblocksize; /* size of structures in function */
-int funcstringsize; /* size of strings in node */
-#ifdef __STDC__
+int funcblocksize; /* size of structures in function */
+int funcstringsize; /* size of strings in node */
pointer funcblock; /* block to allocate function from */
pointer funcblock; /* block to allocate function from */
-#else
-char *funcblock; /* block to allocate function from */
-#endif
-char *funcstring; /* block to allocate strings from */
+char *funcstring; /* block to allocate strings from */
-#ifdef __STDC__
-STATIC void calcsize(union node *);
-STATIC void sizenodelist(struct nodelist *);
-STATIC union node *copynode(union node *);
-STATIC struct nodelist *copynodelist(struct nodelist *);
-STATIC char *nodesavestr(char *);
-#else
-STATIC void calcsize();
-STATIC void sizenodelist();
-STATIC union node *copynode();
-STATIC struct nodelist *copynodelist();
-STATIC char *nodesavestr();
-#endif
+STATIC void calcsize __P((union node *));
+STATIC void sizenodelist __P((struct nodelist *));
+STATIC union node *copynode __P((union node *));
+STATIC struct nodelist *copynodelist __P((struct nodelist *));
+STATIC char *nodesavestr __P((char *));
- union node *n;
- {
- if (n == NULL)
- return NULL;
- funcblocksize = 0;
- funcstringsize = 0;
- calcsize(n);
- funcblock = ckmalloc(funcblocksize + funcstringsize);
- funcstring = funcblock + funcblocksize;
- return copynode(n);
+ union node *n;
+{
+ if (n == NULL)
+ return NULL;
+ funcblocksize = 0;
+ funcstringsize = 0;
+ calcsize(n);
+ funcblock = ckmalloc(funcblocksize + funcstringsize);
+ funcstring = funcblock + funcblocksize;
+ return copynode(n);
}
STATIC void
calcsize(n)
}
STATIC void
calcsize(n)
- union node *n;
- {
- %CALCSIZE
+ union node *n;
+{
+ %CALCSIZE
}
STATIC void
sizenodelist(lp)
}
STATIC void
sizenodelist(lp)
- struct nodelist *lp;
- {
- while (lp) {
- funcblocksize += ALIGN(sizeof (struct nodelist));
- calcsize(lp->n);
- lp = lp->next;
- }
+ struct nodelist *lp;
+{
+ while (lp) {
+ funcblocksize += ALIGN(sizeof(struct nodelist));
+ calcsize(lp->n);
+ lp = lp->next;
+ }
}
STATIC union node *
copynode(n)
}
STATIC union node *
copynode(n)
- union node *n;
- {
- union node *new;
+ union node *n;
+{
+ union node *new;
}
STATIC struct nodelist *
copynodelist(lp)
}
STATIC struct nodelist *
copynodelist(lp)
- struct nodelist *lp;
- {
- struct nodelist *start;
- struct nodelist **lpp;
-
- lpp = &start;
- while (lp) {
- *lpp = funcblock;
- funcblock += ALIGN(sizeof (struct nodelist));
- (*lpp)->n = copynode(lp->n);
- lp = lp->next;
- lpp = &(*lpp)->next;
- }
- *lpp = NULL;
- return start;
+ struct nodelist *lp;
+{
+ struct nodelist *start;
+ struct nodelist **lpp;
+
+ lpp = &start;
+ while (lp) {
+ *lpp = funcblock;
+ funcblock += ALIGN(sizeof(struct nodelist));
+ (*lpp)->n = copynode(lp->n);
+ lp = lp->next;
+ lpp = &(*lpp)->next;
+ }
+ *lpp = NULL;
+ return start;
}
STATIC char *
nodesavestr(s)
}
STATIC char *
nodesavestr(s)
- char *s;
- {
- register char *p = s;
- register char *q = funcstring;
- char *rtn = funcstring;
-
- while (*q++ = *p++);
- funcstring = q;
- return rtn;
+ char *s;
+{
+ register char *p = s;
+ register char *q = funcstring;
+ char *rtn = funcstring;
+
+ while ((*q++ = *p++) != '\0')
+ continue;
+ funcstring = q;
+ return rtn;
- union node *n;
- {
- if (n)
- ckfree(n);
+ union node *n;
+{
+ if (n)
+ ckfree(n);
.\"
.\" %sccs.include.redist.man%
.\"
.\"
.\" %sccs.include.redist.man%
.\"
-.\" @(#)sh.1 8.5 (Berkeley) %G%
+.\" @(#)sh.1 8.6 (Berkeley) %G%
be builtin for efficiency (e.g. printf(1), echo(1), test(1),
etc).
.TP
be builtin for efficiency (e.g. printf(1), echo(1), test(1),
etc).
.TP
+:
+A null command that returns a 0 (true) exit value.
+.TP
+\&. file
+The commands in the specified file are read and executed by the shell.
+.TP
alias [ name[=string] ... ]
If name=string is specified, the shell defines the
alias ``name'' with value ``string''. If just ``name''
alias [ name[=string] ... ]
If name=string is specified, the shell defines the
alias ``name'' with value ``string''. If just ``name''
may be different either because the CDPATH mechanism
was used or because a symbolic link was crossed.
.TP
may be different either because the CDPATH mechanism
was used or because a symbolic link was crossed.
.TP
-\&. file
-The commands in the specified file are read and executed by the shell.
-.TP
eval string...
Concatenate all the arguments with spaces. Then
re-parse and execute the command.
eval string...
Concatenate all the arguments with spaces. Then
re-parse and execute the command.