aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-10-06 09:51:47 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-10-06 09:51:47 +0000
commit176d49d4f7bd1c049211c704018b1ac9d432f52e (patch)
tree465e449d540a7a96f47c7a54eb7540bcb6e94580
parent559691a3bfcb66ccf1cb59060d62d042e0265c00 (diff)
downloadbusybox-w32-176d49d4f7bd1c049211c704018b1ac9d432f52e.tar.gz
busybox-w32-176d49d4f7bd1c049211c704018b1ac9d432f52e.tar.bz2
busybox-w32-176d49d4f7bd1c049211c704018b1ac9d432f52e.zip
ash: some beautification work, no code changes
-rw-r--r--shell/ash.c79
1 files changed, 38 insertions, 41 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 9ccb1c9ee..962d5be02 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2691,7 +2691,6 @@ SIT(int c, int syntax)
2691 indx = 0; 2691 indx = 0;
2692 else 2692 else
2693#endif 2693#endif
2694#define U_C(c) ((unsigned char)(c))
2695 2694
2696 if ((unsigned char)c >= (unsigned char)(CTLESC) 2695 if ((unsigned char)c >= (unsigned char)(CTLESC)
2697 && (unsigned char)c <= (unsigned char)(CTLQUOTEMARK) 2696 && (unsigned char)c <= (unsigned char)(CTLQUOTEMARK)
@@ -10663,7 +10662,9 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
10663 dqvarnest = 0; 10662 dqvarnest = 0;
10664 10663
10665 STARTSTACKSTR(out); 10664 STARTSTACKSTR(out);
10666 loop: { /* for each line, until end of word */ 10665 loop:
10666 /* For each line, until end of word */
10667 {
10667 CHECKEND(); /* set c to PEOF if at end of here document */ 10668 CHECKEND(); /* set c to PEOF if at end of here document */
10668 for (;;) { /* until end of line or end of word */ 10669 for (;;) { /* until end of line or end of word */
10669 CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ 10670 CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
@@ -11310,55 +11311,51 @@ xxreadtoken(void)
11310 startlinno = plinno; 11311 startlinno = plinno;
11311 for (;;) { /* until token or start of word found */ 11312 for (;;) { /* until token or start of word found */
11312 c = pgetc_macro(); 11313 c = pgetc_macro();
11314 if (c == ' ' || c == '\t' USE_ASH_ALIAS( || c == PEOA))
11315 continue;
11313 11316
11314 if ((c != ' ') && (c != '\t') 11317 if (c == '#') {
11315#if ENABLE_ASH_ALIAS 11318 while ((c = pgetc()) != '\n' && c != PEOF)
11316 && (c != PEOA) 11319 continue;
11317#endif 11320 pungetc();
11318 ) { 11321 } else if (c == '\\') {
11319 if (c == '#') { 11322 if (pgetc() != '\n') {
11320 while ((c = pgetc()) != '\n' && c != PEOF)
11321 continue;
11322 pungetc(); 11323 pungetc();
11323 } else if (c == '\\') { 11324 goto READTOKEN1;
11324 if (pgetc() != '\n') { 11325 }
11325 pungetc(); 11326 startlinno = ++plinno;
11326 goto READTOKEN1; 11327 if (doprompt)
11327 } 11328 setprompt(2);
11328 startlinno = ++plinno; 11329 } else {
11329 if (doprompt) 11330 const char *p;
11330 setprompt(2);
11331 } else {
11332 const char *p
11333 = xxreadtoken_chars + sizeof(xxreadtoken_chars) - 1;
11334 11331
11335 if (c != PEOF) { 11332 p = xxreadtoken_chars + sizeof(xxreadtoken_chars) - 1;
11336 if (c == '\n') { 11333 if (c != PEOF) {
11337 plinno++; 11334 if (c == '\n') {
11338 needprompt = doprompt; 11335 plinno++;
11339 } 11336 needprompt = doprompt;
11337 }
11340 11338
11341 p = strchr(xxreadtoken_chars, c); 11339 p = strchr(xxreadtoken_chars, c);
11342 if (p == NULL) { 11340 if (p == NULL) {
11343 READTOKEN1: 11341 READTOKEN1:
11344 return readtoken1(c, BASESYNTAX, (char *) NULL, 0); 11342 return readtoken1(c, BASESYNTAX, (char *) NULL, 0);
11345 } 11343 }
11346 11344
11347 if ((size_t)(p - xxreadtoken_chars) >= xxreadtoken_singles) { 11345 if ((size_t)(p - xxreadtoken_chars) >= xxreadtoken_singles) {
11348 if (pgetc() == *p) { /* double occurrence? */ 11346 if (pgetc() == *p) { /* double occurrence? */
11349 p += xxreadtoken_doubles + 1; 11347 p += xxreadtoken_doubles + 1;
11350 } else { 11348 } else {
11351 pungetc(); 11349 pungetc();
11352 }
11353 } 11350 }
11354 } 11351 }
11355 lasttoken = xxreadtoken_tokens[p - xxreadtoken_chars];
11356 return lasttoken;
11357 } 11352 }
11353 lasttoken = xxreadtoken_tokens[p - xxreadtoken_chars];
11354 return lasttoken;
11358 } 11355 }
11359 } /* for */ 11356 } /* for (;;) */
11360} 11357}
11361#else 11358#else /* old xxreadtoken */
11362#define RETURN(token) return lasttoken = token 11359#define RETURN(token) return lasttoken = token
11363static int 11360static int
11364xxreadtoken(void) 11361xxreadtoken(void)
@@ -11428,7 +11425,7 @@ xxreadtoken(void)
11428 return readtoken1(c, BASESYNTAX, (char *)NULL, 0); 11425 return readtoken1(c, BASESYNTAX, (char *)NULL, 0);
11429#undef RETURN 11426#undef RETURN
11430} 11427}
11431#endif /* NEW_xxreadtoken */ 11428#endif /* old xxreadtoken */
11432 11429
11433static int 11430static int
11434readtoken(void) 11431readtoken(void)