ash: some beautification work, no code changes
This commit is contained in:
parent
559691a3bf
commit
176d49d4f7
91
shell/ash.c
91
shell/ash.c
@ -2691,7 +2691,6 @@ SIT(int c, int syntax)
|
|||||||
indx = 0;
|
indx = 0;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#define U_C(c) ((unsigned char)(c))
|
|
||||||
|
|
||||||
if ((unsigned char)c >= (unsigned char)(CTLESC)
|
if ((unsigned char)c >= (unsigned char)(CTLESC)
|
||||||
&& (unsigned char)c <= (unsigned char)(CTLQUOTEMARK)
|
&& (unsigned char)c <= (unsigned char)(CTLQUOTEMARK)
|
||||||
@ -10663,7 +10662,9 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
|
|||||||
dqvarnest = 0;
|
dqvarnest = 0;
|
||||||
|
|
||||||
STARTSTACKSTR(out);
|
STARTSTACKSTR(out);
|
||||||
loop: { /* for each line, until end of word */
|
loop:
|
||||||
|
/* For each line, until end of word */
|
||||||
|
{
|
||||||
CHECKEND(); /* set c to PEOF if at end of here document */
|
CHECKEND(); /* set c to PEOF if at end of here document */
|
||||||
for (;;) { /* until end of line or end of word */
|
for (;;) { /* until end of line or end of word */
|
||||||
CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
|
CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
|
||||||
@ -11310,55 +11311,51 @@ xxreadtoken(void)
|
|||||||
startlinno = plinno;
|
startlinno = plinno;
|
||||||
for (;;) { /* until token or start of word found */
|
for (;;) { /* until token or start of word found */
|
||||||
c = pgetc_macro();
|
c = pgetc_macro();
|
||||||
|
if (c == ' ' || c == '\t' USE_ASH_ALIAS( || c == PEOA))
|
||||||
|
continue;
|
||||||
|
|
||||||
if ((c != ' ') && (c != '\t')
|
if (c == '#') {
|
||||||
#if ENABLE_ASH_ALIAS
|
while ((c = pgetc()) != '\n' && c != PEOF)
|
||||||
&& (c != PEOA)
|
continue;
|
||||||
#endif
|
pungetc();
|
||||||
) {
|
} else if (c == '\\') {
|
||||||
if (c == '#') {
|
if (pgetc() != '\n') {
|
||||||
while ((c = pgetc()) != '\n' && c != PEOF)
|
|
||||||
continue;
|
|
||||||
pungetc();
|
pungetc();
|
||||||
} else if (c == '\\') {
|
goto READTOKEN1;
|
||||||
if (pgetc() != '\n') {
|
|
||||||
pungetc();
|
|
||||||
goto READTOKEN1;
|
|
||||||
}
|
|
||||||
startlinno = ++plinno;
|
|
||||||
if (doprompt)
|
|
||||||
setprompt(2);
|
|
||||||
} else {
|
|
||||||
const char *p
|
|
||||||
= xxreadtoken_chars + sizeof(xxreadtoken_chars) - 1;
|
|
||||||
|
|
||||||
if (c != PEOF) {
|
|
||||||
if (c == '\n') {
|
|
||||||
plinno++;
|
|
||||||
needprompt = doprompt;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = strchr(xxreadtoken_chars, c);
|
|
||||||
if (p == NULL) {
|
|
||||||
READTOKEN1:
|
|
||||||
return readtoken1(c, BASESYNTAX, (char *) NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((size_t)(p - xxreadtoken_chars) >= xxreadtoken_singles) {
|
|
||||||
if (pgetc() == *p) { /* double occurrence? */
|
|
||||||
p += xxreadtoken_doubles + 1;
|
|
||||||
} else {
|
|
||||||
pungetc();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lasttoken = xxreadtoken_tokens[p - xxreadtoken_chars];
|
|
||||||
return lasttoken;
|
|
||||||
}
|
}
|
||||||
|
startlinno = ++plinno;
|
||||||
|
if (doprompt)
|
||||||
|
setprompt(2);
|
||||||
|
} else {
|
||||||
|
const char *p;
|
||||||
|
|
||||||
|
p = xxreadtoken_chars + sizeof(xxreadtoken_chars) - 1;
|
||||||
|
if (c != PEOF) {
|
||||||
|
if (c == '\n') {
|
||||||
|
plinno++;
|
||||||
|
needprompt = doprompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = strchr(xxreadtoken_chars, c);
|
||||||
|
if (p == NULL) {
|
||||||
|
READTOKEN1:
|
||||||
|
return readtoken1(c, BASESYNTAX, (char *) NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((size_t)(p - xxreadtoken_chars) >= xxreadtoken_singles) {
|
||||||
|
if (pgetc() == *p) { /* double occurrence? */
|
||||||
|
p += xxreadtoken_doubles + 1;
|
||||||
|
} else {
|
||||||
|
pungetc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lasttoken = xxreadtoken_tokens[p - xxreadtoken_chars];
|
||||||
|
return lasttoken;
|
||||||
}
|
}
|
||||||
} /* for */
|
} /* for (;;) */
|
||||||
}
|
}
|
||||||
#else
|
#else /* old xxreadtoken */
|
||||||
#define RETURN(token) return lasttoken = token
|
#define RETURN(token) return lasttoken = token
|
||||||
static int
|
static int
|
||||||
xxreadtoken(void)
|
xxreadtoken(void)
|
||||||
@ -11428,7 +11425,7 @@ xxreadtoken(void)
|
|||||||
return readtoken1(c, BASESYNTAX, (char *)NULL, 0);
|
return readtoken1(c, BASESYNTAX, (char *)NULL, 0);
|
||||||
#undef RETURN
|
#undef RETURN
|
||||||
}
|
}
|
||||||
#endif /* NEW_xxreadtoken */
|
#endif /* old xxreadtoken */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
readtoken(void)
|
readtoken(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user