* Modified by Bill Joy Oct 14, 1976
* interactive (login shell) option "-i"
* shells with input and output tty's ignore interrupts
* verbose option "-v" causes input commands to be echoed
* $* for all arguments $1 to end
* >* >>* and |* to put unit 2 there also
* `cmd1 ; ... ; cmdn &*' means `( cmd1 ; ... ; cmdn ) &'
* pascal objects are recognized and px's are forked
* working directory not searched for root
char glob
[] "/etc/glob2";
char acnm
[] "/usr/adm/sha\0\0\0";
char *numpt
&pidp
[sizeof pidp
- 1];
if ((uid
= getuid()) == 0)
if (*(cp
= v
[1]) == '-') {
if (nofile
== 0 && c
> 1) {
if (open(cp
= v
[1], 0) < 0) {
if ((ty
= ttyn(0)) != 'x' && ttyn(1) != 'x')
numpt
= &acnm
[sizeof acnm
- 1];
if ((acctf
= open(acnm
, 1)) >= 0 || echo
)
if ((cp
= accbuf
) != 0) {
*--numpt
= (i
% 10) | '0';
while((c
= readc()) != c1
) {
if (any(c
, " '\"\t;&<>()|^\n")) {
if (treep
> &trebuf
[TRESIZ
]) {
prs("Command line overflow\n");
if (argp
> &args
[ARGSIZ
-5]) {
while((c
=getc()) != '\n');
if (linep
> &line
[LINSIZ
-5]) {
while((c
=getc()) != '\n');
err("Too many characters");
if ((c
= *dolp
++) != '\0')
if ((c
= readc()) == '\\')
if ((c
= readc()) == '\n')
if (c
>= '0' && c
<= '9') {
else if ((c
= *arginp
++) == '\0') {
} else if (onelflg
== 1 || read(0, &cc
, 1) != 1)
else if ((c
= cc
) == '\n' && onelflg
)
* When fl=1 syn1 handles the vagarities of &*
error
++; /* too many ')'s */
t
[DFLG
] = FAND
|FPRS
|FINT
;
t
[DFLG
] =| FAND
|FPRS
|FINT
;
t1
[DFLG
] =| FAND
|FPRS
|FINT
;
t
[DRIT
] = syntax(p
+1, p2
);
if (p
!= p2
&& **p
== '*') {
* ( syn1@1 ) [ < in ] [ > out ]
* word word* [ < in ] [ > out ]
if (p
!= p2
&& **p
== '*') {
t
[DSPR
] = syn1(lp
, rp
, 1);
prs("wait: interrupted\n");
register char *cp1
, *cp2
;
if (equal(cp1
, "gimme")) {
if (equal(cp1
, "normal")) {
if (equal(cp1
, "chdir") || equal(cp1
, "cd")) {
if (chdir(t
[DCOM
+1]) < 0) {
if (equal(cp1
, "shift")) {
if (cp2
= *(t1
= &t
[DCOM
+1])) {
cp1
= lib
= sbrk(LIBSIZ
+1);
while(*cp1
++ = (*cp2
++ & 0177))
err("lib: path too long");
if (equal(cp1
, "wait")) {
if ((cp1
= t1
[DLEF
]) != 0) {
if ((cp2
= t1
[DRIT
]) != 0) {
if ((f
&FCAT
) != 0 && open(cp2
, 1) >= 0)
else if (creat(cp2
, 0644) < 0) {
if ((f
&FINT
)!=0 && t1
[DLEF
]==0 && (f
&FPIN
)==0) {
if ((f
&FINT
) == 0 && setintr
) {
prs("glob: cannot execute\n");
while(*cp1
&& *cp1
!= '/')
t1
[DFLG
] =| FPOU
| (f
&(FPIN
|FINT
|FPRS
|FDIAG
));
t1
[DFLG
] =| FPIN
| (f
&(FPOU
|FINT
|FAND
|FPRS
));
execv(f
, (t1
= &t
[DCOM
]));
if (read(i
, &w
, 2) == 2 && w
== PCXN
)
} else if (errno
==ENOMEM
) {
while ((c
= *cp
++) != '\0')
if (c
>= '0' && c
<= '9')