"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "sh.lex.c" between
tcsh-6.22.02.tar.gz and tcsh-6.22.03.tar.gz

About: Tcsh is a version of the Berkeley C-Shell, with the addition of: A command line editor, command and file name completion, listing, ...

sh.lex.c  (tcsh-6.22.02):sh.lex.c  (tcsh-6.22.03)
skipping to change at line 185 skipping to change at line 185
new = xmalloc(sizeof(*new)); new = xmalloc(sizeof(*new));
new->word = NULL; new->word = NULL;
new->prev = wdp; new->prev = wdp;
new->next = hp; new->next = hp;
wdp->next = new; wdp->next = new;
hp->prev = new; hp->prev = new;
wdp = new; wdp = new;
wdp->word = word(parsehtime); wdp->word = word(parsehtime);
parsehtime = 0; parsehtime = 0;
if (enterhist && toolong++ > 10 * 1024) if (enterhist && toolong++ > 10 * 1024) {
stderror(ERR_LTOOLONG); stderror(ERR_LTOOLONG);
}
} while (wdp->word[0] != '\n'); } while (wdp->word[0] != '\n');
cleanup_ignore(hp); cleanup_ignore(hp);
cleanup_until(hp); cleanup_until(hp);
Strbuf_terminate(&histline); Strbuf_terminate(&histline);
if (histline.len != 0 && histline.s[histline.len - 1] == '\n') if (histline.len != 0 && histline.s[histline.len - 1] == '\n')
histline.s[histline.len - 1] = '\0'; histline.s[histline.len - 1] = '\0';
histvalid = 1; histvalid = 1;
return (hadhist); return (hadhist);
} }
skipping to change at line 303 skipping to change at line 304
{ {
eChar c, c1; eChar c, c1;
struct Strbuf wbuf = Strbuf_INIT; struct Strbuf wbuf = Strbuf_INIT;
Char hbuf[12]; Char hbuf[12];
int h; int h;
int dolflg; int dolflg;
int toolong = 0; int toolong = 0;
cleanup_push(&wbuf, Strbuf_cleanup); cleanup_push(&wbuf, Strbuf_cleanup);
loop: loop:
if (enterhist && toolong++ > 256 * 1024) if (enterhist && toolong++ > 256 * 1024) {
seterror(ERR_WTOOLONG); stderror(ERR_WTOOLONG);
}
while ((c = getC(DOALL)) == ' ' || c == '\t') while ((c = getC(DOALL)) == ' ' || c == '\t')
continue; continue;
if (cmap(c, _META | _ESC)) if (cmap(c, _META | _ESC))
switch (c) { switch (c) {
case '&': case '&':
case '|': case '|':
case '<': case '<':
case '>': case '>':
Strbuf_append1(&wbuf, c); Strbuf_append1(&wbuf, c);
c1 = getC(DOALL); c1 = getC(DOALL);
skipping to change at line 363 skipping to change at line 365
} }
if (c != (eChar)HIST) if (c != (eChar)HIST)
Strbuf_append1(&wbuf, '\\'); Strbuf_append1(&wbuf, '\\');
c |= QUOTE; c |= QUOTE;
default: default:
break; break;
} }
c1 = 0; c1 = 0;
dolflg = DOALL; dolflg = DOALL;
for (;;) { for (;;) {
if (enterhist && toolong++ > 256 * 1024) if (enterhist && toolong++ > 256 * 1024) {
seterror(ERR_WTOOLONG); stderror(ERR_WTOOLONG);
}
if (c1) { if (c1) {
if (c == c1) { if (c == c1) {
c1 = 0; c1 = 0;
dolflg = DOALL; dolflg = DOALL;
} }
else if (c == '\\') { else if (c == '\\') {
c = getC(0); c = getC(0);
/* /*
* PWP: this is dumb, but how all of the other shells work. If \ quotes * PWP: this is dumb, but how all of the other shells work. If \ quotes
* a character OUTSIDE of a set of ''s, why shouldn't it quote EVERY * a character OUTSIDE of a set of ''s, why shouldn't it quote EVERY
skipping to change at line 599 skipping to change at line 602
} }
if (c == ':') { if (c == ':') {
/* /*
* if the :g modifier is followed by a newline, then error right away! * if the :g modifier is followed by a newline, then error right away!
* -strike * -strike
*/ */
int gmodflag = 0, amodflag = 0; int gmodflag = 0, amodflag = 0;
do { do {
Strbuf_append1(&name, c), c = getC(DOEXCL); Strbuf_append1(&name, c), c = getC(DOEXCL), gmodflag = 0, amodflag = 0;
if (c == 'g' || c == 'a') { if (c == 'g' || c == 'a') {
if (c == 'g') if (c == 'g')
gmodflag++; gmodflag++;
else else
amodflag++; amodflag++;
Strbuf_append1(&name, c); c = getC(DOEXCL); Strbuf_append1(&name, c); c = getC(DOEXCL);
} }
if ((c == 'g' && !gmodflag) || (c == 'a' && !amodflag)) { if ((c == 'g' && !gmodflag) || (c == 'a' && !amodflag)) {
if (c == 'g') if (c == 'g')
gmodflag++; gmodflag++;
skipping to change at line 637 skipping to change at line 640
Strbuf_append1(&name, c); Strbuf_append1(&name, c);
if(c == delim) delimcnt--; if(c == delim) delimcnt--;
if(!delimcnt) break; if(!delimcnt) break;
} }
if(delimcnt) { if(delimcnt) {
seterror(ERR_BADSUBST); seterror(ERR_BADSUBST);
break; break;
} }
c = 's'; c = 's';
} }
if (!any("htrqxesul", c)) { if (!any(TCSH_MODIFIERS, c)) {
if ((amodflag || gmodflag) && c == '\n') if ((amodflag || gmodflag) && c == '\n')
stderror(ERR_VARSYN); /* strike */ stderror(ERR_VARSYN); /* strike */
seterror(ERR_BADMOD, c); seterror(ERR_BADMOD, c);
goto end; goto end;
} }
} }
while ((c = getC(DOEXCL)) == ':'); while ((c = getC(DOEXCL)) == ':');
ungetD(c); ungetD(c);
} }
else else
skipping to change at line 1022 skipping to change at line 1025
} }
} }
Char * Char *
domod(Char *cp, Char type) domod(Char *cp, Char type)
{ {
Char *wp, *xp; Char *wp, *xp;
int c; int c;
switch (type) { switch (type) {
case 'Q':
if (*cp == '\0')
return Strsave(STRQNULL);
/*FALLTHROUGH*/
case 'q': case 'q':
case 'x': case 'x':
wp = Strsave(cp); wp = Strsave(cp);
for (xp = wp; (c = *xp) != 0; xp++) for (xp = wp; (c = *xp) != 0; xp++)
if ((c != ' ' && c != '\t') || type == 'q') if ((c != ' ' && c != '\t') || type == 'q' || type == 'Q')
*xp |= QUOTE; *xp |= QUOTE;
return (wp); return (wp);
case 'l': case 'l':
wp = NLSChangeCase(cp, 1); wp = NLSChangeCase(cp, 1);
return wp ? wp : Strsave(cp); return wp ? wp : Strsave(cp);
case 'u': case 'u':
wp = NLSChangeCase(cp, 0); wp = NLSChangeCase(cp, 0);
return wp ? wp : Strsave(cp); return wp ? wp : Strsave(cp);
case 'h': case 'h':
case 't': case 't':
if (!any(short2str(cp), '/'))
return (type == 't' ? Strsave(cp) : 0);
wp = Strrchr(cp, '/'); wp = Strrchr(cp, '/');
if (type == 'h') if (wp == NULL)
xp = Strnsave(cp, wp - cp); return Strsave(type == 't' ? cp : STRNULL);
else if (type == 't')
xp = Strsave(wp + 1); xp = Strsave(wp + 1);
else
xp = Strnsave(cp, wp - cp);
return (xp); return (xp);
case 'e': case 'e':
case 'r': case 'r':
wp = Strend(cp); wp = Strend(cp);
for (wp--; wp >= cp && *wp != '/'; wp--) for (wp--; wp >= cp && *wp != '/'; wp--)
if (*wp == '.') { if (*wp == '.') {
if (type == 'e') if (type == 'e')
xp = Strsave(wp + 1); xp = Strsave(wp + 1);
else else
xp = Strnsave(cp, wp - cp); xp = Strnsave(cp, wp - cp);
return (xp); return (xp);
} }
return (Strsave(type == 'e' ? STRNULL : cp)); return (Strsave(type == 'e' ? STRNULL : cp));
default: default:
break; break;
} }
return (0); return (0);
} }
static int static int
matchs(const Char *str, const Char *pat) matchs(const Char *str, const Char *pat)
{ {
while (*str && *pat && *str == *pat) while (*str && *pat && *str == *pat)
 End of changes. 12 change blocks. 
14 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)