aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-09-21 18:06:20 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-09-21 18:06:20 +0000
commitbcceb0c5a4a6b69225ae9b748df96e013996d9d3 (patch)
tree03fdf7b8b64d48662b34645c9c63ed5cd1f1b30e
parentfc5d15912cb4dafc585ef57b89531df58b0a9456 (diff)
downloadbusybox-w32-bcceb0c5a4a6b69225ae9b748df96e013996d9d3.tar.gz
busybox-w32-bcceb0c5a4a6b69225ae9b748df96e013996d9d3.tar.bz2
busybox-w32-bcceb0c5a4a6b69225ae9b748df96e013996d9d3.zip
ash: s/int/smallint/. -60 bytes.
-rw-r--r--shell/ash.c98
1 files changed, 47 insertions, 51 deletions
diff --git a/shell/ash.c b/shell/ash.c
index ec3e17618..167232c33 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2152,8 +2152,8 @@ padvance(const char **path, const char *name)
2152 2152
2153/* ============ Prompt */ 2153/* ============ Prompt */
2154 2154
2155static int doprompt; /* if set, prompt the user */ 2155static smallint doprompt; /* if set, prompt the user */
2156static int needprompt; /* true if interactive and at start of line */ 2156static smallint needprompt; /* true if interactive and at start of line */
2157 2157
2158#if ENABLE_FEATURE_EDITING 2158#if ENABLE_FEATURE_EDITING
2159static line_input_t *line_input_state; 2159static line_input_t *line_input_state;
@@ -2458,7 +2458,7 @@ pwdcmd(int argc, char **argv)
2458 2458
2459/* ============ ... */ 2459/* ============ ... */
2460 2460
2461#define IBUFSIZ (BUFSIZ + 1) 2461#define IBUFSIZ COMMON_BUFSIZE
2462#define basebuf bb_common_bufsiz1 /* buffer for top level input file */ 2462#define basebuf bb_common_bufsiz1 /* buffer for top level input file */
2463 2463
2464/* Syntax classes */ 2464/* Syntax classes */
@@ -8481,11 +8481,6 @@ enum {
8481 INPUT_NOFILE_OK = 2, 8481 INPUT_NOFILE_OK = 2,
8482}; 8482};
8483 8483
8484/*
8485 * NEOF is returned by parsecmd when it encounters an end of file. It
8486 * must be distinct from NULL, so we use the address of a variable that
8487 * happens to be handy.
8488 */
8489static int plinno = 1; /* input line number */ 8484static int plinno = 1; /* input line number */
8490/* number of characters left in input buffer */ 8485/* number of characters left in input buffer */
8491static int parsenleft; /* copy of parsefile->nleft */ 8486static int parsenleft; /* copy of parsefile->nleft */
@@ -8906,7 +8901,7 @@ setinputstring(char *string)
8906/* times of mailboxes */ 8901/* times of mailboxes */
8907static time_t mailtime[MAXMBOXES]; 8902static time_t mailtime[MAXMBOXES];
8908/* Set if MAIL or MAILPATH is changed. */ 8903/* Set if MAIL or MAILPATH is changed. */
8909static int mail_var_path_changed; 8904static smallint mail_var_path_changed;
8910 8905
8911/* 8906/*
8912 * Print appropriate message(s) if mail has arrived. 8907 * Print appropriate message(s) if mail has arrived.
@@ -8957,7 +8952,7 @@ chkmail(void)
8957static void 8952static void
8958changemail(const char *val) 8953changemail(const char *val)
8959{ 8954{
8960 mail_var_path_changed++; 8955 mail_var_path_changed = 1;
8961} 8956}
8962 8957
8963#endif /* ASH_MAIL */ 8958#endif /* ASH_MAIL */
@@ -9304,15 +9299,20 @@ getoptscmd(int argc, char **argv)
9304 9299
9305/* ============ Shell parser */ 9300/* ============ Shell parser */
9306 9301
9307static int tokpushback; /* last token pushed back */ 9302/*
9303 * NEOF is returned by parsecmd when it encounters an end of file. It
9304 * must be distinct from NULL, so we use the address of a variable that
9305 * happens to be handy.
9306 */
9307static smallint tokpushback; /* last token pushed back */
9308#define NEOF ((union node *)&tokpushback) 9308#define NEOF ((union node *)&tokpushback)
9309static int parsebackquote; /* nonzero if we are inside backquotes */ 9309static smallint parsebackquote; /* nonzero if we are inside backquotes */
9310static int lasttoken; /* last token read */ 9310static int lasttoken; /* last token read */
9311static char *wordtext; /* text of last word returned by readtoken */ 9311static char *wordtext; /* text of last word returned by readtoken */
9312static struct nodelist *backquotelist; 9312static struct nodelist *backquotelist;
9313static union node *redirnode; 9313static union node *redirnode;
9314static struct heredoc *heredoc; 9314static struct heredoc *heredoc;
9315static int quoteflag; /* set if (part of) last token was quoted */ 9315static smallint quoteflag; /* set if (part of) last token was quoted */
9316 9316
9317static void raise_error_syntax(const char *) ATTRIBUTE_NORETURN; 9317static void raise_error_syntax(const char *) ATTRIBUTE_NORETURN;
9318static void 9318static void
@@ -9406,7 +9406,7 @@ list(int nlflag)
9406 if (nlflag == 1) 9406 if (nlflag == 1)
9407 return n1; 9407 return n1;
9408 } else { 9408 } else {
9409 tokpushback++; 9409 tokpushback = 1;
9410 } 9410 }
9411 checkkwd = CHKNL | CHKKWD | CHKALIAS; 9411 checkkwd = CHKNL | CHKKWD | CHKALIAS;
9412 if (peektoken()) 9412 if (peektoken())
@@ -9421,7 +9421,7 @@ list(int nlflag)
9421 default: 9421 default:
9422 if (nlflag == 1) 9422 if (nlflag == 1)
9423 raise_error_unexpected_syntax(-1); 9423 raise_error_unexpected_syntax(-1);
9424 tokpushback++; 9424 tokpushback = 1;
9425 return n1; 9425 return n1;
9426 } 9426 }
9427 } 9427 }
@@ -9441,7 +9441,7 @@ andor(void)
9441 } else if (t == TOR) { 9441 } else if (t == TOR) {
9442 t = NOR; 9442 t = NOR;
9443 } else { 9443 } else {
9444 tokpushback++; 9444 tokpushback = 1;
9445 return n1; 9445 return n1;
9446 } 9446 }
9447 checkkwd = CHKNL | CHKKWD | CHKALIAS; 9447 checkkwd = CHKNL | CHKKWD | CHKALIAS;
@@ -9467,7 +9467,7 @@ pipeline(void)
9467 negate = !negate; 9467 negate = !negate;
9468 checkkwd = CHKKWD | CHKALIAS; 9468 checkkwd = CHKKWD | CHKALIAS;
9469 } else 9469 } else
9470 tokpushback++; 9470 tokpushback = 1;
9471 n1 = parse_command(); 9471 n1 = parse_command();
9472 if (readtoken() == TPIPE) { 9472 if (readtoken() == TPIPE) {
9473 pipenode = stalloc(sizeof(struct npipe)); 9473 pipenode = stalloc(sizeof(struct npipe));
@@ -9486,7 +9486,7 @@ pipeline(void)
9486 lp->next = NULL; 9486 lp->next = NULL;
9487 n1 = pipenode; 9487 n1 = pipenode;
9488 } 9488 }
9489 tokpushback++; 9489 tokpushback = 1;
9490 if (negate) { 9490 if (negate) {
9491 n2 = stalloc(sizeof(struct nnot)); 9491 n2 = stalloc(sizeof(struct nnot));
9492 n2->type = NNOT; 9492 n2->type = NNOT;
@@ -9644,7 +9644,7 @@ simplecmd(void)
9644 } 9644 }
9645 /* fall through */ 9645 /* fall through */
9646 default: 9646 default:
9647 tokpushback++; 9647 tokpushback = 1;
9648 goto out; 9648 goto out;
9649 } 9649 }
9650 } 9650 }
@@ -9698,7 +9698,7 @@ parse_command(void)
9698 n2->nif.elsepart = list(0); 9698 n2->nif.elsepart = list(0);
9699 else { 9699 else {
9700 n2->nif.elsepart = NULL; 9700 n2->nif.elsepart = NULL;
9701 tokpushback++; 9701 tokpushback = 1;
9702 } 9702 }
9703 t = TFI; 9703 t = TFI;
9704 break; 9704 break;
@@ -9751,7 +9751,7 @@ parse_command(void)
9751 * that the original Bourne shell only allowed NL). 9751 * that the original Bourne shell only allowed NL).
9752 */ 9752 */
9753 if (lasttoken != TNL && lasttoken != TSEMI) 9753 if (lasttoken != TNL && lasttoken != TSEMI)
9754 tokpushback++; 9754 tokpushback = 1;
9755 } 9755 }
9756 checkkwd = CHKNL | CHKKWD | CHKALIAS; 9756 checkkwd = CHKNL | CHKKWD | CHKALIAS;
9757 if (readtoken() != TDO) 9757 if (readtoken() != TDO)
@@ -9824,7 +9824,7 @@ parse_command(void)
9824 break; 9824 break;
9825 case TWORD: 9825 case TWORD:
9826 case TREDIR: 9826 case TREDIR:
9827 tokpushback++; 9827 tokpushback = 1;
9828 return simplecmd(); 9828 return simplecmd();
9829 } 9829 }
9830 9830
@@ -9840,7 +9840,7 @@ parse_command(void)
9840 rpp = &n2->nfile.next; 9840 rpp = &n2->nfile.next;
9841 parsefname(); 9841 parsefname();
9842 } 9842 }
9843 tokpushback++; 9843 tokpushback = 1;
9844 *rpp = NULL; 9844 *rpp = NULL;
9845 if (redir) { 9845 if (redir) {
9846 if (n1->type != NSUBSHELL) { 9846 if (n1->type != NSUBSHELL) {
@@ -9866,8 +9866,6 @@ parse_command(void)
9866 * will run code that appears at the end of readtoken1. 9866 * will run code that appears at the end of readtoken1.
9867 */ 9867 */
9868 9868
9869static int parsebackquote; /* nonzero if we are inside backquotes */
9870
9871#define CHECKEND() {goto checkend; checkend_return:;} 9869#define CHECKEND() {goto checkend; checkend_return:;}
9872#define PARSEREDIR() {goto parseredir; parseredir_return:;} 9870#define PARSEREDIR() {goto parseredir; parseredir_return:;}
9873#define PARSESUB() {goto parsesub; parsesub_return:;} 9871#define PARSESUB() {goto parsesub; parsesub_return:;}
@@ -9878,19 +9876,21 @@ static int parsebackquote; /* nonzero if we are inside backquotes */
9878static int 9876static int
9879readtoken1(int firstc, int syntax, char *eofmark, int striptabs) 9877readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
9880{ 9878{
9879 /* NB: syntax parameter fits into smallint */
9881 int c = firstc; 9880 int c = firstc;
9882 char *out; 9881 char *out;
9883 int len; 9882 int len;
9884 char line[EOFMARKLEN + 1]; 9883 char line[EOFMARKLEN + 1];
9885 struct nodelist *bqlist = 0; 9884 struct nodelist *bqlist;
9886 int quotef = 0; 9885 smallint quotef;
9887 int dblquote = 0; 9886 smallint dblquote;
9888 int varnest = 0; /* levels of variables expansion */ 9887 smallint oldstyle;
9889 int arinest = 0; /* levels of arithmetic expansion */ 9888 smallint prevsyntax; /* syntax before arithmetic */
9890 int parenlevel = 0; /* levels of parens in arithmetic */ 9889 int varnest; /* levels of variables expansion */
9891 int dqvarnest = 0; /* levels of variables expansion within double quotes */ 9890 int arinest; /* levels of arithmetic expansion */
9892 int oldstyle = 0; 9891 int parenlevel; /* levels of parens in arithmetic */
9893 int prevsyntax = 0; /* syntax before arithmetic */ 9892 int dqvarnest; /* levels of variables expansion within double quotes */
9893
9894#if __GNUC__ 9894#if __GNUC__
9895 /* Avoid longjmp clobbering */ 9895 /* Avoid longjmp clobbering */
9896 (void) &out; 9896 (void) &out;
@@ -9904,13 +9904,12 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
9904 (void) &prevsyntax; 9904 (void) &prevsyntax;
9905 (void) &syntax; 9905 (void) &syntax;
9906#endif 9906#endif
9907
9908 startlinno = plinno; 9907 startlinno = plinno;
9909 dblquote = 0;
9910 if (syntax == DQSYNTAX)
9911 dblquote = 1;
9912 quotef = 0;
9913 bqlist = NULL; 9908 bqlist = NULL;
9909 quotef = 0;
9910 dblquote = (syntax == DQSYNTAX);
9911 oldstyle = 0;
9912 prevsyntax = 0;
9914 varnest = 0; 9913 varnest = 0;
9915 arinest = 0; 9914 arinest = 0;
9916 parenlevel = 0; 9915 parenlevel = 0;
@@ -9961,7 +9960,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
9961 if (SIT(c, SQSYNTAX) == CCTL) 9960 if (SIT(c, SQSYNTAX) == CCTL)
9962 USTPUTC(CTLESC, out); 9961 USTPUTC(CTLESC, out);
9963 USTPUTC(c, out); 9962 USTPUTC(c, out);
9964 quotef++; 9963 quotef = 1;
9965 } 9964 }
9966 break; 9965 break;
9967 case CSQUOTE: 9966 case CSQUOTE:
@@ -9985,7 +9984,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
9985 syntax = BASESYNTAX; 9984 syntax = BASESYNTAX;
9986 dblquote = 0; 9985 dblquote = 0;
9987 } 9986 }
9988 quotef++; 9987 quotef = 1;
9989 goto quotemark; 9988 goto quotemark;
9990 } 9989 }
9991 break; 9990 break;
@@ -10017,10 +10016,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
10017 if (--arinest == 0) { 10016 if (--arinest == 0) {
10018 USTPUTC(CTLENDARI, out); 10017 USTPUTC(CTLENDARI, out);
10019 syntax = prevsyntax; 10018 syntax = prevsyntax;
10020 if (syntax == DQSYNTAX) 10019 dblquote = (syntax == DQSYNTAX);
10021 dblquote = 1;
10022 else
10023 dblquote = 0;
10024 } else 10020 } else
10025 USTPUTC(')', out); 10021 USTPUTC(')', out);
10026 } else { 10022 } else {
@@ -10306,17 +10302,17 @@ parsesub: {
10306 */ 10302 */
10307parsebackq: { 10303parsebackq: {
10308 struct nodelist **nlpp; 10304 struct nodelist **nlpp;
10309 int savepbq; 10305 smallint savepbq;
10310 union node *n; 10306 union node *n;
10311 char *volatile str; 10307 char *volatile str;
10312 struct jmploc jmploc; 10308 struct jmploc jmploc;
10313 struct jmploc *volatile savehandler; 10309 struct jmploc *volatile savehandler;
10314 size_t savelen; 10310 size_t savelen;
10315 int saveprompt = 0; 10311 smallint saveprompt = 0;
10312
10316#ifdef __GNUC__ 10313#ifdef __GNUC__
10317 (void) &saveprompt; 10314 (void) &saveprompt;
10318#endif 10315#endif
10319
10320 savepbq = parsebackquote; 10316 savepbq = parsebackquote;
10321 if (setjmp(jmploc.loc)) { 10317 if (setjmp(jmploc.loc)) {
10322 if (str) 10318 if (str)
@@ -10651,7 +10647,7 @@ readtoken(void)
10651{ 10647{
10652 int t; 10648 int t;
10653#if DEBUG 10649#if DEBUG
10654 int alreadyseen = tokpushback; 10650 smallint alreadyseen = tokpushback;
10655#endif 10651#endif
10656 10652
10657#if ENABLE_ASH_ALIAS 10653#if ENABLE_ASH_ALIAS
@@ -10717,7 +10713,7 @@ peektoken(void)
10717 int t; 10713 int t;
10718 10714
10719 t = readtoken(); 10715 t = readtoken();
10720 tokpushback++; 10716 tokpushback = 1;
10721 return tokname_array[t][0]; 10717 return tokname_array[t][0];
10722} 10718}
10723 10719
@@ -10740,7 +10736,7 @@ parsecmd(int interact)
10740 return NEOF; 10736 return NEOF;
10741 if (t == TNL) 10737 if (t == TNL)
10742 return NULL; 10738 return NULL;
10743 tokpushback++; 10739 tokpushback = 1;
10744 return list(1); 10740 return list(1);
10745} 10741}
10746 10742