diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Src/exec.c | 34 | ||||
-rw-r--r-- | Src/glob.c | 14 | ||||
-rw-r--r-- | Src/lex.c | 4 | ||||
-rw-r--r-- | Src/parse.c | 50 | ||||
-rw-r--r-- | Src/text.c | 34 | ||||
-rw-r--r-- | Src/zsh.h | 42 |
7 files changed, 95 insertions, 89 deletions
diff --git a/ChangeLog b/ChangeLog index 9b775cb85..1d92ddd1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-12-05 Peter Stephenson <pws@csr.com> + + * Joel Smith <jsmith@caldera.com>: 13230: Src/exec.c, Src/glob.c, + Src/lex.c, Src/parse.c, Src/text.c, Src/zsh.h: avoid name clashes + with Linux kernel. + 2000-12-04 Bart Schaefer <schaefer@zsh.org> * 13229: Doc/Makefile.in: Include mod_term*.yo in MODDOCSRC. diff --git a/Src/exec.c b/Src/exec.c index 267625807..dc57291dc 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1786,7 +1786,7 @@ execcmd(Estate state, int input, int output, int how, int last1) args = newlinklist(); addlinknode(args, dupstring(":")); } else if (readnullcmd && *readnullcmd && - ((Redir) peekfirst(redir))->type == READ && + ((Redir) peekfirst(redir))->type == REDIR_READ && !nextnode(firstnode(redir))) { if (!args) args = newlinklist(); @@ -2068,16 +2068,16 @@ execcmd(Estate state, int input, int output, int how, int last1) /* Do io redirections */ while (redir && nonempty(redir)) { fn = (Redir) ugetnode(redir); - DPUTS(fn->type == HEREDOC || fn->type == HEREDOCDASH, + DPUTS(fn->type == REDIR_HEREDOC || fn->type == REDIR_HEREDOCDASH, "BUG: unexpanded here document"); - if (fn->type == INPIPE) { + if (fn->type == REDIR_INPIPE) { if (fn->fd2 == -1) { closemnodes(mfds); fixfds(save); execerr(); } addfd(forked, save, mfds, fn->fd1, fn->fd2, 0); - } else if (fn->type == OUTPIPE) { + } else if (fn->type == REDIR_OUTPIPE) { if (fn->fd2 == -1) { closemnodes(mfds); fixfds(save); @@ -2085,7 +2085,7 @@ execcmd(Estate state, int input, int output, int how, int last1) } addfd(forked, save, mfds, fn->fd1, fn->fd2, 1); } else { - if (fn->type != HERESTR && xpandredir(fn, redir)) + if (fn->type != REDIR_HERESTR && xpandredir(fn, redir)) continue; if (errflag) { closemnodes(mfds); @@ -2099,7 +2099,7 @@ execcmd(Estate state, int input, int output, int how, int last1) if (unset(EXECOPT)) continue; switch(fn->type) { - case HERESTR: + case REDIR_HERESTR: fil = getherestr(fn); if (fil == -1) { closemnodes(mfds); @@ -2110,9 +2110,9 @@ execcmd(Estate state, int input, int output, int how, int last1) } addfd(forked, save, mfds, fn->fd1, fil, 0); break; - case READ: - case READWRITE: - if (fn->type == READ) + case REDIR_READ: + case REDIR_READWRITE: + if (fn->type == REDIR_READ) fil = open(unmeta(fn->name), O_RDONLY | O_NOCTTY); else fil = open(unmeta(fn->name), @@ -2131,14 +2131,14 @@ execcmd(Estate state, int input, int output, int how, int last1) isset(SHINSTDIN) && interact && !zleactive) init_io(); break; - case CLOSE: + case REDIR_CLOSE: if (!forked && fn->fd1 < 10 && save[fn->fd1] == -2) save[fn->fd1] = movefd(fn->fd1); closemn(mfds, fn->fd1); zclose(fn->fd1); break; - case MERGEIN: - case MERGEOUT: + case REDIR_MERGEIN: + case REDIR_MERGEOUT: if (fn->fd2 < 10) closemn(mfds, fn->fd2); if (fn->fd2 > 9 && @@ -2150,7 +2150,7 @@ execcmd(Estate state, int input, int output, int how, int last1) } else { int fd = fn->fd2; if(fd == -2) - fd = (fn->type == MERGEOUT) ? coprocout : coprocin; + fd = (fn->type == REDIR_MERGEOUT) ? coprocout : coprocin; fil = dup(fd); } if (fil == -1) { @@ -2163,7 +2163,7 @@ execcmd(Estate state, int input, int output, int how, int last1) zwarn("%s: %e", fn->fd2 == -2 ? "coprocess" : fdstr, errno); execerr(); } - addfd(forked, save, mfds, fn->fd1, fil, fn->type == MERGEOUT); + addfd(forked, save, mfds, fn->fd1, fil, fn->type == REDIR_MERGEOUT); break; default: if (IS_APPEND_REDIR(fn->type)) @@ -2578,7 +2578,7 @@ gethere(char *str, int typ) qt = 1; } untokenize(str); - if (typ == HEREDOCDASH) { + if (typ == REDIR_HEREDOCDASH) { strip = 1; while (*str == '\t') str++; @@ -2670,7 +2670,7 @@ getoutput(char *cmd, int qt) wc_code(pc[1]) == WC_SUBLIST && !WC_SUBLIST_FLAGS(pc[1]) && WC_SUBLIST_TYPE(pc[1]) == WC_SUBLIST_END && wc_code(pc[2]) == WC_PIPE && WC_PIPE_TYPE(pc[2]) == WC_PIPE_END && - wc_code(pc[3]) == WC_REDIR && WC_REDIR_TYPE(pc[3]) == READ && + wc_code(pc[3]) == WC_REDIR && WC_REDIR_TYPE(pc[3]) == REDIR_READ && !pc[4] && wc_code(pc[6]) == WC_SIMPLE && !WC_SIMPLE_ARGC(pc[6])) { /* $(< word) */ @@ -2990,7 +2990,7 @@ spawnpipes(LinkList l) n = firstnode(l); for (; n; incnode(n)) { f = (Redir) getdata(n); - if (f->type == OUTPIPE || f->type == INPIPE) { + if (f->type == REDIR_OUTPIPE || f->type == REDIR_INPIPE) { str = f->name; f->fd2 = getpipe(str); } diff --git a/Src/glob.c b/Src/glob.c index 5e6283ed0..8f2f54952 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -1626,9 +1626,9 @@ xpandredir(struct redir *fn, LinkList tab) char *s = peekfirst(&fake); fn->name = s; untokenize(s); - if (fn->type == MERGEIN || fn->type == MERGEOUT) { + if (fn->type == REDIR_MERGEIN || fn->type == REDIR_MERGEOUT) { if (s[0] == '-' && !s[1]) - fn->type = CLOSE; + fn->type = REDIR_CLOSE; else if (s[0] == 'p' && !s[1]) fn->fd2 = -2; else { @@ -1636,17 +1636,17 @@ xpandredir(struct redir *fn, LinkList tab) s++; if (!*s && s > fn->name) fn->fd2 = zstrtol(fn->name, NULL, 10); - else if (fn->type == MERGEIN) + else if (fn->type == REDIR_MERGEIN) zerr("file number expected", NULL, 0); else - fn->type = ERRWRITE; + fn->type = REDIR_ERRWRITE; } } - } else if (fn->type == MERGEIN) + } else if (fn->type == REDIR_MERGEIN) zerr("file number expected", NULL, 0); else { - if (fn->type == MERGEOUT) - fn->type = ERRWRITE; + if (fn->type == REDIR_MERGEOUT) + fn->type = REDIR_ERRWRITE; while ((nam = (char *)ugetnode(&fake))) { /* Loop over matches, duplicating the * * redirection for each file found. */ diff --git a/Src/lex.c b/Src/lex.c index 747dc32fb..9a066b915 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -349,13 +349,13 @@ yylex(void) char *name; hwbegin(0); - cmdpush(hdocs->type == HEREDOC ? CS_HEREDOC : CS_HEREDOCD); + cmdpush(hdocs->type == REDIR_HEREDOC ? CS_HEREDOC : CS_HEREDOCD); STOPHIST name = gethere(hdocs->str, hdocs->type); ALLOWHIST cmdpop(); hwend(); - setheredoc(hdocs->pc, HERESTR, name); + setheredoc(hdocs->pc, REDIR_HERESTR, name); zfree(hdocs, sizeof(struct heredocs)); hdocs = next; } diff --git a/Src/parse.c b/Src/parse.c index 15f1eba41..fafe65f43 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -707,7 +707,7 @@ par_pline(int *complex) for (r = p + 1; wc_code(ecbuf[r]) == WC_REDIR; r += 3); ecispace(r, 3); - ecbuf[r] = WCB_REDIR(MERGEOUT); + ecbuf[r] = WCB_REDIR(REDIR_MERGEOUT); ecbuf[r + 1] = 2; ecbuf[r + 2] = ecstrcode("1"); @@ -1572,21 +1572,21 @@ par_simple(int *complex, int nr) */ static int redirtab[TRINANG - OUTANG + 1] = { - WRITE, - WRITENOW, - APP, - APPNOW, - READ, - READWRITE, - HEREDOC, - HEREDOCDASH, - MERGEIN, - MERGEOUT, - ERRWRITE, - ERRWRITENOW, - ERRAPP, - ERRAPPNOW, - HERESTR, + REDIR_WRITE, + REDIR_WRITENOW, + REDIR_APP, + REDIR_APPNOW, + REDIR_READ, + REDIR_READWRITE, + REDIR_HEREDOC, + REDIR_HEREDOCDASH, + REDIR_MERGEIN, + REDIR_MERGEOUT, + REDIR_ERRWRITE, + REDIR_ERRWRITENOW, + REDIR_ERRAPP, + REDIR_ERRAPPNOW, + REDIR_HERESTR, }; /**/ @@ -1616,8 +1616,8 @@ par_redir(int *rp) name = tokstr; switch (type) { - case HEREDOC: - case HEREDOCDASH: { + case REDIR_HEREDOC: + case REDIR_HEREDOCDASH: { /* <<[-] name */ struct heredocs **hd; @@ -1638,24 +1638,24 @@ par_redir(int *rp) yylex(); return; } - case WRITE: - case WRITENOW: + case REDIR_WRITE: + case REDIR_WRITENOW: if (tokstr[0] == Outang && tokstr[1] == Inpar) /* > >(...) */ - type = OUTPIPE; + type = REDIR_OUTPIPE; else if (tokstr[0] == Inang && tokstr[1] == Inpar) YYERRORV(ecused); break; - case READ: + case REDIR_READ: if (tokstr[0] == Inang && tokstr[1] == Inpar) /* < <(...) */ - type = INPIPE; + type = REDIR_INPIPE; else if (tokstr[0] == Outang && tokstr[1] == Inpar) YYERRORV(ecused); break; - case READWRITE: + case REDIR_READWRITE: if ((tokstr[0] == Inang || tokstr[0] == Outang) && tokstr[1] == Inpar) - type = tokstr[0] == Inang ? INPIPE : OUTPIPE; + type = tokstr[0] == Inang ? REDIR_INPIPE : REDIR_OUTPIPE; break; } yylex(); diff --git a/Src/text.c b/Src/text.c index 56454c16a..27d16d378 100644 --- a/Src/text.c +++ b/Src/text.c @@ -731,26 +731,26 @@ getredirs(LinkList redirs) Redir f = (Redir) getdata(n); switch (f->type) { - case WRITE: - case WRITENOW: - case APP: - case APPNOW: - case ERRWRITE: - case ERRWRITENOW: - case ERRAPP: - case ERRAPPNOW: - case READ: - case READWRITE: - case HERESTR: - case MERGEIN: - case MERGEOUT: - case INPIPE: - case OUTPIPE: + case REDIR_WRITE: + case REDIR_WRITENOW: + case REDIR_APP: + case REDIR_APPNOW: + case REDIR_ERRWRITE: + case REDIR_ERRWRITENOW: + case REDIR_ERRAPP: + case REDIR_ERRAPPNOW: + case REDIR_READ: + case REDIR_READWRITE: + case REDIR_HERESTR: + case REDIR_MERGEIN: + case REDIR_MERGEOUT: + case REDIR_INPIPE: + case REDIR_OUTPIPE: if (f->fd1 != (IS_READFD(f->type) ? 0 : 1)) taddchr('0' + f->fd1); taddstr(fstr[f->type]); taddchr(' '); - if (f->type == HERESTR) { + if (f->type == REDIR_HERESTR) { taddchr('\''); taddstr(bslashquote(f->name, NULL, 1)); taddchr('\''); @@ -759,7 +759,7 @@ getredirs(LinkList redirs) taddchr(' '); break; #ifdef DEBUG - case CLOSE: + case REDIR_CLOSE: DPUTS(1, "BUG: CLOSE in getredirs()"); taddchr(f->fd1 + '0'); taddstr(">&- "); diff --git a/Src/zsh.h b/Src/zsh.h index c4642434b..1d332f16c 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -233,31 +233,31 @@ enum { * below. */ enum { - WRITE, /* > */ - WRITENOW, /* >| */ - APP, /* >> */ - APPNOW, /* >>| */ - ERRWRITE, /* &>, >& */ - ERRWRITENOW, /* >&| */ - ERRAPP, /* >>& */ - ERRAPPNOW, /* >>&| */ - READWRITE, /* <> */ - READ, /* < */ - HEREDOC, /* << */ - HEREDOCDASH, /* <<- */ - HERESTR, /* <<< */ - MERGEIN, /* <&n */ - MERGEOUT, /* >&n */ - CLOSE, /* >&-, <&- */ - INPIPE, /* < <(...) */ - OUTPIPE /* > >(...) */ + REDIR_WRITE, /* > */ + REDIR_WRITENOW, /* >| */ + REDIR_APP, /* >> */ + REDIR_APPNOW, /* >>| */ + REDIR_ERRWRITE, /* &>, >& */ + REDIR_ERRWRITENOW, /* >&| */ + REDIR_ERRAPP, /* >>& */ + REDIR_ERRAPPNOW, /* >>&| */ + REDIR_READWRITE, /* <> */ + REDIR_READ, /* < */ + REDIR_HEREDOC, /* << */ + REDIR_HEREDOCDASH, /* <<- */ + REDIR_HERESTR, /* <<< */ + REDIR_MERGEIN, /* <&n */ + REDIR_MERGEOUT, /* >&n */ + REDIR_CLOSE, /* >&-, <&- */ + REDIR_INPIPE, /* < <(...) */ + REDIR_OUTPIPE /* > >(...) */ }; -#define IS_WRITE_FILE(X) ((X)>=WRITE && (X)<=READWRITE) +#define IS_WRITE_FILE(X) ((X)>=REDIR_WRITE && (X)<=REDIR_READWRITE) #define IS_APPEND_REDIR(X) (IS_WRITE_FILE(X) && ((X) & 2)) #define IS_CLOBBER_REDIR(X) (IS_WRITE_FILE(X) && ((X) & 1)) -#define IS_ERROR_REDIR(X) ((X)>=ERRWRITE && (X)<=ERRAPPNOW) -#define IS_READFD(X) (((X)>=READWRITE && (X)<=MERGEIN) || (X)==INPIPE) +#define IS_ERROR_REDIR(X) ((X)>=REDIR_ERRWRITE && (X)<=REDIR_ERRAPPNOW) +#define IS_READFD(X) (((X)>=REDIR_READWRITE && (X)<=REDIR_MERGEIN) || (X)==REDIR_INPIPE) #define IS_REDIROP(X) ((X)>=OUTANG && (X)<=TRINANG) /* Flags for input stack */ |