sh.parse.c revision 65b0c20e9bbaf87a200ce20a4decf18585e61a25
08cb74ca432a8c24e39f17dedce527e6a47b8001jerenkrantz * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
e9f8410b788ef1e6f1baed6c706ffdf3da395a16jerenkrantz * Use is subject to license terms.
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
e9f8410b788ef1e6f1baed6c706ffdf3da395a16jerenkrantz/* All Rights Reserved */
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * Copyright (c) 1980 Regents of the University of California.
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * All rights reserved. The Berkeley Software License Agreement
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * specifies the terms and conditions for redistribution.
e9f8410b788ef1e6f1baed6c706ffdf3da395a16jerenkrantz#pragma ident "%Z%%M% %I% %E% SMI"
e9f8410b788ef1e6f1baed6c706ffdf3da395a16jerenkrantzstruct command *syn0(struct wordent *, struct wordent *, int);
e9f8410b788ef1e6f1baed6c706ffdf3da395a16jerenkrantzstruct command *syn1(struct wordent *, struct wordent *, int);
e9f8410b788ef1e6f1baed6c706ffdf3da395a16jerenkrantzstruct command *syn1a(struct wordent *, struct wordent *, int);
503a01a4a003a5fe8b4d9a4ca93fe3874160ec38jimstruct command *syn1b(struct wordent *, struct wordent *, int);
503a01a4a003a5fe8b4d9a4ca93fe3874160ec38jimstruct command *syn2(struct wordent *, struct wordent *, int);
503a01a4a003a5fe8b4d9a4ca93fe3874160ec38jimstruct command *syn3(struct wordent *, struct wordent *, int);
503a01a4a003a5fe8b4d9a4ca93fe3874160ec38jimstruct wordent *freenod(struct wordent *, struct wordent *);
e9f8410b788ef1e6f1baed6c706ffdf3da395a16jerenkrantz * Perform aliasing on the word list lex
e9f8410b788ef1e6f1baed6c706ffdf3da395a16jerenkrantz * Do a (very rudimentary) parse to separate into commands.
e9f8410b788ef1e6f1baed6c706ffdf3da395a16jerenkrantz * If word 0 of a command has an alias, do it.
e9f8410b788ef1e6f1baed6c706ffdf3da395a16jerenkrantz * Repeat a maximum of 20 times.
503a01a4a003a5fe8b4d9a4ca93fe3874160ec38jim /* if (any(p1->word[0], ";&\n")) */ /* For char -> tchar */
struct wordent *p;
#ifdef TRACE
switch (p->word[0]) {
p = p->next;
bool redid;
#ifdef TRACE
if (ap == 0)
alvec = 0;
if (err) {
struct wordent *
#ifdef TRACE
return (retp);
struct command *
#ifdef TRACE
struct command *
struct wordent *p;
#ifdef TRACE
switch (p->word[0]) {
p = p->next;
t1 = t;
t->t_dflg = 0;
struct command *
struct wordent *p;
struct command *t;
#ifdef TRACE
switch (p->word[0]) {
if (t->t_dcdr == 0)
struct command *
struct wordent *p;
struct command *t;
#ifdef TRACE
switch (p->word[0]) {
t->t_dflg = 0;
struct command *
struct wordent *p;
struct command *t;
#ifdef TRACE
switch (p->word[0]) {
t->t_dflg = 0;
struct command *
struct command *t;
#ifdef TRACE
switch (p->word[0]) {
f |= PDIAG;
p = pn;
struct command *
struct wordent *p;
struct command *t;
bool specp = 0;
#ifdef TRACE
p = p1;
case ZELSE:
p = p->next;
if (p != p2)
goto again;
case ZEXIT:
case ZFOREACH:
case ZIF:
case ZLET:
case ZSET:
case ZSWITCH:
case ZWHILE:
switch (p->word[0]) {
if (specp)
if (specp)
if (specp)
if (!specp && l != 0)
lp = 0;
rp = 0;
c = p->word[0];
goto savep;
rp = p;
goto savep;
goto savep;
goto badout;
p = p->next;
goto missfile;
goto savep;
goto missfile;
p = p->next;
goto missfile;
if (!specp)
if (l != 0 && !specp)
if (err == 0)
#ifdef TRACE
switch (t->t_dtyp) {
case TCOM:
if (t->cfname)
if (t->cargs)
goto lr;
case TPAR:
lr:
case TAND:
case TOR:
case TFIL:
case TLST:
xfree(t);
char **av;