Пример #1
0
static void
asyn0(struct wordent *p1, struct wordent *p2)
{
    struct wordent *p;
    int l;

    l = 0;
    for (p = p1; p != p2; p = p->next)
	switch (p->word[0]) {
	case '(':
	    l++;
	    continue;
	case ')':
	    l--;
	    if (l < 0)
		stderror(ERR_TOOMANYRP);
	    continue;
	case '>':
	    if (p->next != p2 && eq(p->next->word, STRand))
		p = p->next;
	    continue;
	case '&':
	case '|':
	case ';':
	case '\n':
	    if (l != 0)
		continue;
	    asyn3(p1, p);
	    asyntax(p->next, p2);
	    return;
	}
    if (l == 0)
	asyn3(p1, p2);
}
Пример #2
0
void
alias(struct wordent *lex)
{
    jmp_buf osetexit;

    aleft = ALEFT;
    hleft = HLEFT;
    getexit(osetexit);
    (void) setexit();
    if (haderr) {
	resexit(osetexit);
	reset();
    }
    if (--aleft == 0)
	stderror(ERR_ALIASLOOP);
    asyntax(lex->next, lex);
    resexit(osetexit);
}